Exemple #1
0
void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
{
#if wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
    wxUnusedVar(dc);

    wxBitmap bmp(m_singleCustomColourRect.GetSize(), 32);
    bmp.UseAlpha();
    DoPreviewBitmap(bmp, m_colourData.GetColour());
    m_customColourBmp->SetBitmap(bmp);
#else
    dc.SetPen(*wxBLACK_PEN);

    wxBrush *brush = new wxBrush(m_colourData.GetColour());
    dc.SetBrush(*brush);

    dc.DrawRectangle(m_singleCustomColourRect);

    dc.SetBrush(wxNullBrush);
    delete brush;
#endif // wxCLRDLGG_USE_PREVIEW_WITH_ALPHA/!wxCLRDLGG_USE_PREVIEW_WITH_ALPHA
}
void Connection::DrawConnection(wxDC& dc, wxPoint Start, wxPoint End)
{
	int Smooth=10;
	float inc = 1.0/(Smooth*2);
	wxPoint inter1,inter2;
	inter1.y=Start.y;
	inter1.x=Start.x+(End.x-Start.x)/2;

	inter2.y=End.y;
	inter2.x=End.x+(Start.x-End.x)/2;

	dc.SetBrush(wxBrush());
	dc.SetPen(wxPen());
	for (float i=0;i<1;i+=inc)
	{
		wxPoint l1,l2;
		l1=_Bezier(Start,End,inter1,inter2,i);
		l2=_Bezier(Start,End,inter1,inter2,i+inc);
		dc.DrawLine(l1.x,l1.y,l2.x,l2.y);
	}
}
Exemple #3
0
void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
{
    int i;
    for (i = 0; i < 6; i++)
    {
        int j;
        for (j = 0; j < 8; j++)
        {
            int ptr = i*8 + j;

            int x = (j*(m_smallRectangleSize.x+m_gridSpacing) + m_standardColoursRect.x);
            int y = (i*(m_smallRectangleSize.y+m_gridSpacing) + m_standardColoursRect.y);

            dc.SetPen(*wxBLACK_PEN);
            wxBrush brush(m_standardColours[ptr]);
            dc.SetBrush(brush);

            dc.DrawRectangle( x, y, m_smallRectangleSize.x, m_smallRectangleSize.y);
        }
    }
}
Exemple #4
0
bool DragShape::Draw(wxDC& dc, bool highlight)
{
    if (m_bitmap.IsOk())
    {
        wxMemoryDC memDC;
        memDC.SelectObject(m_bitmap);

        dc.Blit(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight(),
            & memDC, 0, 0, wxCOPY, true);

        if (highlight)
        {
            dc.SetPen(*wxWHITE_PEN);
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
            dc.DrawRectangle(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight());
        }

        return true;
    }
    else
        return false;
}
Exemple #5
0
void wxAuiMSWTabArt::DrawBackground(wxDC& dc,
    wxWindow* wnd,
    const wxRect& rect)
{
    if ( !IsThemed() )
    {
        wxAuiGenericTabArt::DrawBackground(dc, wnd, rect);
        return;
    }

    int borderHeight = 2;

    wxRect drawRect = rect;
    drawRect.height -= borderHeight;

    // Draw background
    dc.SetBrush(wxBrush(wnd->GetBackgroundColour()));
    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.DrawRectangle(drawRect);

    // Draw top border
    drawRect.y = drawRect.height;
    drawRect.height = borderHeight + 2;

    drawRect.Inflate(1, 0);

    RECT r;
    wxCopyRectToRECT(drawRect, r);

    wxUxThemeHandle hTheme(wnd, L"TAB");

    ::DrawThemeBackground(
        hTheme,
        GetHdcOf(dc.GetTempHDC()),
        TABP_PANE,
        0,
        &r,
        NULL);
}
Exemple #6
0
void wxRibbonDrawParallelGradientLines(wxDC& dc,
                                    int nlines,
                                    const wxPoint* line_origins,
                                    int stepx,
                                    int stepy,
                                    int numsteps,
                                    int offset_x,
                                    int offset_y,
                                    const wxColour& start_colour,
                                    const wxColour& end_colour)
{
    int rd, gd, bd;
    rd = end_colour.Red() - start_colour.Red();
    gd = end_colour.Green() - start_colour.Green();
    bd = end_colour.Blue() - start_colour.Blue();

    for (int step = 0; step < numsteps; ++step)
    {
        int r,g,b;

        r = start_colour.Red() + (((step*rd*100)/numsteps)/100);
        g = start_colour.Green() + (((step*gd*100)/numsteps)/100);
        b = start_colour.Blue() + (((step*bd*100)/numsteps)/100);

        wxPen p(wxColour((unsigned char)r,
                        (unsigned char)g,
                        (unsigned char)b));
        dc.SetPen(p);

        for(int n = 0; n < nlines; ++n)
        {
            dc.DrawLine(offset_x + line_origins[n].x, offset_y + line_origins[n].y,
                        offset_x + line_origins[n].x + stepx, offset_y + line_origins[n].y + stepy);
        }

        offset_x += stepx;
        offset_y += stepy;
    }
}
Exemple #7
0
void SjVisGrBg::DrawBackground(wxDC& dc)
{
	// blue gradient background
	wxSize size = dc.GetSize();
	int rowH = (m_height/BG_STEPS)+1, y, yCol;
	dc.SetPen(*wxTRANSPARENT_PEN);
	for( y = 0; y < BG_STEPS; y++ )
	{
		if( m_imgOpFlags & SJ_IMGOP_GRAYSCALE )
		{
			yCol = int(float(y)*BG_GRAYSCALE);
			m_brush.SetColour(yCol, yCol, yCol);
		}
		else
		{
			m_brush.SetColour(0, 0, y);
		}

		dc.SetBrush(m_brush);
		dc.DrawRectangle(0, y*rowH, size.x, rowH);
	}
}
Exemple #8
0
void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
{
    // we need to render selected and current items differently
    const bool isSelected = IsSelected(n),
               isCurrent = IsCurrent(n);
    if ( isSelected || isCurrent )
    {
        if ( isSelected )
        {
            dc.SetBrush(wxBrush(m_colBgSel, wxSOLID));
        }
        else // !selected
        {
            dc.SetBrush(*wxTRANSPARENT_BRUSH);
        }

        dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN));

        dc.DrawRectangle(rect);
    }
    //else: do nothing for the normal items
}
Exemple #9
0
void SkinRegion::Stroke(wxDC& dc, wxGraphicsContext* gc, const wxRect& rect, int /*n*/)
{
    if (!has_border)
        return;

    int penw = border.GetWidth() / 2.0f;

    wxRect r(rect);
    r.Deflate(penw, penw);
    //border.SetCap(wxCAP_PROJECTING);

    if (rounded) {
        bool needsDelete = false;
        if (!gc) {
            gc = wxGraphicsContext::Create((wxWindowDC&)dc);
            needsDelete = true;
        }

        gc->SetBrush(*wxTRANSPARENT_BRUSH);
        gc->SetPen(border);
        gc->DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, rounded * .97);

        rect.Inflate(penw, penw);

        if (needsDelete)
            delete gc;
    } else {
        dc.SetPen(border);

        int offset = (int)(border.GetWidth() % 2 == 0);
        wxPoint x(offset, 0);
        wxPoint y(0, offset);

        dc.DrawLine(rect.GetTopLeft(), rect.GetBottomLeft() + y);
        dc.DrawLine(rect.GetBottomLeft() + y, rect.GetBottomRight() + y + x);
        dc.DrawLine(rect.GetBottomRight() + y + x, rect.GetTopRight() + x);
        dc.DrawLine(rect.GetTopRight() + x, rect.GetTopLeft());
    }
}
Exemple #10
0
void wxAuiGenericTabArt::DrawBackground(wxDC& dc,
                                        wxWindow* WXUNUSED(wnd),
                                        const wxRect& rect)
{
    // draw background

    wxColor top_color       = m_baseColour.ChangeLightness(90);
    wxColor bottom_color   = m_baseColour.ChangeLightness(170);
    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

   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.DrawRectangle(-1, y-4, w+2, 4);
   }
}
Exemple #11
0
void wxMultiCellSizer :: DrawGridLines(wxDC& dc)
{
    RecalcSizes();
    int maxW = Sum(m_maxWidth, m_cell_count.GetWidth());
    int maxH = Sum(m_maxHeight, m_cell_count.GetHeight());
    int x;

    // Draw the columns
    dc.SetPen(* m_pen);
    for (x = 1; x < m_cell_count.GetWidth(); x++)
    {
        int colPos = Sum(m_maxWidth, x) ;
        dc.DrawLine(colPos, 0, colPos, maxH);
    }

    // Draw the rows
    for (x = 1; x < m_cell_count.GetHeight(); x++)
    {
        int rowPos = Sum(m_maxHeight, x);
        dc.DrawLine(0, rowPos, maxW, rowPos);
    }
}
void kwxAngularMeter::DrawSectors(wxDC &dc)
{
	double starc,endarc;
	int secount,dx,dy;
	int w,h ;

	double val;
	
	GetClientSize(&w,&h);

	//arco -> settori
	dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxSOLID));

	starc = m_nAngleStart;
	endarc = starc + ((m_nAngleEnd - m_nAngleStart) / (double)m_nSec);
	//dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(*wxRED,wxSOLID));
	for(secount=0;secount<m_nSec;secount++)
	{
		dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_aSectorColor[secount],wxSOLID));
		dc.DrawEllipticArc(0,0,w,h,180 - endarc,180 - starc);
		//dc.DrawEllipticArc(0,0,w,h,0,180);
		starc = endarc;
		endarc += ((m_nAngleEnd - m_nAngleStart) / (double)m_nSec);
	}

	val = (m_nAngleStart * m_dPI) / 180.0;
	dx = static_cast<int>(cos(val) * h / 2.0);
	dy = static_cast<int>(sin(val) * h / 2.0);

	dc.DrawLine(w / 2, h / 2, (w / 2) - dx, (h / 2) - dy);	//linea sinistra

	val = (m_nAngleEnd * m_dPI) / 180.0;
	dx = static_cast<int>(cos(val) * h / 2.0);
	dy = static_cast<int>(sin(val) * h / 2.0);
		
	dc.DrawLine(w / 2, h / 2, (w / 2) - dx, (h / 2) - dy);	//linea destra

}
Exemple #13
0
void wxMaze::draw(wxDC & dc, int w, int h, unsigned int m_x, unsigned int m_y) const
{
	dc.SetPen(*wxBLACK_PEN);
	dc.DrawRectangle(0, 0, w, h);

/* {{{ DISABLED: copy from ASCIIMaze
	for (unsigned int j = 0; j < ny(); ++j) {
		for (unsigned int i = 0; i < nx(); ++i) {
			cout << wall;
			if (j == 0) {
				cout << ((c(i, j) & TOP) ? wall : space);
			} else {
				cout << (((c(i, j) & TOP) && (c(i, j-1) & BOTTOM)) ? wall : space);
			}
		}
		cout << wall << endl;
		for (unsigned int i = 0; i < nx(); ++i) {
			if (i == 0) {
				cout << ((c(i, j) & LEFT) ? wall : space);
			} else {
				cout << (((c(i, j) & LEFT) && (c(i-1, j) & RIGHT)) ? wall : space);
			}
			if (m_x == (unsigned int)-1 || m_y == (unsigned int)-1) {
				cout << center;
			} else {
				cout << ((i == m_x && j == m_y) ? mark : center);
			}
		}
		cout << ((c(nx()-1, j) & RIGHT) ? wall : space);
		cout << endl;
	}
	for (unsigned int i = 0; i < nx(); ++i) {
		cout << wall;
		cout << ((c(i, ny()-1) & BOTTOM) ? wall : space);
	}
	cout << wall << endl;
}}} */
}
Exemple #14
0
/**
 * Render the event in the bitmap
 */
void GroupEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEditorItemsAreas & areas, gd::EventsEditorSelection & selection, const gd::Platform & platform)
{
#if !defined(GD_NO_WX_GUI)
    wxString groupTitle = name.empty() ? _("Untitled group") : wxString(name);
    wxColour backgroundColor = wxColour(colorR, colorG, colorB);
    wxColour textColor = colorR + colorG + colorB > 200*3 ? *wxBLACK : *wxWHITE;
    if (IsDisabled())
    {
        backgroundColor.MakeDisabled();
        textColor = wxColour(160, 160, 160);
    }

    dc.SetBrush(wxBrush(backgroundColor));
    dc.SetPen(wxPen(backgroundColor.ChangeLightness(70)));
    wxRect rect(x+1, y, width-2, GetRenderedHeight(width, platform)-2);
    dc.DrawRectangle(rect);

    dc.SetTextBackground(backgroundColor);
    dc.SetTextForeground(textColor);
    dc.SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) );
    dc.DrawText( groupTitle, x+5, y + 5 );
#endif
}
void UIElementPrimitive::render(wxDC& dc)
{
	int client_h = 0;
	int client_w = 0;
	GetClientSize (&client_w, &client_h);

	if (!(cpw::ApplicationConfiguration::GetInstance()->IsThemed()))
	{
	  wxColour c_pen   = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
	  wxColour c_backg = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);	
	wxColour c_brush = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
dc.SetTextForeground(wxColour(wxString(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8)));
		dc.SetPen(wxPen(c_pen));
		dc.SetBrush(wxBrush(c_brush));
		dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
	}

	dc.DrawRotatedText(_T("Name: "),20,20, 0);
	dc.DrawRotatedText(_T("Model: "),20,40, 0);
	dc.DrawRotatedText(_T("Icon:"),20,60, 0);
	dc.DrawRotatedText(_T("Font:"),20,80, 0);
	dc.DrawRotatedText(_T("Description"),20,100, 0);
}
Exemple #16
0
void
wxStdRenderer::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
{
    // draw the pixels manually because the "dots" in wxPen with wxDOT style
    // may be short traits and not really dots
    //
    // note that to behave in the same manner as DrawRect(), we must exclude
    // the bottom and right borders from the rectangle
    wxCoord x1 = rect.GetLeft(),
            y1 = rect.GetTop(),
            x2 = rect.GetRight(),
            y2 = rect.GetBottom();

    dc.SetPen(m_penBlack);

    // this seems to be closer than what Windows does than wxINVERT although
    // I'm still not sure if it's correct
    dc.SetLogicalFunction(wxAND_REVERSE);

    wxCoord z;
    for ( z = x1 + 1; z < x2; z += 2 )
        dc.DrawPoint(z, rect.GetTop());

    wxCoord shift = z == x2 ? 0 : 1;
    for ( z = y1 + shift; z < y2; z += 2 )
        dc.DrawPoint(x2, z);

    shift = z == y2 ? 0 : 1;
    for ( z = x2 - shift; z > x1; z -= 2 )
        dc.DrawPoint(z, y2);

    shift = z == x1 ? 0 : 1;
    for ( z = y2 - shift; z > y1; z -= 2 )
        dc.DrawPoint(x1, z);

    dc.SetLogicalFunction(wxCOPY);
}
Exemple #17
0
void CompDateAxis::DrawGridLines(wxDC &dc, wxRect rc)
{
    wxDateTime firstDate, lastDate;
    if (!GetWindowDateBounds(firstDate, lastDate)) {
        return ;
    }

    // we will draw grid lines by minimal date span
    wxDateSpan span;
    if (!GetMinSpan(span)) {
        return ;
    }

    dc.SetPen(m_gridLinesPen);

    wxDateTime date = RoundDateToSpan(firstDate, span);
    do {
        double value = DateToDataCoord(date);

        wxCoord x0, y0;
        wxCoord x1, y1;
        if (IsVertical()) {
            x0 = rc.x;
            x1 = rc.x + rc.width;
            y0 = y1 = Axis::ToGraphics(dc, rc.y, rc.height, value);
        }
        else {
            x0 = x1 = Axis::ToGraphics(dc, rc.x, rc.width, value);
            y0 = rc.y;
            y1 = rc.y + rc.height;
        }

        dc.DrawLine(x0, y0, x1, y1);

        date += span;
    } while (date <= lastDate);
}
Exemple #18
0
void cbRowDragPlugin::DrawCollapsedRowsBorder( wxDC& dc )
{
    int colRowOfs = GetCollapsedIconsPos();
    wxRect& bounds = mpPane->mBoundsInParent;

    wxBrush bkBrush( mpLayout->mGrayPen.GetColour(), wxSOLID );
    dc.SetBrush( bkBrush );
    dc.SetPen( mpLayout->mDarkPen );

    if ( mpPane->IsHorizontal() )
    
        dc.DrawRectangle( bounds.x + mpPane->mLeftMargin - ROW_DRAG_HINT_WIDTH - 1,
                          colRowOfs,
                          bounds.width - mpPane->mLeftMargin - mpPane->mRightMargin + 2 + ROW_DRAG_HINT_WIDTH,
                          COLLAPSED_ICON_HEIGHT + 1);
    else
        dc.DrawRectangle( colRowOfs,
                          bounds.y + mpPane->mTopMargin - 1,
                          COLLAPSED_ICON_HEIGHT + 1,
                          bounds.height - mpPane->mTopMargin - mpPane->mBottomMargin 
                          - ROW_DRAG_HINT_WIDTH - 2 );

    dc.SetBrush( wxNullBrush );
}
void UIElementVectorial::render(wxDC& dc)
{
	int client_h = 0;
	int client_w = 0;
	GetClientSize (&client_w, &client_h);

	if (!(cpw::ApplicationConfiguration::GetInstance()->IsThemed()))
	{
	  wxColour c_pen   = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient2Colour().c_str(),wxConvUTF8);
	  wxColour c_backg = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundGradient1Colour().c_str(),wxConvUTF8);	
	  wxColour c_brush = wxString(cpw::ApplicationConfiguration::GetInstance()->GetBackgroundColour().c_str(),wxConvUTF8);
	  dc.SetTextForeground(wxColour(wxString(cpw::ApplicationConfiguration::GetInstance()->GetFontLightColour().c_str(),wxConvUTF8)));
		dc.SetPen(wxPen(c_pen));
		dc.SetBrush(wxBrush(c_brush));
		dc.GradientFillLinear( wxRect(0,0,client_w,client_h), c_backg, c_pen, wxSOUTH);
	}

	DrawStaticBox(dc,_T("Position"), wxPoint(20,294-60), wxSize(350,50));
	wxPoint box1_first(20-2,10-2);
	wxPoint box1_last(368,82+2);
	dc.DrawRotatedText(_T("Name:"),20,10, 0);
	//dc.DrawRotatedText(_T("Border thickness"),20,40, 0);
	//dc.DrawRotatedText(_T("Border colour"),188,40, 0);
}
Exemple #20
0
void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
{
  dc.BeginDrawing();

  int i;
  for (i = 0; i < 6; i++)
  {
    int j;
    for (j = 0; j < 8; j++)
    {
      int ptr = i*8 + j;

      int x = (j*(smallRectangleSize.x+gridSpacing) + standardColoursRect.x);
      int y = (i*(smallRectangleSize.y+gridSpacing) + standardColoursRect.y);

      dc.SetPen(*wxBLACK_PEN);
      wxBrush brush(standardColours[ptr], wxSOLID);
      dc.SetBrush(brush);

      dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
    }
  }
  dc.EndDrawing();
}
Exemple #21
0
//---------------------------------------------------------
void CWKSP_Layer_Legend::_Draw_Polygon(wxDC &dc, CWKSP_Shapes_Polygon *pLayer)
{
	wxString	Name;
	wxPen		Pen;
	wxBrush		Brush;

	//-----------------------------------------------------
	m_BoxStyle	= BOXSTYLE_RECT;
	m_Box_bFill	= true;

	//-----------------------------------------------------
	pLayer->Get_Style(Pen, Brush, m_Box_bOutline, &Name);

	dc.SetBrush(Brush);
	dc.SetPen(Pen);

	if( Name.Length() > 0 )
	{
		_Draw_Title(dc, FONT_SUBTITLE, Name);
	}

	//-----------------------------------------------------
	_Draw_Boxes(dc, m_Position.y);
}
Exemple #22
0
void PreviewPlot::draw(wxDC &dc, bool)
{
    if (data_.get() == NULL || !data_updated_
        || block_nr < 0 || block_nr >= data_->get_block_count())
        return;

    xylib::Block const *block = data_->get_block(block_nr);

    if (idx_x < 0 || idx_x > block->get_column_count()
            || idx_y < 0 || idx_y > block->get_column_count())
        return;

    xylib::Column const& xcol = block->get_column(idx_x);
    xylib::Column const& ycol = block->get_column(idx_y);
    const int np = block->get_point_count();
    draw_tics(dc, xcol.get_min(), xcol.get_max(np),
                  ycol.get_min(), ycol.get_max(np));
    draw_axis_labels(dc, xcol.get_name(), ycol.get_name());

    // draw data
    dc.SetPen(*wxGREEN_PEN);
    for (int i = 0; i < np; ++i)
        draw_point(dc, xcol.get_value(i), ycol.get_value(i));
}
Exemple #23
0
void SjVisImgBg::DrawBackground(wxDC& dc)
{
	wxASSERT( wxThread::IsMain() );

	if( m_scaledImage.IsOk() )
	{
		if( m_scaledBitmap == NULL )
		{
			m_scaledBitmap = new wxBitmap(m_scaledImage);
		}

		if( m_scaledBitmap->IsOk() )
		{
			dc.DrawBitmap(*m_scaledBitmap, 0, 0);
			return;
		}
	}

	// error
	wxSize size = dc.GetSize();
	dc.SetBrush(*wxBLACK_BRUSH);
	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.DrawRectangle(0, 0, size.x, size.y);
}
Exemple #24
0
void wxAuiDefaultDockArt::DrawCaption(wxDC& dc, wxWindow *WXUNUSED(window),
                                   const wxString& text,
                                   const wxRect& rect,
                                   wxAuiPaneInfo& pane)
{
    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetFont(m_caption_font);

    DrawCaptionBackground(dc, rect,
                          (pane.state & wxAuiPaneInfo::optionActive)?true:false);

    if (pane.state & wxAuiPaneInfo::optionActive)
        dc.SetTextForeground(m_active_caption_text_colour);
    else
        dc.SetTextForeground(m_inactive_caption_text_colour);


    wxCoord w,h;
    dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);

    wxRect clip_rect = rect;
    clip_rect.width -= 3; // text offset
    clip_rect.width -= 2; // button padding
    if (pane.HasCloseButton())
        clip_rect.width -= m_button_size;
    if (pane.HasPinButton())
        clip_rect.width -= m_button_size;
    if (pane.HasMaximizeButton())
        clip_rect.width -= m_button_size;

    wxString draw_text = wxAuiChopText(dc, text, clip_rect.width);

    dc.SetClippingRegion(clip_rect);
    dc.DrawText(draw_text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1);
    dc.DestroyClippingRegion();
}
Exemple #25
0
void cbCloseBox::Draw( wxDC& dc )
{
    cbMiniButton::Draw( dc );

    dc.SetPen( *wxBLACK_PEN );

    int width = BTN_BOX_WIDTH - 7;

    int xOfs = (mPressed) ? 4 : 3;
    int yOfs = (mPressed) ? 4 : 3;

    for( int i = 0; i != BTN_X_WEIGHT; ++i )
    {
        dc.DrawLine( mPos.x + xOfs + i,
                     mPos.y + yOfs,
                     mPos.x + xOfs + i + width,
                     mPos.y + yOfs + width );

        dc.DrawLine( mPos.x + xOfs + i + width - 1,
                     mPos.y + yOfs,
                     mPos.x + xOfs + i - 1,
                     mPos.y + yOfs + width );
    }
}
Exemple #26
0
void wxRibbonMetroArtProvider::DrawPartialPageBackground(wxDC& dc,
        wxWindow* wnd, const wxRect& rect, wxRibbonPage* page,
        wxPoint offset, bool hovered)
{
    wxRect background;
    // Expanded panels need a background - the expanded panel at
    // best size may have a greater Y dimension higher than when
    // on the bar if it has a sizer. AUI art provider does not need this
    // because it paints the panel without reference to its parent's size.
    // Expanded panels use a wxFrame as parent (not a wxRibbonPage).

    if(wnd->GetSizer() && wnd->GetParent() != page)
    {
        background = wnd->GetParent()->GetSize();
        offset = wxPoint(0,0);
    }
    else
    {
        background = page->GetSize();
        page->AdjustRectToIncludeScrollButtons(&background);
        background.height -= 2;
    }
    // Page background isn't dependant upon the width of the page
    // (at least not the part of it intended to be painted by this
    // function). Set to wider than the page itself for when externally
    // expanded panels need a background - the expanded panel can be wider
    // than the bar.
    background.x = 0;
    background.width = INT_MAX;

    wxRect paint_rect(rect);

	dc.SetPen(*wxTRANSPARENT_PEN);
	dc.SetBrush(m_page_background_colour);
	dc.DrawRectangle(rect);
}
Exemple #27
0
void wxBitmapComboBox::OnDrawBackground(wxDC& dc,
                                        const wxRect& rect,
                                        int item,
                                        int flags) const
{
    if ( GetCustomPaintWidth() == 0 ||
         !(flags & wxODCB_PAINTING_SELECTED) ||
         item < 0 )
    {
        wxOwnerDrawnComboBox::OnDrawBackground(dc, rect, item, flags);
        return;
    }

    //
    // Just paint simple selection background under where is text
    // (ie. emulate what MSW image choice does).
    //

    int xPos = 0;  // Starting x of selection rectangle
    const int vSizeDec = 1;  // Vertical size reduction of selection rectangle edges

    xPos = GetCustomPaintWidth() + 2;

    wxCoord x, y;
    GetTextExtent(GetString(item), &x, &y, 0, 0);

    dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));

    wxColour selCol = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
    dc.SetPen(selCol);
    dc.SetBrush(selCol);
    dc.DrawRectangle(rect.x+xPos,
                     rect.y+vSizeDec,
                     x + 4,
                     rect.height-(vSizeDec*2));
}
Exemple #28
0
static void DrawGradientRectangle(wxDC& dc,
                                  const wxRect& rect,
                                  const wxColour& start_color,
                                  const wxColour& end_color,
                                  int direction)
{
    int rd, gd, bd, high = 0;
    rd = end_color.Red() - start_color.Red();
    gd = end_color.Green() - start_color.Green();
    bd = end_color.Blue() - start_color.Blue();

    if (direction == wxAUI_GRADIENT_VERTICAL)
        high = rect.GetHeight()-1;
    else
        high = rect.GetWidth()-1;

    for (int i = 0; i <= high; ++i)
    {
        int r,g,b;


        r = start_color.Red() + (high <= 0 ? 0 : (((i*rd*100)/high)/100));
        g = start_color.Green() + (high <= 0 ? 0 : (((i*gd*100)/high)/100));
        b = start_color.Blue() + (high <= 0 ? 0 : (((i*bd*100)/high)/100));

        wxPen p(wxColor((unsigned char)r,
                        (unsigned char)g,
                        (unsigned char)b));
        dc.SetPen(p);

        if (direction == wxAUI_GRADIENT_VERTICAL)
            dc.DrawLine(rect.x, rect.y+i, rect.x+rect.width, rect.y+i);
        else
            dc.DrawLine(rect.x+i, rect.y, rect.x+i, rect.y+rect.height);
    }
}
void wxDiagram::DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)
{
  wxPen dottedPen(*wxBLACK, 1, wxDOT);
  dc.SetPen(dottedPen);
  dc.SetBrush((* wxTRANSPARENT_BRUSH));

  wxPoint points[5];

  points[0].x = (int) x1;
  points[0].y = (int) y1;

  points[1].x = (int) x2;
  points[1].y = (int) y1;

  points[2].x = (int) x2;
  points[2].y = (int) y2;

  points[3].x = (int) x1;
  points[3].y = (int) y2;

  points[4].x = (int) x1;
  points[4].y = (int) y1;
  dc.DrawLines(5, points);
}
Exemple #30
0
// Draw 3D effect borders
void wxSashWindow::DrawBorders(wxDC& dc)
{
    int w, h;
    GetClientSize(&w, &h);

    wxPen mediumShadowPen(m_mediumShadowColour, 1, wxSOLID);
    wxPen darkShadowPen(m_darkShadowColour, 1, wxSOLID);
    wxPen lightShadowPen(m_lightShadowColour, 1, wxSOLID);
    wxPen hilightPen(m_hilightColour, 1, wxSOLID);

    if ( GetWindowStyleFlag() & wxSW_3DBORDER )
    {
        dc.SetPen(mediumShadowPen);
        dc.DrawLine(0, 0, w-1, 0);
        dc.DrawLine(0, 0, 0, h - 1);

        dc.SetPen(darkShadowPen);
        dc.DrawLine(1, 1, w-2, 1);
        dc.DrawLine(1, 1, 1, h-2);

        dc.SetPen(hilightPen);
        dc.DrawLine(0, h-1, w-1, h-1);
        dc.DrawLine(w-1, 0, w-1, h); // Surely the maximum y pos. should be h - 1.
                                     /// Anyway, h is required for MSW.

        dc.SetPen(lightShadowPen);
        dc.DrawLine(w-2, 1, w-2, h-2); // Right hand side
        dc.DrawLine(1, h-2, w-1, h-2);     // Bottom
    }
    else if ( GetWindowStyleFlag() & wxSW_BORDER )
    {
        dc.SetBrush(*wxTRANSPARENT_BRUSH);
        dc.SetPen(*wxBLACK_PEN);
        dc.DrawRectangle(0, 0, w-1, h-1);
    }

    dc.SetPen(wxNullPen);
    dc.SetBrush(wxNullBrush);
}