1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxAcceleratorTable class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/object.h"
17 class WXDLLEXPORT wxAcceleratorTable
;
20 #define wxACCEL_ALT 0x01
23 #define wxACCEL_CTRL 0x02
25 // Hold Shift key down
26 #define wxACCEL_SHIFT 0x04
29 #define wxACCEL_NORMAL 0x00
31 class WXDLLEXPORT wxAcceleratorEntry
34 wxAcceleratorEntry(int flags
= 0, int keyCode
= 0, int cmd
= 0)
36 m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
;
39 inline void Set(int flags
, int keyCode
, int cmd
)
40 { m_flags
= flags
; m_keyCode
= keyCode
; m_command
= cmd
; }
42 inline int GetFlags() const { return m_flags
; }
43 inline int GetKeyCode() const { return m_keyCode
; }
44 inline int GetCommand() const { return m_command
; }
47 int m_keyCode
; // ASCII or virtual keycode
48 int m_command
; // Command id to generate
51 class WXDLLEXPORT wxAcceleratorTable
: public wxObject
53 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable
)
56 wxAcceleratorTable(const wxString
& rsResource
); // Load from .rc resource
57 wxAcceleratorTable( int n
58 ,wxAcceleratorEntry vaEntries
[]
62 inline wxAcceleratorTable(const wxAcceleratorTable
& rAccel
) { Ref(rAccel
); }
63 inline wxAcceleratorTable(const wxAcceleratorTable
* pAccel
) { if (pAccel
) Ref(*pAccel
); }
65 ~wxAcceleratorTable();
67 inline wxAcceleratorTable
& operator = (const wxAcceleratorTable
& rAccel
)
68 { if (*this == rAccel
) return (*this); Ref(rAccel
); return *this; };
69 inline bool operator == (const wxAcceleratorTable
& rAccel
)
70 { return m_refData
== rAccel
.m_refData
; };
71 inline bool operator != (const wxAcceleratorTable
& rAccel
)
72 { return m_refData
!= rAccel
.m_refData
; };
75 void SetHACCEL(WXHACCEL hAccel
);
76 WXHACCEL
GetHACCEL(void) const;
78 // translate the accelerator, return TRUE if done
79 bool Translate( WXHWND hWnd
84 WXDLLEXPORT_DATA(extern wxAcceleratorTable
) wxNullAcceleratorTable
;