]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/accel.h
1. wxStaticLine implemented (generic (ugly) and MSW versions)
[wxWidgets.git] / include / wx / gtk / 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
61 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
62 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
63
64 inline void Set(int flags, int keyCode, int cmd)
65 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
66
67 inline int GetFlags() const { return m_flags; }
68 inline int GetKeyCode() const { return m_keyCode; }
69 inline int GetCommand() const { return m_command; }
70
71 int m_flags;
72 int m_keyCode; // ASCII or virtual keycode
73 int m_command; // Command id to generate
74 };
75
76 //-----------------------------------------------------------------------------
77 // wxAcceleratorTable
78 //-----------------------------------------------------------------------------
79
80 class wxAcceleratorTable: public wxObject
81 {
82 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
83
84 public:
85 wxAcceleratorTable();
86 wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
87 ~wxAcceleratorTable();
88
89 inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
90 { Ref(accel); }
91 inline wxAcceleratorTable(const wxAcceleratorTable* accel)
92 { if (accel) Ref(*accel); }
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 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
98 { if (*this == accel) return (*this); Ref(accel); return *this; }
99
100 bool Ok() const;
101
102 // private:
103
104 int GetCommand( wxKeyEvent &event );
105
106 };
107
108 #endif
109
110 #endif