Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Types | Public Member Functions | List of all members
om::gui::objects::Alert Class Reference

A class that represents a dialog that displays a prompt to the user. More...

#include <omGUIAlert.h>

Inheritance diagram for om::gui::objects::Alert:
om::gui::objects::GUIObject

Classes

class  Delegate
 A class that contains function objects that recieve alert events. More...
 

Public Types

enum  Type {
  USER = 0, OK = (1 << 0), CANCEL = (1 << 1), OK_CANCEL = OK | CANCEL,
  YES = (1 << 2), NO = (1 << 3), YES_NO = YES | NO, YES_NO_CANCEL = YES | NO | CANCEL
}
 An enum type that describes different standard alert dialog configurations. More...
 

Public Member Functions

 Alert (Type newType=OK)
 Create a alert with the default title "Error" with the specified standard type. More...
 
 Alert (const UTF8String &title, Type newType=OK)
 Create a alert with the specified title and alert type. More...
 
 Alert (const UTF8String &title, const UTF8String &message, Type newType=OK)
 Create a alert with the specified title, detailed message, and alert type. More...
 
 ~Alert ()
 Destroy a alert, closing it if is visible and releasing all resources used. More...
 
Index run ()
 Display the alert and block the calling thread until the user clicks a button. More...
 
Size getButtonCount () const
 Return the number of buttons that this alert has. More...
 
const UTF8String & getButton (Index typeIndex) const
 Return the name of the button at the specified index in this alert. More...
 
Bool addButton (const UTF8String &buttonName)
 Add a new button to this alert which has the specified name. More...
 
Bool removeButtonAtIndex (Index buttonIndex)
 Remove the button at the specified index from this alert. More...
 
Bool removeButton (const UTF8String &buttonName)
 Remove the specified button string from this alert. More...
 
Bool clearButtons ()
 Remove all buttons from this alert. More...
 
Type getType () const
 Return the standard alert type for this alert, or USER if the alert uses user-defined buttons. More...
 
Bool setType (Type newAlertType)
 Set the standard alert type for this alert, replacing its previous set of buttons. More...
 
UTF8String getTitle () const
 Return the title string for this alert. More...
 
Bool setTitle (const UTF8String &newTitle)
 Set the title string for this alert. More...
 
UTF8String getMessage () const
 Return the message string for this alert. More...
 
Bool setMessage (const UTF8String &newMessage)
 Set the message string for this alert. More...
 
const DelegategetDelegate () const
 Get a reference to the delegate object associated with this alert. More...
 
void setDelegate (const Delegate &delegate)
 Set the delegate object to which this alert sends events. More...
 
virtual void * getInternalPointer () const
 Get a pointer to this alert's platform-specific internal representation. More...
 
- Public Member Functions inherited from om::gui::objects::GUIObject
virtual ~GUIObject ()
 Destroy a GUI element and release all resources associated with it. More...
 

Detailed Description

A class that represents a dialog that displays a prompt to the user.

Member Enumeration Documentation

An enum type that describes different standard alert dialog configurations.

Enumerator
USER 

An alert with a user-defined button type.

OK 

An alert with a single OK confirmation button.

CANCEL 

An alert with a single cancel button.

OK_CANCEL 

An alert with OK and cancel buttons.

YES 

An alert with a single yes button.

NO 

An alert with a single no button.

YES_NO 

An alert with yes and no buttons.

YES_NO_CANCEL 

An alert with yes, no, and cancel buttons.

Constructor & Destructor Documentation

om::gui::objects::Alert::Alert ( Type  newType = OK)

Create a alert with the default title "Error" with the specified standard type.

om::gui::objects::Alert::Alert ( const UTF8String &  title,
Type  newType = OK 
)

Create a alert with the specified title and alert type.

om::gui::objects::Alert::Alert ( const UTF8String &  title,
const UTF8String &  message,
Type  newType = OK 
)

Create a alert with the specified title, detailed message, and alert type.

om::gui::objects::Alert::~Alert ( )

Destroy a alert, closing it if is visible and releasing all resources used.

Member Function Documentation

Index om::gui::objects::Alert::run ( )

Display the alert and block the calling thread until the user clicks a button.

The method returns the button index that was clicked by the user. The button index is also sent to the delegate before the method returns. If there is an error, -1 is returned.

Size om::gui::objects::Alert::getButtonCount ( ) const

Return the number of buttons that this alert has.

const UTF8String& om::gui::objects::Alert::getButton ( Index  typeIndex) const

Return the name of the button at the specified index in this alert.

Bool om::gui::objects::Alert::addButton ( const UTF8String &  buttonName)

Add a new button to this alert which has the specified name.

The method returns whether or not the new button was able to be added.

Bool om::gui::objects::Alert::removeButtonAtIndex ( Index  buttonIndex)

Remove the button at the specified index from this alert.

The method returns whether or not the button was able to be removed.

Bool om::gui::objects::Alert::removeButton ( const UTF8String &  buttonName)

Remove the specified button string from this alert.

The method returns whether or not the button was able to be removed.

Bool om::gui::objects::Alert::clearButtons ( )

Remove all buttons from this alert.

Type om::gui::objects::Alert::getType ( ) const

Return the standard alert type for this alert, or USER if the alert uses user-defined buttons.

Bool om::gui::objects::Alert::setType ( Type  newAlertType)

Set the standard alert type for this alert, replacing its previous set of buttons.

The method returns whether or not the alert type was able to be set.

UTF8String om::gui::objects::Alert::getTitle ( ) const

Return the title string for this alert.

On most platforms, this string will be placed at the top of the window in a title bar.

Bool om::gui::objects::Alert::setTitle ( const UTF8String &  newTitle)

Set the title string for this alert.

The method returns whether or not the title change operation was successful.

UTF8String om::gui::objects::Alert::getMessage ( ) const

Return the message string for this alert.

This string should provide detailed information about the alert.

Bool om::gui::objects::Alert::setMessage ( const UTF8String &  newMessage)

Set the message string for this alert.

The method returns whether or not the message change operation was successful.

const Delegate& om::gui::objects::Alert::getDelegate ( ) const

Get a reference to the delegate object associated with this alert.

void om::gui::objects::Alert::setDelegate ( const Delegate delegate)

Set the delegate object to which this alert sends events.

virtual void* om::gui::objects::Alert::getInternalPointer ( ) const
virtual

Get a pointer to this alert's platform-specific internal representation.

On Mac OS X, this method returns a pointer to a subclass of NSAlert which represents the alert.

On Windows, this method returns an HWND indicating a handle to the alert window.

Implements om::gui::objects::GUIObject.


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