]> git.saurik.com Git - wxWidgets.git/blame - src/os2/accel.cpp
debug check for infinite loop in InitializeClasses() added
[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
DW
25
26#if !USE_SHARED_LIBRARIES
27IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
28#endif
29
30class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
31{
32 friend class WXDLLEXPORT wxAcceleratorTable;
33public:
34 wxAcceleratorRefData();
35 ~wxAcceleratorRefData();
36
0e320a79
DW
37 inline HACCEL GetHACCEL() const { return m_hAccel; }
38protected:
39 HACCEL m_hAccel;
d88de032 40 bool m_ok;
0e320a79
DW
41};
42
43#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
44
45wxAcceleratorRefData::wxAcceleratorRefData()
46{
47 // TODO
48/*
49 HACCEL m_hAccel;
50*/
51}
52
53wxAcceleratorRefData::~wxAcceleratorRefData()
54{
55/*
56 if (m_hAccel)
57 {
58 DestroyAcceleratorTable((HACCEL) m_hAccel);
59 }
60 m_hAccel = 0 ;
61*/
62}
63
64wxAcceleratorTable::wxAcceleratorTable()
65{
66 m_refData = NULL;
67}
68
69wxAcceleratorTable::~wxAcceleratorTable()
70{
71}
72
73// Load from .rc resource
74wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
75{
76 m_refData = new wxAcceleratorRefData;
77
78/* TODO: load acelerator from resource, if appropriate for your platform
79 M_ACCELDATA->m_hAccel = hAccel;
80 M_ACCELDATA->m_ok = (hAccel != 0);
81*/
82}
83
d88de032
DW
84extern int wxCharCodeWXToOS2(int id, bool *isVirtual);
85
0e320a79
DW
86// Create from an array
87wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
88{
89 m_refData = new wxAcceleratorRefData;
90
91/* TODO: create table from entries
92 */
93}
94
95bool wxAcceleratorTable::Ok() const
96{
97 // TODO
98 return FALSE;
99}
100
75f11ad7
DW
101void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
102{
103 if (!M_ACCELDATA)
104 m_refData = new wxAcceleratorRefData;
105
106 M_ACCELDATA->m_hAccel = (HACCEL) hAccel;
107}
108
109WXHACCEL wxAcceleratorTable::GetHACCEL() const
110{
111 if (!M_ACCELDATA)
112 return 0;
113 return (WXHACCEL) M_ACCELDATA->m_hAccel;
114}
115
116bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
117{
118 // TODO:
119/*
120 MSG *msg = (MSG *)wxmsg;
121
122 return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg);
123*/
124 return FALSE;
125}
126