mild gradients for the glossy theme

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams 2006-11-09 06:49:53 +00:00
parent b95d098489
commit 1750e8e256
2 changed files with 60 additions and 44 deletions

View File

@ -263,11 +263,9 @@ protected:
wxFont m_normal_font; wxFont m_normal_font;
wxFont m_selected_font; wxFont m_selected_font;
wxFont m_measuring_font; wxFont m_measuring_font;
wxPen m_normal_bkpen; wxColour m_base_colour;
wxPen m_selected_bkpen; wxPen m_base_colour_pen;
wxBrush m_normal_bkbrush; wxBrush m_base_colour_brush;
wxBrush m_selected_bkbrush;
wxBrush m_bkbrush;
wxBitmap m_active_close_bmp; wxBitmap m_active_close_bmp;
wxBitmap m_disabled_close_bmp; wxBitmap m_disabled_close_bmp;
wxBitmap m_active_left_bmp; wxBitmap m_active_left_bmp;

View File

@ -223,18 +223,9 @@ wxAuiDefaultTabArt::wxAuiDefaultTabArt()
m_fixed_tab_width = 100; m_fixed_tab_width = 100;
m_tab_ctrl_height = 0; m_tab_ctrl_height = 0;
wxColour base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); m_base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
m_base_colour_pen = wxPen(m_base_colour);
wxColour background_colour = base_colour; m_base_colour_brush = wxBrush(m_base_colour);
wxColour normaltab_colour = base_colour;
wxColour selectedtab_colour = base_colour;
m_bkbrush = wxBrush(background_colour);
m_normal_bkbrush = wxBrush(normaltab_colour);
m_normal_bkpen = wxPen(normaltab_colour);
m_selected_bkbrush = wxBrush(selectedtab_colour);
m_selected_bkpen = wxPen(selectedtab_colour);
m_active_close_bmp = BitmapFromBits(close_bits, 16, 16, *wxBLACK); m_active_close_bmp = BitmapFromBits(close_bits, 16, 16, *wxBLACK);
m_disabled_close_bmp = BitmapFromBits(close_bits, 16, 16, wxColour(128,128,128)); m_disabled_close_bmp = BitmapFromBits(close_bits, 16, 16, wxColour(128,128,128));
@ -295,14 +286,20 @@ void wxAuiDefaultTabArt::DrawBackground(wxDC& dc,
const wxRect& rect) const wxRect& rect)
{ {
// draw background // draw background
dc.SetBrush(m_bkbrush); wxRect r(rect.x, rect.y, rect.width+2, rect.height-2);
dc.SetPen(*wxTRANSPARENT_PEN); //wxColor start_colour = m_base_colour;
dc.DrawRectangle(-1, -1, rect.GetWidth()+2, rect.GetHeight()+2); //wxColor end_colour = StepColour(start_colour, 110);
wxColor start_colour = StepColour(m_base_colour, 90);
wxColor end_colour = StepColour(m_base_colour, 110);
dc.GradientFillLinear(r, start_colour, end_colour, wxSOUTH);
// draw base lines // draw base lines
dc.SetPen(*wxGREY_PEN); dc.SetPen(*wxGREY_PEN);
dc.DrawLine(0, rect.GetHeight()-4, rect.GetWidth(), rect.GetHeight()-4); dc.DrawLine(0, rect.GetHeight()-4, rect.GetWidth(), rect.GetHeight()-4);
dc.DrawLine(0, rect.GetHeight()-1, rect.GetWidth(), rect.GetHeight()-1); dc.DrawLine(0, rect.GetHeight()-1, rect.GetWidth(), rect.GetHeight()-1);
dc.SetPen(wxPen(start_colour));
dc.DrawLine(0, rect.GetHeight()-3, rect.GetWidth(), rect.GetHeight()-3);
dc.DrawLine(0, rect.GetHeight()-2, rect.GetWidth(), rect.GetHeight()-2);
} }
@ -366,16 +363,12 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
if (active) if (active)
{ {
dc.SetPen(m_selected_bkpen);
dc.SetBrush(m_selected_bkbrush);
dc.SetFont(m_selected_font); dc.SetFont(m_selected_font);
textx = selected_textx; textx = selected_textx;
texty = selected_texty; texty = selected_texty;
} }
else else
{ {
dc.SetPen(m_normal_bkpen);
dc.SetBrush(m_normal_bkbrush);
dc.SetFont(m_normal_font); dc.SetFont(m_normal_font);
textx = normal_textx; textx = normal_textx;
texty = normal_texty; texty = normal_texty;
@ -401,27 +394,53 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
int drawn_tab_yoff = points[1].y; int drawn_tab_yoff = points[1].y;
int drawn_tab_height = points[0].y - points[1].y; int drawn_tab_height = points[0].y - points[1].y;
// draw gradient background
if (active) if (active)
{ {
wxColour c = m_bkbrush.GetColour(); // draw active tab
dc.SetPen(wxPen(c));
int y, last_y = -1; // move rectangle in a bit so that the inside border has
for (y = points[0].y; y > points[2].y; --y) // a bevelled look
{ wxRect r(tab_x, tab_y+1, tab_width, tab_height-3);
if (y < tab_y+(tab_height*3/5) && y != last_y) r.x += 2;
{ r.width -= 2;
last_y = y;
c = StepColour(c, 102); // draw base background color
dc.SetPen(wxPen(c)); dc.SetPen(*wxWHITE_PEN);
} dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(r.x, r.y, r.width-1, r.height-1);
dc.DrawLine(points[0].x+1, y, points[5].x, y);
} // set rectangle down a bit for gradient drawing
r.SetHeight(r.GetHeight()/2);
r.y += r.height;
// draw gradient background
wxColor start_color = m_base_colour;
wxColor end_color = *wxWHITE;
dc.GradientFillLinear(r, start_color, end_color, wxNORTH);
} }
else
{
// draw inactive tab
wxRect r(tab_x, tab_y+1, tab_width, tab_height-3);
// draw base background color for inactive tabs
dc.SetPen(m_base_colour_pen);
dc.SetBrush(m_base_colour_brush);
dc.DrawRectangle(r.x, r.y, r.width-1, r.height-1);
// start the gradent up a bit and leave the inside border inset
// by a pixel for a 3D look. Only the top half of the inactive
// tab will have a slight gradient
r.x += 2;
r.width -= 2;
r.height /= 2;
// -- draw bottom gradient fill for glossy look
wxColor top_color = m_base_colour;
wxColor bottom_color = StepColour(top_color, 106);
dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH);
}
// draw tab outline // draw tab outline
dc.SetPen(*wxGREY_PEN); dc.SetPen(*wxGREY_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
@ -431,8 +450,7 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc,
// this gets rid of the top one of those lines in the tab control // this gets rid of the top one of those lines in the tab control
if (active) if (active)
{ {
wxColour c = m_bkbrush.GetColour(); dc.SetPen(m_base_colour_pen);
dc.SetPen(wxPen(c));
dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y); dc.DrawLine(points[0].x, points[0].y, points[5].x+1, points[5].y);
} }