]> git.saurik.com Git - wxWidgets.git/commitdiff
Changed time of sending the wxSizeEvent and assorted things,
authorRobert Roebling <robert@roebling.de>
Thu, 14 Oct 1999 13:09:01 +0000 (13:09 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 14 Oct 1999 13:09:01 +0000 (13:09 +0000)
  this made wxGLCanvas work,
  wxMiniFrame looks correct again,
  Corrected makefile for HTML help

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

18 files changed:
include/wx/gtk/frame.h
include/wx/gtk/radiobox.h
include/wx/gtk1/frame.h
include/wx/gtk1/radiobox.h
samples/html/help/Makefile.in
src/common/framecmn.cpp
src/gtk/dialog.cpp
src/gtk/frame.cpp
src/gtk/minifram.cpp
src/gtk/radiobox.cpp
src/gtk/window.cpp
src/gtk1/dialog.cpp
src/gtk1/frame.cpp
src/gtk1/minifram.cpp
src/gtk1/radiobox.cpp
src/gtk1/window.cpp
utils/glcanvas/gtk/glcanvas.cpp
utils/glcanvas/samples/penguin/penguin.cpp

index 0268757d7168c3d785e5bc87d9ae64bf8447ffec..638c506b3d8c43b4653f311800e3ff185ba7ad0f 100644 (file)
@@ -102,6 +102,7 @@ public:
     void OnCloseWindow( wxCloseEvent& event );
     void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
     void OnSize( wxSizeEvent &event );
+    void OnIdle( wxIdleEvent &event );
 
     void OnMenuHighlight( wxMenuEvent& event );
 
index 099900825442a45fa07c55e7b1eecd01824844f1..06402b021a428cf6e84280c9c8a5460eaa5ecfbd 100644 (file)
@@ -42,9 +42,6 @@ extern const char *wxRadioBoxNameStr;
 
 class wxRadioBox: public wxControl
 {
-
-  DECLARE_DYNAMIC_CLASS(wxRadioBox)
-  
 public:
     wxRadioBox();
     inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
@@ -91,7 +88,6 @@ public:
     int GetNumberOfRowsOrCols() const;
     void SetNumberOfRowsOrCols( int n );
     
-    void OnSize( wxSizeEvent &event );
     void SetFocus();
     
   // implementation    
@@ -101,12 +97,14 @@ public:
     bool IsOwnGtkWindow( GdkWindow *window );
     void ApplyWidgetStyle();
     wxSize LayoutItems();
+    void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
     
     bool             m_alreadySent;
     int              m_majorDim;
     wxList           m_boxes;
     
-  DECLARE_EVENT_TABLE()    
+private:
+    DECLARE_DYNAMIC_CLASS(wxRadioBox)
 };
 
 #endif
index 0268757d7168c3d785e5bc87d9ae64bf8447ffec..638c506b3d8c43b4653f311800e3ff185ba7ad0f 100644 (file)
@@ -102,6 +102,7 @@ public:
     void OnCloseWindow( wxCloseEvent& event );
     void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
     void OnSize( wxSizeEvent &event );
+    void OnIdle( wxIdleEvent &event );
 
     void OnMenuHighlight( wxMenuEvent& event );
 
index 099900825442a45fa07c55e7b1eecd01824844f1..06402b021a428cf6e84280c9c8a5460eaa5ecfbd 100644 (file)
@@ -42,9 +42,6 @@ extern const char *wxRadioBoxNameStr;
 
 class wxRadioBox: public wxControl
 {
-
-  DECLARE_DYNAMIC_CLASS(wxRadioBox)
-  
 public:
     wxRadioBox();
     inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
@@ -91,7 +88,6 @@ public:
     int GetNumberOfRowsOrCols() const;
     void SetNumberOfRowsOrCols( int n );
     
-    void OnSize( wxSizeEvent &event );
     void SetFocus();
     
   // implementation    
@@ -101,12 +97,14 @@ public:
     bool IsOwnGtkWindow( GdkWindow *window );
     void ApplyWidgetStyle();
     wxSize LayoutItems();
+    void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
     
     bool             m_alreadySent;
     int              m_majorDim;
     wxList           m_boxes;
     
-  DECLARE_EVENT_TABLE()    
+private:
+    DECLARE_DYNAMIC_CLASS(wxRadioBox)
 };
 
 #endif
index d108cd68a8d8e53fa6398b24327dbdf0506aab65..3ceb53a80a446227eefc78b6276346215e4cfea6 100644 (file)
@@ -17,7 +17,8 @@ VPATH = :$(top_srcdir)/samples/html/help
 
 DATADIRS = helpfiles
 DATAFILES = helpfiles/Index.hhk helpfiles/book1.htm helpfiles/book2.htm \
-        helpfiles/contents.hhc helpfiles/main.htm helpfiles/page2-b.htm helpfiles/testing.hhp   
+       helpfiles/contents.hhc helpfiles/main.htm helpfiles/page2-b.htm helpfiles/testing.hhp \
+       helpfiles/another.hhc helpfiles/another.hhp helpfiles/another.htm
 
 PROGRAM=help
 
index 591382e1879e6eb060c3db0d720a32892ce68d84..24819cfa3412cf26012b5a5e5663db8c468f82cb 100644 (file)
 #include "wx/menu.h"
 #include "wx/menuitem.h"
 
-#ifndef __WXGTK__
 void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
 {
-  DoMenuUpdates();
+    DoMenuUpdates();
 }
-#endif
 
 // update all menus
 void wxFrame::DoMenuUpdates()
 {
-  wxMenuBar* bar = GetMenuBar();
+    wxMenuBar* bar = GetMenuBar();
 
-  if ( bar != NULL ) {
-    int nCount = bar->GetMenuCount();
-    for (int n = 0; n < nCount; n++)
-      DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL);
-  }
+    if ( bar != NULL ) 
+    {
+        int nCount = bar->GetMenuCount();
+        for (int n = 0; n < nCount; n++)
+            DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL);
+    }
 }
 
 // update a menu and all submenus recursively
