if ( retValue == 0 )
{
- /* delete pending toplevel windows (typically a single
- dialog) so that, if there isn't any left, we don't
- call OnRun() */
+ // Delete pending toplevel windows
wxTheApp->DeletePendingObjects();
- wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
+ // When is the app not initialized ?
+ wxTheApp->m_initialized = TRUE;
if (wxTheApp->Initialized())
{
wxTheApp->OnRun();
wxWindow *topWindow = wxTheApp->GetTopWindow();
+
+ // Delete all pending windows if any
+ wxTheApp->DeletePendingObjects();
+
+ // Reset top window
if (topWindow)
- {
- /* Forcibly delete the window. */
- if (topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
- topWindow->IsKindOf(CLASSINFO(wxDialog)) )
- {
- topWindow->Close( TRUE );
- wxTheApp->DeletePendingObjects();
- }
- else
- {
- delete topWindow;
- wxTheApp->SetTopWindow( (wxWindow*) NULL );
- }
- }
+ wxTheApp->SetTopWindow( (wxWindow*) NULL );
retValue = wxTheApp->OnExit();
}
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
if (!win->m_hasVMT) return;
+ // Raise the client area area
+ gdk_window_raise( win->m_wxwindow->window );
+
win->m_menuBarDetached = TRUE;
win->GtkUpdateSize();
}
if (!win->m_hasVMT) return;
win->m_toolBarDetached = FALSE;
-
win->GtkUpdateSize();
}
if (!win->m_hasVMT) return;
+ // Raise the client area area
+ gdk_window_raise( win->m_wxwindow->window );
+
win->m_toolBarDetached = TRUE;
win->GtkUpdateSize();
}
if (!parent->m_insertInClientArea)
{
- /* these are outside the client area */
+ // These are outside the client area
wxFrame* frame = (wxFrame*) parent;
gtk_pizza_put( GTK_PIZZA(frame->m_mainWidget),
GTK_WIDGET(child->m_widget),
child->m_height );
#if wxUSE_TOOLBAR_NATIVE
- /* we connect to these events for recalculating the client area
- space when the toolbar is floating */
+ // We connect to these events for recalculating the client area
+ // space when the toolbar is floating
if (wxIS_KIND_OF(child,wxToolBar))
{
wxToolBar *toolBar = (wxToolBar*) child;
}
else
{
- /* these are inside the client area */
+ // These are inside the client area
gtk_pizza_put( GTK_PIZZA(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
child->m_height );
}
- /* resize on OnInternalIdle */
+ // Resize on OnInternalIdle
parent->GtkUpdateSize();
}
if (height)
{
#if wxUSE_MENUS_NATIVE
- /* menu bar */
+ // menu bar
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
#endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR
- /* status bar */
+ // status bar
if (m_frameStatusBar && m_frameStatusBar->IsShown())
(*height) -= wxSTATUS_HEIGHT;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
- /* tool bar */
+ // tool bar
if (m_frameToolBar && m_frameToolBar->IsShown())
{
if (m_toolBarDetached)
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
#if wxUSE_MENUS_NATIVE
- /* menu bar */
+ // menu bar
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
#endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR
- /* status bar */
+ // status bar
if (m_frameStatusBar && m_frameStatusBar->IsShown()) height += wxSTATUS_HEIGHT;
#endif
#if wxUSE_TOOLBAR
- /* tool bar */
+ // tool bar
if (m_frameToolBar && m_frameToolBar->IsShown())
{
if (m_toolBarDetached)
// m_x = x;
// m_y = y;
- /* avoid recursions */
+ // avoid recursions
if (m_resizing) return;
m_resizing = TRUE;
- /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
+ // this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_width = width;
m_height = height;
- /* space occupied by m_frameToolBar and m_frameMenuBar */
+ // space occupied by m_frameToolBar and m_frameMenuBar
int client_area_x_offset = 0,
client_area_y_offset = 0;
if (m_mainWidget)
{
- /* set size hints */
+ // set size hints
gint flag = 0; // GDK_HINT_POS;
if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
&geom,
(GdkWindowHints) flag );
- /* I revert back to wxGTK's original behaviour. m_mainWidget holds the
- * menubar, the toolbar and the client area, which is represented by
- * m_wxwindow.
- * this hurts in the eye, but I don't want to call SetSize()
- * because I don't want to call any non-native functions here. */
+ // I revert back to wxGTK's original behaviour. m_mainWidget holds
+ // the menubar, the toolbar and the client area, which is represented
+ // by m_wxwindow.
+ // This hurts in the eye, but I don't want to call SetSize()
+ // because I don't want to call any non-native functions here.
#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar)
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
- /* don't change the toolbar's reported height/width */
+ // don't change the toolbar's reported height/width
int ww, hh;
if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
{
ww = m_width - 2*m_miniEdge;
hh = m_toolBarDetached ? wxPLACE_HOLDER
: m_frameToolBar->m_height;
-
+
client_area_y_offset += hh;
}
}
else
{
- /* if there is no m_mainWidget between m_widget and m_wxwindow there
- is no need to set the size or position of m_wxwindow. */
+ // If there is no m_mainWidget between m_widget and m_wxwindow there
+ // is no need to set the size or position of m_wxwindow.
}
#if wxUSE_STATUSBAR
if ( retValue == 0 )
{
- /* delete pending toplevel windows (typically a single
- dialog) so that, if there isn't any left, we don't
- call OnRun() */
+ // Delete pending toplevel windows
wxTheApp->DeletePendingObjects();
- wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
+ // When is the app not initialized ?
+ wxTheApp->m_initialized = TRUE;
if (wxTheApp->Initialized())
{
wxTheApp->OnRun();
wxWindow *topWindow = wxTheApp->GetTopWindow();
+
+ // Delete all pending windows if any
+ wxTheApp->DeletePendingObjects();
+
+ // Reset top window
if (topWindow)
- {
- /* Forcibly delete the window. */
- if (topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
- topWindow->IsKindOf(CLASSINFO(wxDialog)) )
- {
- topWindow->Close( TRUE );
- wxTheApp->DeletePendingObjects();
- }
- else
- {
- delete topWindow;
- wxTheApp->SetTopWindow( (wxWindow*) NULL );
- }
- }
+ wxTheApp->SetTopWindow( (wxWindow*) NULL );
retValue = wxTheApp->OnExit();
}
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
if (!win->m_hasVMT) return;
+ // Raise the client area area
+ gdk_window_raise( win->m_wxwindow->window );
+
win->m_menuBarDetached = TRUE;
win->GtkUpdateSize();
}
if (!win->m_hasVMT) return;
win->m_toolBarDetached = FALSE;
-
win->GtkUpdateSize();
}
if (!win->m_hasVMT) return;
+ // Raise the client area area
+ gdk_window_raise( win->m_wxwindow->window );
+
win->m_toolBarDetached = TRUE;
win->GtkUpdateSize();
}
if (!parent->m_insertInClientArea)
{
- /* these are outside the client area */
+ // These are outside the client area
wxFrame* frame = (wxFrame*) parent;
gtk_pizza_put( GTK_PIZZA(frame->m_mainWidget),
GTK_WIDGET(child->m_widget),
child->m_height );
#if wxUSE_TOOLBAR_NATIVE
- /* we connect to these events for recalculating the client area
- space when the toolbar is floating */
+ // We connect to these events for recalculating the client area
+ // space when the toolbar is floating
if (wxIS_KIND_OF(child,wxToolBar))
{
wxToolBar *toolBar = (wxToolBar*) child;
}
else
{
- /* these are inside the client area */
+ // These are inside the client area
gtk_pizza_put( GTK_PIZZA(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
child->m_height );
}
- /* resize on OnInternalIdle */
+ // Resize on OnInternalIdle
parent->GtkUpdateSize();
}
if (height)
{
#if wxUSE_MENUS_NATIVE
- /* menu bar */
+ // menu bar
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
#endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR
- /* status bar */
+ // status bar
if (m_frameStatusBar && m_frameStatusBar->IsShown())
(*height) -= wxSTATUS_HEIGHT;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
- /* tool bar */
+ // tool bar
if (m_frameToolBar && m_frameToolBar->IsShown())
{
if (m_toolBarDetached)
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
#if wxUSE_MENUS_NATIVE
- /* menu bar */
+ // menu bar
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
#endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR
- /* status bar */
+ // status bar
if (m_frameStatusBar && m_frameStatusBar->IsShown()) height += wxSTATUS_HEIGHT;
#endif
#if wxUSE_TOOLBAR
- /* tool bar */
+ // tool bar
if (m_frameToolBar && m_frameToolBar->IsShown())
{
if (m_toolBarDetached)
// m_x = x;
// m_y = y;
- /* avoid recursions */
+ // avoid recursions
if (m_resizing) return;
m_resizing = TRUE;
- /* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
+ // this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_width = width;
m_height = height;
- /* space occupied by m_frameToolBar and m_frameMenuBar */
+ // space occupied by m_frameToolBar and m_frameMenuBar
int client_area_x_offset = 0,
client_area_y_offset = 0;
if (m_mainWidget)
{
- /* set size hints */
+ // set size hints
gint flag = 0; // GDK_HINT_POS;
if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
&geom,
(GdkWindowHints) flag );
- /* I revert back to wxGTK's original behaviour. m_mainWidget holds the
- * menubar, the toolbar and the client area, which is represented by
- * m_wxwindow.
- * this hurts in the eye, but I don't want to call SetSize()
- * because I don't want to call any non-native functions here. */
+ // I revert back to wxGTK's original behaviour. m_mainWidget holds
+ // the menubar, the toolbar and the client area, which is represented
+ // by m_wxwindow.
+ // This hurts in the eye, but I don't want to call SetSize()
+ // because I don't want to call any non-native functions here.
#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar)
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
- /* don't change the toolbar's reported height/width */
+ // don't change the toolbar's reported height/width
int ww, hh;
if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
{
ww = m_width - 2*m_miniEdge;
hh = m_toolBarDetached ? wxPLACE_HOLDER
: m_frameToolBar->m_height;
-
+
client_area_y_offset += hh;
}
}
else
{
- /* if there is no m_mainWidget between m_widget and m_wxwindow there
- is no need to set the size or position of m_wxwindow. */
+ // If there is no m_mainWidget between m_widget and m_wxwindow there
+ // is no need to set the size or position of m_wxwindow.
}
#if wxUSE_STATUSBAR