VR-Forces 4.1 Class Documentation
List of all members | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Static Protected Attributes
DtPopupMenu Class Reference
Inheritance diagram for DtPopupMenu:
Inheritance graph
[legend]

Public Slots

virtual void validate ()
virtual void menuItemDestroyed (QAction *)
virtual void actionGroupDestroyed (DtActionGroup *)
virtual void featureActionManagerDestroyed ()

Signals

void validateItems ()
 Sent when items want to be validated. Emitted from the validate() method.

Public Member Functions

 DtPopupMenu (QWidget *parent, bool display=true)
 In your override, if you want to create the menu for right click purposes but do not want the menu to be on the main menu bar, call the parent DtPopupMenu constructor with false as the display parameter.
virtual ~DtPopupMenu ()
virtual bool init (DtMainMenuType iType, DtMenuWidget *menu, QWidget *owner, int iPos=-1, int iID=-1)
 Supply an id to identifiy this menu item or -1 to generate a unique id.
virtual void insertMenu (DtMenuWidget *menuWidget, int iPos=-1, int iID=-1)
virtual bool setup (DtMenuWidget *menuWidget)
 Called from init, sets up the menu items, connections and action groups.
virtual void preCreateMenuItems ()
virtual bool createMenuItems ()
virtual int id () const
virtual DtMenuItemType typeFromAction (QAction *)
 If this object contains the specified QAction, return the type it is.
virtual DtMenuItemType typeFromName (const QString &)
 Returns the type from the menu item name.
virtual QActionmenuItemForType (DtMenuItemType iType)
 Returns the QAction for this type (if this menu has it)
virtual bool hasType (DtMenuItemType iType)
 Returns true if this menu contains the specified menu item type.
virtual int positionOfMenuItem (const DtPopupMenuItem &item)
 Returns the position of the menu item in the ordered list.
virtual int positionOfMenuItem (DtMenuItemType iType)
virtual int menuItemPositionOf (QAction *action)
 Returns the true menu item position of the QAction.
virtual DtActionGroupgetActionGroupForType (DtMenuItemType iType)
 If the newly created menu item is to be added to an action group, add it here.
virtual DtMainMenuType type () const
virtual void setOwner (QWidget *owner)
 Accessors for owner.
virtual QWidgetowner () const
virtual void setEnableValidations (bool b)
 Call to always make sure all menu items are enabled with b being set to false.
virtual void reconfigureMenu (QList< DtMenuItemType > &items, bool keep)
 This will reconfigure the menu by either keeping or removing the items in the specified list.
virtual void updateMenuItems ()
 Update contents of menu based on any new conditions.
virtual void seedActionGroups ()
 Goes through all the menu items and fills in the action groups list.
virtual bool attachMenu (const QString &title, DtPopupMenu *, int iIndex=-1)
 This routine will add a DtPopupMenu as a sub menu to this menu.
bool initialized () const
DtFeatureActionManagerfeatureActionManager () const
 Accessors for featureActionManager.
virtual void setFeatureActionManager (DtFeatureActionManager *)
void setAddFeatures (bool)
bool addFeatures () const
virtual QString shortcutFor (const QString &feature) const
 Returns shortcut for specified feature.
virtual void addShortcut (const QString &feature, const QString &shortcut)
virtual void replaceShortcut (const QString &feature, const QString &shortcut)
virtual bool hasShortcutOverride (const QString &feature) const
virtual bool hasShortcut (const QString &feature) const
virtual QString iconFor (const QString &feature, QIcon::Mode mode=QIcon::Normal, QIcon::State=QIcon::Off, bool useDefault=false)
 Returns icon for specified feature. If useDefault is true, finds default icon based on feature name.
virtual QString menuTextForAction (QAction *)
 Returns text for the menu (or sub-menu) that contains the action.
virtual QHash< DtMenuItemType,
QAction * > & 
actions ()
virtual QList< QAction * > menuActions ()
virtual const QList
< DtPopupMenu * > & 
attachedMenus () const
virtual DtPopupMenuIteminsertMenuItem (DtMenuItemType iPos, const QString &featureName, DtMenuItemType iType, QString text, QString toolTip=QString::null, QString accel=QString::null, bool addSeparator=false, bool toggle=false, bool isOn=false, const QString &objectName="")
 The featureName in each of the inserts is a keyword that will be used to look up the feature in the featureActionManager for both shortcuts and icons.
virtual DtPopupMenuIteminsertMenuItem (DtMenuItemType iPos, DtMenuItemType iType, QString text, QString toolTip=QString::null, QString accel=QString::null, bool addSeparator=false, bool toggle=false, bool isOn=false, const QString &objectName="")
 Call this version to not allow the item to be added to a user defined toolbar.
