refactor: buttons and friends (#6102)
This commit is contained in:
@@ -16,10 +16,11 @@ typedef struct tagMSG MSG;
|
||||
namespace chatterino {
|
||||
|
||||
class Button;
|
||||
class EffectLabel;
|
||||
class LabelButton;
|
||||
class PixmapButton;
|
||||
class TitleBarButton;
|
||||
class TitleBarButtons;
|
||||
enum class TitleBarButtonStyle;
|
||||
enum class TitleBarButtonStyle : std::uint8_t;
|
||||
|
||||
class BaseWindow : public BaseWidget
|
||||
{
|
||||
@@ -52,9 +53,20 @@ public:
|
||||
|
||||
QWidget *getLayoutContainer();
|
||||
bool hasCustomWindowFrame() const;
|
||||
TitleBarButton *addTitleBarButton(const TitleBarButtonStyle &style,
|
||||
std::function<void()> onClicked);
|
||||
EffectLabel *addTitleBarLabel(std::function<void()> onClicked);
|
||||
|
||||
template <typename T>
|
||||
T *addTitleBarButton(std::function<void()> onClicked, auto &&...args)
|
||||
{
|
||||
auto *button = new T(std::forward<decltype(args)>(args)...);
|
||||
button->setScaleIndependentSize(30, 30);
|
||||
this->appendTitlebarButton(button);
|
||||
|
||||
QObject::connect(button, &T::leftClicked, this, std::move(onClicked));
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
LabelButton *addTitleBarLabel(std::function<void()> onClicked);
|
||||
|
||||
void moveTo(QPoint point, widgets::BoundsChecking mode);
|
||||
|
||||
@@ -169,6 +181,8 @@ private:
|
||||
bool handleNCHITTEST(MSG *msg, long *result);
|
||||
#endif
|
||||
|
||||
void appendTitlebarButton(Button *button);
|
||||
|
||||
bool enableCustomFrame_;
|
||||
bool frameless_;
|
||||
bool shown_ = false;
|
||||
|
||||
Reference in New Issue
Block a user