• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UndoManagerPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: handleUndoRedoListSelectionChanged

void handleUndoRedoListSelectionChanged(ListSelectionEventDetails* const details,
                                        UndoManagerPtr TheUndoManager)
{
	if(!dynamic_cast<ListSelectionModel*>(details->getSource())->isSelectionEmpty())
    {
		Int32 ListSelectedIndex(dynamic_cast<ListSelectionModel*>(details->getSource())->getAnchorSelectionIndex());

		TheUndoManager->undoOrRedoTo(ListSelectedIndex);
    }
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:10,代码来源:02GenericFieldEditor.cpp


示例2: handleUndoRedoListSelectionChanged

void handleUndoRedoListSelectionChanged(ListSelectionEventDetails* const details,
                                        List* const UndoRedoList,
                                        UndoManagerPtr TheUndoManager)
{
    if(!UndoRedoList->getSelectionModel()->isSelectionEmpty())
    {
        Int32 ListSelectedIndex(UndoRedoList->getSelectionModel()->getAnchorSelectionIndex());

        TheUndoManager->undoOrRedoTo(ListSelectedIndex);
    }
}
开发者ID:pjcamp,项目名称:OpenSGToolbox,代码行数:11,代码来源:40UndoableCommand.cpp


示例3: handleUndoManagerStateChanged

void handleUndoManagerStateChanged(ChangeEventDetails* const details,
                                   Button* const undoButton,
                                   Button* const redoButton,
                                   DefaultListModel* const undoRedoListModel,
                                   UndoManagerPtr TheUndoManager)
{
	while(undoRedoListModel->getSize()-1 > TheUndoManager->numberOfRedos() + TheUndoManager->numberOfUndos())
	{
		undoRedoListModel->popBack();
	}

	//Resize
	while(undoRedoListModel->getSize()-1 < TheUndoManager->numberOfRedos() + TheUndoManager->numberOfUndos())
	{
		undoRedoListModel->pushBack(boost::any(std::string("")));
	}

	UInt32 UndoCount(TheUndoManager->numberOfUndos());
	for(UInt32 i(0) ; i<UndoCount ; ++i)
	{
		undoRedoListModel->set(i+1, boost::any(std::string(TheUndoManager->editToBeUndone(i)->getUndoPresentationName())));
	}
	UInt32 RedoCount(TheUndoManager->numberOfRedos());
	for(UInt32 i(0) ; i<RedoCount ; ++i)
	{
		undoRedoListModel->set(i+TheUndoManager->numberOfUndos()+1, boost::any(std::string(TheUndoManager->editToBeRedone(i)->getRedoPresentationName())));
	}

	if((UndoCount == 0 && undoButton->getEnabled()) ||
		(UndoCount != 0 && !undoButton->getEnabled()) )
	{
			undoButton->setEnabled(UndoCount != 0);
	}
	if((RedoCount == 0 && redoButton->getEnabled()) ||
		(RedoCount != 0 && !redoButton->getEnabled()) )
	{
			redoButton->setEnabled(RedoCount != 0);
	}
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:39,代码来源:02GenericFieldEditor.cpp


示例4: main

int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    {
        // Set up Window
        WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
        TutorialWindow->initWindow();

        // Create the SimpleSceneManager helper
        SimpleSceneManager sceneManager;
        TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
        TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));

        // Tell the Manager what to manage
        sceneManager.setWindow(TutorialWindow);

        TutorialWindow->connectKeyTyped(boost::bind(keyPressed, _1));

        // Make Torus Node (creates Torus in background of scene)
        NodeRecPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);

        // Make Main Scene Node and add the Torus
        NodeRecPtr scene = Node::create();
        scene->setCore(Group::create());
        scene->addChild(TorusGeometryNode);

        // Create the Graphics
        GraphicsRecPtr TutorialGraphics = Graphics2D::create();

        // Initialize the LookAndFeelManager to enable default settings
        LookAndFeelManager::the()->getLookAndFeel()->init();
        /******************************************************

          Create an Button Component and
          a simple Font.
          See 17Label_Font for more
          information about Fonts.

         ******************************************************/

        LineBorderRecPtr ChangableBorder = LineBorder::create();
        ChangableBorder->setColor(Color4f(0.0,0.0,0.0,1.0));

        ColorLayerRecPtr ChangableBackground = ColorLayer::create();
        ChangableBackground->setColor(Color4f(1.0,1.0,1.0,1.0));

        LabelRecPtr ChangableLabel = Label::create();

        ChangableLabel->setText("Changable");
        ChangableLabel->setBorders(ChangableBorder);
        ChangableLabel->setBackgrounds(ChangableBackground);

        //Command Buttons
        UndoManagerPtr TheUndoManager = UndoManager::create();

        CommandManagerPtr TheCommandManager = CommandManager::create(TheUndoManager);
        ButtonRecPtr BorderRedButton = Button::create();
        BorderRedButton->setText("Border Red");
        BorderRedButton->setPreferredSize(Vec2f(85, 20));
        BorderRedButton->connectActionPerformed(boost::bind(handleSetBorderColorAction,
                                                            _1,
                                                            TheCommandManager,
                                                            ChangableBorder.get(),
                                                            Color4f(1.0,0.0,0.0,1.0)));

        ButtonRecPtr BorderGreenButton = Button::create();
        BorderGreenButton->setText("Border Green");
        BorderGreenButton->setPreferredSize(Vec2f(85, 20));
        BorderGreenButton->connectActionPerformed(boost::bind(handleSetBorderColorAction,
                                                            _1,
                                                            TheCommandManager,
                                                            ChangableBorder.get(),
                                                            Color4f(0.0,1.0,0.0,1.0)));

        ButtonRecPtr BorderBlueButton = Button::create();
        BorderBlueButton->setText("Border Blue");
        BorderBlueButton->setPreferredSize(Vec2f(85, 20));
        BorderBlueButton->connectActionPerformed(boost::bind(handleSetBorderColorAction,
                                                            _1,
                                                            TheCommandManager,
                                                            ChangableBorder.get(),
                                                            Color4f(0.0,0.0,1.0,1.0)));

        //Background
        ButtonRecPtr BackgroundRedButton = Button::create();
        BackgroundRedButton->setText("Background Red");
        BackgroundRedButton->setPreferredSize(Vec2f(105, 20));
        BackgroundRedButton->connectActionPerformed(boost::bind(handleSetBackgroundColorAction,
                                                                _1,
                                                                TheCommandManager,
                                                                ChangableBackground.get(),
                                                                Color4f(1.0,0.0,0.0,1.0)));

        ButtonRecPtr BackgroundGreenButton = Button::create();
        BackgroundGreenButton->setText("Background Green");
        BackgroundGreenButton->setPreferredSize(Vec2f(105, 20));
        BackgroundGreenButton->connectActionPerformed(boost::bind(handleSetBackgroundColorAction,
                                                                _1,
//.........这里部分代码省略.........
开发者ID:pjcamp,项目名称:OpenSGToolbox,代码行数:101,代码来源:40UndoableCommand.cpp


示例5: handleRedoButtonAction

void handleRedoButtonAction(ActionEventDetails* const details,
                            UndoManagerPtr TheUndoManager)
{
    TheUndoManager->redo();
}
开发者ID:pjcamp,项目名称:OpenSGToolbox,代码行数:5,代码来源:40UndoableCommand.cpp


示例6: main

int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);
    {
        // Set up Window
        WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
        TutorialWindow->initWindow();

        // Create the SimpleSceneManager helper
        SimpleSceneManager sceneManager;
        TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
        TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));

        // Tell the Manager what to manage
        sceneManager.setWindow(TutorialWindow);

        TutorialWindow->connectKeyTyped(boost::bind(keyTyped, _1));

        // Make Torus Node (creates Torus in background of scene)
        NodeRefPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);

        // Make Main Scene Node and add the Torus
        NodeRefPtr scene = OSG::Node::create();
        scene->setCore(OSG::Group::create());
        scene->addChild(TorusGeometryNode);

        // Create the Graphics
        GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create();

        // Initialize the LookAndFeelManager to enable default settings
        LookAndFeelManager::the()->getLookAndFeel()->init();

        //Background
        SolidBackgroundRefPtr TutorialBackground = SolidBackground::create();
        TutorialBackground->setColor(Color3f(1.0,0.0,0.0));
    		    
        UndoManagerPtr TheUndoManager = UndoManager::create();
        CommandManagerPtr TheCommandManager = CommandManager::create(TheUndoManager);

        //UndoList
	    DefaultListModelRecPtr UndoRedoListModel = DefaultListModel::create();
        UndoRedoListModel->pushBack(boost::any(std::string("Top")));

	    ListRecPtr UndoRedoList = List::create();
        UndoRedoList->setPreferredSize(Vec2f(250, 300));
        UndoRedoList->setOrientation(List::VERTICAL_ORIENTATION);
	    UndoRedoList->setModel(UndoRedoListModel);

        UndoRedoList->getSelectionModel()->connectSelectionChanged(boost::bind(&handleUndoRedoListSelectionChanged, _1, TheUndoManager));

        ButtonRecPtr UndoButton = OSG::Button::create();
        UndoButton->setText("Undo");
	    UndoButton->setEnabled(false);
        UndoButton->connectActionPerformed(boost::bind(&handleUndoButtonAction, _1, TheUndoManager));
    	

        ButtonRecPtr RedoButton = OSG::Button::create();
        RedoButton->setText("Redo");
	    RedoButton->setEnabled(false);
        RedoButton->connectActionPerformed(boost::bind(&handleRedoButtonActionPerformed, _1, TheUndoManager));

        TheUndoManager->connectStateChanged(boost::bind(&handleUndoManagerStateChanged, _1, UndoButton.get(), RedoButton.get(), UndoRedoListModel.get(), TheUndoManager));

        // Create a ScrollPanel for easier viewing of the List (see 27ScrollPanel)
        ScrollPanelRefPtr UndoRedoScrollPanel = ScrollPanel::create();
        UndoRedoScrollPanel->setPreferredSize(Vec2f(200,200));
        UndoRedoScrollPanel->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW);
        UndoRedoScrollPanel->setViewComponent(UndoRedoList);


        //Edited Label
        LabelRecPtr EditedLabel = Label::create();
        EditedLabel->setText("Can be edited");
        EditedLabel->setPreferredSize(Vec2f(100.0f,18.0f));

        //Editor Field
        LabelRecPtr TheTextEditorLabel = Label::create();
        TheTextEditorLabel->setText("Text");
        TheTextEditorLabel->setPreferredSize(Vec2f(100.0f, 20.0f));

        FieldEditorComponentRefPtr TheTextEditor = FieldEditorFactory::the()->createDefaultEditor(EditedLabel,
                                                                                                  Label::TextFieldId,
                                                                                                  TheCommandManager);
        TheTextEditor->setPreferredSize(Vec2f(100.0f, 20.0f));

        LabelRecPtr ThePreferredSizeEditorLabel = Label::create();
        ThePreferredSizeEditorLabel->setText("PreferredSize");
        ThePreferredSizeEditorLabel->setPreferredSize(Vec2f(100.0f, 20.0f));

        FieldEditorComponentRefPtr ThePreferredSizeEditor =
            FieldEditorFactory::the()->createDefaultEditor(EditedLabel,
                                                           Label::PreferredSizeFieldId,
                                                           TheCommandManager);
        ThePreferredSizeEditor->setPreferredSize(Vec2f(150.0f, 20.0f));

        //Editing Panel
        LayoutRefPtr EditorPanelLayout = OSG::FlowLayout::create();
        PanelRecPtr EditorPanel = Panel::create();
        EditorPanel->setPreferredSize(Vec2f(200.0f,200.0f));
