wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : wxGCDCImpl( owner ) { m_window = window; m_ok = true ; m_window->GetSize( &m_width , &m_height); if ( !m_window->IsShownOnScreen() ) m_width = m_height = 0; CGContextRef cg = (CGContextRef) window->MacGetCGContextRef(); m_release = false; if ( cg == NULL ) { SetGraphicsContext( wxGraphicsContext::Create( window ) ) ; m_contentScaleFactor = window->GetContentScaleFactor(); SetDeviceOrigin(-window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize()); } else { // determine content scale CGRect userrect = CGRectMake(0, 0, 10, 10); CGRect devicerect; devicerect = CGContextConvertRectToDeviceSpace(cg, userrect); m_contentScaleFactor = devicerect.size.height / userrect.size.height; CGContextSaveGState( cg ); m_release = true ; // make sure the context is having its origin at the wx-window coordinates of the // view (read at the top of window.cpp about the differences) if ( window->MacGetLeftBorderSize() != 0 || window->MacGetTopBorderSize() != 0 ) CGContextTranslateCTM( cg , -window->MacGetLeftBorderSize() , -window->MacGetTopBorderSize() ); wxGraphicsContext* context = wxGraphicsContext::CreateFromNative( cg ); context->EnableOffset(true); SetGraphicsContext( context ); } DoSetClippingRegion( 0 , 0 , m_width , m_height ) ; SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID)); SetFont( window->GetFont() ) ; }
void wxQtDCImpl::QtPreparePainter( ) { //Do here all QPainter initialization (called after each begin()) if ( m_qtPainter == NULL ) { wxLogDebug(wxT("wxQtDCImpl::QtPreparePainter is NULL!!!")); } else if ( m_qtPainter->isActive() ) { m_qtPainter->setPen( wxPen().GetHandle() ); m_qtPainter->setBrush( wxBrush().GetHandle() ); m_qtPainter->setFont( wxFont().GetHandle() ); } else { wxLogDebug(wxT("wxQtDCImpl::QtPreparePainter not active!")); } }
//---------------------------------------------------------------------------- // STISpectrumGridCellColoredRectRenderer implementation //---------------------------------------------------------------------------- void STISpectrumGridCellColoredRectRenderer::Draw(wxGrid &grid, wxGridCellAttr& attr, wxDC &dc, const wxRect& rect, int nRow, int nCol, bool bIsSelected) { wxGridCellStringRenderer::Draw(grid, attr, dc, rect, nRow, nCol, bIsSelected); wxColour col; ::AuroraChooseColour(col, nRow); wxRect r = rect; r.SetWidth(r.width/2); r.SetHeight(r.height/2); r.x += (rect.width - r.width)/2; r.y += (rect.height - r.height)/2; dc.SetPen(*wxBLACK); dc.SetBrush(wxBrush(col)); dc.DrawRectangle(r); }
void DrawButton(unsigned int* const bitmasks, unsigned int buttons, unsigned int n, wxDC& dc, ControlGroupBox* g, unsigned int row) { if (buttons & bitmasks[(row * 8) + n]) { dc.SetBrush(*wxRED_BRUSH); } else { unsigned char amt = 255 - g->control_group->controls[(row * 8) + n]->control_ref->State() * 128; dc.SetBrush(wxBrush(wxColour(amt, amt, amt))); } dc.DrawRectangle(n * 12, (row == 0) ? 0 : (row * 12 - 1), 14, 12); // text const std::string name = g->control_group->controls[(row * 8) + n]->name; // bit of hax so ZL, ZR show up as L, R dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n * 12 + 2, 1 + ((row == 0) ? 0 : (row * 12 - 1))); }
/* * Here we do the actual rendering. I put it in a separate * method so that it can work no matter what type of DC * (e.g. wxPaintDC or wxClientDC) is used. */ void wxStateButton::render(wxDC& dc) { int w; int h; dc.GetSize(&w,&h); if (m_bChecked) { dc.SetBrush(*wxGREY_BRUSH); dc.SetTextForeground(wxColor(255, 255, 255)); } else { dc.SetBrush(wxBrush(wxColor(64, 64, 64))); dc.SetTextForeground(*wxLIGHT_GREY); } dc.SetPen(*wxGREY_PEN); wxRect r = GetClientRect(); dc.DrawRectangle(0, 0, w, h); dc.SetFont(wxSystemSettings::GetFont(wxSystemFont::wxSYS_DEFAULT_GUI_FONT)); dc.DrawLabel(GetLabel(), r, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL); }
void ToggleBitmap::OnPaint(wxPaintEvent &) { wxAutoBufferedPaintDC dc(this); // Get background color wxColour bgColor = command.IsActive(context) ? wxColour(0,255,0) : wxColour(255,0,0); wxColor sysCol = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT); bgColor.Set( (sysCol.Red() + bgColor.Red()) / 2, (sysCol.Green() + bgColor.Green()) / 2, (sysCol.Blue() + bgColor.Blue()) / 2); dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(bgColor)); dc.DrawRectangle(wxPoint(0, 0), GetClientSize()); wxSize excess = (GetClientSize() - img.GetSize()) / 2; dc.DrawBitmap(img, excess.GetX(), excess.GetY(), true); }
void TLView::Draw3dRect(wxDC *dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxColour colour) { /* wxBrush b1=dc->GetBrush(); b1.SetColour(colour);*/ dc->SetBrush(wxBrush(colour, wxSOLID)); dc->SetPen(*wxTRANSPARENT_PEN); dc->DrawRectangle(x,y,width,height); /* wxPen pen1=dc->GetPen(); pen1.SetColour(GetLightColour(colour));*/ dc->SetPen(wxPen(GetLightColour(colour), 1, wxSOLID )); dc->DrawLine(x,y,x+width-1,y); dc->DrawLine(x,y,x,y+height-1); /* pen1=dc->GetPen(); pen1.SetColour(GetDarkColour(colour));*/ dc->SetPen(wxPen(GetDarkColour(colour), 1, wxSOLID )); dc->DrawLine(x,y+height-1,x+width-1,y+height-1); dc->DrawLine(x+width-1,y,x+width-1,y+height); }
void AudioWaveformRenderer::RenderBlank(wxDC &dc, const wxRect &rect, AudioRenderingStyle style) { const AudioColorScheme *pal = &colors[style]; wxColor line(pal->get(1.0)); wxColor bg(pal->get(0.0)); // Draw the line as background above and below, and line in the middle, to avoid // overdraw flicker (the common theme in all of audio display direct drawing). int halfheight = rect.height / 2; dc.SetBrush(wxBrush(bg)); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rect.x, rect.y, rect.width, halfheight); dc.DrawRectangle(rect.x, rect.y + halfheight + 1, rect.width, rect.height - halfheight - 1); dc.SetPen(wxPen(line)); dc.DrawLine(rect.x, rect.y+halfheight, rect.x+rect.width, rect.y+halfheight); }
wxBitmap TexturePackPanel::GetFrameBitmap(const Frame& frame, int zoom) { wxSize imgSize = frame.GetSize(); imgSize *= zoom; wxMemoryDC srcDC; srcDC.SelectObject(m_bitmap); wxBitmap frameBmp(imgSize, m_bitmap.GetDepth()); wxMemoryDC dstDC; dstDC.SelectObject(frameBmp); dstDC.SetBackground(wxBrush(m_colourPicker->GetColour())); dstDC.Clear(); dstDC.StretchBlit(wxPoint(0, 0), imgSize, &srcDC, frame.GetOffset(), frame.GetSize(), wxCOPY, true); return frameBmp; }
void wxGenericColourButton::UpdateColour() { wxMemoryDC dc(m_bitmap); dc.SetPen( *wxTRANSPARENT_PEN ); dc.SetBrush( wxBrush(m_colour) ); dc.DrawRectangle( 0,0,m_bitmap.GetWidth(),m_bitmap.GetHeight() ); if ( HasFlag(wxCLRP_SHOW_LABEL) ) { wxColour col( ~m_colour.Red(), ~m_colour.Green(), ~m_colour.Blue() ); dc.SetTextForeground( col ); dc.SetFont( GetFont() ); dc.DrawText( m_colour.GetAsString(wxC2S_HTML_SYNTAX), 0, 0 ); } dc.SelectObject( wxNullBitmap ); SetBitmapLabel( m_bitmap ); }
void PenStyleComboBox::OnDrawBackground( wxDC& dc, const wxRect& rect, int item, int flags ) const { // If item is selected or even, or we are painting the // combo control itself, use the default rendering. if ( (flags & (wxODCB_PAINTING_CONTROL|wxODCB_PAINTING_SELECTED)) || (item & 1) == 0 ) { wxOwnerDrawnComboBox::OnDrawBackground(dc,rect,item,flags); return; } // Otherwise, draw every other background with different colour. wxColour bgCol(240,240,250); dc.SetBrush(wxBrush(bgCol)); dc.SetPen(wxPen(bgCol)); dc.DrawRectangle(rect); }
void Piano::SetColorScheme( ColorScheme cs ) { // Recreate the local brushes m_backBrush = wxBrush( GetGlobalColor( _T("UIBDR") ), wxBRUSHSTYLE_SOLID ); m_tBrush = wxBrush( GetGlobalColor( _T("BLUE2") ), wxBRUSHSTYLE_SOLID ); // Raster Chart unselected m_slBrush = wxBrush( GetGlobalColor( _T("BLUE1") ), wxBRUSHSTYLE_SOLID ); // and selected m_vBrush = wxBrush( GetGlobalColor( _T("GREEN2") ), wxBRUSHSTYLE_SOLID ); // Vector Chart unselected m_svBrush = wxBrush( GetGlobalColor( _T("GREEN1") ), wxBRUSHSTYLE_SOLID ); // and selected m_cBrush = wxBrush( GetGlobalColor( _T("YELO2") ), wxBRUSHSTYLE_SOLID ); // CM93 Chart unselected m_scBrush = wxBrush( GetGlobalColor( _T("YELO1") ), wxBRUSHSTYLE_SOLID ); // and selected m_uvBrush = wxBrush( GetGlobalColor( _T("UINFD") ), wxBRUSHSTYLE_SOLID ); // and unavailable m_tex_piano_height = 0; // force texture to update }
SAuiDockArt::SAuiDockArt() { captionBackColour = Drawing::darkColour(Drawing::getPanelBGColour(), 0.0f); wxColour textColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); float r = ((float)textColour.Red() * 0.2f) + ((float)captionBackColour.Red() * 0.8f); float g = ((float)textColour.Green() * 0.2f) + ((float)captionBackColour.Green() * 0.8f); float b = ((float)textColour.Blue() * 0.2f) + ((float)captionBackColour.Blue() * 0.8f); captionAccentColour = wxColor(r, g, b); m_activeCloseBitmap = bitmapFromBits(close_bits, 16, 16, wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); m_inactiveCloseBitmap = bitmapFromBits(close_bits, 16, 16, wxColour(128, 128, 128)); if (Global::win_version_major >= 10) m_sashBrush = wxBrush(col_w10_bg); m_captionSize = 19; m_sashSize = 4; }
void wxTabbedCtrl::DrawMenu(bool active, wxDC &dc) { const int SIZE = 8; wxSize size = GetSize(); wxBrush back_brush = wxBrush(GetBackgroundColour()); wxPen back_pen = wxPen(GetBackgroundColour()); wxPen x_pen = wxPen(active ? *wxBLACK : wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); x_pen.SetWidth(2); int posx = size.x-(SIZE*8), posy = (size.y-SIZE)/2; Menu_rect = wxRect(posx, posy, SIZE, SIZE); dc.SetPen(back_pen); dc.SetBrush(back_brush); dc.DrawRectangle(posx-SIZE+1, 1, SIZE*3-2, size.y-2); dc.SetPen(x_pen); dc.DrawLine(posx, posy+4, posx+4, posy+8); dc.DrawLine(posx+4, posy+8, posx+8, posy+4); }
void BaseEditor::OnPaintEvt(wxPaintEvent& event) { wxBufferedPaintDC dc(this); // get client size wxSize maxSize = CalculateMaxSize(); // fill background dc.SetBackground(*wxLIGHT_GREY_BRUSH); dc.Clear(); // draw cross dc.SetBrush(wxBrush(*wxWHITE, wxBRUSHSTYLE_CROSSDIAG_HATCH)); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(wxPoint(0, 0), maxSize*m_nZoom); // custom draw Draw(dc); }
void wxEmulatorContainer::OnEraseBackground(wxEraseEvent& event) { wxDC* dc wxDUMMY_INITIALIZE(NULL); if (event.GetDC()) { dc = event.GetDC(); } else { dc = new wxClientDC(this); } dc->SetBackground(wxBrush(wxGetApp().m_emulatorInfo.m_emulatorBackgroundColour, wxSOLID)); dc->Clear(); if (!event.GetDC()) delete dc; }
//---------------------------------------------------------------- // draw() //---------------------------------------------------------------- void PlotWaterfall::draw(wxAutoBufferedPaintDC& dc) { m_rCtrl = GetClientRect(); // m_rGrid is coords of inner window we actually plot to. We deflate it a bit // to leave room for axis labels. m_rGrid = m_rCtrl; m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2))); if (m_pBmp == NULL) { // we want a bit map the size of m_rGrid m_pBmp = new wxBitmap(m_rGrid.GetWidth(), m_rGrid.GetHeight(), 24); } dc.Clear(); if(m_newdata) { m_newdata = false; plotPixelData(); dc.DrawBitmap(*m_pBmp, PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER); m_dT = DT; } else { // no data to plot so just erase to black. Blue looks nicer // but is same colour as low amplitude signal // Bug on Linux: When Stop is pressed this code doesn't erase // the lower 25% of the Waterfall Window m_rPlot = wxRect(PLOT_BORDER + XLEFT_OFFSET, PLOT_BORDER, m_rGrid.GetWidth(), m_rGrid.GetHeight()); wxBrush ltGraphBkgBrush = wxBrush(BLACK_COLOR); dc.SetBrush(ltGraphBkgBrush); dc.SetPen(wxPen(BLACK_COLOR, 0)); dc.DrawRectangle(m_rPlot); } drawGraticule(dc); }
void GPSDraw::point(double latitude, double longitude) { if (false) { int x; int y; project(latitude, longitude, x, y); _dc->DrawPoint(x, y); } else { wxBrush saved_brush = _dc->GetBrush(); _dc->SetBrush(wxBrush(_dc->GetPen().GetColour())); circle(latitude, longitude, 1.0); _dc->SetBrush(saved_brush); } }
void SeqTrack::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC dc(this); wxSize s; #define BORDER (3) PrepareDC(dc); s = GetSize(); dc.SetPen(*wxMEDIUM_GREY_PEN); dc.SetBrush(wxBrush(CL_RULER_BACKGROUND, wxTRANSPARENT));//*wxLIGHT_GREY_BRUSH); dc.DrawRoundedRectangle(0, 0, s.x - BORDER, s.y, 3); if (Selected) dc.SetPen(wxPen(CL_WAVE_DRAW, 3, wxSOLID)); else dc.SetPen(wxPen(wxColor(141, 153, 170), 2, wxSOLID)); dc.SetBrush(CL_RULER_BACKGROUND);//*wxLIGHT_GREY_BRUSH); dc.DrawRoundedRectangle(1, 1, s.x - 3 - BORDER, s.y - 2, 3); }
void CDragBar::OnPaint(wxPaintEvent& /*evt*/) { wxRect rcWin = GetRect(); //draw along the entire window rect, since clipping rect is always (0, 0, -1, -1) wxPaintDC dc(this); dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))); //draw the dragbar background, which some platforms don't handle automatically dc.DrawRectangle(rcWin); wxPen shadow(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); dc.SetPen(shadow); //draw a shadow along the bottom or the right edge, depending on orientation if (m_orientation == wxHORIZONTAL) dc.DrawLine(rcWin.GetBottomLeft(), rcWin.GetBottomRight()); else dc.DrawLine(rcWin.GetTopRight(), rcWin.GetBottomRight()); //remove the shadown pen dc.SetPen(wxNullPen); wxRect rc; dc.GetClippingBox(rc); //wxLogDebug(wxT("Clipping box = [(%d, %d) (%d %d)]"), rc.GetLeft(), rc.GetTop(), rc.GetRight(), rc.GetBottom()); wxSize range = GetInvalidatedIconRange(rc); wxASSERT(range.x == -1 || (range.x >= 0 && size_t(range.x) < m_items.size())); wxASSERT(range.y == -1 || (range.y >= range.x && size_t(range.y) < m_items.size())); if (range.x >= 0) { //wxLogDebug(wxT("Painting dragbar icons %d - %d"), range.x + 1, range.y + 1); for (int idx = range.x; idx <= range.y; ++idx) { dc.DrawBitmap(m_items[idx].enabled? m_items[idx].bmp : m_items[idx].bmpDisabled, GetToolX(idx), GetToolY(idx), true); } } else { //wxLogDebug(wxT("all dragbar icons valid")); } }
void ClientBoard::DrawSquare(wxPaintDC& dc, int x, int y, Tetrominoes shape) { static wxColour colors[] = { wxColour(0, 0, 0), wxColour(204, 102, 102), wxColour(102, 204, 102), wxColour(102, 102, 204), wxColour(204, 204, 102), wxColour(204, 102, 204), wxColour(102, 204, 204), wxColour(218, 170, 0) }; static wxColour light[] = { wxColour(0, 0, 0), wxColour(248, 159, 171), wxColour(121, 252, 121), wxColour(121, 121, 252), wxColour(252, 252, 121), wxColour(252, 121, 252), wxColour(121, 252, 252), wxColour(252, 198, 0) }; static wxColour dark[] = { wxColour(0, 0, 0), wxColour(128, 59, 59), wxColour(59, 128, 59), wxColour(59, 59, 128), wxColour(128, 128, 59), wxColour(128, 59, 128), wxColour(59, 128, 128), wxColour(128, 98, 0) }; wxPen pen(light[int(shape)]); pen.SetCap(wxCAP_PROJECTING); dc.SetPen(pen); dc.DrawLine(x, y + SquareHeight() - 1, x, y); dc.DrawLine(x, y, x + SquareWidth() - 1, y); wxPen darkpen(dark[int(shape)]); darkpen.SetCap(wxCAP_PROJECTING); dc.SetPen(darkpen); dc.DrawLine(x + 1, y + SquareHeight() - 1, x + SquareWidth() - 1, y + SquareHeight() - 1); dc.DrawLine(x + SquareWidth() - 1, y + SquareHeight() - 1, x + SquareWidth() - 1, y + 1); dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush(wxBrush(colors[int(shape)])); dc.DrawRectangle(x + 1, y + 1, SquareWidth() - 2, SquareHeight() - 2); }
/********************************************************************************************* > afx_msg void CRenderWnd::OnPaint() Author: Justin_Flude (Xara Group Ltd) <*****@*****.**> Created: ages ago Inputs: - Outputs: - Returns: - Purpose: Creates a CPaintDC and sends a private WM_RENDERVIEW message, together with a pointer to the CPaintDC in the LPARAM, to the parent CCamView. Uses a CCPaintDC so we can get to the rectangle list subsequently. Errors: - Scope: Protected SeeAlso: CCamView::OnRenderView() **********************************************************************************************/ void CRenderWnd::OnPaint( wxPaintEvent &evnt ) { if ((!CCamApp::IsDisabled()) && (!PrintMonitor::IsPrintingNow())) { CCPaintDC dc(this); // wxPalette* OldPal = PaletteManager::StartPaintPalette(&dc); if (m_pView) m_pView->OnDraw(dc.GetDC()); // PaletteManager::StopPaintPalette(&dc, OldPal); } else { // if we were printing, we have to draw something - white will do if (PrintMonitor::IsPrintingNow()) { // Draw a white rectangle here wxPaintDC MyPaint(this); // Lets have a white brush... MyPaint.SetBrush(wxBrush(wxColour(*wxWHITE))); MyPaint.SetPen(*wxTRANSPARENT_PEN); wxRegionIterator upd(GetUpdateRegion()); // get the update rect list while (upd) { wxRect rect(upd.GetRect()); MyPaint.DrawRectangle(rect); upd++; } // ask for a full redraw at the end PrintMonitor::WantFullRedraw(TRUE); } else { wxPaintDC dc( this ); // Clear paint condition } } }
void MaterialWindow::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxBufferedPaintDC bpdc(this); wxGCDC gdc; wxGraphicsRenderer* const renderer = wxGraphicsRenderer::GetDefaultRenderer(); wxGraphicsContext* context; if ( wxMemoryDC *memdc = wxDynamicCast(&bpdc, wxMemoryDC) ) { context = renderer->CreateContext(*memdc); } gdc.SetGraphicsContext(context); // Draw Background gdc.SetBackground(wxBrush(wxColour(38, 38, 38))); gdc.Clear(); // Draw Background Grid int gridOffsetX = (int)mWindowX % 20; int gridOffsetY = (int)mWindowY % 20; gdc.SetPen(wxPen( wxColour(128, 128, 128, 128), 1) ); wxSize windowSize = GetSize(); // Vertical Lines for(int x = 0; x < (windowSize.x + 40); x += 20) gdc.DrawLine(gridOffsetX + x - 20, gridOffsetY - 20, gridOffsetX + x - 20, gridOffsetY + windowSize.y + 40); // Horizontal Lines for(int y = 0; y < (windowSize.y + 40); y += 20) gdc.DrawLine(gridOffsetX - 20, gridOffsetY + y - 20, gridOffsetX + windowSize.x + 40, gridOffsetY + y - 20); // Draw Nodes for(S32 n = 0; n < nodeList.size(); ++n ) { Node* node = &nodeList[n]; drawNode(gdc, node); } // Draw Connections for(S32 n = 0; n < connectionList.size(); ++n ) { Connection* connection = &connectionList[n]; drawConnection(gdc, context, connection); } }
void PicViewCtrl::Render(wxGraphicsContext* gc, wxGraphicsContext* gct) { if(!m_bClearFlag) { gc->Scale(m_dScaleRate, m_dScaleRate); DrawBackGround(gc); m_pHRuler->SetTagValue(m_curLCUStart.x); m_pVRuler->SetTagValue(m_curLCUStart.y); gct->Scale(1, 1); gct->SetBrush(wxBrush(wxColor(255, 255, 255, 100))); gct->SetPen(wxPen(wxColor(255, 0, 0, 255))); gct->StrokeLine(0, m_curLCUStart.y*m_dScaleRate, m_curLCUStart.x*m_dScaleRate, m_curLCUStart.y*m_dScaleRate); gct->StrokeLine(m_curLCUStart.x*m_dScaleRate, 0, m_curLCUStart.x*m_dScaleRate, m_curLCUStart.y*m_dScaleRate); gct->SetPen(wxPen(wxColor(255, 255, 255, 100))); gct->DrawRectangle(m_curLCUStart.x*m_dScaleRate, m_curLCUStart.y*m_dScaleRate, (m_curLCUEnd.x - m_curLCUStart.x)*m_dScaleRate, (m_curLCUEnd.y - m_curLCUStart.y)*m_dScaleRate); if(m_iSelectedLCUId < 0) { m_iSelectedLCUId = 0; CalStartEndPointByLCUId(m_iSelectedLCUId, m_curSelLCUStart, m_curSelLCUEnd); m_PosData._iBlockX = m_curSelLCUStart.x; m_PosData._iBlockY = m_curSelLCUStart.y; m_PosData._iBlockWidth = m_curSelLCUEnd.x - m_curSelLCUStart.x; m_PosData._iBlockHeight = m_curSelLCUEnd.y - m_curSelLCUStart.y; m_PosData._iOffsetX = 0; m_PosData._iOffsetY = 0; wxCommandEvent event(wxEVT_POSITION_CHANGED, wxID_ANY); event.SetClientData(&m_PosData); wxPostEvent(m_pPixelCtrl, event); } m_pHRuler->SetTagValue2(m_curSelLCUStart.x); m_pVRuler->SetTagValue2(m_curSelLCUStart.y); gct->SetPen(wxPen(wxColor(250, 5, 243, 128))); gct->StrokeLine(0, m_curSelLCUStart.y*m_dScaleRate, m_curSelLCUStart.x*m_dScaleRate, m_curSelLCUStart.y*m_dScaleRate); gct->StrokeLine(m_curSelLCUStart.x*m_dScaleRate, 0, m_curSelLCUStart.x*m_dScaleRate, m_curSelLCUStart.y*m_dScaleRate); gct->DrawRectangle(m_curSelLCUStart.x*m_dScaleRate, m_curSelLCUStart.y*m_dScaleRate, (m_curSelLCUEnd.x - m_curSelLCUStart.x)*m_dScaleRate, (m_curSelLCUEnd.y - m_curSelLCUStart.y)*m_dScaleRate); } else DrawNoPictureTips(gc); m_bFullRefresh = true; }
void SliderPanel::DrawSlider(wxPaintDC &dc) { wxColour color; color.Set(wxT("#DDE1E6")); dc.SetBackground(wxBrush(color)); dc.Clear(); wxSize size = GetSize(); int width = size.GetWidth(); int height = size.GetHeight(); wxSize size2 = m_slider->GetSize(); int width2 = size2.GetWidth(); int height2 = size2.GetHeight(); int x = (width-width2)/2; int y = (height-height2)/2; m_slider->Move(wxPoint(x,y)); }
void PicViewCtrl::DrawNoPictureTips(wxGraphicsContext* gc) { double w, h, descent, externalLeading; wxSize size = GetClientSize(); wxString s; s.Printf(_T("No picture to show!"), size.x, size.y); gc->SetFont(*wxNORMAL_FONT, *wxBLACK); gc->SetPen(*wxBLACK_PEN); gc->GetTextExtent(s, &w, &h, &descent, &externalLeading); gc->SetBrush(wxBrush(wxColor(255, 255, 255, 255))); gc->DrawRectangle(0, 0, size.GetWidth()-1, size.GetHeight()-1); h += 3; gc->SetBrush(*wxTRANSPARENT_BRUSH); gc->SetPen(*wxLIGHT_GREY_PEN); gc->StrokeLine(0, 0, size.x, size.y); gc->StrokeLine(0, size.y, size.x, 0); gc->DrawText(s, (size.x-w)/2, ((size.y-(h))/2)); SetRulerCtrlFited(); wxBitmap::CleanUpHandlers(); }
// // This draws the background of a toolbar // void ToolBarResizer::OnPaint( wxPaintEvent & event ) { wxPaintDC dc( (wxWindow *) event.GetEventObject() ); // Start with a clean background // // Under GTK, we specifically set the toolbar background to the background // colour in the system theme. #if defined( __WXGTK__ ) dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) ); #endif dc.Clear(); wxSize sz = GetSize(); AColor::Dark( &dc, false ); AColor::Line(dc, sz.x - 4, 0, sz.x - 4, sz.y ); AColor::Line(dc, sz.x - 1, 0, sz.x - 1, sz.y ); }
void gcImage::tileImg( wxBitmap &target, wxBitmap src, wxColor* fillBg, TILE_DIR dir) { if (!src.IsOk()) return; if ((dir == HOZ || dir == BOTH) && src.GetWidth() == 0) return; if ((dir == VERT || dir == BOTH) && src.GetHeight() == 0) return; wxMemoryDC memTargDC(target); if (fillBg) { memTargDC.SetBrush(wxBrush(*fillBg)); memTargDC.SetPen( wxPen(*fillBg,1) ); memTargDC.DrawRectangle(0, 0, target.GetWidth(), target.GetHeight()); } if (dir == HOZ) { for (int32 x=0; x<target.GetWidth(); x+=src.GetWidth()) memTargDC.DrawBitmap(src, x, 0, true); } else if (dir == VERT) { for (int32 y=0; y<target.GetHeight(); y+=src.GetHeight()) memTargDC.DrawBitmap(src, 0, y, true); } else { for (int32 x=0; x<target.GetWidth(); x+=src.GetWidth()) { for (int32 y=0; y<target.GetHeight(); y+=src.GetHeight()) memTargDC.DrawBitmap(src, x, y, true); } } memTargDC.SelectObject(wxNullBitmap); }
void DefaultTabArt::DrawBackground(wxDC& dc, wxWindow* WXUNUSED(wnd), const wxRect& rect) { // draw background m_baseColour = wxColour(75,75,75); wxColor top_color = m_baseColour.ChangeLightness(90); wxColor bottom_color = m_baseColour.ChangeLightness(110); wxRect r; if (m_flags &wxAUI_NB_BOTTOM) r = wxRect(rect.x, rect.y, rect.width+2, rect.height); // TODO: else if (m_flags &wxAUI_NB_LEFT) {} // TODO: else if (m_flags &wxAUI_NB_RIGHT) {} else //for wxAUI_NB_TOP r = wxRect(rect.x, rect.y, rect.width+2, rect.height-3); dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH); // draw base lines m_borderPen = top_color; dc.SetPen(m_borderPen); int y = rect.GetHeight(); int w = rect.GetWidth(); if (m_flags &wxAUI_NB_BOTTOM) { dc.SetBrush(wxBrush(bottom_color)); dc.DrawRectangle(-1, 0, w+2, 4); } // TODO: else if (m_flags &wxAUI_NB_LEFT) {} // TODO: else if (m_flags &wxAUI_NB_RIGHT) {} else //for wxAUI_NB_TOP { dc.SetBrush(m_baseColourBrush); dc.SetBrush(m_baseColour); dc.DrawRectangle(-1, y-4, w+2, 4); } }
void wxBuildUI::Paint(wxMemoryDC &dc) { wxSize size = GetSize(); dc.SetBrush(wxBrush(sBackgroundBuild, wxSOLID)); dc.SetPen(wxPen(mClickable ? sClickable : sOutline, 1, wxSOLID)); dc.DrawRectangle(0, 0, size.x, size.y); // If we're not clickable, draw hatch lines over the bitmap to show it. if(false == mClickable) { wxBrush brush(sOutline); brush.SetStyle(wxBDIAGONAL_HATCH); dc.SetBrush(brush); dc.DrawRectangle(0, 0, size.x, size.y); dc.DrawBitmap(mDisabledBitmap, 1, 1, true); } }