1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAcceleratorEntry and wxAcceleratorTable classes
4 // Author: Julian Smart, Robert Roebling, Vadim Zeitlin
6 // Created: 31.05.01 (extracted from other files)
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_ACCEL_H_BASE_
13 #define _WX_ACCEL_H_BASE_
19 #include "wx/object.h"
21 class WXDLLEXPORT wxAcceleratorTable
;
22 class WXDLLEXPORT wxMenuItem
;
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 // wxAcceleratorEntry flags
31 wxACCEL_NORMAL
= 0x0000, // no modifiers
32 wxACCEL_ALT
= 0x0001, // hold Alt key down
33 wxACCEL_CTRL
= 0x0002, // hold Ctrl key down
34 wxACCEL_SHIFT
= 0x0004 // hold Shift key down
37 // ----------------------------------------------------------------------------
38 // an entry in wxAcceleratorTable corresponds to one accelerator
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxAcceleratorEntry
44 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0,
45 wxMenuItem
*item
= NULL
)
47 Set(flags
, keyCode
, cmd
, item
);
50 void Set(int flags
, int keyCode
, int cmd
, wxMenuItem
*item
= NULL
)
58 void SetMenuItem(wxMenuItem
*item
) { m_item
= item
; }
60 int GetFlags() const { return m_flags
; }
61 int GetKeyCode() const { return m_keyCode
; }
62 int GetCommand() const { return m_command
; }
64 wxMenuItem
*GetMenuItem() const { return m_item
; }
66 bool operator==(const wxAcceleratorEntry
& entry
) const
68 return m_flags
== entry
.m_flags
&&
69 m_keyCode
== entry
.m_keyCode
&&
70 m_command
== entry
.m_command
&&
71 m_item
== entry
.m_item
;
74 bool operator!=(const wxAcceleratorEntry
& entry
) const
75 { return !(*this == entry
); }
78 int m_flags
; // combination of wxACCEL_XXX constants
79 int m_keyCode
; // ASCII or virtual keycode
80 int m_command
; // Command id to generate
82 // the menu item this entry corresponds to, may be NULL
85 // for compatibility with old code, use accessors now!
86 friend class WXDLLEXPORT wxMenu
;
89 // ----------------------------------------------------------------------------
90 // include wxAcceleratorTable class declaration, it is only used by the library
91 // and so doesn't have any published user visible interface
92 // ----------------------------------------------------------------------------
94 #if defined(__WXUNIVERSAL__)
95 #include "wx/generic/accel.h"
96 #elif defined(__WXMSW__)
97 #include "wx/msw/accel.h"
98 #elif defined(__WXMOTIF__)
99 #include "wx/motif/accel.h"
100 #elif defined(__WXGTK__)
101 #include "wx/gtk/accel.h"
102 #elif defined(__WXQT__)
103 #include "wx/qt/accel.h"
104 #elif defined(__WXMAC__)
105 #include "wx/mac/accel.h"
106 #elif defined(__WXPM__)
107 #include "wx/os2/accel.h"
108 #elif defined(__WXSTUBS__)
109 #include "wx/stubs/accel.h"
112 WXDLLEXPORT_DATA(extern wxAcceleratorTable
) wxNullAcceleratorTable
;
114 #endif // wxUSE_ACCEL