]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/frame.cpp
Fix the coordinates in wxDataViewCustomRenderer::LeftClick() in generic wxDVC.
[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"
4e3e485b 39 #include "wx/toolbar.h"
3304646d 40 #include "wx/statusbr.h"
25466131 41 #include "wx/menuitem.h"
ffecfa5a
JS
42#endif // WX_PRECOMP
43
ffecfa5a
JS
44#ifdef __WXUNIVERSAL__
45 #include "wx/univ/theme.h"
46 #include "wx/univ/colschem.h"
47#endif // __WXUNIVERSAL__
48
20bc5ad8
WS
49#include <Event.h>
50#include <Form.h>
51
ffecfa5a
JS
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)
9b5d7dfc 65 EVT_PAINT(wxFrame::OnPaint)
ffecfa5a
JS
66END_EVENT_TABLE()
67
ffecfa5a
JS
68// ============================================================================
69// implementation
70// ============================================================================
71
ffecfa5a
JS
72// ----------------------------------------------------------------------------
73// creation/destruction
74// ----------------------------------------------------------------------------
75
76void wxFrame::Init()
77{
ffecfa5a
JS
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{
db101bd3 88 if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
ffecfa5a 89 return false;
9b5d7dfc 90
ffecfa5a
JS
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{
be4e4e27
WS
109 wxSize size = GetSize();
110 wxPoint pos = GetClientAreaOrigin();
111 *x = size.x - pos.x - 1;
112 *y = size.y - pos.y - 1;
ffecfa5a
JS
113}
114
115// ----------------------------------------------------------------------------
116// wxFrame: various geometry-related functions
117// ----------------------------------------------------------------------------
118
119void wxFrame::Raise()
120{
121}
122
ffecfa5a
JS
123#if wxUSE_MENUS_NATIVE
124
ffecfa5a
JS
125void wxFrame::InternalSetMenuBar()
126{
127}
128
129bool wxFrame::HandleMenuOpen()
130{
131 if(!m_frameMenuBar)
132 return false;
9b5d7dfc 133
ffecfa5a
JS
134 m_frameMenuBar->LoadMenu();
135 return true;
136}
137
20bc5ad8 138bool wxFrame::HandleMenuSelect(WXEVENTPTR event)
ffecfa5a 139{
20bc5ad8
WS
140 const EventType *palmEvent = (EventType *)event;
141 const int ItemID = palmEvent->data.menu.itemID;
a152561c 142
ffecfa5a
JS
143 if (!m_frameMenuBar)
144 return false;
145
20bc5ad8
WS
146 const int item = m_frameMenuBar->ProcessCommand(ItemID);
147 if (item==-1)
ffecfa5a
JS
148 return false;
149
150 wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item);
151 commandEvent.SetEventObject(this);
9b5d7dfc 152
937013e0 153 HandleWindowEvent(commandEvent);
9b5d7dfc 154 return true;
ffecfa5a
JS
155}
156
157#endif // wxUSE_MENUS_NATIVE
158
ffecfa5a
JS
159void wxFrame::OnPaint(wxPaintEvent& event)
160{
9b5d7dfc
VZ
161#if wxUSE_STATUSBAR
162 if( m_frameStatusBar )
163 m_frameStatusBar->DrawStatusBar();
164#endif // wxUSE_STATUSBAR
ffecfa5a 165}
9b5d7dfc 166
db101bd3 167// Pass true to show full screen, false to restore.
ffecfa5a
JS
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
ffecfa5a
JS
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{
f241653c
WS
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 {
20bc5ad8 217 if(!FrmPointInTitle((FormType*)GetForm(),X,Y))
f241653c
WS
218 return wxPoint(X,Y+1);
219 Y++;
220 }
221
222 return wxPoint(X,0);
ffecfa5a 223}