OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TPopupMenu Class Reference

TPopupMenu creates an empty pop-up menu to add to an existing window or pop-up menu. More...

#include <owl/menu.h>

Inheritance diagram for owl::TPopupMenu:
owl::TMenu

Public Member Functions

 TPopupMenu (TAutoDelete autoDelete=AutoDelete)
 Constructs an empty pop-up menu.
 
 TPopupMenu (HMENU handle, TAutoDelete autoDelete=NoAutoDelete)
 Creates a popup menu based on an existing popup menu.
 
 TPopupMenu (const TMenu &menu, TAutoDelete autoDelete=AutoDelete)
 Creates a popup menu from an existing menu.
 
int TrackPopupMenu (uint flags, int x, int y, int rsvd, HWND wnd, const TRect *rect=nullptr)
 Allows the application to create a pop-up menu at the specified location in the specified window.
 
int TrackPopupMenu (uint flags, const TPoint &point, int rsvd, HWND wnd, const TRect *rect=nullptr)
 TPoint-aware overload.
 
- Public Member Functions inherited from owl::TMenu
 TMenu (TAutoDelete autoDelete=AutoDelete)
 Creates an empty menu and sets autoDelete, by default, so that the menu is automatically deleted when the object is destroyed.
 
 TMenu (const TMenu &original, TAutoDelete autoDelete=AutoDelete)
 Creates a deep copy of an existing menu and sets autoDelete, by default, so that the menu is automatically deleted when the object is destroyed.
 
 TMenu (HMENU handle, TAutoDelete autoDelete=NoAutoDelete)
 Creates a menu object from an already loaded menu and sets autoDelete, by default, so the menu is not automatically deleted when the object is destroyed.
 
 TMenu (HWND hWnd, TAutoDelete autoDelete=NoAutoDelete)
 Creates a menu object representing the window's current menu and sets autoDelete, by default, so that the menu is not automatically deleted when the object is destroyed.
 
 TMenu (const void *menuTemplate)
 Creates a menu object from a menu template in memory.
 
 TMenu (HINSTANCE instance, TResId resId)
 Creates a menu object from a specified resource ID.
 
virtual ~TMenu ()
 
TMenuoperator= (const TMenu &)
 Copies an existing menu onto this menu, using DeepCopy.
 
void CheckValid (uint redId=IDS_MENUFAILURE)
 Throws a TXMenu exception if the menu object is invalid.
 
virtual HMENU GetHandle () const
 Returns the handle to the menu.
 
 operator TMenuItem () const
 Returns the menu's handle.
 
 operator HMENU () const
 Returns the menu's handle.
 
bool IsOK () const
 Returns true if the menu has a valid handle.
 
bool AppendMenu (uint flags, TMenuItem newItem=static_cast< unsigned int >(-1), LPCTSTR newStr=nullptr)
 Adds a text menu item to the end of the menu.
 
bool AppendMenu (uint flags, TMenuItem newItem, const tstring &newStr)
 
bool AppendMenu (uint flags, TMenuItem newitem, const TBitmap &newBmp)
 Adds a bitmap menu item at the end of the menu.
 
bool CheckMenuItem (uint item, uint check)
 Checks or unchecks the menu item.
 
bool DeleteMenu (uint item, uint flags)
 Removes the menu item (item) from the menu or deletes the menu item if it's a pop-up menu.
 
bool EnableMenuItem (uint item, uint enable)
 Enables, disables, or grays the menu item specified in the item parameter.
 
uint GetMenuItemCount () const
 Returns the number of items in a top-level or pop-up menu.
 
uint GetMenuItemID (int posItem) const
 Returns the ID of the menu item at the position specified by posItem.
 
uint GetMenuState (uint item, uint flags) const
 Returns the menu flags for the menu item specified by item.
 
int GetMenuString (uint item, TCHAR *str, int count, uint flags) const
 Returns the label (str) of the menu item (item).
 
tstring GetMenuString (uint item, uint flags) const
 String-aware overload.
 
HMENU GetSubMenu (int posItem) const
 Returns the handle of the menu specified by posItem.
 
bool InsertMenu (uint item, uint flags, TMenuItem newItem=-1, LPCTSTR newStr=nullptr)
 Inserts a new text menu item or pop-up menu into the menu after the menu item specified in item.
 
bool InsertMenu (uint item, uint flags, TMenuItem newItem, const tstring &newStr)
 
bool InsertMenu (uint item, uint flags, TMenuItem newItem, const TBitmap &newBmp)
 Adds a bitmap menu item after the menu item specified in item.
 
bool ModifyMenu (uint item, uint flags, TMenuItem newItem=-1, LPCTSTR newStr=nullptr)
 Changes an existing menu item from the item specified in item to newItem.
 
bool ModifyMenu (uint item, uint flags, TMenuItem newItem, const tstring &newStr)
 
bool ModifyMenu (uint item, uint flags, TMenuItem newItem, const TBitmap &newBmp)
 Changes an existing menu item into a bitmap.
 
bool RemoveMenu (uint item, uint flags)
 Removes the menu item from the menu but does not delete it if it is a submenu.
 
bool SetMenuItemBitmaps (uint item, uint flags, const TBitmap *bmpUnchecked=nullptr, const TBitmap *bmpChecked=nullptr)
 Specifies the bitmap to be displayed when the menu item is checked and unchecked.
 
uint GetDefaultItem (bool getPos, uint flags) const
 
bool SetDefaultItem (uint posOrId, bool isPos)
 
bool CheckRadioItem (uint first, uint last, uint check, uint flags)
 
bool GetMenuItemInfo (uint posOrId, bool isPos, TMenuItemInfo &mi) const
 
bool SetMenuItemInfo (uint posOrId, bool isPos, TMenuItemInfo &mi)
 
bool InsertMenuItem (uint posOrId, bool isPos, TMenuItemInfo &mi)
 
virtual void MeasureItem (MEASUREITEMSTRUCT &measureItem)
 MeasureItem is used by owner-drawn controls to store the dimensions of the specified item.
 
virtual void DrawItem (DRAWITEMSTRUCT &drawItem)
 DrawItem responds to a message forwarded to a drawable control by TWindow when the control needs to be drawn.
 

Additional Inherited Members

- Static Public Member Functions inherited from owl::TMenu
static bool GetMenuCheckMarkDimensions (TSize &size)
 Gets the size of the bitmap used to display the default check mark on checked menu items.
 
static TSize GetMenuCheckMarkDimensions ()
 Return the dimensions of the check mark bitmaps.
 
- Static Protected Member Functions inherited from owl::TMenu
static void DeepCopy (TMenu &dst, const TMenu &src, int srcOffset=0, int itemCount=-1)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static void DeepCopy (TMenu &dst, int dstOffset, const TMenu &src, int srcOffset=0, int itemCount=-1)
 Copies menu items from the src menu to the dst menu.
 

Detailed Description

TPopupMenu creates an empty pop-up menu to add to an existing window or pop-up menu.

Definition at line 189 of file menu.h.

Constructor & Destructor Documentation

◆ TPopupMenu() [1/3]

owl::TPopupMenu::TPopupMenu ( TAutoDelete autoDelete = AutoDelete)

Constructs an empty pop-up menu.

Definition at line 419 of file menu.cpp.

◆ TPopupMenu() [2/3]

owl::TPopupMenu::TPopupMenu ( HMENU handle,
TAutoDelete autoDelete = NoAutoDelete )

Creates a popup menu based on an existing popup menu.

Definition at line 428 of file menu.cpp.

◆ TPopupMenu() [3/3]

owl::TPopupMenu::TPopupMenu ( const TMenu & menu,
TAutoDelete autoDelete = AutoDelete )

Creates a popup menu from an existing menu.

Definition at line 437 of file menu.cpp.

References owl::TMenu::DeepCopy().

Member Function Documentation

◆ TrackPopupMenu() [1/2]

int owl::TPopupMenu::TrackPopupMenu ( uint flags,
const TPoint & point,
int rsvd,
HWND wnd,
const TRect * rect = nullptr )
inline

TPoint-aware overload.

Definition at line 571 of file menu.h.

References owl::TMenu::GetHandle(), and PRECONDITION.

◆ TrackPopupMenu() [2/2]

int owl::TPopupMenu::TrackPopupMenu ( uint flags,
int x,
int y,
int rsvd,
HWND wnd,
const TRect * rect = nullptr )
inline

Allows the application to create a pop-up menu at the specified location in the specified window.

flags specifies a screen position and can be one of the TPM_xxxx values (TPM_CENTERALIGN, TPM_LEFTALIGN, TPM_RIGHTALIGN, TPM_LEFTBUTTON, or TPM_RIGHTBUTTON). wnd is the handle to the window that receives messages about the menu. x specifies the horizontal position in screen coordinates of the left side of the menu. y species the vertical position in screen coordinates of the top of the menu (for example, 0,0 specifies that a menu's left corner is in the top left corner of the screen). rect defines the area that the user can click without dismissing the menu.

If you specify TPM_RETURNCMD in the flags parameter, the return value is the menu-item identifier of the item that the user selected. If the user cancels the menu without making a selection, or if an error occurs, then the return value is zero.

If you do not specify TPM_RETURNCMD in the flags parameter, the return value is nonzero if the function succeeds and zero if it fails. To get extended error information, call GetLastError.

Definition at line 561 of file menu.h.

References owl::TMenu::GetHandle(), and PRECONDITION.


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