Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreRadioButton.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_RADIOBUTTON__
8#define __HDI_CORE_RADIOBUTTON__
9
10#include "hdicoreWidget.h"
11
12namespace hdi
13{
14 namespace core
15 {
16 class Callback;
17 class RadioButtonGroup;
18
23 class RadioButton : public Widget
24 {
25 public:
30 {
31 StateMixed = -1,
32 StateOff = 0,
33 StateOn = 1
34 };
35
48
56 RadioButton(const RadioButton& radio_);
57
73 explicit RadioButton(
74 const Point& loc_,
75 const std::string& title_,
76 const WindowType containerType_,
77 const StateType state_ = StateOff
78 );
79
90 explicit RadioButton(
91 const Point& loc_,
92 const std::string& title_,
93 const double width_,
94 const StateType state_ = StateOff
95 );
96
107 explicit RadioButton(
108 const Rect& frame_,
109 const ImageWithRolloverIDs& imageIDs_,
110 const bool hasBorders_,
111 const bool chosen_ = false
112 );
113
126 explicit RadioButton(
127 const Rect& frame_,
128 const SVGWithRolloverIDs& svgIDs_,
129 const bool hasBorders_,
130 const bool chosen_ = false,
131 const Size& dims_ = Size()
132 );
133
139 virtual ~RadioButton();
140
149 virtual RadioButton& operator=(const RadioButton& rhs_);
150
164 virtual RadioButton* clone() const;
165
176 virtual RadioButton* duplicate() const;
177
185 virtual StateType state() const;
186
194 virtual void setState(const StateType state_);
195
205 virtual void setChosen(const bool chosen_);
206
216 virtual std::string text() const;
217
227 virtual void setText(const std::string& text_);
228
236 virtual bool hasBorders() const;
237
245 virtual RadioButtonGroup* const group() const;
246
252 virtual void click();
253
261 virtual Callback* const clickCallback() const;
262
270 virtual void setClickCallback(const Callback& callback_);
271
280
288 virtual void setImageIDs(const ImageWithRolloverIDs& ids_);
289
297 virtual SVGWithRolloverIDs svgIDs() const;
298
306 virtual void setSVGIDs(const SVGWithRolloverIDs& ids_);
307
315 virtual bool backgroundRollover() const;
316
324 virtual void setBackgroundRollover(const bool ro_);
325
336 static double idealWidth(const std::string& text_, const double height_, const WindowType containerType_);
337
338
339 private:
340 friend class RadioButtonGroup;
341 };
342
343 typedef std::unique_ptr<RadioButton> RadioButtonUP;
344 typedef std::shared_ptr<RadioButton> RadioButtonSP;
345 typedef std::weak_ptr<RadioButton> RadioButtonWP;
346 }
347}
348
349#endif
350// __HDI_CORE_RADIOBUTTON__
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
Allows for logically grouping radio buttons together, such that one can be chosen and others automati...
Definition: hdicoreRadioButtonGroup.h:24
Radio button widget, which has both a radio button and label to its right. After instantiation,...
Definition: hdicoreRadioButton.h:24
RadioButton()
Constructs an empty RadioButton object.
virtual ~RadioButton()
Radio button destructor.
virtual RadioButton * clone() const
Convenience method to clone a RadioButton object on the heap.
static double idealWidth(const std::string &text_, const double height_, const WindowType containerType_)
Gets the ideal width for a radio button, given its label and a known height.
RadioButton(const Rect &frame_, const SVGWithRolloverIDs &svgIDs_, const bool hasBorders_, const bool chosen_=false, const Size &dims_=Size())
Constructs an image radio button, using a bool for the state.
virtual SVGWithRolloverIDs svgIDs() const
Gets the SVG resource IDs of the widget.
virtual std::string text() const
Gets the current text value of the radio button.
virtual void setImageIDs(const ImageWithRolloverIDs &ids_)
Sets the PNGI resource IDs of the widget.
virtual RadioButton * duplicate() const
Convenience method to duplicate a RadioButton object, creating a new and identical UI element to the ...
StateType
Describes the state of a radio button.
Definition: hdicoreRadioButton.h:30
virtual StateType state() const
Gets the radio button state.
virtual bool backgroundRollover() const
Gets whether the background of the button should change in appearance upon mouse-over.
virtual bool hasBorders() const
Gets whether an image radio button has borders.
RadioButton(const RadioButton &radio_)
Constructs a new RadioButton object from an existing RadioButton object (copy constructor)
RadioButton(const Point &loc_, const std::string &title_, const double width_, const StateType state_=StateOff)
Constructs a text radio button, using a StateType for the state.
virtual void setSVGIDs(const SVGWithRolloverIDs &ids_)
Sets the SVG resource IDs of the widget.
virtual void click()
Simulates a click on the button.
virtual RadioButton & operator=(const RadioButton &rhs_)
Allows one RadioButton object to be assigned from another.
virtual void setClickCallback(const Callback &callback_)
Sets the click callback for the button.
virtual void setState(const StateType state_)
Sets the radio button state.
RadioButton(const Point &loc_, const std::string &title_, const WindowType containerType_, const StateType state_=StateOff)
Constructs a text radio button, using a StateType for the state and a window container type.
virtual void setBackgroundRollover(const bool ro_)
Sets whether the background of the button should change in appearance upon mouse-over.
RadioButton(const Rect &frame_, const ImageWithRolloverIDs &imageIDs_, const bool hasBorders_, const bool chosen_=false)
Constructs an image radio button, using a bool for the state.
virtual ImageWithRolloverIDs imageIDs() const
Gets the PNGI resource IDs of the widget.
virtual RadioButtonGroup *const group() const
Gets the radio button group that the target RadioButton belongs to.
virtual void setChosen(const bool chosen_)
Alternate setter for the radio button state.
virtual void setText(const std::string &text_)
Sets the current text value of the radio button.
virtual Callback *const clickCallback() const
Gets the current 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: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.