]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/toplevel.cpp
fixed status bar source file name; removed wxUSE_NATIVE_STATUS_BAR; removed generic...
[wxWidgets.git] / src / palmos / toplevel.cpp
CommitLineData
ffecfa5a
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: palmos/toplevel.cpp
3// Purpose: implements wxTopLevelWindow for Palm OS
4// Author: William Osborne
5// Modified by:
6// Created: 10/13/04
7// RCS-ID: $Id:
8// Copyright: (c) William Osborne <wbo@freeshell.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "toplevel.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28 #pragma hdrstop
29#endif
30
31#ifndef WX_PRECOMP
32 #include "wx/app.h"
33 #include "wx/toplevel.h"
34 #include "wx/dialog.h"
35 #include "wx/string.h"
36 #include "wx/log.h"
37 #include "wx/intl.h"
38 #include "wx/frame.h"
39 #include "wx/containr.h" // wxSetFocusToChild()
40#endif //WX_PRECOMP
41
42#include "wx/module.h"
43
44#include "wx/display.h"
45
46#ifndef ICON_BIG
47 #define ICON_BIG 1
48#endif
49
50#ifndef ICON_SMALL
51 #define ICON_SMALL 0
52#endif
53
54
55// ----------------------------------------------------------------------------
56// globals
57// ----------------------------------------------------------------------------
58
59// the name of the default wxWidgets class
60extern const wxChar *wxCanvasClassName;
61
62// Pointer to the currently active frame for the form event handler.
63wxFrame* ActiveParentFrame;
64
65// ============================================================================
66// wxTopLevelWindowPalm implementation
67// ============================================================================
68
69BEGIN_EVENT_TABLE(wxTopLevelWindowPalm, wxTopLevelWindowBase)
70 EVT_ACTIVATE(wxTopLevelWindowPalm::OnActivate)
71END_EVENT_TABLE()
72
73// ----------------------------------------------------------------------------
74// wxTopLevelWindowPalm creation
75// ----------------------------------------------------------------------------
76
77void wxTopLevelWindowPalm::Init()
78{
79}
80
81WXDWORD wxTopLevelWindowPalm::PalmGetStyle(long style, WXDWORD *exflags) const
82{
83 return 0;
84}
85
86WXHWND wxTopLevelWindowPalm::PalmGetParent() const
87{
88 return NULL;
89}
90
91bool wxTopLevelWindowPalm::CreateDialog(const void *dlgTemplate,
92 const wxString& title,
93 const wxPoint& pos,
94 const wxSize& size)
95{
96 return false;
97}
98
99bool wxTopLevelWindowPalm::CreateFrame(const wxString& title,
100 const wxPoint& pos,
101 const wxSize& size)
102{
103 return false;
104}
105
106bool wxTopLevelWindowPalm::Create(wxWindow *parent,
107 wxWindowID id,
108 const wxString& title,
109 const wxPoint& pos,
110 const wxSize& size,
111 long style,
112 const wxString& name)
113{
114 ActiveParentFrame=NULL;
115
116 wxTopLevelWindows.Append(this);
117
118 if ( parent )
119 parent->AddChild(this);
120
121 m_windowId = id == -1 ? NewControlId() : id;
122
123 FrameForm=FrmNewForm(m_windowId,title,0,0,160,160,false,0,NULL,0,NULL,0);
124 if(FrameForm==0)
125 return false;
126
127 FrmSetEventHandler(FrameForm,FrameFormHandleEvent);
128
129 return true;
130}
131
132bool wxTopLevelWindowPalm::Create(wxWindow *parent,
133 wxWindowID id,
134 const wxString& title,
135 const wxPoint& pos,
136 const wxSize& size,
137 long style,
138 const wxString& name,
139 wxFrame* PFrame)
140{
141 wxTopLevelWindows.Append(this);
142
143 if ( parent )
144 parent->AddChild(this);
145
146 m_windowId = id == -1 ? NewControlId() : id;
147
148 FrameForm=FrmNewForm(m_windowId,title,0,0,160,160,false,0,NULL,0,NULL,0);
149 if(FrameForm==0)
150 return false;
151
152 FrmSetEventHandler(FrameForm,FrameFormHandleEvent);
153
154 FrmSetActiveForm(FrameForm);
155
156 ActiveParentFrame=PFrame;
157
158 return true;
159}
160
161wxTopLevelWindowPalm::~wxTopLevelWindowPalm()
162{
163}
164
165// ----------------------------------------------------------------------------
166// wxTopLevelWindowPalm showing
167// ----------------------------------------------------------------------------
168
169void wxTopLevelWindowPalm::DoShowWindow(int nShowCmd)
170{
171}
172
173bool wxTopLevelWindowPalm::Show(bool show)
174{
175 FrmDrawForm(FrameForm);
176
177 wxPaintEvent event(m_windowId);
178 event.SetEventObject(this);
179 GetEventHandler()->ProcessEvent(event);
180
181 return true;
182}
183
184// ----------------------------------------------------------------------------
185// wxTopLevelWindowPalm maximize/minimize
186// ----------------------------------------------------------------------------
187
188void wxTopLevelWindowPalm::Maximize(bool maximize)
189{
190}
191
192bool wxTopLevelWindowPalm::IsMaximized() const
193{
194 return false;
195}
196
197void wxTopLevelWindowPalm::Iconize(bool iconize)
198{
199}
200
201bool wxTopLevelWindowPalm::IsIconized() const
202{
203 return false;
204}
205
206void wxTopLevelWindowPalm::Restore()
207{
208}
209
210// ----------------------------------------------------------------------------
211// wxTopLevelWindowPalm fullscreen
212// ----------------------------------------------------------------------------
213
214bool wxTopLevelWindowPalm::ShowFullScreen(bool show, long style)
215{
216 return false;
217}
218
219// ----------------------------------------------------------------------------
220// wxTopLevelWindowPalm misc
221// ----------------------------------------------------------------------------
222
223void wxTopLevelWindowPalm::SetIcon(const wxIcon& icon)
224{
225}
226
227void wxTopLevelWindowPalm::SetIcons(const wxIconBundle& icons)
228{
229}
230
231bool wxTopLevelWindowPalm::EnableCloseButton(bool enable)
232{
233 return false;
234}
235
236#ifndef __WXWINCE__
237
238bool wxTopLevelWindowPalm::SetShape(const wxRegion& region)
239{
240 return false;
241}
242
243#endif // !__WXWINCE__
244
245// ----------------------------------------------------------------------------
246// wxTopLevelWindow event handling
247// ----------------------------------------------------------------------------
248
249void wxTopLevelWindowPalm::OnActivate(wxActivateEvent& event)
250{
251}
252
253/* Palm OS Event handler for the window
254 *
255 * This function *must* be located outside of the wxTopLevelWindow class because
256 * the Palm OS API expects a standalone C function as a callback. You cannot
257 * pass a pointer to a member function of a C++ class as a callback because the
258 * prototypes don't match. (A member function has a hidden "this" pointer as
259 * its first parameter).
260 *
261 * This event handler uses a global pointer to the current wxFrame to process
262 * the events generated by the Palm OS form API. I know this is ugly, but right
263 * now I can't think of any other way to deal with this problem. If someone
264 * finds a better solution, please let me know. My email address is
265 * wbo@freeshell.org
266 */
267static Boolean FrameFormHandleEvent(EventType* pEvent)
268{
269 Boolean fHandled = false;
270 FormType* pForm;
271 WinHandle hWindow;
272 int ItemID=0;
273
274 switch (pEvent->eType) {
275 case ctlSelectEvent:
276 break;
277#if wxUSE_MENUS_NATIVE
278 case menuOpenEvent:
279 fHandled=ActiveParentFrame->HandleMenuOpen();
280 break;
281 case menuEvent:
282 ItemID=pEvent->data.menu.itemID;
283 fHandled=ActiveParentFrame->HandleMenuSelect(ItemID);
284 break;
285#endif
286 default:
287 break;
288 }
289
290 return fHandled;
291}