1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAcceleratorTable class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "accel.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
23 class WXDLLEXPORT wxAcceleratorTable
;
26 #define wxACCEL_ALT 0x01
29 #define wxACCEL_CTRL 0x02
31 // Hold Shift key down
32 #define wxACCEL_SHIFT 0x04
35 #define wxACCEL_NORMAL 0x00
37 class WXDLLEXPORT wxAcceleratorEntry
40 wxAcceleratorEntry(const wxAcceleratorEntry
& entry
)
42 m_flags
= entry
.m_flags
; m_keyCode
= entry
.m_keyCode
; m_command
= entry
.m_command
;
44 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
46 m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
;
49 inline void Set(int flags
, int keyCode
, int cmd
)
50 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
52 inline int GetFlags() const { return m_flags
; }
53 inline int GetKeyCode() const { return m_keyCode
; }
54 inline int GetCommand() const { return m_command
; }
56 void operator = (const wxAcceleratorEntry
& entry
)
58 m_flags
= entry
.m_flags
; m_keyCode
= entry
.m_keyCode
; m_command
= entry
.m_command
;
61 // Implementation use only
62 bool MatchesEvent(const wxKeyEvent
& event
) const;
66 int m_keyCode
; // ASCII or virtual keycode
67 int m_command
; // Command id to generate
70 class WXDLLEXPORT wxAcceleratorTable
: public wxObject
72 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)
75 wxAcceleratorTable(const wxString
& resource
); // Load from .rc resource
76 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[]); // Load from array
79 inline wxAcceleratorTable(const wxAcceleratorTable
& accel
) { Ref(accel
); }
80 inline wxAcceleratorTable(const wxAcceleratorTable
* accel
) { if (accel
) Ref(*accel
); }
82 ~wxAcceleratorTable();
84 inline wxAcceleratorTable
& operator = (const wxAcceleratorTable
& accel
) { if (*this == accel
) return (*this); Ref(accel
); return *this; }
85 inline bool operator == (const wxAcceleratorTable
& accel
) { return m_refData
== accel
.m_refData
; }
86 inline bool operator != (const wxAcceleratorTable
& accel
) { return m_refData
!= accel
.m_refData
; }
90 // Implementation only
92 wxAcceleratorEntry
* GetEntries() const;
95 WXDLLEXPORT_DATA(extern wxAcceleratorTable
) wxNullAcceleratorTable
;