mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Moved out custom slider class with natural width to single place.
This commit is contained in:
parent
f4674389d5
commit
57d62423b3
5 changed files with 45 additions and 54 deletions
|
@ -36,10 +36,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/toast/toast.h"
|
||||
#include "ui/vertical_list.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/discrete_sliders.h"
|
||||
#include "ui/widgets/fields/number_input.h"
|
||||
#include "ui/widgets/label_with_custom_emoji.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/slider_natural_width.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_channel_earn.h"
|
||||
|
@ -577,25 +577,12 @@ void InnerWidget::fillHistory() {
|
|||
header->setSubTitle({});
|
||||
}
|
||||
|
||||
class Slider final : public Ui::SettingsSlider {
|
||||
public:
|
||||
using Ui::SettingsSlider::SettingsSlider;
|
||||
void setNaturalWidth(int w) {
|
||||
_naturalWidth = w;
|
||||
}
|
||||
int naturalWidth() const override {
|
||||
return _naturalWidth;
|
||||
}
|
||||
|
||||
private:
|
||||
int _naturalWidth = 0;
|
||||
|
||||
};
|
||||
|
||||
const auto slider = inner->add(
|
||||
object_ptr<Ui::SlideWrap<Slider>>(
|
||||
object_ptr<Ui::SlideWrap<Ui::CustomWidthSlider>>(
|
||||
inner,
|
||||
object_ptr<Slider>(inner, st::defaultTabsSlider)),
|
||||
object_ptr<Ui::CustomWidthSlider>(
|
||||
inner,
|
||||
st::defaultTabsSlider)),
|
||||
st::boxRowPadding);
|
||||
slider->toggle(!hasOneTab, anim::type::instant);
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/rect.h"
|
||||
#include "ui/vertical_list.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/discrete_sliders.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/slider_natural_width.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "styles/style_giveaway.h"
|
||||
#include "styles/style_info.h"
|
||||
|
@ -423,25 +423,12 @@ void InnerWidget::fill() {
|
|||
header->setSubTitle({});
|
||||
}
|
||||
|
||||
class Slider final : public Ui::SettingsSlider {
|
||||
public:
|
||||
using Ui::SettingsSlider::SettingsSlider;
|
||||
void setNaturalWidth(int w) {
|
||||
_naturalWidth = w;
|
||||
}
|
||||
int naturalWidth() const override {
|
||||
return _naturalWidth;
|
||||
}
|
||||
|
||||
private:
|
||||
int _naturalWidth = 0;
|
||||
|
||||
};
|
||||
|
||||
const auto slider = inner->add(
|
||||
object_ptr<Ui::SlideWrap<Slider>>(
|
||||
object_ptr<Ui::SlideWrap<Ui::CustomWidthSlider>>(
|
||||
inner,
|
||||
object_ptr<Slider>(inner, st::defaultTabsSlider)),
|
||||
object_ptr<Ui::CustomWidthSlider>(
|
||||
inner,
|
||||
st::defaultTabsSlider)),
|
||||
st::boxRowPadding);
|
||||
slider->toggle(!hasOneTab, anim::type::instant);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/vertical_list.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/discrete_sliders.h"
|
||||
#include "ui/widgets/slider_natural_width.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
|
@ -160,25 +160,12 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
|||
header->setSubTitle({});
|
||||
}
|
||||
|
||||
class Slider final : public Ui::SettingsSlider {
|
||||
public:
|
||||
using Ui::SettingsSlider::SettingsSlider;
|
||||
void setNaturalWidth(int w) {
|
||||
_naturalWidth = w;
|
||||
}
|
||||
int naturalWidth() const override {
|
||||
return _naturalWidth;
|
||||
}
|
||||
|
||||
private:
|
||||
int _naturalWidth = 0;
|
||||
|
||||
};
|
||||
|
||||
const auto slider = inner->add(
|
||||
object_ptr<Ui::SlideWrap<Slider>>(
|
||||
object_ptr<Ui::SlideWrap<Ui::CustomWidthSlider>>(
|
||||
inner,
|
||||
object_ptr<Slider>(inner, st::defaultTabsSlider)),
|
||||
object_ptr<Ui::CustomWidthSlider>(
|
||||
inner,
|
||||
st::defaultTabsSlider)),
|
||||
st::boxRowPadding);
|
||||
slider->toggle(!hasOneTab, anim::type::instant);
|
||||
|
||||
|
|
29
Telegram/SourceFiles/ui/widgets/slider_natural_width.h
Normal file
29
Telegram/SourceFiles/ui/widgets/slider_natural_width.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/widgets/discrete_sliders.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class CustomWidthSlider final : public SettingsSlider {
|
||||
public:
|
||||
using Ui::SettingsSlider::SettingsSlider;
|
||||
void setNaturalWidth(int w) {
|
||||
_naturalWidth = w;
|
||||
}
|
||||
int naturalWidth() const override {
|
||||
return _naturalWidth;
|
||||
}
|
||||
|
||||
private:
|
||||
int _naturalWidth = 0;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Ui
|
|
@ -404,6 +404,7 @@ PRIVATE
|
|||
ui/widgets/multi_select.h
|
||||
ui/widgets/sent_code_field.cpp
|
||||
ui/widgets/sent_code_field.h
|
||||
ui/widgets/slider_natural_width.h
|
||||
ui/widgets/vertical_drum_picker.cpp
|
||||
ui/widgets/vertical_drum_picker.h
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue