]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/frame.cpp
1. added SetSelection() to wxItemContainer and removed its declarations
[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)
73 EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
9b5d7dfc 74 EVT_PAINT(wxFrame::OnPaint)
ffecfa5a
JS
75END_EVENT_TABLE()
76
77#if wxUSE_EXTENDED_RTTI
78WX_DEFINE_FLAGS( wxFrameStyle )
79
80wxBEGIN_FLAGS( wxFrameStyle )
81 // new style border flags, we put them first to
82 // use them for streaming out
83 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
84 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
85 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
86 wxFLAGS_MEMBER(wxBORDER_RAISED)
87 wxFLAGS_MEMBER(wxBORDER_STATIC)
88 wxFLAGS_MEMBER(wxBORDER_NONE)
9b5d7dfc 89
ffecfa5a
JS
90 // old style border flags
91 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
92 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
93 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
94 wxFLAGS_MEMBER(wxRAISED_BORDER)
95 wxFLAGS_MEMBER(wxSTATIC_BORDER)
96 wxFLAGS_MEMBER(wxBORDER)
97
98 // standard window styles
99 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
100 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
101 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
102 wxFLAGS_MEMBER(wxWANTS_CHARS)
103 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
104 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
105 wxFLAGS_MEMBER(wxVSCROLL)
106 wxFLAGS_MEMBER(wxHSCROLL)
107
108 // frame styles
109 wxFLAGS_MEMBER(wxSTAY_ON_TOP)
110 wxFLAGS_MEMBER(wxCAPTION)
111 wxFLAGS_MEMBER(wxTHICK_FRAME)
112 wxFLAGS_MEMBER(wxSYSTEM_MENU)
113 wxFLAGS_MEMBER(wxRESIZE_BORDER)
114 wxFLAGS_MEMBER(wxRESIZE_BOX)
115 wxFLAGS_MEMBER(wxCLOSE_BOX)
116 wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
117 wxFLAGS_MEMBER(wxMINIMIZE_BOX)
118
119 wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW)
120 wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT)
121
122 wxFLAGS_MEMBER(wxFRAME_SHAPED)
123
124wxEND_FLAGS( wxFrameStyle )
125
126IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h")
127
128wxBEGIN_PROPERTIES_TABLE(wxFrame)
129 wxEVENT_PROPERTY( Menu , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
130
131 wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
132 wxPROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
133 wxPROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
134wxEND_PROPERTIES_TABLE()
135
136wxBEGIN_HANDLERS_TABLE(wxFrame)
137wxEND_HANDLERS_TABLE()
138
9b5d7dfc 139wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle)
ffecfa5a
JS
140
141#else
142IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
143#endif
144
145// ============================================================================
146// implementation
147// ============================================================================
148
ffecfa5a
JS
149// ----------------------------------------------------------------------------
150// creation/destruction
151// ----------------------------------------------------------------------------
152
153void wxFrame::Init()
154{
ffecfa5a
JS
155}
156
157bool wxFrame::Create(wxWindow *parent,
158 wxWindowID id,
159 const wxString& title,
160 const wxPoint& pos,
161 const wxSize& size,
162 long style,
163 const wxString& name)
164{
db101bd3 165 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
ffecfa5a 166 return false;
9b5d7dfc 167
ffecfa5a
JS
168 return true;
169}
170
171wxFrame::~wxFrame()
172{
173}
174
175// ----------------------------------------------------------------------------
176// wxFrame client size calculations
177// ----------------------------------------------------------------------------
178
179void wxFrame::DoSetClientSize(int width, int height)
180{
181}
182
183// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
184void wxFrame::DoGetClientSize(int *x, int *y) const
185{
be4e4e27
WS
186 wxSize size = GetSize();
187 wxPoint pos = GetClientAreaOrigin();
188 *x = size.x - pos.x - 1;
189 *y = size.y - pos.y - 1;
ffecfa5a
JS
190}
191
192// ----------------------------------------------------------------------------
193// wxFrame: various geometry-related functions
194// ----------------------------------------------------------------------------
195
196void wxFrame::Raise()
197{
198}
199
ffecfa5a
JS
200#if wxUSE_MENUS_NATIVE
201
ffecfa5a
JS
202void wxFrame::InternalSetMenuBar()
203{
204}
205
206bool wxFrame::HandleMenuOpen()
207{
208 if(!m_frameMenuBar)
209 return false;
9b5d7dfc 210
ffecfa5a
JS
211 m_frameMenuBar->LoadMenu();
212 return true;
213}
214
a152561c 215bool wxFrame::HandleMenuSelect(EventType* event)
ffecfa5a 216{
a152561c
WS
217 int ItemID = event->data.menu.itemID;
218
ffecfa5a
JS
219 if (!m_frameMenuBar)
220 return false;
221
222 int item=m_frameMenuBar->ProcessCommand(ItemID);
223 if(item==-1)
224 return false;
225
226 wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item);
227 commandEvent.SetEventObject(this);
9b5d7dfc 228
ffecfa5a 229 GetEventHandler()->ProcessEvent(commandEvent);
9b5d7dfc 230 return true;
ffecfa5a
JS
231}
232
233#endif // wxUSE_MENUS_NATIVE
234
235// Responds to colour changes, and passes event on to children.
236void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
237{
238}
239
240void wxFrame::OnPaint(wxPaintEvent& event)
241{
9b5d7dfc
VZ
242#if wxUSE_STATUSBAR
243 if( m_frameStatusBar )
244 m_frameStatusBar->DrawStatusBar();
245#endif // wxUSE_STATUSBAR
ffecfa5a 246}
9b5d7dfc 247
db101bd3 248// Pass true to show full screen, false to restore.
ffecfa5a
JS
249bool wxFrame::ShowFullScreen(bool show, long style)
250{
251 return false;
252}
253
254// ----------------------------------------------------------------------------
255// tool/status bar stuff
256// ----------------------------------------------------------------------------
257
258#if wxUSE_TOOLBAR
259
260wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
261{
262 return NULL;
263}
264
265void wxFrame::PositionToolBar()
266{
267}
268
269#endif // wxUSE_TOOLBAR
270
271// ----------------------------------------------------------------------------
272// frame state (iconized/maximized/...)
273// ----------------------------------------------------------------------------
274
275// propagate our state change to all child frames: this allows us to emulate X
276// Windows behaviour where child frames float independently of the parent one
277// on the desktop, but are iconized/restored with it
278void wxFrame::IconizeChildFrames(bool bIconize)
279{
280}
281
ffecfa5a
JS
282// ===========================================================================
283// message processing
284// ===========================================================================
285
ffecfa5a
JS
286// ---------------------------------------------------------------------------
287// our private (non virtual) message handlers
288// ---------------------------------------------------------------------------
289
290bool wxFrame::HandlePaint()
291{
292 return false;
293}
294
295bool wxFrame::HandleSize(int x, int y, WXUINT id)
296{
297 return false;
298}
299
ffecfa5a
JS
300// ----------------------------------------------------------------------------
301// wxFrame size management: we exclude the areas taken by menu/status/toolbars
302// from the client area, so the client area is what's really available for the
303// frame contents
304// ----------------------------------------------------------------------------
305
306// get the origin of the client area in the client coordinates
307wxPoint wxFrame::GetClientAreaOrigin() const
308{
f241653c
WS
309 // there is no API to get client area but we know
310 // it starts after titlebar and 1 pixel of form border
311 Coord maxY = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y),
312 X = 1,
313 Y = 0;
314 while ( Y < maxY )
315 {
316 if(!FrmPointInTitle(GetForm(),X,Y))
317 return wxPoint(X,Y+1);
318 Y++;
319 }
320
321 return wxPoint(X,0);
ffecfa5a 322}