コード例 #1
0
void wxCodeCompletionBox::DoDrawBottomScrollButton(wxDC& dc)
{
    wxRect scrollRect = m_scrollArea;
    scrollRect.Deflate(0, 2);
    scrollRect.SetWidth(scrollRect.GetWidth() - 2);

    // Separate the scrollbar area into 2 big buttons: up and down
    m_scrollBottomRect =
        wxRect(wxPoint(scrollRect.GetTopLeft().x, scrollRect.GetTopLeft().y + scrollRect.GetHeight() / 2),
               wxSize(scrollRect.GetWidth(), scrollRect.GetHeight() / 2));
#if 0
    wxPoint topRight;
    topRight = m_scrollBottomRect.GetTopRight();
    topRight.x += 1;

    dc.SetPen(m_lightBorder);
    dc.DrawLine(m_scrollBottomRect.GetTopLeft(), topRight);
#endif

    // Draw the up arrow
    wxCoord x, y;
    x = m_scrollBottomRect.x + ((m_scrollBottomRect.GetWidth() - m_bmpDown.GetWidth()) / 2);
    y = m_scrollBottomRect.y + m_scrollBottomRect.GetHeight() - (2 * m_bmpDown.GetHeight());

    wxBitmap bmp = CanScrollDown() ? m_bmpDownEnabled : m_bmpDown;
    dc.DrawBitmap(bmp, x, y);
}
コード例 #2
0
void wxCodeCompletionBox::DoDrawTopScrollButton(wxDC& dc)
{
    wxRect scrollRect = m_scrollArea;
    scrollRect.Deflate(0, 2);
    scrollRect.SetWidth(scrollRect.GetWidth() - 2);

    // Separate the scrollbar area into 2 big buttons: up and down
    m_scrollTopRect = wxRect(scrollRect.GetTopLeft(), wxSize(scrollRect.GetWidth(), scrollRect.GetHeight() / 2));
#if 0
    wxPoint bottomRight;
    bottomRight = m_scrollTopRect.GetBottomRight();
    bottomRight.x += 1;

    dc.SetPen(m_darkBorder);
    dc.DrawLine(m_scrollTopRect.GetBottomLeft(), bottomRight);
#endif

    // Draw the up arrow
    wxCoord x, y;
    x = m_scrollTopRect.x + ((m_scrollTopRect.GetWidth() - m_bmpUp.GetWidth()) / 2);
    y = m_scrollTopRect.y + m_bmpUp.GetHeight();

    wxBitmap bmp = CanScrollUp() ? m_bmpUpEnabled : m_bmpUp;
    dc.DrawBitmap(bmp, x, y);
}
コード例 #3
0
ファイル: audio_display.cpp プロジェクト: Gpower2/Aegisub
void AudioDisplay::PaintMarkers(wxDC &dc, TimeRange updtime)
{
	AudioMarkerVector markers;
	controller->GetTimingController()->GetMarkers(updtime, markers);
	if (markers.empty()) return;

	wxDCPenChanger pen_retainer(dc, wxPen());
	wxDCBrushChanger brush_retainer(dc, wxBrush());
	for (const auto marker : markers)
	{
		int marker_x = RelativeXFromTime(marker->GetPosition());

		dc.SetPen(marker->GetStyle());
		dc.DrawLine(marker_x, audio_top, marker_x, audio_top+audio_height);

		if (marker->GetFeet() == AudioMarker::Feet_None) continue;

		dc.SetBrush(wxBrush(marker->GetStyle().GetColour()));
		dc.SetPen(*wxTRANSPARENT_PEN);

		if (marker->GetFeet() & AudioMarker::Feet_Left)
			PaintFoot(dc, marker_x, -1);
		if (marker->GetFeet() & AudioMarker::Feet_Right)
			PaintFoot(dc, marker_x, 1);
	}
}
コード例 #4
0
ファイル: art_metro.cpp プロジェクト: 05storm26/codelite
void wxRibbonMetroArtProvider::DrawPanelBorder(wxDC& dc, const wxRect& rect,
                                             wxPen& primary_colour,
                                             wxPen& secondary_colour)
{
		dc.SetPen(m_panel_border_pen);
		dc.DrawLine(rect.GetTopRight(), rect.GetBottomRight());
}
コード例 #5
0
ファイル: instancectrl.cpp プロジェクト: Glought/MultiMC4
void GroupVisual::Draw ( wxDC& dc, InstanceCtrl* parent, wxRect limitingRect, bool hasSelection, int selectionIndex, bool hasFocus, int focusIndex, bool highlight )
{
	int i;
	int count = items.size();
	int style = 0;
	wxRect rect;
	
	// Draw the header
	if(!no_header)
	{
		wxColour textColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);

		if (highlight)
		{
			textColor = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
		}

		wxBrush brush(textColor);
		wxPen pen(textColor);
		dc.SetBrush(brush);
		dc.SetPen(pen);
		wxSize sz = dc.GetTextExtent(GetName());
		dc.SetTextForeground(textColor);
		
		dc.DrawText( GetName() , 20, y_position + 5 );
		int atheight = y_position + header_height / 2;
		if(sz.x + 30 < limitingRect.width - 10)
			dc.DrawLine(sz.x + 30,atheight, limitingRect.width - 10, atheight);
		
		dc.SetBrush(*wxTRANSPARENT_BRUSH);
		dc.SetPen(textColor);
		
		// Ungrouped can't be hidden, so don't draw the box.
		if (m_group)
		{
			dc.DrawRectangle(5,atheight -5, 10,10);
			dc.DrawRectangle(7,atheight -1, 6,2);
			if(!IsExpanded())
			{
				dc.DrawRectangle(9,atheight -3, 2,6);
			}
		}
	}
	
	if(IsExpanded()) for (i = 0; i < count; i++)
	{
		parent->GetItemRect(VisualCoord(index,i), rect, false);

		if (!limitingRect.Intersects(rect))
			continue;
		style = 0;
		if (hasSelection && selectionIndex == i)
			style |= wxINST_SELECTED;
		if (hasFocus && i == focusIndex)
			style |= wxINST_IS_FOCUS;

		InstanceVisual& item = items[i];
		item.Draw(dc, parent, rect, style);
	}
}
コード例 #6
0
void wxGridCellIconRenderer::Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
	const wxRect& rectCell, int row, int col, bool isSelected)
{
	wxGridCellRenderer::Draw(grid, attr, dc, rectCell, row, col, isSelected);
	const char** psz=NULL;
// 	if (grid.GetCellValue(row, col) == wxT("IDI_PC"))
// 		psz = szIconPC;
// 	else psz = szIconNomad;
	wxIcon icon(psz);
	icon.SetHeight(16);
	icon.SetWidth(16);
//	wxColour colourBackGround = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE);
//	dc.SetBrush(wxBrush(colourBackGround, wxSOLID));
//	dc.SetPen(wxPen(colourBackGround, 1, wxSOLID));
//	dc.DrawRectangle(rectCell);
	int nMargin = (rectCell.GetHeight() - icon.GetHeight()) /2;
	if (nMargin < 0) nMargin = 0;
	dc.DrawIcon(icon, rectCell.x, rectCell.y+nMargin);
	if (m_border == wxLAYOUT_TOP)
	{
		dc.SetPen(wxPen(*wxBLACK, 1, wxDOT));
		dc.DrawLine(rectCell.GetRight(), rectCell.GetTop(), 
			rectCell.GetLeft(), rectCell.GetTop());
	}
//	dc.DrawIcon(icon, 16, 0);
}
コード例 #7
0
void SeqABI::drawTopLine ( wxDC &dc , int y )
    {
    wxPen p = dc.GetPen () ;
    dc.SetPen(*wxLIGHT_GREY_PEN);
    dc.DrawLine ( 4 , y , minx + maxx , y ) ;
    dc.SetPen(p);
    }
