void RegRichTextCtrl::OnLeftClick( wxMouseEvent& event ) { SetFocus(); wxClientDC dc(this); PrepareDC(dc); dc.SetFont(GetFont()); long position = 0; int hit = GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position); if (hit != wxRICHTEXT_HITTEST_NONE) { bool caretAtLineStart = false; if (hit & wxRICHTEXT_HITTEST_BEFORE) { // If we're at the start of a line (but not first in para) // then we should keep the caret showing at the start of the line // by showing the m_caretAtLineStart flag. wxRichTextParagraph* para = GetBuffer().GetParagraphAtPosition(position); wxRichTextLine* line = GetBuffer().GetLineAtPosition(position); if (line && para && line->GetAbsoluteRange().GetStart() == position && para->GetRange().GetStart() != position) caretAtLineStart = true; position--; } MoveCaret(position, caretAtLineStart); SelectWord(GetCaretPosition()); } }
void ExplainCanvas::OnMouseMotion(wxMouseEvent &ev) { ev.Skip(true); if (ev.Dragging()) return; wxClientDC dc(this); PrepareDC(dc); wxPoint logPos(ev.GetLogicalPosition(dc)); double x, y; x = (double) logPos.x; y = (double) logPos.y; // Find the nearest object int attachment = 0; ExplainShape *nearestObj = dynamic_cast<ExplainShape *>(FindShape(x, y, &attachment)); if (nearestObj) { ShowPopup(nearestObj); } }
// This implements a tiny doodling program! Drag the mouse using the left // button. void MyCanvas::OnEvent(wxMouseEvent& event) { wxClientDC dc(this); PrepareDC(dc); wxPoint pt(event.GetLogicalPosition(dc)); static long xpos = -1; static long ypos = -1; if (xpos > -1 && ypos > -1 && event.Dragging()) { dc.SetPen(*wxBLACK_PEN); dc.DrawLine(xpos, ypos, pt.x, pt.y); m_dirty = true; } else { event.Skip(); } xpos = pt.x; ypos = pt.y; }
void FortyCanvas::Redo() { wxClientDC dc(this); PrepareDC(dc); dc.SetFont(* m_font); m_game->Redo(dc); }
void wxGenericStaticText::OnPaint(wxPaintEvent& WXUNUSED(event)) { if ( m_label.empty() ) return; wxPaintDC dc(this); PrepareDC(dc); wxRect rect = GetClientRect(); if ( IsEnabled() ) { dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT)); } else // paint disabled text { // draw shadow of the text dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT)); wxRect rectShadow = rect; rectShadow.Offset(1, 1); dc.DrawLabel(m_label, rectShadow, GetAlignment(), m_mnemonic); dc.SetTextForeground( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW)); } dc.DrawLabel(m_label, wxNullBitmap, rect, GetAlignment(), m_mnemonic); }
void RulerMidi::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); wxSize size; wxString s; double x; long m; PrepareDC(dc); size = GetSize(); dc.SetPen(wxPen(CL_RULER_BACKGROUND, 1, wxSOLID)); dc.SetBrush(wxBrush(CL_RULER_BACKGROUND)); dc.SetTextForeground(CL_RULER_PATTERNNUM); dc.DrawRectangle(0, 0, size.x, size.y); dc.SetPen(wxPen(CL_RULER_FOREGROUND, 1, wxSOLID)); m = 0; for (x = 0; (long) floor(x) < size.x; x += ROW_WIDTH * ZoomX) { if (!(m % 4)) { s.Printf(wxT("%lu"), (long) (m / 4)); dc.DrawText(s, (int) floor(x) + 2, 0); } dc.DrawLine((int) floor(x), (m++ % 4) ? MIDI_RULER_HEIGHT - 8 : 0, (int) floor(x), MIDI_RULER_HEIGHT); } }
// This calls OnDraw, having adjusted the origin according to the current // scroll position void wxScrolledWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc); OnDraw(dc); }
void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) ) { wxPaintDC dc(this); PrepareDC(dc); dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ; }
void CStandardApertureViewStatic::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here // Do not call CStatic::OnPaint() for painting messages //CRect clientRect; //GetClientRect(&clientRect); //dc.Ellipse(&clientRect); CCEtoODBDoc* doc = getCamCadDoc(); CCamCadDocGraph camCadDocGraph(doc); if (m_camCadFrame != NULL) { PrepareDC(&dc); HBRUSH hBrush = CreateSolidBrush(doc->getSettings().Foregrnd); HBRUSH oldBrush = (HBRUSH) SelectObject(dc.m_hDC, hBrush); CRect clientRect; GetClientRect(&clientRect); dc.DPtoLP(&clientRect); dc.Rectangle(&clientRect); //dc.Rectangle(doc->minXCoord, doc->minYCoord, doc->maxXCoord, doc->maxYCoord); DeleteObject(SelectObject(dc.m_hDC, oldBrush)); Draw(&dc); } }
void csCanvas::OnEndDragLeft(double x, double y, int WXUNUSED(keys)) { ReleaseMouse(); wxClientDC dc(this); PrepareDC(dc); // Select all images within the rectangle float min_x, max_x, min_y, max_y; min_x = wxMin(x, sg_initialX); max_x = wxMax(x, sg_initialX); min_y = wxMin(y, sg_initialY); max_y = wxMax(y, sg_initialY); wxObjectList::compatibility_iterator node = GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *shape = (wxShape *)node->GetData(); if (shape->GetParent() == NULL && !shape->IsKindOf(CLASSINFO(wxControlPoint))) { float image_x = shape->GetX(); float image_y = shape->GetY(); if (image_x >= min_x && image_x <= max_x && image_y >= min_y && image_y <= max_y) { shape->Select(true, &dc); GetView()->SelectShape(shape, true); } } node = node->GetNext(); } }
/***************************************************** ** ** BasicWidget --- OnPaint ** ******************************************************/ void BasicWidget::OnPaint( wxPaintEvent &event ) { int vx, vy; wxPaintDC context( this ); PrepareDC( context ); wxRegionIterator upd( GetUpdateRegion()); if ( upd ) refreshRect = upd.GetRect(); while ( ++upd ) { refreshRect.Union( upd.GetRect() ); } GetViewStart( &vx, &vy ); if ( vx || vy ) { refreshRect.x += vx; refreshRect.y += vy; } assert( painter == 0 ); painter = new DcPainter( &context ); doPaint(); delete painter; painter = 0; }
void customWindowLeft::recalculateComponentsSizes() { wxClientDC dc( this ); PrepareDC( dc ); m_parent->PrepareDC( dc ); m_config->widowLeftWidth = m_drawing->setHeaderWidth( dc ); m_drawing->setCellHeight( dc ); }
void wxListBox::DoDraw(wxControlRenderer *renderer) { // adjust the DC to account for scrolling wxDC& dc = renderer->GetDC(); PrepareDC(dc); dc.SetFont(GetFont()); // get the update rect wxRect rectUpdate = GetUpdateClientRect(); int yTop, yBottom; CalcUnscrolledPosition(0, rectUpdate.GetTop(), NULL, &yTop); CalcUnscrolledPosition(0, rectUpdate.GetBottom(), NULL, &yBottom); // get the items which must be redrawn wxCoord lineHeight = GetLineHeight(); size_t itemFirst = yTop / lineHeight, itemLast = (yBottom + lineHeight - 1) / lineHeight, itemMax = m_strings->GetCount(); if ( itemFirst >= itemMax ) return; if ( itemLast > itemMax ) itemLast = itemMax; // do draw them wxLogTrace(_T("listbox"), _T("Repainting items %d..%d"), itemFirst, itemLast); DoDrawRange(renderer, itemFirst, itemLast); }
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) { wxPaintDC dc( this ); PrepareDC( dc ); DrawShapes(dc); }
void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc); if (m_bitmap.Ok()) dc.DrawBitmap(m_bitmap, 0, 0, true); }
void wxsDrawingWindow::OnPaint(wxPaintEvent& event) { if ( !m_DuringFetch ) { wxPaintDC PaintDC(this); PrepareDC(PaintDC); if ( m_IsBlockFetch || NoNeedToRefetch() ) { if ( m_Bitmap ) { wxBitmap BmpCopy = m_Bitmap->GetSubBitmap(wxRect(0,0,m_Bitmap->GetWidth(),m_Bitmap->GetHeight())); wxBufferedDC DC(&PaintDC,BmpCopy); PaintExtra(&DC); } } else { StartFetchingSequence(); } } else { event.Skip(); } }
void wxBitmapComboPopupChild::OnMouse( wxMouseEvent &event ) { wxPoint mouse = event.GetPosition(); CalcUnscrolledPosition(mouse.x, mouse.y, &mouse.x, &mouse.y); //wxPrintf(wxT("bmpcombo mouse %d %d\n"), mouse.x, mouse.y); fflush(stdout); // Get selection from mouse pos, force valid int sel = m_bmpCombo->GetItemSize().y != 0 ? mouse.y/m_bmpCombo->GetItemSize().y : -1; if (sel < 0) sel = 0; else if (sel >= m_bmpCombo->GetCount()) sel = m_bmpCombo->GetCount()-1; if (event.LeftDown()) { // quickly show user what they selected before hiding it if (sel != m_last_selection) { wxClientDC dc(this); PrepareDC(dc); if (m_last_selection >= 0) DrawSelection(m_last_selection, dc); if (sel >= 0) DrawSelection(sel, dc); m_last_selection = sel; } m_bmpCombo->SetSelection(sel, true); m_bmpCombo->HidePopup(); return; } }
void PictureWindow::OnPaint(wxPaintEvent &event) { wxPaintDC dc(this); PrepareDC(dc); if(m_bitmap_set) { dc.DrawBitmap(m_bitmap, 0,0, false); } }
void csCanvas::OnDragLeft(bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys)) { wxClientDC dc(this); PrepareDC(dc); dc.SetLogicalFunction(OGLRBLF); DrawOutline(dc, sg_initialX, sg_initialY, x, y); }
void wxsDrawingWindow::FastRepaint() { wxClientDC ClientDC(this); PrepareDC(ClientDC); wxBitmap BmpCopy = m_Bitmap->GetSubBitmap(wxRect(0,0,m_Bitmap->GetWidth(),m_Bitmap->GetHeight())); wxBufferedDC DC(&ClientDC,BmpCopy); PaintExtra(&DC); }
void colorPatternArea::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc); dc.SetBrush(wxBrush(*mPattern)); //dc.SetBrush(wxBrush(*wxRED)); dc.DrawRectangle(0, 0, mWidth, mHeight); //dc.DrawBitmap(*mPattern, 0, 0); }
void MainPanel::OnPaint(wxPaintEvent &event) { wxBufferedPaintDC pdc(this, m_bufferBitmap); wxDC &dc = pdc ; PrepareDC(dc); wxBitmap subBitmap = bgBitmap->GetSubBitmap(wxRect(0 + 145, 0 + 95, 1024 - 145, 768 - 95)); dc.DrawBitmap(subBitmap, 0, 0); }
void MyCanvas::OnPaint(wxPaintEvent &WXUNUSED(event)) { wxPaintDC pdc(this); wxDC &dc = pdc; PrepareDC(dc); m_owner->PrepareDC(dc); dc.SetBackgroundMode(m_owner->m_backgroundMode); dc.Clear(); }
void ecMemoryLayoutWindow::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); PrepareDC(dc); ecConfigToolDoc* pDoc = wxGetApp().GetConfigToolDoc(); if (pDoc == NULL) // no document so nothing to draw return; }
void CslPanelAboutImage::OnPaint(wxPaintEvent& event) { static const wxBitmap bmp = BitmapFromData(wxBITMAP_TYPE_PNG,csl_256_png); wxPaintDC dc(this); PrepareDC(dc); dc.DrawBitmap(bmp,0,0,true); event.Skip(); }
// Define the repainting behaviour void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc); if (myTree) { wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); dc.SetFont(font); myTree->Draw(dc); } }
void FancyTextPanel::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this); PrepareDC(dc); wxSize virtSize = GetVirtualSize(); dc.Clear(); dc.DrawRectangle(wxRect(wxPoint(0, 0), virtSize)); DrawCont(dc, m_print_continuity, wxRect(wxPoint(0, 0), virtSize), m_landscape); }
void csCanvas::OnBeginDragLeft(double x, double y, int WXUNUSED(keys)) { sg_initialX = x; sg_initialY = y; wxClientDC dc(this); PrepareDC(dc); dc.SetLogicalFunction(OGLRBLF); DrawOutline(dc, sg_initialX, sg_initialY, x, y); CaptureMouse(); }
void wxShapeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc); dc.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID)); dc.Clear(); if (GetDiagram()) GetDiagram()->Redraw(dc); }
void MyCanvas::OnMouseMotion(wxMouseEvent &event) { wxClientDC dc(this); PrepareDC(dc); m_owner->PrepareDC(dc); wxPoint pos = event.GetPosition(); long x = dc.DeviceToLogicalX(pos.x); long y = dc.DeviceToLogicalY(pos.y); wxString str; str.Printf(wxT("Current mouse position: %d,%d"), (int)x, (int)y); m_owner->SetStatusText(str); }