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

Derived from TCommandEnabler, TMenuItemEnabler is a command enabler for menu items. More...

#include <owl/framewin.h>

Inheritance diagram for owl::TMenuItemEnabler:
owl::TCommandEnabler

Public Member Functions

 TMenuItemEnabler (HMENU hMenu, uint id, HWND hWndReceiver, int position)
 Constructs a TMenuItemEnabler with the specified command ID for the menu item, message responder (hWndReceiver), and position on the menu.
 
void Enable (bool enable)
 Overrides TCommandEnable::Enable.
 
void SetText (LPCTSTR text)
 Overrides TCommandEnable::SetText. Changes the text of the corresponding menu.
 
void SetCheck (int check)
 < String-aware overload
 
HMENU GetMenu ()
 Returns the menu that holds the item being enabled or disabled.
 
int GetPosition ()
 Returns the position of the menu item.
 
virtual void SetText (LPCTSTR text)=0
 Changes the text associated with a command sender; for example, text associated with a menu item or text on a button.
 
void SetText (const tstring &s)
 
- Public Member Functions inherited from owl::TCommandEnabler
 TCommandEnabler (uint id, HWND hWndReceiver=0)
 Constructs the TCommandEnabler object with the specified command ID.
 
uint GetId () const
 Retrieves the id of the command.
 
void SetText (const tstring &s)
 
void SetCheck (bool isChecked)
 Overload; allows you to pass a bool safely.
 
bool SendsCommand () const
 Returns true if this command enabler sends a command message.
 
bool GetHandled ()
 Return true if the command enabler has been handled.
 
bool IsReceiver (HWND hReceiver)
 Returns true if receiver is the same as the message responder originally set up in the constructor.
 
HWND GetReceiver () const
 Returns the handle of the window that this enabler was destined for.
 
void SetReceiver (HWND hReceiver)
 Sets the receiver for the enabler.
 

Additional Inherited Members

- Public Types inherited from owl::TCommandEnabler
enum  TCommandState { Unchecked , Checked , Indeterminate }
 Enumeration describing the 3-states or availability of a command. More...
 
- Protected Types inherited from owl::TCommandEnabler
enum  TCommandStatus { WasHandled = 1 , NonSender = 2 }
 Enumeration describing whether the associated command has been enabled or disabled, and whether the command generates WM_COMMAND messages. More...
 
- Protected Member Functions inherited from owl::TCommandEnabler
void SetHandled ()
 Marks that the enabler has been handled.
 
- Protected Attributes inherited from owl::TCommandEnabler
uint Flags
 TCommandStatus flags Is TCommandStatus::WasHandled if the command enabler has been handled.
 
 DECLARE_CASTABLE
 

Detailed Description

Derived from TCommandEnabler, TMenuItemEnabler is a command enabler for menu items.

The functions in this class modify the text, check state, and appearance of a menu item.

Definition at line 39 of file framewin.h.

Constructor & Destructor Documentation

◆ TMenuItemEnabler()

owl::TMenuItemEnabler::TMenuItemEnabler ( HMENU hMenu,
uint id,
HWND hWndReceiver,
int position )
inline

Constructs a TMenuItemEnabler with the specified command ID for the menu item, message responder (hWndReceiver), and position on the menu.

Definition at line 266 of file framewin.h.

References owl::TCommandEnabler::Flags, and owl::TCommandEnabler::NonSender.

Member Function Documentation

◆ Enable()

void owl::TMenuItemEnabler::Enable ( bool enable)
virtual

Overrides TCommandEnable::Enable.

Enables or disables the menu options that control the appearance of the corresponding menu item.

Reimplemented from owl::TCommandEnabler.

Definition at line 48 of file framewin.cpp.

References owl::TCommandEnabler::Enable().

◆ GetMenu()

HMENU owl::TMenuItemEnabler::GetMenu ( )
inline

Returns the menu that holds the item being enabled or disabled.

Definition at line 280 of file framewin.h.

◆ GetPosition()

int owl::TMenuItemEnabler::GetPosition ( )
inline

Returns the position of the menu item.

Definition at line 288 of file framewin.h.

◆ SetCheck()

void owl::TMenuItemEnabler::SetCheck ( int state)
virtual

< String-aware overload

Overrides TCommandEnable::SetCheck.

Checks or unchecks the corresponding menu item. The state parameter reflects the menu item's state, which can be checked, unchecked, or indeterminate.

Implements owl::TCommandEnabler.

Definition at line 70 of file framewin.cpp.

References owl::TCommandEnabler::Checked.

◆ SetText() [1/3]

void owl::TCommandEnabler::SetText ( const tstring & s)
inline

Definition at line 220 of file window.h.

◆ SetText() [2/3]

void owl::TMenuItemEnabler::SetText ( LPCTSTR text)
virtual

Overrides TCommandEnable::SetText. Changes the text of the corresponding menu.

Implements owl::TCommandEnabler.

Definition at line 59 of file framewin.cpp.

◆ SetText() [3/3]

virtual void owl::TCommandEnabler::SetText ( LPCTSTR text)
virtual

Changes the text associated with a command sender; for example, text associated with a menu item or text on a button.

Implements owl::TCommandEnabler.


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