Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreTool.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_TOOL__
8 #define __HDI_CORE_TOOL__
9 
10 #include <vector>
11 
12 #include "hdicoreArtboardPoint.h"
13 #include "hdicoreTypes.h"
14 
15 namespace hdi
16 {
17  namespace plugin
18  {
19  class BaseTool;
20  }
21 
22  namespace core
23  {
24  class BuiltinTool;
25  class Callback;
26  class HitData;
27  class ModalDialog;
28 
32  class Tool
33  {
34  public:
35  typedef std::vector<ArtboardPoint> ArtboardPointVector;
36 
40  enum Options
41  {
42  NoOptions = 0,
43  TracksCursorOption = 1 << 0,
44  DoesntAutoScrollOption = 1 << 1,
45  BufferedDraggingOption = 1 << 2,
46  MaintainsEditContextOption = 1 << 3,
47  WantsToEditTextOption = 1 << 4,
48  WantsToChangeDiameterOption = 1 << 5,
49  WantsAlternateSelectionOption = 1 << 6,
50  HiddenOption = 1 << 7,
51  DoesntAllowSoftSelectionOption = 1 << 8, // Illustrator 17 and above only
52  DefaultOptions = (TracksCursorOption | WantsToChangeDiameterOption)
53  };
54 
65  Tool();
66 
74  Tool(const Tool& tool_);
75 
105  Tool(
106  const Tool& sameGroupAs_,
107  const Tool* const sameSetAs_,
108  const std::string& title_,
109  const std::string& tip_,
110  const int16_t lightIconID_,
111  const int16_t darkIconID_,
112  const Options options_ = DefaultOptions
113  );
114 
144  Tool(
145  const BuiltinTool& sameGroupAs_,
146  const BuiltinTool* const sameSetAs_,
147  const std::string& title_,
148  const std::string& tip_,
149  const int16_t lightIconID_,
150  const int16_t darkIconID_,
151  const Options options_ = DefaultOptions
152  );
153 
184  explicit Tool(
185  const int16_t sameGroupAs_,
186  const int16_t sameSetAs_,
187  const std::string& title_,
188  const std::string& tip_,
189  const int16_t lightIconID_,
190  const int16_t darkIconID_,
191  const Options options_ = DefaultOptions
192  );
193 
199  virtual ~Tool();
200 
211  virtual void destroy();
212 
221  virtual Tool& operator=(const Tool& rhs_);
222 
231  virtual bool operator==(const Tool& rhs_) const;
232 
241  virtual bool operator!=(const Tool& rhs_) const;
242 
254  virtual AIToolHandle aiToolHandle() const;
255 
266  virtual int16_t number() const;
267 
275  virtual bool isEmpty() const;
276 
284  virtual bool selected() const;
285 
291  virtual void setSelected();
292 
300  virtual Options options() const;
301 
309  virtual void setOptions(const Options options_);
310 
318  virtual std::string title() const;
319 
333  virtual void setTitle(const std::string& title_);
334 
342  virtual std::string tip() const;
343 
357  virtual void setTip(const std::string& tip_);
358 
366  virtual int16_t lightIconID() const;
367 
378  virtual void setLightIconID(const int16_t imgID_);
379 
387  virtual int16_t darkIconID() const;
388 
399  virtual void setDarkIconID(const int16_t imgID_);
400 
410  virtual ArtboardPoint cursorLoc() const;
411 
422  virtual void setCursorLoc(const ArtboardPoint& loc_);
423 
431  virtual ArtboardPointVector mouseDownLocs() const;
432 
440  virtual ArtboardPointVector mouseUpLocs() const;
441 
452  virtual std::auto_ptr<HitData> mouseDownHitData(
453  const uint32_t index_,
454  const HitRequest request_,
455  const double tolerance_ = 2.0
456  ) const;
457 
468  virtual std::auto_ptr<HitData> mouseUpHitData(
469  const uint32_t index_,
470  const HitRequest request_,
471  const double tolerance_ = 2.0
472  ) const;
473 
483  virtual std::auto_ptr<HitData> cursorHitData(
484  const HitRequest request_,
485  const double tolerance_ = 2.0
486  ) const;
487 
495  virtual Callback* const selectionCallback() const;
496 
504  virtual void setSelectionCallback(const Callback& cb_);
505 
513  virtual Callback* const reselectionCallback() const;
514 
522  virtual void setReselectionCallback(const Callback& cb_);
523 
531  virtual Callback* const deselectionCallback() const;
532 
540  virtual void setDeselectionCallback(const Callback& cb_);
541 
549  virtual Callback* const trackCallback() const;
550 
558  virtual void setTrackCallback(const Callback& cb_);
559 
567  virtual Callback* const mouseDownCallback() const;
568 
576  virtual void setMouseDownCallback(const Callback& cb_);
577 
585  virtual Callback* const dragCallback() const;
586 
594  virtual void setDragCallback(const Callback& cb_);
595 
603  virtual Callback* const mouseUpCallback() const;
604 
612  virtual void setMouseUpCallback(const Callback& cb_);
613 
621  virtual Callback* const decreaseDiameterCallback() const;
622 
630  virtual void setDecreaseDiameterCallback(const Callback& cb_);
631 
639  virtual Callback* const increaseDiameterCallback() const;
640 
648  virtual void setIncreaseDiameterCallback(const Callback& cb_);
649 
657  virtual Callback* const editCallback() const;
658 
666  virtual void setEditCallback(const Callback& cb_);
667 
676  virtual void resetCursorLocs();
677 
687  virtual bool wasDragged() const;
688 
699  virtual bool shiftKeyDown() const;
700 
714  virtual bool commandKeyDown() const;
715 
727  virtual bool optionKeyDown() const;
728 
739  virtual bool controlKeyDown() const;
740 
753  virtual ModalDialog* const inputDialog() const;
754 
767  virtual void setInputDialog(const ModalDialog& dialog_);
768 
780  virtual ModalDialog* const prefsDialog() const;
781 
793  virtual void setPrefsDialog(const ModalDialog& dialog_);
794 
803  virtual bool autoShowPrefsDialog() const;
804 
813  virtual void setAutoShowPrefsDialog(const bool show_);
814 
815 
816  private:
817  friend plugin::BaseTool* __accessImpl(const Tool&);
818  friend Tool __accessCtorTool(const void*);
819 
823  void* __data;
824 
830  void* __impl() const;
831 
837  Tool(const void*);
838  };
839 
840  typedef std::auto_ptr<Tool> ToolAP;
841 
842  extern plugin::BaseTool* __accessImpl(const Tool&);
843  extern Tool __accessCtorTool(const void*);
844  }
845 }
846 
847 hdi::core::Tool::Options operator|(
848  const hdi::core::Tool::Options lhs_,
849  const hdi::core::Tool::Options rhs_
850 );
851 
852 hdi::core::Tool::Options& operator|=(
854  const hdi::core::Tool::Options rhs_
855 );
856 
857 #endif
858 // __HDI_CORE_TOOL__
virtual void setCursorLoc(const ArtboardPoint &loc_)
Stores the current location of the cursor.
virtual Callback *const selectionCallback() const
Gets the registered callback for the tool selection event.
virtual bool selected() const
Gets whether the target Tool object is the currently selected tool.
virtual void setReselectionCallback(const Callback &cb_)
Sets the callback for the tool reselection event.
virtual ModalDialog *const inputDialog() const
Gets the modal input dialog for the target tool.
virtual bool isEmpty() const
Gets whether the target Tool object is empty (constructed with the default ctor)
virtual Callback *const mouseUpCallback() const
Gets the registered callback for the mouse up event.
virtual ArtboardPointVector mouseUpLocs() const
Gets the mouse up points for the target tool.
Class for accessing and querying built-in Illustrator tools.
Definition: hdicoreBuiltinTool.h:21
Tool()
Constructs an empty Tool object.
virtual std::string tip() const
Gets the tool's tip string.
virtual Callback *const dragCallback() const
Gets the registered callback for the drag event.
virtual void setEditCallback(const Callback &cb_)
Sets the callback for the tool edit event.
Used to create and display a modal dialog to the user, blocking input to other UI elements...
Definition: hdicoreModalDialog.h:30
virtual Options options() const
Gets the options set for the tool.
virtual void setTrackCallback(const Callback &cb_)
Sets the callback for the tool tracking event (mouse move)
virtual Callback *const reselectionCallback() const
Gets the registered callback for the tool reselection event.
virtual Callback *const increaseDiameterCallback() const
Gets the registered callback for the increase diameter event (']' key)
virtual ArtboardPoint cursorLoc() const
Gets the current location of the cursor.
virtual void setPrefsDialog(const ModalDialog &dialog_)
Sets the modal prefs dialog for the target tool.
virtual std::auto_ptr< HitData > mouseUpHitData(const uint32_t index_, const HitRequest request_, const double tolerance_=2.0) const
Gets hit data for a given point in the mouse up location vector.
virtual ArtboardPointVector mouseDownLocs() const
Gets the mouse down points for the target tool.
virtual ~Tool()
Destructs a Tool object.
Base class for templated __Callback class.
Definition: hdicoreCallback.h:67
virtual bool optionKeyDown() const
Determines whether the option key is down.
virtual ModalDialog *const prefsDialog() const
Gets the modal prefs dialog for the target tool.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
virtual void setDecreaseDiameterCallback(const Callback &cb_)
Sets the callback for the decrease diameter event.
virtual bool controlKeyDown() const
Determines whether the control key is down.
Header file for geometric point manipulation on the Illustrator artboard.
virtual void setDeselectionCallback(const Callback &cb_)
Sets the callback for the tool deselection event.
virtual std::auto_ptr< HitData > mouseDownHitData(const uint32_t index_, const HitRequest request_, const double tolerance_=2.0) const
Gets hit data for a given point in the mouse down location vector.
virtual void setDragCallback(const Callback &cb_)
Sets the callback for the drag event.
virtual void setOptions(const Options options_)
Sets the options for the tool.
virtual bool autoShowPrefsDialog() const
Gets whether the tool prefs dialog should automatically be shown when the tool is double-clicked in t...
virtual bool wasDragged() const
Gets whether the tool has been dragged.
virtual void destroy()
Destroys the tool, converting the target object to an empty Tool object (see the default constructor ...
Definition: hdicoreaiArray.h:12
virtual bool shiftKeyDown() const
Determines whether the shift key is down.
Base class for all tools; stores hit data, cursor loc, dialogs, etc.; receives tool-related messages...
Definition: hdicoreTool.h:32
virtual void setLightIconID(const int16_t imgID_)
Sets the light UI icon ID.
virtual bool operator==(const Tool &rhs_) const
Tests whether a given Tool object is the same as another.
virtual void setMouseDownCallback(const Callback &cb_)
Sets the callback for the mouse down event.
virtual void setIncreaseDiameterCallback(const Callback &cb_)
Sets the callback for the increase diameter event.
virtual Callback *const editCallback() const
Gets the registered callback for the tool edit event (when its icon is double-clicked) ...
virtual Tool & operator=(const Tool &rhs_)
Assigns one Tool object to another.
virtual void setSelected()
Sets the target Tool object as the currently selected tool.
virtual void setSelectionCallback(const Callback &cb_)
Sets the callback for the tool selection event.
Options
Controls various options for a tool.
Definition: hdicoreTool.h:40
virtual bool operator!=(const Tool &rhs_) const
Tests whether a given Tool object is not the same as another.
virtual bool commandKeyDown() const
Determines whether the command key is down.
virtual void setInputDialog(const ModalDialog &dialog_)
Sets the modal input dialog for the target tool.
virtual void setAutoShowPrefsDialog(const bool show_)
Sets whether the tool prefs dialog should automatically be shown when the tool is double- clicked in ...
virtual int16_t darkIconID() const
Gets the dark UI icon ID as set when the tool was created.
virtual void setTitle(const std::string &title_)
Sets the tool's title.
virtual int16_t lightIconID() const
Gets the light UI icon ID as set when the tool was created.
virtual int16_t number() const
Gets the tool's number.
virtual void setDarkIconID(const int16_t imgID_)
Sets the dark UI icon ID.
virtual void resetCursorLocs()
Clears the mouse down and mouse up location containers.
virtual Callback *const deselectionCallback() const
Gets the registered callback for the tool deselection event.
virtual Callback *const decreaseDiameterCallback() const
Gets the registered callback for the decrease diameter event ('[' key)
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:28
virtual Callback *const mouseDownCallback() const
Gets the registered callback for the mouse down event.
virtual std::string title() const
Gets the tool's title.
virtual Callback *const trackCallback() const
Gets the registered callback for the tool tracking event (mouse move)
virtual std::auto_ptr< HitData > cursorHitData(const HitRequest request_, const double tolerance_=2.0) const
Gets hit data for the current cursor location.
virtual AIToolHandle aiToolHandle() const
Gets the tool handle around which the target object is wrapped.
virtual void setMouseUpCallback(const Callback &cb_)
Sets the callback for the mouse up event.
virtual void setTip(const std::string &tip_)
Sets the tool's tip string.