コード例 #8
0
ファイル: CustomGrid.cpp プロジェクト: OpenCPN/OpenCPN
void CustomGrid::DrawRowLabel( wxDC& dc, int row )
{
    //init dc font and colours
    dc.SetFont( m_labelFont );
    dc.SetPen(GetDefaultGridLinePen());
	dc.SetBrush( wxBrush( m_labelBackgroundColour, wxBRUSHSTYLE_SOLID ) );
    int w = dc.GetTextExtent(_T("Speed")).x;
    wxString label1,label2;
    label1 = GetRowLabelValue(row).BeforeFirst(',', &label2);
    bool pline = true;
    //row is the first of 3 for the same parameter (wind ... waves ...)
    if(GetNumberRows() > row + 2 && label1 == GetRowLabelValue(row + 2).BeforeFirst(',')){
        pline = false;
        if(IsRowVisible(row + 2))
            label1 = _T(" ");
    }
    //row is the second of 3 or the first of 2
    else if(GetNumberRows() > row + 1 && label1 == GetRowLabelValue(row + 1).BeforeFirst(',')){
        pline = false;
        if(row > 0 && label1 == GetRowLabelValue(row - 1).BeforeFirst(',')){    //second of 3
            if(!IsRowVisible(row + 1))
                label1 = _T(" ");
        }
    }
    //row is the last of 3
    else if(row > 1 && label1 == GetRowLabelValue(row - 2).BeforeFirst(',')){
        if(IsRowVisible(row - 1))
            label1 = _T(" ");
    }
    //row is the last of 2
    else if(row > 0 && label1 == GetRowLabelValue(row - 1).BeforeFirst(',')){
        if(IsRowVisible(row - 1))
            label1 = _T(" ");
    }
    //draw first part of the label
    wxRect aRect(5, GetRowTop(row), m_rowLabelWidth - w, GetRowHeight(row));
    dc.DrawLabel(label1, aRect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
    //draw second part of the label
    wxRect bRect(m_rowLabelWidth - w, GetRowTop(row), w, GetRowHeight(row));
    dc.SetFont( wxFont(m_labelFont).Scale(0.85) );
    dc.DrawLabel(label2 , bRect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
    //draw row lines around labels
    if(pline)
        dc.DrawLine(0, GetRowBottom(row) - 1, m_rowLabelWidth, GetRowBottom(row) - 1);
    dc.DrawLine(0, GetRowTop(row), 0, GetRowBottom(row) );
    dc.DrawLine(m_rowLabelWidth - 1, GetRowTop(row), m_rowLabelWidth - 1, GetRowBottom(row) );
}
コード例 #9
0
void Plotter::draw_key(wxDC& dc){

	// if no data, don't draw tic marks
	if( this->values.size() == 0 )
		return;

	int x0 = this->panel_width - this->margin_x - 100;
	int y0 = this->margin_y_upper + 10;

	if( this->key_location==KEY_UPPER_RIGHT){
		x0 = this->panel_width - this->margin_x - 100;
		y0 = this->margin_y_upper + 10;
	}
	else if(this->key_location==KEY_UPPER_LEFT){
		x0 = this->margin_x + 50;
		y0 = this->margin_y_upper + 10;
	}
	else if(this->key_location==KEY_LOWER_RIGHT){
		x0 = this->panel_width - this->margin_x - 100;
		y0 = this->panel_height - this->margin_y_lower - 100;
	}
	else if(this->key_location==KEY_LOWER_LEFT){
		x0 = this->margin_x + 50;
		y0 = this->panel_height - this->margin_y_lower - 100;
	}

	int y_cur = y0;
	dc.SetFont(wxFont(8,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD));
	for(int i=0; i<(int)this->value_labels.size(); i++){
		dc.DrawText( wxString::FromAscii(this->value_labels.at(i).c_str()), x0, y_cur);
		wxPen pen(*this->colors.at( i % (int)this->colors.size() ));
		pen.SetWidth(6);
		dc.SetPen(pen);
		if(i>=(int)this->colors.size()){
			pen.SetWidth(3);
			dc.DrawLine(x0-15, y_cur+5, x0-14, y_cur+5);
			dc.DrawLine(x0-7,y_cur+5, x0-5, y_cur+5);
		}
		else
			dc.DrawLine(x0-15, y_cur+5, x0-5, y_cur+5);
		y_cur += 10;
	}
	wxPen pen(*wxBLACK_PEN);
	dc.SetBrush(*wxTRANSPARENT_BRUSH);
	dc.SetPen(pen);
	dc.DrawRectangle(x0-25, y0-5, 150, y_cur - y0 + 10 );
}
コード例 #10
0
ファイル: slider.cpp プロジェクト: jhoggart/rt-tuner
//Disegna i tag impostati
void kwxLinearReg::DrawTags(wxDC &dc)
{	
	int ntag = 0 ;
	int w, h ;
	int tw,th;
	int scalval = 0 ;
	double tcoeff ;

	wxString text ;

	if(m_aTagsVal==NULL)
		return;
	GetClientSize(&w,&h);
	if((!(m_iStyle&STYLE_VERTICAL)))
		tcoeff = (w - 2) / (double)(m_iMax - m_iMin);
	else
		tcoeff = (h - 2) / (double)(m_iMax - m_iMin);

	dc.SetPen(*wxThePenList->FindOrCreatePen(m_cTagsColour, 1, wxSOLID));
	dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_cTagsColour,wxSOLID));
	dc.SetTextForeground(m_cTagsColour);

	while (ntag < m_iTagsCount)
	{
		scalval = (int)floor((m_aTagsVal[ ntag] - m_iMin) * tcoeff);// \todo: need floor ?
		text.Printf("%d", m_aTagsVal[ ntag]) ;		
		
		if(m_iStyle & STYLE_VERTICAL)
		{
			dc.DrawLine(w - 2, h - scalval , w - TAGS_LENGTH , h - scalval);
			if(m_iStyle & STYLE_DRAW_TAG_NUMBERS){
				dc.GetTextExtent(text, &tw, &th);
				dc.DrawText(text, w - TAGS_LENGTH - tw, h - scalval - (th / 2) );
			}
		}
		else
		{
			dc.DrawLine(scalval + 1, h - 2 , scalval + 1, h - TAGS_LENGTH);
			if(m_iStyle & STYLE_DRAW_TAG_NUMBERS){
				dc.GetTextExtent(text, &tw, &th);
				dc.DrawText(text, scalval + 1 - (tw / 2 ), h - TAGS_LENGTH - th);
			}
		}
		ntag++ ;
	}
}
コード例 #11
0
ファイル: statuslinectrl.cpp プロジェクト: idgaf/FileZilla3
void CStatusLineCtrl::DrawProgressBar(wxDC& dc, int x, int y, int height, int bar_split, int permill)
{
	wxASSERT(bar_split != -1);
	wxASSERT(permill != -1);

	// Draw right part
	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
	dc.DrawRectangle(x + 1 + bar_split, y + 1, PROGRESSBAR_WIDTH - bar_split - 1, height - 2);

	if (bar_split && height > 2)
	{
		// Draw pretty gradient

		int greenmin = 128;
		int greenmax = 255;
		int colourCount = ((height + 1) / 2);

		for (int i = 0; i < colourCount; i++)
		{
			int curGreen = greenmax - ((greenmax - greenmin) * i / (colourCount - 1));
			dc.SetPen(wxPen(wxColour(0, curGreen, 0)));
			dc.DrawLine(x + 1, y + colourCount - i, x + 1 + bar_split, y + colourCount - i);
			dc.DrawLine(x + 1, y + height - colourCount + i - 1, x + 1 + bar_split, y + height - colourCount + i - 1);
		}
	}

	dc.SetPen(*wxBLACK_PEN);
	dc.SetBrush(*wxTRANSPARENT_BRUSH);
	dc.DrawRectangle(x, y, PROGRESSBAR_WIDTH, height);

	// Draw percentage-done text
	wxString prefix;
	if( permill > 1000)
	{
		prefix = _T("> ");
		permill = 1000;
	}
	
	wxString text = wxString::Format(_T("%s%d.%d%%"), prefix.c_str(), permill / 10, permill % 10);

	wxCoord w, h;
	dc.GetTextExtent(text, &w, &h);
	dc.DrawText(text, x + PROGRESSBAR_WIDTH / 2 - w / 2, y + height / 2 - h / 2);
}
コード例 #12
0
ファイル: AColor.cpp プロジェクト: Avi2011class/audacity
//
// Draw a line while accounting for differences in wxWidgets versions
//
void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
   // As of 2.8.9 (possibly earlier), wxDC::DrawLine() on the Mac draws the
   // last point since it is now based on the NEW wxGraphicsContext system.
   // Make the other platforms do the same thing since the other platforms
   // "may" follow they get wxGraphicsContext going.