//.........这里部分代码省略.........
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:101,代码来源:02GenericFieldEditor.cpp


示例7: stateChanged

	virtual void stateChanged(const ChangeEventUnrecPtr e)
	{
		while(UndoRedoListModel->getSize()-1 > TheUndoManager->numberOfRedos() + TheUndoManager->numberOfUndos())
		{
			UndoRedoListModel->popBack();
		}

		//Resize
		while(UndoRedoListModel->getSize()-1 < TheUndoManager->numberOfRedos() + TheUndoManager->numberOfUndos())
		{
			UndoRedoListModel->pushBack(boost::any(std::string("")));
		}

		UInt32 UndoCount(TheUndoManager->numberOfUndos());
		for(UInt32 i(0) ; i<UndoCount ; ++i)
		{
			UndoRedoListModel->set(i+1, boost::any(std::string(TheUndoManager->editToBeUndone(i)->getUndoPresentationName())));
		}
		UInt32 RedoCount(TheUndoManager->numberOfRedos());
		for(UInt32 i(0) ; i<RedoCount ; ++i)
		{
			UndoRedoListModel->set(i+TheUndoManager->numberOfUndos()+1, boost::any(std::string(TheUndoManager->editToBeRedone(i)->getRedoPresentationName())));
		}

		if((UndoCount == 0 && UndoButton->getEnabled()) ||
			(UndoCount != 0 && !UndoButton->getEnabled()) )
		{
				UndoButton->setEnabled(UndoCount != 0);
		}
		if((RedoCount == 0 && RedoButton->getEnabled()) ||
			(RedoCount != 0 && !RedoButton->getEnabled()) )
		{
				RedoButton->setEnabled(RedoCount != 0);
		}
	}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:35,代码来源:01ChangeFieldCommands.cpp


