Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Classes | Public Types | Public Member Functions | List of all members
hdi::core::ModalDialog Class Reference

Used to create and display a modal dialog to the user, blocking input to other UI elements. More...

#include <hdicoreModalDialog.h>

Inheritance diagram for hdi::core::ModalDialog:
Inheritance graph
[legend]
Collaboration diagram for hdi::core::ModalDialog:
Collaboration graph
[legend]

Classes

class  ButtonOptions
 Controls button options for the ModalDialog constructor. More...
 

Public Types

enum  ChosenButton { UnknownButtonChosen = 0, OKButtonChosen = 1, CancelButtonChosen = 2 }
 Identifies which button was clicked.
 
- Public Types inherited from hdi::core::Window
typedef std::vector< Widget * > WidgetVector
 

Public Member Functions

 ModalDialog ()
 Constructs an empty ModalDialog object. More...
 
 ModalDialog (const ModalDialog &md_)
 Constructs a new ModalDialog object from an existing ModalDialog object (copy constructor) More...
 
 ModalDialog (const std::string &name_, const Size &size_)
 Constructs a ModalDialog object with a given name and size. More...
 
 ModalDialog (const std::string &name_, const Size &size_, const ButtonOptions &okBtnOpts_, const ButtonOptions &cancelBtnOpts_)
 Constructs a ModalDialog object with a given name, size, and buttons. More...
 
virtual ~ModalDialog ()
 Destructs a ModalDialog object. More...
 
virtual ModalDialogoperator= (const ModalDialog &rhs_)
 Allows one ModalDialog object to be assigned from another. More...
 
virtual ModalDialogclone () const
 Convenience method to clone a ModalDialog object on the heap. More...
 
virtual void destroy ()
 Destroys the UI modal dialog, converting the target object to an empty ModalDialog object (see the default constructor for more info on empty ModalDialog objects) More...
 
virtual PlatformModalDialogPtr platformModalDialog () const
 Gets the platform-specific modal dialog, around which the target object is wrapped. More...
 
virtual bool visible () const
 Gets whether the dialog is visible. More...
 
virtual void show ()
 Shows the modal dialog, blocking user input. More...
 
virtual void dismiss ()
 Forcefully dismisses a modal dialog. More...
 
virtual bool addWidget (const Widget &widget_)
 Adds a widget (label, button, text field, etc.) to the modal dialog. More...
 
virtual bool removeWidget (const Widget &widget_)
 Removes a widget (label, button, text field, etc.) from the modal dialog. More...
 
virtual ChosenButton chosenButton ()
 Gets which button was used to dismiss the dialog. More...
 
std::auto_ptr< ButtonokButton () const
 Gets the OK button created by the constructor (if the options indicated creation) More...
 
std::auto_ptr< ButtoncancelButton () const
 Gets the cancel button created by the constructor (if the options indicated creation) More...
 
virtual std::string title () const
 Gets the current modal dialog title. More...
 
virtual void setTitle (const std::string &title_)
 Sets the current modal dialog title. More...
 
virtual Size size () const
 Gets the modal dialog's size. More...
 
virtual void setSize (const Size &size_)
 Sets the modal dialog's size. More...
 
virtual void update () const
 Forces the widgets in the modal dialog to update/redraw. More...
 
- Public Member Functions inherited from hdi::core::Window
virtual ~Window ()
 Destructs a Window object. More...
 
virtual bool isEmpty () const
 Gets whether the target Window object is empty (constructed with the default ctor) More...
 
virtual WindowType windowType ()
 Gets the type of window. More...
 
virtual bool operator== (const Window &rhs_) const
 Tests whether a given Window object is the same as another. More...
 
virtual bool operator!= (const Window &rhs_) const
 Tests whether a given Window object is not the same as another. More...
 
virtual const WidgetVector widgets () const
 Gets a list of all widgets contained by the target window. More...
 
virtual bool addWidgetGroup (const WidgetGroup &wg_)
 Adds a widget group to the window. More...
 
virtual bool removeWidgetGroup (const WidgetGroup &wg_)
 Removes a widget group from the window. More...
 
virtual TabOrder *const tabOrder () const
 Gets the tab order object for the window. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hdi::core::Window
 Window ()
 Constructs an empty Window object. More...
 
 Window (const Window &w_)
 Constructs a new Window object from an existing Window object (copy constructor) More...
 
 Window (const WindowType type_)
 Constructs a Window object. More...
 
virtual Windowoperator= (const Window &)
 Internal use only. More...
 
- Protected Attributes inherited from hdi::core::Window
void * _data
 Private implementation data.
 

Detailed Description

Used to create and display a modal dialog to the user, blocking input to other UI elements.

Constructor & Destructor Documentation

hdi::core::ModalDialog::ModalDialog ( )

Constructs an empty ModalDialog object.

Author
GW
Date
10/2013
Note
To test if a ModalDialog object is empty, call isEmpty() on it
Empty ModalDialog objects do not relate to any actual UI modal dialog; they are designed to be "receivers" of some other ModalDialog object via the overloaded assignment operator. Empty ModalDialog objects are useless until such time (though it is safe to call any of their methods).
hdi::core::ModalDialog::ModalDialog ( const ModalDialog md_)

Constructs a new ModalDialog object from an existing ModalDialog object (copy constructor)

Author
GW
Date
10/2013
Parameters
md_Existing ModalDialog object
hdi::core::ModalDialog::ModalDialog ( const std::string &  name_,
const Size size_ 
)

Constructs a ModalDialog object with a given name and size.

