当前位置: 首页>>代码示例>>C++>>正文


C++ IAction类代码示例

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


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

示例1: OnEditUndo

void CGeorgesEditDoc::OnEditUndo() 
{
	if (!_UndoBuffer.empty ())
	{
		// Get an action
		IAction *action = _UndoBuffer.back ();
		_UndoBuffer.pop_back ();

		// Undo it
		bool modified;
		action->doAction (*this, false, modified, false);

		// Put in the redo list
		_RedoBuffer.push_back (action);

		CMDIFrameWnd* pMainWnd = (CMDIFrameWnd*)AfxGetMainWnd();

		// Get the active MDI child window.
		CMDIChildWnd* pChild = (CMDIChildWnd*)pMainWnd->MDIGetActive();
		pChild->RecalcLayout();
		pChild->UpdateWindow();

		_UndoModify--;
		if ( (_UndoModify == 0) && IsModified () )
		{
			setModifiedState (false);
		}
		else if ( (_UndoModify != 0) && !IsModified () )
		{
			setModifiedState (true);
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:33,代码来源:georges_edit_doc.cpp

示例2: OnEditRedo

void CGeorgesEditDoc::OnEditRedo() 
{
	if (!_RedoBuffer.empty ())
	{
		// Get an action
		IAction *action = _RedoBuffer.back ();
		_RedoBuffer.pop_back ();

		// Undo it
		bool modified;
		action->doAction (*this, true, modified, false);

		// Put in the redo list
		_UndoBuffer.push_back (action);

		((CMainFrame*)(theApp.m_pMainWnd))->RecalcLayout ();

		_UndoModify++;
		if ( (_UndoModify == 0) && IsModified () )
		{
			setModifiedState (false);
		}
		else if ( (_UndoModify != 0) && !IsModified () )
		{
			setModifiedState (true);
		}
	}
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:28,代码来源:georges_edit_doc.cpp

示例3: GetPrototypeByGUID

void ActionList::LoadFromS11nBlock(const ActionListS11nBlock& block)
{
	block.guid.GetValueIfExists(m_guid);

	if (block.name.Exists())
		m_name = pfc::stringcvt::string_wide_from_utf8(block.name.GetValue()).get_ptr();

	if (block.actions.Exists())
	{
		for (int i = 0; i < block.actions.GetSize(); ++i)
		{
			const ActionS11nBlock& actionBlock = block.actions.GetAt(i);

			// actionGUID is a required field, unnecessary to check if it exists.
			IAction* pPrototype = ServiceManager::Instance().GetActionPrototypesManager().
				GetPrototypeByGUID(actionBlock.actionGUID.GetValue());

			if (!pPrototype)
				continue;

			std::auto_ptr<IAction> pAction(pPrototype->Clone());
			pAction->LoadFromS11nBlock(actionBlock);

			m_actions.push_back(pAction);
		}
	}
}
开发者ID:andrewsmolko,项目名称:foo_scheduler,代码行数:27,代码来源:action_list.cpp

示例4: actionTriggeredSlot

	void IToolBar::actionTriggeredSlot(bool checked)
	{
		IAction* action = dynamic_cast<IAction*> (sender());
		if(action)
		{
			action->execute();
		}					
	}
开发者ID:sld666666,项目名称:HtmlWriter,代码行数:8,代码来源:IToolBar.cpp

示例5: main

int main()
{
   std::cout << "action hello" << std::endl;
   Printer p;
   boost::function<void(std::string)> f = boost::bind(&Printer::printString, &p, _1);

   f(std::string("hello"));

   //boost::function<void(std::string)> f = boost::bind(&Printer::printString, &p);
   IAction* action = new TSingleArgAction<std::string>(ActionType::PRINT_STRING, f);

   TSingleArg<std::string> args("hello");
   action->call(args);
}
开发者ID:jiwaharlal,项目名称:cpp_experience,代码行数:14,代码来源:ActionMain.cpp

示例6: destroyQAction

void QtMenu::destroyQAction(IAction& action)
{
	auto it = actions_.find(&action);
	if (it != actions_.end())
	{
		const std::string groupID(action.group());
		if (!groupID.empty())
		{
			auto groupItr = groups_.find(groupID);
			if (groupItr != groups_.end())
			{
				groupItr->second->removeAction(it->second.data());
				if (groupItr->second->actions().empty())
				{
					groups_.erase(groupItr);
				}
			}
		}
		actions_.erase(it);
	}

	auto findIt = connections_.find(&action);
	if (findIt != connections_.end())
	{
		connections_.erase(findIt);
	}
}
开发者ID:wgsyd,项目名称:wgtf,代码行数:27,代码来源:qt_menu.cpp

示例7: addAction

void QtMenuBar::addAction(IAction& action, const char* path)
{
	auto qAction = getQAction(action);
	if (qAction == nullptr)
	{
		qAction = createQAction(action);
	}
	assert(qAction != nullptr);

	path = relativePath(path);
	if (path == nullptr || strlen(path) == 0)
	{
		path = action.text();
	}

	auto tok = strchr(path, '.');
	auto menuPath = tok != nullptr ? QString::fromUtf8(path, tok - path) : path;
	QMenu* menu = qMenuBar_.findChild<QMenu*>(menuPath, Qt::FindDirectChildrenOnly);
	if (menu == nullptr)
	{
		menu = qMenuBar_.addMenu(menuPath);
		menu->setObjectName(menuPath);
	}
	path = tok != nullptr ? tok + 1 : nullptr;

	QtMenu::addMenuAction(*menu, *qAction, path);
	qMenuBar_.repaint();
}
开发者ID:Aidanboneham,项目名称:wgtf,代码行数:28,代码来源:qt_menu_bar.cpp

示例8: TestStoryboard

void TestStoryboard() {
    List<Point> points;
    points.Add(Point(0, 0, 0));
    points.Add(Point(1, 1, 1));
    points.Add(Point(2, 2, 2));
    points.Add(Point(3, 3, 3));

    Shape shape(points);
    IAction* a = new TranslateAction(3, 3 , 3);
    IAction* b = new TranslateAction(2, 2 , 2);
    IAction* c = new TranslateAction(5, 5 , 5);
    a->SetSteps(3);
    b->SetSteps(3);
    c->SetSteps(4);
    b->SetWithPrevious(true);

    Storyboard sb;
    sb.Actions().Add(a);
    sb.Actions().Add(b);
    sb.Actions().Add(c);
    sb.SetShapeObject(shape);

    assert(sb.TotalSteps() == 10);
    assert(sb.CurrentAction() == NULL);

    sb.Play();
    for(size_t i = 0; i < sb.TotalSteps(); i++) {
        sb.NextStep();
    }
}
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:30,代码来源:Tests.hpp

示例9: execute

void Console::execute(const string& line) {
  vector<string> parts = StringUtil::split(line, ' ');
  if(parts.size() > 0) {
    string command = parts[0];
    IAction* action = basicLanguage[command];
    if(action) {
      string param;
      if(parts.size() > 1) {
        param = parts[1];
      }
      else {
        param = "";
      }

      action->execute(param);
    }
  }
}
开发者ID:dasaro77,项目名称:OGLText,代码行数:18,代码来源:Console.cpp

示例10: while

  void ActionGroup::DoActions(IEntity* theEntity)
  {
    // Make sure clear all of our IAction classes
    std::map<const typeActionID, IAction*>::iterator anActionIter;

    // Start at the beginning of the list of IAction classes
    anActionIter = mActive.begin();
    while(anActionIter != mActive.end())
    {
      // Get the IAction to execute
      IAction* anAction = anActionIter->second;

      // Move on to the next iterator
      anActionIter++;

      // Call the IAction DoAction method and provide theEntity to it
      anAction->DoAction(theEntity);
    }
  }
开发者ID:Moltov,项目名称:Time-Voyager,代码行数:19,代码来源:ActionGroup.cpp

示例11: animContext

void CInteractiveObjectRegistry::ApplyInteractionToObject(IEntity *pEntity, const TagID interactionTypeTag, const int interactionIndex) const
{
	if (m_pDatabaseObject && m_pControllerDef)
	{
		IMannequin &mannequinSys = gEnv->pGame->GetIGameFramework()->GetMannequinInterface();
		SAnimationContext animContext(*m_pControllerDef);

		IActionController *pActionController = mannequinSys.CreateActionController(pEntity, animContext);

		int scopeContextID = m_pControllerDef->m_scopeContexts.Find("SlaveObject");
		pActionController->SetScopeContext(scopeContextID, *pEntity, pEntity->GetCharacter(0), m_pDatabaseObject);
		TagState fragTags = TAG_STATE_EMPTY;
		const CTagDefinition *pTagDef = m_pControllerDef->GetFragmentTagDef(m_interactFragID);
		if (pTagDef)
		{
			pTagDef->Set(fragTags, interactionTypeTag, true);
		}
		IAction *pAction = new TAction<SAnimationContext>(0, m_interactFragID, fragTags);
		pAction->SetOptionIdx(interactionIndex);
		pActionController->Queue(pAction);

		// Set the time increments to non-zero to force the ActionController::Update() to drive the animation to the end.
		// When time increment is zero, animation position will not update. This will be changed to a simpler process by Tom Berry at some point.
		const uint32 totalScopes = pActionController->GetTotalScopes();
		for(uint32 s=0; s<totalScopes; ++s)
		{
			pActionController->GetScope(s)->IncrementTime(0.001f);
		}
		pActionController->Update(1000.0f);
		// "false" here leaves the anim on the transition queue in the animation system so it isn't cleared on pActionController->Release().
		pActionController->ClearScopeContext(scopeContextID, false);

		pActionController->Release();

		CRecordingSystem* pRecordingSystem = g_pGame->GetRecordingSystem();
		if (pRecordingSystem)
		{
			pRecordingSystem->OnInteractiveObjectFinishedUse(pEntity->GetId(), interactionTypeTag, interactionIndex);
		}

	}
}
开发者ID:PiratesAhoy,项目名称:HeartsOfOak-Core,代码行数:42,代码来源:InteractiveObjectRegistry.cpp

示例12: return

EPriorityComparison CReplayObjectAction::ComparePriority( const IAction &actionCurrent ) const
{
	if (m_trumpsPrevious)
	{
		return ((IAction::Installed == actionCurrent.GetStatus() && IAction::Installing & ~actionCurrent.GetFlags()) ? Higher : BaseClass::ComparePriority(actionCurrent));
	}
	else
	{
		return Equal;
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:11,代码来源:ReplayObject.cpp

示例13: addAction

void LayoutManager::addAction(IAction& action)
{
	actions_.push_back(&action);

	auto window = getWindow(action.windowId());
	if (window == nullptr)
	{
		return;
	}

	addAction(actions_.back(), *window);
}
开发者ID:Aidanboneham,项目名称:wgtf,代码行数:12,代码来源:layout_manager.cpp

示例14: update

void ActionChain::update(Time delta) {
    if(m_isAlive) {
        // Store currently used action for convenience
        IAction* action = m_actions[m_currentIndex];

        // Update the action
        action->update(delta);

        // Check if action is finished
        if(action->isFinished()) {
            action->close();

            // Iterate to the next action
            m_currentIndex++;

            // If the action was last one in the chain
            if(m_currentIndex == m_actions.size()) {
                // If the chain is looping, start over
                if(m_isLooping) {
                    for(IAction* action : m_actions) {
                        action->reset();
                    }

                    m_currentIndex = 0;

                    // Initialize first action
                    m_actions[m_currentIndex]->init();
                }
                // Otherwise destroy the chain
                else {
                    m_isAlive = false;
                }
            }
            else {
                // Initialize next action
                m_actions[m_currentIndex]->init();
            }
        }
    }
}
开发者ID:MicroGamesDev,项目名称:MicroGames-FW,代码行数:40,代码来源:ActionChain.cpp

示例15: removeAction

void QtMenuBar::removeAction(IAction& action)
{
	auto qAction = getQAction(action);
	if (qAction == nullptr)
	{
		NGT_ERROR_MSG("Target action '%s' '%s' does not exist\n", action.text(),
		              StringUtils::join(action.paths(), ';').c_str());
		return;
	}

	auto menus = qMenuBar_.findChildren<QMenu*>(QString(), Qt::FindDirectChildrenOnly);
	for (auto& menu : menus)
	{
		QtMenu::removeMenuAction(*menu, *qAction);
		if (menu->isEmpty())
		{
			delete menu;
		}
	}

	destroyQAction(action);
}
开发者ID:Aidanboneham,项目名称:wgtf,代码行数:22,代码来源:qt_menu_bar.cpp


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