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
;
27 #define wxACCEL_ALT 0x01
30 #define wxACCEL_CTRL 0x02
32 // Hold Shift key down
33 #define wxACCEL_SHIFT 0x04
36 #define wxACCEL_NORMAL 0x00
38 class WXDLLEXPORT wxAcceleratorEntry
41 wxAcceleratorEntry(const wxAcceleratorEntry
& entry
)
43 m_flags
= entry
.m_flags
; m_keyCode
= entry
.m_keyCode
; m_command
= entry
.m_command
;
45 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
47 m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
;
50 void Set(int flags
, int keyCode
, int cmd
)
51 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
53 int GetFlags() const { return m_flags
; }
54 int GetKeyCode() const { return m_keyCode
; }
55 int GetCommand() const { return m_command
; }
57 void operator = (const wxAcceleratorEntry
& entry
)
59 m_flags
= entry
.m_flags
; m_keyCode
= entry
.m_keyCode
; m_command
= entry
.m_command
;
62 // Implementation use only
63 bool MatchesEvent(const wxKeyEvent
& event
) const;
67 int m_keyCode
; // ASCII or virtual keycode
68 int m_command
; // Command id to generate
72 class WXDLLEXPORT wxAcceleratorTable
: public wxObject
74 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)
77 wxAcceleratorTable(const wxString
& resource
); // Load from .rc resource
78 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[]); // Load from array
81 wxAcceleratorTable(const wxAcceleratorTable
& accel
) { Ref(accel
); }
82 wxAcceleratorTable(const wxAcceleratorTable
* accel
) { if (accel
) Ref(*accel
); }
84 ~wxAcceleratorTable();
86 wxAcceleratorTable
& operator = (const wxAcceleratorTable
& accel
) { if (*this == accel
) return (*this); Ref(accel
); return *this; }
87 bool operator == (const wxAcceleratorTable
& accel
) { return m_refData
== accel
.m_refData
; }
88 bool operator != (const wxAcceleratorTable
& accel
) { return m_refData
!= accel
.m_refData
; }
92 // Implementation only
94 wxAcceleratorEntry
* GetEntries() const;
97 WXDLLEXPORT_DATA(extern wxAcceleratorTable
) wxNullAcceleratorTable
;