Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreModalDialog.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_MODAL_DIALOG__
8#define __HDI_CORE_MODAL_DIALOG__
9
10#include "hdicoreSize.h"
11#include "hdicoreWindow.h"
12
13namespace hdi
14{
15 namespace core
16 {
17 class Button;
18 class Callback;
19 class Widget;
20
24 class ModalDialog : public Window
25 {
26 public:
31 {
32 UnknownButtonChosen = 0,
33 OKButtonChosen = 1,
34 CancelButtonChosen = 2
35 };
36
41 {
42 public:
46 bool enable;
47
51 bool dismiss;
52
59 std::string title;
60
67
74
87 const bool enable_,
88 const Callback& callback_,
89 const bool dismiss_ = true,
90 const std::string& title_ = ""
91 );
92
98 virtual ~ButtonOptions();
99
110
118 Callback* const callback() const;
119
127 void setCallback(const Callback& cb_);
128
129
130 private:
134 Callback* __cb;
135 };
136
149
158
171 ModalDialog(const std::string& name_, const Size& size_);
172
188 const std::string& name_,
189 const Size& size_,
190 const ButtonOptions& okBtnOpts_,
191 const ButtonOptions& cancelBtnOpts_
192 );
193
199 virtual ~ModalDialog();
200
209 virtual ModalDialog& operator=(const ModalDialog& rhs_);
210
224 virtual ModalDialog* clone() const;
225
236 virtual void destroy();
237
249 virtual PlatformModalDialogPtr platformModalDialog() const;
250
258 virtual bool visible() const;
259
265 virtual void show();
266
272 virtual void dismiss();
273
282 virtual bool addWidget(const Widget& widget_);
283
292 virtual bool removeWidget(const Widget& widget_);
293
301 virtual ChosenButton chosenButton() const;
302
310 std::unique_ptr<Button> okButton() const;
311
319 std::unique_ptr<Button> cancelButton() const;
320
328 virtual std::string title() const;
329
337 virtual void setTitle(const std::string& title_);
338
346 virtual Size size() const;
347
355 virtual void setSize(const Size& size_);
356
362 virtual void update() const;
363 };
364
365 typedef std::unique_ptr<ModalDialog> ModalDialogUP;
366 typedef std::shared_ptr<ModalDialog> ModalDialogSP;
367 typedef std::weak_ptr<ModalDialog> ModalDialogWP;
368 }
369}
370
371#endif
372// __HDI_CORE_MODAL_DIALOG__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Controls button options for the ModalDialog constructor.
Definition: hdicoreModalDialog.h:41
bool dismiss
Whether the modal should be automatically dismissed when the button is chosen.
Definition: hdicoreModalDialog.h:51
virtual ~ButtonOptions()
Destructs a ButtonOptions object.
bool enable
Whether the button should be shown.
Definition: hdicoreModalDialog.h:46
Callback *const callback() const
Gets the callback for the modal dialog button.
ButtonOptions()
Constructs a ButtonOptions object with default settings.
ButtonOptions(const ButtonOptions &bo_)
Constructs a ButtonOptions object with the same settings as another object.
ButtonOptions(const bool enable_, const Callback &callback_, const bool dismiss_=true, const std::string &title_="")
Constructs a ButtonOptions object with the given settings.
void setCallback(const Callback &cb_)
Sets the callback for the modal dialog button.
ButtonOptions & operator=(const ButtonOptions &rhs_)
Overloaded assignment operator to copy values from one ButtonOptions object to another.
std::string title
Button text value, as UTF-8.
Definition: hdicoreModalDialog.h:59
Used to create and display a modal dialog to the user, blocking input to other UI elements.
Definition: hdicoreModalDialog.h:25
ModalDialog(const std::string &name_, const Size &size_)
Constructs a ModalDialog object with a given name and size.
virtual void show()
Shows the modal dialog, blocking user input.
std::unique_ptr< Button > cancelButton() const
Gets the cancel button created by the constructor (if the options indicated creation)
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 void update() const
Forces the widgets in the modal dialog to update/redraw.
virtual ModalDialog * clone() const
Convenience method to clone a ModalDialog object on the heap.
virtual void setSize(const Size &size_)
Sets the modal dialog's size.
virtual void destroy()
Destroys the UI modal dialog, converting the target object to an empty ModalDialog object (see the de...
virtual ModalDialog & operator=(const ModalDialog &rhs_)
Allows one ModalDialog object to be assigned from another.
virtual ChosenButton chosenButton() const
Gets which button was used to dismiss the dialog.
virtual ~ModalDialog()
Destructs a ModalDialog object.
virtual bool visible() const
Gets whether the dialog is visible.
virtual std::string title() const
Gets the current modal dialog title.
virtual bool removeWidget(const Widget &widget_)
Removes a widget (label, button, text field, etc.) from the modal dialog.
virtual Size size() const
Gets the modal dialog's size.
ModalDialog()
Constructs an empty ModalDialog object.
virtual bool addWidget(const Widget &widget_)
Adds a widget (label, button, text field, etc.) to the modal dialog.
virtual void dismiss()
Forcefully dismisses a modal dialog.
ChosenButton
Identifies which button was clicked.
Definition: hdicoreModalDialog.h:31
virtual void setTitle(const std::string &title_)
Sets the current modal dialog title.
std::unique_ptr< Button > okButton() const
Gets the OK button created by the constructor (if the options indicated creation)
ModalDialog(const ModalDialog &md_)
Constructs a new ModalDialog object from an existing ModalDialog object (copy constructor)
virtual PlatformModalDialogPtr platformModalDialog() const
Gets the platform-specific modal dialog, around which the target object is wrapped.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:25
Base class for all interface widgets; handles many common needs, e.g. text, position,...
Definition: hdicoreWidget.h:30
Used as a base class for modal dialogs, panels, and control bars.
Definition: hdicoreWindow.h:26
Header file for describing 2D dimensions (width and height)
Header file for a class to create and manipulate plugin windows.