Hot Door CORE  0.7.1
Adobe® Illustrator® Plug-in Library
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 
13 namespace hdi
14 {
15  namespace core
16  {
17  class Button;
18  class Callback;
19  class Widget;
20 
21  #if defined(MAC_ENV)
22  typedef NSWindow* PlatformModalDialogPtr;
23  #elif defined(WIN_ENV)
24  typedef CDialog* PlatformModalDialogPtr;
25  #endif
26 
30  class ModalDialog : public Window
31  {
32  public:
37  {
38  UnknownButtonChosen = 0,
39  OKButtonChosen = 1,
40  CancelButtonChosen = 2
41  };
42 
47  {
48  public:
52  bool enable;
53 
57  bool dismiss;
58 
65  std::string title;
66 
72  ButtonOptions();
73 
79  ButtonOptions(const ButtonOptions& bo_);
80 
93  const bool enable_,
94  const Callback& callback_,
95  const bool dismiss_ = true,
96  const std::string& title_ = ""
97  );
98 
104  virtual ~ButtonOptions();
105 
115  ButtonOptions& operator=(const ButtonOptions& rhs_);
116 
124  Callback* const callback() const;
125 
133  void setCallback(const Callback& cb_);
134 
135 
136  private:
140  Callback* __cb;
141  };
142 
154  ModalDialog();
155 
163  ModalDialog(const ModalDialog& md_);
164 
177  ModalDialog(const std::string& name_, const Size& size_);
178 
193  ModalDialog(
194  const std::string& name_,
195  const Size& size_,
196  const ButtonOptions& okBtnOpts_,
197  const ButtonOptions& cancelBtnOpts_
198  );
199 
205  virtual ~ModalDialog();
206 
215  virtual ModalDialog& operator=(const ModalDialog& rhs_);
216 
230  virtual ModalDialog* clone() const;
231 
242  virtual void destroy();
243 
255  virtual PlatformModalDialogPtr platformModalDialog() const;
256 
264  virtual bool visible() const;
265 
271  virtual void show();
272 
278  virtual void dismiss();
279 
288  virtual bool addWidget(const Widget& widget_);
289 
298  virtual bool removeWidget(const Widget& widget_);
299 
307  virtual ChosenButton chosenButton() const;
308 
316  std::auto_ptr<Button> okButton() const;
317 
325  std::auto_ptr<Button> cancelButton() const;
326 
334  virtual std::string title() const;
335 
343  virtual void setTitle(const std::string& title_);
344 
352  virtual Size size() const;
353 
361  virtual void setSize(const Size& size_);
362 
368  virtual void update() const;
369  };
370 
371  typedef std::auto_ptr<ModalDialog> ModalDialogAP;
372  }
373 }
374 
375 #endif
376 // __HDI_CORE_MODAL_DIALOG__
Base class for all interface widgets; handles many common needs, e.g. text, position, size, etc.
Definition: hdicoreWidget.h:39
virtual ChosenButton chosenButton() const
Gets which button was used to dismiss the dialog.
virtual bool removeWidget(const Widget &widget_)
Removes a widget (label, button, text field, etc.) from the modal dialog.
Header file for a class to create and manipulate Illustrator modal dialogs.
std::auto_ptr< Button > okButton() const
Gets the OK button created by the constructor (if the options indicated creation) ...
Used to create and display a modal dialog to the user, blocking input to other UI elements...
Definition: hdicoreModalDialog.h:30
ButtonOptions()
Constructs a ButtonOptions object with default settings.
ButtonOptions & operator=(const ButtonOptions &rhs_)
Overloaded assignment operator to copy values from one ButtonOptions object to another.
void setCallback(const Callback &cb_)
Sets the callback for the modal dialog button.
std::auto_ptr< Button > cancelButton() const
Gets the cancel button created by the constructor (if the options indicated creation) ...
ModalDialog()
Constructs an empty ModalDialog object.
virtual void setSize(const Size &size_)
Sets the modal dialog&#39;s size.
Base class for templated __Callback class.
Definition: hdicoreCallback.h:67
virtual PlatformModalDialogPtr platformModalDialog() const
Gets the platform-specific modal dialog, around which the target object is wrapped.
std::string title
Button text value, as UTF-8.
Definition: hdicoreModalDialog.h:65
Header file for describing 2D dimensions (width and height)
virtual void setTitle(const std::string &title_)
Sets the current modal dialog title.
virtual void update() const
Forces the widgets in the modal dialog to update/redraw.
virtual bool visible() const
Gets whether the dialog is visible.
ChosenButton
Identifies which button was clicked.
Definition: hdicoreModalDialog.h:36
virtual bool addWidget(const Widget &widget_)
Adds a widget (label, button, text field, etc.) to the modal dialog.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:24
virtual ModalDialog * clone() const
Convenience method to clone a ModalDialog object on the heap.
Definition: hdicoreaiArray.h:12
virtual ~ButtonOptions()
Destructs a ButtonOptions object.
Controls button options for the ModalDialog constructor.
Definition: hdicoreModalDialog.h:46
virtual void destroy()
Destroys the UI modal dialog, converting the target object to an empty ModalDialog object (see the de...
Used as a base class for modal dialogs, panels, and control bars.
Definition: hdicoreWindow.h:25
Callback *const callback() const
Gets the callback for the modal dialog button.
virtual Size size() const
Gets the modal dialog&#39;s size.
bool dismiss
Whether the modal should be automatically dismissed when the button is chosen.
Definition: hdicoreModalDialog.h:57
virtual void show()
Shows the modal dialog, blocking user input.
bool enable
Whether the button should be shown.
Definition: hdicoreModalDialog.h:52
virtual ~ModalDialog()
Destructs a ModalDialog object.