]>
Commit | Line | Data |
---|---|---|
7c23a0b0 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: accel.h | |
3 | // Purpose: wxAcceleratorTable class | |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
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" | |
34138703 | 20 | #include "wx/string.h" |
7c23a0b0 JS |
21 | |
22 | class WXDLLEXPORT wxAcceleratorTable; | |
23 | ||
24 | // Hold Ctrl key down | |
25 | #define wxACCEL_ALT 0x01 | |
26 | ||
27 | // Hold Ctrl key down | |
28 | #define wxACCEL_CTRL 0x02 | |
29 | ||
30 | // Hold Shift key down | |
31 | #define wxACCEL_SHIFT 0x04 | |
32 | ||
33 | class WXDLLEXPORT wxAcceleratorEntry | |
34 | { | |
35 | public: | |
36 | wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0) | |
37 | { | |
38 | m_flags = flags; m_keyCode = keyCode; m_command = cmd; | |
39 | } | |
40 | ||
41 | inline void Set(int flags, int keyCode, int cmd) | |
42 | { m_flags = flags; m_keyCode = keyCode; m_command = cmd; } | |
43 | ||
44 | inline int GetFlags() const { return m_flags; } | |
45 | inline int GetKeyCode() const { return m_keyCode; } | |
46 | inline int GetCommand() const { return m_command; } | |
47 | ||
48 | int m_flags; | |
49 | int m_keyCode; // ASCII or virtual keycode | |
50 | int m_command; // Command id to generate | |
51 | }; | |
52 | ||
53 | class WXDLLEXPORT wxAcceleratorTable: public wxObject | |
54 | { | |
55 | DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) | |
56 | public: | |
57 | wxAcceleratorTable(); | |
58 | wxAcceleratorTable(const wxString& resource); // Load from .rc resource | |
59 | wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array | |
60 | ||
61 | // Copy constructors | |
62 | inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); } | |
63 | inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); } | |
64 | ||
65 | ~wxAcceleratorTable(); | |
66 | ||
67 | inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; } | |
68 | inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; } | |
69 | inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; } | |
70 | ||
71 | bool Ok() const; | |
7c23a0b0 JS |
72 | }; |
73 | ||
74 | WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable; | |
75 | ||
76 | #endif | |
77 | // _WX_ACCEL_H_ |