]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: accel.h | |
3 | // Purpose: wxAcceleratorTable class | |
4 | // Author: Robert Roebling | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef __GTKACCELH__ | |
11 | #define __GTKACCELH__ | |
12 | ||
13 | #ifdef __GNUG__ | |
14 | #pragma interface "accel.h" | |
15 | #endif | |
16 | ||
17 | #include "wx/defs.h" | |
18 | #include "wx/object.h" | |
19 | #include "wx/event.h" | |
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // classes | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | class wxAcceleratorEntry; | |
26 | class wxAcceleratorTable; | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // constants | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | extern wxAcceleratorTable wxNullAcceleratorTable; | |
33 | ||
34 | //----------------------------------------------------------------------------- | |
35 | // constants | |
36 | //----------------------------------------------------------------------------- | |
37 | ||
38 | // Hold Ctrl key down | |
39 | #define wxACCEL_ALT 0x01 | |
40 | ||
41 | // Hold Ctrl key down | |
42 | #define wxACCEL_CTRL 0x02 | |
43 | ||
44 | // Hold Shift key down | |
45 | #define wxACCEL_SHIFT 0x04 | |
46 | ||
47 | // Hold no other key | |
48 | #define wxACCEL_NORMAL 0x00 | |
49 | ||
50 | //----------------------------------------------------------------------------- | |
51 | // wxAcceleratorEntry | |
52 | //----------------------------------------------------------------------------- | |
53 | ||
54 | class wxAcceleratorEntry: public wxObject | |
55 | { | |
56 | public: | |
57 | ||
58 | wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0) | |
59 | { m_flags = flags; m_keyCode = keyCode; m_command = cmd; } | |
60 | ||
61 | inline void Set(int flags, int keyCode, int cmd) | |
62 | { m_flags = flags; m_keyCode = keyCode; m_command = cmd; } | |
63 | ||
64 | inline int GetFlags() const { return m_flags; } | |
65 | inline int GetKeyCode() const { return m_keyCode; } | |
66 | inline int GetCommand() const { return m_command; } | |
67 | ||
68 | int m_flags; | |
69 | int m_keyCode; // ASCII or virtual keycode | |
70 | int m_command; // Command id to generate | |
71 | }; | |
72 | ||
73 | //----------------------------------------------------------------------------- | |
74 | // wxAcceleratorTable | |
75 | //----------------------------------------------------------------------------- | |
76 | ||
77 | class wxAcceleratorTable: public wxObject | |
78 | { | |
79 | DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) | |
80 | ||
81 | public: | |
82 | wxAcceleratorTable(); | |
83 | wxAcceleratorTable(int n, wxAcceleratorEntry entries[] ); | |
84 | ~wxAcceleratorTable(); | |
85 | ||
86 | inline wxAcceleratorTable(const wxAcceleratorTable& accel) | |
87 | { Ref(accel); } | |
88 | inline wxAcceleratorTable(const wxAcceleratorTable* accel) | |
89 | { if (accel) Ref(*accel); } | |
90 | inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) | |
91 | { if (*this == accel) return (*this); Ref(accel); return *this; } | |
92 | inline bool operator == (const wxAcceleratorTable& accel) | |
93 | { return m_refData == accel.m_refData; } | |
94 | inline bool operator != (const wxAcceleratorTable& accel) | |
95 | { return m_refData != accel.m_refData; } | |
96 | ||
97 | bool Ok() const; | |
98 | ||
99 | // private: | |
100 | ||
101 | int GetCommand( wxKeyEvent &event ); | |
102 | ||
103 | }; | |
104 | ||
105 | #endif |