]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/frame.cpp
Test for x, y in GetPosition
[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
20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "frame.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/frame.h"
33 #include "wx/app.h"
34 #include "wx/menu.h"
35 #include "wx/utils.h"
36 #include "wx/dialog.h"
37 #include "wx/settings.h"
38 #include "wx/dcclient.h"
39 #include "wx/mdi.h"
40 #include "wx/panel.h"
41#endif // WX_PRECOMP
42
43#if wxUSE_STATUSBAR
44 #include "wx/statusbr.h"
45 #include "wx/generic/statusbr.h"
46#endif // wxUSE_STATUSBAR
47
48#if wxUSE_TOOLBAR
49 #include "wx/toolbar.h"
50#endif // wxUSE_TOOLBAR
51
52#include "wx/menuitem.h"
53#include "wx/log.h"
54
55#ifdef __WXUNIVERSAL__
56 #include "wx/univ/theme.h"
57 #include "wx/univ/colschem.h"
58#endif // __WXUNIVERSAL__
59
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)
110 wxFLAGS_MEMBER(wxTHICK_FRAME)
111 wxFLAGS_MEMBER(wxSYSTEM_MENU)
112 wxFLAGS_MEMBER(wxRESIZE_BORDER)
113 wxFLAGS_MEMBER(wxRESIZE_BOX)
114 wxFLAGS_MEMBER(wxCLOSE_BOX)
115 wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
116 wxFLAGS_MEMBER(wxMINIMIZE_BOX)
117
118 wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW)
119 wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT)
120
121 wxFLAGS_MEMBER(wxFRAME_SHAPED)
122
123wxEND_FLAGS( wxFrameStyle )
124
125IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h")
126
127wxBEGIN_PROPERTIES_TABLE(wxFrame)
128 wxEVENT_PROPERTY( Menu , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
129
130 wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
131 wxPROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
132 wxPROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
133wxEND_PROPERTIES_TABLE()
134
135wxBEGIN_HANDLERS_TABLE(wxFrame)
136wxEND_HANDLERS_TABLE()
137
9b5d7dfc 138wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle)
ffecfa5a
JS
139
140#else
141IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
142#endif
143
144// ============================================================================
145// implementation
146// ============================================================================
147
ffecfa5a
JS
148// ----------------------------------------------------------------------------
149// creation/destruction
150// ----------------------------------------------------------------------------
151
152void wxFrame::Init()
153{
ffecfa5a
JS
154}
155
156bool wxFrame::Create(wxWindow *parent,
157 wxWindowID id,
158 const wxString& title,
159 const wxPoint& pos,
160 const wxSize& size,
161 long style,
162 const wxString& name)
163{
db101bd3 164 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
ffecfa5a 165 return false;
9b5d7dfc 166
ffecfa5a
JS
167 return true;
168}
169
170wxFrame::~wxFrame()
171{
172}
173
174// ----------------------------------------------------------------------------
175// wxFrame client size calculations
176// ----------------------------------------------------------------------------
177
178void wxFrame::DoSetClientSize(int width, int height)
179{
180}
181
182// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
183void wxFrame::DoGetClientSize(int *x, int *y) const
184{
be4e4e27
WS
185 wxSize size = GetSize();
186 wxPoint pos = GetClientAreaOrigin();
187 *x = size.x - pos.x - 1;
188 *y = size.y - pos.y - 1;
ffecfa5a
JS
189}
190
191// ----------------------------------------------------------------------------
192// wxFrame: various geometry-related functions
193// ----------------------------------------------------------------------------
194
195void wxFrame::Raise()
196{
197}
198
ffecfa5a
JS
199#if wxUSE_MENUS_NATIVE
200
ffecfa5a
JS
201void wxFrame::InternalSetMenuBar()
202{
203}
204
205bool wxFrame::HandleMenuOpen()
206{
207 if(!m_frameMenuBar)
208 return false;
9b5d7dfc 209
ffecfa5a
JS
210 m_frameMenuBar->LoadMenu();
211 return true;
212}
213
a152561c 214bool wxFrame::HandleMenuSelect(EventType* event)
ffecfa5a 215{
a152561c
WS
216 int ItemID = event->data.menu.itemID;
217
ffecfa5a
JS
218 if (!m_frameMenuBar)
219 return false;
220
221 int item=m_frameMenuBar->ProcessCommand(ItemID);
222 if(item==-1)
223 return false;
224
225 wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item);
226 commandEvent.SetEventObject(this);
9b5d7dfc 227
ffecfa5a 228 GetEventHandler()->ProcessEvent(commandEvent);
9b5d7dfc 229 return true;
ffecfa5a
JS
230}
231
232#endif // wxUSE_MENUS_NATIVE
233
ffecfa5a
JS
234void wxFrame::OnPaint(wxPaintEvent& event)
235{
9b5d7dfc
VZ
236#if wxUSE_STATUSBAR
237 if( m_frameStatusBar )
238 m_frameStatusBar->DrawStatusBar();
239#endif // wxUSE_STATUSBAR
ffecfa5a 240}
9b5d7dfc 241
db101bd3 242// Pass true to show full screen, false to restore.
ffecfa5a
JS
243bool wxFrame::ShowFullScreen(bool show, long style)
244{
245 return false;
246}
247
248// ----------------------------------------------------------------------------
249// tool/status bar stuff
250// ----------------------------------------------------------------------------
251
252#if wxUSE_TOOLBAR
253
254wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
255{
256 return NULL;
257}
258
259void wxFrame::PositionToolBar()
260{
261}
262
263#endif // wxUSE_TOOLBAR
264
265// ----------------------------------------------------------------------------
266// frame state (iconized/maximized/...)
267// ----------------------------------------------------------------------------
268
269// propagate our state change to all child frames: this allows us to emulate X
270// Windows behaviour where child frames float independently of the parent one
271// on the desktop, but are iconized/restored with it
272void wxFrame::IconizeChildFrames(bool bIconize)
273{
274}
275
ffecfa5a
JS
276// ----------------------------------------------------------------------------
277// wxFrame size management: we exclude the areas taken by menu/status/toolbars
278// from the client area, so the client area is what's really available for the
279// frame contents
280// ----------------------------------------------------------------------------
281
282// get the origin of the client area in the client coordinates
283wxPoint wxFrame::GetClientAreaOrigin() const
284{
f241653c
WS
285 // there is no API to get client area but we know
286 // it starts after titlebar and 1 pixel of form border
287 Coord maxY = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y),
288 X = 1,
289 Y = 0;
290 while ( Y < maxY )
291 {
292 if(!FrmPointInTitle(GetForm(),X,Y))
293 return wxPoint(X,Y+1);
294 Y++;
295 }
296
297 return wxPoint(X,0);
ffecfa5a 298}