]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/accel.h
DP: native wxTreeCtrl for GTK.
[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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ACCEL_H_
13#define _WX_ACCEL_H_
14
15#ifdef __GNUG__
16#pragma interface "accel.h"
17#endif
18
19#include "wx/object.h"
20
21class WXDLLEXPORT wxAcceleratorTable;
22
23// Hold Ctrl key down
24#define wxACCEL_ALT 0x01
25
26// Hold Ctrl key down
27#define wxACCEL_CTRL 0x02
28
29 // Hold Shift key down
30#define wxACCEL_SHIFT 0x04
31
32class WXDLLEXPORT wxAcceleratorEntry
33{
34public:
35 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
36 {
37 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
38 }
39
40 inline void Set(int flags, int keyCode, int cmd)
41 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
42
43 inline int GetFlags() const { return m_flags; }
44 inline int GetKeyCode() const { return m_keyCode; }
45 inline int GetCommand() const { return m_command; }
46
47 int m_flags;
48 int m_keyCode; // ASCII or virtual keycode
49 int m_command; // Command id to generate
50};
51
52class WXDLLEXPORT wxAcceleratorTable: public wxObject
53{
54DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
55public:
56 wxAcceleratorTable();
57 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
58 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
59
60 // Copy constructors
61 inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
62 inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
63
64 ~wxAcceleratorTable();
65
66 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
67 inline bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
68 inline bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
69
70 bool Ok(void) const;
71 void SetHACCEL(WXHACCEL hAccel);
72 WXHACCEL GetHACCEL() const;
73};
74
75WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
76
77#endif
78 // _WX_ACCEL_H_