]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/accel.h
Added class to handle selection inside wxGrid
[wxWidgets.git] / include / wx / msw / accel.h
CommitLineData
110f3205
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: accel.h
3// Purpose: wxAcceleratorTable class
4// Author: Julian Smart
5// Modified by:
6// Created: 31/7/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
c50f1fb9 9// Licence: wxWindows licence
110f3205
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ACCEL_H_
13#define _WX_ACCEL_H_
14
15#ifdef __GNUG__
c50f1fb9 16 #pragma interface "accel.h"
110f3205
JS
17#endif
18
19#include "wx/object.h"
20
21class WXDLLEXPORT wxAcceleratorTable;
22
c50f1fb9
VZ
23// ----------------------------------------------------------------------------
24// constants
25// ----------------------------------------------------------------------------
26
110f3205
JS
27// Hold Ctrl key down
28#define wxACCEL_ALT 0x01
29
30// Hold Ctrl key down
31#define wxACCEL_CTRL 0x02
32
33 // Hold Shift key down
34#define wxACCEL_SHIFT 0x04
35
7a11869d
JS
36 // Hold no other key
37#define wxACCEL_NORMAL 0x00
38
c50f1fb9
VZ
39// ----------------------------------------------------------------------------
40// an entry in wxAcceleratorTable corresponds to one accelerator
41// ----------------------------------------------------------------------------
42
110f3205
JS
43class WXDLLEXPORT wxAcceleratorEntry
44{
45public:
46 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
47 {
c50f1fb9 48 Set(flags, keyCode, cmd);
110f3205
JS
49 }
50
c50f1fb9
VZ
51 void Set(int flags, int keyCode, int cmd)
52 {
53 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
54 }
110f3205 55
c50f1fb9
VZ
56 int GetFlags() const { return m_flags; }
57 int GetKeyCode() const { return m_keyCode; }
58 int GetCommand() const { return m_command; }
110f3205 59
c50f1fb9
VZ
60//private:
61 int m_flags;
62 int m_keyCode; // ASCII or virtual keycode
63 int m_command; // Command id to generate
110f3205
JS
64};
65
c50f1fb9
VZ
66// ----------------------------------------------------------------------------
67// the accel table has all accelerators for a given window or menu
68// ----------------------------------------------------------------------------
69
70class WXDLLEXPORT wxAcceleratorTable : public wxObject
110f3205
JS
71{
72DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
73public:
74 wxAcceleratorTable();
75 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
10310d83 76 wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array
110f3205
JS
77
78 // Copy constructors
37f214d5
DW
79 inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
80 inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
110f3205
JS
81
82 ~wxAcceleratorTable();
83
37f214d5
DW
84 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if ( *this != accel ) Ref(accel); return *this; }
85 inline bool operator == (const wxAcceleratorTable& accel) const { return m_refData == accel.m_refData; }
86 inline bool operator != (const wxAcceleratorTable& accel) const { return m_refData != accel.m_refData; }
c50f1fb9
VZ
87
88 bool Ok() const;
110f3205
JS
89 void SetHACCEL(WXHACCEL hAccel);
90 WXHACCEL GetHACCEL() const;
c50f1fb9
VZ
91
92 // translate the accelerator, return TRUE if done
93 bool Translate(wxWindow *window, WXMSG *msg) const;
110f3205
JS
94};
95
96WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
97
98#endif
99 // _WX_ACCEL_H_