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;
65 irr::gui::IGUIWindow* m_irrlicht_window;
66 irr::core::rect< irr::s32 > m_area;
67 bool m_fade_background;
69 InputManager::InputDriverMode m_previous_mode;
74 ModalDialog(
const float percentWidth,
const float percentHeight,
75 ModalDialogLocation location = MODAL_DIALOG_LOCATION_CENTER);
82 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();
124 virtual void load() {}
132 virtual int getWidth() {
return m_area.getWidth(); }
139 bool fadeBackground()
const {
return m_fade_background; }
141 bool isMyIrrChild(irr::gui::IGUIElement* widget)
const {
return m_irrlicht_window->isMyChild(widget); }
142 virtual bool enableScreenPadding()
const {
return false; }
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
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:52
virtual void onUpdate(float dt)
Override to be notified of updates.
Definition: modaldialog.hpp:117
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
Represents a GUI widgets container.
Definition: abstract_top_level_container.hpp:42
virtual int getWidth()
Implementing callback from AbstractTopLevelContainer.
Definition: modaldialog.hpp:132
virtual bool onEscapePressed()
Override to change what happens on escape pressed.
Definition: modaldialog.hpp:114
virtual void beforeAddingWidgets()
Optional callback invoked very early, before widgets have been added (contrast with init()...
Definition: modaldialog.hpp:123
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:55
virtual void init()
Optional callback invoked after widgets have been add()ed.
Definition: modaldialog.hpp:127
virtual int getHeight()
Implementing callback from AbstractTopLevelContainer.
Definition: modaldialog.hpp:137
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:88
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