當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetCanvas函數代碼示例

本文整理匯總了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();
}
開發者ID:antogg,項目名稱:kicad-source-mirror,代碼行數:57,代碼來源:class_DisplayFootprintsFrame.cpp

示例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();
    }
}
開發者ID:KiCad,項目名稱:kicad-source-mirror,代碼行數:56,代碼來源:dialog_swap_layers.cpp

示例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);
}
開發者ID:kleopatra999,項目名稱:pgadmin3,代碼行數:19,代碼來源:composit.cpp

示例4: GetCanvas

void
TGUIStimulusView::Paint()
{
    if( bitmap == NULL )
        return;

    // Draw the bitmap.
    if( visible )
        GetCanvas()->Draw( bitmapTRect.Left, bitmapTRect.Top, bitmap );
}
開發者ID:ACrazyer,項目名稱:NeuralSystemsBCI2000,代碼行數:10,代碼來源:GUIStimulusView.cpp

示例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);
}
開發者ID:xzrunner,項目名稱:easyeditor,代碼行數:19,代碼來源:StagePanel.cpp

示例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"));
  }
}
開發者ID:crioux,項目名稱:SpeedDemon-Profiler,代碼行數:55,代碼來源:ogldiag.cpp

示例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;
}
開發者ID:kleopatra999,項目名稱:pgadmin3,代碼行數:20,代碼來源:composit.cpp

示例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;
}
開發者ID:lixun910,項目名稱:geoda,代碼行數:21,代碼來源:composit.cpp

示例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();
}
開發者ID:ejs-ejs,項目名稱:kicad-source-mirror,代碼行數:13,代碼來源:basepcbframe.cpp

示例10: GetCanvas

void CGUIContext::Clear()
{
	Console = 0;
	TitleLabels = 0;
	VolumeControl = 0;
	TerrainControl = 0;
	GlyphControl = 0;
	SceneControl = 0;
	ControlPanel = 0;

	Manager->RemoveAllWidgets();
	GetCanvas()->RemoveAllChildren();
}
開發者ID:iondune,項目名稱:Aqueous,代碼行數:13,代碼來源:CGUIContext.cpp

示例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);
}
開發者ID:pontocom,項目名稱:opensdrm,代碼行數:22,代碼來源:GTKWindow.cpp

示例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();
}
開發者ID:kleopatra999,項目名稱:pgadmin3,代碼行數:38,代碼來源:composit.cpp

示例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()));
}
開發者ID:authenticate,項目名稱:GWEN,代碼行數:14,代碼來源:ComboBox.cpp

示例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 );
}
開發者ID:ACrazyer,項目名稱:NeuralSystemsBCI2000,代碼行數:14,代碼來源:GUIReinforcementView.cpp

示例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);
    }
}
開發者ID:ruifig,項目名稱:nutcracker,代碼行數:23,代碼來源:font.cpp


注:本文中的GetCanvas函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。