#include <ContextMenu.h>
Public Member Functions | |
| virtual const std::vector < SessionItem * > & | getSessionItems () const =0 |
| template<typename T> | |
| std::vector< T * > | getSessionItems () const |
| virtual const QPoint & | getMouseLocation () const =0 |
| virtual QObject * | getActionParent () const =0 |
| virtual bool | addAction (const ContextMenuAction &menuAction)=0 |
| virtual bool | addAction (QAction *pAction, const std::string &id)=0 |
| virtual bool | addActionBefore (QAction *pAction, const std::string &id, const std::string &beforeId)=0 |
| virtual bool | addActionAfter (QAction *pAction, const std::string &id, const std::string &afterId)=0 |
| virtual void | removeAction (const std::string &id)=0 |
Static Public Member Functions | |
| static bool | getSettingLogActions () |
| static bool | hasSettingLogActions () |
| static void | setSettingLogActions (bool newValue, bool setIfSame=false) |
| static std::string | getSettingLogActionsKey () |
Protected Member Functions | |
| virtual | ~ContextMenu () |
A ContextMenu is created by objects that display a context menu to the user for one or more session items. An object usually creates the menu before it emits a signal that allows attached object to add actions to the menu or to remove one or more of the default actions.
Actions can be added to or removed from the menu using ContextMenuAction objects, which gives all objects that need to modify the actions a chance to add or remove actions. The actual list of actions that are displayed to the user is not created until the menu is shown.
Definition at line 40 of file ContextMenu.h.
| virtual ContextMenu::~ContextMenu | ( | ) | [protected, virtual] |
This object does not need to be destroyed directly.
It will be deleted by the object that creates and displays the context menu.
Definition at line 263 of file ContextMenu.h.
| static bool ContextMenu::getSettingLogActions | ( | ) | [static] |
Returns the current value for this setting.
If this setting does not exist in ConfigurationSettings, a verification error will be logged to the message log and potentially a verification error message box will be displayed to the user.
Please see Settings Macros for more details
Definition at line 53 of file ContextMenu.h.
| static bool ContextMenu::hasSettingLogActions | ( | ) | [static] |
Returns true if this setting exists and has a value in ConfigurationSettings.
Please see Settings Macros for more details
true if this setting exists, false otherwise. Definition at line 60 of file ContextMenu.h.
| static void ContextMenu::setSettingLogActions | ( | bool | newValue, | |
| bool | setIfSame = false | |||
| ) | [static] |
Changes the current value of this setting to the new value.
Please see Settings Macros for more details
| newValue | the new value for this setting. | |
| setIfSame | If true, the value will be set into ConfigurationSettings even if the newValue and existing value are the same. This has the side-effect of making the value a per-user setting and stored in the user's configuration file. If false, this value will only be set if the newValue and existing value are different. Therefore the value will only be stored in the user's configuration file if the newValue is unique to the user. |
Definition at line 76 of file ContextMenu.h.
| static std::string ContextMenu::getSettingLogActionsKey | ( | ) | [static] |
Returns the key for this setting that could be passed to ConfigurationSettings::getSetting() or ConfigurationSettings::setSetting().
Please see Settings Macros for more details
Definition at line 84 of file ContextMenu.h.
| virtual const std::vector<SessionItem*>& ContextMenu::getSessionItems | ( | ) | const [pure virtual] |
Returns the session items for which the context menu will display actions.
| std::vector<T*> ContextMenu::getSessionItems | ( | ) | const |
Returns only the session items of a specified type for which the context menu will display actions.
This is a convenience method that gets all session items for which the context menu has been requested filters the returned items based on the specified type.
Definition at line 112 of file ContextMenu.h.
| virtual const QPoint& ContextMenu::getMouseLocation | ( | ) | const [pure virtual] |
Returns the context menu mouse click location.
| virtual QObject* ContextMenu::getActionParent | ( | ) | const [pure virtual] |
Returns a pointer to an object that can be used as a parent for a menu action.
This method provides a QObject that can optionally be used as the parent for a menu action. By using this object as a parent, the action will automatically be deleted when the context menu itself is deleted.
| virtual bool ContextMenu::addAction | ( | const ContextMenuAction & | menuAction | ) | [pure virtual] |
Adds an action to a context menu.
| menuAction | The action to add to the context menu. |
| virtual bool ContextMenu::addAction | ( | QAction * | pAction, | |
| const std::string & | id | |||
| ) | [pure virtual] |
Adds an action to a context menu.
This is a convenience method that creates a ContextMenuAction to append the given action to the list of actions that will be displayed in the context menu and calls addAction(const ContextMenuAction&).
| pAction | The action to add to the context menu. | |
| id | The unique identifier for the action. |
| virtual bool ContextMenu::addActionBefore | ( | QAction * | pAction, | |
| const std::string & | id, | |||
| const std::string & | beforeId | |||
| ) | [pure virtual] |
Inserts an action into a context menu before another action.
This is a convenience method that creates a ContextMenuAction to add the given action to the list of actions that will be displayed in the context menu, sets the placement of the action to appear before the given action, and calls addAction(const ContextMenuAction&).
| pAction | The action to add to the context menu. | |
| id | The unique identifier for the action to add. | |
| beforeId | The unique identifier for the action that should appear below the added action. If beforeId is empty, this method is identical to addAction(QAction*, const std::string&). |
| virtual bool ContextMenu::addActionAfter | ( | QAction * | pAction, | |
| const std::string & | id, | |||
| const std::string & | afterId | |||
| ) | [pure virtual] |
Inserts an action into a context menu after another action.
This is a convenience method that creates a ContextMenuAction to add the given action to the list of actions that will be displayed in the context menu, sets the placement of the action to appear after the given action, and calls addAction(const ContextMenuAction&).
| pAction | The action to add to the context menu. | |
| id | The unique identifier for the action to add. | |
| afterId | The unique identifier for the action that should appear above the added action. If afterId is empty, this method is identical to addAction(QAction*, const std::string&). |
| virtual void ContextMenu::removeAction | ( | const std::string & | id | ) | [pure virtual] |
Removes an action from the context menu.
This method registers the given action to be removed from the context menu. The action is not removed until all slot methods that are connected to the about-to-show context menu signal are called. This allows for correct placement of all actions in the menu before any actions are removed.
| id | The unique identifier for the action to remove from the menu. |