]> git.saurik.com Git - wxWidgets.git/blame - src/os2/accel.cpp
Added conversion of menu labels (&->~)
[wxWidgets.git] / src / os2 / accel.cpp
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: accel.cpp
3// Purpose: wxAcceleratorTable
d88de032 4// Author: David Webster
0e320a79 5// Modified by:
d88de032 6// Created: 10/13/99
0e320a79 7// RCS-ID: $Id$
d88de032 8// Copyright: (c) David Webster
0e320a79
DW
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
75f11ad7
DW
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
0e320a79 14
75f11ad7
DW
15#ifndef WX_PRECOMP
16#include <stdio.h>
0e320a79 17#include "wx/setup.h"
75f11ad7
DW
18#include "wx/window.h"
19#endif
20
21#include "wx/os2/accel.h"
22
23#include "wx/os2/private.h"
24
0e320a79 25
0e320a79 26IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
0e320a79
DW
27
28class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
29{
30 friend class WXDLLEXPORT wxAcceleratorTable;
31public:
32 wxAcceleratorRefData();
33 ~wxAcceleratorRefData();
34
0e320a79
DW
35 inline HACCEL GetHACCEL() const { return m_hAccel; }
36protected:
37 HACCEL m_hAccel;
d88de032 38 bool m_ok;
0e320a79
DW
39};
40
41#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
42
43wxAcceleratorRefData::wxAcceleratorRefData()
44{
45 // TODO
46/*
47 HACCEL m_hAccel;
48*/
49}
50
51wxAcceleratorRefData::~wxAcceleratorRefData()
52{
53/*
54 if (m_hAccel)
55 {
56 DestroyAcceleratorTable((HACCEL) m_hAccel);
57 }
58 m_hAccel = 0 ;
59*/
60}
61
62wxAcceleratorTable::wxAcceleratorTable()
63{
64 m_refData = NULL;
65}
66
67wxAcceleratorTable::~wxAcceleratorTable()
68{
69}
70
71// Load from .rc resource
72wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
73{
74 m_refData = new wxAcceleratorRefData;
75
76/* TODO: load acelerator from resource, if appropriate for your platform
77 M_ACCELDATA->m_hAccel = hAccel;
78 M_ACCELDATA->m_ok = (hAccel != 0);
79*/
80}
81
d88de032
DW
82extern int wxCharCodeWXToOS2(int id, bool *isVirtual);
83
0e320a79
DW
84// Create from an array
85wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
86{
87 m_refData = new wxAcceleratorRefData;
88
89/* TODO: create table from entries
90 */
91}
92
93bool wxAcceleratorTable::Ok() const
94{
95 // TODO
96 return FALSE;
97}
98
75f11ad7
DW
99void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
100{
101 if (!M_ACCELDATA)
102 m_refData = new wxAcceleratorRefData;
103
104 M_ACCELDATA->m_hAccel = (HACCEL) hAccel;
105}
106
107WXHACCEL wxAcceleratorTable::GetHACCEL() const
108{
109 if (!M_ACCELDATA)
110 return 0;
111 return (WXHACCEL) M_ACCELDATA->m_hAccel;
112}
113
114bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
115{
116 // TODO:
117/*
118 MSG *msg = (MSG *)wxmsg;
119
120 return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg);
121*/
122 return FALSE;
123}
124