Dialog now themeable
This commit is contained in:
+9
-3
@@ -21,12 +21,18 @@
|
||||
#include "mainwindow.h"
|
||||
#include "theme.h"
|
||||
|
||||
DialogWindowContent::DialogWindowContent(Dialog * parent, const rect_t & rect):
|
||||
ModalWindowContent(parent, rect),
|
||||
form(this, {0, POPUP_HEADER_HEIGHT, rect.w, coord_t(rect.h - POPUP_HEADER_HEIGHT)}, FORM_NO_BORDER)
|
||||
{
|
||||
form.setFocus();
|
||||
}
|
||||
|
||||
|
||||
Dialog::Dialog(std::string title, const rect_t & rect):
|
||||
ModalWindow(),
|
||||
content(createDialogWindow(this, rect)),
|
||||
form(content, {0, POPUP_HEADER_HEIGHT, rect.w, coord_t(rect.h - POPUP_HEADER_HEIGHT)}, FORM_NO_BORDER)
|
||||
content(createDialogWindow(this, rect))
|
||||
{
|
||||
bringToTop();
|
||||
content->setTitle(title);
|
||||
form.setFocus();
|
||||
}
|
||||
|
||||
+24
-6
@@ -23,15 +23,34 @@
|
||||
#include "modal_window.h"
|
||||
#include "form.h"
|
||||
|
||||
class Dialog: public ModalWindow {
|
||||
public:
|
||||
Dialog(std::string title, const rect_t & rect);
|
||||
class Dialog;
|
||||
|
||||
~Dialog() override
|
||||
class DialogWindowContent: public ModalWindowContent {
|
||||
friend class Dialog;
|
||||
|
||||
public:
|
||||
DialogWindowContent(Dialog * parent, const rect_t & rect);
|
||||
|
||||
~DialogWindowContent() override
|
||||
{
|
||||
form.detach();
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() override
|
||||
{
|
||||
return "DialogWindowContent";
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
FormGroup form;
|
||||
};
|
||||
|
||||
class Dialog: public ModalWindow {
|
||||
public:
|
||||
Dialog(std::string title, const rect_t & rect);
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() override
|
||||
{
|
||||
@@ -40,8 +59,7 @@ class Dialog: public ModalWindow {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
ModalWindowContent * content;
|
||||
FormGroup form;
|
||||
DialogWindowContent * content;
|
||||
};
|
||||
|
||||
#endif // _DIALOG_H_
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ class MenuWindowContent: public ModalWindowContent {
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() override
|
||||
{
|
||||
return "MenuWindow::";
|
||||
return "MenuWindowContent";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@
|
||||
class Menu;
|
||||
class MenuWindowContent;
|
||||
class Dialog;
|
||||
class ModalWindowContent;
|
||||
class DialogWindowContent;
|
||||
class ChoiceBase;
|
||||
|
||||
enum IconState {
|
||||
@@ -55,6 +55,6 @@ class Theme {
|
||||
extern Theme * theme;
|
||||
|
||||
MenuWindowContent * createMenuWindow(Menu * menu);
|
||||
ModalWindowContent * createDialogWindow(Dialog * dialog, const rect_t & rect);
|
||||
DialogWindowContent * createDialogWindow(Dialog * dialog, const rect_t & rect);
|
||||
|
||||
#endif // _THEME_H_
|
||||
|
||||
Reference in New Issue
Block a user