Changed floats to doubles in wxexpr.h; added a flag in accel.h (wxACCEL_NONE for
[wxWidgets.git] / include / wx / msw / accel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accel.h
3 // Purpose: wxAcceleratorTable class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 31/7/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_ACCEL_H_
13 #define _WX_ACCEL_H_
14
15 #ifdef __GNUG__
16 #pragma interface "accel.h"
17 #endif
18
19 #include "wx/object.h"
20
21 class WXDLLEXPORT wxAcceleratorTable;
22
23 // Hold Ctrl key down
24 #define wxACCEL_ALT 0x01
25
26 // Hold Ctrl key down
27 #define wxACCEL_CTRL 0x02
28
29 // Hold Shift key down
30 #define wxACCEL_SHIFT 0x04
31
32 // Hold no other key
33 #define wxACCEL_NORMAL 0x00
34
35 class WXDLLEXPORT wxAcceleratorEntry
36 {
37 public:
38 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
39 {
40 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
41 }
42
43 inline void Set(int flags, int keyCode, int cmd)
44 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
45
46 inline int GetFlags() const { return m_flags; }
47 inline int GetKeyCode() const { return m_keyCode; }
48 inline int GetCommand() const { return m_command; }
49
50 int m_flags;
51 int m_keyCode; // ASCII or virtual keycode
52 int m_command; // Command id to generate
53 };
54
55 class WXDLLEXPORT wxAcceleratorTable: public wxObject
56 {
57 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
58 public:
59 wxAcceleratorTable();
60 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
61 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
62
63 // Copy constructors
64 inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
65 inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
66
67 ~wxAcceleratorTable();
68
69 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
70 inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
71 inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
72
73 bool Ok(void) const;
74 void SetHACCEL(WXHACCEL hAccel);
75 WXHACCEL GetHACCEL() const;
76 };
77
78 WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
79
80 #endif
81 // _WX_ACCEL_H_