void wxRectangleShape::OnDraw(wxDC &dc) { double x1 = (double)(m_xpos - m_width / 2.0); double y1 = (double)(m_ypos - m_height / 2.0); if (m_shadowMode != SHADOW_NONE) { if (m_shadowBrush) dc.SetBrush(* m_shadowBrush); dc.SetPen(* g_oglTransparentPen); if (m_cornerRadius != 0.0) dc.DrawRoundedRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY), WXROUND(m_width), WXROUND(m_height), m_cornerRadius); else dc.DrawRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY), WXROUND(m_width), WXROUND(m_height)); } if (m_pen) { if (m_pen->GetWidth() == 0) dc.SetPen(* g_oglTransparentPen); else dc.SetPen(* m_pen); } if (m_brush) dc.SetBrush(* m_brush); if (m_cornerRadius != 0.0) dc.DrawRoundedRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height), m_cornerRadius); else dc.DrawRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height)); }
//+-------------------------------------------------------------+ //| Card::DrawNullCard() | //+-------------------------------------------------------------+ //| Description: | //| Draws the outline of a card at (x, y). | //| Used to draw place holders for empty piles of cards. | //+-------------------------------------------------------------+ void Card::DrawNullCard(wxDC& dc, int x, int y) { wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour(), 1, wxSOLID); dc.SetBrush(FortyApp::BackgroundBrush()); dc.SetPen(*pen); dc.DrawRoundedRectangle(x, y, m_width, m_height, 4); } // Card::DrawNullCard()
// Define the repainting behaviour void MyCanvas::OnDraw(wxDC& dc) { dc.SetFont(*wxSWISS_FONT); dc.SetPen(*wxGREEN_PEN); dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.SetBrush(*wxCYAN_BRUSH); dc.SetPen(*wxRED_PEN); dc.DrawRectangle(100, 100, 100, 50); dc.DrawRoundedRectangle(150, 150, 100, 50, 20); dc.DrawEllipse(250, 250, 100, 50); #if wxUSE_SPLINES dc.DrawSpline(50, 200, 50, 100, 200, 10); #endif // wxUSE_SPLINES dc.DrawLine(50, 230, 200, 230); dc.DrawText(wxT("This is a test string"), 50, 230); wxPoint points[3]; points[0].x = 200; points[0].y = 300; points[1].x = 100; points[1].y = 400; points[2].x = 300; points[2].y = 400; dc.DrawPolygon(3, points); }
void BenchmarkRoundedRectangles(const wxString& msg, wxDC& dc) { if ( !opts.testRectangles ) return; if ( opts.mapMode != 0 ) dc.SetMapMode((wxMappingMode)opts.mapMode); if ( opts.penWidth != 0 ) dc.SetPen(wxPen(*wxWHITE, opts.penWidth)); dc.SetBrush( *wxCYAN_BRUSH ); wxPrintf("Benchmarking %s: ", msg); fflush(stdout); wxStopWatch sw; for ( int n = 0; n < opts.numIters; n++ ) { int x = rand() % opts.width, y = rand() % opts.height; dc.DrawRoundedRectangle(x, y, 48, 32, 8); } const long t = sw.Time(); wxPrintf("%ld rounded rects done in %ldms = %gus/rect\n", opts.numIters, t, (1000. * t)/opts.numIters); }
void clRowEntry::RenderCheckBox(wxWindow* win, wxDC& dc, const clColours& colours, const wxRect& rect, bool checked) { #if 1 wxUnusedVar(win); wxUnusedVar(colours); wxRendererNative::Get().DrawCheckBox(win, dc, rect, checked ? wxCONTROL_CHECKED : wxCONTROL_NONE); #else dc.SetPen(wxPen(colours.GetBorderColour(), 2)); dc.SetBrush(checked ? colours.GetBorderColour() : *wxTRANSPARENT_BRUSH); dc.DrawRoundedRectangle(rect, 2.0); if(checked) { wxRect innerRect = rect; innerRect.Deflate(5); const wxColour& penColour = IsSelected() ? colours.GetSelItemTextColour() : colours.GetDarkBorderColour(); dc.SetPen(wxPen(penColour, 3)); wxPoint p1, p2, p3; p1.x = innerRect.GetTopLeft().x; p1.y = innerRect.GetTopLeft().y + (innerRect.GetHeight() / 2); p2.x = innerRect.GetBottomLeft().x + (innerRect.GetWidth() / 3); p2.y = innerRect.GetBottomLeft().y; p3 = innerRect.GetTopRight(); dc.DrawLine(p1, p2); dc.DrawLine(p2, p3); } #endif }
void UIElementVectorial::DrawStaticBox(wxDC& dc,const wxString& label, const wxPoint& pos, const wxSize& size) { wxColour c_pen = dc.GetPen().GetColour(); dc.SetPen(wxPen(dc.GetTextForeground())); dc.DrawRoundedRectangle(pos.x, pos.y, size.x, size.y,3.1f); dc.SetPen(wxPen(c_pen)); dc.DrawRotatedText(label,pos.x+10,pos.y,0); }
// draw the header control button (used by wxListCtrl) virtual void DrawHeaderButton(wxWindow *win, wxDC& dc, const wxRect& rect, int flags = 0) { dc.SetBrush(*wxCYAN_BRUSH); dc.SetTextForeground(*wxRED); dc.DrawRoundedRectangle(rect, 10); dc.DrawLabel(_T("MyDllRenderer"), wxNullBitmap, rect, wxALIGN_CENTER); }
void IsoLine::drawIsoLineLabels(GRIBOverlayFactory *pof, wxDC &dc, wxColour text_color, wxColour back_color, PlugIn_ViewPort *vp, int density, int first, double coef) { /// //#if 0 std::list<Segment *>::iterator it; int nb = first; wxString label; label.Printf(_T("%d"), (int)(value*coef+0.5)); wxPen penText(text_color); int w, h; dc.GetTextExtent(label, &w, &h); dc.SetPen(penText); dc.SetBrush(wxBrush(back_color)); dc.SetTextForeground(text_color); dc.SetTextBackground(back_color); //--------------------------------------------------------- // Ecrit les labels //--------------------------------------------------------- for (it=trace.begin(); it!=trace.end(); it++,nb++) { if (nb % density == 0) { Segment *seg = *it; // if(vp->vpBBox.PointInBox((seg->px1 + seg->px2)/2., (seg->py1 + seg->py2)/2., 0.)) { // wxPoint ab = vp->GetMercatorPixFromLL(seg->py1, seg->px1); // wxPoint cd = vp->GetMercatorPixFromLL(seg->py2, seg->px2); wxPoint ab; GetCanvasPixLL(vp, &ab, seg->py1, seg->px1); wxPoint cd; GetCanvasPixLL(vp, &cd, seg->py1, seg->px1); int label_offset = 6; int xd = (ab.x + cd.x-(w+label_offset * 2))/2; int yd = (ab.y + cd.y - h)/2; dc.DrawRoundedRectangle(xd, yd, w+(label_offset * 2), h, -.25); dc.DrawText(label, label_offset/2 + xd, yd-1); } } } //#endif /// }
void CFreqDisplay::drawDigit(wxDC& dc, int width, int height, int thickness, int x, int y, unsigned int n, bool dot) { wxASSERT(width > 0); wxASSERT(height > 0); wxASSERT(thickness > 0); wxASSERT(x >= 0); wxASSERT(y >= 0); wxASSERT(n >= 0 && n <= 9); int radius = thickness / 2;; int topSpace = 3; int bottomSpace = 3 + thickness; int leftSpace = 3 + thickness; int rightSpace = 3 + thickness; int barWidth = width - leftSpace - rightSpace; int barHeight = (height - topSpace - bottomSpace) / 2; const int BODGE_FACTOR = 2; dc.SetPen(wxPen(m_lightColour)); dc.SetBrush(wxBrush(m_lightColour)); if (dot) dc.DrawRoundedRectangle(x + 2, y + topSpace + 2 * barHeight, thickness, thickness, radius); if (n == 0 || n == 2 || n == 3 || n == 5 || n == 6 || n == 7 || n == 8 || n == 9) dc.DrawRoundedRectangle(x + leftSpace + BODGE_FACTOR, y + topSpace, barWidth, thickness, radius); if (n == 0 || n == 4 || n == 5 || n == 6 || n == 8 || n == 9) dc.DrawRoundedRectangle(x + leftSpace, y + topSpace + BODGE_FACTOR, thickness, barHeight, radius); if (n == 0 || n == 1 || n == 2 || n == 3 || n == 4 || n == 7 || n == 8 || n == 9) dc.DrawRoundedRectangle(x + leftSpace + barWidth, y + topSpace + BODGE_FACTOR, thickness, barHeight, radius); if (n == 2 || n == 3 || n == 4 || n == 5 || n == 6 || n == 8 || n == 9) dc.DrawRoundedRectangle(x + leftSpace + BODGE_FACTOR, y + topSpace + barHeight, barWidth, thickness, radius); if (n == 0 || n == 2 || n == 6 || n == 8) dc.DrawRoundedRectangle(x + leftSpace, y + topSpace + barHeight + BODGE_FACTOR, thickness, barHeight, radius); if (n == 0 || n == 1 || n == 3 || n == 4 || n == 5 || n == 6 || n == 7 || n == 8 || n == 9) dc.DrawRoundedRectangle(x + leftSpace + barWidth, y + topSpace + barHeight + BODGE_FACTOR, thickness, barHeight, radius); if (n == 0 || n == 2 || n == 3 || n == 5 || n == 6 || n == 8 || n == 9) dc.DrawRoundedRectangle(x + leftSpace + BODGE_FACTOR, y + topSpace + 2 * barHeight, barWidth, thickness, radius); }
virtual int DrawHeaderButton(wxWindow *WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags) = 0, wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* WXUNUSED(params) = NULL) { dc.SetBrush(*wxBLUE_BRUSH); dc.SetTextForeground(*wxWHITE); dc.DrawRoundedRectangle(rect, 5); dc.DrawLabel(_T("MyRenderer"), wxNullBitmap, rect, wxALIGN_CENTER); return rect.width; }
void UICalculateDistance::render(wxDC& dc) { int client_h = 0; int client_w = 0; GetClientSize (&client_w, &client_h); if (!(ApplicationConfiguration::GetInstance()->IsThemed())) { wxString str(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8); wxColour c_pen = (wxColour)str; wxString str2(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8); wxColour c_backg = (wxColour)str2; wxString str3(ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8); wxColour c_brush = (wxColour)str3; wxString str4(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8); dc.SetTextForeground((wxColour)str4); dc.SetPen(wxPen(c_pen)); dc.SetBrush(wxBrush(c_brush)); dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH); } std::ostringstream wop,wop2,wop3,wop4; wop << std::fixed << std::setprecision(3) << (distance*factor); double aux = 0.000; Position_x_Edit->GetValue().Trim().ToDouble(&aux); wop2 << std::fixed << std::setprecision (3) << aux; Position_y_Edit->GetValue().Trim().ToDouble(&aux); wop3 << std::fixed << std::setprecision (3) << aux; Position_z_Edit->GetValue().Trim().ToDouble(&aux); wop4 << std::fixed << std::setprecision (3) << aux; wxPoint box1_first(20-2,45-9); wxPoint box1_last(368,45+22); dc.DrawRoundedRectangle(box1_first.x, box1_first.y, box1_last.x-box1_first.x, box1_last.y-box1_first.y,3.1f); dc.DrawRotatedText(wxString(wop2.str().c_str(),wxConvUTF8),89+10-30-5,45, 0); dc.DrawRotatedText(wxString(wop3.str().c_str(),wxConvUTF8),89+10-30-5+92+10+15-3,45, 0); dc.DrawRotatedText(wxString(wop4.str().c_str(),wxConvUTF8),89+10-30-5+184+20+15+10-2,45, 0); wxFont font(10, wxSWISS, wxNORMAL,wxNORMAL, false, wxT("Tahoma")); wxFont font_ = dc.GetFont(); dc.SetFont(font); dc.DrawRotatedText(_T("Distance:"),20,12, 0); dc.DrawRotatedText(wxString(wop.str().c_str(),wxConvUTF8),20+65,12, 0); dc.SetFont(font_); }
virtual int DrawHeaderButton(wxWindow *WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags) = 0, wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE, wxHeaderButtonParams* params = NULL) { wxDCBrushChanger setBrush(dc, *wxBLUE_BRUSH); wxDCTextColourChanger setFgCol(dc, *wxWHITE); dc.DrawRoundedRectangle(rect, 5); wxString label; if ( params ) label = params->m_labelText; dc.DrawLabel(label, wxNullBitmap, rect, wxALIGN_CENTER); return rect.width; }
void CFloopyControl::DrawBG(wxDC& dc, wxRect& rc) { wxBrush oldBrush = dc.GetBrush(); wxPen oldpen = dc.GetPen(); wxPen pen( *wxLIGHT_GREY ); pen.SetWidth(1); dc.SetPen( pen ); wxBrush brush(GetParent()->GetColor(), wxSOLID); dc.SetBrush(brush); dc.DrawRoundedRectangle(rc.GetX(), rc.GetTop(), rc.GetWidth(), rc.GetHeight(), 2); dc.SetPen(oldpen); dc.SetBrush( oldBrush ); }
void clRowEntry::RenderText(wxWindow* win, wxDC& dc, const clColours& colours, const wxString& text, int x, int y, size_t col) { if(IsHighlight()) { const clMatchResult& hi = GetHighlightInfo(); Str3Arr_t arr; if(!hi.Get(col, arr)) { RenderTextSimple(win, dc, colours, text, x, y, col); return; } #ifdef __WXMSW__ const wxColour& defaultTextColour = m_tree->IsNativeTheme() ? colours.GetItemTextColour() : (IsSelected() ? colours.GetSelItemTextColour() : colours.GetItemTextColour()); #else const wxColour& defaultTextColour = IsSelected() ? colours.GetSelItemTextColour() : colours.GetItemTextColour(); #endif const wxColour& matchBgColour = colours.GetMatchedItemBgText(); const wxColour& matchTextColour = colours.GetMatchedItemText(); int xx = x; wxRect rowRect = GetItemRect(); for(size_t i = 0; i < arr.size(); ++i) { wxString str = arr[i]; bool is_match = (i == 1); // the middle entry is always the matched string wxSize sz = dc.GetTextExtent(str); rowRect.SetX(xx); rowRect.SetWidth(sz.GetWidth()); if(is_match) { // draw a match rectangle dc.SetPen(matchBgColour); dc.SetBrush(matchBgColour); dc.SetTextForeground(matchTextColour); dc.DrawRoundedRectangle(rowRect, 3.0); } else { dc.SetTextForeground(defaultTextColour); } dc.DrawText(str, xx, y); xx += sz.GetWidth(); } } else { // No match RenderTextSimple(win, dc, colours, text, x, y, col); } }
void PhotoFrame::Draw(wxDC& dc, wxPoint& origin) { dc.SetBrush(BACKGROUND_BRUSH); dc.SetPen(BACKGROUND_PEN); dc.DrawRoundedRectangle(origin, SMALL_SIZE, CORNER_RADIUS); wxRect rect( origin.x + (SMALL_SIZE.x - SMALL_BITMAP_SIZE.x) / 2, origin.y + (SMALL_SIZE.y - SMALL_BITMAP_SIZE.y) / 2, SMALL_BITMAP_SIZE.x, SMALL_BITMAP_SIZE.y); if (!m_path.IsEmpty()) { wxBitmap* bitmap = m_cache.Get(m_path); if (bitmap != NULL) { rect.SetSize(wxSize(bitmap->GetWidth(), bitmap->GetHeight())); rect.x += (SMALL_BITMAP_SIZE.x - rect.width) / 2; rect.y += (SMALL_BITMAP_SIZE.y - rect.height) / 2; dc.DrawBitmap(*bitmap, rect.GetPosition()); } } dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); }
void SkinColor::Fill(wxDC& dc, const wxRect& rect) { if (IsOpaque()) { if (rounded) dc.DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, rounded); else dc.DrawRectangle(rect); } else { #if __WXMSW__ wxGraphicsContext* gc = wxGraphicsContext::Create(dc); gc->SetBrush(dc.GetBrush()); gc->SetPen(*wxTRANSPARENT_PEN); if (rounded) gc->DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, rounded); else gc->DrawRectangle(rect.x, rect.y, rect.width, rect.height); delete gc; #endif } }
void wxRibbonAUIArtProvider::DrawPanelBackground( wxDC& dc, wxRibbonPanel* wnd, const wxRect& rect) { dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(m_background_brush); dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); wxRect true_rect(rect); RemovePanelPadding(&true_rect); dc.SetPen(m_panel_border_pen); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRectangle(true_rect.x, true_rect.y, true_rect.width, true_rect.height); true_rect.x++; true_rect.width -= 2; true_rect.y++; dc.SetFont(m_panel_label_font); wxSize label_size = dc.GetTextExtent(wnd->GetLabel()); int label_height = label_size.GetHeight() + 5; wxRect label_rect(true_rect); label_rect.height = label_height - 1; dc.DrawLine(label_rect.x, label_rect.y + label_rect.height, label_rect.x + label_rect.width, label_rect.y + label_rect.height); wxColour label_bg_colour = m_panel_label_background_colour; wxColour label_bg_grad_colour = m_panel_label_background_gradient_colour; if(wnd->IsHovered()) { label_bg_colour = m_panel_hover_label_background_colour; label_bg_grad_colour = m_panel_hover_label_background_gradient_colour; dc.SetTextForeground(m_panel_hover_label_colour); } else { dc.SetTextForeground(m_panel_label_colour); } dc.GradientFillLinear(label_rect, #ifdef __WXMAC__ label_bg_grad_colour, label_bg_colour, wxSOUTH); #else label_bg_colour, label_bg_grad_colour, wxSOUTH); #endif dc.SetFont(m_panel_label_font); dc.DrawText(wnd->GetLabel(), label_rect.x + 3, label_rect.y + 2); if(wnd->IsHovered()) { wxRect gradient_rect(true_rect); gradient_rect.y += label_rect.height + 1; gradient_rect.height = true_rect.height - label_rect.height - 3; #ifdef __WXMAC__ wxColour colour = m_page_hover_background_gradient_colour; wxColour gradient = m_page_hover_background_colour; #else wxColour colour = m_page_hover_background_colour; wxColour gradient = m_page_hover_background_gradient_colour; #endif dc.GradientFillLinear(gradient_rect, colour, gradient, wxSOUTH); } if(wnd->HasExtButton()) { if(wnd->IsExtButtonHovered()) { dc.SetPen(m_panel_hover_button_border_pen); dc.SetBrush(m_panel_hover_button_background_brush); dc.DrawRoundedRectangle(label_rect.GetRight() - 13, label_rect.GetBottom() - 13, 13, 13, 1.0); dc.DrawBitmap(m_panel_extension_bitmap[1], label_rect.GetRight() - 10, label_rect.GetBottom() - 10, true); } else dc.DrawBitmap(m_panel_extension_bitmap[0], label_rect.GetRight() - 10, label_rect.GetBottom() - 10, true); } }
void FindCmdDlg::ActionList::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const { const bool isCurrent = IsCurrent(n); dc.SetTextForeground(isCurrent ? m_hlTextColor : m_textColor); const unsigned int ypos = rect.y + m_topMargen; unsigned int rightBorder = rect.GetRight(); const tmAction& action = *m_items[n].action; const vector<unsigned int>& hl = m_items[n].hlChars; wxString name = action.name; if (action.bundle) { name += wxT(" - "); name += action.bundle->name; } if ( !action.trigger.empty() ) { const wxString trig = action.trigger + wxT("\x21E5"); dc.SetFont(m_unifont); int trig_width, trig_height; dc.GetTextExtent(trig, &trig_width, &trig_height); // Draw a grey rounded rect as background for trigger const unsigned int bg_height = trig_height + 1; const unsigned int bg_width = trig_width + 10; const unsigned int bg_xpos = rect.GetWidth()-2-bg_width; const unsigned int bg_ypos = rect.y+ (int)((rect.GetHeight()-bg_height)/2.0); dc.SetPen(*wxLIGHT_GREY_PEN); dc.SetBrush(*wxLIGHT_GREY_BRUSH); dc.DrawRoundedRectangle(bg_xpos, bg_ypos, bg_width, bg_height, 2); // Draw the trigger text const wxColour prevColour = dc.GetTextForeground(); dc.SetTextForeground(*wxBLACK); dc.DrawText(trig, bg_xpos + 5, bg_ypos); dc.SetTextForeground(prevColour); rightBorder = bg_xpos; } else if (!action.key.shortcut.empty()) { const wxString& shortcut = action.key.shortcut; dc.SetFont(m_font); int accel_width, accel_height; dc.GetTextExtent(shortcut, &accel_width, &accel_height); const unsigned int xpos = rect.GetWidth()-2-accel_width; dc.DrawText(shortcut, xpos, ypos); rightBorder = xpos; } // Calc extension width static const wxString ext = wxT(".. "); dc.SetFont(m_font); int w, h; dc.GetTextExtent(ext, &w, &h); const unsigned int extwidth = w; // See if we have to resize the action name to fit // note that this is not 100% correct as bold chars take up a bit more space. unsigned int len = name.length(); dc.GetTextExtent(name, &w, &h); if (w > (int)rightBorder) { do { name.resize(--len); dc.GetTextExtent(name, &w, &h); } while (len > 0 && w + extwidth > rightBorder); name += ext; } // Draw action name DrawItemText(dc, rect, name, hl, isCurrent); }
void MyApp::Draw(wxDC&dc) { // This routine just draws a bunch of random stuff on the screen so that we // can check that different types of object are being drawn consistently // between the screen image, the print preview image (at various zoom // levels), and the printed page. dc.SetBackground(*wxWHITE_BRUSH); // dc.Clear(); dc.SetFont(m_testFont); // dc.SetBackgroundMode(wxTRANSPARENT); dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxLIGHT_GREY_BRUSH); dc.DrawRectangle(0, 0, 230, 350); dc.DrawLine(0, 0, 229, 349); dc.DrawLine(229, 0, 0, 349); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxCYAN_BRUSH); dc.SetPen(*wxRED_PEN); dc.DrawRoundedRectangle(0, 20, 200, 80, 20); dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40); dc.SetPen( wxPen(*wxBLACK, 0, wxPENSTYLE_DOT_DASH) ); dc.DrawEllipse(50, 140, 100, 50); dc.SetPen(*wxRED_PEN); dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180); #if wxUSE_UNICODE const char *test = "Hebrew שלום -- Japanese (日本語)"; wxString tmp = wxConvUTF8.cMB2WC( test ); dc.DrawText( tmp, 10, 200 ); #endif wxPoint points[5]; points[0].x = 0; points[0].y = 0; points[1].x = 20; points[1].y = 0; points[2].x = 20; points[2].y = 20; points[3].x = 10; points[3].y = 20; points[4].x = 10; points[4].y = -20; dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE ); dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE ); dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 ); points[0].x = 150; points[0].y = 250; points[1].x = 180; points[1].y = 250; points[2].x = 180; points[2].y = 220; points[3].x = 200; points[3].y = 220; dc.DrawSpline( 4, points ); dc.DrawArc( 20,10, 10,10, 25,40 ); wxString str; int i = 0; str.Printf( wxT("---- Text at angle %d ----"), i ); dc.DrawRotatedText( str, 100, 300, i ); i = m_angle; str.Printf( wxT("---- Text at angle %d ----"), i ); dc.DrawRotatedText( str, 100, 300, i ); wxIcon my_icon = wxICON(sample); dc.DrawIcon( my_icon, 100, 100); if (m_bitmap.IsOk()) dc.DrawBitmap( m_bitmap, 10, 10 ); #if wxUSE_GRAPHICS_CONTEXT wxGraphicsContext *gc = NULL; wxPrinterDC *printer_dc = wxDynamicCast( &dc, wxPrinterDC ); if (printer_dc) gc = wxGraphicsContext::Create( *printer_dc ); wxWindowDC *window_dc = wxDynamicCast( &dc, wxWindowDC ); if (window_dc) gc = wxGraphicsContext::Create( *window_dc ); #ifdef __WXMSW__ wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC ); if (emf_dc) gc = wxGraphicsContext::Create( *emf_dc ); #endif if (gc) { // make a path that contains a circle and some lines, centered at 100,100 gc->SetPen( *wxRED_PEN ); wxGraphicsPath path = gc->CreatePath(); path.AddCircle( 50.0, 50.0, 50.0 ); path.MoveToPoint(0.0, 50.0); path.AddLineToPoint(100.0, 50.0); path.MoveToPoint(50.0, 0.0); path.AddLineToPoint(50.0, 100.0 ); path.CloseSubpath(); path.AddRectangle(25.0, 25.0, 50.0, 50.0); gc->StrokePath(path); // draw some text wxString text("Text by wxGraphicsContext"); gc->SetFont( m_testFont, *wxBLACK ); gc->DrawText(text, 25.0, 60.0); // draw rectangle around the text double w, h, d, el; gc->GetTextExtent(text, &w, &h, &d, &el); gc->SetPen( *wxBLACK_PEN ); gc->DrawRectangle(25.0, 60.0, w, h); delete gc; } #endif }
// Define the repainting behaviour void MyCanvas::OnDraw(wxDC& dc) { // vars to use ... #if wxUSE_STATUSBAR wxString s ; #endif // wxUSE_STATUSBAR wxPen wP ; wxBrush wB ; wxPoint points[6]; wxColour wC; wxFont wF ; dc.SetFont(*wxSWISS_FONT); dc.SetPen(*wxGREEN_PEN); switch (m_index) { default: case 0: // draw lines to make a cross dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); // draw point colored line and spline wP = *wxCYAN_PEN ; wP.SetWidth(3); dc.SetPen(wP); dc.DrawPoint (25,15) ; dc.DrawLine(50, 30, 200, 30); dc.DrawSpline(50, 200, 50, 100, 200, 10); #if wxUSE_STATUSBAR s = wxT("Green Cross, Cyan Line and spline"); #endif // wxUSE_STATUSBAR break ; case 1: // draw standard shapes dc.SetBrush(*wxCYAN_BRUSH); dc.SetPen(*wxRED_PEN); dc.DrawRectangle(10, 10, 100, 70); wB = wxBrush (_T("DARK ORCHID"), wxTRANSPARENT); dc.SetBrush (wB); dc.DrawRoundedRectangle(50, 50, 100, 70, 20); dc.SetBrush (wxBrush(_T("GOLDENROD"), wxSOLID) ); dc.DrawEllipse(100, 100, 100, 50); points[0].x = 100; points[0].y = 200; points[1].x = 70; points[1].y = 260; points[2].x = 160; points[2].y = 230; points[3].x = 40; points[3].y = 230; points[4].x = 130; points[4].y = 260; points[5].x = 100; points[5].y = 200; dc.DrawPolygon(5, points); dc.DrawLines (6, points, 160); #if wxUSE_STATUSBAR s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars"); #endif // wxUSE_STATUSBAR break ; case 2: // draw text in Arial or similar font dc.DrawLine(50,25,50,35); dc.DrawLine(45,30,55,30); dc.DrawText(wxT("This is a Swiss-style string"), 50, 30); wC = dc.GetTextForeground() ; dc.SetTextForeground (_T("FIREBRICK")); // no effect in msw ?? dc.SetTextBackground (_T("WHEAT")); dc.DrawText(wxT("This is a Red string"), 50, 200); dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45); dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90); wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman")); dc.SetFont(wF); dc.SetTextForeground (wC) ; dc.DrawText(wxT("This is a Times-style string"), 50, 60); #if wxUSE_STATUSBAR s = wxT("Swiss, Times text; red text, rotated and colored orange"); #endif // wxUSE_STATUSBAR break ; case 3 : // four arcs start and end points, center dc.SetBrush(*wxGREEN_BRUSH); dc.DrawArc ( 200,300, 370,230, 300,300 ); dc.SetBrush(*wxBLUE_BRUSH); dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 ); dc.SetDeviceOrigin(-10,-10); dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 ); dc.SetDeviceOrigin(0,0); wP.SetColour (_T("CADET BLUE")); dc.SetPen(wP); dc.DrawArc ( 75,125, 110, 40, 75, 75 ); wP.SetColour (_T("SALMON")); dc.SetPen(wP); dc.SetBrush(*wxRED_BRUSH); //top left corner, width and height, start and end angle // 315 same center and x-radius as last pie-arc, half Y radius dc.DrawEllipticArc(25,50,100,50,180.0,45.0) ; wP = *wxCYAN_PEN ; wP.SetWidth(3); dc.SetPen(wP); //wxTRANSPARENT)); dc.SetBrush (wxBrush (_T("SALMON"),wxSOLID)) ; dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0) ; //same end point dc.DrawEllipticArc(300, 50,200,100,90.0,145.0) ; dc.DrawEllipticArc(300,100,200,100,90.0,345.0) ; #if wxUSE_STATUSBAR s = wxT("This is an arc test page"); #endif // wxUSE_STATUSBAR break ; case 4: dc.DrawCheckMark ( 30,30,25,25); dc.SetBrush (wxBrush (_T("SALMON"),wxTRANSPARENT)); dc.DrawCheckMark ( 80,50,75,75); dc.DrawRectangle ( 80,50,75,75); #if wxUSE_STATUSBAR s = wxT("Two check marks"); #endif // wxUSE_STATUSBAR break ; case 5: wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman")); dc.SetFont(wF); dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.DrawText(wxT("This is an 18pt string"), 50, 60); // rescale and draw in blue wP = *wxCYAN_PEN ; dc.SetPen(wP); dc.SetUserScale (2.0,0.5); dc.SetDeviceOrigin(200,0); dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.DrawText(wxT("This is an 18pt string 2 x 0.5 UserScaled"), 50, 60); dc.SetUserScale (2.0,2.0); dc.SetDeviceOrigin(200,200); dc.DrawText(wxT("This is an 18pt string 2 x 2 UserScaled"), 50, 60); wP = *wxRED_PEN ; dc.SetPen(wP); dc.SetUserScale (1.0,1.0); dc.SetDeviceOrigin(0,10); dc.SetMapMode (wxMM_METRIC) ; //svg ignores this dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60); #if wxUSE_STATUSBAR s = wxT("Scaling test page"); #endif // wxUSE_STATUSBAR break ; case 6: dc.DrawIcon( wxIcon(mondrian_xpm), 10, 10 ); dc.DrawBitmap ( wxBitmap(svgbitmap_xpm), 50,15); #if wxUSE_STATUSBAR s = wxT("Icon and Bitmap "); #endif // wxUSE_STATUSBAR break ; } #if wxUSE_STATUSBAR m_child->SetStatusText(s); #endif // wxUSE_STATUSBAR }
//+-------------------------------------------------------------+ //| Card::Draw() | //+-------------------------------------------------------------+ //| Description: | //| Draw the card at (x, y). | //| If the card is facedown draw the back of the card. | //| If the card is faceup draw the front of the card. | //| Cards are not held in bitmaps, instead they are drawn | //| from their constituent parts when required. | //| hbmap_symbols contains large and small suit symbols and | //| pip values. These are copied to the appropriate part of | //| the card. Picture cards use the pictures defined in | //| hbmap_pictures. Note that only one picture is defined | //| for the Jack, Queen and King, unlike a real pack where | //| each suit is different. | //| | //| WARNING: | //| The locations of these symbols is 'hard-wired' into the | //| code. Editing the bitmaps or the numbers below will | //| result in the wrong symbols being displayed. | //+-------------------------------------------------------------+ void Card::Draw(wxDC& dc, int x, int y) { wxBrush backgroundBrush( dc.GetBackground() ); dc.SetBrush(* wxWHITE_BRUSH); dc.SetPen(* wxBLACK_PEN); dc.DrawRoundedRectangle(x, y, m_width, m_height, 4); if (m_wayUp == facedown) { dc.SetBackground(* wxRED_BRUSH); dc.SetBackgroundMode(wxSOLID); wxBrush* brush = wxTheBrushList->FindOrCreateBrush( *wxBLACK, wxCROSSDIAG_HATCH ); dc.SetBrush(* brush); dc.DrawRoundedRectangle( x + 4, y + 4, m_width - 8, m_height - 8, 2 ); } else { wxMemoryDC memoryDC; memoryDC.SelectObject(*m_symbolBmap); // dc.SetBackgroundMode(wxTRANSPARENT); dc.SetTextBackground(*wxWHITE); switch (m_suit) { case spades: case clubs: dc.SetTextForeground(*wxBLACK); break; case diamonds: case hearts: dc.SetTextForeground(*wxRED); break; } int symsize = 11; int sympos = 14; int sympos2 = 25; int symdist = 5; int symdist2 = 6; int pipsize,pippos,valueheight,valuewidth; int valuepos; if (m_scale > 1.2) { pipsize = symsize; pippos = sympos; valueheight = 10; valuewidth = 9; valuepos = 50; } else { pipsize = 7; pippos = 0; valueheight = 7; valuewidth = 6; valuepos = 36; } // Draw the value dc.Blit((wxCoord)(x + m_scale*3), (wxCoord)(y + m_scale*3), valuewidth, valueheight, &memoryDC, valuewidth * (m_pipValue - 1), valuepos, wxCOPY); dc.Blit((wxCoord)(x + m_width - m_scale*3 - valuewidth), (wxCoord)(y + m_height - valueheight - m_scale*3), valuewidth, valueheight, &memoryDC, valuewidth * (m_pipValue - 1), valuepos+valueheight, wxCOPY); // Draw the pips dc.Blit((wxCoord)(x + m_scale*3 + valuewidth+2), (wxCoord)(y + m_scale*3), pipsize, pipsize, &memoryDC, pipsize * m_suit, pippos, wxCOPY); dc.Blit((wxCoord)(x + m_width - m_scale*3-valuewidth-pipsize-2), (wxCoord)(y + m_height - pipsize - m_scale*3), pipsize, pipsize, &memoryDC, pipsize * m_suit, pipsize+pippos, wxCOPY); switch (m_pipValue) { case 1: dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - m_scale*5 + m_height / 2), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); break; case 3: dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - symdist + m_height / 2), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); case 2: dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - symdist + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); break; case 5: dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - symdist + m_height / 2), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); case 4: dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); break; case 8: dc.Blit((wxCoord)(x - symdist + 5 * m_width / 10), (wxCoord)(y - symdist + 5 * m_height / 8), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); case 7: dc.Blit((wxCoord)(x - symdist + 5 * m_width / 10), (wxCoord)(y - symdist + 3 * m_height / 8), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); case 6: dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + m_height / 2), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + m_height / 2), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); break; case 10: dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - symdist + 2 * m_height / 3), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); case 9: dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist2 + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist2 + 5 * m_height / 12), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + 7 * m_height / 12), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 4), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist2 + m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist2 + 5 * m_height / 12), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + 7 * m_height / 12), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4), (wxCoord)(y - symdist + 3 * m_height / 4), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); dc.Blit((wxCoord)(x - symdist + m_width / 2), (wxCoord)(y - symdist + m_height / 3), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); break; case 11: case 12: case 13: memoryDC.SelectObject(*m_pictureBmap); int picwidth = 40,picheight = 45; dc.Blit((wxCoord)(x + (m_width-picwidth)/2), (wxCoord)(y - picheight/2 + m_height/2), picwidth, picheight, &memoryDC, picwidth * (m_pipValue - 11), 0, wxCOPY); memoryDC.SelectObject(*m_symbolBmap); dc.Blit((wxCoord)(x + m_width-(m_width-picwidth)/2-symsize-3), (wxCoord)(y - picheight/2+m_height/2+1), symsize, symsize, &memoryDC, symsize * m_suit, sympos, wxCOPY); dc.Blit((wxCoord)(x + (m_width-picwidth)/2+2), (wxCoord)(y + picheight/2 + m_height/2-symsize), symsize, symsize, &memoryDC, symsize * m_suit, sympos2, wxCOPY); break; } } dc.SetBackground( backgroundBrush ); } // Card:Draw()
void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { PenColour(fore); BrushColour(back); hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4); }
wxColour wxJigsawShape::DrawBackground(wxDC & dc, const wxPoint & pos, const wxSize & headerSize, const wxSize & size, double scale) { wxColour color(m_Colour); if(wxJigsawEditorMainFrame::Get()->GetCanvas()->GetSelectedShape() == this) { //Shape selected. Give a feedback to the user! double bright = 1.15 + .08*GetLevelColor(); color.Set(__min(bright*color.Red(), 255), __min(bright*color.Green(), 255), __min(bright*color.Blue(), 255)); } else if(m_Parent && m_Colour == m_Parent->GetColour()) { //Change the shape bright to contrast with the parent shape double bright = 1 + .08*GetLevelColor(); color.Set(__min(bright*color.Red(), 255), __min(bright*color.Green(), 255), __min(bright*color.Blue(), 255)); } dc.SetBrush(wxBrush(color)); dc.SetPen(*wxTRANSPARENT_PEN); wxPoint connector[5] = { wxPoint(0,0), wxPoint(wxJigsawShape::ConnectorSize.GetHeight(), wxJigsawShape::ConnectorSize.GetHeight()), wxPoint(wxJigsawShape::ConnectorSize.GetWidth()-wxJigsawShape::ConnectorSize.GetHeight(), wxJigsawShape::ConnectorSize.GetHeight()), wxPoint(wxJigsawShape::ConnectorSize.GetWidth(),0), wxPoint(0,0) }; for(size_t i = 0; i < 5; i++) { connector[i].x *= scale; connector[i].y *= scale; } wxSize childrenSize = GetChildrenSize(dc, scale); int cShapeHeight = wxMax(childrenSize.GetHeight(), 10*scale); wxRegion clippingRegion(0, 0, dc.GetSize().GetWidth(), dc.GetSize().GetHeight()); if(m_HasNotch) { wxRegion connectorRegion(5, connector); connectorRegion.Offset(pos.x + wxJigsawShape::ConnectorSize.GetWidth()*scale, pos.y); clippingRegion.Xor(connectorRegion); } if(m_HasCShape) { wxRegion connectorRegion(5, connector); connectorRegion.Offset( pos.x + (wxJigsawShape::CShapeThickness+wxJigsawShape::ConnectorSize.GetWidth())*scale, pos.y + headerSize.GetHeight()+cShapeHeight); clippingRegion.Xor(connectorRegion); } dc.SetClippingRegion(clippingRegion); //dc.DrawRoundedRectangle(m_Position.x, m_Position.y, headerSize.GetWidth(), headerSize.GetHeight(), 4); DrawShapeHeader(dc, pos, headerSize, IntToJigsawShapeStyle(m_Style)); if(m_HasCShape) { dc.DrawRectangle(pos.x, pos.y + headerSize.GetHeight() / 2, (wxJigsawShape::CShapeThickness+4)*scale, headerSize.GetHeight() / 2 + cShapeHeight + (wxJigsawShape::CShapeThickness*scale)/2); dc.DrawRoundedRectangle(pos.x, pos.y + headerSize.GetHeight()+cShapeHeight, headerSize.GetWidth(), wxJigsawShape::CShapeThickness*scale, 4); // Upper inner notch dc.DrawPolygon(5, connector, pos.x + (wxJigsawShape::CShapeThickness+wxJigsawShape::ConnectorSize.GetWidth())*scale, pos.y + headerSize.GetHeight()); } if(m_HasBump) { dc.DrawPolygon(5, connector, pos.x + wxJigsawShape::ConnectorSize.GetWidth()*scale, pos.y + size.GetHeight()); } dc.DestroyClippingRegion(); return color; }
void clTabRendererClassic::Draw(wxWindow* parent, wxDC& dc, wxDC& fontDC, const clTabInfo& tabInfo, const clTabColours& colors, size_t style, eButtonState buttonState) { const int tabRaius = 1.5; clTabColours colours = colors; if(DrawingUtils::IsDark(colours.activeTabBgColour)) { InitDarkColours(colours, colours.activeTabBgColour); } else { InitLightColours(colours, colours.activeTabBgColour); } wxColour bgColour(tabInfo.IsActive() ? colours.activeTabBgColour : colours.inactiveTabBgColour); wxColour penColour(tabInfo.IsActive() ? colours.activeTabPenColour : colours.inactiveTabPenColour); wxFont font = GetTabFont(false); fontDC.SetTextForeground(tabInfo.IsActive() ? colours.activeTabTextColour : colours.inactiveTabTextColour); fontDC.SetFont(font); if(style & kNotebook_BottomTabs) { // Bottom tabs wxRect tabRect = tabInfo.GetRect(); tabRect.SetHeight(tabRect.GetHeight() + tabRaius); tabRect.SetY(tabRect.GetY() - tabRaius); { dc.SetPen(penColour); dc.SetBrush(bgColour); dc.DrawRoundedRectangle(tabRect, tabRaius); } { tabRect.Deflate(1); // The inner border dc.SetPen(tabInfo.IsActive() ? colours.activeTabInnerPenColour : colours.inactiveTabInnerPenColour); dc.SetBrush(bgColour); dc.DrawRoundedRectangle(tabRect, tabRaius); } } else { // Default tabs (placed at the top) wxRect tabRect = tabInfo.GetRect(); tabRect.SetHeight(tabRect.GetHeight() + tabRaius); { dc.SetPen(penColour); dc.SetBrush(bgColour); dc.DrawRoundedRectangle(tabRect, tabRaius); } { tabRect.Deflate(1); // The inner border dc.SetPen(tabInfo.IsActive() ? colours.activeTabInnerPenColour : colours.inactiveTabInnerPenColour); dc.SetBrush(bgColour); dc.DrawRoundedRectangle(tabRect, tabRaius); } } // Draw bitmap if(tabInfo.GetBitmap().IsOk()) { const wxBitmap& bmp = (!tabInfo.IsActive() && tabInfo.GetDisabledBitmp().IsOk()) ? tabInfo.GetDisabledBitmp() : tabInfo.GetBitmap(); dc.DrawBitmap(bmp, tabInfo.m_bmpX + tabInfo.m_rect.GetX(), tabInfo.m_bmpY); } fontDC.DrawText(tabInfo.m_label, tabInfo.m_textX + tabInfo.m_rect.GetX(), tabInfo.m_textY); if(tabInfo.IsActive() && (style & kNotebook_CloseButtonOnActiveTab)) { DrawButton(parent, dc, tabInfo, colours, buttonState); } }
// Define the repainting behaviour void MyCanvas::OnDraw(wxDC& dc) { // vars to use ... #if wxUSE_STATUSBAR wxString s; #endif // wxUSE_STATUSBAR wxPen wP; wxBrush wB; wxPoint points[6]; wxColour wC; wxFont wF; dc.SetFont(*wxSWISS_FONT); dc.SetPen(*wxGREEN_PEN); switch (m_index) { default: case 0: // draw lines to make a cross dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); // draw point colored line and spline wP = *wxCYAN_PEN; wP.SetWidth(3); dc.SetPen(wP); dc.DrawPoint (25,15); dc.DrawLine(50, 30, 200, 30); dc.DrawSpline(50, 200, 50, 100, 200, 10); #if wxUSE_STATUSBAR s = wxT("Green Cross, Cyan Line and spline"); #endif // wxUSE_STATUSBAR break; case 1: // draw standard shapes dc.SetBrush(*wxCYAN_BRUSH); dc.SetPen(*wxRED_PEN); dc.DrawRectangle(10, 10, 100, 70); wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT); dc.SetBrush (wB); dc.DrawRoundedRectangle(50, 50, 100, 70, 20); dc.SetBrush (wxBrush(wxT("GOLDENROD")) ); dc.DrawEllipse(100, 100, 100, 50); points[0].x = 100; points[0].y = 200; points[1].x = 70; points[1].y = 260; points[2].x = 160; points[2].y = 230; points[3].x = 40; points[3].y = 230; points[4].x = 130; points[4].y = 260; points[5].x = 100; points[5].y = 200; dc.DrawPolygon(5, points); dc.DrawLines (6, points, 160); #if wxUSE_STATUSBAR s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars"); #endif // wxUSE_STATUSBAR break; case 2: // draw text in Arial or similar font dc.DrawLine(50,25,50,35); dc.DrawLine(45,30,55,30); dc.DrawText(wxT("This is a Swiss-style string"), 50, 30); wC = dc.GetTextForeground(); dc.SetTextForeground (wxT("FIREBRICK")); // no effect in msw ?? dc.SetTextBackground (wxT("WHEAT")); dc.DrawText(wxT("This is a Red string"), 50, 200); dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45); dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90); wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman")); dc.SetFont(wF); dc.SetTextForeground (wC); dc.DrawText(wxT("This is a Times-style string"), 50, 60); #if wxUSE_STATUSBAR s = wxT("Swiss, Times text; red text, rotated and colored orange"); #endif // wxUSE_STATUSBAR break; case 3 : // four arcs start and end points, center dc.SetBrush(*wxGREEN_BRUSH); dc.DrawArc ( 200,300, 370,230, 300,300 ); dc.SetBrush(*wxBLUE_BRUSH); dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 ); dc.SetDeviceOrigin(-10,-10); dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 ); dc.SetDeviceOrigin(0,0); wP.SetColour (wxT("CADET BLUE")); dc.SetPen(wP); dc.DrawArc ( 75,125, 110, 40, 75, 75 ); wP.SetColour (wxT("SALMON")); dc.SetPen(wP); dc.SetBrush(*wxRED_BRUSH); //top left corner, width and height, start and end angle // 315 same center and x-radius as last pie-arc, half Y radius dc.DrawEllipticArc(25,50,100,50,180.0,45.0); wP = *wxCYAN_PEN; wP.SetWidth(3); dc.SetPen(wP); //wxTRANSPARENT)); dc.SetBrush (wxBrush (wxT("SALMON"))); dc.DrawEllipticArc(300, 0,200,100, 0.0,145.0); //same end point dc.DrawEllipticArc(300, 50,200,100,90.0,145.0); dc.DrawEllipticArc(300,100,200,100,90.0,345.0); #if wxUSE_STATUSBAR s = wxT("This is an arc test page"); #endif // wxUSE_STATUSBAR break; case 4: dc.DrawCheckMark ( 30,30,25,25); dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT)); dc.DrawCheckMark ( 80,50,75,75); dc.DrawRectangle ( 80,50,75,75); #if wxUSE_STATUSBAR s = wxT("Two check marks"); #endif // wxUSE_STATUSBAR break; case 5: wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman")); dc.SetFont(wF); dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.DrawText(wxT("This is an 18pt string"), 50, 60); // rescale and draw in blue wP = *wxCYAN_PEN; dc.SetPen(wP); dc.SetUserScale (2.0,0.5); dc.SetDeviceOrigin(200,0); dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.DrawText(wxT("This is an 18pt string 2 x 0.5 UserScaled"), 50, 60); dc.SetUserScale (2.0,2.0); dc.SetDeviceOrigin(200,200); dc.DrawText(wxT("This is an 18pt string 2 x 2 UserScaled"), 50, 60); wP = *wxRED_PEN; dc.SetPen(wP); dc.SetUserScale (1.0,1.0); dc.SetDeviceOrigin(0,10); dc.SetMapMode (wxMM_METRIC); //svg ignores this dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); dc.DrawText(wxT("This is an 18pt string in MapMode"), 50, 60); #if wxUSE_STATUSBAR s = wxT("Scaling test page"); #endif // wxUSE_STATUSBAR break; case 6: dc.DrawIcon( wxICON(sample), 10, 10 ); dc.DrawBitmap ( wxBitmap(svgbitmap_xpm), 50,15); #if wxUSE_STATUSBAR s = wxT("Icon and Bitmap "); #endif // wxUSE_STATUSBAR break; case 7: dc.SetTextForeground(wxT("RED")); dc.DrawText(wxT("Red = Clipping Off"), 30, 5); dc.SetTextForeground(wxT("GREEN")); dc.DrawText(wxT("Green = Clipping On"), 30, 25); dc.SetTextForeground(wxT("BLACK")); dc.SetPen(*wxRED_PEN); dc.SetBrush (wxBrush (wxT("SALMON"),wxBRUSHSTYLE_TRANSPARENT)); dc.DrawCheckMark ( 80,50,75,75); dc.DrawRectangle ( 80,50,75,75); dc.SetPen(*wxGREEN_PEN); // Clipped checkmarks dc.DrawRectangle(180,50,75,75); dc.SetClippingRegion(180,50,75,75); // x,y,width,height version dc.DrawCheckMark ( 180,50,75,75); dc.DestroyClippingRegion(); dc.DrawRectangle(wxRect(80,150,75,75)); dc.SetClippingRegion(wxPoint(80,150),wxSize(75,75)); // pt,size version dc.DrawCheckMark ( 80,150,75,75); dc.DestroyClippingRegion(); dc.DrawRectangle(wxRect(180,150,75,75)); dc.SetClippingRegion(wxRect(180,150,75,75)); // rect version dc.DrawCheckMark ( 180,150,75,75); dc.DestroyClippingRegion(); dc.DrawRectangle(wxRect( 80,250,50,65)); dc.DrawRectangle(wxRect(105,260,50,65)); dc.SetClippingRegion(wxRect( 80,250,50,65)); // second call to SetClippingRegion dc.SetClippingRegion(wxRect(105,260,50,65)); // forms intersection with previous dc.DrawCheckMark(80,250,75,75); dc.DestroyClippingRegion(); // only one call to destroy (there's no stack) /* ** Clipping by wxRegion not implemented for SVG. Should be ** possible, but need to access points that define the wxRegion ** from inside DoSetDeviceClippingRegion() and wxRegion does not ** implement anything like getPoints(). points[0].x = 180; points[0].y = 250; points[1].x = 255; points[1].y = 250; points[2].x = 180; points[2].y = 325; points[3].x = 255; points[3].y = 325; points[4].x = 180; points[4].y = 250; dc.DrawLines (5, points); wxRegion reg = wxRegion(5,points); dc.SetClippingRegion(reg); dc.DrawCheckMark ( 180,250,75,75); dc.DestroyClippingRegion(); */ #if wxUSE_STATUSBAR s = wxT("Clipping region"); #endif // wxUSE_STATUSBAR break; case 8: wxString txtStr; wxCoord txtX, txtY, txtW, txtH, txtDescent, txtEL; wxCoord txtPad = 0; wP = *wxRED_PEN; dc.SetPen(wP); //dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID); //dc.SetTextBackground(*wxBLUE); // Horizontal text txtStr = wxT("Horizontal string"); dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL); txtX = 50; txtY = 300; dc.DrawRectangle(txtX, txtY, txtW + 2*txtPad, txtH + 2*txtPad); dc.DrawText(txtStr, txtX + txtPad, txtY + txtPad); // Vertical text txtStr = wxT("Vertical string"); dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL); txtX = 50; txtY = 250; dc.DrawRectangle(txtX, txtY - (txtW + 2*txtPad), txtH + 2*txtPad, txtW + 2*txtPad); dc.DrawRotatedText(txtStr, txtX + txtPad, txtY - txtPad, 90); // 45 degree text txtStr = wxT("45 deg string"); dc.GetTextExtent(txtStr, &txtW, &txtH, &txtDescent, &txtEL); double lenW = (double)(txtW + 2*txtPad) / sqrt(2.0); double lenH = (double)(txtH + 2*txtPad) / sqrt(2.0); double padding = (double)txtPad / sqrt(2.0); txtX = 150; txtY = 200; dc.DrawLine(txtX - padding, txtY, txtX + lenW, txtY - lenW); // top dc.DrawLine(txtX + lenW, txtY - lenW, txtX - padding + lenH + lenW, txtY + (lenH - lenW)); dc.DrawLine(txtX - padding, txtY, txtX - padding + lenH, txtY + lenH); dc.DrawLine(txtX - padding + lenH, txtY + lenH, txtX - padding + lenH + lenW, txtY + (lenH - lenW)); // bottom dc.DrawRotatedText(txtStr, txtX, txtY, 45); #if wxUSE_STATUSBAR s = wxT("Text position test page"); #endif // wxUSE_STATUSBAR break; } #if wxUSE_STATUSBAR m_child->SetStatusText(s); #endif // wxUSE_STATUSBAR }
void wxRibbonMetroArtProvider::DrawPanelBackground( wxDC& dc, wxRibbonPanel* wnd, const wxRect& rect) { DrawPartialPageBackground(dc, wnd, rect, false); wxRect true_rect(rect); RemovePanelPadding(&true_rect); bool has_ext_button = wnd->HasExtButton(); // draw panel label { // int label_height; dc.SetFont(m_panel_label_font); dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetTextForeground(m_panel_label_colour); wxRect label_rect(true_rect); wxString label = wnd->GetLabel(); bool clip_label = false; wxSize label_size(dc.GetTextExtent(label)); label_rect.SetX(label_rect.GetX() + 1); label_rect.SetWidth(label_rect.GetWidth() - 2); label_rect.SetHeight(label_size.GetHeight() + 2); label_rect.SetY(true_rect.GetBottom() - label_rect.GetHeight()); // label_height = label_rect.GetHeight(); wxRect label_bg_rect = label_rect; if(has_ext_button) label_rect.SetWidth(label_rect.GetWidth() - 13); if(label_size.GetWidth() > label_rect.GetWidth()) { // Test if there is enough length for 3 letters and ... wxString new_label = label.Mid(0, 3) + wxT("..."); label_size = dc.GetTextExtent(new_label); if(label_size.GetWidth() > label_rect.GetWidth()) { // Not enough room for three characters and ... // Display the entire label and just crop it clip_label = true; } else { // Room for some characters and ... // Display as many characters as possible and append ... for(size_t len = label.Len() - 1; len >= 3; --len) { new_label = label.Mid(0, len) + wxT("..."); label_size = dc.GetTextExtent(new_label); if(label_size.GetWidth() <= label_rect.GetWidth()) { label = new_label; break; } } } } dc.DrawRectangle(label_bg_rect); if(clip_label) { wxDCClipper clip(dc, label_rect); dc.DrawText(label, label_rect.x, label_rect.y + (label_rect.GetHeight() - label_size.GetHeight()) / 2); } else { dc.DrawText(label, label_rect.x + (label_rect.GetWidth() - label_size.GetWidth()) / 2, label_rect.y + (label_rect.GetHeight() - label_size.GetHeight()) / 2); } if(has_ext_button) { if(wnd->IsExtButtonHovered()) { dc.SetPen(m_panel_hover_button_border_pen); dc.SetBrush(m_panel_hover_button_background_brush); dc.DrawRectangle(label_rect.GetRight(), label_rect.GetBottom() - 14, 14, 14); dc.DrawBitmap(m_panel_extension_bitmap[1], label_rect.GetRight() + 3, label_rect.GetBottom() - 10, true); } else dc.DrawBitmap(m_panel_extension_bitmap[0], label_rect.GetRight() + 3, label_rect.GetBottom() - 10, true); } } if (wnd->GetParent()->IsKindOf(CLASSINFO(wxFrame))) // expanded panels are in their own wxFrame otherwise normal panel { wxRect shadow(rect); shadow.x +=4; shadow.y +=4; dc.SetPen(*wxRED); dc.DrawLine(shadow.GetBottomLeft(), shadow.GetBottomRight()); dc.DrawLine(shadow.GetTopRight(), shadow.GetBottomRight()); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetPen(m_panel_border_pen); dc.DrawRoundedRectangle(rect, 1.0); } else DrawPanelBorder(dc, true_rect, m_panel_border_pen, m_panel_border_gradient_pen); }
void MyFrame::Draw(wxDC& dc) { // This routine just draws a bunch of random stuff on the screen so that we // can check that different types of object are being drawn consistently // between the screen image, the print preview image (at various zoom // levels), and the printed page. dc.SetBackground(*wxWHITE_BRUSH); dc.Clear(); dc.SetFont(wxGetApp().m_testFont); dc.SetBackgroundMode(wxTRANSPARENT); dc.SetPen(*wxBLACK_PEN); dc.SetBrush(*wxLIGHT_GREY_BRUSH); // dc.SetBackground(*wxWHITE_BRUSH); dc.DrawRectangle(0, 0, 230, 350); dc.DrawLine(0, 0, 229, 349); dc.DrawLine(229, 0, 0, 349); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxCYAN_BRUSH); dc.SetPen(*wxRED_PEN); dc.DrawRoundedRectangle(0, 20, 200, 80, 20); dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40); dc.SetPen( wxPen(*wxBLACK,0,wxDOT_DASH) ); dc.DrawEllipse(50, 140, 100, 50); dc.SetPen(*wxRED_PEN); dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180); #if wxUSE_UNICODE //char *test = "Hebrew שלום -- Japanese (日本語)"; //wxString tmp = wxConvUTF8.cMB2WC( test ); //dc.DrawText( tmp, 10, 200 ); #endif wxPoint points[5]; points[0].x = 0; points[0].y = 0; points[1].x = 20; points[1].y = 0; points[2].x = 20; points[2].y = 20; points[3].x = 10; points[3].y = 20; points[4].x = 10; points[4].y = -20; dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE ); dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE ); dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 ); points[0].x = 150; points[0].y = 250; points[1].x = 180; points[1].y = 250; points[2].x = 180; points[2].y = 220; points[3].x = 200; points[3].y = 220; dc.DrawSpline( 4, points ); dc.DrawArc( 20,10, 10,10, 25,40 ); wxString str; int i = 0; str.Printf( wxT("---- Text at angle %d ----"), i ); dc.DrawRotatedText( str, 100, 300, i ); i = m_angle; str.Printf( wxT("---- Text at angle %d ----"), i ); dc.DrawRotatedText( str, 100, 300, i ); wxIcon my_icon = wxICON(mondrian) ; dc.DrawIcon( my_icon, 100, 100); if (m_bitmap.Ok()) { dc.DrawBitmap(m_bitmap, 10, 25); } if (m_imgUp.Ok()) { dc.DrawBitmap(m_imgUp, 300, 200); dc.DrawBitmap(m_imgUp, 300, 250, true); } }
void wxJigsawShape::DrawShapeHeader(wxDC & dc, const wxPoint & pos, const wxSize & size, const wxJigsawShapeStyle style) { wxPoint * points(NULL); bool bDrawBevel = true; wxColour bevelBright(200,200,200), bevelDarker(50,50,50); if(dc.GetPen() == *wxTRANSPARENT_PEN) { wxColour aux; aux = bevelBright; bevelBright = bevelDarker; bevelDarker = aux; } switch(style) { case wxJigsawShapeStyle::wxJS_TYPE_NUMERIC: if(bDrawBevel) { wxPoint pos1(pos); wxSize size1(size); dc.SetPen(bevelDarker); dc.DrawRoundedRectangle(pos1, size1, size1.GetHeight()/2); dc.SetPen(bevelBright); pos1.x += 1; pos1.y += 1; dc.DrawRoundedRectangle(pos1, size1, size1.GetHeight()/2); dc.SetPen(*wxTRANSPARENT_PEN); pos1.y -= 1; dc.DrawRoundedRectangle(pos1, size, size.GetHeight()/2); dc.SetPen(bevelDarker); dc.DrawLine(pos1.x + size.GetHeight()/2, pos1.y, pos1.x + size.GetWidth() - size.GetHeight()/2, pos1.y); } else { dc.DrawRoundedRectangle(pos, size, size.GetHeight()/2); } break; case wxJigsawShapeStyle::wxJS_TYPE_BOOLEAN: // If it is possible to draw a shape then we will draw it if(size.GetWidth() >= size.GetHeight()) { points = new wxPoint[7]; points[0] = wxPoint(0, size.GetHeight()/2); points[1] = wxPoint(size.GetHeight()/2, 0); points[2] = wxPoint(size.GetWidth()-size.GetHeight()/2, 0); points[3] = wxPoint(size.GetWidth(), size.GetHeight()/2); points[4] = wxPoint(size.GetWidth()-size.GetHeight()/2, size.GetHeight()); points[5] = wxPoint(size.GetHeight()/2, size.GetHeight()); points[6] = wxPoint(0, size.GetHeight()/2); dc.DrawPolygon(7, points, pos.x, pos.y); if(bDrawBevel) { dc.SetPen(bevelDarker); dc.DrawLines(3, points, pos.x, pos.y); dc.SetPen(bevelBright); dc.DrawLines(4, &points[3], pos.x, pos.y); } wxDELETEA(points); } else // If it is impossible to draw a shape then we will draw a rectangle { dc.DrawRectangle(pos, size); } break; case wxJigsawShapeStyle::wxJS_TYPE_STRING: // If it is possible to draw a shape then we will draw it if(size.GetWidth() >= size.GetHeight()) { /* 1/3,1 1/3,2/3 0,2/3 0,1/3 1/3,1/3 1/3,0 */ points = new wxPoint[13]; points[0] = wxPoint(size.GetHeight()/3.0, size.GetHeight()); points[1] = wxPoint(size.GetHeight()/3.0, 2*size.GetHeight()/3.0); points[2] = wxPoint(0, 2*size.GetHeight()/3.0); points[3] = wxPoint(0, size.GetHeight()/3.0); points[4] = wxPoint(size.GetHeight()/3.0, size.GetHeight()/3.0); points[5] = wxPoint(size.GetHeight()/3.0, 0); points[6] = wxPoint(size.GetWidth()-points[5].x, points[5].y); points[7] = wxPoint(size.GetWidth()-points[4].x, points[4].y); points[8] = wxPoint(size.GetWidth()-points[3].x, points[3].y); points[9] = wxPoint(size.GetWidth()-points[2].x, points[2].y); points[10] = wxPoint(size.GetWidth()-points[1].x, points[1].y); points[11] = wxPoint(size.GetWidth()-points[0].x, points[0].y); points[12] = points[0]; dc.DrawPolygon(13, points, pos.x, pos.y); if(bDrawBevel) { dc.SetPen(bevelDarker); dc.DrawLines(7, points, pos.x, pos.y); dc.SetPen(bevelBright); dc.DrawLines(6, &points[7], pos.x, pos.y); } wxDELETEA(points); } else // If it is impossible to draw a shape then we will draw a rectangle { dc.DrawRectangle(pos, size); } break; case wxJigsawShapeStyle::wxJS_TYPE_NONE: default: dc.DrawRoundedRectangle(pos, size, 4); break; } }
void GLCanvas::drawUserInterface(wxDC &dc) const { wxSize size = GetSize(); wxPoint pos(0, 0); pos.x = size.x - _buttonSize; wxSize buttonSize(_buttonSize, _buttonSize); wxPen whitePen(wxColour(255, 255, 255)); whitePen.SetWidth(1); wxPen blackPen(wxColour(0, 0, 0)); blackPen.SetWidth(1); wxPen greenPen(wxColour(0, 255, 0)); wxBrush brush; dc.SetPen(blackPen); brush.SetColour(wxColour(0, 0, 0)); dc.SetBrush(brush); // draw black background behind all buttons dc.DrawRectangle(pos.x - 1, pos.y, _buttonSize + 1, _numButtons * _buttonSize + 1); // draw grit if (_style & DRAW_GRID) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawRectangle(pos.x + 1, pos.y + 1, _buttonSize - 2, _buttonSize - 2); dc.DrawLine(pos.x + _buttonSizeHalf, pos.y + 1, pos.x + _buttonSizeHalf, pos.y + _buttonSize - 1); dc.DrawLine(pos.x + 1, pos.y + _buttonSizeHalf, size.x - 1, pos.y + _buttonSizeHalf); pos.y += _buttonSize; // draw a cube for showing AABB if (_style & DRAW_AABB) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawRectangle(pos.x + _buttonSizeHalf - 3, pos.y + 3, _buttonSizeHalf, _buttonSizeHalf); dc.DrawRectangle(pos.x + 2, pos.y + _buttonSizeHalf - 2, _buttonSizeHalf, _buttonSizeHalf); dc.DrawLine(pos.x + 2, pos.y + _buttonSizeHalf - 2, pos.x + _buttonSizeHalf - 3, pos.y + 3); dc.DrawLine(pos.x + 2 + _buttonSizeHalf, pos.y + _buttonSizeHalf - 2, pos.x + _buttonSize - 3, pos.y + 3); dc.DrawLine(pos.x + 2 + _buttonSizeHalf, pos.y + _buttonSize - 3, pos.x + _buttonSize - 3, pos.y + _buttonSizeHalf + 2); pos.y += _buttonSize; // draw coordinate system if (_style & DRAW_LOCAL_COORDINATE_SYSTEM) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawLine(pos.x + 2, pos.y + 3, pos.x + 2, pos.y + _buttonSize - 2); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, size.x - 3, pos.y + _buttonSize - 2); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 6, pos.y + _buttonSizeHalf + 2); pos.y += _buttonSize; // draw joint constraints if (_style & DRAW_JOINT_CONSTRAINTS) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } //dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 3); //dc.DrawArc(pos.x + 4, pos.y + 5, pos.x + 4, pos.y + _buttonSize - 5, pos.x + _buttonSizeHalf + 2, pos.y + _buttonSizeHalf); //dc.DrawCircle(pos.x + 6, pos.y + _buttonSizeHalf, 3); dc.DrawEllipse(pos.x + 4, pos.y + 3, _buttonSizeHalf - 5, _buttonSizeHalf + 4); dc.DrawLine(pos.x + 8, pos.y + 3, pos.x + _buttonSizeHalf + 5, pos.y + _buttonSizeHalf); dc.DrawLine(pos.x + 8, pos.y + _buttonSizeHalf + 7, pos.x + _buttonSizeHalf + 5, pos.y + _buttonSizeHalf); pos.y += _buttonSize; // draw rotation axis if (_style & DRAW_ROTATION_AXIS) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawArc(pos.x + _buttonSizeHalf + 2, pos.y + _buttonSize - 2, pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf + 1, pos.x + 2, pos.y + _buttonSize - 2); //dc.DrawEllipse(pos.x + 6, pos.y + 5, _buttonSize - 12, _buttonSize - 10); //dc.DrawCircle(pos.x + _buttonSizeHalf + 2, pos.y + _buttonSizeHalf - 2, 3); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 2, pos.y + 2); dc.DrawLine(pos.x + 2, pos.y + _buttonSize - 2, pos.x + _buttonSize - 2, pos.y + _buttonSize - 2); pos.y += _buttonSize; // draw label if (_style & DRAW_LABEL) { dc.SetPen(greenPen); } else { dc.SetPen(whitePen); } dc.DrawRoundedRectangle(pos.x + 4, pos.y + 3, _buttonSize - 5, _buttonSizeHalf, 3.0); dc.DrawSpline(pos.x + 4, pos.y + _buttonSizeHalf - 3, pos.x + 1, pos.y + _buttonSizeHalf + 4, pos.x + _buttonSizeHalf + 4, pos.y + _buttonSizeHalf + 6); pos.y += _buttonSize; // draw locate skeleton button dc.SetPen(whitePen); dc.DrawLine(pos.x + _buttonSizeHalf, pos.y + 2, pos.x + _buttonSizeHalf, pos.y + _buttonSize - 1); dc.DrawLine(pos.x + 2, pos.y + _buttonSizeHalf, size.x - 1, pos.y + _buttonSizeHalf); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 4); brush.SetColour(wxColour(255, 255, 255)); dc.SetBrush(brush); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 8); pos.y += _buttonSize; // draw settings button dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 3); dc.SetPen(blackPen); brush.SetColour(wxColour(0, 0, 0)); dc.SetBrush(brush); dc.DrawCircle(pos.x + _buttonSizeHalf + 6, pos.y + _buttonSizeHalf, 2); dc.DrawCircle(pos.x + _buttonSizeHalf - 6, pos.y + _buttonSizeHalf, 2); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf + 6, 2); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf - 6, 2); dc.SetPen(whitePen); dc.DrawCircle(pos.x + _buttonSizeHalf, pos.y + _buttonSizeHalf, _buttonSizeHalf - 7); }