Public Member Functions | Public Attributes | Friends

FBGenericMenu Class Reference

Search for all occurrences

Detailed Description

A GenericMenu class.

You can use this class either to create a new menu in the menu bar (or in a menuitem in the menu bar) or you can use this class to create a pop-up menu.

    #to start a pop up menu use the Execute method
    def mouseClick(x, y):
        item = menu.Execute(x, y)
        if item.Id == 10:
           [do this]
        else if item.Id == 100:
            [do that...]

There are 4 ways to insert new item in a menu. Each method needs the name of the menuitem as well as it's unique id. You can also optionnally sets a new menu for a specific item.

    embeededMenu = FBGenericMenu()
    menu.InsertLast("new new item", 67, embeddedMenu)

    #A genericMenu contains a GenericMenuItem for each entry. You can iterate on the different menuitem
    #using GetFirstITem/GetNextItem or if you already know the id of the item you can get it with GetItem.
    
    item = menu.GetFirstItem()
    while item:
        print item.Name
        item = menu.GetNextItem(item)

You can also delete a Menu item: this will remove the item from the menu as well as freeing its memory.

To be notified when a menuitem is clicked, you can register using OnMenuActivate. This will send a FBEventMenu containing the name and the Id of the menu item that was clicked.

Definition at line 126 of file fbgenericmenu.h.

#include <fbgenericmenu.h>

Inheritance diagram for FBGenericMenu:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 FBGenericMenu (HIObject pObject=NULL)
 Default constructor.
virtual void FBDelete () override
 Virtual FBDelete function.
FBGenericMenuItemGetFirstItem ()
 Returns the first menu item (if existing) in this menu.
FBGenericMenuItemGetLastItem ()
 Returns the last menu item (if existing) in this menu.
FBGenericMenuItemGetNextItem (FBGenericMenuItem *pItem)
 Returns the menu item following an other item.
FBGenericMenuItemGetPrevItem (FBGenericMenuItem *pItem)
 Returns the menu item preceding an other item.
FBGenericMenuItemGetItem (int pItemId)
 Returns the menu item corresponding to an id.
FBGenericMenuItemInsertFirst (const char *pItemName, int pItemId, FBGenericMenu *pMenu=NULL)
 Inserts a new menu Item at the first position in the menu list.
FBGenericMenuItemInsertLast (const char *pItemName, int pItemId, FBGenericMenu *pMenu=NULL)
 Inserts a new menu Item at the last position in the menu list.
FBGenericMenuItemInsertAfter (FBGenericMenuItem *pBeforeItem, const char *pItemName, int pItemId, FBGenericMenu *pMenu=NULL)
 Inserts a new menu Item AFTER another item.
FBGenericMenuItemInsertBefore (FBGenericMenuItem *pAfterItem, const char *pItemName, int pItemId, FBGenericMenu *pMenu=NULL)
 Inserts a new menu Item BEFORE another item.
void DeleteItem (FBGenericMenuItem *pToDelete)
 Remove a menu item from the menu and delete it.
FBGenericMenuItemExecute (int pX, int pY, bool pRightAlign=true)
 Starts the menu as a pop-up menu at a specific location on screen.

Public Attributes

FBPropertyEvent OnMenuActivate
 Event Property: Register on this property to be notified when a menu item is clicked by the user.

Friends

class FBMenuManager
class DataFBMenuManager
class DataFBGenericMenu

Constructor & Destructor Documentation

FBGenericMenu ( HIObject  pObject = NULL)

Default constructor.

Used to create embedded menu (inside aniother menu item) or pop-up menu.


Member Function Documentation

virtual void FBDelete ( ) [override, virtual]

Virtual FBDelete function.

Reimplemented from FBComponent.

FBGenericMenuItem* GetFirstItem ( )

Returns the first menu item (if existing) in this menu.

You can then use GetNextItem to iterate on other menu items.

Returns:
The first menu item in this Menu.
FBGenericMenuItem* GetLastItem ( )

Returns the last menu item (if existing) in this menu.

You can then use GetPrevItem to reverse iterate on other menu items.

Returns:
The last menu item in this Menu.
FBGenericMenuItem* GetNextItem ( FBGenericMenuItem pItem)

Returns the menu item following an other item.

Returns null if this is the last item in menu.

Parameters:
pItemWill return the item after pItem
Returns:
Will return the item after pItem. Null if pItem is the last item.
FBGenericMenuItem* GetPrevItem ( FBGenericMenuItem pItem)

Returns the menu item preceding an other item.

Returns null if this is the first item in menu.

Parameters:
pItemWill return the item BEFORE pItem
Returns:
Will return the item BEFORE pItem. Null if pItem is the first item.
FBGenericMenuItem* GetItem ( int  pItemId)

Returns the menu item corresponding to an id.

Parameters:
pItemIdId of the item we are looking for.
Returns:
Will return the Item corresponding to an id (null if not found).
FBGenericMenuItem* InsertFirst ( const char *  pItemName,
int  pItemId,
FBGenericMenu pMenu = NULL 
)

Inserts a new menu Item at the first position in the menu list.

Parameters:
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptionnal. If this Item leads to another menu (embddedd) it can be specified here.
Returns:
Will return the menu item created from this insertion.
FBGenericMenuItem* InsertLast ( const char *  pItemName,
int  pItemId,
FBGenericMenu pMenu = NULL 
)

Inserts a new menu Item at the last position in the menu list.

Parameters:
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptionnal. If this Item leads to another menu (embddedd) it can be specified here.
Returns:
Will return the menu item created from this insertion.
FBGenericMenuItem* InsertAfter ( FBGenericMenuItem pBeforeItem,
const char *  pItemName,
int  pItemId,
FBGenericMenu pMenu = NULL 
)

Inserts a new menu Item AFTER another item.

Parameters:
pBeforeItemThe reference item. We will create a new item AFTER this one.
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptionnal. If this Item leads to another menu (embddedd) it can be specified here.
Returns:
Will return the menu item created from this insertion.
FBGenericMenuItem* InsertBefore ( FBGenericMenuItem pAfterItem,
const char *  pItemName,
int  pItemId,
FBGenericMenu pMenu = NULL 
)

Inserts a new menu Item BEFORE another item.

Parameters:
pAfterItemThe reference item. We will create a new item BEFORE this one.
pItemNameCaption of the newly added item.
pItemIdUnique id of this menu item.
pMenuOptionnal. If this Item leads to another menu (embddedd) it can be specified here.
Returns:
Will return the menu item created from this insertion.
void DeleteItem ( FBGenericMenuItem pToDelete)

Remove a menu item from the menu and delete it.

Parameters:
pToDeleteThe item to remove.
FBGenericMenuItem* Execute ( int  pX,
int  pY,
bool  pRightAlign = true 
)

Starts the menu as a pop-up menu at a specific location on screen.

It returns the item that was clicked by the user.

Parameters:
pXX location in pixel on screen where the menu is to be popped.
pYY location in pixel on screen where the menu is to be poppded.
pRightAlignAll menu item will be align to the right justified (if true) or left justifed (if false)
Returns:
The selected item by the user. Null if the user clicks outside the menu.

Friends And Related Function Documentation

friend class FBMenuManager [friend]

Definition at line 218 of file fbgenericmenu.h.

friend class DataFBMenuManager [friend]

Definition at line 219 of file fbgenericmenu.h.

friend class DataFBGenericMenu [friend]

Definition at line 220 of file fbgenericmenu.h.


Member Data Documentation

Event Property: Register on this property to be notified when a menu item is clicked by the user.

Definition at line 216 of file fbgenericmenu.h.


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

FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu
FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu FBGenericMenu