1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAcceleratorTable class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "accel.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
22 class WXDLLEXPORT wxAcceleratorTable
;
25 #define wxACCEL_ALT 0x01
28 #define wxACCEL_CTRL 0x02
30 // Hold Shift key down
31 #define wxACCEL_SHIFT 0x04
34 #define wxACCEL_NORMAL 0x00
36 class WXDLLEXPORT wxAcceleratorEntry
39 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
41 m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
;
44 inline void Set(int flags
, int keyCode
, int cmd
)
45 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
47 inline int GetFlags() const { return m_flags
; }
48 inline int GetKeyCode() const { return m_keyCode
; }
49 inline int GetCommand() const { return m_command
; }
52 int m_keyCode
; // ASCII or virtual keycode
53 int m_command
; // Command id to generate
56 class WXDLLEXPORT wxAcceleratorTable
: public wxObject
58 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)
61 wxAcceleratorTable(const wxString
& resource
); // Load from .rc resource
62 wxAcceleratorTable(int n
, wxAcceleratorEntry entries
[]); // Load from array
65 inline wxAcceleratorTable(const wxAcceleratorTable
& accel
) { Ref(accel
); }
66 inline wxAcceleratorTable(const wxAcceleratorTable
* accel
) { if (accel
) Ref(*accel
); }
68 ~wxAcceleratorTable();
70 inline wxAcceleratorTable
& operator = (const wxAcceleratorTable
& accel
)
71 { if (*this == accel
) return (*this); Ref(accel
); return *this; };
72 inline bool operator == (const wxAcceleratorTable
& accel
)
73 { return m_refData
== accel
.m_refData
; };
74 inline bool operator != (const wxAcceleratorTable
& accel
)
75 { return m_refData
!= accel
.m_refData
; };
78 void SetHACCEL(WXHACCEL hAccel
);
79 WXHACCEL
GetHACCEL() const;
81 // translate the accelerator, return TRUE if done
82 bool Translate(wxWindow
*window
, WXMSG
*msg
) const;
85 WXDLLEXPORT_DATA(extern wxAcceleratorTable
) wxNullAcceleratorTable
;