您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wxPen函数代码示例

51自学网 2021-06-03 10:11:24
  C++
这篇教程C++ wxPen函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wxPen函数的典型用法代码示例。如果您正苦于以下问题:C++ wxPen函数的具体用法?C++ wxPen怎么用?C++ wxPen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: _

/** * 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}
开发者ID:alcemirfernandes,项目名称:GD,代码行数:26,


示例2: DigitX

void kwxLCDDisplay::DrawTwoDots( wxDC *dc, int digit ){	int sl = mSegmentLen;	int sw = mSegmentWidth;//	int sp = mSpace;	int x = DigitX( digit );	int y = DigitY( digit );	wxBrush brushOn( mLightColour, wxSOLID );	x += ( sl / 2 ) - sw;	y += ( sl / 2 ) - sw;	dc->SetBrush( brushOn );	dc->SetPen( wxPen( GetBackgroundColour(), 1, wxSOLID ) );	dc->DrawEllipse( x, y, 2 * sw, 2 * sw );	y += sl;	dc->DrawEllipse( x, y, 2 * sw, 2 * sw );}
开发者ID:BlueAndi,项目名称:vscp_software,代码行数:23,


示例3: DrawHighlightedShapes

void ConditionalHistogramCanvas::DrawHighlightedShapes(wxMemoryDC &dc){	dc.SetPen(wxPen(highlight_color));	dc.SetBrush(wxBrush(highlight_color, wxBRUSHSTYLE_CROSSDIAG_HATCH));	int t = var_info[HIST_VAR].time;	int i=0;	double s;	for (int r=0; r<vert_num_cats; r++) {		for (int c=0; c<horiz_num_cats; c++) {			for (int ival=0; ival<cur_intervals; ival++) {				if (cell_data[t][r][c].ival_obs_sel_cnt[ival] != 0) {					s = (((double) cell_data[t][r][c].ival_obs_sel_cnt[ival]) /						 ((double) cell_data[t][r][c].ival_obs_cnt[ival]));					GdaRectangle* rec = (GdaRectangle*) selectable_shps[i];					dc.DrawRectangle(rec->lower_left.x, rec->lower_left.y,									 rec->upper_right.x - rec->lower_left.x,									 (rec->upper_right.y-rec->lower_left.y)*s);				}				i++;			}		}	}}
开发者ID:GeoDaCenter,项目名称:geoda,代码行数:23,


示例4: WXUNUSED

void SAuiTabArt::DrawBackground(wxDC& dc,	wxWindow* WXUNUSED(wnd),	const wxRect& rect){	// draw background	wxColor top_color = (m_mainTabs && Global::win_version_major >= 10) ? col_w10_bg : m_baseColour;	wxColor bottom_color = (m_mainTabs && Global::win_version_major >= 10) ? col_w10_bg : m_baseColour;	wxRect r;	if (m_flags &wxAUI_NB_BOTTOM)		r = wxRect(rect.x, rect.y, rect.width + 2, rect.height);	else		r = wxRect(rect.x, rect.y, rect.width + 2, rect.height);	dc.GradientFillLinear(r, top_color, bottom_color, wxSOUTH);	// draw base lines	dc.SetPen(wxPen(m_baseColour));	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);	}	else	{		//dc.SetPen(*wxTRANSPARENT_PEN);		//dc.SetBrush(wxBrush(m_activeColour));		//dc.SetBrush(wxBrush(wxColor(224, 238, 255)));		//dc.DrawRectangle(-1, y - 4, w + 2, 4);		dc.SetPen(m_borderPen);		dc.DrawLine(-2, y - 1, w + 2, y - 1);	}}
开发者ID:SanyaWaffles,项目名称:SLADE,代码行数:37,


示例5: dc

void TileSelector::OnPaint(wxPaintEvent &event) {	wxPaintDC dc(this);	if(tiles == 0 || tiles_per_line == 0)		return;	wxBitmap tile;	wxRect rect;	wxPoint p;	for(int i = 0; i < tiles_max; i++) {		rect.x = i * TILE_W;		rect.y = 0;		rect.width = TILE_W;		rect.height = TILE_H;		p.x = BORDER + (i % tiles_per_line) * (TILE_W + (TILE_SPACING * 2));		p.y = BORDER + (i / tiles_per_line) * (TILE_H + (TILE_SPACING * 2));		if(selected == i) {			wxSize size;			size.x = TILE_W + (TILE_SPACING * 2);			size.y = TILE_H + (TILE_SPACING * 2);			dc.SetPen(wxPen(wxColor(0x88, 0x88, 0xff), 2));			dc.SetBrush(*wxTRANSPARENT_BRUSH);			dc.DrawRectangle(p, size);		}		p.x += TILE_SPACING;		p.y += TILE_SPACING;		tile = tiles->GetSubBitmap(rect);		dc.DrawBitmap(tile, p, true);	}}
开发者ID:DemonTPx,项目名称:smashbattle-leveleditor,代码行数:36,


示例6: wxWindow

SjOscWindow::SjOscWindow(SjOscModule* oscModule, wxWindow* parent)	: wxWindow( parent, -1, /*oscModule->m_name,*/	            wxPoint(-1000,-1000), wxSize(100,100),	            (wxNO_BORDER /*| wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT*/) ),	m_offscreenBitmap(16,16){	m_oscModule = oscModule;	// get the number of samples wanted	// (currently we exactly 576 for the spcectrum analyzer)	m_sampleCount = SjMs2Bytes(SLEEP_MS) / (SJ_WW_CH*SJ_WW_BYTERES);	if( m_sampleCount < 576*2 )	{		m_sampleCount = 576*2;	}	m_bufferStart = (unsigned char*)malloc(m_sampleCount*SJ_WW_CH*SJ_WW_BYTERES);	// set colors	m_textColour = wxColour(0x2F, 0x60, 0xA3);	m_fgColour = wxColour(0x3D, 0x80, 0xDF);	m_fgPen = wxPen(m_fgColour, 1, wxSOLID);	// create the drawing objects	m_spectrum = new SjOscSpectrum(m_sampleCount);	m_oscilloscope = new SjOscOscilloscope(m_sampleCount);	m_title = new SjOscTitle();	m_rotor = new SjOscRotor();	m_hands = new SjOscHands();	m_firework = new SjOscFirework();	m_starfield = new SjOscStarfield();	// finally, start the timer	m_timer.SetOwner(this, IDC_TIMER);	m_timer.Start(SLEEP_MS);}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:36,


示例7: dc

/* SToolBar::onPaint * Called when the toolbar needs to be drawn *******************************************************************/void SToolBar::onPaint(wxPaintEvent& e){	wxPaintDC dc(this);	// Get system colours needed	wxColour col_background = Drawing::getPanelBGColour();	wxColour col_light = Drawing::lightColour(col_background, 1.5f);	wxColour col_dark = Drawing::darkColour(col_background, 1.5f);		// Draw background	dc.SetBackground(wxBrush(col_background));	dc.Clear();	if (draw_border)	{		// Draw top		//dc.SetPen(wxPen(col_dark));// col_light));		//dc.DrawLine(wxPoint(0, 0), wxPoint(GetSize().x+1, 0));		// Draw bottom		dc.SetPen(wxPen(col_dark));		dc.DrawLine(wxPoint(0, GetSize().y-1), wxPoint(GetSize().x+1, GetSize().y-1));	}}
开发者ID:jonrimmer,项目名称:SLADE,代码行数:27,


示例8: defined

// Initialize coloursvoid wxStatusBarGeneric::InitColours(){    // Shadow colours#if defined(__WIN95__) || defined(__WXMAC__)    wxColour mediumShadowColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));    m_mediumShadowPen = wxPen(mediumShadowColour, 1, wxSOLID);    wxColour hilightColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT));    m_hilightPen = wxPen(hilightColour, 1, wxSOLID);#elif defined(__WXPM__)    m_mediumShadowPen = wxPen(wxColour(127, 127, 127), 1, wxSOLID);    m_hilightPen = wxPen(_T("WHITE"), 1, wxSOLID);    wxColour                        vColour;    vColour.Set(wxString(_T("LIGHT GREY")));    SetBackgroundColour(vColour);    vColour.Set(wxString(_T("BLACK")));    SetForegroundColour(vColour);#else    m_mediumShadowPen = wxPen("GREY", 1, wxSOLID);    m_hilightPen = wxPen("WHITE", 1, wxSOLID);#endif}
开发者ID:gitrider,项目名称:wxsj2,代码行数:25,


示例9: wxBrush

void wxAuiSimpleTabArt::SetActiveColour(const wxColour& colour){    m_selectedBkBrush = wxBrush(colour);    m_selectedBkPen = wxPen(colour);}
开发者ID:futurepr0n,项目名称:wxWidgets,代码行数:5,


示例10: wxT

//.........这里部分代码省略.........    wxPoint border_points[6];    if (m_flags &wxAUI_NB_BOTTOM)    {        border_points[0] = wxPoint(tab_x,             tab_y);        border_points[1] = wxPoint(tab_x,             tab_y+tab_height-6);        border_points[2] = wxPoint(tab_x+2,           tab_y+tab_height-4);        border_points[3] = wxPoint(tab_x+tab_width-2, tab_y+tab_height-4);        border_points[4] = wxPoint(tab_x+tab_width,   tab_y+tab_height-6);        border_points[5] = wxPoint(tab_x+tab_width,   tab_y);    }    else //if (m_flags & wxAUI_NB_TOP) {}    {        border_points[0] = wxPoint(tab_x,             tab_y+tab_height-4);        border_points[1] = wxPoint(tab_x,             tab_y+2);        border_points[2] = wxPoint(tab_x+2,           tab_y);        border_points[3] = wxPoint(tab_x+tab_width-2, tab_y);        border_points[4] = wxPoint(tab_x+tab_width,   tab_y+2);        border_points[5] = wxPoint(tab_x+tab_width,   tab_y+tab_height-4);    }    // TODO: else if (m_flags &wxAUI_NB_LEFT) {}    // TODO: else if (m_flags &wxAUI_NB_RIGHT) {}    int drawn_tab_yoff = border_points[1].y;    int drawn_tab_height = border_points[0].y - border_points[1].y;    if (page.active)    {        // draw active tab        // draw base background color        wxRect r(tab_x, tab_y, tab_width, tab_height);        dc.SetPen(wxPen(m_activeColour));        dc.SetBrush(wxBrush(m_activeColour));        dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4);        // this white helps fill out the gradient at the top of the tab        dc.SetPen(*wxWHITE_PEN);        dc.SetBrush(*wxWHITE_BRUSH);        dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4);        // these two points help the rounded corners appear more antialiased        dc.SetPen(wxPen(m_activeColour));        dc.DrawPoint(r.x+2, r.y+1);        dc.DrawPoint(r.x+r.width-2, r.y+1);        // set rectangle down a bit for gradient drawing        r.SetHeight(r.GetHeight()/2);        r.x += 2;        r.width -= 3;        r.y += r.height;        r.y -= 2;        // draw gradient background        wxColor top_color = *wxWHITE;        wxColor bottom_color = m_activeColour;        dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH);    }    else    {        // draw inactive tab        wxRect r(tab_x, tab_y+1, tab_width, tab_height-3);        // start the gradent up a bit and leave the inside border inset
开发者ID:futurepr0n,项目名称:wxWidgets,代码行数:67,


示例11: GetCanvasPixLL

bool IACSystem::Draw(wxDC *dc, PlugIn_ViewPort *vp, TexFont &numfont, TexFont &sysfont) {    bool hasDrawn = false;    if (dc) {        if (m_positions.GetCount() == 1) {            GeoPoint &Pos = m_positions[0];            if (PointInLLBox(vp, Pos.x, Pos.y)) {                wxPoint p;                GetCanvasPixLL(vp, &p, Pos.y, Pos.x);                wxColour colour;                wxString msg1 = GetShortType(m_type);                if (!msg1.IsEmpty()) {                    hasDrawn = true;                    GetGlobalColor(_T ( "UBLCK" ), &colour);                    dc->SetTextForeground(colour);                    wxFont sfont = dc->GetFont();                    wxFont *font1 = wxTheFontList->FindOrCreateFont(SYSTEMS_FONT_SIZE, wxFONTFAMILY_ROMAN, wxNORMAL,                                                                    wxFONTWEIGHT_BOLD, FALSE, wxString(_T ( "Arial" )));                    dc->SetFont(*font1);                    wxSize s1 = dc->GetTextExtent(msg1);                    dc->DrawText(msg1, p.x - (s1.GetWidth() / 2), p.y - (s1.GetHeight() / 2));                    wxFont *font2 = wxTheFontList->FindOrCreateFont(NUMBERS_FONT_SIZE, wxFONTFAMILY_SWISS, wxITALIC,                                                                    wxFONTWEIGHT_NORMAL, FALSE, wxString(_T ( "Arial" )));                    dc->SetFont(*font2);                    wxString msg2 = GetValue();                    if (!msg2.IsEmpty()) {                        wxSize s2 = dc->GetTextExtent(msg2);                        dc->DrawText(msg2, p.x - (s2.GetWidth() / 2), p.y + (s1.GetHeight() / 2) + (s2.GetHeight() / 2));                        dc->SetFont(sfont);                    }                }            }        } else {            wxColour colour;            wxPen pen;            pen = dc->GetPen();            GetGlobalColor(_T ( "GREEN2" ), &colour);            dc->SetPen(wxPen(colour, m_isoLineWidth));            DrawPositions(dc, vp);            dc->SetPen(pen);        }    } else {        if (m_positions.GetCount() == 1) {            GeoPoint &Pos = m_positions[0];            if (PointInLLBox(vp, Pos.x, Pos.y)) {                wxPoint p;                GetCanvasPixLL(vp, &p, Pos.y, Pos.x);                wxColour colour;                wxString msg1 = GetShortType(m_type);                if (!msg1.IsEmpty()) {                    hasDrawn = true;                    glEnable(GL_BLEND);                    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);                    wxPoint p;                    GetCanvasPixLL(vp, &p, Pos.y, Pos.x);                    int w, h;                    sysfont.GetTextExtent(msg1, &w, &h);                    int xd = p.x - (w / 2);                    int yd = p.y - (h / 2);                    GetGlobalColor(_T ( "UBLCK" ), &colour);                    glColor3ub(colour.Red(), colour.Green(), colour.Blue());                    glEnable(GL_TEXTURE_2D);                    sysfont.RenderString(msg1, xd, yd);                    wxString msg2 = GetValue();                    if (!msg2.IsEmpty()) {                        int w1, h1;                        numfont.GetTextExtent(msg2, &w1, &h1);                        numfont.RenderString(msg2, p.x - (w1 / 2), p.y + (h / 2) + (h1 / 2));                    }                    glDisable(GL_TEXTURE_2D);                    glDisable(GL_BLEND);                }            }        } else {            wxColour colour = m_isoLineColor;            GetGlobalColor(_T ( "GREEN2" ), &m_isoLineColor);            DrawPositions(dc, vp);            m_isoLineColor = colour;        }    }    return hasDrawn;}
开发者ID:rgleason,项目名称:iacfleet_pi,代码行数:87,


示例12: dc

void FreqWindow::PlotPaint(wxPaintEvent & evt){   wxPaintDC dc( (wxWindow *) evt.GetEventObject() );   dc.DrawBitmap( *mBitmap, 0, 0, true );   if( mProcessed == NULL )      return;   int alg = mAlgChoice->GetSelection();   dc.SetFont(mFreqFont);   wxRect r = mPlotRect;   int width = r.width - 2;   float xMin, xMax, xPos, xRatio, xLast, xStep;   if (alg == 0) {      xMin = mRate / mWindowSize;      xMax = mRate / 2;      xRatio = xMax / xMin;      xPos = xMin;      xLast = xPos / 2.0;      if (mLogAxis)         xStep = pow(2.0f, (log(xRatio) / log(2.0f)) / width);      else         xStep = (xMax - xMin) / width;   } else {      xMin = 0;      xMax = mProcessedSize / mRate;      xPos = xMin;      xLast = xPos / 2.0;      xStep = (xMax - xMin) / width;   }   // Find the peak nearest the cursor and plot it   float bestpeak = float(0.0);   if ( r.Contains(mMouseX, mMouseY) & (mMouseX!=0) & (mMouseX!=r.width-1) ) {      if (mLogAxis)         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));      else         xPos = xMin + xStep * (mMouseX - (r.x + 1));      bool up = (mProcessed[1] > mProcessed[0]);      float bestdist = 1000000;      float bestValue = 0.0;      for (int bin = 2; bin < mProcessedSize; bin++) {         bool nowUp = mProcessed[bin] > mProcessed[bin - 1];         if (!nowUp && up) {            // Local maximum.  Find actual value by cubic interpolation            int leftbin = bin - 2;            if (leftbin < 1)               leftbin = 1;            float valueAtMax = 0.0;            float max = leftbin + CubicMaximize(mProcessed[leftbin],                                                mProcessed[leftbin + 1],                                                mProcessed[leftbin + 2],                                                mProcessed[leftbin + 3], &valueAtMax);            float thispeak;            if (alg == 0)               thispeak = max * mRate / mWindowSize;            else               thispeak = max / mRate;            if (fabs(thispeak - xPos) < bestdist) {               bestpeak = thispeak;               bestdist = fabs(thispeak - xPos);               bestValue = valueAtMax;               if (thispeak > xPos)                  break;            }         }         up = nowUp;      }      int px;      if (mLogAxis)         px = int (log(bestpeak / xMin) / log(xStep));      else         px = int ((bestpeak - xMin) * width / (xMax - xMin));      dc.SetPen(wxPen(wxColour(160,160,160), 1, wxSOLID));      AColor::Line(dc, r.x + 1 + px, r.y, r.x + 1 + px, r.y + r.height);       // print out info about the cursor location      float value;      if (mLogAxis) {         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));         value = GetProcessedValue(xPos, xPos * xStep);      } else {         xPos = xMin + xStep * (mMouseX - (r.x + 1));         value = GetProcessedValue(xPos, xPos + xStep);      }      wxString info;//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,


示例13: WXUNUSED

void wxSymbolListCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)){    // If size is larger, recalculate double buffer bitmap    wxSize clientSize = GetClientSize();    if ( !m_doubleBuffer ||         clientSize.x > m_doubleBuffer->GetWidth() ||         clientSize.y > m_doubleBuffer->GetHeight() )    {        delete m_doubleBuffer;        m_doubleBuffer = new wxBitmap(clientSize.x+25,clientSize.y+25);    }    wxBufferedPaintDC dc(this,*m_doubleBuffer);    // the update rectangle    wxRect rectUpdate = GetUpdateClientRect();    // fill it with background colour    dc.SetBackground(GetBackgroundColour());    dc.Clear();    // set the font to be displayed    dc.SetFont(GetFont());    // the bounding rectangle of the current line    wxRect rectRow;    rectRow.width = clientSize.x;    dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));    dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));    dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);    // iterate over all visible lines    const size_t lineMax = GetVisibleEnd();    for ( size_t line = GetVisibleBegin(); line < lineMax; line++ )    {        const wxCoord hRow = OnGetRowHeight(line);        rectRow.height = hRow;        // and draw the ones which intersect the update rect        if ( rectRow.Intersects(rectUpdate) )        {            // don't allow drawing outside of the lines rectangle            wxDCClipper clip(dc, rectRow);            wxRect rect = rectRow;            rect.Deflate(m_ptMargins.x, m_ptMargins.y);            OnDrawItem(dc, rect, line);        }        else // no intersection        {            if ( rectRow.GetTop() > rectUpdate.GetBottom() )            {                // we are already below the update rect, no need to continue                // further                break;            }            //else: the next line may intersect the update rect        }        rectRow.y += hRow;    }}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:65,


示例14: wxRect

void CLMainAuiTBArt::DrawDropDownButton(wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& item, const wxRect& rect){    wxAuiDefaultToolBarArt::DrawDropDownButton(dc, wnd, item, rect);#if 0    // Dark theme    int textWidth = 0, textHeight = 0, textX = 0, textY = 0;    int bmpX = 0, bmpY = 0, dropBmpX = 0, dropBmpY = 0;    wxRect buttonRect = wxRect(rect.x, rect.y, rect.width - BUTTON_DROPDOWN_WIDTH, rect.height);    wxRect dropDownRect =        wxRect(rect.x + rect.width - BUTTON_DROPDOWN_WIDTH - 1, rect.y, BUTTON_DROPDOWN_WIDTH + 1, rect.height);    if(m_flags & wxAUI_TB_TEXT) {        dc.SetFont(m_font);        int tx, ty;        if(m_flags & wxAUI_TB_TEXT) {            dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight);            textWidth = 0;        }        dc.GetTextExtent(item.GetLabel(), &textWidth, &ty);    }    dropBmpX = dropDownRect.x + (dropDownRect.width / 2) - (m_buttonDropDownBmp.GetWidth() / 2);    dropBmpY = dropDownRect.y + (dropDownRect.height / 2) - (m_buttonDropDownBmp.GetHeight() / 2);    if(m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) {        bmpX = buttonRect.x + (buttonRect.width / 2) - (item.GetBitmap().GetWidth() / 2);        bmpY = buttonRect.y + ((buttonRect.height - textHeight) / 2) - (item.GetBitmap().GetHeight() / 2);        textX = rect.x + (rect.width / 2) - (textWidth / 2) + 1;        textY = rect.y + rect.height - textHeight - 1;    } else if(m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT) {        bmpX = rect.x + 3;        bmpY = rect.y + (rect.height / 2) - (item.GetBitmap().GetHeight() / 2);        textX = bmpX + 3 + item.GetBitmap().GetWidth();        textY = rect.y + (rect.height / 2) - (textHeight / 2);    }    if(item.GetState() & wxAUI_BUTTON_STATE_PRESSED) {        dc.SetPen(wxPen(m_highlightColour));        dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(140)));        dc.DrawRectangle(buttonRect);        dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170)));        dc.DrawRectangle(dropDownRect);    } else if(item.GetState() & wxAUI_BUTTON_STATE_HOVER || item.IsSticky()) {        dc.SetPen(wxPen(m_highlightColour));        dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170)));        dc.DrawRectangle(buttonRect);        dc.DrawRectangle(dropDownRect);    } else if(item.GetState() & wxAUI_BUTTON_STATE_CHECKED) {        // Notice that this branch must come after the hover one to ensure the        // correct appearance when the mouse hovers over a checked item.m_        dc.SetPen(wxPen(m_highlightColour));        dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170)));        dc.DrawRectangle(buttonRect);        dc.DrawRectangle(dropDownRect);    }    wxBitmap bmp;    wxBitmap dropbmp;    if(item.GetState() & wxAUI_BUTTON_STATE_DISABLED) {        bmp = CreateDisabledBitmap(item.GetBitmap());        dropbmp = m_disabledButtonDropDownBmp;    } else {        bmp = item.GetBitmap();        dropbmp = m_buttonDropDownBmp;    }    if(!bmp.IsOk()) return;    dc.DrawBitmap(bmp, bmpX, bmpY, true);    dc.DrawBitmap(dropbmp, dropBmpX, dropBmpY, true);    // set the item's text color based on if it is disabled    dc.SetTextForeground(*wxBLACK);    if(item.GetState() & wxAUI_BUTTON_STATE_DISABLED) dc.SetTextForeground(DISABLED_TEXT_COLOR);    if((m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty()) {        dc.DrawText(item.GetLabel(), textX, textY);    }#endif}
开发者ID:292388900,项目名称:codelite,代码行数:87,


示例15: if

void CLMainAuiTBArt::DrawButton(wxDC& dc, wxWindow* wnd, const wxAuiToolBarItem& item, const wxRect& rect){    wxAuiDefaultToolBarArt::DrawButton(dc, wnd, item, rect);#if 0    // if(!DrawingUtils::IsThemeDark()) {    //     wxAuiDefaultToolBarArt::DrawButton(dc, wnd, item, rect);    //     return;    // }    int textWidth = 0, textHeight = 0;    if(m_flags & wxAUI_TB_TEXT) {        dc.SetFont(m_font);        int tx, ty;        dc.GetTextExtent(wxT("ABCDHgj"), &tx, &textHeight);        textWidth = 0;        dc.GetTextExtent(item.GetLabel(), &textWidth, &ty);    }    int bmpX = 0, bmpY = 0;    int textX = 0, textY = 0;    if(m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM) {        bmpX = rect.x + (rect.width / 2) - (item.GetBitmap().GetWidth() / 2);        bmpY = rect.y + ((rect.height - textHeight) / 2) - (item.GetBitmap().GetHeight() / 2);        textX = rect.x + (rect.width / 2) - (textWidth / 2) + 1;        textY = rect.y + rect.height - textHeight - 1;    } else if(m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT) {        bmpX = rect.x + 3;        bmpY = rect.y + (rect.height / 2) - (item.GetBitmap().GetHeight() / 2);        textX = bmpX + 3 + item.GetBitmap().GetWidth();        textY = rect.y + (rect.height / 2) - (textHeight / 2);    }    if(!(item.GetState() & wxAUI_BUTTON_STATE_DISABLED)) {        if(item.GetState() & wxAUI_BUTTON_STATE_PRESSED) {            dc.SetPen(wxPen(m_highlightColour));            dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(150)));            dc.DrawRectangle(rect);        } else if((item.GetState() & wxAUI_BUTTON_STATE_HOVER) || item.IsSticky()) {            dc.SetPen(wxPen(m_highlightColour));            dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170)));            // draw an even lighter background for checked item hovers (since            // the hover background is the same color as the check background)            if(item.GetState() & wxAUI_BUTTON_STATE_CHECKED)                dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(180)));            dc.DrawRectangle(rect);        } else if(item.GetState() & wxAUI_BUTTON_STATE_CHECKED) {            // it's important to put this code in an else statement after the            // hover, otherwise hovers won't draw properly for checked items            dc.SetPen(wxPen(m_highlightColour));            dc.SetBrush(wxBrush(m_highlightColour.ChangeLightness(170)));            dc.DrawRectangle(rect);        }    }    wxBitmap bmp;    if(item.GetState() & wxAUI_BUTTON_STATE_DISABLED) {        bmp = CreateDisabledBitmap(item.GetBitmap());    } else        bmp = item.GetBitmap();    if(bmp.IsOk()) dc.DrawBitmap(bmp, bmpX, bmpY, true);    // set the item's text color based on if it is disabled    dc.SetTextForeground(*wxBLACK);    if(item.GetState() & wxAUI_BUTTON_STATE_DISABLED) dc.SetTextForeground(DISABLED_TEXT_COLOR);    if((m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty()) {        dc.DrawText(item.GetLabel(), textX, textY);    }#endif}
开发者ID:292388900,项目名称:codelite,代码行数:81,


示例16: WXUNUSED

void EffectAutoDuckPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)){   int clientWidth, clientHeight;   GetSize(&clientWidth, &clientHeight);   if (!mBackgroundBitmap || mBackgroundBitmap->GetWidth() != clientWidth ||       mBackgroundBitmap->GetHeight() != clientHeight)   {      if (mBackgroundBitmap)         delete mBackgroundBitmap;      mBackgroundBitmap = new wxBitmap(clientWidth, clientHeight);   }   wxMemoryDC dc;   dc.SelectObject(*mBackgroundBitmap);   dc.SetBrush(*wxWHITE_BRUSH);   dc.SetPen(*wxBLACK_PEN);   dc.DrawRectangle(0, 0, clientWidth, clientHeight);   dc.SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL,                     wxFONTWEIGHT_NORMAL));   dc.SetTextForeground(*wxBLACK);   dc.SetTextBackground(*wxWHITE);   double duckAmountDb = 0;   double innerFadeDownLen = 0;   double innerFadeUpLen = 0;   double outerFadeDownLen = 0;   double outerFadeUpLen = 0;   mEffect->mDuckAmountDbBox->GetValue().ToDouble(&duckAmountDb);   mEffect->mInnerFadeDownLenBox->GetValue().ToDouble(&innerFadeDownLen);   mEffect->mInnerFadeUpLenBox->GetValue().ToDouble(&innerFadeUpLen);   mEffect->mOuterFadeDownLenBox->GetValue().ToDouble(&outerFadeDownLen);   mEffect->mOuterFadeUpLenBox->GetValue().ToDouble(&outerFadeUpLen);   if (innerFadeDownLen < MIN_InnerFadeDownLen || innerFadeDownLen > MAX_InnerFadeDownLen ||       innerFadeUpLen < MIN_InnerFadeUpLen     || innerFadeUpLen > MAX_InnerFadeUpLen     ||       outerFadeDownLen < MIN_OuterFadeDownLen || outerFadeDownLen > MAX_OuterFadeDownLen ||       outerFadeUpLen < MIN_OuterFadeUpLen     || outerFadeUpLen > MAX_OuterFadeUpLen     ||       duckAmountDb < MIN_DuckAmountDb         || duckAmountDb > MAX_DuckAmountDb)   {      // values are out of range, no preview available      wxString message = wxString::Format(_("Preview not available"));      int textWidth = 0, textHeight = 0;      dc.GetTextExtent(message, &textWidth, &textHeight);      dc.DrawText(message, (clientWidth - textWidth) / 2,                           (clientHeight - textHeight) / 2);      ResetControlPoints();   } else   {      // draw preview      dc.SetBrush(*wxTRANSPARENT_BRUSH);      dc.SetPen(wxPen(theTheme.Colour(clrGraphLines), 3, wxSOLID));      wxPoint points[6];      points[0].x = 10;      points[0].y = DUCK_AMOUNT_START;      points[1].x = FADE_DOWN_START - (int)(outerFadeDownLen * FADE_SCALE);      points[1].y = DUCK_AMOUNT_START;      points[2].x = FADE_DOWN_START + (int)(innerFadeDownLen * FADE_SCALE);      points[2].y = DUCK_AMOUNT_START -         (int)(duckAmountDb * DUCK_AMOUNT_SCALE);      points[3].x = FADE_UP_START - (int)(innerFadeUpLen * FADE_SCALE);      points[3].y = DUCK_AMOUNT_START -         (int)(duckAmountDb * DUCK_AMOUNT_SCALE);      points[4].x = FADE_UP_START + (int)(outerFadeUpLen * FADE_SCALE);      points[4].y = DUCK_AMOUNT_START;      points[5].x = clientWidth - 10;      points[5].y = DUCK_AMOUNT_START;      dc.DrawLines(6, points);      dc.SetPen(wxPen(*wxBLACK, 1, wxDOT));      AColor::Line(dc, FADE_DOWN_START, 10, FADE_DOWN_START, clientHeight - 10);      AColor::Line(dc, FADE_UP_START, 10, FADE_UP_START, clientHeight - 10);      dc.SetPen(AColor::envelopePen);      dc.SetBrush(*wxWHITE_BRUSH);      mControlPoints[outerFadeDown] = points[1];      mControlPoints[innerFadeDown] = points[2];      mControlPoints[innerFadeUp] = points[3];      mControlPoints[outerFadeUp] = points[4];      mControlPoints[duckAmount] = wxPoint(         (points[2].x + points[3].x) / 2, points[2].y);      for (int i = 0; i < AUTO_DUCK_PANEL_NUM_CONTROL_POINTS; i++)      {         EControlPoint cp = (EControlPoint)i;         int digits;         float value;//.........这里部分代码省略.........
开发者ID:MayTheSForceBeWithYou,项目名称:audacity,代码行数:101,


示例17: dc

void FilterPanel::OnPaint(wxPaintEvent & evt){   wxPaintDC dc(this);   int width, height;   GetSize(&width, &height);    if (!mBitmap || mWidth!=width || mHeight!=height) {      if (mBitmap)         delete mBitmap;      mWidth = width;      mHeight = height;      mBitmap = new wxBitmap(mWidth, mHeight);   }     wxMemoryDC memDC;   memDC.SelectObject(*mBitmap);   wxRect border;   border.x = 0;   border.y = 0;   border.width = mWidth;   border.height = mHeight;   memDC.SetBrush(*wxWHITE_BRUSH);   memDC.SetPen(*wxBLACK_PEN);   memDC.DrawRectangle(border);   mEnvRect = border;   mEnvRect.x += 4;   mEnvRect.width -= 10;   mEnvRect.y += 3;   mEnvRect.height -= 6;   // Pure blue x-axis line   memDC.SetPen(wxPen(wxColour(0, 0, 255), 1, wxSOLID));   int center = mEnvRect.height/2;   memDC.DrawLine(0, center, mEnvRect.width, center);   // Med-blue envelope line   memDC.SetPen(wxPen(wxColour(110, 110, 220), 3, wxSOLID));   // Draw envelope   double *values = new double[mEnvRect.width];   mEnvelope->GetValues(values, mEnvRect.width, 0.0, 1.0/mEnvRect.width);   int x, y, xlast = 0, ylast = 0;   for(int i=0; i<mEnvRect.width; i++) {      x = mEnvRect.x + i;      y = (int)(mEnvRect.height-mEnvRect.height*values[i]);      if (i != 0) {         memDC.DrawLine(xlast, ylast,                        x, y);      }      xlast = x;      ylast = y;         }   delete[] values;   memDC.SetPen(*wxBLACK_PEN);   mEnvRect.y -= 5;   mEnvelope->Draw(memDC, mEnvRect, 0.0, mEnvRect.width, false);   mEnvRect.y += 5;   // Paint border again   memDC.SetBrush(*wxTRANSPARENT_BRUSH);   memDC.SetPen(*wxBLACK_PEN);   memDC.DrawRectangle(border);   dc.Blit(0, 0, mWidth, mHeight,           &memDC, 0, 0, wxCOPY, FALSE);}
开发者ID:andreipaga,项目名称:audacity,代码行数:72,


示例18: wxPen

void wxStatusBarGeneric::InitColours(){    m_mediumShadowPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));    m_hilightPen = wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHILIGHT));}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:5,


