本文整理汇总了C++中GetCanvas函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCanvas函数的具体用法?C++ GetCanvas怎么用?C++ GetCanvas使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCanvas函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetParent
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
{
wxString msg;
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint();
if( !footprintName.IsEmpty() )
{
msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) );
SetTitle( msg );
const FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName );
const wxChar* libname;
if( module_info )
libname = GetChars( module_info->GetNickname() );
else
libname = GetChars( wxT( "???" ) );
msg.Printf( _( "Lib: %s" ), libname );
SetStatusText( msg, 0 );
if( GetBoard()->m_Modules.GetCount() )
{
// there is only one module in the list
GetBoard()->m_Modules.DeleteAll();
}
MODULE* module = Get_Module( footprintName );
if( module )
GetBoard()->m_Modules.PushBack( module );
Zoom_Automatique( false );
}
else // No footprint to display. Erase old footprint, if any
{
if( GetBoard()->m_Modules.GetCount() )
{
GetBoard()->m_Modules.DeleteAll();
Zoom_Automatique( false );
SetStatusText( wxEmptyString, 0 );
}
}
// Display new cursor coordinates and zoom value:
UpdateStatusBar();
GetCanvas()->Refresh();
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
}
示例2: dlg
void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
{
PCB_LAYER_ID new_layer[PCB_LAYER_ID_COUNT];
DIALOG_SWAP_LAYERS dlg( this, new_layer );
if( dlg.ShowModal() != wxID_OK )
return;
BOARD_COMMIT commit( this );
bool hasChanges = false;
// Change tracks.
for( TRACK* segm = GetBoard()->m_Track; segm; segm = segm->Next() )
{
if( segm->Type() == PCB_VIA_T )
{
VIA* via = (VIA*) segm;
PCB_LAYER_ID top_layer, bottom_layer;
if( via->GetViaType() == VIA_THROUGH )
continue;
via->LayerPair( &top_layer, &bottom_layer );
if( new_layer[bottom_layer] != bottom_layer || new_layer[top_layer] != top_layer )
{
commit.Modify( via );
via->SetLayerPair( new_layer[top_layer], new_layer[bottom_layer] );
GetGalCanvas()->GetView()->Update( via, KIGFX::GEOMETRY );
hasChanges = true;
}
}
else
{
hasChanges |= processBoardItem( this, commit, segm, new_layer );
}
}
for( BOARD_ITEM* zone : GetBoard()->Zones() )
{
hasChanges |= processBoardItem( this, commit, zone, new_layer );
}
for( BOARD_ITEM* drawing : GetBoard()->Drawings() )
{
hasChanges |= processBoardItem( this, commit, drawing, new_layer );
}
if( hasChanges )
{
OnModify();
commit.Push( "Layers moved" );
GetCanvas()->Refresh();
}
}
示例3: WXUNUSED
void wxCompositeShape::OnDragLeft(bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
double xx = x;
double yy = y;
m_canvas->Snap(&xx, &yy);
double offsetX = xx - objectStartX;
double offsetY = yy - objectStartY;
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
dc.SetLogicalFunction(OGLRBLF);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
GetEventHandler()->OnDrawOutline(dc, GetX() + offsetX, GetY() + offsetY, GetWidth(), GetHeight());
// wxShape::OnDragLeft(draw, x, y, keys, attachment);
}
示例4: GetCanvas
void
TGUIStimulusView::Paint()
{
if( bitmap == NULL )
return;
// Draw the bitmap.
if( visible )
GetCanvas()->Draw( bitmapTRect.Left, bitmapTRect.Top, bitmap );
}
示例5: TraverseSprites
void StagePanel::OnPreview()
{
int width, height;
QueryWindowViewSizeSJ::Instance()->Query(width, height);
std::vector<ee::SprPtr> sprs;
TraverseSprites(ee::FetchAllRefVisitor<ee::Sprite>(sprs));
EnableObserve(false);
GetCanvas()->EnableObserve(false);
GetStageImpl()->EnableObserve(false);
PreviewDialog dlg(const_cast<StagePanel*>(this), GetCanvas()->GetGLContext(), width, height, sprs);
dlg.ShowModal();
EnableObserve(true);
GetCanvas()->EnableObserve(true);
GetStageImpl()->EnableObserve(true);
}
示例6: while
void wxDiagram::ReadLines(wxExprDatabase& database)
{
database.BeginFind();
wxExpr *clause = database.FindClauseByFunctor(_T("line"));
while (clause)
{
wxString type;
long parentId = -1;
clause->GetAttributeValue(_T("type"), type);
clause->GetAttributeValue(_T("parent"), parentId);
wxClassInfo *classInfo = wxClassInfo::FindClass(type);
if (classInfo)
{
wxLineShape *shape = (wxLineShape *)classInfo->CreateObject();
shape->Show(true);
OnShapeLoad(database, *shape, *clause);
shape->SetCanvas(GetCanvas());
long image_to = -1; long image_from = -1;
clause->GetAttributeValue(_T("to"), image_to);
clause->GetAttributeValue(_T("from"), image_from);
wxExpr *image_to_expr = database.HashFind(_T("shape"), image_to);
if (!image_to_expr)
{
// Error
}
wxExpr *image_from_expr = database.HashFind(_T("shape"), image_from);
if (!image_from_expr)
{
// Error
}
if (image_to_expr && image_from_expr)
{
wxShape *image_to_object = (wxShape *)image_to_expr->GetClientData();
wxShape *image_from_object = (wxShape *)image_from_expr->GetClientData();
if (image_to_object && image_from_object)
{
image_from_object->AddLine(shape, image_to_object, shape->GetAttachmentFrom(), shape->GetAttachmentTo());
}
}
clause->SetClientData(shape);
m_shapeList->Append(shape);
}
clause = database.FindClauseByFunctor(_T("line"));
}
}
示例7: SetSize
bool wxDivisionShape::AdjustBottom(double bottom, bool test)
{
double y1 = (double)(GetY() - (GetHeight() / 2.0));
if (bottom <= y1)
return FALSE;
if (test)
return TRUE;
double newH = bottom - y1;
double newY = (double)(y1 + newH / 2.0);
SetSize(GetWidth(), newH);
Move(GetX(), newY);
if (GetCanvas())
GetCanvas()->Refresh();
return TRUE;
}
示例8: SetSize
// Adjust a side, returning false if it's not physically possible.
bool wxDivisionShape::AdjustLeft(double left, bool test)
{
double x2 = (double)(GetX() + (GetWidth()/2.0));
if (left >= x2)
return false;
if (test)
return true;
double newW = x2 - left;
double newX = (double)(left + newW/2.0);
SetSize(newW, GetHeight());
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
Move(dc, newX, GetY());
return true;
}
示例9: cmd
void PCB_BASE_FRAME::SetPrevGrid()
{
EDA_DRAW_FRAME::SetPrevGrid();
if( m_gridSelectBox )
{
wxCommandEvent cmd( wxEVT_CHOICE );
cmd.SetEventObject( this );
OnSelectGrid( cmd );
}
else
GetCanvas()->Refresh();
}
示例10: GetCanvas
void CGUIContext::Clear()
{
Console = 0;
TitleLabels = 0;
VolumeControl = 0;
TerrainControl = 0;
GlyphControl = 0;
SceneControl = 0;
ControlPanel = 0;
Manager->RemoveAllWidgets();
GetCanvas()->RemoveAllChildren();
}
示例11: GetCanvas
void GTKWindow::PanelStateChanged(void)
{
Rect oRect;
GdkBitmap *mask;
GetCanvas()->SetNoScreenUpdate(true);
Window::PanelStateChanged();
GetCanvas()->GetBackgroundRect(oRect);
mask = ((GTKCanvas *)m_pCanvas)->GetMask();
gdk_threads_enter();
if (mask)
gdk_window_shape_combine_mask(mainWindow->window, mask, 0, 0);
gtk_widget_set_usize(mainWindow, oRect.Width(), oRect.Height());
gdk_threads_leave();
GetCanvas()->SetNoScreenUpdate(false);
((GTKCanvas *)GetCanvas())->Paint(oRect);
}
示例12: SetAttachmentSize
void wxCompositeShape::SetSize(double w, double h, bool recursive)
{
SetAttachmentSize(w, h);
double xScale = (double)(w / (wxMax(1.0, GetWidth())));
double yScale = (double)(h / (wxMax(1.0, GetHeight())));
m_width = w;
m_height = h;
if (!recursive) return;
wxNode *node = m_children.GetFirst();
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
double xBound, yBound;
while (node)
{
wxShape *object = (wxShape *)node->GetData();
// Scale the position first
double newX = (double)(((object->GetX() - GetX()) * xScale) + GetX());
double newY = (double)(((object->GetY() - GetY()) * yScale) + GetY());
object->Show(FALSE);
object->Move(newX, newY);
object->Show(TRUE);
// Now set the scaled size
object->GetBoundingBoxMin(&xBound, &yBound);
object->SetSize(object->GetFixedWidth() ? xBound : xScale * xBound,
object->GetFixedHeight() ? yBound : yScale * yBound);
node = node->GetNext();
}
SetDefaultRegionSize();
}
示例13: Open
void ComboBox::Open()
{
if (!_menu)
{
return;
}
_menu->SetParent(GetCanvas());
_menu->SetHidden(false);
_menu->BringToFront();
Gwen::Point point = LocalPositionToCanvas(Gwen::Point(0, 0));
_menu->SetBounds(Gwen::Rectangle(point._x, point._y + Height(), Width(), _menu->Height()));
}
示例14: GetCanvas
void
TGUIReinforcementView::Paint()
{
if( animationCounter != lastAnimationCounter )
{
if( animationCounter < numAnimationFrames )
animationBitmap = animFrames[ animationCounter ];
else
animationBitmap = NULL;
lastAnimationCounter = animationCounter;
}
if( animationBitmap != NULL )
GetCanvas()->Draw( animTRect.Left, animTRect.Top, animationBitmap );
}
示例15: WXUNUSED
void MyFrame::OnSetFaceName(wxCommandEvent& WXUNUSED(event))
{
wxString facename = GetCanvas()->GetTextFont().GetFaceName();
wxString newFaceName = wxGetTextFromUser(
wxT("Here you can edit current font face name."),
wxT("Input font facename"), facename,
this);
if (newFaceName.IsEmpty())
return; // user clicked "Cancel" - do nothing
wxFont font(GetCanvas()->GetTextFont());
if (font.SetFaceName(newFaceName)) // change facename only
{
wxASSERT_MSG(font.IsOk(), wxT("The font should now be valid"));
DoChangeFont(font);
}
else
{
wxASSERT_MSG(!font.IsOk(), wxT("The font should now be invalid"));
wxMessageBox(wxT("There is no font with such face name..."),
wxT("Invalid face name"), wxOK|wxICON_ERROR, this);
}
}