void wxPseudoDC::DrawToDCClippedRgn(wxDC *dc, const wxRegion& region) { pdcObjectList::Node *pt = m_objectlist.GetFirst(); pdcObject *obj; while (pt) { obj = pt->GetData(); if (!obj->IsBounded() || (region.Contains(obj->GetBounds()) != wxOutRegion)) obj->DrawToDC(dc); pt = pt->GetNext(); } }
void WxGraphs::DrawWindowInfo(wxDC * dc, const wxRegion & repainted_region) { if (repainted_region.IsEmpty()) return; int info_left_marg = m_screen_margins.leftmargin + 8; int param_name_shift = 5; if (m_draws.size() < 1) return; int w, h; dc->GetSize(&w, &h); DrawInfo *info = m_draws[0]->GetDrawInfo(); wxString name = info->GetSetName().c_str(); int namew, nameh; dc->GetTextExtent(name, &namew, &nameh); if (repainted_region.Contains(info_left_marg, m_screen_margins.infotopmargin, w - m_screen_margins.infotopmargin, nameh) == wxOutRegion) return; dc->SetTextForeground(*wxWHITE); dc->DrawText(name, info_left_marg, m_screen_margins.infotopmargin); wxColor color = dc->GetTextForeground(); int xpos = info_left_marg + namew + param_name_shift; for (int i = 0; i < (int)m_draws.size(); ++i) { if (!m_draws[i]->GetEnable()) continue; DrawInfo *info = m_draws[i]->GetDrawInfo(); dc->SetTextForeground(info->GetDrawColor()); name = info->GetShortName().c_str(); dc->GetTextExtent(name, &namew, &nameh); dc->DrawText(name, xpos, m_screen_margins.infotopmargin); xpos += namew + param_name_shift; } dc->SetTextForeground(color); }
void wxIFMComponent::Paint(wxDC &dc, const wxRegion ®ion) { // get component rect first wxRect rect = m_rect; // set clipping region of DC dc.DestroyClippingRegion(); dc.SetClippingRegion(region); // paint background first wxIFMPaintEvent bgevt(wxEVT_IFM_PAINTBG, this, region, dc); m_ip->ProcessPluginEvent(bgevt); // paint border second wxIFMPaintEvent bdevt(wxEVT_IFM_PAINTBORDER, this, region, dc); m_ip->ProcessPluginEvent(bdevt); // paint decorations last wxIFMPaintEvent dcevt(wxEVT_IFM_PAINTDECOR, this, region, dc); m_ip->ProcessPluginEvent(dcevt); // recursively paint children of this component for( size_t i = 0; i < m_children.GetCount(); i++ ) //for( wxIFMComponentArray::const_iterator i = m_children.begin(), end = m_children.end(); i != end; ++i ) { //wxIFMComponent *child = *i; wxIFMComponent *child = m_children[i]; // only paint the child if needed if( child->IsVisible() ) { wxRegionContain result = region.Contains(child->m_rect); if( result == wxPartRegion || result == wxInRegion ) { //wxRegion new_region = region; //new_region.Intersect(child->m_rect); child->Paint(dc, region); } } } }