|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ICommandPoolEdit
Provides access to members that control the command pool.
The ICommandPoolEdit interface is used to manage the collection of commands used by the ToolbarControl, a ToolbarMenu, a ToolbarPalette, or the commands shared between several ToolbarControl's. Use the ICommandPoolEdit interface to add and remove commands in the CommandPool and to call the ICommand::OnCreate method.
The ICommandPoolEdit methods are normally called by the ToolbarControl, ToolbarMenu and ToolbarPalette objects to mange the command's used by their items. Typically, the Hook property will be set to a ToolbarControl. The ToolbarControl will ensure that the CallOnCreate method is called on the first IToolbarControl::Update, once the IToolbarControl::Buddy property has been set.
Method Summary | |
---|---|
void |
addCommand(ICommand command,
IUID pUID)
Adds the specified command to the command pool. |
IArray |
addUID(IUID uID)
Adds the given UID to the command pool and returns an array of command objects. |
void |
callOnCreate(ICommand pCommand)
Calls the specified command OnCreate method if the Hook is set and OnCreate has not already been called. |
Object |
getHook()
The object that is passed as a hook to the OnCreate method on the command. |
void |
remove(ICommand command)
Decrements the usage count of the command. |
void |
removeAll()
Removes all commands from the command pool, regardless of each commands usage count. |
void |
setHook(Object pHook)
Sets the object that is passed as a hook to the OnCreate method on the command. |
Method Detail |
---|
void addCommand(ICommand command, IUID pUID) throws IOException, AutomationException
If a UID object is specified and the command object is nothing, the method searches the CommandPool for the given UID. If the UID is found its UsageCount is incremented by 1. If the UID is not found a new command is created and added to the CommandPool with a UsageCount of 1.
If a command object is specified and the UID object is nothing, the command is added to the CommandPool with a UsageCount of 1.
If a UID object and a command object are specified, the method searches the CommandPool for the given UID. If the UID is found its UsageCount is incremented by 1. If the UID is not found the specified command is added to the CommandPool with a UsageCount of 1.
Typically the AddUID method should be used as the method to add commands that implement the ICommandSubType interface. If the AddCommand method is used the IUID::SubType property must be set.
command
- A reference to a com.esri.arcgis.systemUI.ICommand (in)pUID
- A reference to a com.esri.arcgis.system.IUID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IArray addUID(IUID uID) throws IOException, AutomationException
Adds commands to the CommandPool using the specified UID. The method searches the CommandPool for the specified UID. If the UID is found then that commands UsageCount is incremented by 1. If the UID is not found a new command is created and added to the CommandPool with a UsageCount of 1. The command is returned in an array.
If the specified UID is a command that implements the ICommandSubType interface, the method will return an array of all the commands, and if necessary create the command in the CommandPool. Set the IUID::SubType property to a none zero value to add a specific command defined within the ICommandSubType object.
uID
- A reference to a com.esri.arcgis.system.IUID (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void remove(ICommand command) throws IOException, AutomationException
Decrements the supplied command UsageCount by 1. If the UsageCount reaches 0 the command is released from the CommandPool and the ICommandPool::Exists property will return false. If the UsageCount is 1 or more the command will remain in the CommandPool. The number of calls to the AddUID and AddCommand methods for a given UID must typically match the number of calls to Remove.
Typically the ToolbarControl will manage the commands in the CommandPool as part of IToolbarControl::AddItem and IToolbarControl::Remove methods.
command
- A reference to a com.esri.arcgis.systemUI.ICommand (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void removeAll() throws IOException, AutomationException
Removes all of the commands from the CommandPool. The developer must ensure that any IToolbarItem objects using the commands are removed from the ToolbarControl.
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void callOnCreate(ICommand pCommand) throws IOException, AutomationException
Calls the ICommand:OnCreate event for the specified command.
When a command is added to the CommandPool, the ICommandPool::Created property is set to false. If the ICommandPoolEdit::Hook property is set, the CallOnCreate method will pass the Hook into the command's ICommand:OnCreate method. The ICommandPool::Created property is then set to true.
To ensure that the ICommand:OnCreate method is called only once during the lifetime of the command object, subsquent calls to the CallOnCreate method will not do anything.
pCommand
- A reference to a com.esri.arcgis.systemUI.ICommand (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void setHook(Object pHook) throws IOException, AutomationException
Pass the SetHook method an IDispatch object, typically the ToolbarControl, that is passed as a hook to the ICommand::OnCreate method of each command in the CommandPool.
pHook
- A reference to another Automation Object (IDispatch) (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.Object getHook() throws IOException, AutomationException
The Hook is an IDispatch object, typically the ToolbarControl, that is passed as a hook to the ICommand::OnCreate method of each command in the CommandPool.
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 |