58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <QFrame>
|
||
|
|
|
||
|
|
namespace Ui {
|
||
|
|
class FrameTitleBar;
|
||
|
|
}
|
||
|
|
|
||
|
|
class FrameTitleBar : public QFrame {
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
enum SysButton {
|
||
|
|
FTB_ICON = 0x01,
|
||
|
|
FTB_TTILE = 0x01 << 1,
|
||
|
|
FTB_MENU = 0x01 << 2,
|
||
|
|
FTB_SKIN = 0x01 << 3,
|
||
|
|
FTB_MIN = 0x01 << 4,
|
||
|
|
FTB_MAX = 0x01 << 5,
|
||
|
|
FTB_CLOSE = 0x01 << 6
|
||
|
|
};
|
||
|
|
|
||
|
|
public:
|
||
|
|
FrameTitleBar(QWidget* parent = 0);
|
||
|
|
~FrameTitleBar() override;
|
||
|
|
|
||
|
|
void SetTitle(const QString& title);
|
||
|
|
void SetMainWidget(QWidget* widget);
|
||
|
|
|
||
|
|
void OnMaximized(bool maximized);
|
||
|
|
|
||
|
|
class QPushButton* InsertPushButtonMenu(const QString& name, int index);
|
||
|
|
|
||
|
|
void InitSkinMemu();
|
||
|
|
void InitMenuWidget();
|
||
|
|
|
||
|
|
void SetSysButton(unsigned int sysBtn);
|
||
|
|
unsigned int GetSysteButton() const {
|
||
|
|
return ftbButton_;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void paintEvent(QPaintEvent* event) override;
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void OnMinBtnClicked();
|
||
|
|
void OnMaxBtnClicked();
|
||
|
|
void OnRestorClicked();
|
||
|
|
void OnCloseBtnClicked();
|
||
|
|
|
||
|
|
private:
|
||
|
|
Ui::FrameTitleBar* ui;
|
||
|
|
|
||
|
|
QWidget* mainWidget_{ nullptr };
|
||
|
|
class QBoxLayout* menuLayout_{ nullptr };
|
||
|
|
class QButtonGroup* buttonCourp_{ nullptr };
|
||
|
|
unsigned int ftbButton_{ 0 };
|
||
|
|
};
|