示例19: wxBitmap

//.........这里部分代码省略.........   } else {      vRuler->ruler.SetUnits(wxT(""));      vRuler->ruler.SetFormat(Ruler::RealFormat);   }   int w1, w2, h;   vRuler->ruler.GetMaxSize(&w1, &h);   vRuler->ruler.SetRange(mYMax, mYMin); // Note inversion for vertical.   vRuler->ruler.GetMaxSize(&w2, &h);   if( w1 != w2 )   // Reduces flicker   {      vRuler->SetSize(wxSize(w2,h));      szr->Layout();      hRuler->Refresh(false);   }   vRuler->Refresh(false);   // Set up x axis ruler   int width = r.width - 2;   float xMin, xMax, xPos, xRatio, xLast, xStep;   if (alg == 0) {      xMin = mRate / mWindowSize;      xMax = mRate / 2;      xRatio = xMax / xMin;      xPos = xMin;      xLast = xPos / 2.0;      if (mLogAxis)      {         xStep = pow(2.0f, (log(xRatio) / log(2.0f)) / width);         hRuler->ruler.SetLog(true);      }      else      {         xStep = (xMax - xMin) / width;         hRuler->ruler.SetLog(false);      }      hRuler->ruler.SetUnits(_("Hz"));   } else {      xMin = 0;      xMax = mProcessedSize / mRate;      xPos = xMin;      xLast = xPos / 2.0;      xStep = (xMax - xMin) / width;      hRuler->ruler.SetLog(false);      hRuler->ruler.SetUnits(_("s"));   }   hRuler->ruler.SetRange(xMin, xMax-xStep);   hRuler->Refresh(false);   // Draw the plot   if (alg == 0)      memDC.SetPen(wxPen(theTheme.Colour( clrHzPlot ), 1, wxSOLID));   else      memDC.SetPen(wxPen(theTheme.Colour( clrWavelengthPlot), 1, wxSOLID));   xPos = xMin;   for (i = 0; i < width; i++) {      float y;      if (mLogAxis)         y = GetProcessedValue(xPos, xPos * xStep);      else         y = GetProcessedValue(xPos, xPos + xStep);      float ynorm = (y - mYMin) / yTotal;      int lineheight = int (ynorm * (r.height - 1));      if (lineheight > r.height - 2)         lineheight = r.height - 2;      if (ynorm > 0.0)         AColor::Line(memDC, r.x + 1 + i, r.y + r.height - 1 - lineheight,                        r.x + 1 + i, r.y + r.height - 1);      if (mLogAxis)         xPos *= xStep;      else         xPos += xStep;   }   // Outline the graph   memDC.SetPen(*wxBLACK_PEN);   memDC.SetBrush(*wxTRANSPARENT_BRUSH);   memDC.DrawRectangle(r);   if(mDrawGrid)   {      hRuler->ruler.DrawGrid(memDC, r.height, true, true, 1, 1);      vRuler->ruler.DrawGrid(memDC, r.width, true, true, 1, 1);   }   memDC.SelectObject( wxNullBitmap );   mBitmap->SetMask( new wxMask( *mBitmap, wxColour(254, 254, 254) ) );}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,


