当前位置: 首页>>代码示例>>C++>>正文


C++ wxDC::SetClippingRegion方法代码示例

本文整理汇总了C++中wxDC::SetClippingRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::SetClippingRegion方法的具体用法?C++ wxDC::SetClippingRegion怎么用?C++ wxDC::SetClippingRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxDC的用法示例。


在下文中一共展示了wxDC::SetClippingRegion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawFieldText

void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;

    wxRect rect;
    GetFieldRect(i, rect);

    if ( !IsWindowHilited( MAC_WXHWND( MacGetRootWindow() ) ) )
    {
        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
    }

    wxString text(GetStatusText(i));

    long x, y;

    dc.GetTextExtent(text, &x, &y);

    int xpos = rect.x + leftMargin + 1 ;
    int ypos = 1 ;

    dc.SetClippingRegion(rect.x, 0, rect.width, m_height);

    dc.DrawText(text, xpos, ypos);

    dc.DestroyClippingRegion();
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:27,代码来源:statbrma.cpp

示例2: PaintLabels

void AudioDisplay::PaintLabels(wxDC &dc, TimeRange updtime)
{
	std::vector<AudioLabelProvider::AudioLabel> labels;
	controller->GetTimingController()->GetLabels(updtime, labels);
	if (labels.empty()) return;

	wxDCFontChanger fc(dc);
	wxFont font = dc.GetFont();
	font.SetWeight(wxFONTWEIGHT_BOLD);
	dc.SetFont(font);
	dc.SetTextForeground(*wxWHITE);
	for (auto const& label : labels)
	{
		wxSize extent = dc.GetTextExtent(label.text);
		int left = RelativeXFromTime(label.range.begin());
		int width = AbsoluteXFromTime(label.range.length());

		// If it doesn't fit, truncate
		if (width < extent.GetWidth())
		{
			dc.SetClippingRegion(left, audio_top + 4, width, extent.GetHeight());
			dc.DrawText(label.text, left, audio_top + 4);
			dc.DestroyClippingRegion();
		}
		// Otherwise center in the range
		else
		{
			dc.DrawText(label.text, left + (width - extent.GetWidth()) / 2, audio_top + 4);
		}
	}
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:31,代码来源:audio_display.cpp

示例3: DrawFieldText

void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
{
    int leftMargin = 2;
    int w, h ;
    GetSize( &w , &h ) ;
    wxRect rect;
    GetFieldRect(i, rect);
    
    if ( !MacIsReallyHilited()  )
    {
        dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
    }
    
    wxString text(GetStatusText(i));
    
    long x, y;
    
    dc.GetTextExtent(text, &x, &y);
    
    int xpos = rect.x + leftMargin + 1 ;
    int ypos = 1 ;
    
    if ( MacGetTopLevelWindow()->MacGetMetalAppearance()  )
        ypos++ ;
        
    dc.SetClippingRegion(rect.x, 0, rect.width, h);
    
    dc.DrawText(text, xpos, ypos);
    
    dc.DestroyClippingRegion();
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:31,代码来源:statbrma.cpp

示例4: DrawFieldText

void wxStatusBarGeneric::DrawFieldText(wxDC& dc, int i)
{
  int leftMargin = 2;

  wxRect rect;
  GetFieldRect(i, rect);

  wxString text(GetStatusText(i));

  long x, y;

  dc.GetTextExtent(text, &x, &y);

  int xpos = rect.x + leftMargin;
  int ypos = (int) (((rect.height - y) / 2 ) + rect.y + 0.5) ;

#if defined( __WXGTK__ ) || defined(__WXMAC__)
  xpos++;
  ypos++;
#endif

  dc.SetClippingRegion(rect.x, rect.y, rect.width, rect.height);

  dc.DrawText(text, xpos, ypos);

  dc.DestroyClippingRegion();
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:27,代码来源:statusbr.cpp

示例5: OneRegion

void ClippingBoxTestCaseBase::OneRegion()
{
    // Setting one clipping box inside DC area.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(10, 20, 80, 75);
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:8,代码来源:clippingbox.cpp

示例6: OneRegionNegDim

void ClippingBoxTestCaseBase::OneRegionNegDim()
{
    // Setting one clipping box with negative sizes values.
    // Final clipping box should have standard positive size values.
    m_dc->SetClippingRegion(10, 20, -80, -75);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 11, 21);
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:9,代码来源:clippingbox.cpp

示例7: OneOuterRegion

void ClippingBoxTestCaseBase::OneOuterRegion()
{
    // Setting one clipping box entirely outside DC surface.
    // Final clipping box should be empty.
    m_dc->SetClippingRegion(-100, -80, 20, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 0, 0);
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:9,代码来源:clippingbox.cpp

示例8: OneLargeRegion

void ClippingBoxTestCaseBase::OneLargeRegion()
{
    // Setting one clipping box larger then DC surface.
    // Final clipping box should be limited to the DC extents.
    m_dc->SetClippingRegion(-10, -20,
                         s_dcSize.GetWidth()+30, s_dcSize.GetHeight()+50);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:10,代码来源:clippingbox.cpp

示例9: TwoRegionsNonOverlapping

void ClippingBoxTestCaseBase::TwoRegionsNonOverlapping()
{
    // Setting one clipping box and next another box (non-overlapping).
    // Final clipping box should be empty.
    m_dc->SetClippingRegion(10, 20, 30, 30);
    m_dc->SetClippingRegion(50, 60, 50, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, 0, 0);
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:10,代码来源:clippingbox.cpp

示例10: OneRegionAndReset

void ClippingBoxTestCaseBase::OneRegionAndReset()
{
    // Setting one clipping box and next destroy it.
    // Final clipping box should be the same as DC surface.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->DestroyClippingRegion();
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:10,代码来源:clippingbox.cpp

示例11: TwoRegionsOverlapping

void ClippingBoxTestCaseBase::TwoRegionsOverlapping()
{
    // Setting one clipping box and next another box (partially overlapping).
    // Final clipping box should be an intersection of these two boxes.
    m_dc->SetClippingRegion(10, 20, 80, 75);
    m_dc->SetClippingRegion(50, 60, 50, 40);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(50, 60, 40, 35);
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:10,代码来源:clippingbox.cpp

示例12: DoProgressDrawing

/* paints the progress bar */
void CBOINCGridCellProgressRenderer::DoProgressDrawing(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rectCell, int row, int col, bool isSelected) {
    wxRect rect = rectCell;
    rect.Inflate(-1);

    // erase only this cells background, overflow cells should have been erased
	this->DrawBackground(grid, dc, rectCell, row, isSelected);
	// set text attributes
    int hAlign, vAlign;
	attr.GetAlignment(&hAlign, &vAlign);
    SetTextColoursAndFont(grid, attr, dc, isSelected);

	//calculate the two parts of the progress rect
    //
	double dv = 0.0;
	wxString strValue = grid.GetCellValue(row,col);
	if(m_bDoPercentAppending) {
		strValue = strValue + wxT(" %");
	}

    // Project view uses the format:  %0.0f (%0.2f%%)
    // Everyone else uses: %.3f%%
    if (strValue.Find(wxT("(")) != wxNOT_FOUND) {
        strValue.SubString(strValue.Find(wxT("(")) + 1, strValue.Find(wxT(")")) - 1).ToDouble( &dv );
    } else {
    	strValue.ToDouble ( &dv );	 // NOTE: we should do error-checking/reporting here!!
    }


	wxRect p1(rect);
	wxRect p2(rect);
	int r = (int)((rect.GetRight()-rect.GetLeft())*dv / 100.0);
	p1.SetRight(rect.GetLeft()+r);
	p2.SetLeft(rect.GetLeft()+r+1);
	p2.SetRight(rect.GetRight()-1);
	//start drawing
	dc.SetClippingRegion(rect);
	wxBrush old = dc.GetBrush();
	wxColour progressColour = wxTheColourDatabase->Find(wxT("LIGHT BLUE"));
	wxBrush* progressBrush = wxTheBrushList->FindOrCreateBrush(progressColour);
	wxPen* progressPen = wxThePenList->FindOrCreatePen(progressColour,1,wxSOLID);
	//draw the outline rectangle
	dc.SetBrush(*wxTRANSPARENT_BRUSH);
	dc.SetPen(*progressPen);
	dc.DrawRectangle(rect);
	// Draw the left part
	dc.SetBrush(*progressBrush);
	dc.DrawRectangle(p1);
	//draw the right part
	dc.SetBrush(old);
	dc.DrawRectangle(p2);
	//
	dc.DestroyClippingRegion();
	// draw the text
	grid.DrawTextRectangle(dc, strValue, rect, hAlign, vAlign);
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:56,代码来源:BOINCGridCtrl.cpp

示例13: DoPaint

void SplashScreen::DoPaint( wxDC &dc )
{
    static const wxString release = "release";
    static const wxString revision = "revision";

#ifdef __WIN32__
    dc.SetClippingRegion( r );
#endif

    dc.DrawBitmap( m_label, 0, 0, false );
}
开发者ID:HaoDrang,项目名称:GD,代码行数:11,代码来源:SplashScreen.cpp

示例14: Draw

void wxSheetCellBitmapRendererRefData::Draw(wxSheet& sheet,
        const wxSheetCellAttr& attr,
        wxDC& dc, const wxRect& rect_,
        const wxSheetCoords& coords,
        bool isSelected)
{
    wxSheetCellRendererRefData::Draw(sheet, attr, dc, rect_, coords, isSelected);

    wxRect rect(rect_);

    wxSize bmpSize;
    if (m_bitmap.Ok())
    {
        bmpSize.x = m_bitmap.GetWidth();
        bmpSize.y = m_bitmap.GetHeight();
    }

    wxSize txtSize(wxSheetCellStringRendererRefData::GetBestSize(sheet, attr, dc, coords));

    if ((txtSize.x == 0) && (bmpSize.x == 0))
        return;

    int margin = 2;

    if ((txtSize.x == 0) || (bmpSize.x == 0))
        margin = 0;


    int txt_align = attr.GetAlignment();
    int bmp_align = m_align;
    wxRect bmpRect(wxPoint(0,0), bmpSize);
    wxRect txtRect(wxPoint(0,0), txtSize);
    if (txtSize.x > 0) txtRect.Inflate(1);
    rect.Inflate(-1);
    AlignBmpTextRects(rect, bmp_align, txt_align, margin, bmpRect, txtRect);
    rect.Inflate(1);

    //dc.SetBrush(*wxTRANSPARENT_BRUSH);
    //dc.SetPen(*wxRED_PEN);
    //dc.DrawRectangle(txtRect);
    //dc.SetPen(*wxGREEN_PEN);
    //dc.DrawRectangle(bmpRect);

    if ((txtRect.width > 0) && (txtRect.height > 0))
        wxSheetCellStringRendererRefData::DoDraw(sheet, attr, dc, txtRect, coords, isSelected);

    if (m_bitmap.Ok() && (bmpRect.width > 0) && (bmpRect.height > 0))
    {
        dc.SetClippingRegion(rect);
        bmpRect.SetPosition(wxSheet::AlignInRect(m_align, bmpRect, bmpSize));
        dc.DrawBitmap(m_bitmap, bmpRect.x, bmpRect.y, true);
        dc.DestroyClippingRegion();
    }
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:54,代码来源:sheetren.cpp

示例15: EraseShape

void MyCanvas::EraseShape(DragShape* shape, wxDC& dc)
{
    wxSize sz = GetClientSize();
    wxRect rect(0, 0, sz.x, sz.y);

    wxRect rect2(shape->GetRect());
    dc.SetClippingRegion(rect2.x, rect2.y, rect2.width, rect2.height);

    wxGetApp().TileBitmap(rect, dc, wxGetApp().GetBackgroundBitmap());

    dc.DestroyClippingRegion();
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:12,代码来源:dragimag.cpp


注:本文中的wxDC::SetClippingRegion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。