Hidden eye dropper tool, to be used programmatically only, that allows for selection of a color from the current document (the Illustrator eye dropper always sets the toolbar fill/stroke color and does not allow for interception of the selected color, whereas this tool simply provides the color under the cursor to the caller)
More...
#include <hdicoreEyeDropperTool.h>
|
virtual AIToolHandle | aiToolHandle () const |
| Gets the tool handle for the eye dropper tool.
|
|
virtual bool | selected () const |
| Gets whether the eye dropper tool is the currently selected tool.
|
|
virtual void | select () |
| Sets the eye dropper tool as the current tool, storing the previously selected tool for later resuming.
|
|
virtual void | deselect () |
| Deselects the eye dropper tool, causing the previously selected tool to become current again.
|
|
virtual std::string | title () const |
| Gets the eye dropper tool's title.
|
|
virtual std::string | tip () const |
| Gets the eye dropper tool's tip string.
|
|
virtual ArtboardPoint | cursorLoc () const |
| Gets the current location of the cursor.
|
|
virtual Callback *const | trackCallback () const |
| Gets the registered callback for the tool tracking event (mouse move)
|
|
virtual void | setTrackCallback (const Callback &cb_) |
| Sets the callback for the tool tracking event (mouse move)
|
|
virtual Callback *const | dragCallback () const |
| Gets the registered callback for the drag event.
|
|
virtual void | setDragCallback (const Callback &cb_) |
| Sets the callback for the drag event.
|
|
virtual Callback *const | mouseUpCallback () const |
| Gets the registered callback for the mouse up event.
|
|
virtual void | setMouseUpCallback (const Callback &cb_) |
| Sets the callback for the mouse up event.
|
|
virtual bool | shiftKeyDown () const |
| Determines whether the shift key is down.
|
|
virtual bool | commandKeyDown () const |
| Determines whether the command key is down.
|
|
virtual bool | optionKeyDown () const |
| Determines whether the option key is down.
|
|
virtual bool | controlKeyDown () const |
| Determines whether the control key is down.
|
|
virtual PathStyle | currentStyle () const |
| Gets the current path style for the eye dropper tool.
|
|
Hidden eye dropper tool, to be used programmatically only, that allows for selection of a color from the current document (the Illustrator eye dropper always sets the toolbar fill/stroke color and does not allow for interception of the selected color, whereas this tool simply provides the color under the cursor to the caller)
- Warning
- Usage of this class will cause your plugin to "become" a tool plugin, and therefore its file must be placed in the Illustrator Tools folder to function properly.
-
This tool, like all Illustrator tools, cannot be used from within the context of a modal dialog. If you need this sort of behavior, consider switching to a floating dialog instead.
- Note
- To use this tool, first create it during plugin startup and set your mouse event callbacks, then select it during e.g. some UI event. The user can then move the cursor around the document and click a desired color, and you can acquire the color in your track, drag, and/or mouse up callbacks. The tool will automatically deselect itself upon the mouse up event, restoring whichever tool was current before the eye dropper was selected. Remember to destroy the tool during plugin shutdown.
◆ aiToolHandle()
virtual AIToolHandle hdi::core::EyeDropperTool::aiToolHandle |
( |
| ) |
const |
|
virtual |
Gets the tool handle for the eye dropper tool.
- Author
- GW
- Date
- 09/2014
- Returns
- AIToolHandle for this object
- Note
- Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of functionality provided by Illustrator is not handled by this class (or related classes), then it should probably be added to the hdi_core library.
◆ commandKeyDown()
virtual bool hdi::core::EyeDropperTool::commandKeyDown |
( |
| ) |
const |
|
virtual |
Determines whether the command key is down.
- Author
- GW
- Date
- 09/2014
- Returns
- true if the command key was down in the last tool event
- Note
- Windows machines do not have a command key. If this method is called on a Windows machine, it will return the same value as the controlKeyDown() method (because the control key is the closest command key analog on Windows).
-
The return value is only valid if the last message the plugin received was an eye dropper tool-related event.
◆ controlKeyDown()
virtual bool hdi::core::EyeDropperTool::controlKeyDown |
( |
| ) |
const |
|
virtual |
Determines whether the control key is down.
- Author
- GW
- Date
- 09/2014
- Returns
- true if the control key was down in the last tool event
- Note
- The return value is only valid if the last message the plugin received was an eye dropper tool-related event.
◆ create()
◆ currentStyle()
virtual PathStyle hdi::core::EyeDropperTool::currentStyle |
( |
| ) |
const |
|
virtual |
Gets the current path style for the eye dropper tool.
- Author
- GW
- Date
- 09/2014
- Returns
- Either the path style for the art object under the cursor, or a "synthetic" path style for the pixel color under the cursor
- Note
- The return value of this method is only valid when called from within an EyeDropperTool mouse event callback.
-
If artwork that can have a path style is under the cursor, then this is acquired and returned. If art that cannot have a path style is under the cursor, then the pixel color is acquired and placed in the fill color of the path style. If no art is under the cursor, then the pixel color is acquired and placed in the fill color of the path style.
◆ cursorLoc()
virtual ArtboardPoint hdi::core::EyeDropperTool::cursorLoc |
( |
| ) |
const |
|
virtual |
Gets the current location of the cursor.
- Author
- GW
- Date
- 09/2014
- Returns
- The last known cursor location for the tool
- Note
- The cursor location is automatically set when a mouse event occurs
◆ deselect()
virtual void hdi::core::EyeDropperTool::deselect |
( |
| ) |
|
|
virtual |
Deselects the eye dropper tool, causing the previously selected tool to become current again.
- Author
- GW
- Date
- 09/2014
◆ destroy()
static void hdi::core::EyeDropperTool::destroy |
( |
| ) |
|
|
static |
Destroys the singleton instance of the EyeDropperTool class.
- Author
- GW
- Date
- 09/2014
◆ dragCallback()
virtual Callback *const hdi::core::EyeDropperTool::dragCallback |
( |
| ) |
const |
|
virtual |
Gets the registered callback for the drag event.
- Author
- GW
- Date
- 09/2014
- Returns
- Callback for dragging, or NULL if none
◆ instance()
Acquires the singleton instance of the EyeDropperTool class.
- Author
- GW
- Date
- 09/2014
- Returns
- The EyeDropperTool instance object
- Note
- This method will always return NULL until create() has been called
◆ mouseUpCallback()
virtual Callback *const hdi::core::EyeDropperTool::mouseUpCallback |
( |
| ) |
const |
|
virtual |
Gets the registered callback for the mouse up event.
- Author
- GW
- Date
- 09/2014
- Returns
- Callback for mouse up, or NULL if none
◆ optionKeyDown()
virtual bool hdi::core::EyeDropperTool::optionKeyDown |
( |
| ) |
const |
|
virtual |
Determines whether the option key is down.
- Author
- GW
- Date
- 09/2014
- Returns
- true if the option key was down in the last tool event
- Note
- The option key on Mac is akin to the alt key on Windows.
-
The return value is only valid if the last message the plugin received was an eye dropper tool-related event.
◆ select()
virtual void hdi::core::EyeDropperTool::select |
( |
| ) |
|
|
virtual |
Sets the eye dropper tool as the current tool, storing the previously selected tool for later resuming.
- Author
- GW
- Date
- 09/2014
◆ selected()
virtual bool hdi::core::EyeDropperTool::selected |
( |
| ) |
const |
|
virtual |
Gets whether the eye dropper tool is the currently selected tool.
- Author
- GW
- Date
- 09/2014
- Returns
- true if the tool is selected, false otherwise
◆ setDragCallback()
virtual void hdi::core::EyeDropperTool::setDragCallback |
( |
const Callback & |
cb_ | ) |
|
|
virtual |
Sets the callback for the drag event.
- Author
- GW
- Date
- 09/2014
- Parameters
-
cb_ | The new dragging callback |
◆ setMouseUpCallback()
virtual void hdi::core::EyeDropperTool::setMouseUpCallback |
( |
const Callback & |
cb_ | ) |
|
|
virtual |
Sets the callback for the mouse up event.
- Author
- GW
- Date
- 09/2014
- Parameters
-
cb_ | The new mouse up callback |
◆ setTrackCallback()
virtual void hdi::core::EyeDropperTool::setTrackCallback |
( |
const Callback & |
cb_ | ) |
|
|
virtual |
Sets the callback for the tool tracking event (mouse move)
- Author
- GW
- Date
- 09/2014
- Parameters
-
cb_ | The new tracking callback |
◆ shiftKeyDown()
virtual bool hdi::core::EyeDropperTool::shiftKeyDown |
( |
| ) |
const |
|
virtual |
Determines whether the shift key is down.
- Author
- GW
- Date
- 09/2014
- Returns
- true if the shift key was down in the last tool event
- Note
- The return value is only valid if the last message the plugin received was an eye dropper tool-related event.
◆ tip()
virtual std::string hdi::core::EyeDropperTool::tip |
( |
| ) |
const |
|
virtual |
Gets the eye dropper tool's tip string.
- Author
- GW
- Date
- 09/2014
- Returns
- The rollover tip for the tool, as UTF-8
◆ title()
virtual std::string hdi::core::EyeDropperTool::title |
( |
| ) |
const |
|
virtual |
Gets the eye dropper tool's title.
- Author
- GW
- Date
- 09/2014
- Returns
- The title for the tool, as UTF-8
◆ trackCallback()
virtual Callback *const hdi::core::EyeDropperTool::trackCallback |
( |
| ) |
const |
|
virtual |
Gets the registered callback for the tool tracking event (mouse move)
- Author
- GW
- Date
- 09/2014
- Returns
- Callback for tracking, or NULL if none