]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/accel.h
second part of Markus' BC++ fix
[wxWidgets.git] / include / wx / motif / accel.h
CommitLineData
9b6dbb09
JS
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
72cdf4c9 9// Licence: wxWindows licence
9b6dbb09
JS
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"
8aa04e8b 21#include "wx/event.h"
9b6dbb09
JS
22
23class WXDLLEXPORT wxAcceleratorTable;
24
25// Hold Ctrl key down
26#define wxACCEL_ALT 0x01
27
28// Hold Ctrl key down
29#define wxACCEL_CTRL 0x02
30
31 // Hold Shift key down
32#define wxACCEL_SHIFT 0x04
33
34 // Hold no key down
8aa04e8b 35#define wxACCEL_NORMAL 0x00
9b6dbb09
JS
36
37class WXDLLEXPORT wxAcceleratorEntry
38{
39public:
8aa04e8b
JS
40 wxAcceleratorEntry(const wxAcceleratorEntry& entry)
41 {
42 m_flags = entry.m_flags; m_keyCode = entry.m_keyCode; m_command = entry.m_command;
43 }
9b6dbb09
JS
44 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
45 {
46 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
47 }
48
72cdf4c9 49 void Set(int flags, int keyCode, int cmd)
9b6dbb09
JS
50 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
51
72cdf4c9
VZ
52 int GetFlags() const { return m_flags; }
53 int GetKeyCode() const { return m_keyCode; }
54 int GetCommand() const { return m_command; }
9b6dbb09 55
8aa04e8b
JS
56 void operator = (const wxAcceleratorEntry& entry)
57 {
58 m_flags = entry.m_flags; m_keyCode = entry.m_keyCode; m_command = entry.m_command;
59 }
60
61 // Implementation use only
62 bool MatchesEvent(const wxKeyEvent& event) const;
63
64public:
72cdf4c9
VZ
65 int m_flags;
66 int m_keyCode; // ASCII or virtual keycode
67 int m_command; // Command id to generate
9b6dbb09
JS
68};
69
70class WXDLLEXPORT wxAcceleratorTable: public wxObject
71{
72DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
73public:
74 wxAcceleratorTable();
75 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
76 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
77
78 // Copy constructors
72cdf4c9
VZ
79 wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
80 wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
9b6dbb09
JS
81
82 ~wxAcceleratorTable();
83
72cdf4c9
VZ
84 wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
85 bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
86 bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
9b6dbb09
JS
87
88 bool Ok() const;
8aa04e8b
JS
89
90// Implementation only
91 int GetCount() const;
92 wxAcceleratorEntry* GetEntries() const;
9b6dbb09
JS
93};
94
95WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
96
97#endif
98 // _WX_ACCEL_H_