]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk1/accel.h
Watcom C++ fixup in tbar95.cpp; removed WXWIN_COMPATIBILITY for 'old' menu
[wxWidgets.git] / include / wx / gtk1 / accel.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: accel.h
3// Purpose: wxAcceleratorTable class
4// Author: Robert Roebling
5// RCS-ID: $Id$
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"
18
19#if wxUSE_ACCEL
20
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
57class wxAcceleratorEntry: public wxObject
58{
59public:
60 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
61 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
62
63 inline void Set(int flags, int keyCode, int cmd)
64 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
65
66 inline int GetFlags() const { return m_flags; }
67 inline int GetKeyCode() const { return m_keyCode; }
68 inline int GetCommand() const { return m_command; }
69
70 int m_flags;
71 int m_keyCode; // ASCII or virtual keycode
72 int m_command; // Command id to generate
73};
74
75//-----------------------------------------------------------------------------
76// wxAcceleratorTable
77//-----------------------------------------------------------------------------
78
79class wxAcceleratorTable: public wxObject
80{
81public:
82 wxAcceleratorTable();
83 wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
84 ~wxAcceleratorTable();
85
86 inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
87 { Ref(accel); }
88 inline wxAcceleratorTable(const wxAcceleratorTable* accel)
89 { if (accel) Ref(*accel); }
90 inline bool operator == (const wxAcceleratorTable& accel)
91 { return m_refData == accel.m_refData; }
92 inline bool operator != (const wxAcceleratorTable& accel)
93 { return m_refData != accel.m_refData; }
94 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
95 { if (*this == accel) return (*this); Ref(accel); return *this; }
96
97 bool Ok() const;
98
99// implementation
100
101 int GetCommand( wxKeyEvent &event );
102
103private:
104 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
105};
106
107#endif
108
109#endif