virtual DtPopupMenuIteminsertToggleMenuItem (DtMenuItemType iBefore, const QString &featureName, DtMenuItemType iType, QString text, QString toolTip=QString::null, QString accel=QString::null, bool addSeparator=false, bool isOn=false, const QString &objectName="")
 Same as above except sets the myIsToggle flag to true which means that is will be an on/off menu item and rather than having the connection made to the "activated" signal, it will be made to the "toggled(bool)" signal.
virtual DtPopupMenuIteminsertToggleMenuItem (DtMenuItemType iBefore, DtMenuItemType iType, QString text, QString toolTip=QString::null, QString accel=QString::null, bool addSeparator=false, bool isOn=false, const QString &objectName="")
 Call this version to not allow the item to be added to a user defined toolbar.
virtual void addMenuItemSeparator (DtMenuItemType iGroup)
 Inserts a separator at the current create position for the specified group.
virtual void removeMenuItem (DtMenuItemType iType)
 Removes the menu item of the specified type. If it's already created removes it immediately.
virtual bool removeMenuGroup (const QString &gr)
 Removes the menu group and all sub-items from that group.
virtual void removeItemAtPosition (int iPos)
 Removes the item at the specified position.
virtual void addIcon (DtMenuItemType iType, QString icon, QIcon::Mode mode=QIcon::Normal, QIcon::State=QIcon::Off)
 Adds an icon to be added when the menu item is created.
virtual void removeIcon (DtMenuItemType iType, QIcon::Mode mode=(QIcon::Mode)-1, QIcon::State=QIcon::Off)
 Removes an icon. If the menu item is created also removes it from the menu item.
virtual void addGroup (DtMenuItemType iToGroup, DtMenuItemType iGroup, int iPos, bool addSep=false)
 Inserts the action group at the specified position to the specified group (use -1 to append at current position).
virtual void removeGroup (DtMenuItemType iGroup)
 Removes group.
virtual void addMenu (DtMainMenuType, int iPos, bool addSep)
 Inserts the menu at the specified position.
virtual void removeMenu (DtMainMenuType iGroup)
 Removes group.
virtual void mappingMenu (DtPopupMenu *menu, int iFlags=0)
 Call this routine if you want to map menu items.
virtual void mapMenuItem (DtMenuItemType iType, DtPopupMenu &popupMenu, int iPos=-1, bool addSeparator=false)
 This will look at the target popup menu and take both the menu item definition and the validator map entry defined by the menu item type and add them to this menu.
virtual void setPosition (int iPos)
 Sets the menu item position if inited. Removes then re-inserts.
virtual bool matchesName (QString name)
 Returns true if the supplied name matches the menu name of this menu. Will take & into account.
virtual DtMenuItemType uniqueId () const
 Returns a unique id for this menu (max + 1)
virtual QActionaddMenuItem (DtMenuItemType &retId, const QString &featureName, const QString &item, const QString &addToMenu, bool toggle=false, QObject *actionReceiver=NULL, const char *action=NULL, QObject *validationReceiver=NULL, const char *validation=NULL, const QString &tooltip=QString::null, const QString &accelerator=QString::null, bool addSep=false)
 Adds a new menu item given the menu item, path to add, action and validator.
virtual void appendMenuValidator (DtMenuItemType iType, QObject *vCall, const char *validator)
 Adds the specified validator to a list of validators that can be called for the menu item.
virtual void appendMenuValidator (const QString &menu, QObject *vCall, const char *validator)
virtual bool removeMenuItem (const QString &item)
 Removes the named menu item from the menu.
virtual void setupFrom (DtMainMenuType iType, DtPopupMenu *, QWidget *, DtMenuWidget *w)
 Copies menu item information without creating the menu.
virtual void renameMenuItem (DtMenuItemType iType, QString text=QString::null, QString toolTip=QString::null, QString accel=QString::null)
 Useful routines for subclasses of existing menus to rename/override default functionality.
virtual void positionBefore (DtMenuItemType iType, DtMenuItemType iBefore)
 Repositioning of menu items.
virtual void positionAfter (DtMenuItemType iType, DtMenuItemType iAfter)
virtual QString menuName ()
 Returns the name of this menu item to place on the menu bar.
virtual void addActionAndValidatorForType (DtMenuItemType iType, QObject *aCall, const char *action, QObject *vCall=NULL, const char *validator=NULL)
 Adds a new action/validator pair.
