]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/accel.h
Makefile tweaks
[wxWidgets.git] / include / wx / gtk / 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"
18#include "wx/object.h"
19#include "wx/event.h"
20
21//-----------------------------------------------------------------------------
22// classes
23//-----------------------------------------------------------------------------
24
25class wxAcceleratorEntry;
26class wxAcceleratorTable;
27
28//-----------------------------------------------------------------------------
29// constants
30//-----------------------------------------------------------------------------
31
32extern wxAcceleratorTable wxNullAcceleratorTable;
33
34//-----------------------------------------------------------------------------
35// constants
36//-----------------------------------------------------------------------------
37
38// Hold Ctrl key down
39#define wxACCEL_ALT 0x01
40
41// Hold Ctrl key down
42#define wxACCEL_CTRL 0x02
43
44 // Hold Shift key down
45#define wxACCEL_SHIFT 0x04
46
47 // Hold no other key
48#define wxACCEL_NORMAL 0x00
49
50//-----------------------------------------------------------------------------
51// wxAcceleratorEntry
52//-----------------------------------------------------------------------------
53
e55ad60e 54class wxAcceleratorEntry: public wxObject
bcf1fa6b
RR
55{
56 public:
57
58 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
59 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
60
61 inline void Set(int flags, int keyCode, int cmd)
62 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
63
64 inline int GetFlags() const { return m_flags; }
65 inline int GetKeyCode() const { return m_keyCode; }
66 inline int GetCommand() const { return m_command; }
67
68 int m_flags;
69 int m_keyCode; // ASCII or virtual keycode
70 int m_command; // Command id to generate
71};
72
73//-----------------------------------------------------------------------------
74// wxAcceleratorTable
75//-----------------------------------------------------------------------------
76
77class wxAcceleratorTable: public wxObject
78{
79 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
80
81 public:
82 wxAcceleratorTable();
83 wxAcceleratorTable(int n, wxAcceleratorEntry entries[] );
84 ~wxAcceleratorTable();
85
74e34480 86 inline wxAcceleratorTable(const wxAcceleratorTable& accel) : wxObject()
bcf1fa6b
RR
87 { Ref(accel); }
88 inline wxAcceleratorTable(const wxAcceleratorTable* accel)
89 { if (accel) Ref(*accel); }
74e34480 90 inline bool operator == (const wxAcceleratorTable& accel)
bcf1fa6b
RR
91 { return m_refData == accel.m_refData; }
92 inline bool operator != (const wxAcceleratorTable& accel)
93 { return m_refData != accel.m_refData; }
74e34480
JS
94 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
95 { if (*this == accel) return (*this); Ref(accel); return *this; }
bcf1fa6b
RR
96
97 bool Ok() const;
98
99// private:
100
101 int GetCommand( wxKeyEvent &event );
102
103};
104
105#endif