]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/accel.h
pass correct key code in TREE_KEY_DOWN event
[wxWidgets.git] / include / wx / motif / accel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accel.h
3 // Purpose: wxAcceleratorTable class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
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"
20 #include "wx/string.h"
21 #include "wx/event.h"
22
23 class WXDLLEXPORT wxAcceleratorTable;
24
25 #if 0
26 // Hold Ctrl key down
27 #define wxACCEL_ALT 0x01
28
29 // Hold Ctrl key down
30 #define wxACCEL_CTRL 0x02
31
32 // Hold Shift key down
33 #define wxACCEL_SHIFT 0x04
34
35 // Hold no key down
36 #define wxACCEL_NORMAL 0x00
37
38 class WXDLLEXPORT wxAcceleratorEntry
39 {
40 public:
41 wxAcceleratorEntry(const wxAcceleratorEntry& entry)
42 {
43 m_flags = entry.m_flags; m_keyCode = entry.m_keyCode; m_command = entry.m_command;
44 }
45 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
46 {
47 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
48 }
49
50 void Set(int flags, int keyCode, int cmd)
51 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
52
53 int GetFlags() const { return m_flags; }
54 int GetKeyCode() const { return m_keyCode; }
55 int GetCommand() const { return m_command; }
56
57 void operator = (const wxAcceleratorEntry& entry)
58 {
59 m_flags = entry.m_flags; m_keyCode = entry.m_keyCode; m_command = entry.m_command;
60 }
61
62 // Implementation use only
63 bool MatchesEvent(const wxKeyEvent& event) const;
64
65 public:
66 int m_flags;
67 int m_keyCode; // ASCII or virtual keycode
68 int m_command; // Command id to generate
69 };
70 #endif
71
72 class WXDLLEXPORT wxAcceleratorTable: public wxObject
73 {
74 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
75 public:
76 wxAcceleratorTable();
77 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
78 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
79
80 // Copy constructors
81 wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
82 wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
83
84 ~wxAcceleratorTable();
85
86 wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
87 bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
88 bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
89
90 bool Ok() const;
91
92 // Implementation only
93 int GetCount() const;
94 wxAcceleratorEntry* GetEntries() const;
95 };
96
97 WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
98
99 #endif
100 // _WX_ACCEL_H_