18 #ifndef HEADER_MODAL_DIALOG_HPP
19 #define HEADER_MODAL_DIALOG_HPP
21 #include <IGUIWindow.h>
23 #include "utils/ptr_vector.hpp"
24 #include "guiengine/abstract_top_level_container.hpp"
27 #include "guiengine/skin.hpp"
28 #include "input/input_manager.hpp"
29 #include "utils/leak_check.hpp"
42 enum ModalDialogLocation
44 MODAL_DIALOG_LOCATION_CENTER = 0,
45 MODAL_DIALOG_LOCATION_BOTTOM = 1
59 ModalDialogLocation m_dialog_location;
61 float m_percent_width, m_percent_height;
64 irr::gui::IGUIWindow* m_irrlicht_window;
65 irr::core::rect< irr::s32 > m_area;
66 bool m_fade_background;
68 InputManager::InputDriverMode m_previous_mode;
73 ModalDialog(
const float percentWidth,
const float percentHeight,
74 ModalDialogLocation location = MODAL_DIALOG_LOCATION_CENTER);
81 virtual void onEnterPressedInternal();
101 virtual EventPropagation
processEvent(
const std::string& eventSource){
return EVENT_LET; }
103 irr::gui::IGUIWindow* getIrrlichtElement()
105 return m_irrlicht_window;
108 static void dismiss();
109 static void onEnterPressed();
111 static bool isADialogActive();
127 virtual void load() {}
135 virtual int getWidth() {
return m_area.getWidth(); }
142 bool fadeBackground()
const {
return m_fade_background; }
144 bool isMyIrrChild(irr::gui::IGUIElement* widget)
const {
return m_irrlicht_window->isMyChild(widget); }
145 virtual bool enableScreenPadding()
const {
return false; }
Represents a GUI widgets container.
Definition: abstract_top_level_container.hpp:43
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
virtual void onResize()
Override to be notified of resizes.
Definition: modaldialog.cpp:214
virtual void init()
Optional callback invoked after widgets have been add()ed.
Definition: modaldialog.hpp:130
virtual int getHeight()
Implementing callback from AbstractTopLevelContainer.
Definition: modaldialog.hpp:140
void loadFromFile(const char *xmlFile)
Load a XML file to create the dialog from.
Definition: modaldialog.cpp:67
bool isInited()
Because C++ doesn't support constructor delegation...
Definition: modaldialog.hpp:96
virtual void onUpdate(float dt)
Override to be notified of updates.
Definition: modaldialog.hpp:117
virtual void beforeAddingWidgets()
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: modaldialog.hpp:126
virtual EventPropagation processEvent(const std::string &eventSource)
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: modaldialog.hpp:101
virtual bool onEscapePressed()
Override to change what happens on escape pressed.
Definition: modaldialog.hpp:114
ModalDialog(const float percentWidth, const float percentHeight, ModalDialogLocation location=MODAL_DIALOG_LOCATION_CENTER)
Creates a modal dialog with given percentage of screen width and height.
Definition: modaldialog.cpp:54
virtual int getWidth()
Implementing callback from AbstractTopLevelContainer.
Definition: modaldialog.hpp:135
virtual void loadedFromFile()
Callback invoked when the dialog was loaded from the XML file (if the constructor that takes a XML fi...
Definition: modaldialog.hpp:87
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33