]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/frame.cpp
Added stubs .cpp files.
[wxWidgets.git] / src / gtk1 / frame.cpp
index 0abf2c82dffb405679cd3bdf6680cf3a16e59998..033ec23f9d37896b4064fd8dfdd7a11fd2c37c3e 100644 (file)
@@ -33,7 +33,7 @@ extern wxList wxPendingDelete;
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
-// size
+// set size
 
 void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
 {
@@ -66,6 +66,19 @@ bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(
   return TRUE;
 };
 
+//-----------------------------------------------------------------------------
+// configure
+
+gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+{
+  if (!win->HasVMT()) return FALSE;
+  
+  win->m_x = event->x;
+  win->m_y = event->y;
+  
+  return FALSE;
+};
+
 //-----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(wxFrame, wxWindow)
@@ -143,6 +156,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
   gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
     GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
 
+  gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
+    GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
+    
   PostCreation();
 
   gtk_widget_realize( m_mainWindow );
@@ -210,10 +226,25 @@ void wxFrame::GetClientSize( int *width, int *height ) const
   };
 };
 
-void wxFrame::GtkOnSize( int x, int y, int width, int height )
+void wxFrame::SetClientSize( int const width, int const height )
+{
+  int h = height;
+  if (m_frameMenuBar) h += wxMENU_HEIGHT;
+  if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
+  if (m_frameToolBar)
+  {
+    int y = 0;
+    m_frameToolBar->GetSize( NULL, &y );
+    h += y;
+  }
+  wxWindow::SetClientSize( width, h );
+};
+
+void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
 {
-  m_x = x;
-  m_y = y;
+  // due to a bug in gtk, x,y are always 0
+  // m_x = x;
+  // m_y = y;
 
   if ((m_height == height) && (m_width == width) &&
       (m_sizeSet)) return;
@@ -240,7 +271,7 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
   // m_wxwindow just like any other window.
 
 //  not really needed
-  gtk_widget_set_usize( m_mainWindow, width, height );
+//  gtk_widget_set_usize( m_mainWindow, width, height );
 
   if (m_frameMenuBar)
   {
@@ -369,16 +400,16 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
   
   if (m_frameMenuBar)
   {
+    wxNode *node = m_frameMenuBar->m_menus.First();
+    while (node)
+    {
+      wxMenu *menu = (wxMenu*)node->Data();
+      SetInvokingWindow( menu, this );
+      node = node->Next();
+    };
+    
     if (m_frameMenuBar->m_parent != this)
     {
-      wxNode *node = m_frameMenuBar->m_menus.First();
-      while (node)
-      {
-        wxMenu *menu = (wxMenu*)node->Data();
-        SetInvokingWindow( menu, this );
-        node = node->Next();
-      };
-  
       m_frameMenuBar->m_parent = this;
       gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
         m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );