OpendTect-6_4
6.4
|
Public Member Functions | |
MenuHandler (int id) | |
virtual bool | executeMenu ()=0 |
int | menuID () const |
void | setMenuID (int newid) |
bool | isHandled () const |
void | setIsHandled (bool) |
int | queueID () const |
Public Member Functions inherited from MenuItemHolder | |
MenuItemHolder () | |
virtual | ~MenuItemHolder () |
virtual void | addItem (MenuItem *, bool manage=false) |
void | removeItems () |
int | nrItems () const |
const MenuItem * | getItem (int idx) const |
MenuItem * | getItem (int idx) |
int | itemIndex (const MenuItem *) const |
int | itemIndex (int id) const |
MenuItem * | findItem (int id) |
const MenuItem * | findItem (int id) const |
MenuItem * | findItem (const char *) |
Seaches for untranslated text. More... | |
const MenuItem * | findItem (const char *) const |
Seaches for untranslated text. More... | |
const ObjectSet< MenuItem > & | getItems () const |
Public Member Functions inherited from CallBacker | |
CallBacker () | |
CallBacker (const CallBacker &) | |
virtual | ~CallBacker () |
bool | attachCB (NotifierAccess &, const CallBack &, bool onlyifnew=false) |
bool | attachCB (NotifierAccess *notif, const CallBack &cb, bool onlyifnew=false) |
void | detachCB (NotifierAccess &, const CallBack &) |
void | detachCB (NotifierAccess *notif, const CallBack &cb) |
bool | isNotifierAttached (NotifierAccess *) const |
Only for debugging purposes, don't use. More... | |
Public Attributes | |
Notifier< MenuHandler > | initnotifier |
Notifier< MenuHandler > | createnotifier |
CNotifier< MenuHandler, int > | handlenotifier |
Public Attributes inherited from MenuItemHolder | |
Notifier< MenuItemHolder > | removal |
Protected Member Functions | |
void | assignItemID (MenuItem &) |
void | executeQueue () |
Protected Member Functions inherited from MenuItemHolder | |
void | itemIsDeletedCB (CallBacker *) |
Protected Member Functions inherited from CallBacker | |
void | detachAllNotifiers () |
Call from the destructor of your inherited object. More... | |
Protected Attributes | |
int | id_ |
bool | ishandled_ |
int | queueid_ |
Protected Attributes inherited from MenuItemHolder | |
MenuItemHolder * | parent_ |
Private Member Functions | |
mRefCountImpl (MenuHandler) | |
A generic representation of a menu. It allows anyone to add their own custom menuitems to it. The principle is that the menu triggers it's createnotifier just before the menu should be displayed, and the application adds the items it wants into the menu. When the user has clicked on something in the menu, the handlenotifier is triggered and the application checks what should be done.
Usage:
Upon a create notification, your class might do something like this:
The code will make a menu with two items, and the second item will have a submenu with two items. The first boolean says whether the item should be enabled, the second one says where there should be a check before it.
The menuitems are instantiations of MenuItem and should be stored in your class. They hold information about the item itself (like text, enabled or not enabled, checked or not checked, information on where in the menu it should be placed. In addition, it has an unique id that is set when the item is inserted into the menu.
Upon a handle notification, your class might do something like this:
MenuHandler::MenuHandler | ( | int | id | ) |
|
protectedvirtual |
Get a unique id for this item.
Reimplemented from MenuItemHolder.
|
pure virtual |
Implemented in uiTreeItemTBHandler, and uiMenuHandler.
|
protected |
bool MenuHandler::isHandled | ( | ) | const |
Should be called as the first thing from callbacks that is triggered from uiMenuHandler::handlenotifier. If isHandled() returns true, the callback should return immediately.
|
inline |
|
private |
|
inline |
After a menu is executed, it will execute a queue, identified by this id.
void MenuHandler::setIsHandled | ( | bool | ) |
Should be called from callbacks that are triggered from uiMenuHandler::handlenotifier if they have found the menu id they are looking for.
|
inline |
Notifier<MenuHandler> MenuHandler::createnotifier |
CNotifier<MenuHandler,int> MenuHandler::handlenotifier |
|
protected |
Notifier<MenuHandler> MenuHandler::initnotifier |
|
protected |
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019