]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/accel.h
Fixes for long to wxCoord
[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 58{
738f9e5a 59public:
bcf1fa6b
RR
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{
8636aed8 81public:
bcf1fa6b
RR
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
8636aed8 99// implementation
bcf1fa6b 100
8636aed8 101 int GetCommand( wxKeyEvent &event );
bcf1fa6b 102
8636aed8
RR
103private:
104 DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
bcf1fa6b
RR
105};
106
107#endif
dcf924a3
RR
108
109#endif