1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAcceleratorTable class
4 // Author: Robert Roebling
6 // Copyright: (c) Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
14 #pragma interface "accel.h"
21 #include "wx/object.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
28 class wxAcceleratorEntry
;
29 class wxAcceleratorTable
;
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 extern wxAcceleratorTable wxNullAcceleratorTable
;
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
42 #define wxACCEL_ALT 0x01
45 #define wxACCEL_CTRL 0x02
47 // Hold Shift key down
48 #define wxACCEL_SHIFT 0x04
51 #define wxACCEL_NORMAL 0x00
53 //-----------------------------------------------------------------------------
55 //-----------------------------------------------------------------------------
57 class wxAcceleratorEntry
: public wxObject
61 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
62 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
64 inline void Set(int flags
, int keyCode
, int cmd
)
65 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
67 inline int GetFlags() const { return m_flags
; }
68 inline int GetKeyCode() const { return m_keyCode
; }
69 inline int GetCommand() const { return m_command
; }
72 int m_keyCode
; // ASCII or virtual keycode
73 int m_command
; // Command id to generate
76 //-----------------------------------------------------------------------------
78 //-----------------------------------------------------------------------------
80 class wxAcceleratorTable
: public wxObject
82 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)
86 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[] );
87 ~wxAcceleratorTable();
89 inline wxAcceleratorTable(const wxAcceleratorTable
& accel
) : wxObject()
91 inline wxAcceleratorTable(const wxAcceleratorTable
* accel
)
92 { if (accel
) Ref(*accel
); }
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
; }
97 inline wxAcceleratorTable
& operator = (const wxAcceleratorTable
& accel
)
98 { if (*this == accel
) return (*this); Ref(accel
); return *this; }
104 int GetCommand( wxKeyEvent
&event
);