]> git.saurik.com Git - wxWidgets.git/commitdiff
Removed crashes when not using themes.
authorRobert Roebling <robert@roebling.de>
Tue, 4 Jan 2000 22:56:58 +0000 (22:56 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 4 Jan 2000 22:56:58 +0000 (22:56 +0000)
  Removed much flicker form tree ctrl and list ctrl.

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

src/generic/filedlgg.cpp
src/generic/listctrl.cpp
src/generic/treectrl.cpp
src/gtk/font.cpp
src/gtk/settings.cpp
src/gtk/window.cpp
src/gtk1/font.cpp
src/gtk1/settings.cpp
src/gtk1/window.cpp

index 909355ded63da70a3017b4e6de708facc693d523..c43b4f642866aa22df8f431c353fafcc252a2aca 100644 (file)
@@ -347,7 +347,7 @@ void wxFileCtrl::Update()
     {
         InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, 130 );
         InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, 60 );
-        InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT, 70 );
+        InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT, 65 );
         InsertColumn( 3, _("Time"), wxLIST_FORMAT_LEFT, 50 );
         InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, 120 );
     }
@@ -397,9 +397,9 @@ void wxFileCtrl::Update()
 
     SortItems( ListCompare, 0 );
     
+    SetColumnWidth( 1, wxLIST_AUTOSIZE );
     SetColumnWidth( 2, wxLIST_AUTOSIZE );
     SetColumnWidth( 3, wxLIST_AUTOSIZE );
-    SetColumnWidth( 4, wxLIST_AUTOSIZE );
 }
 
 void wxFileCtrl::SetWild( const wxString &wild )
index 3ea0fdc49aeea2864ecbac3691c192eb3fa00142..0eb186d1655b6912fbf04abaf2768b8f3156179a 100644 (file)
@@ -1168,6 +1168,8 @@ wxListMainWindow::~wxListMainWindow()
 
 void wxListMainWindow::RefreshLine( wxListLineData *line )
 {
+    if (m_dirty) return;
+    
     int x = 0;
     int y = 0;
     int w = 0;
index dfe22222913d6fb3e2baa32ab5478f3439f3a977..a85aa6fd8d29ec07ec1ae9b9b47f34962b17a106 100644 (file)
@@ -589,14 +589,12 @@ void wxTreeCtrl::SetIndent(unsigned int indent)
 {
     m_indent = indent;
     m_dirty = TRUE;
-    Refresh();
 }
 
 void wxTreeCtrl::SetSpacing(unsigned int spacing)
 {
     m_spacing = spacing;
     m_dirty = TRUE;
-    Refresh();
 }
 
 size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively)
