[Window] deleteLater made virtual

This commit is contained in:
Bertrand Songis
2020-11-04 16:48:53 +01:00
parent 8aeae1d72f
commit 25a3a20642
2 changed files with 10 additions and 7 deletions
+5 -4
View File
@@ -33,7 +33,7 @@ class ModalWindow: public Window
} }
#endif #endif
void deleteLater() void deleteLater(bool detach=true) override
{ {
if (_deleted) if (_deleted)
return; return;
@@ -42,7 +42,7 @@ class ModalWindow: public Window
previousFocus->setFocus(SET_FOCUS_DEFAULT); previousFocus->setFocus(SET_FOCUS_DEFAULT);
} }
Window::deleteLater(); Window::deleteLater(detach);
} }
void paint(BitmapBuffer * dc) override; void paint(BitmapBuffer * dc) override;
@@ -87,11 +87,12 @@ class ModalWindow: public Window
} }
protected: protected:
Window * previousFocus = nullptr; Window * previousFocus;
bool closeAllowed = true; bool closeAllowed = true;
}; };
class ModalWindowContent: public Window { class ModalWindowContent: public Window
{
public: public:
explicit ModalWindowContent(ModalWindow * parent, const rect_t & rect): explicit ModalWindowContent(ModalWindow * parent, const rect_t & rect):
Window(parent, rect, OPAQUE) Window(parent, rect, OPAQUE)
+5 -3
View File
@@ -50,14 +50,16 @@ constexpr WindowFlags PAINT_CHILDREN_FIRST = 1u << 6u;
constexpr WindowFlags PUSH_FRONT = 1u << 7u; constexpr WindowFlags PUSH_FRONT = 1u << 7u;
constexpr WindowFlags WINDOW_FLAGS_LAST = PUSH_FRONT; constexpr WindowFlags WINDOW_FLAGS_LAST = PUSH_FRONT;
enum SetFocusFlag { enum SetFocusFlag
{
SET_FOCUS_DEFAULT, SET_FOCUS_DEFAULT,
SET_FOCUS_FORWARD, SET_FOCUS_FORWARD,
SET_FOCUS_BACKWARD, SET_FOCUS_BACKWARD,
SET_FOCUS_FIRST SET_FOCUS_FIRST
}; };
class Window { class Window
{
friend class GridLayout; friend class GridLayout;
public: public:
@@ -135,7 +137,7 @@ class Window {
focusHandler = std::move(handler); focusHandler = std::move(handler);
} }
void deleteLater(bool detach=true); virtual void deleteLater(bool detach=true);
void clear(); void clear();