karm

tdeaccelmenuwatch.h
1 /*
2 * tdeaccelmenuwatch.h -- Declaration of class TDEAccelMenuWatch.
3 * Generated by newclass on Thu Jan 7 15:05:26 EST 1999.
4 */
5 #ifndef KARM_TDE_ACCEL_MENU_WATCH_H
6 #define KARM_TDE_ACCEL_MENU_WATCH_H
7 
8 #include <tqobject.h>
9 #include <tqptrlist.h>
10 
11 #include <tdeaccel.h>
12 
13 class TQPopupMenu;
14 
35 class TDEAccelMenuWatch : public TQObject
36 {
37  TQ_OBJECT
38 
39 
40  private:
41  enum AccelType { StdAccel, StringAccel };
42 
43  typedef struct AccelItem {
44  TQPopupMenu *menu;
45  int itemId;
46 
47  AccelType type;
48 
49  // only one of these is used at a time
50  TQString action;
51  TDEStdAccel::StdAccel stdAction;
52  } AccelItem;
53 
54  TDEAccel *_accel;
55  TQPtrList<AccelItem> _accList;
56  TQPtrList<TQPopupMenu> _menuList;
57 
58  TQPopupMenu *_menu;
59 
60  TDEAccelMenuWatch::AccelItem *newAccelItem( TQPopupMenu *menu,
61  int itemId, AccelType type );
62 
63  public:
67  TDEAccelMenuWatch( TDEAccel *accel, TQObject *parent = 0 );
68 
72  virtual ~TDEAccelMenuWatch() {}
73 
80  void setMenu( TQPopupMenu *menu );
81 
86  TQPopupMenu *currentMenu() const { return _menu; }
87 
92  void connectAccel( int itemId, const char *action );
93 
97  void connectAccel( int itemId, TDEStdAccel::StdAccel );
98 
99  public slots:
104  void updateMenus();
105 
106  private slots:
107  void removeDeadMenu();
108 
109  private:
110  TDEAccelMenuWatch& operator=( const TDEAccelMenuWatch& );
112 };
113 
114 #endif // KARM_K_ACCEL_MENU_WATCH_H
Easy updating of menu accels when changing a TDEAccel object.
void connectAccel(int itemId, const char *action)
Connect the menu item identified to currentMenu()/id to the accelerator action.
TDEAccelMenuWatch(TDEAccel *accel, TQObject *parent=0)
TDEAccelMenuWatch Constructor.
void setMenu(TQPopupMenu *menu)
Set the menu on which connectAccel calls will operate.
void updateMenus()
Updates all menu accelerators.
TQPopupMenu * currentMenu() const
Return the last menu set with TDEAccelMenuWatch::setMenu(TQPopupMenu*), or 0 if none has been set.
virtual ~TDEAccelMenuWatch()
TDEAccelMenuWatch Destructor.