]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/accel.h
Some Motif fixes; makefile fixes; added wxTransferStreamToFile/FileToStream for wxWin
[wxWidgets.git] / include / wx / os2 / accel.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: accel.h
3// Purpose: wxAcceleratorTable class
d88de032 4// Author: David Webster
0e320a79 5// Modified by:
d88de032 6// Created: 10/13/99
0e320a79 7// RCS-ID: $Id$
d88de032
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ACCEL_H_
13#define _WX_ACCEL_H_
14
0e320a79 15#include "wx/object.h"
0e320a79
DW
16
17class WXDLLEXPORT wxAcceleratorTable;
18
19// Hold Ctrl key down
20#define wxACCEL_ALT 0x01
21
22// Hold Ctrl key down
23#define wxACCEL_CTRL 0x02
24
25 // Hold Shift key down
26#define wxACCEL_SHIFT 0x04
27
28 // Hold no key down
29#define wxACCEL_NORMAL 0x00
30
31class WXDLLEXPORT wxAcceleratorEntry
32{
33public:
34 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0)
35 {
36 m_flags = flags; m_keyCode = keyCode; m_command = cmd;
37 }
38
39 inline void Set(int flags, int keyCode, int cmd)
40 { m_flags = flags; m_keyCode = keyCode; m_command = cmd; }
41
42 inline int GetFlags() const { return m_flags; }
43 inline int GetKeyCode() const { return m_keyCode; }
44 inline int GetCommand() const { return m_command; }
45
46 int m_flags;
47 int m_keyCode; // ASCII or virtual keycode
48 int m_command; // Command id to generate
49};
50
51class WXDLLEXPORT wxAcceleratorTable: public wxObject
52{
53DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
54public:
55 wxAcceleratorTable();
56 wxAcceleratorTable(const wxString& resource); // Load from .rc resource
57 wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
58
59 // Copy constructors
60 inline wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
61 inline wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
62
63 ~wxAcceleratorTable();
64
75f11ad7
DW
65 inline wxAcceleratorTable& operator = (const wxAcceleratorTable& accel)
66 { if (*this == accel) return (*this); Ref(accel); return *this; };
67 inline bool operator == (const wxAcceleratorTable& accel)
68 { return m_refData == accel.m_refData; };
69 inline bool operator != (const wxAcceleratorTable& accel)
70 { return m_refData != accel.m_refData; };
0e320a79
DW
71
72 bool Ok() const;
75f11ad7
DW
73 void SetHACCEL(WXHACCEL hAccel);
74 WXHACCEL GetHACCEL() const;
75
76 // translate the accelerator, return TRUE if done
77 bool Translate(wxWindow *window, WXMSG *msg) const;
0e320a79
DW
78};
79
80WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
81
82#endif
83 // _WX_ACCEL_H_