Inheritance diagram for os::Menu:
Public Member Functions | |
Menu (Rect cFrame, const String &cName, MenuLayout_e eLayout, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_RIGHT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_CLEAR_BACKGROUND|WID_FULL_UPDATE_ON_RESIZE) | |
Constructor. | |
~Menu () | |
internal | |
int | Lock (void) const |
Locks the Menu. | |
void | Unlock (void) const |
Unlocks the Menu. | |
virtual void | TimerTick (int nID) |
Timer dispatch member. | |
void | AttachedToWindow (void) |
void | DetachedFromWindow (void) |
void | WindowActivated (bool bIsActive) |
Hook called when the window hosting this view gain or loose focus. | |
Point | GetPreferredSize (bool bLargest) const |
Returns the exact size of the Menu. | |
virtual void | MouseDown (const Point &cPosition, uint32 nButtons) |
Hook called by the system when a mouse button is pressed. | |
virtual void | MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData) |
Hook called by the system when a mouse button is release. | |
virtual void | MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData) |
Hook called by the system when the mouse is moved. | |
virtual void | KeyDown (const char *pzString, const char *pzRawString, uint32 nQualifiers) |
Hook called by the system when a key is pressed while the view has focus. | |
virtual void | FrameSized (const Point &cDelta) |
Virtual hook called by the system when the view is resized. | |
virtual void | Paint (const Rect &cUpdateRect) |
Called by the system update "damaged" areas of the view. | |
String | GetLabel () const |
Gets the label of the Menu. | |
void | SetLabel (const os::String &cLabel) |
Sets the label of the Menu. | |
MenuLayout_e | GetLayout () const |
Gets the layout of the Menu. | |
bool | AddItem (const String &cLabel, Message *pcMessage, const String &cShortcut="", Image *pcImage=NULL) |
Adds a MenuItem. | |
bool | AddItem (MenuItem *pcItem) |
Adds a MenuItem. | |
bool | AddItem (MenuItem *pcItem, int nIndex) |
Adds a MenuItem. | |
bool | AddItem (Menu *pcItem) |
Adds a MenuItem. | |
bool | AddItem (Menu *pcItem, int nIndex) |
Adds a MenuItem. | |
MenuItem * | RemoveItem (int nIndex) |
Removes an MenuItem. | |
bool | RemoveItem (MenuItem *pcItem) |
Removes an MenuItem. | |
bool | RemoveItem (Menu *pcMenu) |
Removes an MenuItem. | |
MenuItem * | GetItemAt (int nIndex) const |
Gets the MenuItem at a certain index number. | |
MenuItem * | GetItemAt (Point cPos) const |
Gets the MenuItem at a certain point. | |
Menu * | GetSubMenuAt (int nIndex) const |
Gets the SubMenu determined by the passing index number. | |
int | GetItemCount (void) const |
Returns the number of items in the Menu. | |
int | GetIndexOf (MenuItem *pcItem) const |
Returns the number of the MenuItem's position. | |
int | GetIndexOf (Menu *pcMenu) const |
Returns the number of the Menu's position. | |
MenuItem * | FindItem (int nCode) const |
Method that finds an item by a certain Message code. | |
MenuItem * | FindItem (const String &cName) const |
Method that finds an item by a certain name. | |
MenuItem * | FindMarked () const |
Gets the MenuItem that is Hightlighted. | |
virtual status_t | SetTargetForItems (Handler *pcTarget) |
Sets the object that the MenuItems will send messages to. | |
virtual status_t | SetTargetForItems (Messenger cMessenger) |
Sets the object that the MenuItems will send messages to. | |
Menu * | GetSuperMenu () const |
Gets the Menu that the Menu is attached to. | |
MenuItem * | GetSuperItem () |
Gets the MenuItem that the Menu is attached to. | |
void | InvalidateLayout () |
Refreshes the layout of the Menu. | |
void | SetCloseMessage (const Message &cMsg) |
Sets the message. | |
void | SetCloseMsgTarget (const Messenger &cTarget) |
Sets Target for Menu. | |
MenuItem * | Track (const Point &cScreenPos) |
Go to a certain MenuItem by screen position. | |
void | Open (Point cScrPos) |
Opens the Menu at a specific position. | |
void | SetEnable (bool) |
Tells the system to disable or enable this element. | |
bool | IsEnabled () |
Tells the programmer whether this element is enabled or disabled. | |
Friends | |
class | MenuItem |
Classes | |
class | Private |
Menu::Menu | ( | Rect | cFrame, | |
const String & | cTitle, | |||
MenuLayout_e | eLayout, | |||
uint32 | nResizeMask = CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP , |
|||
uint32 | nFlags = WID_WILL_DRAW | WID_CLEAR_BACKGROUND | WID_FULL_UPDATE_ON_RESIZE | |||
) |
cFrame | - The frame that holds the size of the Menu. | |
cTitle | - The label that will be displayed. | |
eLayout | - The layout of the Menu. OS::ITEMS_IN_ROW for displaying items horizontally and OS::ITEMS_IN_COLUMN for displaying items vertically. | |
nResizeMask | - The parameters of how you want the Menu to resize when resizing the Application it is attached to. Look at os::View for more documentatinon. | |
nFlags | - The view flags that will be passed to the Menu. |
Menu* pcMenu = new Menu(Rect(),"main_menu",os::ITEMS_IN_ROW, CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP ); //creates a menu and this menu would be attached to another menu(main menu) Menu* pcFileMenu = new Menu(Rect(),"File",os::ITEMS_IN_COLUMN,CF_FOLLOW_LEFT | CF_FOLLOW_RIGHT | CF_FOLLOW_TOP); pcFileMenu->AddItem("Open",new Message()); pcMenu->AddItem(pcFileMenu); //add the file menu to the main_menu //this code will create a new frame for the menu so that the Menu will fit the Application better Rect cMenuFrame; cMenuFrame.left = 0; cMenuFrame.top = 0; cMenuFrame.right = GetBounds().Width(); cMenuFrame.bottom = m_pcMenu->GetPreferredSize(true).y; pcMenu->SetFrame(cMenuFrame);
Menu::~Menu | ( | ) |
int Menu::Lock | ( | void | ) | const |
void Menu::Unlock | ( | void | ) | const |
void Menu::TimerTick | ( | int | nID | ) | [virtual] |
nID
parameter. \return |
Reimplemented from os::Handler.
void Menu::AttachedToWindow | ( | void | ) | [virtual] |
Reimplemented from os::View.
void Menu::DetachedFromWindow | ( | void | ) | [virtual] |
Reimplemented from os::View.
void Menu::WindowActivated | ( | bool | bIsActive | ) | [virtual] |
bIsActive | - true if the window gain and false if it loose focus. |
Reimplemented from os::View.
Point Menu::GetPreferredSize | ( | bool | bLargest | ) | const [virtual] |
void Menu::MouseDown | ( | const Point & | cPosition, | |
uint32 | nButtons | |||
) | [virtual] |
cPosition | Mouse position in the views coordinate system at the time the mouse was pressed. | |
nButtons | Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up. |
Reimplemented from os::View.
pcData
member will point to a Message containing the dragged data. Look at BeginDrag() for a more detailed description of the drag and drop system. cPosition | Mouse position in the views coordinate system at the time the mouse was pressed. | |
nButtons | Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up. | |
pcData | Pointer to a Message object containing the dragged data if this mouse-up was the end of a drag and drop operation. If no data was dragged it will be NULL. |
Reimplemented from os::View.
void Menu::MouseMove | ( | const Point & | cNewPos, | |
int | nCode, | |||
uint32 | nButtons, | |||
Message * | pcData | |||
) | [virtual] |
cNewPos | New mouse position given in the views coordinate system. | |
nCode | Enter/exit code. This is MOUSE_ENTERED when the mouse first enter the view, MOUSE_EXITED when the mouse leaves the view, MOUSE_INSIDE whenever the mouse move withing the boundary of the view and MOUSE_OUTSIDE when the mouse move outside the view (will only happen if the view has focus). | |
nButtons | Bitmask telling which buttons that are currently pressed. Bit 0 is button 1 (left), bit 1 is button 2 (right), and bit 2 is button 3 (middle), and so on. | |
pcData | Pointer to a Message object containing the dragged data if the user is in the middle of a drag and drop operation. Otherwise this pointer is NULL. Look at BeginDrag() for a more detailed description of the drag and drop system. |
Reimplemented from os::View.
void Menu::KeyDown | ( | const char * | pzString, | |
const char * | pzRawString, | |||
uint32 | nQualifiers | |||
) | [virtual] |
pzString | String containing a single UTF-8 encoded character. This is the character generated by the pressed key according to the current keymap accounting for any qualifiers that might be pressed. | |
pzRawString | Same as pzString except that the key is converted without accounting for qualifiers. Ie. if 'A' is pressed while pressing <SHIFT> pzString will contain 'A' and pzRawString will contain 'a'. | |
nQualifiers | Bitmask describing which qualifiers that was active when the key was pressed. |
Reimplemented from os::View.
void Menu::FrameSized | ( | const Point & | cDelta | ) | [virtual] |
cDelta
calue from the current size. cDelta | The distance the bottom/right corner was moved relative to the upper/left corner. |
Reimplemented from os::View.
void Menu::Paint | ( | const Rect & | cUpdateRect | ) | [virtual] |
cUpdateRect | A rectangle enclosing all damaged areas. This is just a rough "worst-case", further fine-grained clipping will be performed by the Application Server to avoid updating non-damaged pixels and make the update as fast and flicker-free as possible. |
Reimplemented from os::View.
String Menu::GetLabel | ( | ) | const |
..
void Menu::SetLabel | ( | const os::String & | cTitle | ) |
..
MenuLayout_e Menu::GetLayout | ( | ) | const |
bool Menu::AddItem | ( | const String & | cLabel, | |
Message * | pcMessage, | |||
const String & | cShortcut = "" , |
|||
Image * | pcImage = NULL | |||
) |
bool Menu::AddItem | ( | MenuItem * | pcItem | ) |
bool Menu::AddItem | ( | MenuItem * | pcItem, | |
int | nIndex | |||
) |
bool Menu::AddItem | ( | Menu * | pcMenu | ) |
pcMenu | - the SubMenu that will be added to the Menu. |
bool Menu::AddItem | ( | Menu * | pcMenu, | |
int | nIndex | |||
) |
pcMenu | - the SubMenu that will be added to the Menu. | |
nIndex | - the place where the MenuItem will be put. |
MenuItem * Menu::RemoveItem | ( | int | nIndex | ) |
bool Menu::RemoveItem | ( | MenuItem * | pcItem | ) |
bool Menu::RemoveItem | ( | Menu * | pcMenu | ) |
MenuItem * Menu::GetItemAt | ( | int | nIndex | ) | const |
Menu * Menu::GetSubMenuAt | ( | int | nIndex | ) | const |
nIndex | - The index number you want to get the SubMenu from |
int Menu::GetItemCount | ( | void | ) | const |
int Menu::GetIndexOf | ( | MenuItem * | pcItem | ) | const |
int Menu::GetIndexOf | ( | Menu * | pcMenu | ) | const |
pcMenu | - The Menu you want to get the index of. |
MenuItem * Menu::FindItem | ( | int | nCode | ) | const |
MenuItem * Menu::FindMarked | ( | ) | const |
status_t Menu::SetTargetForItems | ( | Handler * | pcTarget | ) | [virtual] |
status_t Menu::SetTargetForItems | ( | Messenger | cMessenger | ) | [virtual] |
Menu * Menu::GetSuperMenu | ( | ) | const |
MenuItem * Menu::GetSuperItem | ( | ) |
void Menu::InvalidateLayout | ( | ) |
void Menu::SetCloseMessage | ( | const Message & | cMsg | ) |
void Menu::SetCloseMsgTarget | ( | const Messenger & | cTarget | ) |
..
cScreenPos | - The screen position. |
void Menu::Open | ( | Point | cScrPos | ) |
void Menu::SetEnable | ( | bool | bEnabled | ) |
..
bEnabled | - To enable this element set this to true(default) and to disable set this to false. |
bool Menu::IsEnabled | ( | void | ) |
..
friend class MenuItem [friend] |