1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAcceleratorTable class
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
15 #pragma interface "accel.h"
19 #include "wx/object.h"
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 class wxAcceleratorEntry
;
27 class wxAcceleratorTable
;
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 extern wxAcceleratorTable wxNullAcceleratorTable
;
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
40 #define wxACCEL_ALT 0x01
43 #define wxACCEL_CTRL 0x02
45 // Hold Shift key down
46 #define wxACCEL_SHIFT 0x04
49 #define wxACCEL_NORMAL 0x00
51 //-----------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------
55 class wxAcceleratorEntry
: public wxObject
59 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
60 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
62 inline void Set(int flags
, int keyCode
, int cmd
)
63 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
65 inline int GetFlags() const { return m_flags
; }
66 inline int GetKeyCode() const { return m_keyCode
; }
67 inline int GetCommand() const { return m_command
; }
70 int m_keyCode
; // ASCII or virtual keycode
71 int m_command
; // Command id to generate
74 //-----------------------------------------------------------------------------
76 //-----------------------------------------------------------------------------
78 class wxAcceleratorTable
: public wxObject
80 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)
84 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[] );
85 ~wxAcceleratorTable();
87 inline wxAcceleratorTable(const wxAcceleratorTable
& accel
)
89 inline wxAcceleratorTable(const wxAcceleratorTable
* accel
)
90 { if (accel
) Ref(*accel
); }
91 inline wxAcceleratorTable
& operator = (const wxAcceleratorTable
& accel
)
92 { if (*this == accel
) return (*this); Ref(accel
); return *this; }
93 inline bool operator == (const wxAcceleratorTable
& accel
)
94 { return m_refData
== accel
.m_refData
; }
95 inline bool operator != (const wxAcceleratorTable
& accel
)
96 { return m_refData
!= accel
.m_refData
; }
102 int GetCommand( wxKeyEvent
&event
);