]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/frame.cpp
New module definition file for the ever chaning treectrl class interface.
[wxWidgets.git] / src / gtk1 / frame.cpp
index 65ac5783e4a3580f6e1b48c36df5b9d1e7cfe0fa..b1987a0b8d5e7278edf11a6f74aaf02eeaf15c5a 100644 (file)
@@ -65,11 +65,8 @@ extern int g_openDialogs;
 // event tables
 // ----------------------------------------------------------------------------
 
-#ifdef __WXUNIVERSAL__
-    IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
-#else
-    IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameGTK)
-    IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
+#ifndef __WXUNIVERSAL__
+    IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
 #endif
 
 // ----------------------------------------------------------------------------
@@ -156,7 +153,8 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
     return TRUE;
 }
 
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
+
 //-----------------------------------------------------------------------------
 // "child_attached" of menu bar
 //-----------------------------------------------------------------------------
@@ -180,7 +178,8 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
     win->m_menuBarDetached = TRUE;
     win->GtkUpdateSize();
 }
-#endif // wxUSE_MENUS
+
+#endif // wxUSE_MENUS_NATIVE
 
 #if wxUSE_TOOLBAR
 //-----------------------------------------------------------------------------
@@ -750,7 +749,7 @@ void wxFrameGTK::DoGetClientSize( int *width, int *height ) const
     wxWindow::DoGetClientSize( width, height );
     if (height)
     {
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
         /* menu bar */
         if (m_frameMenuBar)
         {
@@ -759,7 +758,7 @@ void wxFrameGTK::DoGetClientSize( int *width, int *height ) const
             else
                 (*height) -= wxPLACE_HOLDER;
         }
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
 
 #if wxUSE_STATUSBAR
         /* status bar */
@@ -803,7 +802,7 @@ void wxFrameGTK::DoSetClientSize( int width, int height )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
 
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
         /* menu bar */
         if (m_frameMenuBar)
         {
@@ -812,7 +811,7 @@ void wxFrameGTK::DoSetClientSize( int width, int height )
             else
                 height += wxPLACE_HOLDER;
         }
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
 
 #if wxUSE_STATUSBAR
         /* status bar */
@@ -901,7 +900,7 @@ void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
          * 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
+#if wxUSE_MENUS_NATIVE
         if (m_frameMenuBar)
         {
             int xx = m_miniEdge;
@@ -918,7 +917,7 @@ void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
                                   xx, yy, ww, hh );
             client_area_y_offset += hh;
         }
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
 
 #if wxUSE_TOOLBAR
         if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
@@ -926,7 +925,7 @@ void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
         {
             int xx = m_miniEdge;
             int yy = m_miniEdge + m_miniTitle;
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
             if (m_frameMenuBar)
             {
                 if (!m_menuBarDetached)
@@ -934,7 +933,7 @@ void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
                 else
                     yy += wxPLACE_HOLDER;
             }
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
 
             m_frameToolBar->m_x = xx;
             m_frameToolBar->m_y = yy;
@@ -1036,9 +1035,9 @@ void wxFrameGTK::OnInternalIdle()
         return;
     }
 
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
     if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
 #if wxUSE_TOOLBAR
     if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
 #endif
@@ -1053,17 +1052,14 @@ void wxFrameGTK::OnInternalIdle()
 // menu/tool/status bar stuff
 // ----------------------------------------------------------------------------
 
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
 
-void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
+void wxFrameGTK::DetachMenuBar()
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
     wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
 
-    if (menuBar == m_frameMenuBar)
-        return;
-
-    if (m_frameMenuBar)
+    if ( m_frameMenuBar )
     {
         m_frameMenuBar->UnsetInvokingWindow( this );
 
@@ -1081,7 +1077,12 @@ void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
         gtk_widget_unparent( m_frameMenuBar->m_widget );
     }
 
-    m_frameMenuBar = menuBar;
+    wxFrameBase::DetachMenuBar();
+}
+
+void wxFrameGTK::AttachMenuBar( wxMenuBar *menuBar )
+{
+    wxFrameBase::AttachMenuBar(menuBar);
 
     if (m_frameMenuBar)
     {
@@ -1111,7 +1112,7 @@ void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
     m_sizeSet = FALSE;
 }
 
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
 
 #if wxUSE_TOOLBAR
 
@@ -1231,9 +1232,14 @@ void wxFrameGTK::Iconize( bool iconize )
 {
    if (iconize)
    {
-        XIconifyWindow( GDK_WINDOW_XDISPLAY( m_widget->window ),
-                        GDK_WINDOW_XWINDOW( m_widget->window ),
-                        DefaultScreen( GDK_DISPLAY() ) );
+       GdkWindow *window = m_widget->window;
+
+       // you should do it later, for example from OnCreate() handler
+       wxCHECK_RET( window, _T("frame not created yet - can't iconize") );
+
+       XIconifyWindow( GDK_WINDOW_XDISPLAY( window ),
+                       GDK_WINDOW_XWINDOW( window ),
+                       DefaultScreen( GDK_DISPLAY() ) );
    }
 }