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"
32 #include "wx/dialog.h"
33 #include "wx/settings.h"
34 #include "wx/dcclient.h"
40 #include "wx/statusbr.h"
41 #include "wx/generic/statusbr.h"
42 #endif // wxUSE_STATUSBAR
45 #include "wx/toolbar.h"
46 #endif // wxUSE_TOOLBAR
48 #include "wx/menuitem.h"
51 #ifdef __WXUNIVERSAL__
52 #include "wx/univ/theme.h"
53 #include "wx/univ/colschem.h"
54 #endif // __WXUNIVERSAL__
59 // ----------------------------------------------------------------------------
61 // ----------------------------------------------------------------------------
63 #if wxUSE_MENUS_NATIVE
64 extern wxMenu
*wxCurrentPopupMenu
;
65 #endif // wxUSE_MENUS_NATIVE
67 // ----------------------------------------------------------------------------
69 // ----------------------------------------------------------------------------
71 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
72 EVT_PAINT(wxFrame::OnPaint
)
75 #if wxUSE_EXTENDED_RTTI
76 WX_DEFINE_FLAGS( wxFrameStyle
)
78 wxBEGIN_FLAGS( wxFrameStyle
)
79 // new style border flags, we put them first to
80 // use them for streaming out
81 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
82 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
83 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
84 wxFLAGS_MEMBER(wxBORDER_RAISED
)
85 wxFLAGS_MEMBER(wxBORDER_STATIC
)
86 wxFLAGS_MEMBER(wxBORDER_NONE
)
88 // old style border flags
89 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
90 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
91 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
92 wxFLAGS_MEMBER(wxRAISED_BORDER
)
93 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
94 wxFLAGS_MEMBER(wxBORDER
)
96 // standard window styles
97 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
98 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
99 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
100 wxFLAGS_MEMBER(wxWANTS_CHARS
)
101 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
102 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
103 wxFLAGS_MEMBER(wxVSCROLL
)
104 wxFLAGS_MEMBER(wxHSCROLL
)
107 wxFLAGS_MEMBER(wxSTAY_ON_TOP
)
108 wxFLAGS_MEMBER(wxCAPTION
)
109 #if WXWIN_COMPATIBILITY_2_6
110 wxFLAGS_MEMBER(wxTHICK_FRAME
)
111 #endif // WXWIN_COMPATIBILITY_2_6
112 wxFLAGS_MEMBER(wxSYSTEM_MENU
)
113 wxFLAGS_MEMBER(wxRESIZE_BORDER
)
114 #if WXWIN_COMPATIBILITY_2_6
115 wxFLAGS_MEMBER(wxRESIZE_BOX
)
116 #endif // WXWIN_COMPATIBILITY_2_6
117 wxFLAGS_MEMBER(wxCLOSE_BOX
)
118 wxFLAGS_MEMBER(wxMAXIMIZE_BOX
)
119 wxFLAGS_MEMBER(wxMINIMIZE_BOX
)
121 wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW
)
122 wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT
)
124 wxFLAGS_MEMBER(wxFRAME_SHAPED
)
126 wxEND_FLAGS( wxFrameStyle
)
128 IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame
, wxTopLevelWindow
,"wx/frame.h")
130 wxBEGIN_PROPERTIES_TABLE(wxFrame
)
131 wxEVENT_PROPERTY( Menu
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEvent
)
133 wxPROPERTY( Title
,wxString
, SetTitle
, GetTitle
, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
134 wxPROPERTY_FLAGS( WindowStyle
, wxFrameStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
135 wxPROPERTY( MenuBar
, wxMenuBar
* , SetMenuBar
, GetMenuBar
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
136 wxEND_PROPERTIES_TABLE()
138 wxBEGIN_HANDLERS_TABLE(wxFrame
)
139 wxEND_HANDLERS_TABLE()
141 wxCONSTRUCTOR_6( wxFrame
, wxWindow
* , Parent
, wxWindowID
, Id
, wxString
, Title
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
144 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxTopLevelWindow
)
147 // ============================================================================
149 // ============================================================================
151 // ----------------------------------------------------------------------------
152 // creation/destruction
153 // ----------------------------------------------------------------------------
159 bool wxFrame::Create(wxWindow
*parent
,
161 const wxString
& title
,
165 const wxString
& name
)
167 if ( !wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
) )
177 // ----------------------------------------------------------------------------
178 // wxFrame client size calculations
179 // ----------------------------------------------------------------------------
181 void wxFrame::DoSetClientSize(int width
, int height
)
185 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
186 void wxFrame::DoGetClientSize(int *x
, int *y
) const
188 wxSize size
= GetSize();
189 wxPoint pos
= GetClientAreaOrigin();
190 *x
= size
.x
- pos
.x
- 1;
191 *y
= size
.y
- pos
.y
- 1;
194 // ----------------------------------------------------------------------------
195 // wxFrame: various geometry-related functions
196 // ----------------------------------------------------------------------------
198 void wxFrame::Raise()
202 #if wxUSE_MENUS_NATIVE
204 void wxFrame::InternalSetMenuBar()
208 bool wxFrame::HandleMenuOpen()
213 m_frameMenuBar
->LoadMenu();
217 bool wxFrame::HandleMenuSelect(WXEVENTPTR event
)
219 const EventType
*palmEvent
= (EventType
*)event
;
220 const int ItemID
= palmEvent
->data
.menu
.itemID
;
225 const int item
= m_frameMenuBar
->ProcessCommand(ItemID
);
229 wxCommandEvent
commandEvent(wxEVT_COMMAND_MENU_SELECTED
, item
);
230 commandEvent
.SetEventObject(this);
232 GetEventHandler()->ProcessEvent(commandEvent
);
236 #endif // wxUSE_MENUS_NATIVE
238 void wxFrame::OnPaint(wxPaintEvent
& event
)
241 if( m_frameStatusBar
)
242 m_frameStatusBar
->DrawStatusBar();
243 #endif // wxUSE_STATUSBAR
246 // Pass true to show full screen, false to restore.
247 bool wxFrame::ShowFullScreen(bool show
, long style
)
252 // ----------------------------------------------------------------------------
253 // tool/status bar stuff
254 // ----------------------------------------------------------------------------
258 wxToolBar
* wxFrame::CreateToolBar(long style
, wxWindowID id
, const wxString
& name
)
263 void wxFrame::PositionToolBar()
267 #endif // wxUSE_TOOLBAR
269 // ----------------------------------------------------------------------------
270 // frame state (iconized/maximized/...)
271 // ----------------------------------------------------------------------------
273 // propagate our state change to all child frames: this allows us to emulate X
274 // Windows behaviour where child frames float independently of the parent one
275 // on the desktop, but are iconized/restored with it
276 void wxFrame::IconizeChildFrames(bool bIconize
)
280 // ----------------------------------------------------------------------------
281 // wxFrame size management: we exclude the areas taken by menu/status/toolbars
282 // from the client area, so the client area is what's really available for the
284 // ----------------------------------------------------------------------------
286 // get the origin of the client area in the client coordinates
287 wxPoint
wxFrame::GetClientAreaOrigin() const
289 // there is no API to get client area but we know
290 // it starts after titlebar and 1 pixel of form border
291 Coord maxY
= wxSystemSettings::GetMetric(wxSYS_SCREEN_Y
),
296 if(!FrmPointInTitle((FormType
*)GetForm(),X
,Y
))
297 return wxPoint(X
,Y
+1);