More colour finetuning
Corrected wxCheckBoc and wxRadioButton::SetValue git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -90,6 +90,7 @@ class MyPanel: public wxPanel
|
|||||||
wxSpinButton *m_spinbutton;
|
wxSpinButton *m_spinbutton;
|
||||||
wxTextCtrl *m_spintext;
|
wxTextCtrl *m_spintext;
|
||||||
wxTextCtrl *m_multitext;
|
wxTextCtrl *m_multitext;
|
||||||
|
wxCheckBox *m_checkbox;
|
||||||
|
|
||||||
wxTextCtrl *m_text;
|
wxTextCtrl *m_text;
|
||||||
wxNotebook *m_notebook;
|
wxNotebook *m_notebook;
|
||||||
@@ -310,7 +311,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
|||||||
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
|
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
|
||||||
button = new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
|
button = new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
|
||||||
// button->SetForegroundColour( "red" );
|
// button->SetForegroundColour( "red" );
|
||||||
(void)new wxCheckBox( panel, ID_LISTBOX_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
|
m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
|
||||||
m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
|
m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
|
||||||
|
|
||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
@@ -505,6 +506,7 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
|
|||||||
case ID_LISTBOX_FONT:
|
case ID_LISTBOX_FONT:
|
||||||
{
|
{
|
||||||
m_listbox->SetFont( *wxITALIC_FONT );
|
m_listbox->SetFont( *wxITALIC_FONT );
|
||||||
|
m_checkbox->SetFont( *wxITALIC_FONT );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -96,12 +96,9 @@ void wxCheckBox::SetValue( bool state )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
if (state)
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
|
|
||||||
else
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
|
|
||||||
|
|
||||||
m_blockFirstEvent = TRUE;
|
m_blockFirstEvent = TRUE;
|
||||||
|
|
||||||
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), state );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCheckBox::GetValue() const
|
bool wxCheckBox::GetValue() const
|
||||||
|
@@ -102,9 +102,9 @@ void wxRadioButton::SetValue( bool val )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
|
wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
|
||||||
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
|
|
||||||
|
|
||||||
m_blockFirstEvent = TRUE;
|
m_blockFirstEvent = TRUE;
|
||||||
|
|
||||||
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRadioButton::GetValue(void) const
|
bool wxRadioButton::GetValue(void) const
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include <wx/intl.h>
|
#include "wx/intl.h"
|
||||||
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -676,6 +677,14 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
wxControl::SetBackgroundColour( colour );
|
wxControl::SetBackgroundColour( colour );
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == colour.Red() &&
|
||||||
|
sysbg.Green() == colour.Green() &&
|
||||||
|
sysbg.Blue() == colour.Blue())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
if (m_windowStyle & wxTE_MULTILINE)
|
if (m_windowStyle & wxTE_MULTILINE)
|
||||||
|
@@ -2164,14 +2164,6 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
if (m_backgroundColour == colour) return;
|
if (m_backgroundColour == colour) return;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
|
||||||
if (sysbg.Red() == colour.Red() &&
|
|
||||||
sysbg.Green() == colour.Green() &&
|
|
||||||
sysbg.Blue() == colour.Blue())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_backgroundColour = colour;
|
m_backgroundColour = colour;
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
@@ -2183,7 +2175,19 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == colour.Red() &&
|
||||||
|
sysbg.Green() == colour.Green() &&
|
||||||
|
sysbg.Blue() == colour.Blue())
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
m_backgroundColour = sysbg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxWindow::GetForegroundColour() const
|
wxColour wxWindow::GetForegroundColour() const
|
||||||
@@ -2200,7 +2204,19 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
m_foregroundColour = colour;
|
m_foregroundColour = colour;
|
||||||
if (!m_foregroundColour.Ok()) return;
|
if (!m_foregroundColour.Ok()) return;
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == colour.Red() &&
|
||||||
|
sysbg.Green() == colour.Green() &&
|
||||||
|
sysbg.Blue() == colour.Blue())
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
m_backgroundColour = sysbg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkStyle *wxWindow::GetWidgetStyle()
|
GtkStyle *wxWindow::GetWidgetStyle()
|
||||||
@@ -2395,7 +2411,19 @@ void wxWindow::SetFont( const wxFont &font )
|
|||||||
else
|
else
|
||||||
m_font = *wxSWISS_FONT;
|
m_font = *wxSWISS_FONT;
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == m_backgroundColour.Red() &&
|
||||||
|
sysbg.Green() == m_backgroundColour.Green() &&
|
||||||
|
sysbg.Blue() == m_backgroundColour.Blue())
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
m_backgroundColour = sysbg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetWindowStyleFlag( long flag )
|
void wxWindow::SetWindowStyleFlag( long flag )
|
||||||
|
@@ -96,12 +96,9 @@ void wxCheckBox::SetValue( bool state )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
wxCHECK_RET( m_widget != NULL, "invalid checkbox" );
|
||||||
|
|
||||||
if (state)
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
|
|
||||||
else
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
|
|
||||||
|
|
||||||
m_blockFirstEvent = TRUE;
|
m_blockFirstEvent = TRUE;
|
||||||
|
|
||||||
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), state );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCheckBox::GetValue() const
|
bool wxCheckBox::GetValue() const
|
||||||
|
@@ -102,9 +102,9 @@ void wxRadioButton::SetValue( bool val )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
|
wxCHECK_RET( m_widget != NULL, "invalid radiobutton" );
|
||||||
|
|
||||||
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
|
|
||||||
|
|
||||||
m_blockFirstEvent = TRUE;
|
m_blockFirstEvent = TRUE;
|
||||||
|
|
||||||
|
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRadioButton::GetValue(void) const
|
bool wxRadioButton::GetValue(void) const
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include <wx/intl.h>
|
#include "wx/intl.h"
|
||||||
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -676,6 +677,14 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
wxControl::SetBackgroundColour( colour );
|
wxControl::SetBackgroundColour( colour );
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == colour.Red() &&
|
||||||
|
sysbg.Green() == colour.Green() &&
|
||||||
|
sysbg.Blue() == colour.Blue())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
if (m_windowStyle & wxTE_MULTILINE)
|
if (m_windowStyle & wxTE_MULTILINE)
|
||||||
|
@@ -2164,14 +2164,6 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
|
|
||||||
if (m_backgroundColour == colour) return;
|
if (m_backgroundColour == colour) return;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
|
||||||
if (sysbg.Red() == colour.Red() &&
|
|
||||||
sysbg.Green() == colour.Green() &&
|
|
||||||
sysbg.Blue() == colour.Blue())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_backgroundColour = colour;
|
m_backgroundColour = colour;
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok()) return;
|
||||||
|
|
||||||
@@ -2183,7 +2175,19 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
|||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == colour.Red() &&
|
||||||
|
sysbg.Green() == colour.Green() &&
|
||||||
|
sysbg.Blue() == colour.Blue())
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
m_backgroundColour = sysbg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxWindow::GetForegroundColour() const
|
wxColour wxWindow::GetForegroundColour() const
|
||||||
@@ -2200,7 +2204,19 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
|||||||
m_foregroundColour = colour;
|
m_foregroundColour = colour;
|
||||||
if (!m_foregroundColour.Ok()) return;
|
if (!m_foregroundColour.Ok()) return;
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == colour.Red() &&
|
||||||
|
sysbg.Green() == colour.Green() &&
|
||||||
|
sysbg.Blue() == colour.Blue())
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
m_backgroundColour = sysbg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkStyle *wxWindow::GetWidgetStyle()
|
GtkStyle *wxWindow::GetWidgetStyle()
|
||||||
@@ -2395,7 +2411,19 @@ void wxWindow::SetFont( const wxFont &font )
|
|||||||
else
|
else
|
||||||
m_font = *wxSWISS_FONT;
|
m_font = *wxSWISS_FONT;
|
||||||
|
|
||||||
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
if (sysbg.Red() == m_backgroundColour.Red() &&
|
||||||
|
sysbg.Green() == m_backgroundColour.Green() &&
|
||||||
|
sysbg.Blue() == m_backgroundColour.Blue())
|
||||||
|
{
|
||||||
|
m_backgroundColour = wxNullColour;
|
||||||
ApplyWidgetStyle();
|
ApplyWidgetStyle();
|
||||||
|
m_backgroundColour = sysbg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetWindowStyleFlag( long flag )
|
void wxWindow::SetWindowStyleFlag( long flag )
|
||||||
|
Reference in New Issue
Block a user