]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/accel.h
1. some minor but nasty bugs fixed (see post to the list)
[wxWidgets.git] / include / wx / mac / accel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accel.h
3 // Purpose: wxAcceleratorTable class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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
22 class WXDLLEXPORT wxAcceleratorTable;
23
24 // Hold Ctrl key down
25 #define wxACCEL_ALT 0x01
26
27 // Hold Ctrl key down
28 #define wxACCEL_CTRL 0x02
29
30 // Hold Shift key down
31 #define wxACCEL_SHIFT 0x04
32
33 // Hold no key down
34 #define wxACCEL_NORMAL 0x00
35
36 class WXDLLEXPORT wxAcceleratorEntry
37 {
38 public:
39 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
40 {
41 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
42 }
43
44 inline void Set(int flags, int keyCode, int cmd)
45 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
46
47 inline int GetFlags() const { return m_flags; }
48 inline int GetKeyCode() const { return m_keyCode; }
49 inline int GetCommand() const { return m_command; }
50
51 int m_flags;
52 int m_keyCode; // ASCII or virtual keycode
53 int m_command; // Command id to generate
54 };
55
56 class WXDLLEXPORT wxAcceleratorTable: public wxObject
57 {
58 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
59 public:
60 wxAcceleratorTable();
61 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
62 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
63
64 // Copy constructors
65 inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
66 inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
67
68 ~wxAcceleratorTable();
69
70 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
71 inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
72 inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
73
74 bool Ok() const;
75 };
76
77 WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
78
79 #endif
80 // _WX_ACCEL_H_