void DrawingUtils::DrawVerticalButton(wxDC& dc, const wxRect& rect, const bool &focus, const bool &leftTabs, bool vertical, bool hover ) { wxColour lightGray = GetGradient(); // Define the rounded rectangle base on the given rect // we need an array of 9 points for it wxColour topStartColor(wxT("WHITE")); wxColour topEndColor(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); // Define the middle points if ( focus ) { PaintStraightGradientBox(dc, rect, topStartColor, topEndColor, vertical); } else { wxRect r1; wxRect r2; topStartColor = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); topEndColor = lightGray; if (leftTabs) { r1 = wxRect(rect.x, rect.y, rect.width, rect.height/4); r2 = wxRect(rect.x, rect.y+rect.height/4, rect.width, (rect.height*3)/4); PaintStraightGradientBox(dc, r1, topEndColor, topStartColor, vertical); PaintStraightGradientBox(dc, r2, topStartColor, topStartColor, vertical); } else { r1 = wxRect(rect.x, rect.y, rect.width, (rect.height*3)/4); r2 = wxRect(rect.x, rect.y+(rect.height*3)/4, rect.width, rect.height/4); PaintStraightGradientBox(dc, r1, topStartColor, topStartColor, vertical); PaintStraightGradientBox(dc, r2, topStartColor, topEndColor, vertical); } } dc.SetBrush( *wxTRANSPARENT_BRUSH ); }
// ---------------------------------------------------------------------------- void BrowseSelector::OnPanelPaint(wxPaintEvent &event) // ---------------------------------------------------------------------------- { wxUnusedVar(event); wxPaintDC dc(m_panel); wxRect rect = m_panel->GetClientRect(); firstPaint = true; static wxBitmap bmp( rect.width, rect.height ); if( firstPaint ) { firstPaint = false; wxMemoryDC mem_dc; mem_dc.SelectObject( bmp ); wxColour endColour( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW) ); wxColour startColour( LightColour(endColour, 50) ); PaintStraightGradientBox(mem_dc, rect, startColour, endColour); // Draw the caption title and place the bitmap wxPoint bmpPt; wxPoint txtPt; // get the bitmap optimal position, and draw it bmpPt.y = (rect.height - m_bmp.GetHeight()) / 2; bmpPt.x = 3; mem_dc.DrawBitmap( m_bmp, bmpPt, true ); // get the text position, and draw it int fontHeight(0), w(0); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); font.SetWeight( wxFONTWEIGHT_BOLD ); mem_dc.SetFont( font ); mem_dc.GetTextExtent( wxT("Tp"), &w, &fontHeight ); txtPt.x = bmpPt.x + m_bmp.GetWidth() + 4; txtPt.y = (rect.height - fontHeight)/2; mem_dc.SetTextForeground( *wxWHITE ); mem_dc.DrawText( wxT("Browsed Tabs:"), txtPt ); mem_dc.SelectObject( wxNullBitmap ); } dc.DrawBitmap( bmp, 0, 0 ); }
void DrawingUtils::DrawHorizontalButton(wxDC& dc, const wxRect& rect, const bool& focus, const bool& upperTabs, bool vertical, bool hover) { wxColour lightGray = GetGradient(); wxColour topStartColor(wxT("WHITE")); wxColour topEndColor(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); // Define the middle points if(focus) { if(upperTabs) { PaintStraightGradientBox(dc, rect, topStartColor, topEndColor, vertical); } else { PaintStraightGradientBox(dc, rect, topEndColor, topStartColor, vertical); } } else { topStartColor = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); topEndColor = lightGray; wxRect r1; wxRect r2; if(upperTabs) { r1 = wxRect(rect.x, rect.y, rect.width, rect.height / 4); r2 = wxRect(rect.x, rect.y + rect.height / 4, rect.width, (rect.height * 3) / 4); PaintStraightGradientBox(dc, r1, topEndColor, topStartColor, vertical); PaintStraightGradientBox(dc, r2, topStartColor, topStartColor, vertical); } else { r1 = wxRect(rect.x, rect.y, rect.width, (rect.height * 3) / 4); r2 = wxRect(rect.x, rect.y + (rect.height * 3) / 4, rect.width, rect.height / 4); PaintStraightGradientBox(dc, r1, topStartColor, topStartColor, vertical); PaintStraightGradientBox(dc, r2, topStartColor, topEndColor, vertical); } } dc.SetBrush(*wxTRANSPARENT_BRUSH); }