|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.controls.ToolbarMenu
public class ToolbarMenu
A menu containing commands that can be used from a ToolbarControl or as a popup menu.
A ToolbarMenu supplies the implementation of a menu item that can host Command, Tool, ToolControl, MultiItem and ToolbarPalette objetcs. A ToolbarMenu can either be hosted on the ToolbarControl or can appear as a popup menu.
A ToolbarMenu can be built in two ways. Firstly, an object implementing IMenuDef can be passed to the IToolbarControl::AddItem or IToolbarControl::AddMenuItem method which creates a ToolbarMenu object and populates it from the menu definition. Secondly, the properties and methods on the IToolbarMenu interface can be used to build a menu. Any sub menus on a ToolbarMenu are implemented as another instance of a IToolbarMenu.
ToolbarMenu items support accelerator (shortcut) and access keys, defined in the ICommand::Caption property. For example, a 'Close' command with the caption "&Close\tAlt+F4" has the 'ALT+F4' key combination as its shortcut key, and the 'C' key as its access key. Although a shortcut key will always work, an access key will only work when the ToolbarMenu is active.
Constructor Summary | |
---|---|
ToolbarMenu()
Constructs a ToolbarMenu using ArcGIS Engine. |
|
ToolbarMenu(Object obj)
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts. ToolbarMenu theToolbarMenu = (ToolbarMenu) obj; |
Method Summary | |
---|---|
int |
addItem(Object item,
int subType,
int index,
boolean beginGroup,
int style)
Adds an item to the ToolbarMenu. |
int |
addMultiItem(Object multiItem,
int index,
boolean beginGroup,
int style)
Adds a multi-item to the ToolbarMenu. |
int |
addSubMenu(Object menuOrPalette,
int index,
boolean beginGroup)
Adds a sub-menu to the ToolbarMenu. |
boolean |
equals(Object o)
Compare this object with another |
int |
find(Object item)
Returns the index of the first item containing the given command or menu. |
int |
getBitmap()
The bitmap that is used as the icon on this ToolbarMenu. |
String |
getCaption()
The caption used by the ToolbarMenu. |
static String |
getClsid()
getClsid. |
ICommandPool |
getCommandPool()
The CommandPool used by the ToolbarMenu. |
int |
getCount()
The number of items on the ToolbarMenu. |
Object |
getHook()
The object that is passed as a hook to the OnCreate event of each item's command. |
int |
getIconSize()
The size in pixels of icons displayed on the ToolbarMenu. |
IToolbarItem |
getItem(int index)
Returns the item at the specified index from the ToolbarMenu. |
IMenuDef |
getMenuDef()
Returns the menu definition, this method is obsolete. |
Picture |
getMouseIcon()
Custom mouse icon used if MousePointer is 99. |
int |
getMousePointer()
The mouse pointer displayed over the ToolbarMenu. |
int |
hashCode()
the hashcode for this object |
void |
interfaceSupportsErrorInfo(GUID riid)
interfaceSupportsErrorInfo |
boolean |
isAlignLeft()
Indicates if the ToolbarMenu displays aligned to the left or right. |
boolean |
isCustomize()
Indicates if the ToolbarMenu is in customize mode. |
boolean |
isThemedDrawing()
Indicates if the ToolbarMenu uses themed drawing. |
void |
moveItem(int startIndex,
int finalIndex)
Moves an item from one index to another. |
void |
popupMenu(int x,
int y,
int hWndParent)
Pops up the menu at the position specified. |
void |
remove(int index)
Removes the item at the specified index from the ToolbarMenu. |
void |
removeAll()
Removes all items from the ToolbarMenu. |
void |
setAlignLeft(boolean pVal)
Indicates if the ToolbarMenu displays aligned to the left or right. |
void |
setBitmap(int pVal)
The bitmap that is used as the icon on this ToolbarMenu. |
void |
setCaption(String pCaption)
The caption used by the ToolbarMenu. |
void |
setCommandPoolByRef(ICommandPool ppCommandPool)
The CommandPool used by the ToolbarMenu. |
void |
setCustomize(boolean newVal)
Indicates if the ToolbarMenu is in customize mode. |
void |
setHook(Object pHook)
Sets the object that is passed as a hook to the OnCreate event of each item's command. |
void |
setIconSize(int pVal)
The size in pixels of icons displayed on the ToolbarMenu. |
void |
setMouseIconByRef(Picture ppMouseIcon)
Custom mouse icon used if MousePointer is 99. |
void |
setMousePointer(int pVal)
The mouse pointer displayed over the ToolbarMenu. |
void |
setThemedDrawing(boolean pVal)
Indicates if the ToolbarMenu uses themed drawing. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef |
---|
getJintegraDispatch, release |
Constructor Detail |
---|
public ToolbarMenu() throws IOException, UnknownHostException
IOException
- if there are interop problems
UnknownHostException
- if there are interop problemspublic ToolbarMenu(Object obj) throws IOException
ToolbarMenu theToolbarMenu = (ToolbarMenu) obj;
obj
to ToolbarMenu
.
obj
- an object returned from ArcGIS Engine or Server
IOException
- if there are interop problemsMethod Detail |
---|
public static String getClsid()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void popupMenu(int x, int y, int hWndParent) throws IOException, AutomationException
Creates a popup menu of the ToolbarMenu at the specified coordinates, supplied in pixels, relative to the top left of the parent window handle hWndParent.
The PopupMenu method is called automatically if the ToolbarMenu is hosted on the ToolbarControl, and the user has clicked on the menu item. In such cases the ToolbarMenu pops up just below the item.
If the ToolbarMenu is a standalone popup menu use the SetHook method, and optionally share the CommandPool with an existing one within the application.
popupMenu
in interface IToolbarMenu
x
- The x (in)y
- The y (in)hWndParent
- The hWndParent (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCaption(String pCaption) throws IOException, AutomationException
setCaption
in interface IToolbarMenu
pCaption
- The pCaption (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getCaption() throws IOException, AutomationException
The Caption of the ToolbarMenu that is displayed on the ToolbarControl.
getCaption
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCommandPoolByRef(ICommandPool ppCommandPool) throws IOException, AutomationException
setCommandPoolByRef
in interface IToolbarMenu
ppCommandPool
- A reference to a com.esri.arcgis.controls.ICommandPool (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public ICommandPool getCommandPool() throws IOException, AutomationException
The CommandPool manages the collection of commands used by the ToolbarMenu. If the ToolbarMenu is added to the ToolbarControl the CommandPool will be shared with the IToolbarControl::CommandPool, otherwise a new CommandPool is created with a Hook property set to Nothing. If the ToolbarMenu is to be a popup menu, set the CommandPool to the IToolbarControl::CommandPool in order to share CommandPools.
getCommandPool
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setHook(Object pHook) throws IOException, AutomationException
The Hook is a shortcut to ICommandPoolEdit::Hook on the CommandPool. If the ToolbarMenu is an item on the ToolbarControl the Hook is shared and initialized by the ToolbarControl. If the ToolbarMenu is a standalone popup menu use the SetHook method, and optionally share the CommandPool with an existing one within the application.
setHook
in interface IToolbarMenu
pHook
- A reference to another Automation Object (IDispatch) (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getHook() throws IOException, AutomationException
The Hook is a shortcut to ICommandPoolEdit::Hook on the CommandPool.
getHook
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getBitmap() throws IOException, AutomationException
The Bitmap of the ToolbarMenu.
getBitmap
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setBitmap(int pVal) throws IOException, AutomationException
setBitmap
in interface IToolbarMenu
pVal
- The pVal (A COM typedef) (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IMenuDef getMenuDef() throws IOException, AutomationException
Returns the IMenuDef object from the ToolbarMenu. The ToolbarMenu will construct an object implementing IMenuDef that describes the current layout of the menu. Note that this a different object from that used to initially build the menu.
getMenuDef
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int addItem(Object item, int subType, int index, boolean beginGroup, int style) throws IOException, AutomationException
A ToolbarMenu supplies the implementation of a menu item that can host commands, menus, palettes and multi-items.
Takes the specified command, menu or palette and creates new items that are appended to the ToolbarMenu with their Command set, and returns the index of the first item added. Specifiy the command, menu or palette as either a IUid, ProgID, ICommand , IMenuDef or IPaletteDef. To add a sub menu use the AddSubMenu method. To add a MultiItem use the IToolbarMenu2::AddMultiItem method. Note a palette object will be automatically added as a sub menu.
Supply a subType when passing an ICommandSubType. If no subType is supplied and the command is passed as a IUid or ProgID then ICommandSubType::GetCount determines the number of item's to be added to the ToolbarMenu. A subType must be supplied when passing an ICommandSubType as an ICommand, or the method will fail. By default subType is 0.
Index determines the position on the ToolbarMenu that the Item will be added to. By default this is -1 and represents the end of the ToolbarMenu.
beginGroup determines whether a separator will appear before the Item. By default beginGroup is False.
Style determines the style of the Item.
AddItem checks to see if the supplied command or the commands used by the menu already exists in the CommandPool used by the ToolbarMenu. If the command does not already exist, it is created and added to the CommandPool with a ICommandPool::UsageCount of 1, and is set as the IToolbarItem::Command . If the command already exists in the CommandPool its ICommandPool::UsageCount is incremented by 1 and the command is set as the IToolbarItem::Command. The ICommand::OnCreate method will be called the first time a command is added to the CommandPool.
Where possible always supply commands and menus as either Uid objects or ProgID's. Only supply commands as ICommand or IMenuDef objects when a IUid or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl. Passing a command or menu as an ICommand or IMenuDef object has the following limitation: Multiple instances of the same command can be added to the CommandPool , and each IToolbarItem::Command will point to a different command object.
addItem
in interface IToolbarMenu
item
- A Variant (in)subType
- The subType (in, optional, pass 0 if not required)index
- The index (in, optional, pass -1 if not required)beginGroup
- The beginGroup (in, optional, pass false if not required)style
- A com.esri.arcgis.systemUI.esriCommandStyles constant (in, optional, pass 2 if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int addSubMenu(Object menuOrPalette, int index, boolean beginGroup) throws IOException, AutomationException
Takes the specified menu and creates a new sub menu that is added to the ToolbarMenu, and returns the index of the menu. Specifiy the menu as either a IUid, ProgID, IMenuDef or IToolbarMenu.
Index determines the position on the ToolbarMenu that the Item will be added to. By default this is -1 and represents the end of the ToolbarMenu.
beginGroup determines whether a separator will appear before the Item. By default beginGroup is False.
AddSubMenu checks to see if the commands used by the menu already exists in the CommandPool used by the ToolbarMenu. If the command does not already exist, it is created and added to the CommandPool with a ICommandPool::UsageCount of 1, and is set as the IToolbarItem::Command . If the command already exists in the CommandPool its ICommandPool::UsageCount is incremented by 1 and the command is set as the IToolbarItem::Command. The ICommand::OnCreate method will be called the first time a command is added to the CommandPool.
Where possible always supply commands and menus as either Uid objects or ProgID's. Only supply commands as ICommand or IMenuDef objects when a IUid or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl.
addSubMenu
in interface IToolbarMenu
menuOrPalette
- A Variant (in)index
- The index (in, optional, pass -1 if not required)beginGroup
- The beginGroup (in, optional, pass false if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void remove(int index) throws IOException, AutomationException
Removes the item at the specified index from the ToolbarMenu. The item at the top of the menu as an index of 0.
The Remove method will automatically find the IToolbarItem::Command in the CommandPool and decrement the ICommandPool::UsageCount by 1. If the ICommandPool::UsageCount reaches 0 the command will be released from the CommandPool.
remove
in interface IToolbarMenu
index
- The index (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void removeAll() throws IOException, AutomationException
This method removes all items from the ToolbarMenu.
For each item removed the RemoveAll method will automatically find the IToolbarItem::Command in the CommandPool and decrement the ICommandPool::UsageCount by 1. If the ICommandPool::UsageCount reaches 0 the command will be released from the CommandPool.
removeAll
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IToolbarItem getItem(int index) throws IOException, AutomationException
The property is used to access a particular item on the ToolbarMenu. The item at the top of the menu has an index of 0.
To loop through a ToolbarMenus item collection use the GetItem method in conjunction with the Count property.
getItem
in interface IToolbarMenu
index
- The index (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getCount() throws IOException, AutomationException
Returns the number of items on the ToolbarMenu.
getCount
in interface IToolbarMenu
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int find(Object item) throws IOException, AutomationException
Returns the index of the first item on the ToolbarMenu using the specified IUid , ProgID, ICommand or IToolbarMenu. If the specified comman, menu or palette cannot be found -1 is returned.
To find an Item on the ToolbarMenu using a Command implementing ICommandSubType pass a UID with its SubType property set.
find
in interface IToolbarMenu
item
- A Variant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void moveItem(int startIndex, int finalIndex) throws IOException, AutomationException
Moves the item at the specified startIndex, to the position at the specified finalIndex. If no finalIndex is supplied the item is moved to the end of the ToolbarMenu.
moveItem
in interface IToolbarMenu
startIndex
- The startIndex (in)finalIndex
- The finalIndex (in, optional, pass -1 if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int addMultiItem(Object multiItem, int index, boolean beginGroup, int style) throws IOException, AutomationException
Takes the specified multi-item and creates new items that are appended to the ToolbarMenu with their Command set, and returns the index of the first item added. Specifiy the multi-item as either a IUID, ProgID, or IMultiItem. To add a sub menu use the AddSubMenu method.
Index determines the position on the ToolbarMenu that the item will be added to. By default this is -1 and represents the end of the ToolbarMenu.
beginGroup determines whether a separator will appear before the item. By default beginGroup is false.
Style determines the style of the item.
AddMultiItem checks to see if the supplied command already exists in the CommandPool used by the ToolbarMenu. If the command does not already exist, it is created and added to the CommandPool with a ICommandPool::UsageCount of 1, and is set as the IToolbarItem::Command. If the command already exists in the CommandPool its ICommandPool::UsageCount is incremented by 1 and the command is set as the IToolbarItem::Command. The ICommand::OnCreate method will be called the first time a command is added to the CommandPool .
Where possible always supply multi-items as either Uid objects or ProgID's. Only supply multi-items as IMultiItem objects when a IUID or ProgID does not exist, and the class is compiled as part of the same project using the ToolbarControl. Passing a multi-item as IMultiItem object has the following limitation: Multiple instances of the same multi-item can be added to the CommandPool, and each IToolbarItem::Command will point to a different command object.
addMultiItem
in interface IToolbarMenu2
multiItem
- A Variant (in)index
- The index (in, optional, pass -1 if not required)beginGroup
- The beginGroup (in, optional, pass false if not required)style
- A com.esri.arcgis.systemUI.esriCommandStyles constant (in, optional, pass 2 if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCustomize(boolean newVal) throws IOException, AutomationException
setCustomize
in interface IToolbarMenu2
newVal
- The newVal (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isCustomize() throws IOException, AutomationException
Determines whether a ToolbarMenu is in customize mode at run time. The behavior of the ToolbarMenu changes when in customize mode. This property is false by default.
If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the Customize property with the IToolbarControl::Customize property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu method.
Use the left mouse button to select an item on the ToolbarMenu. Either drag the selected item to a new position on the ToolbarMenu as indicated by the black verticle line, or drag and drop the item off the ToolbarMenu to remove item.
Use the right mouse button to select an item and display the customize menu. Use the customize menu to either delete the item or set its IToolbarItem::Style, IToolbarItem::Group or IToolbarItem::GroupSpacing properties.
If the CustomizeDialog is displayed on the screen whilst the ToolbarMenu is in customize mode, new items can be added to the ToolbarMenu by either double clicking on an item in the CustomizeDialog or by dragging and dropping an item from the CustomizeDialog to the ToolbarMenu.
isCustomize
in interface IToolbarMenu2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isThemedDrawing() throws IOException, AutomationException
Determines whether items on the ToolbarMenu display themselves using the current Windows XP theme. This property is false by default, and items display themselves on the ToolbarMenu with the Windows Classic look.
If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the ThemedDrawing property with the IToolbarControl2::ThemedDrawing property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu method.
isThemedDrawing
in interface IToolbarMenu2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setThemedDrawing(boolean pVal) throws IOException, AutomationException
setThemedDrawing
in interface IToolbarMenu2
pVal
- The pVal (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getMousePointer() throws IOException, AutomationException
Use this property when you want to indicate changes in functionality as the mouse pointer passes over the ToolbarMenu. The esriPointerArrowHourglass setting (11) is useful for indicating that the user should wait for a process or to finish.
If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the MousePointer property with the IToolbarControl::MousePointer property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu method.
getMousePointer
in interface IToolbarMenu2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setMousePointer(int pVal) throws IOException, AutomationException
setMousePointer
in interface IToolbarMenu2
pVal
- A com.esri.arcgis.controls.esriControlsMousePointer constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getIconSize() throws IOException, AutomationException
The size in pixels that each item on the ToolbarMenu will display the ICommand::Bitmap property. By default bitmaps are stretched to a size of 16 x 16 pixels. The minimum IconSize allowed is 8.
If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the IconSize property with the IToolbarControl2::IconSize property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu method.
IconSize may not affect the size of an item on the ToolbarControl that contains an object implementing IToolControl. Whether the ToolControl responds to the resize depends on its implementation.
getIconSize
in interface IToolbarMenu2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setIconSize(int pVal) throws IOException, AutomationException
setIconSize
in interface IToolbarMenu2
pVal
- The pVal (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isAlignLeft() throws IOException, AutomationException
Determines whether a ToolbarMenu (and any sub menus it contains) when displayed using the IToolbarMenu::PopupMenu method displays in a position aligned to the left of the users mouse click. This property is true by default.
If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the AlignLeft property with the IToolbarControl2::AlignLeft property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu method.
If a ToolbarMenu is to popup in a position so close to edge of a screen display, that it will not be fully visible, the AlignLeft property will be ignored. The ToolbarMenu will popup aligned in a direction that will ensure it is fully visible.
AlignLeft does not affect the alignment of an ICommand::Caption or an IToolbarMenu::Caption displayed on a ToolbarItem. In order to change the direction text is displayed the RTL (right to left) display environment variable needs changing. The AlignLeft property will override any RTL (right to left) display environment variables that affect the position of drop down menus.
isAlignLeft
in interface IToolbarMenu2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setAlignLeft(boolean pVal) throws IOException, AutomationException
setAlignLeft
in interface IToolbarMenu2
pVal
- The pVal (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setMouseIconByRef(Picture ppMouseIcon) throws IOException, AutomationException
setMouseIconByRef
in interface IToolbarMenu2
ppMouseIcon
- A reference to a com.esri.arcgis.support.ms.stdole.Picture (A com.esri.arcgis.support.ms.stdole.Picture COM typedef) (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Picture getMouseIcon() throws IOException, AutomationException
The MouseIcon property provides a custom icon that is used when the MousePointer property is set to esriPointerArrowHourglass (99).
If the ToolbarMenu has also been added to the ToolbarControl, the ToolbarControl will override the MouseIcon property with the IToolbarControl::MouseIcon property, before the ToolbarMenu is displayed with the IToolbarMenu::PopupMenu method.
In most development evironments a cursor (.cur) or icon (.ico) file can be loaded. A cursor contains a custom 'hotspot' location and can be any size. The 'hotspot' location for an icon file defaults to the center of the icon. This property cannot be used to load animated cursor (.ani) files.
To programatically create an object implementing IPictureDisp there is the win32 function OleLoadPicture or helper methods depending on the development environment.
getMouseIcon
in interface IToolbarMenu2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void interfaceSupportsErrorInfo(GUID riid) throws IOException, AutomationException
Indicates whether the interface supports IErrorInfo.
interfaceSupportsErrorInfo
in interface ISupportErrorInfo
riid
- A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |