Bunch of GTK theme changes.

Make wxStatusBar use themes.
  SetStatusText() now uses Refresh() since I don't
    know why it shouldn't.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-04-21 16:43:15 +00:00
parent c7de4135b6
commit f90566f5c3
5 changed files with 87 additions and 105 deletions

View File

@@ -85,6 +85,9 @@ bool wxStatusBarGeneric::Create(wxWindow *parent,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
style | wxTAB_TRAVERSAL, name); style | wxTAB_TRAVERSAL, name);
// The status bar should have a themed background
SetThemeEnabled( TRUE );
// Don't wish this to be found as a child // Don't wish this to be found as a child
#ifndef __WXMAC__ #ifndef __WXMAC__
parent->GetChildren().DeleteObject(this); parent->GetChildren().DeleteObject(this);
@@ -127,27 +130,10 @@ void wxStatusBarGeneric::SetStatusText(const wxString& text, int number)
m_statusStrings[number] = text; m_statusStrings[number] = text;
#ifdef __WXMAC__
int major,minor;
wxGetOsVersion( &major, &minor );
if (major >= 10)
{
Refresh();
return;
}
#endif
wxRect rect; wxRect rect;
GetFieldRect(number, rect); GetFieldRect(number, rect);
wxClientDC dc(this);
dc.SetBackground( wxBrush(GetBackgroundColour(), wxSOLID) ); Refresh( TRUE, &rect );
dc.SetClippingRegion( rect.x+1, rect.y+1, rect.width-1, rect.height-1 );
dc.Clear();
dc.DestroyClippingRegion();
dc.SetFont(GetFont());
DrawFieldText( dc, number );
} }
wxString wxStatusBarGeneric::GetStatusText(int n) const wxString wxStatusBarGeneric::GetStatusText(int n) const

View File

@@ -1569,9 +1569,7 @@ void wxWindowDC::Clear()
if (m_owner) if (m_owner)
{ {
int width,height; m_owner->Clear();
m_owner->GetSize( &width, &height );
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
return; return;
} }

View File

@@ -3467,28 +3467,14 @@ void wxWindowGTK::GtkSendPaintEvents()
return; return;
} }
m_clipPaintRegion = TRUE;
// if (!m_clearRegion.IsEmpty()) // always send an erase event
{
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_clearRegion );
wxEraseEvent erase_event( GetId(), &dc );
erase_event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( GTK_PIZZA(m_wxwindow)->bin_window );
gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
}
gdk_gc_set_foreground( g_eraseGC, m_backgroundColour.GetColor() );
// widget to draw on // widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow); GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
// Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE;
if (GetThemeEnabled())
{
// find ancestor from which to steal background // find ancestor from which to steal background
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
while (parent && !parent->IsTopLevel()) while (parent && !parent->IsTopLevel())
@@ -3496,10 +3482,8 @@ void wxWindowGTK::GtkSendPaintEvents()
if (!parent) if (!parent)
parent = this; parent = this;
wxRegionIterator upd( m_clearRegion ); wxRegionIterator upd( m_updateRegion );
while (upd) while (upd)
{
if (GetThemeEnabled())
{ {
GdkRectangle rect; GdkRectangle rect;
rect.x = upd.GetX(); rect.x = upd.GetX();
@@ -3515,12 +3499,33 @@ void wxWindowGTK::GtkSendPaintEvents()
parent->m_widget, parent->m_widget,
(char *)"base", (char *)"base",
0, 0, -1, -1 ); 0, 0, -1, -1 );
upd ++;
}
} }
else else
// if (!m_clearRegion.IsEmpty()) // always send an erase event
{
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_clearRegion );
wxEraseEvent erase_event( GetId(), &dc );
erase_event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( pizza->bin_window );
gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
}
gdk_gc_set_foreground( g_eraseGC, m_backgroundColour.GetColor() );
wxRegionIterator upd( m_clearRegion );
while (upd)
{ {
gdk_draw_rectangle( pizza->bin_window, g_eraseGC, 1, gdk_draw_rectangle( pizza->bin_window, g_eraseGC, 1,
upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() ); upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
}
upd ++; upd ++;
} }
} }
@@ -3543,8 +3548,6 @@ void wxWindowGTK::GtkSendPaintEvents()
// being redrawn because the wxWindows class is allowed to // being redrawn because the wxWindows class is allowed to
// paint over the window-less widgets. // paint over the window-less widgets.
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
GList *children = pizza->children; GList *children = pizza->children;
while (children) while (children)
{ {
@@ -3629,12 +3632,9 @@ void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour )
// We need the pixel value e.g. for background clearing. // We need the pixel value e.g. for background clearing.
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
if ((m_wxwindow) && if (m_wxwindow)
(m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)))
{ {
/* wxMSW doesn't clear the window here. I don't do that either to // wxMSW doesn't clear the window here, either.
provide compatibility. call Clear() to do the job. */
gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
} }

