wxFrame::wxFrame(void)
{
+ m_frameToolBar = NULL ;
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
// m_modalShowing = FALSE;
m_windowStyle = style;
m_frameMenuBar = NULL;
+ m_frameToolBar = NULL ;
m_frameStatusBar = NULL;
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
m_frameStatusBar->SetStatusText(text, number);
}
-void wxFrame::SetStatusWidths(int n, int *widths_field)
+void wxFrame::SetStatusWidths(int n, const int widths_field[])
{
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
bool wxFrame::MSWOnPaint(void)
{
-#if DEBUG > 1
+#if WXDEBUG > 1
wxDebugMsg("wxFrameWnd::OnPaint %d\n", handle);
#endif
RECT rect;
void wxFrame::MSWOnSize(int x, int y, WXUINT id)
{
-#if DEBUG > 1
+#if WXDEBUG > 1
wxDebugMsg("wxFrameWnd::OnSize %d\n", m_hWnd);
#endif
switch (id)
bool wxFrame::MSWOnClose(void)
{
-#if DEBUG > 1
+#if WXDEBUG > 1
wxDebugMsg("wxFrameWnd::OnClose %d\n", handle);
#endif
return Close();
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
{
-#if DEBUG > 1
+#if WXDEBUG > 1
wxDebugMsg("wxFrameWnd::OnCommand %d\n", handle);
#endif
if (cmd == 0 || cmd == 1 ) // Can be either a menu command or an accelerator.
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
{
if (m_acceleratorTable != 0 &&
- ::TranslateAccelerator((HWND) GetHWND(), (HANDLE) m_acceleratorTable, (MSG *)pMsg))
+ ::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable, (MSG *)pMsg))
return TRUE;
return FALSE;
// resize to client rectangle size
void wxFrame::OnSize(wxSizeEvent& event)
{
- // Search for a child which is a subwindow, not another frame.
+ // if we're using constraints - do use them
+ #if USE_CONSTRAINTS
+ if ( GetAutoLayout() ) {
+ Layout();
+ return;
+ }
+ #endif
+
+ // do we have _exactly_ one child?
wxWindow *child = NULL;
- // Count the number of _subwindow_ children
- int noChildren = 0;
- for(wxNode *node = GetChildren()->First(); node; node = node->Next())
+ for ( wxNode *node = GetChildren()->First(); node; node = node->Next() )
{
wxWindow *win = (wxWindow *)node->Data();
- if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))
- && (win != GetStatusBar()))
+ if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
+ !win->IsKindOf(CLASSINFO(wxDialog)) &&
+ (win != GetStatusBar()) &&
+ (win != GetToolBar()) )
{
+ if ( child )
+ return; // it's our second subwindow - nothing to do
child = win;
- noChildren ++;
}
}
- // If not one child, call the Layout function if compiled in
- if (!child || (noChildren > 1)
-#if USE_CONSTRAINTS
- || GetAutoLayout()
-#endif
- )
- {
-#if USE_CONSTRAINTS
- if (GetAutoLayout())
- Layout();
-#endif
- return;
- }
-
- if (child)
- {
- int client_x, client_y;
+ if ( child ) {
+ // we have exactly one child - set it's size to fill the whole frame
+ int clientW, clientH;
+ GetClientSize(&clientW, &clientH);
-#if DEBUG > 1
- wxDebugMsg("wxFrame::OnSize: about to set the child's size.\n");
-#endif
+ int x = 0;
+ int y = 0;
- GetClientSize(&client_x, &client_y);
- child->SetSize(0, 0, client_x, client_y);
- }
+ // Manage the toolbar if there is one
+ if ( GetToolBar() )
+ {
+ int wt, ht;
+ GetToolBar()->GetSize(&wt, &ht);
+ clientH -= ht;
+ y += ht;
+ GetToolBar()->SetSize(0, 0, clientW, ht);
+ }
+ child->SetSize(x, y, clientW, clientH);
+ }
}
// Default activation behaviour - set the focus for the first child
if (!child->IsKindOf(CLASSINFO(wxFrame)) &&
!child->IsKindOf(CLASSINFO(wxDialog)))
{
-#if DEBUG > 1
+#if WXDEBUG > 1
wxDebugMsg("wxFrame::OnActivate: about to set the child's focus.\n");
#endif
child->SetFocus();
}
}
+bool wxFrame::OnClose(void)
+{
+ return TRUE;
+}
+
// Destroy the window (delayed, if a managed window)
bool wxFrame::Destroy(void)
{