1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/frame.cpp
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Wlodzimierz ABX Skiba - more than minimal functionality
8 // Copyright: (c) William Osborne, Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
33 #include "wx/dialog.h"
34 #include "wx/settings.h"
35 #include "wx/dcclient.h"
39 #include "wx/toolbar.h"
40 #include "wx/statusbr.h"
41 #include "wx/menuitem.h"
44 #ifdef __WXUNIVERSAL__
45 #include "wx/univ/theme.h"
46 #include "wx/univ/colschem.h"
47 #endif // __WXUNIVERSAL__
52 // ----------------------------------------------------------------------------
54 // ----------------------------------------------------------------------------
56 #if wxUSE_MENUS_NATIVE
57 extern wxMenu
*wxCurrentPopupMenu
;
58 #endif // wxUSE_MENUS_NATIVE
60 // ----------------------------------------------------------------------------
62 // ----------------------------------------------------------------------------
64 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
65 EVT_PAINT(wxFrame::OnPaint
)
68 // ============================================================================
70 // ============================================================================
72 // ----------------------------------------------------------------------------
73 // creation/destruction
74 // ----------------------------------------------------------------------------
80 bool wxFrame::Create(wxWindow
*parent
,
82 const wxString
& title
,
88 if ( !wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
) )
98 // ----------------------------------------------------------------------------
99 // wxFrame client size calculations
100 // ----------------------------------------------------------------------------
102 void wxFrame::DoSetClientSize(int width
, int height
)
106 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
107 void wxFrame::DoGetClientSize(int *x
, int *y
) const
109 wxSize size
= GetSize();
110 wxPoint pos
= GetClientAreaOrigin();
111 *x
= size
.x
- pos
.x
- 1;
112 *y
= size
.y
- pos
.y
- 1;
115 // ----------------------------------------------------------------------------
116 // wxFrame: various geometry-related functions
117 // ----------------------------------------------------------------------------
119 void wxFrame::Raise()
123 #if wxUSE_MENUS_NATIVE
125 void wxFrame::InternalSetMenuBar()
129 bool wxFrame::HandleMenuOpen()
134 m_frameMenuBar
->LoadMenu();
138 bool wxFrame::HandleMenuSelect(WXEVENTPTR event
)
140 const EventType
*palmEvent
= (EventType
*)event
;
141 const int ItemID
= palmEvent
->data
.menu
.itemID
;
146 const int item
= m_frameMenuBar
->ProcessCommand(ItemID
);
150 wxCommandEvent
commandEvent(wxEVT_COMMAND_MENU_SELECTED
, item
);
151 commandEvent
.SetEventObject(this);
153 HandleWindowEvent(commandEvent
);
157 #endif // wxUSE_MENUS_NATIVE
159 void wxFrame::OnPaint(wxPaintEvent
& event
)
162 if( m_frameStatusBar
)
163 m_frameStatusBar
->DrawStatusBar();
164 #endif // wxUSE_STATUSBAR
167 // Pass true to show full screen, false to restore.
168 bool wxFrame::ShowFullScreen(bool show
, long style
)
173 // ----------------------------------------------------------------------------
174 // tool/status bar stuff
175 // ----------------------------------------------------------------------------
179 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
184 void wxFrame::PositionToolBar()
188 #endif // wxUSE_TOOLBAR
190 // ----------------------------------------------------------------------------
191 // frame state (iconized/maximized/...)
192 // ----------------------------------------------------------------------------
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
197 void wxFrame::IconizeChildFrames(bool bIconize
)
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
205 // ----------------------------------------------------------------------------
207 // get the origin of the client area in the client coordinates
208 wxPoint
wxFrame::GetClientAreaOrigin() const
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
),
217 if(!FrmPointInTitle((FormType
*)GetForm(),X
,Y
))
218 return wxPoint(X
,Y
+1);