]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/accel.h
Forgot to add the files.
[wxWidgets.git] / include / wx / gtk1 / accel.h
CommitLineData
bcf1fa6b
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: accel.h
3// Purpose: wxAcceleratorTable class
dbf858b5
RR
4// Author: Robert Roebling
5// RCS-ID: $Id$
bcf1fa6b
RR
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"
dcf924a3
RR
18
19#if wxUSE_ACCEL
20
bcf1fa6b
RR
21#include "wx/object.h"
22#include "wx/event.h"
23
24//-----------------------------------------------------------------------------
25// classes
26//-----------------------------------------------------------------------------
27
28class wxAcceleratorEntry;
29class wxAcceleratorTable;
30
31//-----------------------------------------------------------------------------
32// constants
33//-----------------------------------------------------------------------------
34
35extern 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
e55ad60e 57class wxAcceleratorEntry: public wxObject
bcf1fa6b
RR
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
80class wxAcceleratorTable: public wxObject
81{
8636aed8 82public:
bcf1fa6b
RR
83 wxAcceleratorTable();
84 wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
85 ~wxAcceleratorTable();
86
74e34480 87 inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
bcf1fa6b
RR
88 { Ref(accel); }
89 inline wxAcceleratorTable(const wxAcceleratorTable* accel)
90 { if (accel) Ref(*accel); }
74e34480 91 inline bool operator == (const wxAcceleratorTable& accel)
bcf1fa6b
RR
92 { return m_refData == accel.m_refData; }
93 inline bool operator != (const wxAcceleratorTable& accel)
94 { return m_refData != accel.m_refData; }
74e34480
JS
95 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
96 { if (*this == accel) return (*this); Ref(accel); return *this; }
bcf1fa6b
RR
97
98 bool Ok() const;
99
8636aed8 100// implementation
bcf1fa6b 101
8636aed8 102 int GetCommand( wxKeyEvent &event );
bcf1fa6b 103
8636aed8
RR
104private:
105 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
bcf1fa6b
RR
106};
107
108#endif
dcf924a3
RR
109
110#endif