]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/frame.cpp
Added dcbase target to various makefiles
[wxWidgets.git] / src / gtk1 / frame.cpp
index e0b475caae32176b96775e8e35fb442c9b608a18..d9299edf62d1a23a6756e01c5bda4c717f8e0e2a 100644 (file)
@@ -152,7 +152,7 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
         wxapp_install_idle_handler();
 
     if (!win->m_hasVMT) return FALSE;
-
+    
     win->m_x = event->x;
     win->m_y = event->y;
 
@@ -249,13 +249,10 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
  * virtual function here as wxWindows requires different ways to insert
  * a child in container classes. */
 
-static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child )
+static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
 {
-    if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
+    if (!parent->m_insertInClientArea)
     {
-        /* actually, menubars are never inserted here, but this
-           may change one day */
-    
         /* these are outside the client area */
         wxFrame* frame = (wxFrame*) parent;
         gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
@@ -318,7 +315,8 @@ wxFrame::wxFrame()
     m_mainWidget = (GtkWidget*) NULL;
     m_menuBarDetached = FALSE;
     m_toolBarDetached = FALSE;
-    m_insertCallback = wxInsertChildInFrame;
+    m_insertCallback = (wxInsertChildFunction) NULL;
+    m_insertInClientArea = TRUE;
 }
 
 wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
@@ -334,7 +332,8 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
     m_mainWidget = (GtkWidget*) NULL;
     m_menuBarDetached = FALSE;
     m_toolBarDetached = FALSE;
-    m_insertCallback = wxInsertChildInFrame;
+    m_insertCallback = (wxInsertChildFunction) NULL;
+    m_insertInClientArea = TRUE;
     Create( parent, id, title, pos, size, style, name );
 }
 
@@ -350,7 +349,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
 
     m_title = title;
     
-    m_insertCallback = wxInsertChildInFrame;
+    m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame;
 
     GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
     if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
@@ -511,7 +510,6 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
     {
         if ((m_x != old_x) || (m_y != old_y))
         {
-            /* we set the size here and in gtk_frame_map_callback */
             gtk_widget_set_uposition( m_widget, m_x, m_y );
         }
     }
@@ -744,15 +742,33 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
     m_resizing = FALSE;
 }
 
+void wxFrame::MakeModal( bool modal )
+{
+    if (modal)
+    {
+        gtk_grab_add( m_widget );
+        gtk_main();
+        gtk_grab_remove( m_widget );
+    }
+    else
+    {
+        gtk_main_quit();
+    }
+}
+
 void wxFrame::OnInternalIdle()
 {
     if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
         GtkOnSize( m_x, m_y, m_width, m_height );
 
     DoMenuUpdates();
+    
+    if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
+    if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
+    if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle();
 }
 
-void wxFrame::OnCloseWindow( wxCloseEvent& event )
+void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
 {
     Destroy();
 }
@@ -789,7 +805,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
         {
             /* yes: set it's size to fill all the frame */
             int client_x, client_y;
-            GetClientSize( &client_x, &client_y );
+            DoGetClientSize( &client_x, &client_y );
             child->SetSize( 1, 1, client_x-2, client_y-2 );
         }
     }
@@ -887,15 +903,19 @@ void wxFrame::OnMenuHighlight(wxMenuEvent& event)
     }
 }
 
-wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
+wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& name )
 {
     wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") );
 
     wxCHECK_MSG( m_frameToolBar == NULL, FALSE, _T("recreating toolbar in wxFrame") );
 
+    m_insertInClientArea = FALSE;
+    
     m_frameToolBar = OnCreateToolBar( style, id, name );
 
-    GetChildren().DeleteObject( m_frameToolBar );
+    if (m_frameToolBar) GetChildren().DeleteObject( m_frameToolBar );
+    
+    m_insertInClientArea = TRUE;
 
     m_sizeSet = FALSE;