Author
GW
Date
09/2013
Parameters
name_Name (title) of the dialog, as UTF-8
size_Width and height
Note
All modal dialogs are presented in the center of the screen.
This constructor creates a modal dialog with no buttons; it's up to you to add buttons that dismiss the dialog.
hdi::core::ModalDialog::ModalDialog ( const std::string &  name_,
const Size size_,
const ButtonOptions okBtnOpts_,
const ButtonOptions cancelBtnOpts_ 
)

Constructs a ModalDialog object with a given name, size, and buttons.

Author
GW
Date
09/2013
Parameters
name_Name (title) of the dialog, as UTF-8
size_Width and height
okBtnOpts_Whether to show the OK button, what its title is, and what its callback should be
cancelBtnOpts_Whether to show the cancel button, what its title is, and what its callback should be
Note
All modal dialogs are presented in the center of the screen.
virtual hdi::core::ModalDialog::~ModalDialog ( )
virtual

Destructs a ModalDialog object.

Author
GW
Date
09/2013

Member Function Documentation

virtual bool hdi::core::ModalDialog::addWidget ( const Widget widget_)
virtual

Adds a widget (label, button, text field, etc.) to the modal dialog.

Author
GW
Date
09/2013
Parameters
widget_Widget to place in the dialog
Returns
true if the widget was added, false otherwise

Reimplemented from hdi::core::Window.

std::auto_ptr<Button> hdi::core::ModalDialog::cancelButton ( ) const

Gets the cancel button created by the constructor (if the options indicated creation)

Author
GW
Date
07/2015
Returns
A pointer to the cancel Button object, or NULL if none
virtual ChosenButton hdi::core::ModalDialog::chosenButton ( )
virtual

Gets which button was used to dismiss the dialog.

Author
GW
Date
09/2013
Returns
An enum to describe which button dismissed the dialog
virtual ModalDialog* hdi::core::ModalDialog::clone ( ) const
virtual

Convenience method to clone a ModalDialog object on the heap.

Author
GW
Date
10/2013
Returns
A pointer to the new ModalDialog object
Note
If you subclass ModalDialog, you MUST overload this method yourself! If you don't and/or your clone() method does not return an instance of your ModalDialog subclass, you will experience "object slicing" when e.g. adding the modal dialog to a window collection.
Warning
The caller must manage the memory for the returned ModalDialog object.

Implements hdi::core::Window.

virtual void hdi::core::ModalDialog::destroy ( )
virtual

Destroys the UI modal dialog, converting the target object to an empty ModalDialog object (see the default constructor for more info on empty ModalDialog objects)

Author
GW
Date
10/2013
Note
This method must be called for any existing modal dialogs by the time the plugin is shutting down. If you no longer retain any of your own references to a modal dialog then the lib will call this method for you as it is shutting down.
virtual void hdi::core::ModalDialog::dismiss ( )
virtual

Forcefully dismisses a modal dialog.

Author
GW
Date
09/2013
std::auto_ptr<Button> hdi::core::ModalDialog::okButton ( ) const

Gets the OK button created by the constructor (if the options indicated creation)

Author
GW
Date
07/2015
Returns
A pointer to the OK Button object, or NULL if none
virtual ModalDialog& hdi::core::ModalDialog::operator= ( const ModalDialog rhs_)
virtual

Allows one ModalDialog object to be assigned from another.

Author
GW
Date
10/2013
Parameters
rhs_Righthand side of the = operator; the object to copy values from
Returns
The target ModalDialog object, but with its value updated to match that of rhs_
virtual PlatformModalDialogPtr hdi::core::ModalDialog::platformModalDialog ( ) const
virtual

Gets the platform-specific modal dialog, around which the target object is wrapped.

Author
GW
Date
11/2013
Returns
Pointer to platform-specific modal dialog. See PlatformModalDialogPtr typedef.
Note
Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of UI functionality is not handled by this class (or related classes), then it should probably be added to the hdi_core library.
virtual bool hdi::core::ModalDialog::removeWidget ( const Widget widget_)
virtual

Removes a widget (label, button, text field, etc.) from the modal dialog.

Author
GW
Date
09/2013
Parameters
widget_Widget to remove from the dialog
Returns
true if the widget was removed, false otherwise

Reimplemented from hdi::core::Window.

virtual void hdi::core::ModalDialog::setSize ( const Size size_)
virtual

Sets the modal dialog's size.

Author
GW
Date
11/2013
Parameters
size_New dialog size
virtual void hdi::core::ModalDialog::setTitle ( const std::string &  title_)
virtual

Sets the current modal dialog title.

Author
GW
Date
09/2013
Parameters
title_New string value for the modal dialog title, as UTF-8
virtual void hdi::core::ModalDialog::show ( )
virtual

Shows the modal dialog, blocking user input.

Author
GW
Date
09/2013

Implements hdi::core::Window.

virtual Size hdi::core::ModalDialog::size ( ) const
virtual

Gets the modal dialog's size.

Author
GW
Date
11/2013
Returns
A Size object representing the dialog's dimensions
virtual std::string hdi::core::ModalDialog::title ( ) const
virtual

Gets the current modal dialog title.

Author
GW
Date
09/2013
Returns
String value for the modal dialog title, as UTF-8
virtual void hdi::core::ModalDialog::update ( ) const
virtual

Forces the widgets in the modal dialog to update/redraw.

Author
GW
Date
09/2013

Implements hdi::core::Window.

virtual bool hdi::core::ModalDialog::visible ( ) const
virtual

Gets whether the dialog is visible.

Author
GW
Date
09/2013
Returns
true if the dialog is visible, false otherwise

Implements hdi::core::Window.