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