virtual void addActionForType (DtMenuItemType iType, QObject *aCall, const char *action)
virtual void addValidatorForType (DtMenuItemType iType, QObject *vCall, const char *validator)
virtual void addGlobalActionAndValidatorForType (DtMenuItemType iType, QObject *aCall, const char *action, QObject *vCall=NULL, const char *validator=NULL)
 Replaces on a global level the action/validator pair for the specified type.
virtual DtActionGroupactionGroupWithName (const QString &) const
 Returns an action (or action group) with the specified name.
virtual QActionactionWithName (const QString &) const
virtual void clearMenuItems ()
 Frees memory associated with menu items. Do not call unless the menu is about to be destroyed.
virtual void removeFeatureActions ()

Protected Slots

virtual void popupRemoved (QObject *)
virtual void menuItemDestroyed ()
virtual void actionGroupDestroyed ()

Protected Member Functions

virtual bool initMenuItems ()
 Initializes specific menu items to place onto this menu bar.
virtual bool initActionGroups ()
 Initializes action groups to be used with this menu.
virtual bool removeMenuItemAtPosition (int iPos)
 Removes the menu item at the specified position from the ordered list and the menu if it has been created.
virtual void addNewMenuItem (DtPopupMenuItem &item, int iPos)
 Adds a new menu item to internal structures and creates if needed.
virtual QActioncreateMenuItem (const DtPopupMenuItem &item)
 Creates and returns the new menu item.
virtual void attachMenuItems ()
 Using the mappings from type to validator and action, maps the created actions and connects them to the appropriate messages.
virtual void attachMenuItem (const DtPopupMenuItem &item)
 Attaches a menu item based on the specific type.
virtual void addCompletedItemsToMenu ()
 Adds the completed items to the menu.
virtual void addAttachedMenus ()
 Adds any menus to this menu via the attachMenu command by creating them via the menu widget factory.
virtual void setIcon (DtMenuItemType iType)
 Uses internal structures to see if this menu item needs an icon associated with it.
virtual void attachValidators (bool b)
 Cycles through menu items and attaches/detatches validators according to flag.
virtual void initConnections ()
 Initializes connections used for validations on this popup menu.
virtual DtPopupMenuItempopupMenuItem (DtMenuItemType iType, bool actionable=false)
 Returns the DtPopupMenuItem associated with a particular type.
virtual DtActionValidatorMapactionValidatorMapEntry (DtMenuItemType iType)
 Returns a DtActionValidatorMap associated with the particular type.
virtual void removeOrderedMenuItem (int iPos)
 Removes the item only from the ordered list.
virtual int addOrderedItem (const DtPopupMenuItem &item, int iPos)
 Adds an item to the ordered list. Returns the position added to in the ordered list.
virtual void setMapMenuItemsTo (DtPopupMenu *menu)
 Set proxy menu.
virtual void addActionGroup (DtActionGroup *)
 Adds a new action group to internal list (if does not exist)
virtual bool matchesName (QString menu, QString name) const
virtual DtActionGroupinternalGetActionGroupForType (DtMenuItemType type)
 Checks internal groups then checks getActionGroupForType.
virtual QActionaddNewActionToActionGroup (const DtPopupMenuItem &item)
 Creates a new menu item and adds it to its action group.
virtual void addAllActionsFor (DtActionGroup *)
 Given the group, looks through all menu items that return the given sub group and adds them to the group.

Protected Attributes

QHash< DtMenuItemType, QAction * > myActions
QHash< DtMenuItemType,
DtPopupMenuItem
myMenuItems
QHash< DtMenuItemType,
DtActionValidatorMap
myActionValidators
QList< DtPopupMenuItemmyOrderedMenuItems
QHash< DtMenuItemType, QIcon > myIcons
int myId
bool myCreated
bool myInited
QWidgetmyOwner
DtMainMenuType myType
bool myEnableValidations
DtMenuWidgetmyMenuWidget
bool myDisplay
QHash< DtPopupMenu *, int > myMenuMappingList
DtPopupMenumyMenuItemProxy
 This will be set to a menu that is mapping us so the menuItemForType call will ask myMenuItemProxy menu rather this menu.
QList< DtActionGroup * > myActionGroups
 These are actions groups that were created outside the menu system.
QHash< DtMenuItemType,
DtActionGroup * > 
myInternalGroupMappings
QList< DtPopupMenu * > myAttachedMenus
 Menus that have been attached to this menu.
QList< DtActionGroup * > myPendingActionGroups
 During post processing step, add menu items to parent action group or menu.
QVector< QString > myRemovedActionGroups
 List of action groups that need to be ignored.
DtFeatureActionManagermyFeatureActionManager
bool myAddFeatures

Static Protected Attributes

