All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

ApplicationFrame Class CATCommandHeader

System.IUnknown
  |
  +---System.IDispatch
    |
    +---System.CATBaseUnknown
      |
      +---System.CATEventSubscriber
        |
        +---CATCommandHeader
 

Usage: you can derive this class.


public class CATCommandHeader

Class to create a command header.
Role: Each command you want to make available in your workshop or workbench must have a command header. It holds the necessary information to load the command, such as the name of the shared library in which the command's executable code is located, the name of the command class, and the data to pass to the command's code when this command becomes the current one.

The command header has resources for each command to display, such as the command name shown to the end user, its ToolTip displayed in a balloon, it help message, and its icon. This enables the workshop or workbench to be displayed, that is loaded in memory, without any of its commands being itself loaded, except the default one, spares memory space, and improves performance. The end user can see the icons in the toolbars, the items in the menu bar, can ask for help on a given command, without the command being loaded. It is only when he/she clicks on the menu item or on the icon that the command code is actually loaded.

You cannot directly instanciate a CATCommandHeader, you must derive this class. The easiest way is using the MacDeclareHeader.b>: Each command you want to make available in your workshop or workbench must have a command header. It holds the necessary information to load the command, such as the name of the shared library in which the command's executable code is located, the name of the command class, and the data to pass to the command's code when this command becomes the current one.

The command header has resources for each command to display, such as the command name shown to the end user, its ToolTip displayed in a balloon, it help message, and its icon. This enables the workshop or workbench to be displayed, that is loaded in memory, without any of its c macro such that:

    #include "CATCommandHeader.h"
    MacDeclareHeader(MyHeader);
 
MyHeader is a command header class always available and with a default representation: a push button in a toolbar, and a push item is the menu bar or in a contextual menu. In most cases it is sufficient. However you can create a customized command header for two reasons: Creating a customized command header implies to have (or overwrite) at least the following methods: The customized command header (named MyHeader) must be a component to implement any kind interfaces, so it must contain the following macros: To assign resources to the command header, it must contain the following macros: Where to create command header instances ? Generaly, you create instances in the following methods: In this case, the command header instance, identified by the first argument of the constructor class, is associated with a starter thanks to the SetAccessCommand macro

You can also create command header instances to set in the "Tools Palette" toolbar. It is a specific toolbar which can be filled, for a specific workbench by implementing CATIAfrPaletteOptions, or/and for a specific command thanks CATIAfrCmdPaletteOptions . In these two cases, before creating a command header instance, you must check that the instance does not already exist in the current editor. It is possible thanks to the CATAfrGetCommandHeader global function.

Who delete command header instances ?
Each command header instance is kept in a list by the CATFrmEditor associated with the document to edit. The editor manages the command header deletion. You must never delete a command header instance.


Constructor and Destructor Index


o CATCommandHeader(CATCommandHeader*)
Constructs a command header instance.
o CATCommandHeader(CATString&,CATString&,CATString&,void*,int)
Constructs a command header.
o ~CATCommandHeader()

Method Index


o BecomeAvailable()
Makes the command Available.
o BecomeUnavailable()
Makes the command Unavailable.
o Clone()
Clones the command header.
o GetCurrentArgument()
Retrieves the argument of the header.
o GetVisibility()
Returns the header visibility in the Tools/Customize command.
o SetVisibility(int)
Sets the header visibility in the Tools/Customize command.

Constructor and Destructor


o CATCommandHeader
protected CATCommandHeader(CATCommandHeader* header)
Constructs a command header instance. Role:This method calls the copy constructor. In your derived class overwrite this method such that:
 MyHeader::MyHeader(CATCommandHeader * iHeaderToCopy):
                           CATCommandHeader(iHeaderToCopy)
 {
 }   
 
This method is called by the Clone method.
Parameters:
iHeaderToCopy
The header to copy.
o CATCommandHeader
public CATCommandHeader( const CATString& iHeaderID,
const CATString& iLoadName,
const CATString& iClassName,
void* iArgument,
int iState= CATFrmAvailable)
Constructs a command header.
Parameters:
iHeaderID
The identifier of the header. It iss the command argument of the SetAccessCommand macro.It iss used for NLS resources.
iLoadName
The name of the shared library where iClassName is.
iClassName
The name of the CATCommand class.
iArgument
The argument of the CATCommand class.
iState
The CATCommandHeader state.
Legal values:
  • CATFrmAvailable (The default value)
  • CATFrmUnavailable
  • See also:
    CATCommand, SetAccessCommand, CATFrmState
    o ~CATCommandHeader
    public virtual ~CATCommandHeader()

    Methods


    o BecomeAvailable
    public virtual void BecomeAvailable()
    Makes the command Available.
    Role: The command of the header becomes available. The icon switches from the grayed to the normal state.
    o BecomeUnavailable
    public virtual void BecomeUnavailable()
    Makes the command Unavailable.
    Role: The command of the header becomes unavailable. The icon switches from the normal to the grayed state.
    o Clone
    public virtual CATCommandHeader * Clone()
    Clones the command header. Role:This method calls the constructor with a CATCommandHeader pointer as argument. In your derived class overwrite this method such that:
     CATCommandHeader * MyHeader::Clone ()                                  
     { 
       return new MyHeader(this); 
     }   
     
    You must never call a Clone method. This method is called by the "frame". Today, it is called for your CAA instances in only one case: when the command header instance is created in an Add-in of the General workshop, refer to the CATIAfrGeneralWksAddin interface for more details about these Add-ins.
    Returns:
    The new command header instance.
    o GetCurrentArgument
    public static CATString & GetCurrentArgument()
    Retrieves the argument of the header.
    o GetVisibility
    public virtual int GetVisibility()
    Returns the header visibility in the Tools/Customize command.
    Role: This method returns if the command header is visible or not in the Tools/Customize command.
    Returns:
    The header visibility in the Tools/Customize command.
    Legal values: 1 Visible, 0 : invisible
    o SetVisibility
    public void SetVisibility(int iIsVisible)
    Sets the header visibility in the Tools/Customize command.
    Role: This method enables you to hide or show the command header instance in the Tools/Customize command. It can be interesting to hide some command header instances, when you do not want that the end user drag and drop your command in a toolbar.
    Parameters:
    iIsVisible
    The header visibility in the Tools/Customize command.
    Legal values: 1 Visible, 0 : invisible

    This object is included in the file: CATCommandHeader.h
    If needed, your Imakefile.mk should include the module: CATApplicationFrame

    Copyright © 2003, Dassault Systèmes. All rights reserved.