]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/frame.cpp
Build fix for motif.
[wxWidgets.git] / src / palmos / frame.cpp
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/frame.cpp
ffecfa5a 3// Purpose: wxFrame
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
db101bd3 5// Modified by: Wlodzimierz ABX Skiba - more than minimal functionality
ffecfa5a 6// Created: 10/13/04
e2731512 7// RCS-ID: $Id$
db101bd3 8// Copyright: (c) William Osborne, Wlodzimierz Skiba
ffecfa5a
JS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
ffecfa5a
JS
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
e4db172a
WS
27#include "wx/frame.h"
28
ffecfa5a 29#ifndef WX_PRECOMP
ffecfa5a
JS
30 #include "wx/app.h"
31 #include "wx/menu.h"
32 #include "wx/utils.h"
33 #include "wx/dialog.h"
34 #include "wx/settings.h"
35 #include "wx/dcclient.h"
36 #include "wx/mdi.h"
37 #include "wx/panel.h"
e4db172a 38 #include "wx/log.h"
ffecfa5a
JS
39#endif // WX_PRECOMP
40
41#if wxUSE_STATUSBAR
42 #include "wx/statusbr.h"
43 #include "wx/generic/statusbr.h"
44#endif // wxUSE_STATUSBAR
45
46#if wxUSE_TOOLBAR
47 #include "wx/toolbar.h"
48#endif // wxUSE_TOOLBAR
49
50#include "wx/menuitem.h"
ffecfa5a
JS
51
52#ifdef __WXUNIVERSAL__
53 #include "wx/univ/theme.h"
54 #include "wx/univ/colschem.h"
55#endif // __WXUNIVERSAL__
56
20bc5ad8
WS
57#include <Event.h>
58#include <Form.h>
59
ffecfa5a
JS
60// ----------------------------------------------------------------------------
61// globals
62// ----------------------------------------------------------------------------
63
64#if wxUSE_MENUS_NATIVE
65 extern wxMenu *wxCurrentPopupMenu;
66#endif // wxUSE_MENUS_NATIVE
67
68// ----------------------------------------------------------------------------
69// event tables
70// ----------------------------------------------------------------------------
71
72BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
9b5d7dfc 73 EVT_PAINT(wxFrame::OnPaint)
ffecfa5a
JS
74END_EVENT_TABLE()
75
76#if wxUSE_EXTENDED_RTTI
77WX_DEFINE_FLAGS( wxFrameStyle )
78
79wxBEGIN_FLAGS( wxFrameStyle )
80 // new style border flags, we put them first to
81 // use them for streaming out
82 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
83 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
84 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
85 wxFLAGS_MEMBER(wxBORDER_RAISED)
86 wxFLAGS_MEMBER(wxBORDER_STATIC)
87 wxFLAGS_MEMBER(wxBORDER_NONE)
9b5d7dfc 88
ffecfa5a
JS
89 // old style border flags
90 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
91 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
92 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
93 wxFLAGS_MEMBER(wxRAISED_BORDER)
94 wxFLAGS_MEMBER(wxSTATIC_BORDER)
95 wxFLAGS_MEMBER(wxBORDER)
96
97 // standard window styles
98 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
99 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
100 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
101 wxFLAGS_MEMBER(wxWANTS_CHARS)
102 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
103 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
104 wxFLAGS_MEMBER(wxVSCROLL)
105 wxFLAGS_MEMBER(wxHSCROLL)
106
107 // frame styles
108 wxFLAGS_MEMBER(wxSTAY_ON_TOP)
109 wxFLAGS_MEMBER(wxCAPTION)
1c067fe3 110#if WXWIN_COMPATIBILITY_2_6
ffecfa5a 111 wxFLAGS_MEMBER(wxTHICK_FRAME)
1c067fe3 112#endif // WXWIN_COMPATIBILITY_2_6
ffecfa5a
JS
113 wxFLAGS_MEMBER(wxSYSTEM_MENU)
114 wxFLAGS_MEMBER(wxRESIZE_BORDER)
1c067fe3 115#if WXWIN_COMPATIBILITY_2_6
ffecfa5a 116 wxFLAGS_MEMBER(wxRESIZE_BOX)
1c067fe3 117#endif // WXWIN_COMPATIBILITY_2_6
ffecfa5a
JS
118 wxFLAGS_MEMBER(wxCLOSE_BOX)
119 wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
120 wxFLAGS_MEMBER(wxMINIMIZE_BOX)
121
122 wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW)
123 wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT)
124
125 wxFLAGS_MEMBER(wxFRAME_SHAPED)
126
127wxEND_FLAGS( wxFrameStyle )
128
129IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h")
130
131wxBEGIN_PROPERTIES_TABLE(wxFrame)
132 wxEVENT_PROPERTY( Menu , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
133
134 wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
135 wxPROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
136 wxPROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
137wxEND_PROPERTIES_TABLE()
138
139wxBEGIN_HANDLERS_TABLE(wxFrame)
140wxEND_HANDLERS_TABLE()
141
9b5d7dfc 142wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle)
ffecfa5a
JS
143
144#else
145IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
146#endif
147
148// ============================================================================
149// implementation
150// ============================================================================
151
ffecfa5a
JS
152// ----------------------------------------------------------------------------
153// creation/destruction
154// ----------------------------------------------------------------------------
155
156void wxFrame::Init()
157{
ffecfa5a
JS
158}
159
160bool wxFrame::Create(wxWindow *parent,
161 wxWindowID id,
162 const wxString& title,
163 const wxPoint& pos,
164 const wxSize& size,
165 long style,
166 const wxString& name)
167{
db101bd3 168 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
ffecfa5a 169 return false;
9b5d7dfc 170
ffecfa5a
JS
171 return true;
172}
173
174wxFrame::~wxFrame()
175{
176}
177
178// ----------------------------------------------------------------------------
179// wxFrame client size calculations
180// ----------------------------------------------------------------------------
181
182void wxFrame::DoSetClientSize(int width, int height)
183{
184}
185
186// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
187void wxFrame::DoGetClientSize(int *x, int *y) const
188{
be4e4e27
WS
189 wxSize size = GetSize();
190 wxPoint pos = GetClientAreaOrigin();
191 *x = size.x - pos.x - 1;
192 *y = size.y - pos.y - 1;
ffecfa5a
JS
193}
194
195// ----------------------------------------------------------------------------
196// wxFrame: various geometry-related functions
197// ----------------------------------------------------------------------------
198
199void wxFrame::Raise()
200{
201}
202
ffecfa5a
JS
203#if wxUSE_MENUS_NATIVE
204
ffecfa5a
JS
205void wxFrame::InternalSetMenuBar()
206{
207}
208
209bool wxFrame::HandleMenuOpen()
210{
211 if(!m_frameMenuBar)
212 return false;
9b5d7dfc 213
ffecfa5a
JS
214 m_frameMenuBar->LoadMenu();
215 return true;
216}
217
20bc5ad8 218bool wxFrame::HandleMenuSelect(WXEVENTPTR event)
ffecfa5a 219{
20bc5ad8
WS
220 const EventType *palmEvent = (EventType *)event;
221 const int ItemID = palmEvent->data.menu.itemID;
a152561c 222
ffecfa5a
JS
223 if (!m_frameMenuBar)
224 return false;
225
20bc5ad8
WS
226 const int item = m_frameMenuBar->ProcessCommand(ItemID);
227 if (item==-1)
ffecfa5a
JS
228 return false;
229
230 wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item);
231 commandEvent.SetEventObject(this);
9b5d7dfc 232
ffecfa5a 233 GetEventHandler()->ProcessEvent(commandEvent);
9b5d7dfc 234 return true;
ffecfa5a
JS
235}
236
237#endif // wxUSE_MENUS_NATIVE
238
ffecfa5a
JS
239void wxFrame::OnPaint(wxPaintEvent& event)
240{
9b5d7dfc
VZ
241#if wxUSE_STATUSBAR
242 if( m_frameStatusBar )
243 m_frameStatusBar->DrawStatusBar();
244#endif // wxUSE_STATUSBAR
ffecfa5a 245}
9b5d7dfc 246
db101bd3 247// Pass true to show full screen, false to restore.
ffecfa5a
JS
248bool wxFrame::ShowFullScreen(bool show, long style)
249{
250 return false;
251}
252
253// ----------------------------------------------------------------------------
254// tool/status bar stuff
255// ----------------------------------------------------------------------------
256
257#if wxUSE_TOOLBAR
258
259wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
260{
261 return NULL;
262}
263
264void wxFrame::PositionToolBar()
265{
266}
267
268#endif // wxUSE_TOOLBAR
269
270// ----------------------------------------------------------------------------
271// frame state (iconized/maximized/...)
272// ----------------------------------------------------------------------------
273
274// propagate our state change to all child frames: this allows us to emulate X
275// Windows behaviour where child frames float independently of the parent one
276// on the desktop, but are iconized/restored with it
277void wxFrame::IconizeChildFrames(bool bIconize)
278{
279}
280
ffecfa5a
JS
281// ----------------------------------------------------------------------------
282// wxFrame size management: we exclude the areas taken by menu/status/toolbars
283// from the client area, so the client area is what's really available for the
284// frame contents
285// ----------------------------------------------------------------------------
286
287// get the origin of the client area in the client coordinates
288wxPoint wxFrame::GetClientAreaOrigin() const
289{
f241653c
WS
290 // there is no API to get client area but we know
291 // it starts after titlebar and 1 pixel of form border
292 Coord maxY = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y),
293 X = 1,
294 Y = 0;
295 while ( Y < maxY )
296 {
20bc5ad8 297 if(!FrmPointInTitle((FormType*)GetForm(),X,Y))
f241653c
WS
298 return wxPoint(X,Y+1);
299 Y++;
300 }
301
302 return wxPoint(X,0);
ffecfa5a 303}