]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/palmos/frame.cpp
Round the values in wxDC coordinate calculations.
[wxWidgets.git] / src / palmos / frame.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/frame.cpp
3// Purpose: wxFrame
4// Author: William Osborne - minimal working wxPalmOS port
5// Modified by: Wlodzimierz ABX Skiba - more than minimal functionality
6// Created: 10/13/04
7// RCS-ID: $Id$
8// Copyright: (c) William Osborne, Wlodzimierz Skiba
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#include "wx/frame.h"
28
29#ifndef WX_PRECOMP
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"
38 #include "wx/log.h"
39 #include "wx/toolbar.h"
40 #include "wx/statusbr.h"
41 #include "wx/menuitem.h"
42#endif // WX_PRECOMP
43
44#ifdef __WXUNIVERSAL__
45 #include "wx/univ/theme.h"
46 #include "wx/univ/colschem.h"
47#endif // __WXUNIVERSAL__
48
49#include <Event.h>
50#include <Form.h>
51
52// ----------------------------------------------------------------------------
53// globals
54// ----------------------------------------------------------------------------
55
56#if wxUSE_MENUS_NATIVE
57 extern wxMenu *wxCurrentPopupMenu;
58#endif // wxUSE_MENUS_NATIVE
59
60// ----------------------------------------------------------------------------
61// event tables
62// ----------------------------------------------------------------------------
63
64BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
65 EVT_PAINT(wxFrame::OnPaint)
66END_EVENT_TABLE()
67
68// ============================================================================
69// implementation
70// ============================================================================
71
72// ----------------------------------------------------------------------------
73// creation/destruction
74// ----------------------------------------------------------------------------
75
76void wxFrame::Init()
77{
78}
79
80bool wxFrame::Create(wxWindow *parent,
81 wxWindowID id,
82 const wxString& title,
83 const wxPoint& pos,
84 const wxSize& size,
85 long style,
86 const wxString& name)
87{
88 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
89 return false;
90
91 return true;
92}
93
94wxFrame::~wxFrame()
95{
96}
97
98// ----------------------------------------------------------------------------
99// wxFrame client size calculations
100// ----------------------------------------------------------------------------
101
102void wxFrame::DoSetClientSize(int width, int height)
103{
104}
105
106// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
107void wxFrame::DoGetClientSize(int *x, int *y) const
108{
109 wxSize size = GetSize();
110 wxPoint pos = GetClientAreaOrigin();
111 *x = size.x - pos.x - 1;
112 *y = size.y - pos.y - 1;
113}
114
115// ----------------------------------------------------------------------------
116// wxFrame: various geometry-related functions
117// ----------------------------------------------------------------------------
118
119void wxFrame::Raise()
120{
121}
122
123#if wxUSE_MENUS_NATIVE
124
125void wxFrame::InternalSetMenuBar()
126{
127}
128
129bool wxFrame::HandleMenuOpen()
130{
131 if(!m_frameMenuBar)
132 return false;
133
134 m_frameMenuBar->LoadMenu();
135 return true;
136}
137
138bool wxFrame::HandleMenuSelect(WXEVENTPTR event)
139{
140 const EventType *palmEvent = (EventType *)event;
141 const int ItemID = palmEvent->data.menu.itemID;
142
143 if (!m_frameMenuBar)
144 return false;
145
146 const int item = m_frameMenuBar->ProcessCommand(ItemID);
147 if (item==-1)
148 return false;
149
150 wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item);
151 commandEvent.SetEventObject(this);
152
153 HandleWindowEvent(commandEvent);
154 return true;
155}
156
157#endif // wxUSE_MENUS_NATIVE
158
159void wxFrame::OnPaint(wxPaintEvent& event)
160{
161#if wxUSE_STATUSBAR
162 if( m_frameStatusBar )
163 m_frameStatusBar->DrawStatusBar();
164#endif // wxUSE_STATUSBAR
165}
166
167// Pass true to show full screen, false to restore.
168bool wxFrame::ShowFullScreen(bool show, long style)
169{
170 return false;
171}
172
173// ----------------------------------------------------------------------------
174// tool/status bar stuff
175// ----------------------------------------------------------------------------
176
177#if wxUSE_TOOLBAR
178
179wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
180{
181 return NULL;
182}
183
184void wxFrame::PositionToolBar()
185{
186}
187
188#endif // wxUSE_TOOLBAR
189
190// ----------------------------------------------------------------------------
191// frame state (iconized/maximized/...)
192// ----------------------------------------------------------------------------
193
194// propagate our state change to all child frames: this allows us to emulate X
195// Windows behaviour where child frames float independently of the parent one
196// on the desktop, but are iconized/restored with it
197void wxFrame::IconizeChildFrames(bool bIconize)
198{
199}
200
201// ----------------------------------------------------------------------------
202// wxFrame size management: we exclude the areas taken by menu/status/toolbars
203// from the client area, so the client area is what's really available for the
204// frame contents
205// ----------------------------------------------------------------------------
206
207// get the origin of the client area in the client coordinates
208wxPoint wxFrame::GetClientAreaOrigin() const
209{
210 // there is no API to get client area but we know
211 // it starts after titlebar and 1 pixel of form border
212 Coord maxY = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y),
213 X = 1,
214 Y = 0;
215 while ( Y < maxY )
216 {
217 if(!FrmPointInTitle((FormType*)GetForm(),X,Y))
218 return wxPoint(X,Y+1);
219 Y++;
220 }
221
222 return wxPoint(X,0);
223}