static QHash< DtMenuItemType,
DtActionValidatorMap
myGlobalActionValidators

Constructor & Destructor Documentation

DtPopupMenu::DtPopupMenu ( QWidget parent,
bool  display = true 
)

In your override, if you want to create the menu for right click purposes but do not want the menu to be on the main menu bar, call the parent DtPopupMenu constructor with false as the display parameter.

virtual DtPopupMenu::~DtPopupMenu ( )
virtual

Member Function Documentation

virtual bool DtPopupMenu::init ( DtMainMenuType  iType,
DtMenuWidget menu,
QWidget owner,
int  iPos = -1,
int  iID = -1 
)
virtual

Supply an id to identifiy this menu item or -1 to generate a unique id.

Also supply a position to place this menu item on the parent menu bar. If -1, appends item

virtual void DtPopupMenu::insertMenu ( DtMenuWidget menuWidget,
int  iPos = -1,
int  iID = -1 
)
virtual
virtual bool DtPopupMenu::setup ( DtMenuWidget menuWidget)
virtual

Called from init, sets up the menu items, connections and action groups.

virtual void DtPopupMenu::preCreateMenuItems ( )
virtual

Reimplemented in DtTMCreateMenu.

virtual bool DtPopupMenu::createMenuItems ( )
virtual

Reimplemented in DtTMCreateMenu, and DtTMObjectsMenu.

virtual int DtPopupMenu::id ( ) const
virtual
virtual DtMenuItemType DtPopupMenu::typeFromAction ( QAction )
virtual

If this object contains the specified QAction, return the type it is.

virtual DtMenuItemType DtPopupMenu::typeFromName ( const QString &  )
virtual

Returns the type from the menu item name.

virtual QAction* DtPopupMenu::menuItemForType ( DtMenuItemType  iType)
virtual

Returns the QAction for this type (if this menu has it)

virtual bool DtPopupMenu::hasType ( DtMenuItemType  iType)
virtual

Returns true if this menu contains the specified menu item type.

virtual int DtPopupMenu::positionOfMenuItem ( const DtPopupMenuItem item)
virtual

Returns the position of the menu item in the ordered list.

Note that this might not be the same as the position in the menu, due to separator addition

virtual int DtPopupMenu::positionOfMenuItem ( DtMenuItemType  iType)
virtual
virtual int DtPopupMenu::menuItemPositionOf ( QAction action)
virtual

Returns the true menu item position of the QAction.

This is based on a menu item name match, so, if the menu has two menu items of the same name, it will return the first occurnace. Will return -1 if not found

virtual DtActionGroup* DtPopupMenu::getActionGroupForType ( DtMenuItemType  iType)
virtual
virtual DtMainMenuType DtPopupMenu::type ( ) const
virtual
virtual void DtPopupMenu::setOwner ( QWidget owner)
virtual

Accessors for owner.

virtual QWidget* DtPopupMenu::owner ( ) const
virtual
virtual void DtPopupMenu::setEnableValidations ( bool  b)
virtual

Call to always make sure all menu items are enabled with b being set to false.

virtual void DtPopupMenu::reconfigureMenu ( QList< DtMenuItemType > &  items,
bool  keep 
)
virtual

This will reconfigure the menu by either keeping or removing the items in the specified list.

If keep is false, the items in the list will be removed

virtual void DtPopupMenu::updateMenuItems ( )
virtual

Update contents of menu based on any new conditions.

Reimplemented in DtTMCreateMenu.

virtual void DtPopupMenu::seedActionGroups ( )
virtual

Goes through all the menu items and fills in the action groups list.

virtual bool DtPopupMenu::attachMenu ( const QString &  title,
DtPopupMenu ,
int  iIndex = -1 
)
virtual

This routine will add a DtPopupMenu as a sub menu to this menu.

When this menu does any operation (finding items, names, etc) these menus will be referenced as well. The rules for inserting a new popup menu are: 1) This menu must already be created 2) The menu that is being attached is also created 3) Once the menu is attached, it cannot be unattached, unless the original popup is deleted

bool DtPopupMenu::initialized ( ) const
inline

References myInited.

DtFeatureActionManager * DtPopupMenu::featureActionManager ( ) const
inline

Accessors for featureActionManager.

References myFeatureActionManager.

virtual void DtPopupMenu::setFeatureActionManager ( DtFeatureActionManager )
virtual
void DtPopupMenu::setAddFeatures ( bool  b)
inline

References myAddFeatures.

bool DtPopupMenu::addFeatures ( ) const
inline

References myAddFeatures.

virtual QString DtPopupMenu::shortcutFor ( const QString &  feature) const
virtual

