本文整理汇总了C++中wxMemoryDC类的典型用法代码示例。如果您正苦于以下问题:C++ wxMemoryDC类的具体用法?C++ wxMemoryDC怎么用?C++ wxMemoryDC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxMemoryDC类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DrawMouseoverMarker
void LineChart::DrawMouseoverMarker(wxMemoryDC &dc){
dc.SetPen(*wxThePenList->FindOrCreatePen(*wxWHITE, 1, wxSOLID));
dc.DrawLine(m_mouseX, 0, m_mouseX, _currentHeight);
size_t dataIndex = (size_t)(((double)GetMaxSeriesBufferSize()) * m_viewOffsetFactor) + m_mouseX - m_leftEdge;
DrawCurrentValues(dc, dataIndex, m_mouseX, m_mouseY);
}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:8,代码来源:lineChart.cpp
示例2: wxMemoryDC
void
TstLayer_t::_updateDC(void)
{
if (mDC) delete mDC;
mDC = new wxMemoryDC(*mSurface);
mDC->SetBackground(*wxBLACK_BRUSH);
mDC->SetPen(*_pen);
}
开发者ID:charlesw1234,项目名称:learning,代码行数:8,代码来源:tst-wx.cpp
示例3: DrawCurrentValues
void StripChart::DrawCurrentValues(wxMemoryDC &dc){
//see if data was logged for the mouse location
int dataBufferSize = _dataBuffer.size();
float zoomFactor = (float)_zoomPercentage / 100.0;
int dataBufferIndex = dataBufferSize - (int)(((float)(_currentWidth - _mouseX)) / zoomFactor) - 1;
//adjust for uboundoffset
dataBufferIndex-=((dataBufferSize - 1) -_currentDataBufferUBound);
if (dataBufferIndex < 0 || dataBufferIndex >= dataBufferSize) return;
dc.SetPen(*wxThePenList->FindOrCreatePen(*wxWHITE, 1, wxSOLID));
dc.DrawLine(_mouseX, 0, _mouseX, _currentHeight);
int currentOffset = 0;
StripChartLogItem logItem = _dataBuffer[dataBufferIndex];
wxDateTime timestamp = logItem.GetTimestamp();
wxDateTime fromTime;
switch(_timespanMode){
case TIMESPAN_FROM_LAST_LOG_ENTRY:
{
StripChartLogItem lastLogItem = _dataBuffer[dataBufferSize - 1];
fromTime = lastLogItem.GetTimestamp();
break;
}
case TIMESPAN_FROM_NOW:
fromTime = wxDateTime::UNow();
break;
}
wxTimeSpan span = (fromTime - timestamp);
wxString timeString = wxString::Format("%d seconds back",(int)span.GetSeconds().ToLong());
wxFont labelFont = GetFont();
int labelWidth,labelHeight,descent,externalLeading;
dc.GetTextExtent(timeString, &labelHeight, &labelWidth, &descent, &externalLeading, &labelFont);
dc.SetTextForeground(*wxWHITE);
dc.DrawRotatedText(timeString, _mouseX - labelWidth, _mouseY,90);
for (LogItemTypes::iterator it = _logItemTypes.begin(); it != _logItemTypes.end(); ++it){
wxString key = it->first;
LogItemType *logItemType = it->second;
ChartScale *scale = &_chartScales[logItemType->scaleId];
dc.SetTextForeground(logItemType->lineColor);
int value = logItem[logItemType->typeKey];
wxString valueString = logItemType->typeLabel + ": " + wxString::Format("%d",value) + " " +scale->scaleLabel;
dc.GetTextExtent(valueString, &labelHeight, &labelWidth, &descent, &externalLeading, &labelFont);
currentOffset += labelWidth;
dc.DrawRotatedText(valueString,_mouseX - labelHeight - 15, _mouseY - currentOffset,0);
}
}
开发者ID:BMWPower,项目名称:gaugeWorks,代码行数:59,代码来源:StripChart.cpp
示例4: DrawHighlightedShapes
void ConnectivityHistCanvas::DrawHighlightedShapes(wxMemoryDC &dc)
{
dc.SetPen(wxPen(highlight_color));
dc.SetBrush(wxBrush(highlight_color, wxBRUSHSTYLE_CROSSDIAG_HATCH));
for (int i=0, iend=selectable_shps.size(); i<iend; i++) {
if (ival_obs_sel_cnt[i] == 0) continue;
double s = (((double) ival_obs_sel_cnt[i]) /
((double) ival_obs_cnt[i]));
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);
}
}
开发者ID:ndon-ndon,项目名称:geoda,代码行数:15,代码来源:ConnectivityHistView.cpp
示例5: wxDCImpl
wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) :
wxDCImpl( owner )
{
#if defined(__WXMSW__) && wxUSE_WXDIB
// It seems that GDI+ sets invalid values for alpha channel when used with
// a compatible bitmap (DDB). So we need to convert the currently selected
// bitmap to a DIB before using it with any GDI+ functions to ensure that
// we get the correct alpha channel values in it at the end.
wxBitmap bmp = dc.GetSelectedBitmap();
wxASSERT_MSG( bmp.IsOk(), "Should select a bitmap before creating wxGCDC" );
// We don't need to convert it if it can't have alpha at all (any depth but
// 32) or is already a DIB with alpha.
if ( bmp.GetDepth() == 32 && (!bmp.IsDIB() || !bmp.HasAlpha()) )
{
// We need to temporarily deselect this bitmap from the memory DC
// before modifying it.
const_cast<wxMemoryDC&>(dc).SelectObject(wxNullBitmap);
bmp.ConvertToDIB(); // Does nothing if already a DIB.
if( !bmp.HasAlpha() )
{
// Initialize alpha channel, even if we don't have any alpha yet,
// we should have correct (opaque) alpha values in it for GDI+
// functions to work correctly.
{
wxAlphaPixelData data(bmp);
if ( data )
{
wxAlphaPixelData::Iterator p(data);
for ( int y = 0; y < data.GetHeight(); y++ )
{
wxAlphaPixelData::Iterator rowStart = p;
for ( int x = 0; x < data.GetWidth(); x++ )
{
p.Alpha() = wxALPHA_OPAQUE;
++p;
}
p = rowStart;
p.OffsetY(data, 1);
}
}
} // End of block modifying the bitmap.
// Using wxAlphaPixelData sets the internal "has alpha" flag but we
// don't really have any alpha yet, so reset it back for now.
bmp.ResetAlpha();
}
// Undo SelectObject() at the beginning of this block.
const_cast<wxMemoryDC&>(dc).SelectObjectAsSource(bmp);
}
#endif // wxUSE_WXDIB
Init(wxGraphicsContext::Create(dc));
}
开发者ID:emutavchi,项目名称:pxCore,代码行数:60,代码来源:dcgraph.cpp
示例6: DrawSolvePath
void DrawSolvePath(wxMemoryDC &mem)
{
unsigned int route_count=0;
unsigned int x=0,y=0;
wxBrush yellowback(wxColour(255,255,0),wxSOLID);
wxPen yellow(wxColour(255,255,0),1,wxSOLID);
while ( GetRouteWaypoint(GetWorldHandler(),0,route_count,&x,&y) == 1 )
{
mem.SetPen(yellow);
mem.SetBrush(yellowback);
mem.DrawRectangle(x*map_box_size,y*map_box_size,map_box_size,map_box_size);
++route_count;
}
//printf("Drawing Level 1 Lines \n");
wxPen redfat(wxColour(255,0,0),3,wxSOLID);
unsigned int oldx=0,oldy=0;
if ( GetStraightRouteWaypoint(GetWorldHandler(),OURROBOT,0,&oldx,&oldy)==1 ) { mem.DrawCircle(oldx*10+5,oldy*10+5,3); }
route_count=1;
while ( GetStraightRouteWaypoint(GetWorldHandler(),OURROBOT,route_count,&x,&y)==1 )
{
mem.SetPen(redfat);
mem.DrawCircle(x*map_box_size+map_box_size_half,y*map_box_size+map_box_size_half,3);
mem.DrawLine(oldx*map_box_size+map_box_size_half,oldy*map_box_size+map_box_size_half,x*map_box_size+map_box_size_half,y*map_box_size+map_box_size_half);
++route_count;
oldx = x , oldy = y ;
}
return;
}
开发者ID:AmmarkoV,项目名称:RoboVision,代码行数:33,代码来源:MapOverview.cpp
示例7: DrawBackground
void FreqWindow::DrawBackground(wxMemoryDC & dc)
{
Layout();
if (mBitmap)
{
delete mBitmap;
mBitmap = NULL;
}
mPlotRect = mFreqPlot->GetClientRect();
mBitmap = new wxBitmap(mPlotRect.width, mPlotRect.height);
dc.SelectObject(*mBitmap);
dc.SetBackground(wxBrush(wxColour(254, 254, 254)));// DONT-THEME Mask colour.
dc.Clear();
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(mPlotRect);
dc.SetFont(mFreqFont);
}
开发者ID:LarryPAC,项目名称:audacity,代码行数:25,代码来源:FreqWindow.cpp
示例8: DrawSelectableShapes
void BoxNewPlotCanvas::DrawSelectableShapes(wxMemoryDC &dc)
{
LOG_MSG("In BoxNewPlotCanvas::DrawSelectableShapes");
int radius = TemplateCanvas::markers_size;
for (int t=cur_first_ind; t<=cur_last_ind; t++) {
int min_IQR = hinge_stats[t].min_IQR_ind;
int max_IQR = hinge_stats[t].max_IQR_ind;
int ind_base = (t-cur_first_ind)*num_obs;
dc.SetPen(GdaConst::boxplot_point_color);
dc.SetBrush(*wxWHITE_BRUSH);
for (int i=0; i<min_IQR; i++) {
int ind = ind_base + data_sorted[t][i].second;
dc.DrawCircle(selectable_shps[ind]->center, radius);
}
for (int i=max_IQR+1; i<num_obs; i++) {
int ind = ind_base + data_sorted[t][i].second;
dc.DrawCircle(selectable_shps[ind]->center, radius);
}
int iqr_s = GenUtils::max<double>(min_IQR, 0);
int iqr_t = GenUtils::min<double>(max_IQR, num_obs-1);
dc.SetPen(GdaConst::boxplot_q1q2q3_color);
dc.SetBrush(GdaConst::boxplot_q1q2q3_color);
for (int i=iqr_s; i<=iqr_t; i++) {
int ind = ind_base + data_sorted[t][i].second;
GdaRectangle* rec = (GdaRectangle*) selectable_shps[ind];
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);
}
}
}
开发者ID:grzegorz-m-dziedzic,项目名称:geoda,代码行数:31,代码来源:BoxNewPlotView.cpp
示例9: DrawEndPoint
void DrawEndPoint(wxMemoryDC &mem,unsigned int endx,unsigned int endy)
{
wxBrush blueback(wxColour(0,0,255),wxSOLID);
wxPen black(wxColour(0,0,0),1,wxSOLID);
wxPen red(wxColour(255,0,0),1,wxSOLID);
if ( (endx!=0) || (endy!=0) )
{
int parent=0;//Get_Object_PathPlanning(endx,endy,1);
mem.SetBrush(blueback);
if ( parent!=0 ) mem.SetPen(red);
else
mem.SetPen(black);
mem.DrawRectangle(endx*map_box_size-map_box_size_half,endy*map_box_size-map_box_size_half,map_box_size,map_box_size);
}
}
开发者ID:AmmarkoV,项目名称:RoboVision,代码行数:18,代码来源:MapOverview.cpp
示例10: DrawCurrentValues
void LineChart::DrawCurrentValues(wxMemoryDC &dc, size_t dataIndex, int x, int y){
int currentOffset = 0;
wxFont labelFont = GetFont();
int labelWidth,labelHeight,descent,externalLeading;
for (SeriesMap::iterator it = m_seriesMap.begin(); it != m_seriesMap.end(); ++it){
Series *series = it->second;
double dataValue = series->GetValueAtOrNear(dataIndex);
wxString numberFormat = "% 2." + wxString::Format("%df", series->GetPrecision());
wxString valueString = (DatalogValue::NULL_VALUE == dataValue ? "---" : wxString::Format(numberFormat.ToAscii(), dataValue)) + " " + series->GetLabel();
dc.SetTextForeground(series->GetColor());
dc.GetTextExtent(valueString, &labelHeight, &labelWidth, &descent, &externalLeading, &labelFont);
dc.DrawRotatedText(valueString, x + CURRENT_VALUES_RIGHT_OFFSET, y + currentOffset,0);
currentOffset += labelWidth;
}
}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:18,代码来源:lineChart.cpp
示例11: SetFont
//set the font on memDC such that text can fit in specified width and height
void ExportMixerPanel::SetFont( wxMemoryDC &memDC, wxString text, int width,
int height )
{
int l = 0, u = 13, m, w, h;
wxFont font = memDC.GetFont();
while( l < u - 1 )
{
m = ( l + u ) / 2;
font.SetPointSize( m );
memDC.SetFont( font );
memDC.GetTextExtent( text, &w, &h );
if( w < width && h < height )
l = m;
else
u = m;
}
font.SetPointSize( l );
memDC.SetFont( font );
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:21,代码来源:Export.cpp
示例12: WXUNUSED
// On some platforms, notably Mac OS X with Core Graphics, we can't blit from
// a window, so we need to draw the background explicitly.
bool MyDragImage::UpdateBackingFromWindow(wxDC& WXUNUSED(windowDC), wxMemoryDC& destDC, const wxRect& WXUNUSED(sourceRect),
const wxRect& destRect) const
{
destDC.SetClippingRegion(destRect);
if (wxGetApp().GetBackgroundBitmap().IsOk())
wxGetApp().TileBitmap(destRect, destDC, wxGetApp().GetBackgroundBitmap());
m_canvas->DrawShapes(destDC);
return true;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:13,代码来源:dragimag.cpp
示例13: RenderRegionViewOnDC
bool ChartPlugInWrapper::RenderRegionViewOnDC(wxMemoryDC& dc, const ViewPort& VPoint,
const wxRegion &Region)
{
if(m_ppicb)
{
PlugIn_ViewPort pivp = CreatePlugInViewport( VPoint);
dc.SelectObject(m_ppicb->RenderRegionView( pivp, Region));
return true;
}
else
return false;
}
开发者ID:biiont,项目名称:OpenCPN,代码行数:12,代码来源:pluginmanager.cpp
示例14: DrawHighlightedShapes
void BoxNewPlotCanvas::DrawHighlightedShapes(wxMemoryDC &dc)
{
int radius = 3;
std::vector<bool>& hs = highlight_state->GetHighlight();
dc.SetBrush(highlight_color);
for (int t=cur_first_ind; t<=cur_last_ind; t++) {
int min_IQR = hinge_stats[t].min_IQR_ind;
int max_IQR = hinge_stats[t].max_IQR_ind;
int ind_base = (t-cur_first_ind)*num_obs;
dc.SetPen(*wxRED_PEN);
for (int i=0; i<min_IQR; i++) {
if (!hs[data_sorted[t][i].second]) continue;
int ind = ind_base + data_sorted[t][i].second;
dc.DrawCircle(selectable_shps[ind]->center, radius);
}
for (int i=max_IQR+1; i<num_obs; i++) {
if (!hs[data_sorted[t][i].second]) continue;
int ind = ind_base + data_sorted[t][i].second;
dc.DrawCircle(selectable_shps[ind]->center, radius);
}
int iqr_s = GenUtils::max<double>(min_IQR, 0);
int iqr_t = GenUtils::min<double>(max_IQR, num_obs-1);
dc.SetPen(highlight_color);
for (int i=iqr_s; i<=iqr_t; i++) {
if (!hs[data_sorted[t][i].second]) continue;
int ind = ind_base + data_sorted[t][i].second;
GdaRectangle* rec = (GdaRectangle*) selectable_shps[ind];
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);
}
}
}
开发者ID:grzegorz-m-dziedzic,项目名称:geoda,代码行数:34,代码来源:BoxNewPlotView.cpp
示例15: DrawGrid
void LineChart::DrawGrid(wxMemoryDC &dc){
dc.SetPen(*wxThePenList->FindOrCreatePen(wxColor(40,40,40), 1, wxSOLID));
int width = _currentWidth;
int height = _currentHeight;
float zoomFactor = (float)_zoomPercentage / 100;
int gridIncrement = (int)(GRID_SIZE * zoomFactor);
for (int x = width; x >=0 ; x -= gridIncrement){
dc.DrawLine(x, 0, x, height);
}
float i = 0;
while (i < 1){
int y = (int)(((float)height) * i);
dc.DrawLine(0, y, width, y);
i = i + 0.1;
}
}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:22,代码来源:lineChart.cpp
示例16: 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,代码来源:ConditionalHistogramView.cpp
示例17: DrawBackground
void FreqWindow::DrawBackground(wxMemoryDC & dc)
{
Layout();
mBitmap.reset();
mPlotRect = mFreqPlot->GetClientRect();
mBitmap = std::make_unique<wxBitmap>(mPlotRect.width, mPlotRect.height);
dc.SelectObject(*mBitmap);
dc.SetBackground(wxBrush(wxColour(254, 254, 254)));// DONT-THEME Mask colour.
dc.Clear();
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(mPlotRect);
dc.SetFont(mFreqFont);
}
开发者ID:RaphaelMarinier,项目名称:audacity,代码行数:21,代码来源:FreqWindow.cpp
示例18: Paint
void wxBuildUI::Paint(wxMemoryDC &dc)
{
wxSize size = GetSize();
dc.SetBrush(wxBrush(sBackgroundBuild, wxSOLID));
dc.SetPen(wxPen(mClickable ? sClickable : sOutline, 1, wxSOLID));
dc.DrawRectangle(0, 0, size.x, size.y);
// If we're not clickable, draw hatch lines over the bitmap to show it.
if(false == mClickable)
{
wxBrush brush(sOutline);
brush.SetStyle(wxBDIAGONAL_HATCH);
dc.SetBrush(brush);
dc.DrawRectangle(0, 0, size.x, size.y);
dc.DrawBitmap(mDisabledBitmap, 1, 1, true);
}
}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:21,代码来源:BuildUI.cpp
示例19: drawTable
// NOTES:(1) store values of width & height at queryTable.
// (2)Need to set a font for the device context before get font metrics with GetTextExtent
void gqbGraphSimple::drawTable(wxMemoryDC& bdc, wxPoint *origin, gqbQueryObject *queryTable)
{
long w=0,h=0,height=0,width=0,margin=5;
// Get Value for row Height
if(!rowHeight)
{
bdc.SetFont(TableTitleFont);
bdc.GetTextExtent(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxtz"),&w,&h);
rowHeight=h;
}
// Get Title Metrics
bdc.SetFont(TableTitleFont);
height+= rowHeight + rowTopMargin;
// Calculate font metrics for table title with/without alias
if(queryTable->getAlias().length()>0)
bdc.GetTextExtent(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),&w,&h);
else
bdc.GetTextExtent(queryTable->getName(),&w,&h);
width= rowLeftMargin + w + rowRightMargin;
// Get Columns Metrics
bdc.SetFont(normalFont);
// Don't use h value from font metrics to get consistency between columns vertical separation (height)
height+=rowHeight*queryTable->parent->countCols()+rowTopMargin*queryTable->parent->countCols();
gqbIteratorBase *iterator = queryTable->parent->createColumnsIterator();
while(iterator->HasNext())
{
gqbColumn *tmp= (gqbColumn *)iterator->Next();
bdc.GetTextExtent(tmp->getName(),&w,&h);
if((rowLeftMargin + w + rowRightMargin) > width)
width=rowLeftMargin + w + rowRightMargin;
}
//Don't delete iterator because will be use below;
// Set table Size in ObjectModel (Temporary Values for object representation,
// and for this reason the view can modified model without using the controller
// because this values are used by controller when use object's size in internal operations)
if( (height+2) < minTableHeight) // +2 from BackgroundLayers addition
{
queryTable->setHeight(minTableHeight);
height=minTableHeight;
}
else
queryTable->setHeight(height+2);
if( (width+2) < minTableWidth)
{
queryTable->setWidth(minTableWidth);
width=minTableWidth;
}
else
queryTable->setWidth(width+2);
//Decorate Table
bdc.SetPen(*wxTRANSPARENT_PEN);
//draw second Layer
bdc.SetBrush(BackgroundLayer2);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+2,height+2)));
//draw third Layer
bdc.SetBrush(BackgroundLayer1);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width+1,height+1)));
//draw real frame layer
bdc.SetBrush(*wxWHITE_BRUSH);
if(queryTable->getSelected())
{
bdc.SetPen(selectedPen);
}
else
{
bdc.SetPen(*wxBLACK_PEN);
}
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,height)));
//draw title layer
bdc.SetBrush(BackgroundTitle);
bdc.DrawRectangle(wxRect(wxPoint(origin->x,origin->y), wxSize(width,rowHeight+rowTopMargin)));
bdc.SetFont(TableTitleFont);
if(queryTable->getAlias().length()>0)
bdc.DrawText(queryTable->getName()+wxT(" (")+queryTable->getAlias()+wxT(")"),origin->x+margin,origin->y+rowTopMargin);
else
bdc.DrawText(queryTable->getName(),origin->x+margin,origin->y+rowTopMargin);
bdc.SetFont(normalFont);
// GQB-TODO: in a future reuse a little more the iterator creating it inside the Query or Table Object
// and only delete it when delete the query object.
// Draw Columns
height=rowHeight+rowTopMargin;
iterator->ResetIterator();
while(iterator->HasNext())
//.........这里部分代码省略.........
开发者ID:xiul,项目名称:Database-Designer-for-pgAdmin,代码行数:101,代码来源:gqbGraphSimple.cpp
示例20: drawJoin
void gqbGraphSimple::drawJoin(wxMemoryDC& bdc, wxPoint& origin, wxPoint& dest, wxPoint& anchorUsed, bool selected=false, type_Join joinKind=_equally)
{
wxPoint origin2=origin;
wxPoint dest2=dest;
if(selected)
{
bdc.SetPen(selectedPen);
bdc.SetBrush(selectedBrush);
}
else
{
bdc.SetPen(*wxBLACK_PEN);
bdc.SetBrush(*wxBLACK_BRUSH);
}
// GQB-TODO: optimize this if possible, I know one other can be the same?
// getAnchorsUsed() [-1==left] [1==right] x->origin y->destination
if(anchorUsed.x==1)
{
bdc.DrawRectangle(origin.x,origin.y-4,8,8);
origin2.x+=20;
}
else
{
bdc.DrawRectangle(origin.x-8,origin.y-4,8,8);
origin2.x-=20;
}
if(anchorUsed.y==1)
{
bdc.DrawRectangle(dest.x,dest.y-4,8,8);
dest2.x+=20;
}
else
{
bdc.DrawRectangle(dest.x-8,dest.y-4,8,8);
dest2.x-=20;
}
bdc.DrawLine(origin,origin2);
bdc.DrawLine(dest,dest2);
bdc.DrawLine(origin2,dest2);
// Draw type of join
switch(joinKind)
{
case _equally:
bdc.DrawText(wxT("="),findLineMiddle(origin2, dest2));
break;
case _lesser:
bdc.DrawText(wxT("<"),findLineMiddle(origin2, dest2));
break;
case _greater:
bdc.DrawText(wxT(">"),findLineMiddle(origin2, dest2));
break;
case _equlesser:
bdc.DrawText(wxT("<="),findLineMiddle(origin2, dest2));
break;
case _equgreater:
bdc.DrawText(wxT(">="),findLineMiddle(origin2, dest2));
break;
};
}
开发者ID:xiul,项目名称:Database-Designer-for-pgAdmin,代码行数:65,代码来源:gqbGraphSimple.cpp
注:本文中的wxMemoryDC类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论