added mechanic for deleting a BaseWindow on focus out

This commit is contained in:
fourtf
2018-07-05 10:34:04 +02:00
parent 335cbf8758
commit f02a89690e
5 changed files with 60 additions and 44 deletions
+9 -4
View File
@@ -26,13 +26,13 @@ public:
EnableCustomFrame = 1,
Frameless = 2,
TopMost = 4,
DeleteOnFocusOut = 8,
DisableCustomScaling = 16,
FramelessDraggable = 32,
DisableCustomScaling = 8,
FramelessDraggable = 16,
};
enum ActionOnFocusLoss { Nothing, Delete, Close, Hide };
explicit BaseWindow(QWidget *parent = nullptr, Flags flags_ = None);
virtual ~BaseWindow() = default;
QWidget *getLayoutContainer();
bool hasCustomWindowFrame();
@@ -43,6 +43,9 @@ public:
void setStayInScreenRect(bool value);
bool getStayInScreenRect() const;
void setActionOnFocusLoss(ActionOnFocusLoss value);
ActionOnFocusLoss getActionOnFocusLoss() const;
void moveTo(QWidget *widget, QPoint point, bool offset = true);
virtual float getScale() const override;
@@ -78,6 +81,7 @@ private:
void moveIntoDesktopRect(QWidget *parent);
void calcButtonsSizes();
void drawCustomWindowFrame(QPainter &painter);
void onFocusLost();
bool handleDPICHANGED(MSG *msg);
bool handleSHOWWINDOW(MSG *msg);
@@ -86,6 +90,7 @@ private:
bool handleNCHITTEST(MSG *msg, long *result);
bool enableCustomFrame_;
ActionOnFocusLoss actionOnFocusLoss_ = Nothing;
bool frameless_;
bool stayInScreenRect_ = false;
bool shown_ = false;