Returns shortcut for specified feature.

virtual void DtPopupMenu::addShortcut ( const QString &  feature,
const QString &  shortcut 
)
virtual
virtual void DtPopupMenu::replaceShortcut ( const QString &  feature,
const QString &  shortcut 
)
virtual
virtual bool DtPopupMenu::hasShortcutOverride ( const QString &  feature) const
virtual
virtual bool DtPopupMenu::hasShortcut ( const QString &  feature) const
virtual
virtual QString DtPopupMenu::iconFor ( const QString &  feature,
QIcon::Mode  mode = QIcon::Normal,
QIcon::State  = QIcon::Off,
bool  useDefault = false 
)
virtual

Returns icon for specified feature. If useDefault is true, finds default icon based on feature name.

virtual QString DtPopupMenu::menuTextForAction ( QAction )
virtual

Returns text for the menu (or sub-menu) that contains the action.

virtual QHash<DtMenuItemType, QAction*>& DtPopupMenu::actions ( )
virtual
virtual QList<QAction*> DtPopupMenu::menuActions ( )
virtual
virtual const QList<DtPopupMenu*>& DtPopupMenu::attachedMenus ( ) const
virtual
virtual DtPopupMenuItem* DtPopupMenu::insertMenuItem ( DtMenuItemType  iPos,
const QString &  featureName,
DtMenuItemType  iType,
QString  text,
QString  toolTip = QString::null,
QString  accel = QString::null,
bool  addSeparator = false,
bool  toggle = false,
bool  isOn = false,
const QString &  objectName = "" 
)
virtual

The featureName in each of the inserts is a keyword that will be used to look up the feature in the featureActionManager for both shortcuts and icons.

If the featureName is empty, the feature will not be available for lookup nor for placement on a user defined toolbar If iPos is -1, appends the menu item. The type is one that uniquely identifies this menu item (defined in menuItems.h). If iType already exists as part of this menu, the menu item is replaced. If this menu is already created, inserts the new menu item and initializes connections for it. If addSeparator is true a separator will be added to the current action group of this type after the menu item is added. By default a name will be created for this menu item unless supplied as last parameter.

virtual DtPopupMenuItem* DtPopupMenu::insertMenuItem ( DtMenuItemType  iPos,
DtMenuItemType  iType,
QString  text,
QString  toolTip = QString::null,
QString  accel = QString::null,
bool  addSeparator = false,
bool  toggle = false,
bool  isOn = false,
const QString &  objectName = "" 
)
virtual

Call this version to not allow the item to be added to a user defined toolbar.

virtual DtPopupMenuItem* DtPopupMenu::insertToggleMenuItem ( DtMenuItemType  iBefore,
const QString &  featureName,
DtMenuItemType  iType,
QString  text,
QString  toolTip = QString::null,
QString  accel = QString::null,
bool  addSeparator = false,
bool  isOn = false,
const QString &  objectName = "" 
)
virtual

Same as above except sets the myIsToggle flag to true which means that is will be an on/off menu item and rather than having the connection made to the "activated" signal, it will be made to the "toggled(bool)" signal.

virtual DtPopupMenuItem* DtPopupMenu::insertToggleMenuItem ( DtMenuItemType  iBefore,
DtMenuItemType  iType,
QString  text,
QString  toolTip = QString::null,
QString  accel = QString::null,
bool  addSeparator = false,
bool  isOn = false,
const QString &  objectName = "" 
)
virtual

Call this version to not allow the item to be added to a user defined toolbar.

virtual void DtPopupMenu::addMenuItemSeparator ( DtMenuItemType  iGroup)
virtual

Inserts a separator at the current create position for the specified group.

virtual void DtPopupMenu::removeMenuItem ( DtMenuItemType  iType)
virtual

Removes the menu item of the specified type. If it's already created removes it immediately.

virtual bool DtPopupMenu::removeMenuGroup ( const QString &  gr)
virtual

Removes the menu group and all sub-items from that group.

If the menu has not already been created, will prevent that action group from being used

virtual void DtPopupMenu::removeItemAtPosition ( int  iPos)
virtual

Removes the item at the specified position.

virtual void DtPopupMenu::addIcon ( DtMenuItemType  iType,
QString  icon,
QIcon::Mode  mode = QIcon::Normal,
QIcon::State  = QIcon::Off 
)
virtual

Adds an icon to be added when the menu item is created.

If the menu item has already been created, attaches the icon to the menu item. If the menu item already has an icon, replaces it with the new one

virtual void DtPopupMenu::removeIcon ( DtMenuItemType  iType,
QIcon::Mode  mode = (QIcon::Mode)-1,
QIcon::State  = QIcon::Off 
)
virtual