示例20: DigitX

voidwxLCDWindow::DrawSegment(wxDC* dc, int digit, int seg, bool state){    int sl = m_segLen;    int sw = m_segWidth;    int x = DigitX(digit);    int y = DigitY(digit);    wxBrush brushOn(m_lightColr, wxSOLID);    wxBrush brushOff(m_grayColr, wxSOLID);    if (state) {        dc->SetBrush(brushOn);    }    else {        dc->SetBrush(brushOff);    }    dc->SetPen(wxPen(GetBackgroundColour(), 1, wxSOLID));    wxPoint points[4];    switch(seg) {    case 0:        points[0].x = x;        points[0].y = y;        points[1].x = x + sl;        points[1].y = y;        points[2].x = x + sl - sw;        points[2].y = y + sw;        points[3].x = x + sw;        points[3].y = y + sw;        break;    case 5:        y += 2 * sl - sw;        points[0].x = x + sw;        points[0].y = y;        points[1].x = x + sl - sw;        points[1].y = y;        points[2].x = x + sl;        points[2].y = y + sw;        points[3].x = x;        points[3].y = y + sw;        break;    case 4:        y += sl;        x += sl - sw;        points[0].x = x;        points[0].y = y + sw / 2;        points[1].x = x + sw;        points[1].y = y;        points[2].x = x + sw;        points[2].y = y + sl;        points[3].x = x;        points[3].y = y + sl - sw;        break;        case 2:        x += sl - sw;        points[0].x = x;        points[0].y = y + sw;        points[1].x = x + sw;        points[1].y = y;        points[2].x = x + sw;        points[2].y = y + sl;        points[3].x = x;        points[3].y = y + sl - sw / 2;        break;    case 3:        y += sl;        points[0].x = x;        points[0].y = y;        points[1].x = x;        points[1].y = y + sl;        points[2].x = x + sw;        points[2].y = y + sl - sw;        points[3].x = x + sw;        points[3].y = y + sw - sw / 2;        break;    case 1:        points[0].x = x;        points[0].y = y;        points[1].x = x;        points[1].y = y + sl;        points[2].x = x + sw;        points[2].y = y + sl - sw / 2;        points[3].x = x + sw;        points[3].y = y + sw;        break;    case 6:    default:        break;    }    if (seg < 6) {        dc->DrawPolygon(4, points);    }        if (seg == 6) {        y += sl - sw / 2;//.........这里部分代码省略.........
开发者ID:mju-oss-13-c,项目名称:Team7-ScoreBoard,代码行数:101,


示例21: wxDynamicCast

void EDA_DOCKART::DrawBorder( wxDC& aDC, wxWindow* aWindow, const wxRect& aRect,                              wxAuiPaneInfo& aPane ){    const wxRect& r = aRect;    aDC.SetPen( m_borderPen );    aDC.SetBrush( *wxTRANSPARENT_BRUSH );    // notebooks draw the border themselves, so they can use native rendering (e.g. tabartgtk)    wxAuiTabArt* art = nullptr;    wxAuiNotebook* nb = wxDynamicCast( aWindow, wxAuiNotebook );    if( nb )        art = nb->GetArtProvider();    if( art )    {        art->DrawBorder( aDC, aWindow, r );    }    else if( aPane.name == "DrawFrame" || aPane.name == "DrawFrameGal" )    {        // We don't want to re-write the layout manager, so we give the canvas a single-pixel        // border and then fill in the top and left with the canvas background colour.        //        // This achieves a right-bottom-bordered canvas, which works reasonably well with        // wxWidgets right-bottom bordered toolbars.        //wxWindow* window = reinterpret_cast<wxWindow*>( m_frame->GetCanvas() );        //wxSize scrollbarSize = window->GetSize() - window->GetClientSize();        // Not sure why it takes a pen twice as wide as the border to fill it in, but it does.        #if 0        int borderWidth = GetMetric( wxAUI_DOCKART_PANE_BORDER_SIZE ) * 2;        int borderAdjust = borderWidth;        aDC.SetPen( wxPen( m_frame->GetDrawBgColor().ToColour(), borderWidth ) );        // Yes, this leaves me scratching my head too.        if( m_frame->IsType( FRAME_PCB )         || m_frame->IsType( FRAME_PCB_MODULE_EDITOR )         || m_frame->IsType( FRAME_PCB_MODULE_VIEWER )         || m_frame->IsType( FRAME_PCB_MODULE_VIEWER_MODAL )         || m_frame->IsType( FRAME_GERBER ) )        {            borderAdjust += 1;        }        // left        aDC.DrawLine( r.x + 1, r.y, r.x + 1, r.y + r.height - borderAdjust - scrollbarSize.y );        // top        aDC.DrawLine( r.x + 1, r.y, r.x + r.width - borderAdjust - scrollbarSize.x, r.y );        aDC.SetPen( m_borderPen );        // finish off bottom of left side (at end of scrollbar)        aDC.DrawLine( r.x, r.y + r.height - 1 - scrollbarSize.y, r.x, r.y + r.height - 1 );        // right        aDC.DrawLine( r.x + r.width, r.y, r.x + r.width, r.y + r.height - 1 );        // bottom        aDC.DrawLine( r.x, r.y + r.height - 1, r.x + r.width - 1, r.y + r.height - 1 );        #endif    }    else    {        aDC.DrawRectangle( r );    }}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:65,


示例22: pxGetFixedFont

void CtrlRegisterList::OnDraw(wxDC& dc){	wxFont font = pxGetFixedFont(8);	font.SetPixelSize(wxSize(charWidth,rowHeight-2));	dc.SetFont(font);	refreshChangedRegs();	wxColor colorChanged = wxColor(0xFF0000FF);	wxColor colorUnchanged = wxColor(0xFF004000);	wxColor colorNormal = wxColor(0xFF600000);	int startRow;	GetViewStart(nullptr,&startRow);	int endRow = startRow + ceil(float(GetClientSize().y) / rowHeight);	// draw categories	int width = GetClientSize().x;	if (startRow == 0)	{		int piece = width /cpu->getRegisterCategoryCount();		for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)		{			const char* name = cpu->getRegisterCategoryName(i);			int x = i*piece;			if (i == category)			{				dc.SetBrush(wxBrush(wxColor(0xFF70FF70)));				dc.SetPen(wxPen(wxColor(0xFF000000)));			} else {				dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));				dc.SetPen(wxPen(wxColor(0xFF000000)));			}			if (i == cpu->getRegisterCategoryCount()-1)				piece += width-piece*cpu->getRegisterCategoryCount()-1;					dc.DrawRectangle(x,0,piece+1,rowHeight);			// center text			x += (piece-strlen(name)*charWidth)/2;			dc.DrawText(wxString(name,wxConvUTF8),x,2);		}	}	// skip the tab row	startRow = std::max<int>(0,startRow-1);	endRow = std::min<int>(cpu->getRegisterCount(category)-1,endRow-1);	int nameStart = 17;	int valueStart = startPositions[category];	ChangedReg* changedRegs = changedCategories[category];	int registerBits = cpu->getRegisterSize(category);	DebugInterface::RegisterType type = cpu->getRegisterType(category);	for (int i = startRow; i <= endRow; i++)	{		int x = valueStart;		int y = rowHeight*(i+1);		wxColor backgroundColor;		if (currentRows[category] == i)			backgroundColor = wxColor(0xFFFFCFC8);		else if (i % 2)			backgroundColor = wxColor(237, 242, 255, 255);		else			backgroundColor = wxColor(0xFFFFFFFF);		dc.SetBrush(backgroundColor);		dc.SetPen(backgroundColor);		dc.DrawRectangle(0, y, width, rowHeight);		const char* name = cpu->getRegisterName(category,i);		dc.SetTextForeground(colorNormal);		dc.DrawText(wxString(name,wxConvUTF8),nameStart,y+2);		u128 value = cpu->getRegister(category,i);		ChangedReg& changed = changedRegs[i];		switch (type)		{		case DebugInterface::NORMAL:	// display them in 32 bit parts			switch (registerBits)			{			case 128:				{					int startIndex = std::min<int>(3, maxBits / 32 - 1);					if (resolvePointerStrings && cpu->isAlive()) {						char *strval = cpu->stringFromPointer(value._u32[0]);						if (strval) {							static wxColor clr = wxColor(0xFF228822);							dc.SetTextForeground(clr);							dc.DrawText(wxString(strval), width - (32 * charWidth + 12), y + 2);							startIndex = 0;						}					}//.........这里部分代码省略.........
开发者ID:AdmiralCurtiss,项目名称:pcsx2,代码行数:101,


示例23: text

//------------------------------------------------------------------------------//          custom renderer//------------------------------------------------------------------------------void CustomRenderer::Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, const wxRect& rect, int row, int col, bool isSelected){    dc.SetPen(wxPen(attr.GetBackgroundColour(), 1));    dc.SetBrush(wxBrush( attr.GetBackgroundColour(), wxBRUSHSTYLE_SOLID ));    dc.DrawRectangle( rect );    if( m_IsDigit || m_dDir == GRIB_NOTDEF ) {        //digital format        wxString text(wxEmptyString);        if( m_dDir != GRIB_NOTDEF )            text.Printf(_T("%03d/u00B0"), (int)m_dDir);        dc.DrawLabel(text, rect, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL);    } else {                                        //graphical format        double si = sin( (m_dDir - 90) * M_PI / 180. );        double co = cos( (m_dDir - 90) * M_PI / 180. );        int i = rect.GetTopLeft().x + (rect.GetWidth() / 2);        int j = rect.GetTopLeft().y + (rect.GetHeight() / 2);        int arrowSize = rect.GetHeight() - 3;        int dec = -arrowSize / 2;#if wxUSE_GRAPHICS_CONTEXT        wxGraphicsContext *gdc;        wxClientDC *cdc = new wxClientDC(wxDynamicCast( &grid, wxWindow));        cdc = wxDynamicCast(&dc, wxClientDC);        if( cdc ) {            gdc = wxGraphicsContext::Create(*cdc);#ifdef __WXGTK__            /*platforms don't manage the same way the gdc origin            for linux, we have to re-compute the good one.            To DO : verify it works on all other plateforms (done for MSW*/            bool vis = false;            int r = 0;            for( int c = 0; c < grid.GetNumberCols(); c++){                for(r = 0; r < grid.GetNumberRows(); r++) {                    if(grid.IsVisible(r, c)){  //find the first row/col                        vis = true;                        i -= (c * grid.GetColSize(0));                        j -= (r * grid.GetRowHeight(0));                        break;                    }                }                if(vis) break;            }#endif            gdc->SetPen(wxPen(attr.GetTextColour(), 3));            gdc->SetBrush(wxBrush( attr.GetBackgroundColour(), wxBRUSHSTYLE_SOLID ));            double ii, jj, kk, ll;            GetArrowsPoints( si, co, i, j, dec, 0, dec + arrowSize, 0, ii, jj, kk, ll );            gdc->StrokeLine( ii, jj, kk, ll );            GetArrowsPoints( si, co, i, j, dec - 3, 0, dec + 5, 3, ii, jj, kk, ll );            gdc->StrokeLine( ii, jj, kk, ll );            GetArrowsPoints( si, co, i, j, dec - 3, 0, dec + 5, -3, ii, jj, kk, ll );            gdc->StrokeLine( ii, jj, kk, ll );            delete gdc;        } else#endif        {            dc.SetPen(wxPen(attr.GetTextColour(), 3));            double ii, jj, kk, ll;            GetArrowsPoints( si, co, i, j, dec, 0, dec + arrowSize, 0, ii, jj, kk, ll );            dc.DrawLine( (int)ii, (int)jj, (int)kk, (int)ll );            GetArrowsPoints( si, co, i, j, dec - 3, 0, dec + 5, 3, ii, jj, kk, ll );            dc.DrawLine( (int)ii, (int)jj, (int)kk, (int)ll );            GetArrowsPoints( si, co, i, j, dec - 3, 0, dec + 5, -3, ii, jj, kk, ll );            dc.DrawLine( (int)ii, (int)jj, (int)kk, (int)ll );        }    }}
开发者ID:OpenCPN,项目名称:OpenCPN,代码行数:72,


示例24: DrawBackground

//.........这里部分代码省略.........   }   int w1, w2, h;   vRuler->ruler.GetMaxSize(&w1, &h);   vRuler->ruler.SetRange(yMax, yMin); // Note inversion for vertical.   vRuler->ruler.GetMaxSize(&w2, &h);   if( w1 != w2 )   // Reduces flicker   {      vRuler->SetMinSize(wxSize(w2,h));      Layout();   }   vRuler->Refresh(false);   wxMemoryDC memDC;   DrawBackground(memDC);   // Get the plot dimensions   //   // Must be done after setting the vertical ruler above since the   // the width could change.   wxRect r = mPlotRect;   // Set up x axis ruler   int width = r.width - 2;   float xMin, xMax, xRatio, xStep;   if (mAlg == SpectrumAnalyst::Spectrum) {      xMin = mRate / mWindowSize;      xMax = mRate / 2;      xRatio = xMax / xMin;      if (mLogAxis)      {         xStep = pow(2.0f, (log(xRatio) / log(2.0f)) / width);         hRuler->ruler.SetLog(true);      }      else      {         xStep = (xMax - xMin) / width;         hRuler->ruler.SetLog(false);      }      hRuler->ruler.SetUnits(_("Hz"));   } else {      xMin = 0;      xMax = mAnalyst->GetProcessedSize() / mRate;      xStep = (xMax - xMin) / width;      hRuler->ruler.SetLog(false);      hRuler->ruler.SetUnits(_("s"));   }   hRuler->ruler.SetRange(xMin, xMax-xStep);   hRuler->Refresh(false);   // Draw the plot   if (mAlg == SpectrumAnalyst::Spectrum)      memDC.SetPen(wxPen(theTheme.Colour( clrHzPlot ), 1, wxSOLID));   else      memDC.SetPen(wxPen(theTheme.Colour( clrWavelengthPlot), 1, wxSOLID));   float xPos = xMin;   for (int i = 0; i < width; i++) {      float y;      if (mLogAxis)         y = mAnalyst->GetProcessedValue(xPos, xPos * xStep);      else         y = mAnalyst->GetProcessedValue(xPos, xPos + xStep);      float ynorm = (y - yMin) / yTotal;      int lineheight = (int)(ynorm * (r.height - 1));      if (lineheight > r.height - 2)         lineheight = r.height - 2;      if (ynorm > 0.0)         AColor::Line(memDC, r.x + 1 + i, r.y + r.height - 1 - lineheight,                        r.x + 1 + i, r.y + r.height - 1);      if (mLogAxis)         xPos *= xStep;      else         xPos += xStep;   }   // Outline the graph   memDC.SetPen(*wxBLACK_PEN);   memDC.SetBrush(*wxTRANSPARENT_BRUSH);   memDC.DrawRectangle(r);   if(mDrawGrid)   {      hRuler->ruler.DrawGrid(memDC, r.height, true, true, 1, 1);      vRuler->ruler.DrawGrid(memDC, r.width, true, true, 1, 1);   }   memDC.SelectObject( wxNullBitmap );   mFreqPlot->Refresh();}
开发者ID:RaphaelMarinier,项目名称:audacity,代码行数:101,


示例25: dc

void FreqWindow::PlotPaint(wxPaintEvent & event){   wxPaintDC dc( (wxWindow *) event.GetEventObject() );   dc.DrawBitmap( *mBitmap, 0, 0, true );   // Fix for Bug 1226 "Plot Spectrum freezes... if insufficient samples selected"   if (!mData || mDataLen < mWindowSize)      return;   dc.SetFont(mFreqFont);   wxRect r = mPlotRect;   int width = r.width - 2;   float xMin, xMax, xRatio, xStep;   if (mAlg == SpectrumAnalyst::Spectrum) {      xMin = mRate / mWindowSize;      xMax = mRate / 2;      xRatio = xMax / xMin;      if (mLogAxis)         xStep = pow(2.0f, (log(xRatio) / log(2.0f)) / width);      else         xStep = (xMax - xMin) / width;   } else {      xMin = 0;      xMax = mAnalyst->GetProcessedSize() / mRate;      xStep = (xMax - xMin) / width;   }   float xPos = xMin;   // Find the peak nearest the cursor and plot it   if ( r.Contains(mMouseX, mMouseY) & (mMouseX!=0) & (mMouseX!=r.width-1) ) {      if (mLogAxis)         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));      else         xPos = xMin + xStep * (mMouseX - (r.x + 1));      float bestValue = 0;      float bestpeak = mAnalyst->FindPeak(xPos, &bestValue);      int px;      if (mLogAxis)         px = (int)(log(bestpeak / xMin) / log(xStep));      else         px = (int)((bestpeak - xMin) * width / (xMax - xMin));      dc.SetPen(wxPen(wxColour(160,160,160), 1, wxSOLID));      AColor::Line(dc, r.x + 1 + px, r.y, r.x + 1 + px, r.y + r.height);       // print out info about the cursor location      float value;      if (mLogAxis) {         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));         value = mAnalyst->GetProcessedValue(xPos, xPos * xStep);      } else {         xPos = xMin + xStep * (mMouseX - (r.x + 1));         value = mAnalyst->GetProcessedValue(xPos, xPos + xStep);      }      wxString cursor;      wxString peak;      wxString xpitch;      wxString peakpitch;      const wxChar *xp;      const wxChar *pp;      if (mAlg == SpectrumAnalyst::Spectrum) {         xpitch = PitchName_Absolute(FreqToMIDInote(xPos));         peakpitch = PitchName_Absolute(FreqToMIDInote(bestpeak));         xp = xpitch;         pp = peakpitch;         /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#*/         cursor.Printf(_("%d Hz (%s) = %d dB"), (int)(xPos + 0.5), xp, (int)(value + 0.5));         peak.Printf(_("%d Hz (%s) = %.1f dB"), (int)(bestpeak + 0.5), pp, bestValue);      } else if (xPos > 0.0 && bestpeak > 0.0) {         xpitch = PitchName_Absolute(FreqToMIDInote(1.0 / xPos));         peakpitch = PitchName_Absolute(FreqToMIDInote(1.0 / bestpeak));         xp = xpitch;         pp = peakpitch;         /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#          * the %.4f are numbers, and 'sec' should be an abbreviation for seconds */         cursor.Printf(_("%.4f sec (%d Hz) (%s) = %f"),                     xPos, (int)(1.0 / xPos + 0.5), xp, value);         peak.Printf(_("%.4f sec (%d Hz) (%s) = %.3f"),                     bestpeak, (int)(1.0 / bestpeak + 0.5), pp, bestValue);      }      mCursorText->SetValue(cursor);      mPeakText->SetValue(peak);   }   else {      mCursorText->SetValue(wxT(""));      mPeakText->SetValue(wxT(""));   }//.........这里部分代码省略.........
开发者ID:RaphaelMarinier,项目名称:audacity,代码行数:101,


示例26: CurrentPlot

void SIM_PLOT_FRAME::updateSignalList(){    SIM_PLOT_PANEL* plotPanel = CurrentPlot();    if( !plotPanel )        return;    m_signals->ClearAll();    wxSize size = m_signals->GetClientSize();    m_signals->AppendColumn( _( "Signal" ), wxLIST_FORMAT_LEFT, size.x );    // Build an image list, to show the color of the corresponding trace    // in the plot panel    // This image list is used for trace and cursor lists    wxMemoryDC bmDC;    const int isize = bmDC.GetCharHeight();    if( m_signalsIconColorList == NULL )        m_signalsIconColorList = new wxImageList( isize, isize, false );    else        m_signalsIconColorList->RemoveAll();    for( const auto& trace : CurrentPlot()->GetTraces() )    {        wxBitmap bitmap( isize, isize );        bmDC.SelectObject( bitmap );        wxColor tcolor = trace.second->GetTraceColour();        wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();        bmDC.SetPen( wxPen( bgColor ) );        bmDC.SetBrush( wxBrush( bgColor ) );        bmDC.DrawRectangle( 0, 0, isize, isize ); // because bmDC.Clear() does not work in wxGTK        bmDC.SetPen( wxPen( tcolor ) );        bmDC.SetBrush( wxBrush( tcolor ) );        bmDC.DrawRectangle( 0, isize / 4 + 1, isize, isize / 2 );        bmDC.SelectObject( wxNullBitmap );  // Needed to initialize bitmap        bitmap.SetMask( new wxMask( bitmap, *wxBLACK ) );        m_signalsIconColorList->Add( bitmap );    }    if( bmDC.IsOk() )    {        bmDC.SetBrush( wxNullBrush );        bmDC.SetPen( wxNullPen );    }    m_signals->SetImageList( m_signalsIconColorList, wxIMAGE_LIST_SMALL );    // Fill the signals listctrl. Keep the order of names and    // the order of icon color identical, because the icons    // are also used in cursor list, and the color index is    // calculated from the trace name index    int imgidx = 0;    for( const auto& trace : m_plots[plotPanel].m_traces )    {        m_signals->InsertItem( imgidx, trace.first, imgidx );        imgidx++;    }}
开发者ID:miloh,项目名称:kicad-source-mirror,代码行数:64,


示例27: pdc

void DCButton::OnPaint(wxPaintEvent& event){    wxBufferedPaintDC pdc(this);    if(g_gui.gfx.isUnloaded()) {        return;    }    static std::unique_ptr<wxPen> highlight_pen;    static std::unique_ptr<wxPen> dark_highlight_pen;    static std::unique_ptr<wxPen> light_shadow_pen;    static std::unique_ptr<wxPen> shadow_pen;    if(highlight_pen.get() == nullptr)      highlight_pen.reset(newd wxPen(wxColor(0xFF,0xFF,0xFF), 1, wxSOLID));    if(dark_highlight_pen.get() == nullptr) dark_highlight_pen.reset(newd wxPen(wxColor(0xD4,0xD0,0xC8), 1, wxSOLID));    if(light_shadow_pen.get() == nullptr)   light_shadow_pen.reset(newd wxPen(wxColor(0x80,0x80,0x80), 1, wxSOLID));    if(shadow_pen.get() == nullptr)         shadow_pen.reset(newd wxPen(wxColor(0x40,0x40,0x40), 1, wxSOLID));    int size_x = 20, size_y = 20;    if(size == RENDER_SIZE_16x16) {        size_x = 20;        size_y = 20;    } else if(size == RENDER_SIZE_32x32) {        size_x = 36;        size_y = 36;    }    pdc.SetBrush(*wxBLACK);    pdc.DrawRectangle(0,0,size_x,size_y);    if(type == DC_BTN_TOGGLE && GetValue()) {        pdc.SetPen(*shadow_pen);        pdc.DrawLine(0 ,0 ,size_x-1,0 );        pdc.DrawLine(0 ,1 ,0 ,size_y-1);        pdc.SetPen(*light_shadow_pen);        pdc.DrawLine(1 ,1 ,size_x-2,1 );        pdc.DrawLine(1 ,2 ,1 ,size_y-2);        pdc.SetPen(*dark_highlight_pen);        pdc.DrawLine(size_x-2,1 ,size_x-2,size_y-2);        pdc.DrawLine(1 ,size_y-2,size_x-1,size_y-2);        pdc.SetPen(*highlight_pen);        pdc.DrawLine(size_x-1,0 ,size_x-1,size_y-1);        pdc.DrawLine(0 ,size_y-1,size_y,size_y-1);    } else {        pdc.SetPen(*highlight_pen);        pdc.DrawLine(0 ,0 ,size_x-1,0 );        pdc.DrawLine(0 ,1 ,0 ,size_y-1);        pdc.SetPen(*dark_highlight_pen);        pdc.DrawLine(1 ,1 ,size_x-2,1 );        pdc.DrawLine(1 ,2 ,1 ,size_y-2);        pdc.SetPen(*light_shadow_pen);        pdc.DrawLine(size_x-2,1 ,size_x-2,size_y-2);        pdc.DrawLine(1 ,size_y-2,size_x-1,size_y-2);        pdc.SetPen(*shadow_pen);        pdc.DrawLine(size_x-1,0 ,size_x-1,size_y-1);        pdc.DrawLine(0 ,size_y-1,size_y,size_y-1);    }    if(sprite) {        if(size == RENDER_SIZE_16x16) {            // Draw the picture!            sprite->DrawTo(&pdc, SPRITE_SIZE_16x16, 2, 2);            if(overlay && type == DC_BTN_TOGGLE && GetValue()) {                overlay->DrawTo(&pdc, SPRITE_SIZE_16x16, 2, 2);            }        } else if(size == RENDER_SIZE_32x32) {            // Draw the picture!            sprite->DrawTo(&pdc, SPRITE_SIZE_32x32, 2, 2);            if(overlay && type == DC_BTN_TOGGLE && GetValue()) {                overlay->DrawTo(&pdc, SPRITE_SIZE_32x32, 2, 2);            }        } else if(size == RENDER_SIZE_64x64) {            ////        }    }}
开发者ID:hjnilsson,项目名称:rme,代码行数:78,



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


C++ wxPoint函数代码示例
C++ wxPathOnly函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。