Hot Door CORE 0.8.4
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreModalDialog.h
Go to the documentation of this file.
1
6
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
76
89 const bool enable_,
90 const Callback& callback_,
91 const bool dismiss_ = true,
92 const std::string& title_ = ""
93 );
94
100 virtual ~ButtonOptions();
101
112
120 Callback* const callback() const;
121
129 void setCallback(const Callback& cb_);
130
131
132 private:
136 Callback* __cb;
137 };
138
151
160
173 ModalDialog(const std::string& name_, const Size& size_);
174
190 const std::string& name_,
191 const Size& size_,
192 const ButtonOptions& okBtnOpts_,
193 const ButtonOptions& cancelBtnOpts_
194 );
195
201 virtual ~ModalDialog();
202
211 virtual ModalDialog& operator=(const ModalDialog& rhs_);
212
226 virtual ModalDialog* clone() const;
227
238 virtual void destroy();
239
251 virtual PlatformModalDialogPtr platformModalDialog() const;
252
260 virtual bool visible() const;
261
267 virtual void show();
268
274 virtual void dismiss();
275
284 virtual bool addWidget(const Widget& widget_);
285
294 virtual bool removeWidget(const Widget& widget_);
295
303 virtual ChosenButton chosenButton() const;
304
312 std::unique_ptr<Button> okButton() const;
313
321 std::unique_ptr<Button> cancelButton() const;
322
330 virtual std::string title() const;
331
339 virtual void setTitle(const std::string& title_);
340
348 virtual Size size() const;
349
357 virtual void setSize(const Size& size_);
358
364 virtual void update() const;
365 };
366
367 typedef std::unique_ptr<ModalDialog> ModalDialogUP;
368 typedef std::shared_ptr<ModalDialog> ModalDialogSP;
369 typedef std::weak_ptr<ModalDialog> ModalDialogWP;
370 }
371}
372
373#endif
374// __HDI_CORE_MODAL_DIALOG__
Button widget, which can be either the default button, cancel button, or normal button in a dialog,...
Definition hdicoreButton.h:23
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
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
Window()
Constructs an empty Window object.
Header file for describing 2D dimensions (width and height)
Header file for a class to create and manipulate plugin windows.