Removes an icon. If the menu item is created also removes it from the menu item.

virtual void DtPopupMenu::addGroup ( DtMenuItemType  iToGroup,
DtMenuItemType  iGroup,
int  iPos,
bool  addSep = false 
)
virtual

Inserts the action group at the specified position to the specified group (use -1 to append at current position).

Note that when the group is added it will be added in its current state, and any menu items that are added to that group will not be displayed. The group is added at the specified position

virtual void DtPopupMenu::removeGroup ( DtMenuItemType  iGroup)
virtual

Removes group.

virtual void DtPopupMenu::addMenu ( DtMainMenuType  ,
int  iPos,
bool  addSep 
)
virtual

Inserts the menu at the specified position.

These items will be added after all other menu items have been created

virtual void DtPopupMenu::removeMenu ( DtMainMenuType  iGroup)
virtual

Removes group.

virtual void DtPopupMenu::mappingMenu ( DtPopupMenu menu,
int  iFlags = 0 
)
virtual

Call this routine if you want to map menu items.

All menus that are scheduled for mapping must be set before this menu is initialized

virtual void DtPopupMenu::mapMenuItem ( DtMenuItemType  iType,
DtPopupMenu popupMenu,
int  iPos = -1,
bool  addSeparator = false 
)
virtual

This will look at the target popup menu and take both the menu item definition and the validator map entry defined by the menu item type and add them to this menu.

Note that no information will be changed. If the same menu item type exists in this menu, it is removed

virtual void DtPopupMenu::setPosition ( int  iPos)
virtual

Sets the menu item position if inited. Removes then re-inserts.

virtual bool DtPopupMenu::matchesName ( QString  name)
virtual

Returns true if the supplied name matches the menu name of this menu. Will take & into account.

virtual DtMenuItemType DtPopupMenu::uniqueId ( ) const
virtual

Returns a unique id for this menu (max + 1)

virtual QAction* DtPopupMenu::addMenuItem ( DtMenuItemType retId,
const QString &  featureName,
const QString &  item,
const QString &  addToMenu,
bool  toggle = false,
QObject actionReceiver = NULL,
const char *  action = NULL,
QObject validationReceiver = NULL,
const char *  validation = NULL,
const QString &  tooltip = QString::null,
const QString &  accelerator = QString::null,
bool  addSep = false 
)
virtual

Adds a new menu item given the menu item, path to add, action and validator.

Note this routine is only valid for after the menu system has been created. The addToMenu is the "path" to add the menu item to. If empty, adds it to the top level menu (at the bottom). If addToMenu is a menu item, will add it before that menu item. If addToMenu is a popdown action group, adds it to that group at the end (or before the specified item). If the addToMenu item does not exist, it will assume to create a popdown action group for each item and add it to that. Returns a new unique menu item id for this menu.

If the menu has been created, will return the new menu item

If retId is DtNoMenuItemType, then it will be assigned a uniqueId()

virtual void DtPopupMenu::appendMenuValidator ( DtMenuItemType  iType,
QObject vCall,
const char *  validator 
)
virtual

Adds the specified validator to a list of validators that can be called for the menu item.

virtual void DtPopupMenu::appendMenuValidator ( const QString &  menu,
QObject vCall,
const char *  validator 
)
virtual
virtual bool DtPopupMenu::removeMenuItem ( const QString &  item)
virtual

Removes the named menu item from the menu.

virtual void DtPopupMenu::setupFrom ( DtMainMenuType  iType,
DtPopupMenu ,
QWidget ,
DtMenuWidget w 
)
virtual

Copies menu item information without creating the menu.

If the menu is already created, will not change any menu items, but will copy over structure information

virtual void DtPopupMenu::renameMenuItem ( DtMenuItemType  iType,
QString  text = QString::null,
QString  toolTip = QString::null,
QString  accel = QString::null 
)
virtual

Useful routines for subclasses of existing menus to rename/override default functionality.

If menu item has been created renames existing menu ite,

virtual void DtPopupMenu::positionBefore ( DtMenuItemType  iType,
DtMenuItemType  iBefore 
)
virtual

Repositioning of menu items.

virtual void DtPopupMenu::positionAfter ( DtMenuItemType  iType,
DtMenuItemType  iAfter 
)
virtual
virtual QString DtPopupMenu::menuName ( )
virtual

Returns the name of this menu item to place on the menu bar.

Reimplemented in DtTMCreateMenu, DtHelpMenu, DtTMObjectsMenu, DtEntityEditorCreateMenu, DtEntityEditorEditMenu, DtTMViewMenu, DtTMFileMenu, DtTMNavigationMenu, and DtTMOptionsMenu.

