]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/accel.h
Fix for missing -g from wx-config
[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
45f22d48 25#if 0
9b6dbb09
JS
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
8aa04e8b 36#define wxACCEL_NORMAL 0x00
9b6dbb09
JS
37
38class WXDLLEXPORT wxAcceleratorEntry
39{
40public:
8aa04e8b
JS
41 wxAcceleratorEntry(const wxAcceleratorEntry& entry)
42 {
43 m_flags = entry.m_flags; m_keyCode = entry.m_keyCode; m_command = entry.m_command;
44 }
9b6dbb09
JS
45 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
46 {
47 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
48 }
49
72cdf4c9 50 void Set(int flags, int keyCode, int cmd)
9b6dbb09
JS
51 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
52
72cdf4c9
VZ
53 int GetFlags() const { return m_flags; }
54 int GetKeyCode() const { return m_keyCode; }
55 int GetCommand() const { return m_command; }
9b6dbb09 56
8aa04e8b
JS
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
65public:
72cdf4c9
VZ
66 int m_flags;
67 int m_keyCode; // ASCII or virtual keycode
68 int m_command; // Command id to generate
9b6dbb09 69};
45f22d48 70#endif
9b6dbb09
JS
71
72class WXDLLEXPORT wxAcceleratorTable: public wxObject
73{
74DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
75public:
76 wxAcceleratorTable();
77 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
78 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
79
80 // Copy constructors
72cdf4c9
VZ
81 wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
82 wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
9b6dbb09
JS
83
84 ~wxAcceleratorTable();
85
72cdf4c9
VZ
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; }
9b6dbb09
JS
89
90 bool Ok() const;
8aa04e8b
JS
91
92// Implementation only
93 int GetCount() const;
94 wxAcceleratorEntry* GetEntries() const;
9b6dbb09
JS
95};
96
97WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
98
99#endif
100 // _WX_ACCEL_H_