index 75852bf9681f9633b28fcc3315ba248499913b6f..a528c57da79a7ac9d253b8a2397c6aacae0f25af 100644 (file)
@@ -246,6 +246,7 @@ void wxDialog::Init()
     m_returnCode = 0;
     m_sizeSet = FALSE;
     m_modalShowing = FALSE;
+    m_isFrame = TRUE;
 }
 
 wxDialog::wxDialog( wxWindow *parent,
index 780a098659bd5e888f05436506685144d6d5c0a7..6ecd18ed733eb3584d747ef45e1c5694c48250d8 100644 (file)
@@ -71,10 +71,20 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
     if (g_isIdle)
         wxapp_install_idle_handler();
 
-    if (!win->m_hasVMT) return;
+    if (!win->m_hasVMT)
+        return;
 
     if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
     {
+/*
+        wxPrintf( "OnSize from " );
+        if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+           wxPrintf( win->GetClassInfo()->GetClassName() );
+        wxPrintf( " %d %d %d %d\n", (int)alloc->x,
+                                (int)alloc->y,
+                                (int)alloc->width,
+                                (int)alloc->height );
+*/
         win->m_width = alloc->width;
         win->m_height = alloc->height;
         win->UpdateSize();
@@ -334,6 +344,7 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
 
 BEGIN_EVENT_TABLE(wxFrame, wxWindow)
     EVT_SIZE(wxFrame::OnSize)
+    EVT_IDLE(wxFrame::OnIdle)
     EVT_CLOSE(wxFrame::OnCloseWindow)
     EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
 END_EVENT_TABLE()
@@ -356,6 +367,7 @@ void wxFrame::Init()
     m_menuBarDetached = FALSE;
     m_toolBarDetached = FALSE;
     m_insertInClientArea = TRUE;
+    m_isFrame = TRUE;
 }
 
 wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
@@ -429,6 +441,10 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
 
     if (m_parent) m_parent->AddChild( this );
 
+    /* the user resized the frame by dragging etc. */
+    gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+        GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
+
     PostCreation();
 
     /*  we cannot set MWM hints and icons before the widget has
@@ -436,10 +452,6 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                         GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
 
-    /* the user resized the frame by dragging etc. */
-    gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
-        GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
-
     /* the only way to get the window size is to connect to this event */
     gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
         GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
@@ -775,20 +787,23 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
     /* we actually set the size of a frame here and no-where else */
     gtk_widget_set_usize( m_widget, m_width, m_height );
 
-    m_sizeSet = TRUE;
 
-    /* send size event to frame */
+    m_sizeSet = TRUE;
+    
+    // send size event to frame
     wxSizeEvent event( wxSize(m_width,m_height), GetId() );
     event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( event );
 
-    /* send size event to status bar */
+/*
+    // send size event to status bar
     if (m_frameStatusBar)
     {
         wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
         event2.SetEventObject( m_frameStatusBar );
         m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
     }
+*/
 
     m_resizing = FALSE;
 }
