karm

TDEAccelMenuWatch Class Reference

#include <tdeaccelmenuwatch.h>

Inherits TQObject.

Public Slots

void updateMenus ()
 

Public Member Functions

 TDEAccelMenuWatch (TDEAccel *accel, TQObject *parent=0)
 
virtual ~TDEAccelMenuWatch ()
 
void setMenu (TQPopupMenu *menu)
 
TQPopupMenu * currentMenu () const
 
void connectAccel (int itemId, const char *action)
 
void connectAccel (int itemId, TDEStdAccel::StdAccel)
 

Detailed Description

Easy updating of menu accels when changing a TDEAccel object.

Since a TDEAccel object does not keep track of menu items to which it is connected, we normally have to manually call TDEAccel::changeMenuAccel() again for each update of the TDEAccel object.

With TDEAccelMenuWatch you provide the tdeaccel object and the menu items to which it connects, and if you update the tdeaccel you just have to call TDEAccelMenuWatch::updateMenus() and the menu items will be updated.

It is safe to delete menus that have connections handled by this class. On deletion of a menu, all associated accelerators will be deleted.

Note that you have to call TDEAccelMenuWatch::updateMenus() after you connect the * accelerators, as they are not activated till then.

Author
Sirtaj Singh Kang (taj@k.nosp@m.de.o.nosp@m.rg)

Definition at line 35 of file tdeaccelmenuwatch.h.

Constructor & Destructor Documentation

◆ TDEAccelMenuWatch()

TDEAccelMenuWatch::TDEAccelMenuWatch ( TDEAccel *  accel,
TQObject *  parent = 0 
)

TDEAccelMenuWatch Constructor.

Definition at line 12 of file tdeaccelmenuwatch.cpp.

◆ ~TDEAccelMenuWatch()

virtual TDEAccelMenuWatch::~TDEAccelMenuWatch ( )
inlinevirtual

TDEAccelMenuWatch Destructor.

Definition at line 72 of file tdeaccelmenuwatch.h.

Member Function Documentation

◆ connectAccel() [1/2]

void TDEAccelMenuWatch::connectAccel ( int  itemId,
const char *  action 
)

Connect the menu item identified to currentMenu()/id to the accelerator action.

Definition at line 36 of file tdeaccelmenuwatch.cpp.

◆ connectAccel() [2/2]

void TDEAccelMenuWatch::connectAccel ( int  itemId,
TDEStdAccel::StdAccel  accel 
)

Same as above, but connects to standard accelerators.

Definition at line 42 of file tdeaccelmenuwatch.cpp.

◆ currentMenu()

TQPopupMenu* TDEAccelMenuWatch::currentMenu ( ) const
inline

Return the last menu set with TDEAccelMenuWatch::setMenu(TQPopupMenu*), or 0 if none has been set.

Definition at line 86 of file tdeaccelmenuwatch.h.

◆ setMenu()

void TDEAccelMenuWatch::setMenu ( TQPopupMenu *  menu)

Set the menu on which connectAccel calls will operate.

All subsequent calls to connectAccel will be associated with this menu. You can call this function any number of times, so multiple menus can be handled.

Definition at line 21 of file tdeaccelmenuwatch.cpp.

◆ updateMenus

void TDEAccelMenuWatch::updateMenus ( )
slot

Updates all menu accelerators.

Call this after all accelerators have been connected or the tdeaccel object has been updated.

Definition at line 48 of file tdeaccelmenuwatch.cpp.


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