]> git.saurik.com Git - wxWidgets.git/blob - src/os2/accel.cpp
438c075e32c783c5162645b9917d25cc743ec2ed
[wxWidgets.git] / src / os2 / accel.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: accel.cpp
3 // Purpose: wxAcceleratorTable
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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 };
41
42 #define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
43
44 wxAcceleratorRefData::wxAcceleratorRefData()
45 {
46 // TODO
47 /*
48 HACCEL m_hAccel;
49 */
50 }
51
52 wxAcceleratorRefData::~wxAcceleratorRefData()
53 {
54 /*
55 if (m_hAccel)
56 {
57 DestroyAcceleratorTable((HACCEL) m_hAccel);
58 }
59 m_hAccel = 0 ;
60 */
61 }
62
63 wxAcceleratorTable::wxAcceleratorTable()
64 {
65 m_refData = NULL;
66 }
67
68 wxAcceleratorTable::~wxAcceleratorTable()
69 {
70 }
71
72 // Load from .rc resource
73 wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
74 {
75 m_refData = new wxAcceleratorRefData;
76
77 /* TODO: load acelerator from resource, if appropriate for your platform
78 M_ACCELDATA->m_hAccel = hAccel;
79 M_ACCELDATA->m_ok = (hAccel != 0);
80 */
81 }
82
83 // Create from an array
84 wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
85 {
86 m_refData = new wxAcceleratorRefData;
87
88 /* TODO: create table from entries
89 */
90 }
91
92 bool wxAcceleratorTable::Ok() const
93 {
94 // TODO
95 return FALSE;
96 }
97
98 void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel)
99 {
100 if (!M_ACCELDATA)
101 m_refData = new wxAcceleratorRefData;
102
103 M_ACCELDATA->m_hAccel = (HACCEL) hAccel;
104 }
105
106 WXHACCEL wxAcceleratorTable::GetHACCEL() const
107 {
108 if (!M_ACCELDATA)
109 return 0;
110 return (WXHACCEL) M_ACCELDATA->m_hAccel;
111 }
112
113 bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
114 {
115 // TODO:
116 /*
117 MSG *msg = (MSG *)wxmsg;
118
119 return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg);
120 */
121 return FALSE;
122 }
123