Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreTool.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_TOOL__
8#define __HDI_CORE_TOOL__
9
10#if defined(HDI_CORE_AIP_MODE)
11
12#include <vector>
13
15#include "hdicoreTypes.h"
16
17namespace hdi
18{
19 namespace aip
20 {
21 class BaseTool;
22 }
23
24 namespace core
25 {
26 class BuiltinTool;
27 class Callback;
28 class HitData;
29 class ModalDialog;
30
34 class Tool
35 {
36 public:
37 typedef std::vector<ArtboardPoint> ArtboardPointVector;
38
43 {
44 NoOptions = 0,
45 TracksCursorOption = 1 << 0,
46 DoesntAutoScrollOption = 1 << 1,
47 BufferedDraggingOption = 1 << 2,
48 MaintainsEditContextOption = 1 << 3,
49 WantsToEditTextOption = 1 << 4,
50 WantsToChangeDiameterOption = 1 << 5,
51 WantsAlternateSelectionOption = 1 << 6,
52 HiddenOption = 1 << 7,
53 DoesntAllowSoftSelectionOption = 1 << 8,
54 DefaultOptions = (TracksCursorOption | WantsToChangeDiameterOption)
55 };
56
68
76 Tool(const Tool& tool_);
77
106 const Tool& sameGroupAs_,
107 const Tool* const sameSetAs_,
108 const std::string& title_,
109 const std::string& tip_,
110 const IconResourceType iconType_,
111 const int16_t lightIconID_,
112 const int16_t darkIconID_,
113 const Options options_ = DefaultOptions
114 );
115
144 const BuiltinTool& sameGroupAs_,
145 const BuiltinTool* const sameSetAs_,
146 const std::string& title_,
147 const std::string& tip_,
148 const IconResourceType iconType_,
149 const int16_t lightIconID_,
150 const int16_t darkIconID_,
151 const Options options_ = DefaultOptions
152 );
153
182 explicit Tool(
183 const int16_t sameGroupAs_,
184 const int16_t sameSetAs_,
185 const std::string& title_,
186 const std::string& tip_,
187 const IconResourceType iconType_,
188 const int16_t lightIconID_,
189 const int16_t darkIconID_,
190 const Options options_ = DefaultOptions
191 );
192
198 virtual ~Tool();
199
210 virtual void destroy();
211
220 virtual Tool& operator=(const Tool& rhs_);
221
230 virtual bool operator==(const Tool& rhs_) const;
231
240 virtual bool operator!=(const Tool& rhs_) const;
241
253 virtual AIToolHandle aiToolHandle() const;
254
265 virtual int16_t number() const;
266
274 virtual bool isEmpty() const;
275
283 virtual bool selected() const;
284
290 virtual void setSelected();
291
299 virtual Options options() const;
300
308 virtual void setOptions(const Options options_);
309
317 virtual std::string title() const;
318
326 virtual void setTitle(const std::string& title_);
327
335 virtual std::string tip() const;
336
344 virtual void setTip(const std::string& tip_);
345
353 virtual IconResourceType iconType() const;
354
362 virtual int16_t lightIconID() const;
363
371 virtual void setLightIconID(const int16_t imgID_);
372
380 virtual int16_t darkIconID() const;
381
389 virtual void setDarkIconID(const int16_t imgID_);
390
400 virtual ArtboardPoint cursorLoc() const;
401
412 virtual void setCursorLoc(const ArtboardPoint& loc_);
413
421 virtual ArtboardPointVector mouseDownLocs() const;
422
430 virtual ArtboardPointVector mouseUpLocs() const;
431
442 virtual std::unique_ptr<HitData> mouseDownHitData(
443 const uint32_t index_,
444 const HitRequest request_,
445 const double tolerance_ = 2.0
446 ) const;
447
458 virtual std::unique_ptr<HitData> mouseUpHitData(
459 const uint32_t index_,
460 const HitRequest request_,
461 const double tolerance_ = 2.0
462 ) const;
463
473 virtual std::unique_ptr<HitData> cursorHitData(
474 const HitRequest request_,
475 const double tolerance_ = 2.0
476 ) const;
477
485 virtual Callback* const selectionCallback() const;
486
494 virtual void setSelectionCallback(const Callback& cb_);
495
503 virtual Callback* const reselectionCallback() const;
504
512 virtual void setReselectionCallback(const Callback& cb_);
513
521 virtual Callback* const deselectionCallback() const;
522
530 virtual void setDeselectionCallback(const Callback& cb_);
531
539 virtual Callback* const trackCallback() const;
540
548 virtual void setTrackCallback(const Callback& cb_);
549
557 virtual Callback* const mouseDownCallback() const;
558
566 virtual void setMouseDownCallback(const Callback& cb_);
567
575 virtual Callback* const dragCallback() const;
576
584 virtual void setDragCallback(const Callback& cb_);
585
593 virtual Callback* const mouseUpCallback() const;
594
602 virtual void setMouseUpCallback(const Callback& cb_);
603
611 virtual Callback* const decreaseDiameterCallback() const;
612
620 virtual void setDecreaseDiameterCallback(const Callback& cb_);
621
629 virtual Callback* const increaseDiameterCallback() const;
630
638 virtual void setIncreaseDiameterCallback(const Callback& cb_);
639
647 virtual Callback* const editCallback() const;
648
656 virtual void setEditCallback(const Callback& cb_);
657
666 virtual void resetCursorLocs();
667
677 virtual bool wasDragged() const;
678
689 virtual bool shiftKeyDown() const;
690
704 virtual bool commandKeyDown() const;
705
717 virtual bool optionKeyDown() const;
718
729 virtual bool controlKeyDown() const;
730
743 virtual ModalDialog* const inputDialog() const;
744
757 virtual void setInputDialog(const ModalDialog& dialog_);
758
770 virtual ModalDialog* const prefsDialog() const;
771
783 virtual void setPrefsDialog(const ModalDialog& dialog_);
784
793 virtual bool autoShowPrefsDialog() const;
794
803 virtual void setAutoShowPrefsDialog(const bool show_);
804
805
806 private:
807 friend aip::BaseTool* __accessImpl(const Tool&);
808 friend Tool __accessCtorTool(const void*);
809
813 void* __data;
814
820 void* __impl() const;
821
827 Tool(const void*);
828 };
829
830 typedef std::unique_ptr<Tool> ToolUP;
831 typedef std::shared_ptr<Tool> ToolSP;
832 typedef std::weak_ptr<Tool> ToolWP;
833
834 extern aip::BaseTool* __accessImpl(const Tool&);
835 extern Tool __accessCtorTool(const void*);
836 }
837}
838
840 const hdi::core::Tool::Options lhs_,
841 const hdi::core::Tool::Options rhs_
842);
843
844hdi::core::Tool::Options& operator|=(
846 const hdi::core::Tool::Options rhs_
847);
848
849#endif
850// HDI_CORE_AIP_MODE
851
852#endif
853// __HDI_CORE_TOOL__
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:31
Class for accessing and querying built-in Illustrator tools.
Definition: hdicoreBuiltinTool.h:24
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
Base class for all tools; stores hit data, cursor loc, dialogs, etc.; receives tool-related messages.
Definition: hdicoreTool.h:35
virtual bool operator!=(const Tool &rhs_) const
Tests whether a given Tool object is not the same as another.
virtual Callback *const trackCallback() const
Gets the registered callback for the tool tracking event (mouse move)
virtual std::unique_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 Tool & operator=(const Tool &rhs_)
Assigns one Tool object to another.
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.
virtual void setAutoShowPrefsDialog(const bool show_)
Sets whether the tool prefs dialog should automatically be shown when the tool is double- clicked in ...
virtual void setSelected()
Sets the target Tool object as the currently selected tool.
virtual int16_t number() const
Gets the tool's number.
virtual void setReselectionCallback(const Callback &cb_)
Sets the callback for the tool reselection event.
virtual Callback *const increaseDiameterCallback() const
Gets the registered callback for the increase diameter event (']' key)
virtual void setCursorLoc(const ArtboardPoint &loc_)
Stores the current location of the cursor.
virtual bool selected() const
Gets whether the target Tool object is the currently selected tool.
virtual Callback *const reselectionCallback() const
Gets the registered callback for the tool reselection event.
virtual Callback *const dragCallback() const
Gets the registered callback for the drag event.
virtual bool autoShowPrefsDialog() const
Gets whether the tool prefs dialog should automatically be shown when the tool is double-clicked in t...
virtual void setDeselectionCallback(const Callback &cb_)
Sets the callback for the tool deselection event.
virtual Callback *const mouseUpCallback() const
Gets the registered callback for the mouse up event.
virtual bool operator==(const Tool &rhs_) const
Tests whether a given Tool object is the same as another.
Tool(const Tool &tool_)
Constructs a new Tool object from an existing Tool object (copy constructor)
Tool(const int16_t sameGroupAs_, const int16_t sameSetAs_, const std::string &title_, const std::string &tip_, const IconResourceType iconType_, const int16_t lightIconID_, const int16_t darkIconID_, const Options options_=DefaultOptions)
Constructs a new Tool object in the same set/group as some third-party tool (via handles)
virtual IconResourceType iconType() const
Gets which type of icon resource the tool was originally constructed with.
virtual Callback *const decreaseDiameterCallback() const
Gets the registered callback for the decrease diameter event ('[' key)
virtual void setInputDialog(const ModalDialog &dialog_)
Sets the modal input dialog for the target tool.
virtual Options options() const
Gets the options set for the tool.
virtual void destroy()
Destroys the tool, converting the target object to an empty Tool object (see the default constructor ...
virtual void setOptions(const Options options_)
Sets the options for the tool.
virtual std::string title() const
Gets the tool's title.
virtual bool shiftKeyDown() const
Determines whether the shift key is down.
virtual ArtboardPointVector mouseDownLocs() const
Gets the mouse down points for the target tool.
Options
Controls various options for a tool.
Definition: hdicoreTool.h:43
virtual void setTip(const std::string &tip_)
Sets the tool's tip string.
virtual int16_t darkIconID() const
Gets the dark UI icon ID as set when the tool was created.
virtual int16_t lightIconID() const
Gets the light UI icon ID as set when the tool was created.
virtual ModalDialog *const inputDialog() const
Gets the modal input dialog for the target tool.
Tool(const Tool &sameGroupAs_, const Tool *const sameSetAs_, const std::string &title_, const std::string &tip_, const IconResourceType iconType_, const int16_t lightIconID_, const int16_t darkIconID_, const Options options_=DefaultOptions)
Constructs a new Tool object, optionally in the same set/group as one of your own tools.
virtual std::string tip() const
Gets the tool's tip string.
Tool(const BuiltinTool &sameGroupAs_, const BuiltinTool *const sameSetAs_, const std::string &title_, const std::string &tip_, const IconResourceType iconType_, const int16_t lightIconID_, const int16_t darkIconID_, const Options options_=DefaultOptions)
Constructs a new Tool object in the same set/group as a built-in Illustrator tool.
virtual AIToolHandle aiToolHandle() const
Gets the tool handle around which the target object is wrapped.
virtual void setTitle(const std::string &title_)
Sets the tool's title.
virtual void resetCursorLocs()
Clears the mouse down and mouse up location containers.
virtual void setPrefsDialog(const ModalDialog &dialog_)
Sets the modal prefs dialog for the target tool.
virtual bool wasDragged() const
Gets whether the tool has been dragged.
virtual void setMouseDownCallback(const Callback &cb_)
Sets the callback for the mouse down event.
virtual void setMouseUpCallback(const Callback &cb_)
Sets the callback for the mouse up event.
virtual void setTrackCallback(const Callback &cb_)
Sets the callback for the tool tracking event (mouse move)
virtual bool commandKeyDown() const
Determines whether the command key is down.
virtual Callback *const selectionCallback() const
Gets the registered callback for the tool selection event.
virtual std::unique_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 ArtboardPointVector mouseUpLocs() const
Gets the mouse up points for the target tool.
virtual void setDragCallback(const Callback &cb_)
Sets the callback for the drag event.
virtual Callback *const editCallback() const
Gets the registered callback for the tool edit event (when its icon is double-clicked)
virtual void setEditCallback(const Callback &cb_)
Sets the callback for the tool edit event.
virtual void setLightIconID(const int16_t imgID_)
Sets the light UI icon ID.
virtual void setIncreaseDiameterCallback(const Callback &cb_)
Sets the callback for the increase diameter event.
virtual bool optionKeyDown() const
Determines whether the option key is down.
virtual void setDarkIconID(const int16_t imgID_)
Sets the dark UI icon ID.
virtual ModalDialog *const prefsDialog() const
Gets the modal prefs dialog for the target tool.
virtual std::unique_ptr< HitData > cursorHitData(const HitRequest request_, const double tolerance_=2.0) const
Gets hit data for the current cursor location.
virtual void setSelectionCallback(const Callback &cb_)
Sets the callback for the tool selection event.
virtual Callback *const mouseDownCallback() const
Gets the registered callback for the mouse down event.
virtual bool isEmpty() const
Gets whether the target Tool object is empty (constructed with the default ctor)
virtual ~Tool()
Destructs a Tool object.
Tool()
Constructs an empty Tool object.
virtual Callback *const deselectionCallback() const
Gets the registered callback for the tool deselection event.
virtual ArtboardPoint cursorLoc() const
Gets the current location of the cursor.
Header file for geometric point manipulation on the Illustrator artboard.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
IconResourceType
Indicates which type of resource is related to a given icon (for passing to Adobe's SDK)
Definition: hdicoreTypes.h:782
HitRequest
Describes the types of hit tests that can be performed (AKA a hit request)
Definition: hdicoreTypes.h:348