@@ -2160,6 +2158,8 @@ void wxTreeCtrl::CalculatePositions()
 
 void wxTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
 {
+    if (m_dirty) return;
+
     wxClientDC dc(this);
     PrepareDC(dc);
 
@@ -2180,6 +2180,8 @@ void wxTreeCtrl::RefreshSubtree(wxGenericTreeItem *item)
 
 void wxTreeCtrl::RefreshLine( wxGenericTreeItem *item )
 {
+    if (m_dirty) return;
+
     wxClientDC dc(this);
     PrepareDC( dc );
 
index a4861030902b111ea2e0bc23f3203ed95b2b5831..5e9d1ce629aec4527207a93e0d9f0d1444302985 100644 (file)
@@ -398,7 +398,16 @@ static GdkFont *GtkGetDefaultGuiFont()
     {
         GtkWidget *widget = gtk_button_new();
         GtkStyle *def = gtk_rc_get_style( widget );
-        g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        if (def)
+        {
+            g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        }
+        else
+        {
+            def = gtk_widget_get_default_style();
+            if (def)
+                g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        }
         gtk_widget_destroy( widget );
     }
     return g_systemDefaultGuiFont;
@@ -428,7 +437,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const
         {
             font = GtkGetDefaultGuiFont();
         }
-        else
+        if (!font)
         {
             font = wxLoadQueryNearestFont( point_scale,
                                            M_FONTDATA->m_family,
index db8fbc1bb6c3d84be6e455d8b4d951942459a2b3..ca5965f55df08e43b1cbd2a4bf6ba388afc34fcf 100644 (file)
@@ -128,23 +128,29 @@ wxColour wxSystemSettings::GetSystemColour( int index )
         {
             if (!g_systemHighlightColour)
             {
-/*
-                g_systemHighlightColour = 
-                       new wxColour( 0      >> SHIFT,
-                                     0      >> SHIFT,
-                                             0x9c40 >> SHIFT );
-*/              
                 GtkWidget *widget = gtk_button_new();
                 GtkStyle *def = gtk_rc_get_style( widget );
-                int red = def->bg[GTK_STATE_SELECTED].red;
-                int green = def->bg[GTK_STATE_SELECTED].green;
-                int blue = def->bg[GTK_STATE_SELECTED].blue;
+                if (!def)
+                    def = gtk_widget_get_default_style();
+                if (def)
+                {
+                    int red = def->bg[GTK_STATE_SELECTED].red;
+                    int green = def->bg[GTK_STATE_SELECTED].green;
+                    int blue = def->bg[GTK_STATE_SELECTED].blue;
+                    g_systemHighlightColour = 
+                           new wxColour( red    >> SHIFT,
+                                         green  >> SHIFT,
+                                                 blue   >> SHIFT );
+                }
+                else
+                {
+                    g_systemHighlightColour = 
+                           new wxColour( 0      >> SHIFT,
+                                         0      >> SHIFT,
+                                                 0x9c40 >> SHIFT );
+                }
                 gtk_widget_destroy( widget );
 
-                g_systemHighlightColour = 
-                       new wxColour( red    >> SHIFT,
-                                     green  >> SHIFT,
-                                             blue   >> SHIFT );
             }
             return *g_systemHighlightColour;
         }
index 6c749174f259c6d5935ec49ba2399235f48ecc5d..cc3a5b7c45ef43f12698504a26f9f93c33d0b6bb 100644 (file)
@@ -2962,7 +2962,12 @@ GtkStyle *wxWindow::GetWidgetStyle()
 {
     if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
 
-    m_widgetStyle = gtk_style_copy( gtk_rc_get_style( m_widget ) );
+    GtkStyle *def = gtk_rc_get_style( m_widget );
+
+    if (!def)
+        def = gtk_widget_get_default_style();
+
+    m_widgetStyle = gtk_style_copy( def );
 
     return m_widgetStyle;
 }
index a4861030902b111ea2e0bc23f3203ed95b2b5831..5e9d1ce629aec4527207a93e0d9f0d1444302985 100644 (file)
@@ -398,7 +398,16 @@ static GdkFont *GtkGetDefaultGuiFont()
     {
         GtkWidget *widget = gtk_button_new();
         GtkStyle *def = gtk_rc_get_style( widget );
-        g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        if (def)
+        {
+            g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        }
+        else
+        {
+            def = gtk_widget_get_default_style();
+            if (def)
+                g_systemDefaultGuiFont = gdk_font_ref( def->font );
+        }
         gtk_widget_destroy( widget );
     }
     return g_systemDefaultGuiFont;
@@ -428,7 +437,7 @@ GdkFont *wxFont::GetInternalFont( float scale ) const
         {
             font = GtkGetDefaultGuiFont();
         }
-        else
+        if (!font)
         {
             font = wxLoadQueryNearestFont( point_scale,
                                            M_FONTDATA->m_family,
index db8fbc1bb6c3d84be6e455d8b4d951942459a2b3..ca5965f55df08e43b1cbd2a4bf6ba388afc34fcf 100644 (file)
@@ -128,23 +128,29 @@ wxColour wxSystemSettings::GetSystemColour( int index )
         {
             if (!g_systemHighlightColour)
             {
-/*
-                g_systemHighlightColour = 
-                       new wxColour( 0      >> SHIFT,
-                                     0      >> SHIFT,
-                                             0x9c40 >> SHIFT );
-*/              
                 GtkWidget *widget = gtk_button_new();
                 GtkStyle *def = gtk_rc_get_style( widget );
-                int red = def->bg[GTK_STATE_SELECTED].red;
-                int green = def->bg[GTK_STATE_SELECTED].green;
-                int blue = def->bg[GTK_STATE_SELECTED].blue;
+                if (!def)
+                    def = gtk_widget_get_default_style();
+                if (def)
+                {
+                    int red = def->bg[GTK_STATE_SELECTED].red;
+                    int green = def->bg[GTK_STATE_SELECTED].green;
+                    int blue = def->bg[GTK_STATE_SELECTED].blue;
+                    g_systemHighlightColour = 
+                           new wxColour( red    >> SHIFT,
+                                         green  >> SHIFT,
+                                                 blue   >> SHIFT );
+                }
+                else
+                {
+                    g_systemHighlightColour = 
+                           new wxColour( 0      >> SHIFT,
+                                         0      >> SHIFT,
+                                                 0x9c40 >> SHIFT );
+                }
                 gtk_widget_destroy( widget );
 
-                g_systemHighlightColour = 
-                       new wxColour( red    >> SHIFT,
-                                     green  >> SHIFT,
-                                             blue   >> SHIFT );
             }
             return *g_systemHighlightColour;
         }
index 6c749174f259c6d5935ec49ba2399235f48ecc5d..cc3a5b7c45ef43f12698504a26f9f93c33d0b6bb 100644 (file)
@@ -2962,7 +2962,12 @@ GtkStyle *wxWindow::GetWidgetStyle()
 {
     if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
 
-    m_widgetStyle = gtk_style_copy( gtk_rc_get_style( m_widget ) );
+    GtkStyle *def = gtk_rc_get_style( m_widget );
+
+    if (!def)
+        def = gtk_widget_get_default_style();
+
+    m_widgetStyle = gtk_style_copy( def );
 
     return m_widgetStyle;
 }