Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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< std::shared_ptr< Widget > > WidgetVector
 

Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from hdi::core::Window
 Window ()
 Constructs an empty Window object.
 
 Window (const Window &w_)
 Constructs a new Window object from an existing Window object (copy constructor)
 
 Window (const WindowType type_)
 Constructs a Window object.
 
virtual Windowoperator= (const Window &)
 Internal use only.
 
- 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

◆ ModalDialog() [1/4]

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).

◆ ModalDialog() [2/4]

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

◆ ModalDialog() [3/4]

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, in 1x resolution coordinates
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.

◆ ModalDialog() [4/4]

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, in 1x resolution coordinates
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.

◆ ~ModalDialog()

virtual hdi::core::ModalDialog::~ModalDialog ( )
virtual

Destructs a ModalDialog object.

Author
GW
Date
09/2013

Member Function Documentation

◆ addWidget()

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.

◆ cancelButton()

std::unique_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

◆ chosenButton()

virtual ChosenButton hdi::core::ModalDialog::chosenButton ( ) const
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

◆ clone()

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.

◆ destroy()

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.

◆ dismiss()

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

Forcefully dismisses a modal dialog.

Author
GW
Date
09/2013

◆ okButton()

std::unique_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

◆ operator=()

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_

◆ platformModalDialog()

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.

◆ removeWidget()

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.

◆ setSize()

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, in 1x resolution coordinates

◆ setTitle()

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

◆ show()

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

Shows the modal dialog, blocking user input.

Author
GW
Date
09/2013

Implements hdi::core::Window.

◆ size()

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, in 1x resolution coordinates

◆ title()

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

◆ update()

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.

◆ visible()

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.