Hot Door CORE 0.8.3
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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
12namespace hdi
13{
14 namespace core
15 {
16 class Callback;
17
22 class Button : public Widget
23 {
24 public:
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
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 ImageWithRolloverIDs& imageIDs_);
103
114 Button(const Rect& frame_, const SVGWithRolloverIDs& svgIDs_, const Size& dims_ = Size());
115
121 virtual ~Button();
122
131 virtual Button& operator=(const Button& rhs_);
132
146 virtual Button* clone() const;
147
158 virtual Button* duplicate() const;
159
169 virtual std::string text() const;
170
180 virtual void setText(const std::string& text_);
181
189 virtual StyleType style() const;
190
198 virtual void setStyle(const StyleType style_);
199
205 virtual void click();
206
214 virtual Callback* const clickCallback() const;
215
223 virtual void setClickCallback(const Callback& callback_);
224
230 virtual void doubleClick();
231
239 virtual Callback* const doubleClickCallback() const;
240
248 virtual void setDoubleClickCallback(const Callback& callback_);
249
258
266 virtual void setImageIDs(const ImageWithRolloverIDs& ids_);
267
275 virtual SVGWithRolloverIDs svgIDs() const;
276
284 virtual void setSVGIDs(const SVGWithRolloverIDs& ids_);
285
293 virtual bool backgroundRollover() const;
294
302 virtual void setBackgroundRollover(const bool ro_);
303
314 static double idealHeight(const std::string& text_, const double width_, const WindowType containerType_);
315
326 static double idealWidth(const std::string& text_, const double height_, const WindowType containerType_);
327 };
328
329 typedef std::unique_ptr<Button> ButtonUP;
330 typedef std::shared_ptr<Button> ButtonSP;
331 typedef std::weak_ptr<Button> ButtonWP;
332 }
333}
334
335#endif
336// __HDI_CORE_BUTTON__
Button widget, which can be either the default button, cancel button, or normal button in a dialog,...
Definition: hdicoreButton.h:23
Button(const Rect &frame_, const SVGWithRolloverIDs &svgIDs_, const Size &dims_=Size())
Constructs an image button of a certain size.
virtual Button * clone() const
Convenience method to clone a Button object on the heap.
Button(const Button &button_)
Constructs a new Button object from an existing Button object (copy constructor)
virtual Callback *const clickCallback() const
Gets the current click callback for the button.
virtual StyleType style() const
Gets the current button style.
virtual ImageWithRolloverIDs imageIDs() const
Gets the PNGI resource IDs of the widget.
virtual ~Button()
Button destructor.
virtual void setSVGIDs(const SVGWithRolloverIDs &ids_)
Sets the SVG resource IDs of the widget.
virtual bool backgroundRollover() const
Gets whether the background of the button should change in appearance upon mouse-over.
virtual void click()
Simulates a click on the button.
virtual void doubleClick()
Simulates a double-click on the button.
Button(const Point &loc_, const std::string &title_, const double width_)
Constructs a button using a location and width; height is fixed.
Button(const Rect &frame_, const ImageWithRolloverIDs &imageIDs_)
Constructs an image button of a certain size.
Button(const Rect &frame_, const std::string &title_)
Constructs a text button of a specific size.
virtual void setClickCallback(const Callback &callback_)
Sets the click callback for the button.
virtual void setImageIDs(const ImageWithRolloverIDs &ids_)
Sets the PNGI resource IDs of the widget.
Button(const Point &loc_, const std::string &title_, const WindowType containerType_)
Constructs a button using a location and window container type; height is fixed.
virtual void setDoubleClickCallback(const Callback &callback_)
Sets the double-click callback for the button.
Button()
Constructs an empty Button object.
virtual Button * duplicate() const
Convenience method to duplicate a Button object, creating a new and identical UI element to the targe...
virtual void setBackgroundRollover(const bool ro_)
Sets whether the background of the button should change in appearance upon mouse-over.
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 SVGWithRolloverIDs svgIDs() const
Gets the SVG resource IDs of the widget.
virtual std::string text() const
Gets the current text value of the button.
virtual Button & operator=(const Button &rhs_)
Allows one Button object to be assigned from another.
virtual Callback *const doubleClickCallback() const
Gets the current double-click callback for the 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 void setText(const std::string &text_)
Sets the current text value of the button.
virtual void setStyle(const StyleType style_)
Sets the style of the button as the default, cancel, or normal button.
StyleType
Describes the style of the button (see descriptions for each)
Definition: hdicoreButton.h:29
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Allows for image rollover support.
Definition: hdicoreImageIDs.h:220
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:38
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:34
Allows for image rollover support.
Definition: hdicoreSVGIDs.h:120
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
WindowType
Describes the type of a Window object, allowing for proper casting to its subclass.
Definition: hdicoreTypes.h:822
Header file for plugin user interface widgets.