]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/frame.cpp
Added stubs .cpp files.
[wxWidgets.git] / src / gtk1 / frame.cpp
index 5a39066f389eb430ef0ee48478fe78d0ab0ca9f7..033ec23f9d37896b4064fd8dfdd7a11fd2c37c3e 100644 (file)
@@ -19,6 +19,7 @@
 #include "wx/menu.h"
 #include "wx/toolbar.h"
 #include "wx/statusbr.h"
+#include "wx/mdi.h"
 #include "wx/gtk/win_gtk.h"
 
 const wxMENU_HEIGHT    = 28;
@@ -32,7 +33,7 @@ extern wxList wxPendingDelete;
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
-// size
+// set size
 
 void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
 {
@@ -65,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)
@@ -142,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 );
@@ -209,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 )
 {
-  m_x = x;
-  m_y = y;
+  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 )
+{
+  // 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;
@@ -239,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)
   {
@@ -253,18 +285,18 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height )
   main_y += toolbar_height;
   main_height -= toolbar_height;
   
-  gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y );
-  gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height );
+  gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_wxwindow, main_x, main_y );
+  gtk_widget_set_usize( m_wxwindow, main_width, main_height );
 
   if (m_frameMenuBar)
   {
-    gtk_widget_set_uposition( m_frameMenuBar->m_widget, 1, 1 );
+    gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameMenuBar->m_widget, 1, 1 );
     gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
   };
 
   if (m_frameToolBar)
   {
-    gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
+    gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
     gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
   };
   
@@ -320,7 +352,9 @@ void wxFrame::AddChild( wxWindow *child )
 {
   // wxFrame and wxDialog as children aren't placed into the parents
   
-  if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog)))
+  if (IS_KIND_OF(child,wxMDIChildFrame)) printf( "wxFrame::AddChild error.\n" );
+  
+  if ( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog))
   {
     m_children.Append( child );
     
@@ -366,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 );