Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

os::Menu Class Reference

#include <menu.h>

Inheritance diagram for os::Menu::

os::View os::Handler List of all members.

Public Methods

 Menu (Rect cFrame, const char *pzName, 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)
 ~Menu ()
int Lock (void) const
void Unlock (void) const
virtual void TimerTick (int nID)
 Timer dispatch member. More...

void AttachedToWindow (void)
void DetachedFromWindow (void)
void WindowActivated (bool bIsActive)
 Hook called when the window hosting this view gain or loose focus. More...

Point GetPreferredSize (bool bLargest) const
virtual void MouseDown (const Point &cPosition, uint32 nButtons)
 Hook called by the system when a mouse button is pressed. More...

virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
 Hook called by the system when a mouse button is release. More...

virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
 Hook called by the system when the mouse is moved. More...

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. More...

virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized. More...

virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view. More...

std::string GetLabel () const
MenuLayout_e GetLayout () const
bool AddItem (const char *pzLabel, Message *pcMessage)
bool AddItem (MenuItem *pcItem)
bool AddItem (MenuItem *pcItem, int nIndex)
bool AddItem (Menu *pcItem)
bool AddItem (Menu *pcItem, int nIndex)
MenuItemRemoveItem (int nIndex)
bool RemoveItem (MenuItem *pcItem)
bool RemoveItem (Menu *pcMenu)
MenuItemGetItemAt (int nIndex) const
MenuItemGetItemAt (Point cPos) const
Menu * GetSubMenuAt (int nIndex) const
int GetItemCount (void) const
int GetIndexOf (MenuItem *pcItem) const
int GetIndexOf (Menu *pcMenu) const
MenuItemFindItem (int nCode) const
MenuItemFindItem (const char *pzName) const
virtual status_t SetTargetForItems (Handler *pcTarget)
virtual status_t SetTargetForItems (Messenger cMessenger)
MenuItemFindMarked () const
Menu * GetSuperMenu () const
MenuItemGetSuperItem ()
void InvalidateLayout ()
void SetCloseMessage (const Message &cMsg)
void SetCloseMsgTarget (const Messenger &cTarget)
MenuItemTrack (const Point &cScreenPos)
void Open (Point cScrPos)

Friends

class MenuItem

Detailed Description

Description:
See also:
Author:
Kurt Skauen (kurt@atheos.cx)


Constructor & Destructor Documentation

Menu::Menu Rect cFrame,
const char * pzTitle,
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
 

Menu::~Menu
 


Member Function Documentation

bool Menu::AddItem Menu * pcMenu,
int nIndex
 

bool Menu::AddItem Menu * pcMenu
 

bool Menu::AddItem MenuItem * pcItem,
int nIndex
 

bool Menu::AddItem MenuItem * pcItem
 

bool Menu::AddItem const char * pzLabel,
Message * pcMessage
 

void Menu::AttachedToWindow void [virtual]
 

Reimplemented from os::View.

void Menu::DetachedFromWindow void [virtual]
 

Reimplemented from os::View.

MenuItem * Menu::FindItem const char * pzName const
 

MenuItem * Menu::FindItem int nCode const
 

MenuItem * Menu::FindMarked const
 

void Menu::FrameSized const Point & cDelta [virtual]
 

Description:
Overload this member if you need to know when the view is resized.
Note:
This member is called after the view is resized. If you need the old size you can subtract the cDelta calue from the current size.
Parameters:
cDelta   The distance the bottom/right corner was moved relative to the upper/left corner.
See also:
FrameMoved(), SetFrame, ResizeBy(), ResizeTo()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

int Menu::GetIndexOf Menu * pcMenu const
 

int Menu::GetIndexOf MenuItem * pcItem const
 

MenuItem * Menu::GetItemAt Point cPosition const
 

MenuItem * Menu::GetItemAt int nIndex const
 

int Menu::GetItemCount void const
 

std::string Menu::GetLabel const
 

MenuLayout_e Menu::GetLayout const
 

Point Menu::GetPreferredSize bool bLargest const [virtual]
 

Reimplemented from os::View.

Menu * Menu::GetSubMenuAt int nIndex const
 

MenuItem * Menu::GetSuperItem
 

Menu * Menu::GetSuperMenu const
 

void Menu::InvalidateLayout
 

