Hot Door CORE  0.7.1
Adobe® Illustrator® Plug-in Library
hdicoreCustomWidget.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_CUSTOM_WIDGET__
8 #define __HDI_CORE_CUSTOM_WIDGET__
9 
10 #include <vector>
11 
12 #include "hdicoreColor.h"
13 #include "hdicoreWidget.h"
14 
15 #if defined(MAC_ENV)
16  @class NSGraphicsContext;
17 #elif defined(WIN_ENV)
18  class CDC;
19 #endif
20 
21 namespace hdi
22 {
23  namespace core
24  {
25  class Callback;
26 
27  #if defined(MAC_ENV)
28  typedef NSGraphicsContext* PlatformDrawingContextPtr;
29  #elif defined(WIN_ENV)
30  typedef CDC* PlatformDrawingContextPtr;
31  #endif
32 
37  class CustomWidget : public Widget
38  {
39  public:
40  typedef std::vector<Point> PointVector;
41 
53  CustomWidget();
54 
65  CustomWidget(const CustomWidget& widget_);
66 
74  CustomWidget(const Rect& frame_);
75 
81  virtual ~CustomWidget();
82 
91  virtual CustomWidget& operator=(const CustomWidget& rhs_);
92 
106  virtual CustomWidget* clone() const;
107 
118  virtual CustomWidget* duplicate() const;
119 
125  virtual void redraw();
126 
136  virtual ModifierKey getClickDragModifiers() const;
137 
151  virtual bool getClickDragLocations(Point& start__, Point& end__) const;
152 
161  virtual bool isMouseOver() const;
162 
170  virtual Callback* const mouseOverCallback() const;
171 
179  virtual void setMouseOverCallback(const Callback& cb_);
180 
188  virtual Callback* const mouseMoveCallback() const;
189 
197  virtual void setMouseMoveCallback(const Callback& cb_);
198 
206  virtual Callback* const mouseOutCallback() const;
207 
215  virtual void setMouseOutCallback(const Callback& cb_);
216 
224  virtual Callback* const mouseDownCallback() const;
225 
233  virtual void setMouseDownCallback(const Callback& cb_);
234 
242  virtual Callback* const mouseDragCallback() const;
243 
251  virtual void setMouseDragCallback(const Callback& cb_);
252 
260  virtual Callback* const mouseUpCallback() const;
261 
269  virtual void setMouseUpCallback(const Callback& cb_);
270 
278  PlatformDrawingContextPtr platformDC() const;
279 
287  virtual Callback* const drawCallback() const;
288 
296  virtual void setDrawCallback(const Callback& cb_);
297 
306  virtual bool clearsOnRedraw() const;
307 
319  virtual void setClearsOnRedraw(const bool clear_);
320 
331  virtual void setDrawColor(const Color& color_);
332 
344  virtual void drawLine(const Point& from_, const Point& to_);
345 
357  virtual void drawRect(const Rect& rect_, const bool fill_ = false);
358 
370  virtual void drawEllipse(const Rect& rect_, const bool fill_ = false);
371 
384  virtual void drawPolygon(const PointVector& points_, const bool fill_ = false);
385 
400  virtual void drawImage(const Point& tl_, const int16_t pngID_, const double scale_ = 1.0);
401  };
402 
403  typedef std::auto_ptr<CustomWidget> CustomWidgetAP;
404  }
405 }
406 
407 #endif
408 // __HDI_CORE_CUSTOM_WIDGET__
virtual Callback *const mouseMoveCallback() const
Gets the current mouse move callback.
virtual Callback *const mouseDownCallback() const
Gets the current mouse down callback.
Base class for all interface widgets; handles many common needs, e.g. text, position, size, etc.
Definition: hdicoreWidget.h:39
virtual Callback *const mouseDragCallback() const
Gets the current mouse drag callback.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual void drawLine(const Point &from_, const Point &to_)
Draws a line from a given point to an endpoint; will be the color set by setDrawColor() ...
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:24
virtual void setClearsOnRedraw(const bool clear_)
Sets whether the widget automatically clears the frame (i.e. paints the background color over the fra...
virtual void drawPolygon(const PointVector &points_, const bool fill_=false)
Draws a polygon composed of a given set of points; can optionally be filled with the current draw col...
virtual void setMouseOverCallback(const Callback &cb_)
Sets the mouse over callback.
virtual Callback *const mouseUpCallback() const
Gets the current mouse up callback.
virtual Callback *const mouseOverCallback() const
Gets the current mouse over callback.
virtual CustomWidget & operator=(const CustomWidget &rhs_)
Allows one CustomWidget object to be assigned from another.
virtual CustomWidget * duplicate() const
Convenience method to duplicate a CustomWidget object, creating a new and identical UI element to the...
virtual void setMouseUpCallback(const Callback &cb_)
Sets the mouse up callback.
PlatformDrawingContextPtr platformDC() const
Gets the platform-specific graphics drawing context for the current draw call.
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:26
virtual void setMouseOutCallback(const Callback &cb_)
Sets the mouse out callback.
Header file for describing Illustrator UI colors.
virtual void setDrawColor(const Color &color_)
Sets the color for the current widget drawing context.
Base class for templated __Callback class.
Definition: hdicoreCallback.h:67
virtual Callback *const mouseOutCallback() const
Gets the current mouse out callback.
ModifierKey
Describes various modifier keys.
Definition: hdicoreTypes.h:570
virtual Callback *const drawCallback() const
Gets the current draw callback.
virtual bool clearsOnRedraw() const
Gets whether the widget automatically clears the frame (i.e. paints the background color over the fra...
virtual void setMouseDownCallback(const Callback &cb_)
Sets the mouse down callback.
virtual void setMouseMoveCallback(const Callback &cb_)
Sets the mouse move callback.
virtual ModifierKey getClickDragModifiers() const
Gets the modifier keys used during a click/drag event.
virtual bool isMouseOver() const
Indicates whether the mouse is currently over the widget (useful for implementing rollover effects...
virtual void drawRect(const Rect &rect_, const bool fill_=false)
Draws a rect, optionally filled; will be the color set by setDrawColor()
Definition: hdicoreaiArray.h:12
virtual void drawImage(const Point &tl_, const int16_t pngID_, const double scale_=1.0)
Draws a PNGI image resource at the given point.
Header file for Illustrator user interface widgets.
virtual CustomWidget * clone() const
Convenience method to clone a CustomWidget object on the heap.
Class for custom Illustrator widgets; receives notification of a variety of events, can be custom drawn, etc.
Definition: hdicoreCustomWidget.h:37
virtual void setDrawCallback(const Callback &cb_)
Sets the draw callback.
virtual void redraw()
Forces the widget to redraw, calling the appropriate callbacks to do so.
virtual ~CustomWidget()
CustomWidget destructor.
virtual bool getClickDragLocations(Point &start__, Point &end__) const
Gets the mouse locations during a click/drag event.
virtual void setMouseDragCallback(const Callback &cb_)
Sets the mouse drag callback.
CustomWidget()
Constructs an empty CustomWidget object.
virtual void drawEllipse(const Rect &rect_, const bool fill_=false)
Draws an ellipse, optionally filled; will be the color set by setDrawColor()