Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Public Member Functions | Static Public Member Functions | Friends | List of all members
hdi::core::MenuItem Class Reference

Wraps around an Illustrator menu item to allow for selection callbacks, en/disabling, setting text, grouping, etc. More...

#include <hdicoreMenuItem.h>

Public Member Functions

 MenuItem ()
 Constructs an empty MenuItem object. More...
 
 MenuItem (const MenuItem &m_)
 Constructs a new MenuItem object from an existing MenuItem object (copy constructor) More...
 
 MenuItem (const BuiltinMenuGroup group_, const std::string &text_, const Callback &callback_)
 Constructs a new MenuItem object. More...
 
 MenuItem (const MenuGroup &group_, const std::string &text_, const Callback &callback_)
 Constructs a new MenuItem object. More...
 
virtual ~MenuItem ()
 Destructs a MenuItem object. More...
 
virtual void destroy ()
 Destroys the UI menu item, converting the target object to an empty MenuItem object (see the default constructor for more info on empty MenuItem objects) More...
 
virtual MenuItemoperator= (const MenuItem &rhs_)
 Assigns one MenuItem object to another. More...
 
virtual bool operator== (const MenuItem &rhs_) const
 Tests whether a given MenuItem object is the same as another. More...
 
virtual bool operator!= (const MenuItem &rhs_) const
 Tests whether a given MenuItem object is not the same as another. More...
 
virtual AIMenuItemHandle aiMenuItemHandle () const
 Gets the menu item handle around which the target object is wrapped. More...
 
virtual bool isEmpty () const
 Gets whether the target MenuItem object is empty (constructed with the default ctor) More...
 
virtual bool isDivider () const
 Gets whether the target MenuItem is a divider. More...
 
virtual std::auto_ptr< MenuGroupparent () const
 Gets the parent of the target menu item. More...
 
virtual bool enabled () const
 Gets whether the menu item is enabled. More...
 
virtual void setEnabled (const bool enabled_)
 Sets the menu item as enabled or disabled. More...
 
virtual bool checked () const
 Gets whether the menu item is checked. More...
 
virtual void setChecked (const bool checked_)
 Sets the menu item as checked or unchecked. More...
 
virtual std::string text () const
 Gets the text of the menu item itself. More...
 
virtual void setText (const std::string &text_)
 Sets the text of the menu item itself. More...
 
virtual Callback *const callback () const
 Gets the registered callback for the menu item. More...
 
virtual void setCallback (const Callback &cb_)
 Sets the callback for the menu item. More...
 

Static Public Member Functions

static MenuItem Divider (const BuiltinMenuGroup group_)
 Constructs a new MenuItem object as a divider. More...
 
static MenuItem Divider (const MenuGroup &group_)
 Constructs a new MenuItem object as a divider. More...
 

Friends

MenuItem __accessCtor (AIMenuItemHandle)
 

Detailed Description

Wraps around an Illustrator menu item to allow for selection callbacks, en/disabling, setting text, grouping, etc.

Constructor & Destructor Documentation

hdi::core::MenuItem::MenuItem ( )

Constructs an empty MenuItem object.

Author
GW
Date
08/2013
Note
To test if a MenuItem object is empty, call isEmpty() on it
Empty MenuItem objects do not relate to any actual Illustrator menu item; they are designed to be "receivers" of some other MenuItem object via the overloaded assignment operator. Empty MenuItem objects are useless until such time (though it is safe to call any of their methods).
hdi::core::MenuItem::MenuItem ( const MenuItem m_)

Constructs a new MenuItem object from an existing MenuItem object (copy constructor)

Author
GW
Date
08/2013
Parameters
m_Existing MenuItem object
hdi::core::MenuItem::MenuItem ( const BuiltinMenuGroup  group_,
const std::string &  text_,
const Callback callback_ 
)

Constructs a new MenuItem object.

Author
GW
Date
08/2013
Parameters
group_Built-in Illustrator menu group to contain the new MenuItem
text_String that will show in the menu item, as UTF-8
callback_Callback to perform when the menu item is selected
hdi::core::MenuItem::MenuItem ( const MenuGroup group_,
const std::string &  text_,
const Callback callback_ 
)

Constructs a new MenuItem object.

Author
GW
Date
08/2013
Parameters
group_User-created menu group to contain the new MenuItem
text_String that will show in the menu item, as UTF-8
callback_Callback to perform when the menu item is selected
virtual hdi::core::MenuItem::~MenuItem ( )
virtual