@@ -804,9 +819,14 @@ void wxFrame::MakeModal( bool modal )
 void wxFrame::OnInternalIdle()
 {
     if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
+    {
         GtkOnSize( m_x, m_y, m_width, m_height );
-
-    DoMenuUpdates();
+       
+       // we'll come back later
+        if (g_isIdle)
+            wxapp_install_idle_handler();
+       return;
+    }
 
     if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
 #if wxUSE_TOOLBAR
index 9da9393c89f83f676204cbe20f67b835ff026f4f..a59e05cd8d221f577a0e55237f2f1ac50ddc7bd1 100644 (file)
@@ -71,8 +71,10 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
     if (!win->m_hasVMT) return;
     if (gdk_event->count > 0) return;
     
+    GtkMyFixed *myfixed = GTK_MYFIXED(widget);
+    
     gtk_draw_shadow( widget->style, 
-                     widget->window,
+                     myfixed->bin_window,
                      GTK_STATE_NORMAL,
                      GTK_SHADOW_OUT,
                      0, 0,
@@ -83,20 +85,20 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
          (win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) || 
          (win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
     {
-        GdkGC *gc = gdk_gc_new( widget->window );
+        GdkGC *gc = gdk_gc_new( myfixed->bin_window );
         GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
         int x = 2;
         if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 18;
         
         gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
-        gdk_draw_rectangle( widget->window, gc, TRUE, 
+        gdk_draw_rectangle( myfixed->bin_window, gc, TRUE, 
                             x, 
                             3, 
                             win->m_width - 4 - x,
                             font->ascent + font->descent+1 );
                             
         gdk_gc_set_foreground( gc, &widget->style->white );
-        gdk_draw_string( widget->window, font, gc, 
+        gdk_draw_string( myfixed->bin_window, font, gc, 
                          x+2, 
                          3+font->ascent, 
                          win->m_title.mb_str() );
@@ -115,8 +117,10 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
 
     if (!win->m_hasVMT) return;
     
+    GtkMyFixed *myfixed = GTK_MYFIXED(widget);
+    
     gtk_draw_shadow( widget->style, 
-                     widget->window,
+                     myfixed->bin_window,
                      GTK_STATE_NORMAL,
                      GTK_SHADOW_OUT,
                      0, 0,
@@ -127,20 +131,20 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
          (win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) || 
          (win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
     {
-        GdkGC *gc = gdk_gc_new( widget->window );
+        GdkGC *gc = gdk_gc_new( myfixed->bin_window );
         GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
         int x = 2;
         if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 17;
         
         gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
-        gdk_draw_rectangle( widget->window, gc, TRUE, 
+        gdk_draw_rectangle( myfixed->bin_window, gc, TRUE, 
                             x, 
                             3, 
                             win->m_width - 4 - x,
                             font->ascent + font->descent+1 );
                             
         gdk_gc_set_foreground( gc, &widget->style->white );
-        gdk_draw_string( widget->window, font, gc, 
+        gdk_draw_string( myfixed->bin_window, font, gc, 
                          x+2, 
                          3+font->ascent, 
                          win->m_title.mb_str() );
index 43b4ae78037d1075bf89d0d202056b7c64a5a0e1..d96aff1a1d099c852379498aafaf74a091a9887e 100644 (file)
@@ -67,10 +67,6 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
 
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
 
-BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
-    EVT_SIZE(wxRadioBox::OnSize)
-END_EVENT_TABLE()
-
 wxRadioBox::wxRadioBox()
 {
 }
@@ -161,11 +157,11 @@ wxRadioBox::~wxRadioBox()
     }
 }
 
-void wxRadioBox::OnSize( wxSizeEvent &event )
+void wxRadioBox::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
+    wxWindow::DoSetSize( x, y, width, height, sizeFlags );
+    
     LayoutItems();
-
-    event.Skip();
 }
 
 wxSize wxRadioBox::LayoutItems()
index 5c6a1422e1daa164bc9f291ca154f987075e2449..1e1dcdc207a5546e34370b5f116cb31801cf2af5 100644 (file)
@@ -313,6 +313,39 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
 
 #endif // GTK_MINOR_VERSION > 0
 
+
+//-----------------------------------------------------------------------------
+// "size_allocate"
+//-----------------------------------------------------------------------------
+
+static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
+{
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+
+    if (!win->m_hasVMT) 
+        return;
+
+    if (win->m_sizeSet)
+        return;
+       
+    win->m_sizeSet = TRUE;
+    
+/*
+    wxPrintf( "OnSize from " );
+    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+        wxPrintf( win->GetClassInfo()->GetClassName() );
+    wxPrintf( " %d %d %d %d\n", (int)alloc->x,
+                                (int)alloc->y,
+                                (int)alloc->width,
+                                (int)alloc->height );
+*/
+
+    wxSizeEvent event( win->GetSize(), win->GetId() );
+    event.SetEventObject( win );
+    win->GetEventHandler()->ProcessEvent( event );
+}
+
 //-----------------------------------------------------------------------------
 // key event conversion routines
 //-----------------------------------------------------------------------------
@@ -694,6 +727,10 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
                                 (int)gdk_event->area.height );
 */
 
+    wxEraseEvent eevent( win->GetId() );
+    eevent.SetEventObject( win );
+    win->GetEventHandler()->ProcessEvent(eevent);
+    
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent( event );
@@ -726,6 +763,10 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
                                 (int)rect->height );
 */
                                
+    wxEraseEvent eevent( win->GetId() );
+    eevent.SetEventObject( win );
+    win->GetEventHandler()->ProcessEvent(eevent);
+    
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent( event );
@@ -1784,6 +1825,7 @@ void wxWindow::Init()
 
     m_isStaticBox = FALSE;
     m_isRadioButton = FALSE;
+    m_isFrame = FALSE;
     m_acceptsFocus = FALSE;
     
     m_cursor = *wxSTANDARD_CURSOR;
@@ -2027,6 +2069,13 @@ void wxWindow::PostCreation()
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
 
+    if (!m_isFrame)
+    {
+        /* frames have their own callback */
+        gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+            GTK_SIGNAL_FUNC(gtk_window_size_callback), (gpointer)this );
+    }
+
     if (m_wxwindow)
     {
         if (!m_noExpose)
@@ -2115,9 +2164,14 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
         m_y = y;
         m_width = width;
         m_height = height;
+
+        m_sizeSet = FALSE;
     }
     else
     {
+        int old_width = m_width;
+       int old_height = m_height;
+       
         GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
        
         if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
@@ -2166,14 +2220,19 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
                               m_y-border,
                               m_width+2*border,
                               m_height+border+bottom_border );
-    }
 
-    m_sizeSet = TRUE;
+        if ((old_width != m_width) ||
+           (old_height != m_height))
+       {
+           m_sizeSet = FALSE;
+       }
+    }
 
+/*
     wxSizeEvent event( wxSize(m_width,m_height), GetId() );
     event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( event );
-
+*/
     m_resizing = FALSE;
 }
 
@@ -2929,7 +2988,7 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
                   (GtkMenuPositionFunc) pop_pos_callback,
                   (gpointer) this,             // client data
                   0,                           // button used to activate it
-                  0 //gs_timeLastClick         // the time of activation
+                  gs_timeLastClick             // the time of activation
                 );
                
     while (is_waiting)
index 75852bf9681f9633b28fcc3315ba248499913b6f..a528c57da79a7ac9d253b8a2397c6aacae0f25af 100644 (file)
@@ -246,6 +246,7 @@ void wxDialog::Init()
     m_returnCode = 0;
     m_sizeSet = FALSE;
     m_modalShowing = FALSE;
+    m_isFrame = TRUE;
 }
 
 wxDialog::wxDialog( wxWindow *parent,
index 780a098659bd5e888f05436506685144d6d5c0a7..6ecd18ed733eb3584d747ef45e1c5694c48250d8 100644 (file)
@@ -71,10 +71,20 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
     if (g_isIdle)
         wxapp_install_idle_handler();
 
-    if (!win->m_hasVMT) return;
+    if (!win->m_hasVMT)
+        return;
 
     if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
     {
+/*
+        wxPrintf( "OnSize from " );
+        if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+           wxPrintf( win->GetClassInfo()->GetClassName() );
+        wxPrintf( " %d %d %d %d\n", (int)alloc->x,
+                                (int)alloc->y,
+                                (int)alloc->width,
+                                (int)alloc->height );
+*/
         win->m_width = alloc->width;
         win->m_height = alloc->height;
         win->UpdateSize();
@@ -334,6 +344,7 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
 
 BEGIN_EVENT_TABLE(wxFrame, wxWindow)
     EVT_SIZE(wxFrame::OnSize)
+    EVT_IDLE(wxFrame::OnIdle)
     EVT_CLOSE(wxFrame::OnCloseWindow)
     EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
 END_EVENT_TABLE()
@@ -356,6 +367,7 @@ void wxFrame::Init()
     m_menuBarDetached = FALSE;
     m_toolBarDetached = FALSE;
     m_insertInClientArea = TRUE;
+    m_isFrame = TRUE;
 }
 
 wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
@@ -429,6 +441,10 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
 
     if (m_parent) m_parent->AddChild( this );
 
+    /* the user resized the frame by dragging etc. */
+    gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+        GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
+
     PostCreation();
 
     /*  we cannot set MWM hints and icons before the widget has
@@ -436,10 +452,6 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
     gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
                         GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
 
-    /* the user resized the frame by dragging etc. */
-    gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
-        GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
-
     /* the only way to get the window size is to connect to this event */
     gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
         GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
@@ -775,20 +787,23 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
     /* we actually set the size of a frame here and no-where else */
     gtk_widget_set_usize( m_widget, m_width, m_height );
 
-    m_sizeSet = TRUE;
 
-    /* send size event to frame */
+    m_sizeSet = TRUE;
+    
+    // send size event to frame
     wxSizeEvent event( wxSize(m_width,m_height), GetId() );
     event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( event );
 
-    /* send size event to status bar */
+/*
+    // send size event to status bar
     if (m_frameStatusBar)
     {
         wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
         event2.SetEventObject( m_frameStatusBar );
         m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
     }
+*/
 
     m_resizing = FALSE;
 }
