]> git.saurik.com Git - wxWidgets.git/blob - src/os2/accel.cpp
*** empty log message ***
[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 #if !USE_SHARED_LIBRARIES
27 IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
28 #endif
29
30 class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
31 {
32 friend class WXDLLEXPORT wxAcceleratorTable;
33 public:
34 wxAcceleratorRefData();
35 ~wxAcceleratorRefData();
36
37 inline HACCEL GetHACCEL() const { return m_hAccel; }
38 protected:
39 HACCEL m_hAccel;
40 bool m_ok;
41 };
42
43 #define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
44
45 wxAcceleratorRefData::wxAcceleratorRefData()
46 {
47 // TODO
48 /*
49 HACCEL m_hAccel;
50 */
51 }
52
53 wxAcceleratorRefData::~wxAcceleratorRefData()
54 {
55 /*
56 if (m_hAccel)
57 {
58 DestroyAcceleratorTable((HACCEL) m_hAccel);
59 }
60 m_hAccel = 0 ;
61 */
62 }
63
64 wxAcceleratorTable::wxAcceleratorTable()
65 {
66 m_refData = NULL;
67 }
68
69 wxAcceleratorTable::~wxAcceleratorTable()
70 {
71 }
72
73 // Load from .rc resource
74 wxAcceleratorTable::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
84 extern int wxCharCodeWXToOS2(int id, bool *isVirtual);
85
86 // Create from an array
87 wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
88 {
89 m_refData = new wxAcceleratorRefData;
90
91 /* TODO: create table from entries
92 */
93 }
94
95 bool wxAcceleratorTable::Ok() const
96 {
97 // TODO
98 return FALSE;
99 }
100
101 void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
102 {
103 if (!M_ACCELDATA)
104 m_refData = new wxAcceleratorRefData;
105
106 M_ACCELDATA->m_hAccel = (HACCEL) hAccel;
107 }
108
109 WXHACCEL wxAcceleratorTable::GetHACCEL() const
110 {
111 if (!M_ACCELDATA)
112 return 0;
113 return (WXHACCEL) M_ACCELDATA->m_hAccel;
114 }
115
116 bool 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