void Menu::KeyDown const char * pzString,
const char * pzRawString,
uint32 nQualifiers
[virtual]
 

Description:
Overload this member if your view need to handle keyboard input. This member is called to allow the view to handle M_KEY_DOWN messages. The most common members are exctracted from the message and passed as parameters but you might need to obtain the raw message with os::Looper::GetCurrentMessage() and find some members yourself if you the data you needed are not passed in.

For example if you need the raw key-code for the pressed key you will have to lookup the "_raw_key" member from the message.

Parameters:
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.

See also:
KeyUp(), os::Looper::GetCurrentMessage()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

int Menu::Lock void const
 

void Menu::MouseDown const Point & cPosition,
uint32 nButtons
[virtual]
 

Description:
This member is called from the window thread whenever a mouse button is clicked above the view. You can overload this member if your view need to know about mouse-down events.

A view will not automatically take focus when clicked so if you want that behaviour you must call MakeFocus() from an overloaded version of this member.

The default implementation of this member will call MouseDown() on it's parent view if one exists.

Parameters:
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.

See also:
MouseUp(), MouseMove(), WheelMoved()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

void Menu::MouseMove const Point & cPosition,
int nCode,
uint32 nButtons,
Message * pcData
[virtual]
 

Description:
This member is called from the window thread whenever the mouse is moved above the view or if the view have focus.

Oveload this member if your view need to handle mouse-move events.

The default implementation of this member will call MouseMove() on it's parent view if one exists.

Parameters:
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 have 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.

See also:
MouseDown(), MouseUp(), WheelMoved(), BeginDrag()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

void Menu::MouseUp const Point & cPosition,
uint32 nButtons,
Message * pcData
[virtual]
 

Description:
This member is called from the window thread whenever a mouse button is released above the view. You can overload this member if your view need to know about mouse-up events or if your view support drag and drop.

If mouse-up was the result of ending a drag and drop operation the 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.

The default implementation of this member will call MouseDown() on it's parent view if one exists.

Parameters:
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.

See also:
MouseDown(), MouseMove(), WheelMoved()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

void Menu::Open Point cScrPos
 

void Menu::Paint const Rect & cUpdateRect [virtual]
 

Description:
Note:
Warning:
Parameters:
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.

See also:
Invalidate(), Flush()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.

bool Menu::RemoveItem Menu * pcMenu
 

bool Menu::RemoveItem MenuItem * pcItem
 

MenuItem * Menu::RemoveItem int nIndex
 

void Menu::SetCloseMessage const Message & cMsg
 

void Menu::SetCloseMsgTarget const Messenger & cTarget
 

status_t Menu::SetTargetForItems Messenger cMessenger [virtual]
 

status_t Menu::SetTargetForItems Handler * pcTarget [virtual]
 

void Menu::TimerTick int nID [virtual]
 

Description:
This member will be called by the looper thread when a timer targeting this handler expires.

When a timer created with os::Looper::AddTimer() expires the looper thread will lock the looper and call this member on the target for the expired timer. If more than one timers are created it is possible to distinguish them by the timer ID that is assigned to the timer with os::Looper::AddTimer() and that is passed to TimerTick() through the nID parameter.

Note:
Never do any lenthy operations in any hook members that are called from the looper thread if the looper is involved with the GUI (for example if the looper is a os::Window). The looper will not be able to dispatch messages until the hook returns so spending a long time in this members will make the GUI feel unresponsive.
Warning:
Parameters:
return  
Error codes:
See also:
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::Handler.

MenuItem * Menu::Track const Point & cScreenPos
 

void Menu::Unlock void const
 

void Menu::WindowActivated bool bIsActive [virtual]
 

Description:
This is a callback member that can be overloaded by derived classes to learn when the window that this view is hosted by is activated and when it is deactivated. The bIsActive parameter tell whether the focus was lost or gained. This member is called whenever the window changes focus independent of whether the view is active or not.
Note:
This is a hook function that is called by the system to notify about an event. You should never call this member yourself.

The window is locked when this member is called.
Parameters:
bIsActive   - true if the window gain and false if it loose focus.
See also:
MakeFocus(), Activated()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented from os::View.


Friends And Related Function Documentation

friend class MenuItem [friend]
 


Generated at Tue Sep 11 15:27:50 2001 for AtheOS higlevel API by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001