Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreButton.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_BUTTON__
8 #define __HDI_CORE_BUTTON__
9 
10 #include "hdicoreWidget.h"
11 
12 namespace hdi
13 {
14  namespace core
15  {
16  class Callback;
17 
22  class Button : public Widget
23  {
24  public:
28  enum StyleType
29  {
30  UnknownStyle = 0,
31  CancelStyle = 10, // Indicates the cancel functionality of a window (cancel keyboard shortcut)
32  DefaultStyle = 20, // Indicates the default functionality of a window (accept keyboard shortcut)
33  NormalStyle = 30 // Just a normal button with no styling
34  };
35 
46  Button();
47 
55  Button(const Button& button_);
56 
71  Button(const Point& loc_, const std::string& title_, const WindowType containerType_);
72 
82  Button(const Point& loc_, const std::string& title_, const double width_);
83 
92  Button(const Rect& frame_, const std::string& title_);
93 
102  Button(const Rect& frame_, const ImageIDs& imageIDs_);
103 
109  virtual ~Button();
110 
119  virtual Button& operator=(const Button& rhs_);
120 
134  virtual Button* clone() const;
135 
146  virtual Button* duplicate() const;
147 
157  virtual std::string text() const;
158 
168  virtual void setText(const std::string& text_);
169 
177  virtual StyleType style() const;
178 
186  virtual void setStyle(const StyleType style_);
187 
193  virtual void click();
194 
202  virtual Callback* const clickCallback() const;
203 
211  virtual void setClickCallback(const Callback& callback_);
212 
218  virtual void doubleClick();
219 
227  virtual Callback* const doubleClickCallback() const;
228 
236  virtual void setDoubleClickCallback(const Callback& callback_);
237 
245  virtual ImageIDs imageIDs() const;
246 
254  virtual void setImageIDs(const ImageIDs& ids_);
255 
263  virtual bool backgroundRollover() const;
264 
272  virtual void setBackgroundRollover(const bool ro_);
273 
284  static double idealHeight(const std::string& text_, const double width_, const WindowType containerType_);
285 
296  static double idealWidth(const std::string& text_, const double height_, const WindowType containerType_);
297  };
298 
299  typedef std::auto_ptr<Button> ButtonAP;
300  }
301 }
302 
303 #endif
304 // __HDI_CORE_BUTTON__
Base class for all interface widgets; handles many common needs, e.g. text, position, size, etc.
Definition: hdicoreWidget.h:39
Button widget, which can be either the default button, cancel button, or normal button in a dialog...
Definition: hdicoreButton.h:22
Button()
Constructs an empty Button object.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual Callback *const doubleClickCallback() const
Gets the current double-click callback for the button.
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:26
static double idealWidth(const std::string &text_, const double height_, const WindowType containerType_)
Gets the ideal width for a button, given its title and a known height.
virtual void setText(const std::string &text_)
Sets the current text value of the button.
virtual Button & operator=(const Button &rhs_)
Allows one Button object to be assigned from another.
virtual std::string text() const
Gets the current text value of the button.
virtual Callback *const clickCallback() const
Gets the current click callback for the button.
Base class for templated __Callback class.
Definition: hdicoreCallback.h:67
virtual ~Button()
Button destructor.
virtual StyleType style() const
Gets the current button style.
virtual Button * duplicate() const
Convenience method to duplicate a Button object, creating a new and identical UI element to the targe...
virtual bool backgroundRollover() const
Gets whether the background of the button should change in appearance upon mouse-over.
virtual void setClickCallback(const Callback &callback_)
Sets the click callback for the button.
Definition: hdicoreaiArray.h:12
Header file for Illustrator user interface widgets.
virtual void setStyle(const StyleType style_)
Sets the style of the button as the default, cancel, or normal button.
static double idealHeight(const std::string &text_, const double width_, const WindowType containerType_)
Gets the ideal height for a button, given its title and a known width.
virtual ImageIDs imageIDs() const
Gets the PNGI resource IDs of the widget.
virtual void doubleClick()
Simulates a double-click on the button.
virtual void setDoubleClickCallback(const Callback &callback_)
Sets the double-click callback for the button.
virtual void setImageIDs(const ImageIDs &ids_)
Sets the PNGI resource IDs of the widget.
virtual Button * clone() const
Convenience method to clone a Button object on the heap.
StyleType
Describes the style of the button (see descriptions for each)
Definition: hdicoreButton.h:28
virtual void click()
Simulates a click on the button.
virtual void setBackgroundRollover(const bool ro_)
Sets whether the background of the button should change in appearance upon mouse-over.