]> git.saurik.com Git - wxWidgets.git/blob - src/os2/accel.cpp
added a few comments and remove $(COPYSEP)
[wxWidgets.git] / src / os2 / accel.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accel.cpp
3 // Purpose: wxAcceleratorTable
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/13/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #ifndef WX_PRECOMP
16 #include <stdio.h>
17 #include "wx/setup.h"
18 #include "wx/window.h"
19 #endif
20
21 #include "wx/os2/accel.h"
22
23 #include "wx/os2/private.h"
24
25
26 IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
27
28 class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
29 {
30 friend class WXDLLEXPORT wxAcceleratorTable;
31 public:
32 wxAcceleratorRefData();
33 ~wxAcceleratorRefData();
34
35 inline HACCEL GetHACCEL() const { return m_hAccel; }
36 protected:
37 HACCEL m_hAccel;
38 bool m_ok;
39 };
40
41 #define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
42
43 wxAcceleratorRefData::wxAcceleratorRefData()
44 {
45 // TODO
46 /*
47 HACCEL m_hAccel;
48 */
49 }
50
51 wxAcceleratorRefData::~wxAcceleratorRefData()
52 {
53 /*
54 if (m_hAccel)
55 {
56 DestroyAcceleratorTable((HACCEL) m_hAccel);
57 }
58 m_hAccel = 0 ;
59 */
60 }
61
62 wxAcceleratorTable::wxAcceleratorTable()
63 {
64 m_refData = NULL;
65 }
66
67 wxAcceleratorTable::~wxAcceleratorTable()
68 {
69 }
70
71 // Load from .rc resource
72 wxAcceleratorTable::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
82 extern int wxCharCodeWXToOS2(int id, bool *isVirtual);
83
84 // Create from an array
85 wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
86 {
87 m_refData = new wxAcceleratorRefData;
88
89 /* TODO: create table from entries
90 */
91 }
92
93 bool wxAcceleratorTable::Ok() const
94 {
95 // TODO
96 return FALSE;
97 }
98
99 void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
100 {
101 if (!M_ACCELDATA)
102 m_refData = new wxAcceleratorRefData;
103
104 M_ACCELDATA->m_hAccel = (HACCEL) hAccel;
105 }
106
107 WXHACCEL wxAcceleratorTable::GetHACCEL() const
108 {
109 if (!M_ACCELDATA)
110 return 0;
111 return (WXHACCEL) M_ACCELDATA->m_hAccel;
112 }
113
114 bool 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