SuperTuxKart
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
MessageDialog Class Reference

Generic dialog to ask the user to confirm something, or to show a simple message box. More...

#include <message_dialog.hpp>

Inheritance diagram for MessageDialog:
Inheritance graph
[legend]

Classes

class  IConfirmDialogListener
 Listener interface to get notified of whether the user chose to confirm or cancel. More...
 

Public Types

enum  MessageDialogType { MESSAGE_DIALOG_OK, MESSAGE_DIALOG_CONFIRM, MESSAGE_DIALOG_OK_CANCEL, MESSAGE_DIALOG_YESNO }
 

Public Member Functions

 MessageDialog (const irr::core::stringw &msg, MessageDialogType type, IConfirmDialogListener *listener, bool delete_listener, bool from_queue=false, float width=0.6f, float height=0.6f)
 Complete constructor, which allows setting of listener, type etc. More...
 
 MessageDialog (const irr::core::stringw &msg, bool from_queue=false)
 Variant of MessageDialog where cancelling is not possible (i.e. More...
 
virtual void onEnterPressedInternal () OVERRIDE
 
virtual void onUpdate (float dt) OVERRIDE
 Override to be notified of updates.
 
virtual void load () OVERRIDE
 Called from the DialogQueue, used to load the actual xml file and init the dialog.
 
GUIEngine::EventPropagation processEvent (const std::string &eventSource) OVERRIDE
 Returns whether to block event propagation (usually, you will want to block events you processed)
 
virtual void loadedFromFile () OVERRIDE
 Callback invoked when the dialog was loaded from the XML file (if the constructor that takes a XML file as argument is used)
 
void setFocusCancel ()
 Calling this will make sure that the focus is set on the 'cancel' or 'no'. More...
 
- Public Member Functions inherited from GUIEngine::ModalDialog
bool isInited ()
 Because C++ doesn't support constructor delegation... More...
 
irr::gui::IGUIWindow * getIrrlichtElement ()
 
virtual bool onEscapePressed ()
 Override to change what happens on escape pressed.
 
virtual void beforeAddingWidgets ()
 Optional callback invoked very early, before widgets have been added (contrast with init(), which is invoked afer widgets were added)
 
virtual void init ()
 Optional callback invoked after widgets have been add()ed.
 
virtual int getWidth ()
 Implementing callback from AbstractTopLevelContainer.
 
virtual int getHeight ()
 Implementing callback from AbstractTopLevelContainer.
 
bool fadeBackground () const
 
bool isMyIrrChild (irr::gui::IGUIElement *widget) const
 
- Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer
WidgetgetWidget (const char *name)
 This function returns a widget by name if that widget is found. More...
 
WidgetgetWidget (const int id)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
template<typename T >
T * getWidget (const char *name)
 This function searches and returns a widget by name, cast as specified type, if that widget is found and the type is correct. More...
 
WidgetgetFirstWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the first widget found in within_vector. More...
 
WidgetgetLastWidget (PtrVector< Widget > *within_vector=NULL)
 This function returns the last widget found in within_vector. More...
 
void elementsWereDeleted (PtrVector< Widget > *within_vector=NULL)
 This function is called when screen is removed. More...
 
bool isMyChild (Widget *widget) const
 This function checks if a widget is a child of the container. More...
 

Public Attributes

MessageDialogType m_type
 
- Public Attributes inherited from GUIEngine::SkinWidgetContainer
int m_skin_x
 
int m_skin_y
 
int m_skin_w
 
int m_skin_h
 
bool m_skin_dest_areas_inited
 
bool m_skin_dest_areas_yflip_inited
 
int m_skin_dest_x
 
int m_skin_dest_y
 
int m_skin_dest_x2
 
int m_skin_dest_y2
 
core::rect< s32 > m_skin_dest_area_left
 
core::rect< s32 > m_skin_dest_area_center
 
core::rect< s32 > m_skin_dest_area_right
 
core::rect< s32 > m_skin_dest_area_top
 
core::rect< s32 > m_skin_dest_area_bottom
 
core::rect< s32 > m_skin_dest_area_top_left
 
core::rect< s32 > m_skin_dest_area_top_right
 
core::rect< s32 > m_skin_dest_area_bottom_left
 
core::rect< s32 > m_skin_dest_area_bottom_right
 
core::rect< s32 > m_skin_dest_area_left_yflip
 
core::rect< s32 > m_skin_dest_area_center_yflip
 
core::rect< s32 > m_skin_dest_area_right_yflip
 
core::rect< s32 > m_skin_dest_area_top_yflip
 
core::rect< s32 > m_skin_dest_area_bottom_yflip
 
core::rect< s32 > m_skin_dest_area_top_left_yflip
 
core::rect< s32 > m_skin_dest_area_top_right_yflip
 
core::rect< s32 > m_skin_dest_area_bottom_left_yflip
 
core::rect< s32 > m_skin_dest_area_bottom_right_yflip
 
short m_skin_r
 
short m_skin_g
 
short m_skin_b
 

Private Member Functions

void doInit (bool from_queue)
 If necessary schedules a pause, and loads the xml file if necessary. More...
 

Private Attributes

IConfirmDialogListenerm_listener
 
bool m_own_listener
 
irr::core::stringw m_msg
 
bool m_focus_on_cancel
 If set this will set the focus on 'cancel'/'no' instead of "yes"/"ok". More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GUIEngine::ModalDialog
static void dismiss ()
 
static void onEnterPressed ()
 
static ModalDialoggetCurrent ()
 
static bool isADialogActive ()
 
- Static Public Member Functions inherited from GUIEngine::AbstractTopLevelContainer
static WidgetgetWidget (const char *name, PtrVector< Widget > *within_vector)
 This function returns a widget by name if that widget is found in within_vector. More...
 
static WidgetgetWidget (const int id, PtrVector< Widget > *within_vector)
 This function returns a widget by irrlicht ID if that widget is found. More...
 
- Protected Member Functions inherited from GUIEngine::ModalDialog
 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.
 
void loadFromFile (const char *xmlFile)
 Load a XML file to create the dialog from. More...
 
void clearWindow ()
 
void doInit ()
 
- Protected Member Functions inherited from GUIEngine::AbstractTopLevelContainer
void addWidgetsRecursively (PtrVector< Widget > &widgets, Widget *parent=NULL)
 This function adds a list of widgets recursively, effectively creating the hierarchy of widgets. More...
 
- Protected Attributes inherited from GUIEngine::ModalDialog
irr::gui::IGUIWindow * m_irrlicht_window
 
irr::core::rect< irr::s32 > m_area
 
bool m_fade_background
 
InputManager::InputDriverMode m_previous_mode
 
- Protected Attributes inherited from GUIEngine::AbstractTopLevelContainer
PtrVector< Widget, HOLD > m_widgets
 the widgets in this screen
 
Widgetm_first_widget
 AbstractTopLevelContainer is generally able to determine its first widget just fine, but in highly complex screens (e.g. More...
 
Widgetm_last_widget
 AbstractTopLevelContainer is generally able to determine its last widget just fine, but in highly complex screens (e.g. More...
 

Detailed Description

Generic dialog to ask the user to confirm something, or to show a simple message box.

Constructor & Destructor Documentation

◆ MessageDialog() [1/2]

MessageDialog::MessageDialog ( const irr::core::stringw &  msg,
MessageDialogType  type,
IConfirmDialogListener listener,
bool  own_listener,
bool  from_queue = false,
float  width = 0.6f,
float  height = 0.6f 
)

Complete constructor, which allows setting of listener, type etc.

Parameters
msgMessage to display in the dialog
listenerA listener object to notify when the user made a choice.
Ifset to true, 'listener' will be owned by this dialog and deleted along with the dialog.
msgThe text to be shown in the dialog.
typeThe type of dialog (OK, confirm, ok/cancel, ...).
listenerAn optional listener object.
own_listenerIf true the dialog will free the listener.
from_queueIf the object is placed into the DialogQueue. If so, loadFromFile() is not called (it will be called when the dialog is finally being removed from the queue and shown).

◆ MessageDialog() [2/2]

MessageDialog::MessageDialog ( const irr::core::stringw &  msg,
bool  from_queue = false 
)

Variant of MessageDialog where cancelling is not possible (i.e.

Simple constructor for a notification message (i.e.

just shows a message box with OK)

Parameters
msgMessage to display in the dialog

only OK button shown).

Parameters
msgThe message to show.
from_queueIf the object is placed into the DialogQueue. If so, loadFromFile() is not called (it will be called when the dialog is finally being removed from the queue and shown).

Member Function Documentation

◆ doInit()

void MessageDialog::doInit ( bool  from_queue)
private

If necessary schedules a pause, and loads the xml file if necessary.

Parameters
from_queueIf the dialog is queued, do not load the xml file, this will be done later in the case of a queued dialog.

◆ setFocusCancel()

void MessageDialog::setFocusCancel ( )
inline

Calling this will make sure that the focus is set on the 'cancel' or 'no'.

Member Data Documentation

◆ m_focus_on_cancel

bool MessageDialog::m_focus_on_cancel
private

If set this will set the focus on 'cancel'/'no' instead of "yes"/"ok".


The documentation for this class was generated from the following files: