Fix wxListCtrl bakground colour bug Part II.
Make wxWindow::Refresh() wake up idle. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2164,10 +2164,10 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
|
|||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (win->m_delayedBackgroundColour)
|
if (win->m_delayedBackgroundColour)
|
||||||
win->SetBackgroundColour( win->GetBackgroundColour() );
|
win->GtkSetBackgroundColour( win->GetBackgroundColour() );
|
||||||
|
|
||||||
if (win->m_delayedForegroundColour)
|
if (win->m_delayedForegroundColour)
|
||||||
win->SetForegroundColour( win->GetForegroundColour() );
|
win->GtkSetForegroundColour( win->GetForegroundColour() );
|
||||||
|
|
||||||
wxWindowCreateEvent event( win );
|
wxWindowCreateEvent event( win );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
@@ -3418,6 +3418,9 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
if (!m_widget->window) return;
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
#ifndef __WXGTK20__
|
#ifndef __WXGTK20__
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
if (rect)
|
if (rect)
|
||||||
@@ -3619,16 +3622,37 @@ void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
GdkWindow *window = (GdkWindow*) NULL;
|
||||||
|
if (m_wxwindow)
|
||||||
|
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
else
|
||||||
|
window = GetConnectWidget()->window;
|
||||||
|
|
||||||
|
wxASSERT( window );
|
||||||
|
|
||||||
|
// We need the pixel value e.g. for background clearing.
|
||||||
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
|
|
||||||
|
if ((m_wxwindow) &&
|
||||||
|
(m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)))
|
||||||
|
{
|
||||||
|
/* wxMSW doesn't clear the window here. I don't do that either to
|
||||||
|
provide compatibility. call Clear() to do the job. */
|
||||||
|
|
||||||
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
|
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
||||||
|
|
||||||
if (!wxWindowBase::SetBackgroundColour(colour))
|
if (!wxWindowBase::SetBackgroundColour(colour))
|
||||||
{
|
return FALSE;
|
||||||
// don't leave if the GTK widget has just
|
|
||||||
// been realized
|
|
||||||
if (!m_delayedBackgroundColour) return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkWindow *window = (GdkWindow*) NULL;
|
GdkWindow *window = (GdkWindow*) NULL;
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
@@ -3642,29 +3666,29 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
|
|||||||
// but it couldn't get applied as the
|
// but it couldn't get applied as the
|
||||||
// widget hasn't been realized yet.
|
// widget hasn't been realized yet.
|
||||||
m_delayedBackgroundColour = TRUE;
|
m_delayedBackgroundColour = TRUE;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (window)
|
|
||||||
{
|
{
|
||||||
// We need the pixel value e.g. for background clearing.
|
GtkSetBackgroundColour( colour );
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_wxwindow) &&
|
|
||||||
(m_wxwindow->window) &&
|
|
||||||
(m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)))
|
|
||||||
{
|
|
||||||
/* wxMSW doesn't clear the window here. I don't do that either to
|
|
||||||
provide compatibility. call Clear() to do the job. */
|
|
||||||
|
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplyWidgetStyle();
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::GtkSetForegroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
GdkWindow *window = (GdkWindow*) NULL;
|
||||||
|
if (m_wxwindow)
|
||||||
|
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
else
|
||||||
|
window = GetConnectWidget()->window;
|
||||||
|
|
||||||
|
wxASSERT( window );
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
|
bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
||||||
@@ -3689,8 +3713,10 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
|
|||||||
// widget hasn't been realized yet.
|
// widget hasn't been realized yet.
|
||||||
m_delayedForegroundColour = TRUE;
|
m_delayedForegroundColour = TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
ApplyWidgetStyle();
|
{
|
||||||
|
GtkSetForegroundColour( colour );
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -2164,10 +2164,10 @@ gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
|
|||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (win->m_delayedBackgroundColour)
|
if (win->m_delayedBackgroundColour)
|
||||||
win->SetBackgroundColour( win->GetBackgroundColour() );
|
win->GtkSetBackgroundColour( win->GetBackgroundColour() );
|
||||||
|
|
||||||
if (win->m_delayedForegroundColour)
|
if (win->m_delayedForegroundColour)
|
||||||
win->SetForegroundColour( win->GetForegroundColour() );
|
win->GtkSetForegroundColour( win->GetForegroundColour() );
|
||||||
|
|
||||||
wxWindowCreateEvent event( win );
|
wxWindowCreateEvent event( win );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
@@ -3418,6 +3418,9 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
|||||||
if (!m_widget->window) return;
|
if (!m_widget->window) return;
|
||||||
|
|
||||||
#ifndef __WXGTK20__
|
#ifndef __WXGTK20__
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
if (eraseBackground && m_wxwindow && m_wxwindow->window)
|
||||||
{
|
{
|
||||||
if (rect)
|
if (rect)
|
||||||
@@ -3619,16 +3622,37 @@ void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
|
|||||||
}
|
}
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
GdkWindow *window = (GdkWindow*) NULL;
|
||||||
|
if (m_wxwindow)
|
||||||
|
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
else
|
||||||
|
window = GetConnectWidget()->window;
|
||||||
|
|
||||||
|
wxASSERT( window );
|
||||||
|
|
||||||
|
// We need the pixel value e.g. for background clearing.
|
||||||
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
|
|
||||||
|
if ((m_wxwindow) &&
|
||||||
|
(m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)))
|
||||||
|
{
|
||||||
|
/* wxMSW doesn't clear the window here. I don't do that either to
|
||||||
|
provide compatibility. call Clear() to do the job. */
|
||||||
|
|
||||||
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
|
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
||||||
|
|
||||||
if (!wxWindowBase::SetBackgroundColour(colour))
|
if (!wxWindowBase::SetBackgroundColour(colour))
|
||||||
{
|
return FALSE;
|
||||||
// don't leave if the GTK widget has just
|
|
||||||
// been realized
|
|
||||||
if (!m_delayedBackgroundColour) return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkWindow *window = (GdkWindow*) NULL;
|
GdkWindow *window = (GdkWindow*) NULL;
|
||||||
if (m_wxwindow)
|
if (m_wxwindow)
|
||||||
@@ -3642,29 +3666,29 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
|
|||||||
// but it couldn't get applied as the
|
// but it couldn't get applied as the
|
||||||
// widget hasn't been realized yet.
|
// widget hasn't been realized yet.
|
||||||
m_delayedBackgroundColour = TRUE;
|
m_delayedBackgroundColour = TRUE;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (window)
|
|
||||||
{
|
{
|
||||||
// We need the pixel value e.g. for background clearing.
|
GtkSetBackgroundColour( colour );
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_wxwindow) &&
|
|
||||||
(m_wxwindow->window) &&
|
|
||||||
(m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)))
|
|
||||||
{
|
|
||||||
/* wxMSW doesn't clear the window here. I don't do that either to
|
|
||||||
provide compatibility. call Clear() to do the job. */
|
|
||||||
|
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
|
||||||
}
|
|
||||||
|
|
||||||
ApplyWidgetStyle();
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWindowGTK::GtkSetForegroundColour( const wxColour &colour )
|
||||||
|
{
|
||||||
|
GdkWindow *window = (GdkWindow*) NULL;
|
||||||
|
if (m_wxwindow)
|
||||||
|
window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
|
else
|
||||||
|
window = GetConnectWidget()->window;
|
||||||
|
|
||||||
|
wxASSERT( window );
|
||||||
|
|
||||||
|
ApplyWidgetStyle();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
|
bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
|
||||||
@@ -3689,8 +3713,10 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
|
|||||||
// widget hasn't been realized yet.
|
// widget hasn't been realized yet.
|
||||||
m_delayedForegroundColour = TRUE;
|
m_delayedForegroundColour = TRUE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
ApplyWidgetStyle();
|
{
|
||||||
|
GtkSetForegroundColour( colour );
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user