virtual void DtPopupMenu::addActionAndValidatorForType ( DtMenuItemType  iType,
QObject aCall,
const char *  action,
QObject vCall = NULL,
const char *  validator = NULL 
)
virtual

Adds a new action/validator pair.

Supply NULL to have no action. The items passed are SLOTS that will be called via a connection to either the activated signal from the QAction (for the action) or the validateItems signal if something needs to be validated. The QObject* supplied is the item that will be signalled in response to both action and validator

virtual void DtPopupMenu::addActionForType ( DtMenuItemType  iType,
QObject aCall,
const char *  action 
)
virtual
virtual void DtPopupMenu::addValidatorForType ( DtMenuItemType  iType,
QObject vCall,
const char *  validator 
)
virtual
virtual void DtPopupMenu::addGlobalActionAndValidatorForType ( DtMenuItemType  iType,
QObject aCall,
const char *  action,
QObject vCall = NULL,
const char *  validator = NULL 
)
virtual

Replaces on a global level the action/validator pair for the specified type.

virtual DtActionGroup* DtPopupMenu::actionGroupWithName ( const QString &  ) const
virtual

Returns an action (or action group) with the specified name.

These will only return valid items after the menu has been created

virtual QAction* DtPopupMenu::actionWithName ( const QString &  ) const
virtual
virtual void DtPopupMenu::clearMenuItems ( )
virtual

Frees memory associated with menu items. Do not call unless the menu is about to be destroyed.

virtual void DtPopupMenu::removeFeatureActions ( )
virtual
void DtPopupMenu::validateItems ( )
signal

Sent when items want to be validated. Emitted from the validate() method.

virtual void DtPopupMenu::validate ( )
virtualslot

Reimplemented in DtTMViewMenu, and DtTerrainObjectsMenu.

virtual void DtPopupMenu::menuItemDestroyed ( QAction )
virtualslot

Reimplemented in DtTMCreateMenu.

virtual void DtPopupMenu::actionGroupDestroyed ( DtActionGroup )
virtualslot

Reimplemented in DtTMCreateMenu.

virtual void DtPopupMenu::featureActionManagerDestroyed ( )
virtualslot
virtual void DtPopupMenu::popupRemoved ( QObject )
protectedvirtualslot
virtual void DtPopupMenu::menuItemDestroyed ( )
protectedvirtualslot
virtual void DtPopupMenu::actionGroupDestroyed ( )
protectedvirtualslot
virtual bool DtPopupMenu::initMenuItems ( )
protectedvirtual

Initializes specific menu items to place onto this menu bar.

Override this routine to create your menu items.

Reimplemented in DtTMCreateMenu, DtTMNavigationMenu, DtHelpMenu, DtTMViewMenu, DtTMObjectsMenu, DtTerrainFileMenu, DtTMFileMenu, DtTMOptionsMenu, DtTerrainObjectsMenu, DtTerrainViewMenu, DtTerrainOptionsMenu, DtEntityEditorCreateMenu, DtEntityEditorEditMenu, and DtEntityEditorFileMenu.

virtual bool DtPopupMenu::initActionGroups ( )
protectedvirtual
virtual bool DtPopupMenu::removeMenuItemAtPosition ( int  iPos)
protectedvirtual

Removes the menu item at the specified position from the ordered list and the menu if it has been created.

Returns true if the menu was also removed from the menu system, false if not. This will be true if myCreated is true and the menu item is found

virtual void DtPopupMenu::addNewMenuItem ( DtPopupMenuItem item,
int  iPos 
)
protectedvirtual

Adds a new menu item to internal structures and creates if needed.

At this time, if the menu has already been created, the item is appended rather than inserted at the current position.

virtual QAction* DtPopupMenu::createMenuItem ( const DtPopupMenuItem item)
protectedvirtual

Creates and returns the new menu item.

If item created is a separator, then what is returned is DtSeparatorType

virtual void DtPopupMenu::attachMenuItems ( )
protectedvirtual

Using the mappings from type to validator and action, maps the created actions and connects them to the appropriate messages.

Reimplemented in DtTMCreateMenu.

virtual void DtPopupMenu::attachMenuItem ( const DtPopupMenuItem item)
protectedvirtual

Attaches a menu item based on the specific type.

virtual void DtPopupMenu::addCompletedItemsToMenu ( )
protectedvirtual

Adds the completed items to the menu.

By default calls getActionGroupForType(0) and adds that return value to this menu

Reimplemented in DtTerrainOptionsMenu.

virtual void DtPopupMenu::addAttachedMenus ( )
protectedvirtual

Adds any menus to this menu via the attachMenu command by creating them via the menu widget factory.

virtual void DtPopupMenu::setIcon ( DtMenuItemType  iType)
protectedvirtual

Uses internal structures to see if this menu item needs an icon associated with it.

virtual void DtPopupMenu::attachValidators ( bool  b)
protectedvirtual

Cycles through menu items and attaches/detatches validators according to flag.

Called from setEnableValidations

virtual void DtPopupMenu::initConnections ( )
protectedvirtual

Initializes connections used for validations on this popup menu.

Reimplemented in DtTMObjectsMenu.

virtual DtPopupMenuItem* DtPopupMenu::popupMenuItem ( DtMenuItemType  iType,
bool  actionable = false 
)
protectedvirtual

Returns the DtPopupMenuItem associated with a particular type.

If actionable is false, returns the first occurance, else returns the first actionable occurance

virtual DtActionValidatorMap* DtPopupMenu::actionValidatorMapEntry ( DtMenuItemType  iType)
protectedvirtual

Returns a DtActionValidatorMap associated with the particular type.

virtual void DtPopupMenu::removeOrderedMenuItem ( int  iPos)
protectedvirtual

Removes the item only from the ordered list.

virtual int DtPopupMenu::addOrderedItem ( const DtPopupMenuItem item,
int  iPos 
)
protectedvirtual

Adds an item to the ordered list. Returns the position added to in the ordered list.

virtual void DtPopupMenu::setMapMenuItemsTo ( DtPopupMenu menu)
protectedvirtual

Set proxy menu.

virtual void DtPopupMenu::addActionGroup ( DtActionGroup )
protectedvirtual

Adds a new action group to internal list (if does not exist)

virtual bool DtPopupMenu::matchesName ( QString  menu,
QString  name 
) const
protectedvirtual
virtual DtActionGroup* DtPopupMenu::internalGetActionGroupForType ( DtMenuItemType  type)
protectedvirtual

Checks internal groups then checks getActionGroupForType.

virtual QAction* DtPopupMenu::addNewActionToActionGroup ( const DtPopupMenuItem item)
protectedvirtual

Creates a new menu item and adds it to its action group.

virtual void DtPopupMenu::addAllActionsFor ( DtActionGroup )
protectedvirtual

Given the group, looks through all menu items that return the given sub group and adds them to the group.

Sets myProcess flag to true

Member Data Documentation

QHash<DtMenuItemType, QAction*> DtPopupMenu::myActions
protected
QHash<DtMenuItemType, DtPopupMenuItem> DtPopupMenu::myMenuItems
protected
QHash<DtMenuItemType, DtActionValidatorMap> DtPopupMenu::myActionValidators
protected
QList<DtPopupMenuItem> DtPopupMenu::myOrderedMenuItems
protected
QHash<DtMenuItemType, QIcon> DtPopupMenu::myIcons
protected
int DtPopupMenu::myId
protected
bool DtPopupMenu::myCreated
protected
bool DtPopupMenu::myInited
protected

Referenced by initialized().

QWidget* DtPopupMenu::myOwner
protected
DtMainMenuType DtPopupMenu::myType
protected
bool DtPopupMenu::myEnableValidations
protected
DtMenuWidget* DtPopupMenu::myMenuWidget
protected
bool DtPopupMenu::myDisplay
protected
QHash<DtPopupMenu*, int> DtPopupMenu::myMenuMappingList
protected
DtPopupMenu* DtPopupMenu::myMenuItemProxy
protected

This will be set to a menu that is mapping us so the menuItemForType call will ask myMenuItemProxy menu rather this menu.

QHash<DtMenuItemType, DtActionValidatorMap> DtPopupMenu::myGlobalActionValidators
staticprotected
QList<DtActionGroup*> DtPopupMenu::myActionGroups
protected

These are actions groups that were created outside the menu system.

QHash<DtMenuItemType, DtActionGroup*> DtPopupMenu::myInternalGroupMappings
protected
QList<DtPopupMenu*> DtPopupMenu::myAttachedMenus
protected

Menus that have been attached to this menu.

QList<DtActionGroup*> DtPopupMenu::myPendingActionGroups
protected

During post processing step, add menu items to parent action group or menu.

QVector<QString> DtPopupMenu::myRemovedActionGroups
protected

List of action groups that need to be ignored.

DtFeatureActionManager* DtPopupMenu::myFeatureActionManager
protected

Referenced by featureActionManager().

bool DtPopupMenu::myAddFeatures
protected

Referenced by addFeatures(), and setAddFeatures().


The documentation for this class was generated from the following file:

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)