]> git.saurik.com Git - wxWidgets.git/commitdiff
wxBusyInfo now uses wxGenericStaticText under GTK+, more Refresh/Update updates
authorRobert Roebling <robert@roebling.de>
Fri, 6 Mar 2009 23:30:54 +0000 (23:30 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 6 Mar 2009 23:30:54 +0000 (23:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/toplevel.h
src/generic/busyinfo.cpp
src/gtk/toplevel.cpp
src/gtk/window.cpp

index a953b7412ea08ea556791c27c6f955eae1ffaa76..a5e356e2db633dc0b096f2dc9a1a9f371ee84d0f 100644 (file)
@@ -79,6 +79,10 @@ public:
     virtual void RemoveGrab();
     virtual bool IsGrabbed() const { return m_grabbed; }
 
+
+    virtual void Refresh( bool eraseBackground = true,
+                          const wxRect *rect = (const wxRect *) NULL );
+
     // implementation from now on
     // --------------------------
 
index 723678c0276ff9f739dfb6a304cd792d1c8d2c30..2a95659dd16e0501f6ab9cbadff5b60f3309af6c 100644 (file)
@@ -24,6 +24,7 @@
 #endif
 
 #include "wx/busyinfo.h"
+#include "wx/generic/stattextg.h"
 
 class WXDLLEXPORT wxInfoFrame : public wxFrame
 {
@@ -46,7 +47,11 @@ wxInfoFrame::wxInfoFrame(wxWindow *parent, const wxString& message)
                      | wxFRAME_TOOL_WINDOW | wxSTAY_ON_TOP)
 {
     wxPanel *panel = new wxPanel( this );
+#if __WXGTK__
+    wxGenericStaticText *text = new wxGenericStaticText(panel, wxID_ANY, message);
+#else
     wxStaticText *text = new wxStaticText(panel, wxID_ANY, message);
+#endif
 
     panel->SetCursor(*wxHOURGLASS_CURSOR);
     text->SetCursor(*wxHOURGLASS_CURSOR);
index 5d04f3bcb37fd77dee9624a83076363587addcf1..a8a2b2bba13b38ef370e48cd78a9a2aa9e081f74 100644 (file)
@@ -777,6 +777,14 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
 // overridden wxWindow methods
 // ----------------------------------------------------------------------------
 
+void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect *WXUNUSED(rect) )
+{
+    wxCHECK_RET( m_widget, wxT("invalid frame") );
+    
+   gtk_widget_queue_draw( m_widget );
+   gdk_window_invalidate_rect( m_wxwindow->window, NULL, TRUE );
+}
+
 bool wxTopLevelWindowGTK::Show( bool show )
 {
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
index b996ff7fee9d4e807536e2ee7d48faf7fced7626..fb13c32ec2ddf06a7a1e8f6e580a1ad645065b1f 100644 (file)
@@ -1828,7 +1828,7 @@ gtk_window_realized_callback(GtkWidget* widget, wxWindow* win)
         gtk_im_context_set_client_window( win->m_imData->context,
                                           widget->window);
     }
-
+    
     // We cannot set colours and fonts before the widget
     // been realized, so we do this directly after realization
     // or otherwise in idle time
@@ -3526,38 +3526,40 @@ bool wxWindowGTK::ScrollPages(int pages)
     return DoScrollByUnits(ScrollDir_Vert, ScrollUnit_Page, pages);
 }
 
-#include "wx/treectrl.h"
-
 void wxWindowGTK::Refresh(bool WXUNUSED(eraseBackground),
                           const wxRect *rect)
 {
-    GtkWidget* widget;
-    if (m_wxwindow)
-        widget = m_wxwindow;
-    else if (m_widget)
-        widget = m_widget;
-    else
-        return;
-
-    if (!widget->window)
-        return;
+    wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
 
-    if (rect == NULL)
+    if (!m_wxwindow)
     {
-        gdk_window_invalidate_rect( widget->window, NULL, TRUE );
+        if (rect)
+            gtk_widget_queue_draw_area( m_widget, rect->x, rect->y, rect->width, rect->height );
+        else
+            gtk_widget_queue_draw( m_widget );
     }
     else
     {
-        int x = rect->x;
-        if (GetLayoutDirection() == wxLayout_RightToLeft)
-            x = GetClientSize().x - x - rect->width;
-            
-        GdkRectangle r;
-        r.x = rect->x;
-        r.y = rect->y;
-        r.width = rect->width;
-        r.height = rect->height;
-        gdk_window_invalidate_rect( m_wxwindow->window, &r, TRUE );
+        // Just return if the widget or one of its ancestors isn't mapped
+        GtkWidget *w;
+        for (w = m_wxwindow; w != NULL; w = w->parent)
+            if (!GTK_WIDGET_MAPPED (w))
+                return;
+
+        if (rect)
+        {
+            int x = rect->x;
+            if (GetLayoutDirection() == wxLayout_RightToLeft)
+                x = GetClientSize().x - x - rect->width;
+            GdkRectangle r;
+            r.x = rect->x;
+            r.y = rect->y;
+            r.width = rect->width;
+            r.height = rect->height;
+            gdk_window_invalidate_rect( m_wxwindow->window, &r, TRUE );
+        }
+        else
+            gdk_window_invalidate_rect( m_wxwindow->window, NULL, TRUE );
     }
 }
 
@@ -3570,8 +3572,8 @@ void wxWindowGTK::Update()
         // This ensures nothing will overwrite the drawing we are about to do.
         gdk_display_sync(display);
 
-        gdk_window_process_updates(m_widget->window, true);
-
+        gdk_window_process_updates(m_widget->window, TRUE);
+        
         // Flush again, but no need to wait for it to finish
         gdk_display_flush(display);
     }