View File

@@ -1569,9 +1569,7 @@ void wxWindowDC::Clear()
if (m_owner) if (m_owner)
{ {
int width,height; m_owner->Clear();
m_owner->GetSize( &width, &height );
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
return; return;
} }

View File

@@ -3467,28 +3467,14 @@ void wxWindowGTK::GtkSendPaintEvents()
return; return;
} }
m_clipPaintRegion = TRUE;
// if (!m_clearRegion.IsEmpty()) // always send an erase event
{
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_clearRegion );
wxEraseEvent erase_event( GetId(), &dc );
erase_event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( GTK_PIZZA(m_wxwindow)->bin_window );
gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
}
gdk_gc_set_foreground( g_eraseGC, m_backgroundColour.GetColor() );
// widget to draw on // widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow); GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
// Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE;
if (GetThemeEnabled())
{
// find ancestor from which to steal background // find ancestor from which to steal background
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
while (parent && !parent->IsTopLevel()) while (parent && !parent->IsTopLevel())
@@ -3496,10 +3482,8 @@ void wxWindowGTK::GtkSendPaintEvents()
if (!parent) if (!parent)
parent = this; parent = this;
wxRegionIterator upd( m_clearRegion ); wxRegionIterator upd( m_updateRegion );
while (upd) while (upd)
{
if (GetThemeEnabled())
{ {
GdkRectangle rect; GdkRectangle rect;
rect.x = upd.GetX(); rect.x = upd.GetX();
@@ -3515,12 +3499,33 @@ void wxWindowGTK::GtkSendPaintEvents()
parent->m_widget, parent->m_widget,
(char *)"base", (char *)"base",
0, 0, -1, -1 ); 0, 0, -1, -1 );
upd ++;
}
} }
else else
// if (!m_clearRegion.IsEmpty()) // always send an erase event
{
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_clearRegion );
wxEraseEvent erase_event( GetId(), &dc );
erase_event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( pizza->bin_window );
gdk_gc_set_fill( g_eraseGC, GDK_SOLID );
}
gdk_gc_set_foreground( g_eraseGC, m_backgroundColour.GetColor() );
wxRegionIterator upd( m_clearRegion );
while (upd)
{ {
gdk_draw_rectangle( pizza->bin_window, g_eraseGC, 1, gdk_draw_rectangle( pizza->bin_window, g_eraseGC, 1,
upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() ); upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
}
upd ++; upd ++;
} }
} }
@@ -3543,8 +3548,6 @@ void wxWindowGTK::GtkSendPaintEvents()
// being redrawn because the wxWindows class is allowed to // being redrawn because the wxWindows class is allowed to
// paint over the window-less widgets. // paint over the window-less widgets.
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
GList *children = pizza->children; GList *children = pizza->children;
while (children) while (children)
{ {
@@ -3629,12 +3632,9 @@ void wxWindowGTK::GtkSetBackgroundColour( const wxColour &colour )
// We need the pixel value e.g. for background clearing. // We need the pixel value e.g. for background clearing.
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
if ((m_wxwindow) && if (m_wxwindow)
(m_backgroundColour != wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)))
{ {
/* wxMSW doesn't clear the window here. I don't do that either to // wxMSW doesn't clear the window here, either.
provide compatibility. call Clear() to do the job. */
gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
} }