Destructs a MenuItem object.

Author
GW
Date
08/2013

Member Function Documentation

virtual AIMenuItemHandle hdi::core::MenuItem::aiMenuItemHandle ( ) const
virtual

Gets the menu item handle around which the target object is wrapped.

Author
GW
Date
11/2013
Returns
AIMenuItemHandle 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.
virtual Callback* const hdi::core::MenuItem::callback ( ) const
virtual

Gets the registered callback for the menu item.

Author
GW
Date
08/2013
Returns
Currently registered menu item callback
virtual bool hdi::core::MenuItem::checked ( ) const
virtual

Gets whether the menu item is checked.

Author
GW
Date
08/2013
Returns
true if the item is checked, false otherwise
virtual void hdi::core::MenuItem::destroy ( )
virtual

Destroys the UI menu item, converting the target object to an empty MenuItem object (see the default constructor for more info on empty MenuItem objects)

Author
GW
Date
10/2013
Note
This method must be called for any existing menu items by the time the plugin is shutting down. If you no longer retain any of your own references to a menu item then the lib will call this method for you as it is shutting down.
static MenuItem hdi::core::MenuItem::Divider ( const BuiltinMenuGroup  group_)
static

Constructs a new MenuItem object as a divider.

Author
GW
Date
11/2013
Parameters
group_Built-in Illustrator menu group to contain the new MenuItem
Returns
A new MenuItem object that's a divider
static MenuItem hdi::core::MenuItem::Divider ( const MenuGroup group_)
static

Constructs a new MenuItem object as a divider.

Author
GW
Date
11/2013
Parameters
group_User-created menu group to contain the new MenuItem
Returns
A new MenuItem object that's a divider
virtual bool hdi::core::MenuItem::enabled ( ) const
virtual

Gets whether the menu item is enabled.

Author
GW
Date
08/2013
Returns
true if the item is enabled, false otherwise
virtual bool hdi::core::MenuItem::isDivider ( ) const
virtual

Gets whether the target MenuItem is a divider.

Author
GW
Date
09/2014
Returns
true if the menu item is a divider/separate, false otherwise
virtual bool hdi::core::MenuItem::isEmpty ( ) const
virtual

Gets whether the target MenuItem object is empty (constructed with the default ctor)

Author
GW
Date
08/2013
Returns
true if the target MenuItem object is empty, false otherwise
virtual bool hdi::core::MenuItem::operator!= ( const MenuItem rhs_) const
virtual

Tests whether a given MenuItem object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_MenuItem to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different menu items, false otherwise
virtual MenuItem& hdi::core::MenuItem::operator= ( const MenuItem rhs_)
virtual

Assigns one MenuItem object to another.

Author
GW
Date
08/2013
Parameters
rhs_Existing MenuItem object to copy values from
Returns
The target MenuItem object, but with its values updated to match that of the rhs_ argument
virtual bool hdi::core::MenuItem::operator== ( const MenuItem rhs_) const
virtual

Tests whether a given MenuItem object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_MenuItem to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same menu item, false otherwise
virtual std::auto_ptr<MenuGroup> hdi::core::MenuItem::parent ( ) const
virtual

Gets the parent of the target menu item.

Author
GW
Date
09/2014
Returns
The parent menu group, or NULL for none/error
virtual void hdi::core::MenuItem::setCallback ( const Callback cb_)
virtual

Sets the callback for the menu item.

Author
GW
Date
08/2013
Parameters
cb_New callback to be performed when the menu item is selected
virtual void hdi::core::MenuItem::setChecked ( const bool  checked_)
virtual

Sets the menu item as checked or unchecked.

Author
GW
Date
08/2013
Parameters
checked_true to check the menu item, false to uncheck
virtual void hdi::core::MenuItem::setEnabled ( const bool  enabled_)
virtual

Sets the menu item as enabled or disabled.

Author
GW
Date
08/2013
Parameters
enabled_true to enable the item, false to disable
virtual void hdi::core::MenuItem::setText ( const std::string &  text_)
virtual

Sets the text of the menu item itself.

Author
GW
Date
08/2013
Parameters
text_New text value for the menu item, as UTF-8
virtual std::string hdi::core::MenuItem::text ( ) const
virtual

Gets the text of the menu item itself.

Author
GW
Date
08/2013
Returns
Current text value of the menu item, as UTF-8