Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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
15namespace hdi
16{
17 namespace core
18 {
19 class Callback;
20 class Font;
21
22 #if defined(HDI_CORE_AIP_MODE)
23 class Panel;
24 #endif
25
26 #if defined(HDI_CORE_PSP_MODE)
27 class PixelMap;
28 #endif
29
34 class CustomWidget : public Widget
35 {
36 public:
37 typedef std::vector<Point> PointVector;
38
51
62 CustomWidget(const CustomWidget& widget_);
63
71 CustomWidget(const Rect& frame_);
72
78 virtual ~CustomWidget();
79
88 virtual CustomWidget& operator=(const CustomWidget& rhs_);
89
103 virtual CustomWidget* clone() const;
104
115 virtual CustomWidget* duplicate() const;
116
122 virtual void redraw();
123
134
148 virtual bool getClickDragLocations(Point& start__, Point& end__) const;
149
150 #if defined(HDI_CORE_PSP_MODE)
166 virtual bool getScrollDeltas(double& dx__, double& dy__) const;
167 #endif
168 // HDI_CORE_PSP_MODE
169
178 virtual bool isMouseOver() const;
179
187 virtual Callback* const mouseOverCallback() const;
188
196 virtual void setMouseOverCallback(const Callback& cb_);
197
205 virtual Callback* const mouseMoveCallback() const;
206
214 virtual void setMouseMoveCallback(const Callback& cb_);
215
223 virtual Callback* const mouseOutCallback() const;
224
232 virtual void setMouseOutCallback(const Callback& cb_);
233
241 virtual bool focusesOnClick() const;
242
253 virtual void setFocusesOnClick(const bool focus_);
254
262 virtual Callback* const mouseDownCallback() const;
263
271 virtual void setMouseDownCallback(const Callback& cb_);
272
280 virtual Callback* const mouseDragCallback() const;
281
289 virtual void setMouseDragCallback(const Callback& cb_);
290
298 virtual Callback* const mouseUpCallback() const;
299
307 virtual void setMouseUpCallback(const Callback& cb_);
308
309 #if defined(HDI_CORE_PSP_MODE)
317 virtual Callback* const scrollCallback() const;
318
326 virtual void setScrollCallback(const Callback& cb_);
327 #endif
328 // HDI_CORE_PSP_MODE
329
337 virtual bool draggable() const;
338
346 virtual void setDraggable(const bool enable_);
347
358 virtual std::string dragData() const;
359
370 virtual void setDragData(const std::string& data_);
371
379 virtual bool droppable() const;
380
388 virtual void setDroppable(const bool enable_);
389
398 virtual Callback* const potentialDropCallback() const;
399
408 virtual void setPotentialDropCallback(const Callback& callback_);
409
420 virtual Point potentialDropPoint() const;
421
429 virtual Callback* const dropCallback() const;
430
438 virtual void setDropCallback(const Callback& callback_);
439
449 virtual std::string droppedData() const;
450
460 virtual Point droppedPoint() const;
461
462 #if defined(HDI_CORE_AIP_MODE)
471 virtual std::unique_ptr<Panel> linkedPanel() const;
472
480 virtual void setLinkedPanel(const Panel& p_);
481
487 virtual void removeLinkedPanel();
488
496 virtual void showLinkedPanel(const Point& pt_);
497 #endif
498
506 virtual PlatformDrawingContextPtr platformDC() const;
507
515 virtual Callback* const drawCallback() const;
516
524 virtual void setDrawCallback(const Callback& cb_);
525
534 virtual bool clearsOnRedraw() const;
535
547 virtual void setClearsOnRedraw(const bool clear_);
548
559 virtual void setDrawColor(const Color& color_);
560
572 virtual void drawLine(const Point& from_, const Point& to_);
573
585 virtual void drawRect(const Rect& rect_, const bool fill_ = false);
586
601 virtual void drawRoundedRect(const Rect& rect_, const double radius_, const bool fill_ = false);
602
614 virtual void drawEllipse(const Rect& rect_, const bool fill_ = false);
615
628 virtual void drawPolygon(const PointVector& points_, const bool fill_ = false);
629
644 virtual void drawImage(const Point& tl_, const int16_t pngID_, const double scale_ = 1.0);
645
659 virtual void drawText(
660 const Point& tl_,
661 const std::string& text_,
662 const Font& font_,
663 const double fontSize_
664 );
665
666 #if defined(HDI_CORE_PSP_MODE)
686 virtual void drawPixelData(
687 const PixelMap& srcPM_,
688 const Rect& srcArea_,
689 const Point& dstTL_,
690 const Rect& dstArea_
691 );
692 #endif
693 // HDI_CORE_PSP_MODE
694 };
695
696 typedef std::unique_ptr<CustomWidget> CustomWidgetUP;
697 typedef std::shared_ptr<CustomWidget> CustomWidgetSP;
698 typedef std::weak_ptr<CustomWidget> CustomWidgetWP;
699 }
700}
701
702#endif
703// __HDI_CORE_CUSTOM_WIDGET__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:32
Class for custom plugin widgets; receives notification of a variety of events, can be custom drawn,...
Definition: hdicoreCustomWidget.h:35
virtual bool getClickDragLocations(Point &start__, Point &end__) const
Gets the mouse locations during a click/drag event.
virtual void setDragData(const std::string &data_)
Sets the data that will be passed when the widget is dropped on a receiver.
virtual bool draggable() const
Gets whether dragging support for this particular widget is enabled.
virtual void drawRoundedRect(const Rect &rect_, const double radius_, const bool fill_=false)
Draws a rounded rect, optionally filled; will be the color set by setDrawColor()
virtual void setDraggable(const bool enable_)
Sets whether dragging support for this particular widget is enabled.
CustomWidget(const CustomWidget &widget_)
Constructs a new CustomWidget object from an existing CustomWidget object (copy constructor)
virtual void setMouseDragCallback(const Callback &cb_)
Sets the mouse drag callback.
virtual Point potentialDropPoint() const
Gets the point at which the drop might occur, in the widget's coordinate system.
virtual Callback *const mouseUpCallback() const
Gets the current mouse up callback.
virtual bool focusesOnClick() const
Gets whether the widget automatically takes focus on click (mouse down, specifically)
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 std::string droppedData() const
Gets the data that was passed when the widget received a drop.
virtual void setDroppable(const bool enable_)
Sets whether dropping support for this particular widget is enabled.
virtual void drawText(const Point &tl_, const std::string &text_, const Font &font_, const double fontSize_)
Draws text at the given point.
virtual void setDrawCallback(const Callback &cb_)
Sets the draw callback.
virtual void setMouseOutCallback(const Callback &cb_)
Sets the mouse out callback.
virtual void drawRect(const Rect &rect_, const bool fill_=false)
Draws a rect, optionally filled; will be the color set by setDrawColor()
virtual Callback *const dropCallback() const
Gets the current drop callback for the widget.
virtual Callback *const mouseMoveCallback() const
Gets the current mouse move callback.
virtual CustomWidget * duplicate() const
Convenience method to duplicate a CustomWidget object, creating a new and identical UI element to the...
virtual void drawImage(const Point &tl_, const int16_t pngID_, const double scale_=1.0)
Draws a PNGI image resource at the given point.
virtual ~CustomWidget()
CustomWidget destructor.
virtual Callback *const mouseDownCallback() const
Gets the current mouse down callback.
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()
virtual bool clearsOnRedraw() const
Gets whether the widget automatically clears the frame (i.e. paints the background color over the fra...
virtual void setLinkedPanel(const Panel &p_)
Sets the panel that can be shown when the whenever the custom widget implementer wants.
virtual Callback *const mouseDragCallback() const
Gets the current mouse drag callback.
virtual bool droppable() const
Gets whether dropping support for this particular widget is enabled.
CustomWidget(const Rect &frame_)
CustomWidget constructor, taking an argument for the frame which will receive events.
virtual CustomWidget * clone() const
Convenience method to clone a CustomWidget object on the heap.
virtual void drawEllipse(const Rect &rect_, const bool fill_=false)
Draws an ellipse, optionally filled; will be the color set by setDrawColor()
virtual void setPotentialDropCallback(const Callback &callback_)
Sets the potential-drop callback for the widget.
virtual void removeLinkedPanel()
Removes the panel that should be shown when the label is clicked.
virtual Callback *const mouseOverCallback() const
Gets the current mouse over callback.
virtual PlatformDrawingContextPtr platformDC() const
Gets the platform-specific graphics drawing context for the current draw call.
virtual void showLinkedPanel(const Point &pt_)
Shows the linked panel in a popdown borderless fashion at the given location.
virtual bool isMouseOver() const
Indicates whether the mouse is currently over the widget (useful for implementing rollover effects,...
virtual std::string dragData() const
Gets the data that will be passed when the widget is dropped on a receiver.
virtual void setFocusesOnClick(const bool focus_)
Sets whether the widget automatically takes focus on click (mouse down, specifically)
virtual std::unique_ptr< Panel > linkedPanel() const
Gets the panel that the target custom widget has been associated with.
virtual Callback *const drawCallback() const
Gets the current draw callback.
virtual void setDrawColor(const Color &color_)
Sets the color for the current widget drawing context.
virtual void setMouseDownCallback(const Callback &cb_)
Sets the mouse down callback.
virtual void redraw()
Forces the widget to redraw, calling the appropriate callbacks to do so.
virtual void setMouseOverCallback(const Callback &cb_)
Sets the mouse over callback.
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 setMouseUpCallback(const Callback &cb_)
Sets the mouse up callback.
virtual Point droppedPoint() const
Gets the point at which the drop occurred, in the widget's coordinate system.
virtual Callback *const mouseOutCallback() const
Gets the current mouse out callback.
virtual void setDropCallback(const Callback &callback_)
Sets the drop callback for the widget.
virtual CustomWidget & operator=(const CustomWidget &rhs_)
Allows one CustomWidget object to be assigned from another.
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 Callback *const potentialDropCallback() const
Gets the current potential-drop callback for the widget (for when the mouse is moving over the widget...
CustomWidget()
Constructs an empty CustomWidget object.
Font class to allow for easy font manipulation.
Definition: hdicoreFont.h:183
Used to add a panel to Illustrator's UI and contain various UI widgets.
Definition: hdicorePanel.h:36
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
Base class for all interface widgets; handles many common needs, e.g. text, position,...
Definition: hdicoreWidget.h:30
Header file for describing plugin UI colors.
ModifierKey
Describes various modifier keys.
Definition: hdicoreTypes.h:898
Header file for plugin user interface widgets.