@@ -804,9 +819,14 @@ void wxFrame::MakeModal( bool modal )
 void wxFrame::OnInternalIdle()
 {
     if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
+    {
         GtkOnSize( m_x, m_y, m_width, m_height );
-
-    DoMenuUpdates();
+       
+       // we'll come back later
+        if (g_isIdle)
+            wxapp_install_idle_handler();
+       return;
+    }
 
     if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
 #if wxUSE_TOOLBAR
index 9da9393c89f83f676204cbe20f67b835ff026f4f..a59e05cd8d221f577a0e55237f2f1ac50ddc7bd1 100644 (file)
@@ -71,8 +71,10 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
     if (!win->m_hasVMT) return;
     if (gdk_event->count > 0) return;
     
+    GtkMyFixed *myfixed = GTK_MYFIXED(widget);
+    
     gtk_draw_shadow( widget->style, 
-                     widget->window,
+                     myfixed->bin_window,
                      GTK_STATE_NORMAL,
                      GTK_SHADOW_OUT,
                      0, 0,
@@ -83,20 +85,20 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
          (win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) || 
          (win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
     {
-        GdkGC *gc = gdk_gc_new( widget->window );
+        GdkGC *gc = gdk_gc_new( myfixed->bin_window );
         GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
         int x = 2;
         if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 18;
         
         gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
-        gdk_draw_rectangle( widget->window, gc, TRUE, 
+        gdk_draw_rectangle( myfixed->bin_window, gc, TRUE, 
                             x, 
                             3, 
                             win->m_width - 4 - x,
                             font->ascent + font->descent+1 );
                             
         gdk_gc_set_foreground( gc, &widget->style->white );
-        gdk_draw_string( widget->window, font, gc, 
+        gdk_draw_string( myfixed->bin_window, font, gc, 
                          x+2, 
                          3+font->ascent, 
                          win->m_title.mb_str() );
@@ -115,8 +117,10 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
 
     if (!win->m_hasVMT) return;
     
+    GtkMyFixed *myfixed = GTK_MYFIXED(widget);
+    
     gtk_draw_shadow( widget->style, 
-                     widget->window,
+                     myfixed->bin_window,
                      GTK_STATE_NORMAL,
                      GTK_SHADOW_OUT,
                      0, 0,
@@ -127,20 +131,20 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
          (win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) || 
          (win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
     {
-        GdkGC *gc = gdk_gc_new( widget->window );
+        GdkGC *gc = gdk_gc_new( myfixed->bin_window );
         GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
         int x = 2;
         if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 17;
         
         gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
-        gdk_draw_rectangle( widget->window, gc, TRUE, 
+        gdk_draw_rectangle( myfixed->bin_window, gc, TRUE, 
                             x, 
                             3, 
                             win->m_width - 4 - x,
                             font->ascent + font->descent+1 );
                             
         gdk_gc_set_foreground( gc, &widget->style->white );
-        gdk_draw_string( widget->window, font, gc, 
+        gdk_draw_string( myfixed->bin_window, font, gc, 
                          x+2, 
                          3+font->ascent, 
                          win->m_title.mb_str() );
index 43b4ae78037d1075bf89d0d202056b7c64a5a0e1..d96aff1a1d099c852379498aafaf74a091a9887e 100644 (file)
@@ -67,10 +67,6 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
 
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
 
-BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
-    EVT_SIZE(wxRadioBox::OnSize)
-END_EVENT_TABLE()
-
 wxRadioBox::wxRadioBox()
 {
 }
@@ -161,11 +157,11 @@ wxRadioBox::~wxRadioBox()
     }
 }
 
-void wxRadioBox::OnSize( wxSizeEvent &event )
+void wxRadioBox::DoSetSize( int x, int y, int width, int height, int sizeFlags )
 {
+    wxWindow::DoSetSize( x, y, width, height, sizeFlags );
+    
     LayoutItems();
-
-    event.Skip();
 }
 
 wxSize wxRadioBox::LayoutItems()
index 5c6a1422e1daa164bc9f291ca154f987075e2449..1e1dcdc207a5546e34370b5f116cb31801cf2af5 100644 (file)
@@ -313,6 +313,39 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
 
 #endif // GTK_MINOR_VERSION > 0
 
+
+//-----------------------------------------------------------------------------
+// "size_allocate"
+//-----------------------------------------------------------------------------
+
+static void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
+{
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+
+    if (!win->m_hasVMT) 
+        return;
+
+    if (win->m_sizeSet)
+        return;
+       
+    win->m_sizeSet = TRUE;
+    
+/*
+    wxPrintf( "OnSize from " );
+    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+        wxPrintf( win->GetClassInfo()->GetClassName() );
+    wxPrintf( " %d %d %d %d\n", (int)alloc->x,
+                                (int)alloc->y,
+                                (int)alloc->width,
+                                (int)alloc->height );
+*/
+
+    wxSizeEvent event( win->GetSize(), win->GetId() );
+    event.SetEventObject( win );
+    win->GetEventHandler()->ProcessEvent( event );
+}
+
 //-----------------------------------------------------------------------------
 // key event conversion routines
 //-----------------------------------------------------------------------------
@@ -694,6 +727,10 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
                                 (int)gdk_event->area.height );
 */
 
+    wxEraseEvent eevent( win->GetId() );
+    eevent.SetEventObject( win );
+    win->GetEventHandler()->ProcessEvent(eevent);
+    
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent( event );
@@ -726,6 +763,10 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
                                 (int)rect->height );
 */
                                
+    wxEraseEvent eevent( win->GetId() );
+    eevent.SetEventObject( win );
+    win->GetEventHandler()->ProcessEvent(eevent);
+    
     wxPaintEvent event( win->GetId() );
     event.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent( event );
@@ -1784,6 +1825,7 @@ void wxWindow::Init()
 
     m_isStaticBox = FALSE;
     m_isRadioButton = FALSE;
+    m_isFrame = FALSE;
     m_acceptsFocus = FALSE;
     
     m_cursor = *wxSTANDARD_CURSOR;
@@ -2027,6 +2069,13 @@ void wxWindow::PostCreation()
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
 
+    if (!m_isFrame)
+    {
+        /* frames have their own callback */
+        gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+            GTK_SIGNAL_FUNC(gtk_window_size_callback), (gpointer)this );
+    }
+
     if (m_wxwindow)
     {
         if (!m_noExpose)
@@ -2115,9 +2164,14 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
         m_y = y;
         m_width = width;
         m_height = height;
+
+        m_sizeSet = FALSE;
     }
     else
     {
+        int old_width = m_width;
+       int old_height = m_height;
+       
         GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
        
         if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
@@ -2166,14 +2220,19 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
                               m_y-border,
                               m_width+2*border,
                               m_height+border+bottom_border );
-    }
 
-    m_sizeSet = TRUE;
+        if ((old_width != m_width) ||
+           (old_height != m_height))
+       {
+           m_sizeSet = FALSE;
+       }
+    }
 
+/*
     wxSizeEvent event( wxSize(m_width,m_height), GetId() );
     event.SetEventObject( this );
     GetEventHandler()->ProcessEvent( event );
-
+*/
     m_resizing = FALSE;
 }
 
@@ -2929,7 +2988,7 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
                   (GtkMenuPositionFunc) pop_pos_callback,
                   (gpointer) this,             // client data
                   0,                           // button used to activate it
-                  0 //gs_timeLastClick         // the time of activation
+                  gs_timeLastClick             // the time of activation
                 );
                
     while (is_waiting)
index 9ee7d285436759ed1ec993f362e977c21e4dc0cc..a59ceaed951c535183d9d23a7d9ee84b9b45d5ff 100644 (file)
@@ -34,6 +34,13 @@ extern "C" {
 
 XVisualInfo *g_vi = (XVisualInfo*) NULL;
 
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
 //---------------------------------------------------------------------------
 // wxGLContext
 //---------------------------------------------------------------------------
@@ -152,6 +159,9 @@ gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
 static void 
 gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win )
 {
+    if (g_isIdle) 
+        wxapp_install_idle_handler();
+
     win->m_exposed = TRUE;
 
     win->GetUpdateRegion().Union( gdk_event->area.x,
@@ -167,6 +177,9 @@ gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_e
 static void 
 gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win )
 {
+    if (g_isIdle) 
+        wxapp_install_idle_handler();
+
     win->m_exposed = TRUE;
 
     win->GetUpdateRegion().Union( rect->x, rect->y,
@@ -337,4 +350,6 @@ void wxGLCanvas::OnInternalIdle()
         m_exposed = FALSE;
         GetUpdateRegion().Clear();
     }
-}
\ No newline at end of file
+    
+    wxWindow::OnInternalIdle();
+}
index 0d49b80611955ebd7efc1c1d085c694ed0713953..8eaed6a1d9bd74fb9361e90604628e42da3190fd 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "penguin.h"
 #include <GL/glu.h>
-#include "wx/gtk/win_gtk.h"
 
 #define VIEW_ASPECT 1.3
 
@@ -106,14 +105,6 @@ void TestGLCanvas::OnPaint( wxPaintEvent& event )
     if (!GetContext()) return;
 #endif
 
-    printf( "on refresh.\n" );
-    int x,y;
-    GtkMyFixed *fixed = GTK_MYFIXED(m_wxwindow);
-    gdk_window_get_size( m_wxwindow->window, &x, &y );
-    printf( "-> window %d %d.\n", x, y );
-    gdk_window_get_size( fixed->bin_window, &x, &y );
-    printf( "-> bin_window %d %d.\n", x, y );
-    
     SetCurrent();
     
     /* initialize OpenGL */
@@ -155,8 +146,6 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
     int width, height;
     GetClientSize(& width, & height);
     
-    printf( "onsize %d %d.\n", width, height );
-    
 #ifndef __WXMOTIF__
     if (GetContext())
 #endif