background colour changes for listbox and combobox

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-04-28 12:56:25 +00:00
parent f9a273cd71
commit 72a16063d3
6 changed files with 48 additions and 18 deletions

View File

@@ -12,6 +12,7 @@
#endif #endif
#include "wx/combobox.h" #include "wx/combobox.h"
#include "wx/settings.h"
#include <wx/intl.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_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
SetBackgroundColour( parent->GetBackgroundColour() ); SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
SetForegroundColour( parent->GetForegroundColour() ); SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() ); SetFont( parent->GetFont() );
@@ -590,7 +591,7 @@ void wxComboBox::ApplyWidgetStyle()
{ {
SetWidgetStyle(); 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)->entry, m_widgetStyle );
gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );

View File

@@ -17,6 +17,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/checklst.h" #include "wx/checklst.h"
#include "wx/settings.h"
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
#include "wx/tooltip.h" #include "wx/tooltip.h"
@@ -287,7 +288,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
PostCreation(); PostCreation();
SetBackgroundColour( parent->GetBackgroundColour() ); SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
SetForegroundColour( parent->GetForegroundColour() ); SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() ); SetFont( parent->GetFont() );

View File

@@ -56,6 +56,7 @@
#define SHIFT (8*(sizeof(short int)-sizeof(char))) #define SHIFT (8*(sizeof(short int)-sizeof(char)))
wxColour *g_systemWinColour = (wxColour *) NULL;
wxColour *g_systemBtnFaceColour = (wxColour *) NULL; wxColour *g_systemBtnFaceColour = (wxColour *) NULL;
wxColour *g_systemBtnShadowColour = (wxColour *) NULL; wxColour *g_systemBtnShadowColour = (wxColour *) NULL;
wxColour *g_systemBtnHighlightColour = (wxColour *) NULL; wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
@@ -65,11 +66,12 @@ wxFont *g_systemFont = (wxFont *) NULL;
void wxSystemSettings::Done() void wxSystemSettings::Done()
{ {
wxDELETE(g_systemBtnFaceColour); delete g_systemWinColour;
wxDELETE(g_systemBtnShadowColour); delete g_systemBtnFaceColour;
wxDELETE(g_systemBtnHighlightColour); delete g_systemBtnShadowColour;
wxDELETE(g_systemHighlightColour); delete g_systemBtnHighlightColour;
wxDELETE(g_systemFont); delete g_systemHighlightColour;
delete g_systemFont;
} }
wxColour wxSystemSettings::GetSystemColour( int index ) wxColour wxSystemSettings::GetSystemColour( int index )
@@ -81,7 +83,6 @@ wxColour wxSystemSettings::GetSystemColour( int index )
case wxSYS_COLOUR_ACTIVECAPTION: case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_INACTIVECAPTION: case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_MENU: case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_WINDOWFRAME: case wxSYS_COLOUR_WINDOWFRAME:
case wxSYS_COLOUR_ACTIVEBORDER: case wxSYS_COLOUR_ACTIVEBORDER:
case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_INACTIVEBORDER:
@@ -97,6 +98,18 @@ wxColour wxSystemSettings::GetSystemColour( int index )
} }
return *g_systemBtnFaceColour; 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_GRAYTEXT:
case wxSYS_COLOUR_BTNSHADOW: case wxSYS_COLOUR_BTNSHADOW:
{ {

View File

@@ -12,6 +12,7 @@
#endif #endif
#include "wx/combobox.h" #include "wx/combobox.h"
#include "wx/settings.h"
#include <wx/intl.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_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
SetBackgroundColour( parent->GetBackgroundColour() ); SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
SetForegroundColour( parent->GetForegroundColour() ); SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() ); SetFont( parent->GetFont() );
@@ -590,7 +591,7 @@ void wxComboBox::ApplyWidgetStyle()
{ {
SetWidgetStyle(); 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)->entry, m_widgetStyle );
gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle );

View File

@@ -17,6 +17,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/checklst.h" #include "wx/checklst.h"
#include "wx/settings.h"
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
#include "wx/tooltip.h" #include "wx/tooltip.h"
@@ -287,7 +288,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
PostCreation(); PostCreation();
SetBackgroundColour( parent->GetBackgroundColour() ); SetBackgroundColour( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_WINDOW ) );
SetForegroundColour( parent->GetForegroundColour() ); SetForegroundColour( parent->GetForegroundColour() );
SetFont( parent->GetFont() ); SetFont( parent->GetFont() );

View File

@@ -56,6 +56,7 @@
#define SHIFT (8*(sizeof(short int)-sizeof(char))) #define SHIFT (8*(sizeof(short int)-sizeof(char)))
wxColour *g_systemWinColour = (wxColour *) NULL;
wxColour *g_systemBtnFaceColour = (wxColour *) NULL; wxColour *g_systemBtnFaceColour = (wxColour *) NULL;
wxColour *g_systemBtnShadowColour = (wxColour *) NULL; wxColour *g_systemBtnShadowColour = (wxColour *) NULL;
wxColour *g_systemBtnHighlightColour = (wxColour *) NULL; wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
@@ -65,11 +66,12 @@ wxFont *g_systemFont = (wxFont *) NULL;
void wxSystemSettings::Done() void wxSystemSettings::Done()
{ {
wxDELETE(g_systemBtnFaceColour); delete g_systemWinColour;
wxDELETE(g_systemBtnShadowColour); delete g_systemBtnFaceColour;
wxDELETE(g_systemBtnHighlightColour); delete g_systemBtnShadowColour;
wxDELETE(g_systemHighlightColour); delete g_systemBtnHighlightColour;
wxDELETE(g_systemFont); delete g_systemHighlightColour;
delete g_systemFont;
} }
wxColour wxSystemSettings::GetSystemColour( int index ) wxColour wxSystemSettings::GetSystemColour( int index )
@@ -81,7 +83,6 @@ wxColour wxSystemSettings::GetSystemColour( int index )
case wxSYS_COLOUR_ACTIVECAPTION: case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_INACTIVECAPTION: case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_MENU: case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_WINDOWFRAME: case wxSYS_COLOUR_WINDOWFRAME:
case wxSYS_COLOUR_ACTIVEBORDER: case wxSYS_COLOUR_ACTIVEBORDER:
case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_INACTIVEBORDER:
@@ -97,6 +98,18 @@ wxColour wxSystemSettings::GetSystemColour( int index )
} }
return *g_systemBtnFaceColour; 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_GRAYTEXT:
case wxSYS_COLOUR_BTNSHADOW: case wxSYS_COLOUR_BTNSHADOW:
{ {