Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreWidget.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_WIDGET__
8 #define __HDI_CORE_WIDGET__
9 
10 #include "hdicoreRect.h"
11 #include "hdicoreTypes.h"
12 
13 #if defined(MAC_ENV)
14  @class NSView;
15 #elif defined(WIN_ENV)
16  class CWnd;
17 #endif
18 
19 namespace hdi
20 {
21  namespace plugin
22  {
23  class Widget;
24  }
25 
26  namespace core
27  {
28  class Window;
29 
30  #if defined(MAC_ENV)
31  typedef NSView* PlatformWidgetPtr;
32  #elif defined(WIN_ENV)
33  typedef CWnd* PlatformWidgetPtr;
34  #endif
35 
39  class Widget
40  {
41  public:
45  enum Type
46  {
47  UnknownType = 0,
48  BoxType = 10, // Box class
49  ButtonType = 20, // Button class
50  CheckboxType = 30, // Checkbox class
51  ColumnViewType = 40, // ColumnView class
52  ComboBoxType = 50, // ComboBox class
53  ColorWellType = 60, // ColorWell class
54  CustomType = 70, // CustomWidget class
55  DividerType = 80, // Divider class
56  HierarchicalColumnViewType = 85, // HierarchicalColumnView class
57  HierarchicalViewType = 90, // HierarchicalView class
58  LabelType = 100, // Label class
59  ListViewType = 110, // ListView class
60  PopupMenuType = 120, // PopupMenu class
61  RadioButtonType = 130, // RadioButton class
62  SliderType = 140, // Slider class
63  StepperType = 150, // Stepper class
64  TextFieldType = 160, // TextField class
65  TextViewType = 170, // TextView class
66  WebViewType = 180 // WebView class
67  };
68 
73  struct ImageIDs
74  {
80  static const int16_t noneID = 0;
81 
85  int16_t lightID;
86 
90  int16_t lightID_2x;
91 
95  int16_t lightID_3x;
96 
100  int16_t darkID;
101 
105  int16_t darkID_2x;
106 
110  int16_t darkID_3x;
111 
115  int16_t lightOverID;
116 
120  int16_t lightOverID_2x;
121 
125  int16_t lightOverID_3x;
126 
130  int16_t darkOverID;
131 
135  int16_t darkOverID_2x;
136 
140  int16_t darkOverID_3x;
141 
147  ImageIDs();
148 
156  ImageIDs(const ImageIDs& ids_);
157 
167  ImageIDs(const int16_t light_, const int16_t lightOver_, const int16_t dark_);
168 
175  ImageIDs(
176  const int16_t light_,
177  const int16_t light2x_,
178  const int16_t light3x_,
179  const int16_t dark_,
180  const int16_t dark2x_,
181  const int16_t dark3x_
182  );
183 
190  ImageIDs(
191  const int16_t light_,
192  const int16_t light2x_,
193  const int16_t light3x_,
194  const int16_t dark_,
195  const int16_t dark2x_,
196  const int16_t dark3x_,
197  const int16_t lightOver_,
198  const int16_t lightOver2x_,
199  const int16_t lightOver3x_,
200  const int16_t darkOver_,
201  const int16_t darkOver2x_,
202  const int16_t darkOver3x_
203  );
204 
210  ~ImageIDs();
211 
220  ImageIDs& operator=(const ImageIDs& rhs_);
221 
231  bool operator==(const ImageIDs& rhs_) const;
232 
242  bool operator!=(const ImageIDs& rhs_) const;
243  };
244 
245  typedef std::auto_ptr<ImageIDs> ImageIDsAP;
246 
252  virtual ~Widget();
253 
263  static bool isCoreWidget(const PlatformWidgetPtr widget_);
264 
275  virtual Widget* clone() const = 0;
276 
287  virtual Widget* duplicate() const = 0;
288 
300  virtual PlatformWidgetPtr platformWidget() const;
301 
309  virtual bool isEmpty() const;
310 
319  virtual bool operator==(const Widget& rhs_) const;
320 
329  virtual bool operator!=(const Widget& rhs_) const;
330 
338  virtual Type type() const;
339 
347  virtual Window* const window() const;
348 
356  virtual Rect frame() const;
357 
365  virtual void setFrame(const Rect& frame_);
366 
375  virtual void offset(const double x_, const double y_);
376 
384  virtual std::string text() const;
385 
396  virtual void setText(const std::string& text_);
397 
405  virtual bool enabled();
406 
414  virtual void setEnabled(const bool enable_);
415 
423  virtual bool visible();
424 
432  virtual void setVisible(const bool visible_);
433 
441  virtual void setOrigin(const Point& p_);
442 
450  virtual void setSize(const Size& s_);
451 
459  virtual void setWidth(const double w_);
460 
468  virtual void setHeight(const double h_);
469 
477  virtual bool hasFocus() const;
478 
484  virtual void focus() const;
485 
491  virtual void blur() const;
492 
500  virtual std::string tooltip() const;
501 
509  virtual void setTooltip(const std::string& tip_);
510 
516  virtual void update();
517 
525  static std::auto_ptr<Widget> lastClickedWidget();
526 
535  static std::auto_ptr<Widget> lastValueChangingWidget();
536 
545  static std::auto_ptr<Widget> lastValueChangedWidget();
546 
547  #if defined(WIN_ENV)
548 
565  static bool forceIdeographicFontSize(bool& larger__);
566 
586  static void setForceIdeographicFontSize(const bool force_, const bool larger_);
587  #endif
588 
589 
590  protected:
591  friend class ModalDialog;
592  friend class Window;
593  friend plugin::Widget* __accessImpl(const Widget&);
594 
598  void* _data;
599 
605  void* _impl() const;
606 
617  Widget();
618 
629  Widget(const Widget& w_);
630 
636  Widget(plugin::Widget*&);
637 
643  virtual Widget& operator=(const Widget&);
644  };
645 
646  typedef std::auto_ptr<Widget> WidgetAP;
647 
648  extern plugin::Widget* __accessImpl(const Widget&);
649  }
650 }
651 
652 #endif
653 // __HDI_CORE_WIDGET__
virtual void setWidth(const double w_)
Convenience method to set just the width of the target widget's frame.
virtual void setSize(const Size &s_)
Convenience method to set just the size of the target widget's frame.
int16_t darkOverID_3x
PNGI resource ID for the 3x rollover image variant for Illustrator's dark-themed UI.
Definition: hdicoreWidget.h:140
void * _data
Private implementation data.
Definition: hdicoreWidget.h:598
Base class for all interface widgets; handles many common needs, e.g. text, position, size, etc.
Definition: hdicoreWidget.h:39
int16_t lightOverID_3x
PNGI resource ID for the 3x rollover image variant for Illustrator's light-themed UI...
Definition: hdicoreWidget.h:125
int16_t darkID_2x
PNGI resource ID for the 2x image variant for Illustrator's dark-themed UI.
Definition: hdicoreWidget.h:105
virtual Window *const window() const
Gets the parent window of the widget.
virtual PlatformWidgetPtr platformWidget() const
Gets the platform-specific widget, around which the target object is wrapped.
virtual std::string text() const
Gets the current text value of the widget.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual void setVisible(const bool visible_)
Shows or hides the widget.
virtual bool isEmpty() const
Gets whether the target Widget object is empty (constructed with the default ctor) ...
virtual Widget * clone() const =0
Convenience method to clone a Widget object in memory, taking its subclass type into account...
virtual void setOrigin(const Point &p_)
Convenience method to set just the origin of the target widget's frame.
Header file for describing rectangles.
Used to create and display a modal dialog to the user, blocking input to other UI elements...
Definition: hdicoreModalDialog.h:30
Allows for support of multiple PNGI resource IDs for a light-themed UI, dark-themed UI...
Definition: hdicoreWidget.h:73
static std::auto_ptr< Widget > lastValueChangedWidget()
Gets the last widget that received a value changed event (either by the user or programmatically) ...
int16_t lightOverID_2x
PNGI resource ID for the 2x rollover image variant for Illustrator's light-themed UI...
Definition: hdicoreWidget.h:120
int16_t darkID
PNGI resource ID for the 1x image variant for Illustrator's dark-themed UI.
Definition: hdicoreWidget.h:100
bool operator==(const ImageIDs &rhs_) const
Overloaded equality operator to compare two ImageIDs objects with one another.
virtual bool visible()
Gets whether the widget is visible.
bool operator!=(const ImageIDs &rhs_) const
Overloaded equality operator to compare two ImageIDs objects with one another.
int16_t lightID_3x
PNGI resource ID for the 3x image variant for Illustrator's light-themed UI.
Definition: hdicoreWidget.h:95
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:26
int16_t darkOverID
PNGI resource ID for the 1x rollover image variant for Illustrator's dark-themed UI.
Definition: hdicoreWidget.h:130
static std::auto_ptr< Widget > lastValueChangingWidget()
Gets the last widget that received a value changing event (either by the user or programmatically) ...
virtual std::string tooltip() const
Gets the tool tip string for the widget.
virtual void offset(const double x_, const double y_)
Offsets the widget from its current location by the given amounts.
int16_t darkID_3x
PNGI resource ID for the 3x image variant for Illustrator's dark-themed UI.
Definition: hdicoreWidget.h:110
static const int16_t noneID
Default image ID to indicate that no image has been set.
Definition: hdicoreWidget.h:80
static bool forceIdeographicFontSize(bool &larger__)
Gets whether widgets should use an ideographically appropriate font size for widget text on Windows (...
virtual Widget & operator=(const Widget &)
Internal use only.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
virtual void update()
Force the widget to update (i.e. cause it to redraw)
virtual Rect frame() const
Gets the widget frame.
static bool isCoreWidget(const PlatformWidgetPtr widget_)
Gets whether the given platform widget is a hdi_core widget.
virtual bool enabled()
Gets whether the widget is enabled.
virtual void setFrame(const Rect &frame_)
Sets the widget frame.
virtual bool hasFocus() const
Gets whether the widget currently has focus.
virtual Type type() const
Gets the type of the widget.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:24
static void setForceIdeographicFontSize(const bool force_, const bool larger_)
Sets whether widgets should use an ideographically appropriate font size for widget text on Windows (...
int16_t darkOverID_2x
PNGI resource ID for the 2x rollover image variant for Illustrator's dark-themed UI.
Definition: hdicoreWidget.h:135
Definition: hdicoreaiArray.h:12
virtual void setEnabled(const bool enable_)
Enables or disables the widget.
int16_t lightID
PNGI resource ID for the 1x image variant for Illustrator's light-themed UI.
Definition: hdicoreWidget.h:85
ImageIDs & operator=(const ImageIDs &rhs_)
Overloaded assignment operator to copy values from one ImageIDs object to another.
virtual Widget * duplicate() const =0
Convenience method to duplicate a Widget object, creating a new and identical UI element to the targe...
virtual void focus() const
Forces the widget to have focus, taking it from any other focused widget of the same window...
~ImageIDs()
ImageIDs destructor.
virtual bool operator==(const Widget &rhs_) const
Tests whether a given Widget object is the same as another.
virtual void setText(const std::string &text_)
Sets the current text value of the widget.
int16_t lightID_2x
PNGI resource ID for the 2x image variant for Illustrator's light-themed UI.
Definition: hdicoreWidget.h:90
virtual ~Widget()
Destructs a Widget.
static std::auto_ptr< Widget > lastClickedWidget()
Gets the last widget that received a click event (either by the user or programmatically) ...
int16_t lightOverID
PNGI resource ID for the 1x rollover image variant for Illustrator's light-themed UI...
Definition: hdicoreWidget.h:115
Used as a base class for modal dialogs, panels, and control bars.
Definition: hdicoreWindow.h:25
virtual void setTooltip(const std::string &tip_)
Sets the tool tip string for the widget.
ImageIDs()
Default ImageIDs constructor, setting all ID values to noneID.
void * _impl() const
Internal use only.
Widget()
Constructs an empty Widget object.
virtual void setHeight(const double h_)
Convenience method to set just the height of the target widget's frame.
Type
Supported widget types.
Definition: hdicoreWidget.h:45
virtual void blur() const
Removes focus from the widget.
virtual bool operator!=(const Widget &rhs_) const
Tests whether a given Widget object is not the same as another.