]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/accel.h
generated code updates
[wxWidgets.git] / include / wx / gtk1 / accel.h
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
19 #if wxUSE_ACCEL
20
21 #include "wx/object.h"
22 #include "wx/event.h"
23
24 //-----------------------------------------------------------------------------
25 // classes
26 //-----------------------------------------------------------------------------
27
28 class wxAcceleratorEntry;
29 class wxAcceleratorTable;
30
31 //-----------------------------------------------------------------------------
32 // constants
33 //-----------------------------------------------------------------------------
34
35 extern wxAcceleratorTable wxNullAcceleratorTable;
36
37 //-----------------------------------------------------------------------------
38 // constants
39 //-----------------------------------------------------------------------------
40
41 // Hold Ctrl key down
42 #define wxACCEL_ALT 0x01
43
44 // Hold Ctrl key down
45 #define wxACCEL_CTRL 0x02
46
47 // Hold Shift key down
48 #define wxACCEL_SHIFT 0x04
49
50 // Hold no other key
51 #define wxACCEL_NORMAL 0x00
52
53 //-----------------------------------------------------------------------------
54 // wxAcceleratorEntry
55 //-----------------------------------------------------------------------------
56
57 class wxAcceleratorEntry: public wxObject
58 {
59 public:
60 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
61 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
62
63 inline void Set(int flags, int keyCode, int cmd)
64 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
65
66 inline int GetFlags() const { return m_flags; }
67 inline int GetKeyCode() const { return m_keyCode; }
68 inline int GetCommand() const { return m_command; }
69
70 int m_flags;
71 int m_keyCode; // ASCII or virtual keycode
72 int m_command; // Command id to generate
73 };
74
75 //-----------------------------------------------------------------------------
76 // wxAcceleratorTable
77 //-----------------------------------------------------------------------------
78
79 class wxAcceleratorTable: public wxObject
80 {
81 public:
82 wxAcceleratorTable();
83 wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
84 ~wxAcceleratorTable();
85
86 inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
87 { Ref(accel); }
88 inline wxAcceleratorTable(const wxAcceleratorTable* accel)
89 { if (accel) Ref(*accel); }
90 inline bool operator == (const wxAcceleratorTable& accel)
91 { return m_refData == accel.m_refData; }
92 inline bool operator != (const wxAcceleratorTable& accel)
93 { return m_refData != accel.m_refData; }
94 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
95 { if (*this == accel) return (*this); Ref(accel); return *this; }
96
97 bool Ok() const;
98
99 // implementation
100 // --------------
101
102 int GetCommand( wxKeyEvent &event );
103
104 private:
105 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
106 };
107
108 #endif
109
110 #endif