background colour changes for listbox and combobox
authorRobert Roebling <robert@roebling.de>
Wed, 28 Apr 1999 12:56:25 +0000 (12:56 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 28 Apr 1999 12:56:25 +0000 (12:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/combobox.cpp
src/gtk/listbox.cpp
src/gtk/settings.cpp
src/gtk1/combobox.cpp
src/gtk1/listbox.cpp
src/gtk1/settings.cpp

index cb5a74135aea13b0d37f14fc84018c6b6a00b854..7c2a75604b99fd6f66286986714436ba7f4abbcb 100644 (file)
@@ -12,6 +12,7 @@
 #endif
 
 #include "wx/combobox.h"
+#include "wx/settings.h"
 
 #include <wx/intl.h>
 
@@ -145,7 +146,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
+    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetFont( parent->GetFont() );
 
@@ -590,7 +591,7 @@ void wxComboBox::ApplyWidgetStyle()
 {
     SetWidgetStyle();
 
-    gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
+//    gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
     gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
     gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
 
index e0fa8aca7eeba050e2e0e49e65020bc5f97c9956..406b583e7cac31d096bfa0ff0f1f9e551ad6e4d4 100644 (file)
@@ -17,6 +17,7 @@
 #include "wx/utils.h"
 #include "wx/intl.h"
 #include "wx/checklst.h"
+#include "wx/settings.h"
 
 #if wxUSE_TOOLTIPS
 #include "wx/tooltip.h"
@@ -287,7 +288,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
+    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetFont( parent->GetFont() );
 
index 2b774f2a8b4419b00c005d3514b70543b0beb2af..72b4c3e2a804cd6d03a51e6b7eb95b1e7e75a75f 100644 (file)
@@ -56,6 +56,7 @@
 
 #define SHIFT (8*(sizeof(short int)-sizeof(char)))
 
+wxColour *g_systemWinColour          = (wxColour *) NULL;
 wxColour *g_systemBtnFaceColour      = (wxColour *) NULL;
 wxColour *g_systemBtnShadowColour    = (wxColour *) NULL;
 wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
@@ -65,11 +66,12 @@ wxFont *g_systemFont = (wxFont *) NULL;
 
 void wxSystemSettings::Done() 
 {
-    wxDELETE(g_systemBtnFaceColour);
-    wxDELETE(g_systemBtnShadowColour);
-    wxDELETE(g_systemBtnHighlightColour);
-    wxDELETE(g_systemHighlightColour);
-    wxDELETE(g_systemFont);
+    delete g_systemWinColour;
+    delete g_systemBtnFaceColour;
+    delete g_systemBtnShadowColour;
+    delete g_systemBtnHighlightColour;
+    delete g_systemHighlightColour;
+    delete g_systemFont;
 }
 
 wxColour wxSystemSettings::GetSystemColour( int index )
@@ -81,7 +83,6 @@ wxColour wxSystemSettings::GetSystemColour( int index )
     case wxSYS_COLOUR_ACTIVECAPTION:
     case wxSYS_COLOUR_INACTIVECAPTION:
     case wxSYS_COLOUR_MENU:
-    case wxSYS_COLOUR_WINDOW:
     case wxSYS_COLOUR_WINDOWFRAME:
     case wxSYS_COLOUR_ACTIVEBORDER:
     case wxSYS_COLOUR_INACTIVEBORDER:
@@ -97,6 +98,18 @@ wxColour wxSystemSettings::GetSystemColour( int index )
       }
       return *g_systemBtnFaceColour;
     }
+    case wxSYS_COLOUR_WINDOW:
+    {
+      GtkStyle *style = gtk_widget_get_default_style();
+      if (!g_systemWinColour)
+      {
+        g_systemWinColour = 
+         new wxColour( style->base[0].red >> SHIFT,
+                       style->base[0].green >> SHIFT,
+                       style->base[0].blue >> SHIFT );
+      }
+      return *g_systemWinColour;
+    }
     case wxSYS_COLOUR_GRAYTEXT:
     case wxSYS_COLOUR_BTNSHADOW:
     {
index cb5a74135aea13b0d37f14fc84018c6b6a00b854..7c2a75604b99fd6f66286986714436ba7f4abbcb 100644 (file)
@@ -12,6 +12,7 @@
 #endif
 
 #include "wx/combobox.h"
+#include "wx/settings.h"
 
 #include <wx/intl.h>
 
@@ -145,7 +146,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
     gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
+    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetFont( parent->GetFont() );
 
@@ -590,7 +591,7 @@ void wxComboBox::ApplyWidgetStyle()
 {
     SetWidgetStyle();
 
-    gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
+//    gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle );
     gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle );
     gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );
 
index e0fa8aca7eeba050e2e0e49e65020bc5f97c9956..406b583e7cac31d096bfa0ff0f1f9e551ad6e4d4 100644 (file)
@@ -17,6 +17,7 @@
 #include "wx/utils.h"
 #include "wx/intl.h"
 #include "wx/checklst.h"
+#include "wx/settings.h"
 
 #if wxUSE_TOOLTIPS
 #include "wx/tooltip.h"
@@ -287,7 +288,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     PostCreation();
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
+    SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
     SetForegroundColour( parent->GetForegroundColour() );
     SetFont( parent->GetFont() );
 
index 2b774f2a8b4419b00c005d3514b70543b0beb2af..72b4c3e2a804cd6d03a51e6b7eb95b1e7e75a75f 100644 (file)
@@ -56,6 +56,7 @@
 
 #define SHIFT (8*(sizeof(short int)-sizeof(char)))
 
+wxColour *g_systemWinColour          = (wxColour *) NULL;
 wxColour *g_systemBtnFaceColour      = (wxColour *) NULL;
 wxColour *g_systemBtnShadowColour    = (wxColour *) NULL;
 wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
@@ -65,11 +66,12 @@ wxFont *g_systemFont = (wxFont *) NULL;
 
 void wxSystemSettings::Done() 
 {
-    wxDELETE(g_systemBtnFaceColour);
-    wxDELETE(g_systemBtnShadowColour);
-    wxDELETE(g_systemBtnHighlightColour);
-    wxDELETE(g_systemHighlightColour);
-    wxDELETE(g_systemFont);
+    delete g_systemWinColour;
+    delete g_systemBtnFaceColour;
+    delete g_systemBtnShadowColour;
+    delete g_systemBtnHighlightColour;
+    delete g_systemHighlightColour;
+    delete g_systemFont;
 }
 
 wxColour wxSystemSettings::GetSystemColour( int index )
@@ -81,7 +83,6 @@ wxColour wxSystemSettings::GetSystemColour( int index )
     case wxSYS_COLOUR_ACTIVECAPTION:
     case wxSYS_COLOUR_INACTIVECAPTION:
     case wxSYS_COLOUR_MENU:
-    case wxSYS_COLOUR_WINDOW:
     case wxSYS_COLOUR_WINDOWFRAME:
     case wxSYS_COLOUR_ACTIVEBORDER:
     case wxSYS_COLOUR_INACTIVEBORDER:
@@ -97,6 +98,18 @@ wxColour wxSystemSettings::GetSystemColour( int index )
       }
       return *g_systemBtnFaceColour;
     }
+    case wxSYS_COLOUR_WINDOW:
+    {
+      GtkStyle *style = gtk_widget_get_default_style();
+      if (!g_systemWinColour)
+      {
+        g_systemWinColour = 
+         new wxColour( style->base[0].red >> SHIFT,
+                       style->base[0].green >> SHIFT,
+                       style->base[0].blue >> SHIFT );
+      }
+      return *g_systemWinColour;
+    }
     case wxSYS_COLOUR_GRAYTEXT:
     case wxSYS_COLOUR_BTNSHADOW:
     {