#if defined(__WXMAC__) || defined(__WXGTK3__)
   dc.DrawLine(x1, y1, x2, y2);
#else
   bool point = false;

   if (x1 == x2) {
      if (y1 < y2) {
         y2++;
      }
      else if (y2 < y1) {
         y1++;
      }
      else {
         point = true;
      }
   }
   else if (y1 == y2) {
      if (x1 < x2) {
         x2++;
      }
      else if (x2 < x1) {
         x1++;
      }
      else {
         point = true;
      }
   }
   else {
      dc.DrawPoint(x2, y2);
   }

   if (point) {
      dc.DrawPoint(x2, y2);
   }
   else {
      dc.DrawLine(x1, y1, x2, y2);
   }
#endif
}
コード例 #13
0
ファイル: TestScrollWinView.cpp プロジェクト: LreeLenn/geoda
void TestScrollWinCanvas::PaintShapes(wxDC& dc)
{
	TemplateCanvas::PaintShapes(dc);
	dc.SetPen(*wxBLACK_PEN);
	dc.SetBrush(*wxRED_BRUSH);
	dc.SetTextForeground(*wxBLACK);
	dc.SetTextBackground(wxTransparentColor); // new const in wxWidgets 2.9.1
	dc.SetFont(*wxSMALL_FONT);
	int y=10;
	int dy=20;
	int i=0;
	dc.DrawLine(30,30, 250,15);
	dc.DrawText("*wxSMALL_FONT", 10, y+(dy*i++));
	dc.SetFont(*wxNORMAL_FONT);
	dc.DrawText("*wxNORMAL_FONT", 10, y+(dy*i++));
	dc.SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_VAR_FONT));
	dc.DrawText("GetFont(wxSYS_ANSI_VAR_FONT)", 10, y+(dy*i++));
	dc.SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
	dc.DrawText("GetFont(wxSYS_SYSTEM_FONT)", 10, y+(dy*i++));
	wxFont f1(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f1);
	dc.DrawText("8, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f1_1(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f1_1);
	dc.DrawText("9, wxFONTFAMILY_SWISS", 10, y+(dy*i++));	
	wxFont f2(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f2);
	dc.DrawText("10, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f3(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f3);
	dc.DrawText("11, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f4(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f4);
	dc.DrawText("12, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	wxFont f5(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
	dc.SetFont(f5);
	dc.DrawText("14, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPointSize(16);
	dc.SetFont(f5);
	dc.DrawText("16, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPixelSize(wxSize(0,15));
	dc.SetFont(f5);
	dc.DrawText("SetPixelSize(0,15), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPixelSize(wxSize(0,10));
	dc.SetFont(f5);
	dc.DrawText("SetPixelSize(0,10), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	f5.SetPixelSize(wxSize(0,20));
	dc.SetFont(f5);
	dc.DrawText("SetPixelSize(0,20), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
	dc.SetFont(*GdaConst::small_font);
	dc.DrawText("*GdaConst::small_font", 10, y+(dy*i++));
	dc.SetFont(*GdaConst::medium_font);
	dc.DrawText("*GdaConst::medium_font", 10, y+(dy*i++));
	dc.SetTextForeground(GdaConst::selectable_fill_color);
	dc.SetFont(*GdaConst::large_font);
	dc.DrawText("*GdaConst::large_font", 10, y+(dy*i++));
}
コード例 #14
0
ファイル: tableview.cpp プロジェクト: Mileslee/wxgis
void wxGridCtrl::DrawRowLabel(wxDC& dc, int row)
{
    if (GetRowHeight(row) <= 0 || m_rowLabelWidth <= 0)
        return;
    wxRect rect;
    int rowTop = GetRowTop(row), rowBottom = GetRowBottom(row) - 1;
    dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID));
    dc.DrawLine(m_rowLabelWidth - 1, rowTop, m_rowLabelWidth - 1, rowBottom);
    dc.DrawLine(0, rowTop, 0, rowBottom);
    dc.DrawLine(0, rowBottom, m_rowLabelWidth, rowBottom);
    dc.SetPen(*wxWHITE_PEN);
    dc.DrawLine(1, rowTop, 1, rowBottom);
    dc.DrawLine(1, rowTop, m_rowLabelWidth - 1, rowTop);
    if (row == GetGridCursorRow())
	{
		dc.DrawBitmap(wxBitmap(small_arrow_xpm), 0, GetRowTop(row), true);
    }
}
コード例 #15
0
void clTabRendererClassic::FinaliseBackground(wxWindow* parent, wxDC& dc, const wxRect& clientRect,
                                              const clTabColours& colours, size_t style)
{
    wxUnusedVar(parent);
    clTabColours c = colours;
    if(DrawingUtils::IsDark(c.activeTabBgColour)) {
        InitDarkColours(c, c.activeTabBgColour);
    } else {
        InitLightColours(c, c.activeTabBgColour);
    }

    dc.SetPen(c.activeTabPenColour);
    if(style & kNotebook_BottomTabs) {
        dc.DrawLine(clientRect.GetTopLeft(), clientRect.GetTopRight());
    } else {
        dc.DrawLine(clientRect.GetBottomLeft(), clientRect.GetBottomRight());
    }
}
コード例 #16
0
//---------------------------------------------------------
void CWKSP_Shapes::Edit_Shape_Draw_Move(wxDC &dc, const CSG_Rect &rWorld, const wxPoint &Point, const TSG_Point &ptWorld)
{
	double	ClientToWorld	= rWorld.Get_XRange() / (double)dc.GetSize().x;

	dc.DrawLine(Point.x, Point.y,
		(int)((ptWorld.x - rWorld.Get_XMin()) / ClientToWorld),
		(int)((rWorld.Get_YMax() - ptWorld.y) / ClientToWorld)
	);
}
コード例 #17
0
ファイル: stdrend.cpp プロジェクト: czxxjtu/wxPython-1
void wxStdRenderer::DrawShadedRect(wxDC& dc, wxRect *rect,
                                   const wxPen& pen1, const wxPen& pen2)
{
    // draw the rectangle
    dc.SetPen(pen1);
    dc.DrawLine(rect->GetLeft(), rect->GetTop(),
                rect->GetLeft(), rect->GetBottom());
    dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
                rect->GetRight(), rect->GetTop());
    dc.SetPen(pen2);
    dc.DrawLine(rect->GetRight(), rect->GetTop(),
                rect->GetRight(), rect->GetBottom());
    dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
                rect->GetRight() + 1, rect->GetBottom());

    // adjust the rect
    rect->Inflate(-1);
}
コード例 #18
0
ファイル: AColor.cpp プロジェクト: Kirushanr/audacity
void AColor::Bevel(wxDC & dc, bool up, wxRect & r)
{
   if (up)
      AColor::Light(&dc, false);
   else
      AColor::Dark(&dc, false);

   dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
   dc.DrawLine(r.x, r.y, r.x, r.y + r.height);

   if (!up)
      AColor::Light(&dc, false);
   else
      AColor::Dark(&dc, false);

   dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
   dc.DrawLine(r.x, r.y + r.height, r.x + r.width + 1, r.y + r.height);
}
コード例 #19
0
ファイル: NoteTrack.cpp プロジェクト: Kirushanr/audacity
void NoteTrack::DrawLabelControls(wxDC & dc, wxRect & r)
{
   int wid = 23;
   int ht = 16;

   if (r.height < ht * 4)
      return;

   int x = r.x + r.width / 2 - wid * 2;
   int y = r.y + 4;

   for (int row = 0; row < 4; row++)
      for (int col = 0; col < 4; col++) {
         int channel = row * 4 + col + 1;

         wxRect box;
         box.x = x + col * wid;
         box.y = y + row * ht;
         box.width = wid;
         box.height = ht;

         if (mVisibleChannels & (1 << (channel - 1))) {
            AColor::MIDIChannel(&dc, channel);
            dc.DrawRectangle(box);

            AColor::LightMIDIChannel(&dc, channel);
            dc.DrawLine(box.x, box.y, box.x + box.width - 1, box.y);
            dc.DrawLine(box.x, box.y, box.x, box.y + box.height - 1);

            AColor::DarkMIDIChannel(&dc, channel);
            dc.DrawLine(box.x + box.width - 1, box.y,
                        box.x + box.width - 1, box.y + box.height);
            dc.DrawLine(box.x, box.y + box.height - 1, box.x + box.width,
                        box.y + box.height - 1);
         } else {
            AColor::MIDIChannel(&dc, 0);
            dc.DrawRectangle(box);
         }

         dc.DrawText(wxString::Format(wxT("%d"), channel), box.x + 5,
                     box.y + 3);
      }

}
コード例 #20
0
ファイル: dockart.cpp プロジェクト: CodeTickler/wxWidgets
void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow* window, const wxRect& _rect,
                                     wxAuiPaneInfo& pane)
{
    dc.SetPen(m_borderPen);
    dc.SetBrush(*wxTRANSPARENT_BRUSH);

    wxRect rect = _rect;
    int i, border_width = GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE);

    if (pane.IsToolbar())
    {
        for (i = 0; i < border_width; ++i)
        {
            dc.SetPen(*wxWHITE_PEN);
            dc.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y);
            dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height);
            dc.SetPen(m_borderPen);
            dc.DrawLine(rect.x, rect.y+rect.height-1,
                        rect.x+rect.width, rect.y+rect.height-1);
            dc.DrawLine(rect.x+rect.width-1, rect.y,
                        rect.x+rect.width-1, rect.y+rect.height);
            rect.Deflate(1);
        }
    }
    else
    {
        // notebooks draw the border themselves, so they can use native rendering (e.g. tabartgtk)
        wxAuiTabArt* art = 0;
        wxAuiNotebook* nb = wxDynamicCast(window, wxAuiNotebook);
        if (nb)
            art = nb->GetArtProvider();

        if (art)
            art->DrawBorder(dc, window, rect);
        else
        {
            for (i = 0; i < border_width; ++i)
            {
                dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
                rect.Deflate(1);
            }
        }
    }
}
コード例 #21
0
ファイル: statusbr.cpp プロジェクト: 252525fb/rpcs3
void wxStatusBarGeneric::DrawField(wxDC& dc, int i)
{
    wxRect rect;
    GetFieldRect(i, rect);

    int style = wxSB_NORMAL;
    if (m_statusStyles)
        style = m_statusStyles[i];

    if (style != wxSB_FLAT)
    {
        // Draw border
        // For wxSB_NORMAL:
        // Have grey background, plus 3-d border -
        // One black rectangle.
        // Inside this, left and top sides - dark grey. Bottom and right -
        // white.
        // Reverse it for wxSB_RAISED

        dc.SetPen((style == wxSB_RAISED) ? m_mediumShadowPen : m_hilightPen);

    #ifndef __WXPM__

        // Right and bottom lines
        dc.DrawLine(rect.x + rect.width, rect.y,
                    rect.x + rect.width, rect.y + rect.height);
        dc.DrawLine(rect.x + rect.width, rect.y + rect.height,
                    rect.x, rect.y + rect.height);

        dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);

        // Left and top lines
        dc.DrawLine(rect.x, rect.y + rect.height,
               rect.x, rect.y);
        dc.DrawLine(rect.x, rect.y,
            rect.x + rect.width, rect.y);
    #else

        dc.DrawLine(rect.x + rect.width, rect.height + 2,
                    rect.x, rect.height + 2);
        dc.DrawLine(rect.x + rect.width, rect.y,
                    rect.x + rect.width, rect.y + rect.height);

        dc.SetPen((style == wxSB_RAISED) ? m_hilightPen : m_mediumShadowPen);
        dc.DrawLine(rect.x, rect.y,
                    rect.x + rect.width, rect.y);
        dc.DrawLine(rect.x, rect.y + rect.height,
                   rect.x, rect.y);

#endif
    }

    DrawFieldText(dc, i);
}
コード例 #22
0
ファイル: wxmynotebook.cpp プロジェクト: bihai/fbide
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);
}
コード例 #23
0
ファイル: wksp_layer_legend.cpp プロジェクト: am2222/SAGA-GIS
//---------------------------------------------------------
inline void CWKSP_Layer_Legend::_Draw_Box(wxDC &dc, int y, int dy, wxColour Color)
{
	wxPen	Pen;
	wxBrush	Brush;

	//-----------------------------------------------------
	_Set_Size(0, dy);

	dy	-= BOX_SPACE;

	//-----------------------------------------------------
	if( m_Box_bOutline == false )
	{
		Pen		= dc.GetPen();
		Pen.SetColour(Color);
		dc.SetPen(Pen);
	}

	if( m_Box_bFill )
	{
		Brush	= dc.GetBrush();
		Brush.SetColour(Color);
		dc.SetBrush(Brush);
	}

	//-----------------------------------------------------
	switch( m_BoxStyle )
	{
	case BOXSTYLE_LINE:
		dc.DrawLine(m_xBox                  , y + dy / 2, m_xBox +     m_dxBox / 4, y);
		dc.DrawLine(m_xBox +     m_dxBox / 4, y         , m_xBox + 3 * m_dxBox / 4, y + dy);
		dc.DrawLine(m_xBox + 3 * m_dxBox / 4, y + dy    , m_xBox +     m_dxBox    , y + dy / 2);
		break;

	case BOXSTYLE_CIRCLE:
		dc.DrawCircle(m_xBox + m_dxBox / 2, y + dy / 2, dy / 2);
		break;

	case BOXSTYLE_RECT:	default:
		dc.DrawRectangle(m_xBox, y, m_dxBox, dy);
		break;
	}
}
コード例 #24
0
ファイル: art_metro.cpp プロジェクト: 05storm26/codelite
void wxRibbonMetroArtProvider::DrawTabCtrlBackground(
                        wxDC& dc,
                        wxWindow* WXUNUSED(wnd),
                        const wxRect& rect)
{
    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetBrush(m_tab_ctrl_background_brush);
    dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);

    dc.SetPen(m_page_border_pen); 
    if(rect.width > 6)
    {
        dc.DrawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width, rect.y + rect.height - 1);
    }
    else
    {
        dc.DrawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width, rect.y + rect.height - 1);
    }
}
コード例 #25
0
ファイル: CurveShape.cpp プロジェクト: BlitzMaxModules/wx.mod
void wxSFCurveShape::Catmul_Rom_Kubika(const wxRealPoint& A, const wxRealPoint& B, const wxRealPoint& C, const wxRealPoint& D, wxDC& dc)
{
	// the begginig of the curve is in the B point
	wxRealPoint point0=B;
	wxRealPoint point1;

	int nOptimSteps = double(Distance(B, C)) / 10;
	if( nOptimSteps < 10 ) nOptimSteps = 10;

    // draw the curve
	for(double t = 0; t <= (1 + (1.0f / nOptimSteps)); t += 1.0f / (nOptimSteps-1))
	{
		point1 = Coord_Catmul_Rom_Kubika(A,B,C,D,t);
		dc.DrawLine((int)point0.x, (int)point0.y, (int)point1.x, (int)point1.y);
		point0 = point1;
	}
	point1 = Coord_Catmul_Rom_Kubika(A,B,C,D,1);
	dc.DrawLine((int)point0.x, (int)point0.y, (int)point1.x, (int)point1.y);
}
コード例 #26
0
ファイル: plot.cpp プロジェクト: darckense/fityk
/// draw y axis tics
void FPlot::draw_ytics (wxDC& dc, Rect const &v, bool set_pen)
{
    if (set_pen) {
        dc.SetPen(wxPen(xAxisCol, pen_width));
        dc.SetTextForeground(xAxisCol);
    }
    set_font(dc, ticsFont);
    const int pixel_width = get_pixel_width(dc);


    //if y axis is visible, tics are drawed at the axis,
    //otherwise tics are drawed at the left hand edge of the plot
    int X = 0;
    if (y_axis_visible && xs.px(0) > 0
            && xs.px(0) < pixel_width - 10)
        X = xs.px(0);
    vector<double> minors;
    vector<double> y_tics = scale_tics_step(v.bottom(), v.top(), y_max_tics,
                                            minors, ys.logarithm);
    for (vector<double>::const_iterator i = y_tics.begin();
                                                    i != y_tics.end(); ++i) {
        int Y = ys.px(*i);
        dc.DrawLine (X, Y, X + y_tic_size, Y);
        wxString label = format_label(*i, v.top() - v.bottom());
        if (x_axis_visible && label == wxT("0"))
            continue;
        wxCoord w, h;
        dc.GetTextExtent (label, &w, &h);
        dc.DrawText (label, X + y_tic_size + 1, Y - h/2);
        if (y_grid) {
            draw_line_with_style(dc, wxPENSTYLE_DOT, 0,Y, X,Y);
            draw_line_with_style(dc, wxPENSTYLE_DOT, X+y_tic_size+1+w+1, Y,
                                                     pixel_width, Y);
        }
    }
    //draw minor tics
    if (yminor_tics_visible)
        for (vector<double>::const_iterator i = minors.begin();
                                                    i != minors.end(); ++i) {
            int Y = ys.px(*i);
            dc.DrawLine (X, Y, X + y_tic_size, Y);
        }
}
コード例 #27
0
virtual void OnDraw(wxDC& dc)
{
	if (m_bitmap.IsOk())
	{
		dc.DrawBitmap(m_bitmap, 0, 0);
	}
	else if (!m_imageError.IsNull())
	{
		dc.SetPen(wxPen(wxColor(255, 255, 255)));
		dc.SetBrush(*wxWHITE_BRUSH);
		dc.DrawRectangle(0, 0, m_w, m_h);
		
		dc.SetPen(*wxRED_PEN);
		dc.DrawLine(0, 0, m_w - 1, m_h - 1);
		dc.DrawLine(0, m_h - 1, m_w - 1, m_h - 1);
		dc.SetPen(*wxBLACK_PEN);
		dc.DrawText(m_imageError.GetMessage(), 0 , 0);
	}
}
コード例 #28
0
/* not virtual in wxGrid, so code copied and modified her for painting sorting icons */
void CBOINCGridCtrl::DrawColLabel( wxDC& dc, int col )
{
    if ( GetColWidth(col) <= 0 || m_colLabelHeight <= 0 )
        return;

    int colLeft = GetColLeft(col);

    wxRect rect;
    int colRight = GetColRight(col) - 1;

    dc.SetPen( wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW),1, wxSOLID) );
    dc.DrawLine( colRight, 0,
                 colRight, m_colLabelHeight-1 );

    dc.DrawLine( colLeft, 0, colRight, 0 );

    dc.DrawLine( colLeft, m_colLabelHeight-1,
                 colRight+1, m_colLabelHeight-1 );

    dc.SetPen( *wxWHITE_PEN );
    dc.DrawLine( colLeft, 1, colLeft, m_colLabelHeight-1 );
    dc.DrawLine( colLeft, 1, colRight, 1 );
    dc.SetBackgroundMode( wxTRANSPARENT );
    dc.SetTextForeground( GetLabelTextColour() );
    dc.SetFont( GetLabelFont() );

    int hAlign, vAlign, orient;
    GetColLabelAlignment( &hAlign, &vAlign );
    orient = GetColLabelTextOrientation();

    rect.SetX( colLeft + 2 );
    rect.SetY( 2 );
    rect.SetWidth( GetColWidth(col) - 4 );
    rect.SetHeight( m_colLabelHeight - 4 );
    DrawTextRectangle( dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
	//paint sorting indicators, if needed
	if(col == sortColumn) {
		int x = rect.GetRight() - ascBitmap.GetWidth() - 2;
		int y = rect.GetY();
		dc.DrawBitmap(this->sortAscending ? descBitmap : ascBitmap,x,y,true);
	}
}
コード例 #29
0
ファイル: plot.cpp プロジェクト: darckense/fityk
void draw_line_with_style(wxDC& dc, wxPenStyle style,
                          wxCoord X1, wxCoord Y1, wxCoord X2, wxCoord Y2)
{
    wxPen pen = dc.GetPen();
    wxPenStyle old_style = pen.GetStyle();
    pen.SetStyle(style);
    dc.SetPen(pen);
    dc.DrawLine (X1, Y1, X2, Y2);
    pen.SetStyle(old_style);
    dc.SetPen(pen);
}
コード例 #30
0
void kwxAngularMeter::DrawTicks(wxDC &dc)
{
	double intervallo = (m_nAngleEnd - m_nAngleStart) / (m_nTick + 1.0);
	double valint = intervallo + m_nAngleStart;
	double tx, ty;
	double val;
	double dx, dy;
	int n, w, h;
	int tw, th;
	wxString s;
	
	GetClientSize(&w, &h);

	for(n = 0;n < m_nTick;n++)
	{
		val=(valint * m_dPI) / 180;
		//wxLogTrace("v: %f",valint);
		dx = cos(val) * (h/2);	//punto sul cerchio
		dy = sin(val) * (h/2);

		tx = cos(val) * ((h / 2) - 10);	//punto nel cerchio
		ty = sin(val) * ((h / 2) - 10);

		dc.DrawLine(  static_cast<int>((w / 2) - tx)
					, static_cast<int>((h / 2) - ty)
					, static_cast<int>((w / 2) - dx)
					, static_cast<int>((h / 2) - dy));
		
		int deltarange = m_nRangeEnd - m_nRangeStart;
		int deltaangle = m_nAngleEnd - m_nAngleStart;
		double coeff = (double)deltaangle / (double)deltarange;

		int rightval = (int)(((valint - (double)m_nAngleStart)) / coeff) + m_nRangeStart;
		
		s.Printf("%d", rightval);

		dc.GetTextExtent(s, &tw, &th);

		val = ((valint - 4) * m_dPI) / 180;	//angolo spostato
		tx = cos(val) * ((h / 2) - 12);	//punto testo
		ty = sin(val) * ((h / 2) - 12);

		dc.SetFont(m_Font);

		dc.DrawRotatedText(   s
							, static_cast<int>((w / 2) - tx)
							, static_cast<int>((h / 2) - ty)
							, 90 - valint);

		valint = valint + intervallo;
	}	

	
}