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
60 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
61 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
63 inline void Set(int flags
, int keyCode
, int cmd
)
64 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
66 inline int GetFlags() const { return m_flags
; }
67 inline int GetKeyCode() const { return m_keyCode
; }
68 inline int GetCommand() const { return m_command
; }
71 int m_keyCode
; // ASCII or virtual keycode
72 int m_command
; // Command id to generate
75 //-----------------------------------------------------------------------------
77 //-----------------------------------------------------------------------------
79 class wxAcceleratorTable
: public wxObject
83 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[] );
84 ~wxAcceleratorTable();
86 inline wxAcceleratorTable(const wxAcceleratorTable
& accel
) : wxObject()
88 inline wxAcceleratorTable(const wxAcceleratorTable
* accel
)
89 { if (accel
) Ref(*accel
); }
90 inline bool operator == (const wxAcceleratorTable
& accel
)
91 { return m_refData
== accel
.m_refData
; }
92 inline bool operator != (const wxAcceleratorTable
& accel
)
93 { return m_refData
!= accel
.m_refData
; }
94 inline wxAcceleratorTable
& operator = (const wxAcceleratorTable
& accel
)
95 { if (*this == accel
) return (*this); Ref(accel
); return *this; }
102 int GetCommand( wxKeyEvent
&event
);
105 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)