Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreWidget.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_WIDGET__
8#define __HDI_CORE_WIDGET__
9
10#include "hdicoreImageIDs.h"
11#include "hdicoreRect.h"
12#include "hdicoreSVGIDs.h"
13
14namespace hdi
15{
16 namespace pui
17 {
18 class Widget;
19 }
20
21 namespace core
22 {
23 class Callback;
24 class Window;
25
29 class Widget
30 {
31 public:
35 enum Type
36 {
37 UnknownType = 0,
38 BoxType = 10, // Box class
39 ButtonType = 20, // Button class
40 CheckboxType = 30, // Checkbox class
41 ColumnViewType = 40, // ColumnView class
42 ComboBoxType = 50, // ComboBox class
43 ColorWellType = 60, // ColorWell class
44 CustomType = 70, // CustomWidget class
45 DividerType = 80, // Divider class
46 HierarchicalColumnViewType = 85, // HierarchicalColumnView class
47 HierarchicalViewType = 90, // HierarchicalView class
48 LabelType = 100, // Label class
49 ListViewType = 110, // ListView class
50 PopupMenuType = 120, // PopupMenu class
51 RadioButtonType = 130, // RadioButton class
52 SliderType = 140, // Slider class
53 StepperType = 150, // Stepper class
54 TextFieldType = 160, // TextField class
55 TextViewType = 170, // TextView class
56 WebViewType = 180 // WebView class
57 };
58
64 virtual ~Widget();
65
75 static bool isCoreWidget(const PlatformWidgetPtr widget_);
76
87 virtual Widget* clone() const = 0;
88
99 virtual Widget* duplicate() const = 0;
100
112 virtual PlatformWidgetPtr platformWidget() const;
113
121 virtual bool isEmpty() const;
122
131 virtual bool operator==(const Widget& rhs_) const;
132
141 virtual bool operator!=(const Widget& rhs_) const;
142
150 virtual Type type() const;
151
159 virtual Window* const window() const;
160
169 virtual Rect frame() const;
170
178 virtual void setFrame(const Rect& frame_);
179
188 virtual void offset(const double x_, const double y_);
189
197 virtual std::string text() const;
198
209 virtual void setText(const std::string& text_);
210
218 virtual bool enabled();
219
227 virtual void setEnabled(const bool enable_);
228
236 virtual bool visible();
237
245 virtual void setVisible(const bool visible_);
246
254 virtual void setOrigin(const Point& p_);
255
263 virtual void setSize(const Size& s_);
264
272 virtual void setWidth(const double w_);
273
281 virtual void setHeight(const double h_);
282
290 virtual bool hasFocus() const;
291
297 virtual void focus() const;
298
306 virtual Callback* const focusCallback() const;
307
317 virtual void setFocusCallback(const Callback& callback_);
318
324 virtual void blur() const;
325
333 virtual Callback* const blurCallback() const;
334
344 virtual void setBlurCallback(const Callback& callback_);
345
353 virtual std::string tooltip() const;
354
362 virtual void setTooltip(const std::string& tip_);
363
369 virtual void update();
370
378 static std::unique_ptr<Widget> lastClickedWidget();
379
388 static std::unique_ptr<Widget> lastValueChangingWidget();
389
398 static std::unique_ptr<Widget> lastValueChangedWidget();
399
408 static std::unique_ptr<Widget> lastDropWidget();
409
417 static std::unique_ptr<Widget> lastPotentialReorderWidget();
418
426 static std::unique_ptr<Widget> lastReorderWidget();
427
428 #if defined(WIN_ENV)
446 static bool forceIdeographicFontSize(bool& larger__);
447
467 static void setForceIdeographicFontSize(const bool force_, const bool larger_);
468 #endif
469
470
471 protected:
472 friend class ModalDialog;
473 friend class Window;
474 friend pui::Widget* __accessImpl(const Widget&);
475
479 void* _data;
480
486 void* _impl() const;
487
499
510 Widget(const Widget& w_);
511
517 Widget(pui::Widget*&);
518
524 virtual Widget& operator=(const Widget&);
525 };
526
527 typedef std::unique_ptr<Widget> WidgetUP;
528 typedef std::shared_ptr<Widget> WidgetSP;
529 typedef std::weak_ptr<Widget> WidgetWP;
530
531 extern pui::Widget* __accessImpl(const Widget&);
532 }
533}
534
535#endif
536// __HDI_CORE_WIDGET__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Used to create and display a modal dialog to the user, blocking input to other UI elements.
Definition: hdicoreModalDialog.h:25
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
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
virtual Callback *const blurCallback() const
Gets the current blur callback for the widget.
virtual void setFrame(const Rect &frame_)
Sets the widget frame.
Widget()
Constructs an empty Widget object.
static std::unique_ptr< Widget > lastValueChangedWidget()
Gets the last widget that received a value changed event (either by the user or programmatically)
virtual Rect frame() const
Gets the widget frame.
Widget(pui::Widget *&)
Internal use only.
static std::unique_ptr< Widget > lastReorderWidget()
Gets the last widget that received a reorder event.
static std::unique_ptr< Widget > lastClickedWidget()
Gets the last widget that received a click event (either by the user or programmatically)
virtual bool enabled()
Gets whether the widget is enabled.
virtual bool operator!=(const Widget &rhs_) const
Tests whether a given Widget object is not the same as another.
virtual Widget & operator=(const Widget &)
Internal use only.
virtual Widget * duplicate() const =0
Convenience method to duplicate a Widget object, creating a new and identical UI element to the targe...
virtual void setEnabled(const bool enable_)
Enables or disables the widget.
virtual Widget * clone() const =0
Convenience method to clone a Widget object in memory, taking its subclass type into account.
virtual bool hasFocus() const
Gets whether the widget currently has focus.
virtual Window *const window() const
Gets the parent window of the widget.
static std::unique_ptr< Widget > lastValueChangingWidget()
Gets the last widget that received a value changing event (either by the user or programmatically)
virtual void offset(const double x_, const double y_)
Offsets the widget from its current location by the given amounts, in 1x resolution coordinates.
virtual ~Widget()
Destructs a Widget.
virtual void setBlurCallback(const Callback &callback_)
Sets the blur callback for the widget.
virtual void setSize(const Size &s_)
Convenience method to set just the size of the target widget's frame.
Widget(const Widget &w_)
Constructs a new Widget object from an existing Widget object (copy constructor)
virtual Callback *const focusCallback() const
Gets the current focus callback for the widget.
virtual void setTooltip(const std::string &tip_)
Sets the tool tip string for the widget.
virtual void setWidth(const double w_)
Convenience method to set just the width of the target widget's frame.
virtual void setOrigin(const Point &p_)
Convenience method to set just the origin of the target widget's frame.
void * _impl() const
Internal use only.
virtual bool visible()
Gets whether the widget is visible.
virtual bool isEmpty() const
Gets whether the target Widget object is empty (constructed with the default ctor)
virtual void update()
Force the widget to update (i.e. cause it to redraw)
virtual void blur() const
Removes focus from the widget.
static std::unique_ptr< Widget > lastPotentialReorderWidget()
Gets the last widget that received a potential-reorder event.
virtual void setHeight(const double h_)
Convenience method to set just the height of the target widget's frame.
static std::unique_ptr< Widget > lastDropWidget()
Gets the last widget that received a drag-and-drop drop event (either by the user or programmatically...
virtual void setText(const std::string &text_)
Sets the current text value of the widget.
virtual void focus() const
Forces the widget to have focus, taking it from any other focused widget of the same window.
virtual PlatformWidgetPtr platformWidget() const
Gets the platform-specific widget, around which the target object is wrapped.
Type
Supported widget types.
Definition: hdicoreWidget.h:36
void * _data
Private implementation data.
Definition: hdicoreWidget.h:479
virtual void setFocusCallback(const Callback &callback_)
Sets the focus callback for the widget.
virtual std::string tooltip() const
Gets the tool tip string for the widget.
static bool isCoreWidget(const PlatformWidgetPtr widget_)
Gets whether the given platform widget is a hdi_core widget.
virtual std::string text() const
Gets the current text value of the widget.
virtual bool operator==(const Widget &rhs_) const
Tests whether a given Widget object is the same as another.
virtual Type type() const
Gets the type of the widget.
virtual void setVisible(const bool visible_)
Shows or hides the widget.
Used as a base class for modal dialogs, panels, and control bars.
Definition: hdicoreWindow.h:26
Header file for handling image IDs and their higher resolution variants.
Header file for describing rectangles.
Header file for handling vector graphic IDs.