示例8: selectionChanged

    virtual void selectionChanged(const ListSelectionEventUnrecPtr e)
    {
		if(!UndoRedoList->getSelectionModel()->isSelectionEmpty())
        {
			Int32 ListSelectedIndex(UndoRedoList->getSelectionModel()->getAnchorSelectionIndex());


			TheUndoManager->undoOrRedoTo(ListSelectedIndex);
        }
    }
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:10,代码来源:01ChangeFieldCommands.cpp


示例9: main

int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    // Set up Window
    TutorialWindow = createNativeWindow();
    TutorialWindow->initWindow();

    TutorialWindow->setDisplayCallback(display);
    TutorialWindow->setReshapeCallback(reshape);

    TutorialKeyListener TheKeyListener;
    TutorialWindow->addKeyListener(&TheKeyListener);

    // Make Torus Node (creates Torus in background of scene)
    NodeRefPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);

    // Make Main Scene Node and add the Torus
    NodeRefPtr scene = OSG::Node::create();
        scene->setCore(OSG::Group::create());
        scene->addChild(TorusGeometryNode);

    // Create the Graphics
    GraphicsRefPtr TutorialGraphics = OSG::Graphics2D::create();

    // Initialize the LookAndFeelManager to enable default settings
    LookAndFeelManager::the()->getLookAndFeel()->init();

    //Background
    TutorialBackground = GradientBackground::create();
    TutorialBackground->addLine(Color3f(1.0,0.0,0.0), 0.0);
    TutorialBackground->addLine(Color3f(0.0,1.0,0.0), 0.2);
    TutorialBackground->addLine(Color3f(0.0,0.0,1.0), 0.4);
    TutorialBackground->addLine(Color3f(0.0,1.0,1.0), 0.6);
    TutorialBackground->addLine(Color3f(1.0,1.0,0.0), 0.8);
    TutorialBackground->addLine(Color3f(1.0,1.0,1.0), 1.0);

	TheUndoManager = UndoManager::create();
	UndoManagerChangeListener TheUndoManagerChangeListener;
	TheUndoManager->addChangeListener(&TheUndoManagerChangeListener);
    
    LabelRefPtr SingleFieldLabel = OSG::Label::create();
    SingleFieldLabel->setText("Single Field");
    SingleFieldLabel->setBorders(NULL);
    SingleFieldLabel->setBackgrounds(NULL);

    LabelRefPtr MultiFieldLabel = OSG::Label::create();
    MultiFieldLabel->setText("Multi Field");
    MultiFieldLabel->setBorders(NULL);
    MultiFieldLabel->setBackgrounds(NULL);

    LabelRefPtr SinglePtrFieldLabel = OSG::Label::create();
    SinglePtrFieldLabel->setText("Single Ptr Field");
    SinglePtrFieldLabel->setBorders(NULL);
    SinglePtrFieldLabel->setBackgrounds(NULL);

    LabelRefPtr MultiPtrFieldLabel = OSG::Label::create();
    MultiPtrFieldLabel->setText("Multi Ptr Field");
    MultiPtrFieldLabel->setBorders(NULL);
    MultiPtrFieldLabel->setBackgrounds(NULL);

    TabPanelRefPtr ExampleTabPanel = OSG::TabPanel::create();
    ExampleTabPanel->setPreferredSize(Vec2f(600,600));
    ExampleTabPanel->addTab(SingleFieldLabel, createSingleFieldPanel());
    ExampleTabPanel->addTab(MultiFieldLabel, createMultiFieldPanel());
    ExampleTabPanel->addTab(SinglePtrFieldLabel, createSinglePtrFieldPanel());
    ExampleTabPanel->addTab(MultiPtrFieldLabel, createMultiPtrFieldPanel());
    ExampleTabPanel->setTabAlignment(0.5f);
    ExampleTabPanel->setTabPlacement(TabPanel::PLACEMENT_NORTH);
    ExampleTabPanel->setSelectedIndex(0);

	//UndoList
	UndoRedoListModel = DefaultListModel::create();
    UndoRedoListModel->pushBack(boost::any(std::string("Top")));
	ListSelectionModelPtr UndoRedoListSelectionModel(new DefaultListSelectionModel());

	UndoRedoList = List::create();
        UndoRedoList->setPreferredSize(Vec2f(200, 300));
        UndoRedoList->setOrientation(List::VERTICAL_ORIENTATION);
		UndoRedoList->setModel(UndoRedoListModel);

    UndoRedoList->setSelectionModel(UndoRedoListSelectionModel);

    UndoRedoListListener TheUndoRedoListListener;
    UndoRedoList->getSelectionModel()->addListSelectionListener(&TheUndoRedoListListener);

    UndoButton = OSG::Button::create();
            UndoButton->setText("Undo");
			UndoButton->setEnabled(TheUndoManager->numberOfUndos() != 0);
    UndoButtonActionListener TheUndoButtonActionListener;
    UndoButton->addActionListener(&TheUndoButtonActionListener);
	

    RedoButton = OSG::Button::create();
            RedoButton->setText("Redo");
			RedoButton->setEnabled(TheUndoManager->numberOfRedos() != 0);
    RedoButtonActionListener TheRedoButtonActionListener;
    RedoButton->addActionListener(&TheRedoButtonActionListener);

//.........这里部分代码省略.........
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:101,代码来源:01ChangeFieldCommands.cpp


示例10: actionPerformed

   virtual void actionPerformed(const ActionEventUnrecPtr e)
    {
		TheUndoManager->redo();
    }
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:4,代码来源:01ChangeFieldCommands.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UndoRedo类代码示例发布时间:2022-05-31
下一篇:
C++ UndoManager类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap