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


C++ Action函數代碼示例

本文整理匯總了C++中Action函數的典型用法代碼示例。如果您正苦於以下問題:C++ Action函數的具體用法?C++ Action怎麽用?C++ Action使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Action函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetMousePos

void LineEdit::DragAndDrop(Point p, PasteClip& d)
{
	if(IsReadOnly()) return;
	int c = GetMousePos(p);
	if(AcceptText(d)) {
		NextUndo();
		int a = sb.y;
		int sell, selh;
		WString text = GetWString(d);
		if(GetSelection(sell, selh)) {
			if(c >= sell && c < selh) {
				RemoveSelection();
				if(IsDragAndDropSource())
					d.SetAction(DND_COPY);
				c = sell;
			}
			else
			if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
				if(c > sell)
					c -= selh - sell;
				RemoveSelection();
				d.SetAction(DND_COPY);
			}
		}
		int count = Insert(c, text);
		sb.y = a;
		SetFocus();
		SetSelection(c, c + count);
		Action();
		return;
	}
	if(!d.IsAccepted()) return;
	if(!isdrag) {
		isdrag = true;
		ScrollIntoCursor();
	}
	Point dc = Null;
	if(c >= 0)
		dc = GetColumnLine(c);
	if(dc != dropcaret) {
		RefreshDropCaret();
		dropcaret = dc;
		RefreshDropCaret();
	}
}
開發者ID:pedia,項目名稱:raidget,代碼行數:45,代碼來源:LineEdit.cpp

示例2: GetMousePos

void DocEdit::DragAndDrop(Point p, PasteClip& d)
{
	if(IsReadOnly()) return;
	int c = GetMousePos(p);
	if(AcceptText(d)) {
		NextUndo();
		int a = sb;
		int sell, selh;
		WString txt = GetWString(d);
		if(GetSelection(sell, selh)) {
			if(c >= sell && c < selh) {
				if(!IsReadOnly())
					RemoveSelection();
				if(IsDragAndDropSource())
					d.SetAction(DND_COPY);
				c = sell;
			}
			else
			if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
				if(c > sell)
					c -= selh - sell;
				if(!IsReadOnly())
					RemoveSelection();
				d.SetAction(DND_COPY);
			}
		}
		int count = Insert(c, txt);
		sb = a;
		SetFocus();
		SetSelection(c, c + count);
		Action();
		return;
	}
	if(!d.IsAccepted()) return;
	Point dc = Null;
	if(c >= 0) {
		Point cr = GetCaret(c);
		dc = Point(cr.x + 1, cr.y);
	}
	if(dc != dropcaret) {
		RefreshDropCaret();
		dropcaret = dc;
		RefreshDropCaret();
	}
}
開發者ID:guowei8412,項目名稱:upp-mirror,代碼行數:45,代碼來源:DocEdit.cpp

示例3: Action

  //Does not save distance tables!  This is
  //to save lightweight data!!
  ///Does not save R or buffers!
  void Bead_ParticleSet::RestoreOldData()
  {
    //    for (int i=0;i<R.size();i++)
    //      R[i]=R_saved[i];
    for(int i=0; i<Gradients_saved.size(); i++) *Gradients[i] = *(Gradients_saved[i]);
    for(int i=0; i<Laplacians_saved.size(); i++) *Laplacians[i] = *(Laplacians_saved[i]);
    for(int i=0; i<DriftVectors_saved.size(); i++) *DriftVectors[i] = *(DriftVectors_saved[i]);
    //    Action=Action_saved;
    for (int ipsi=0;ipsi<nPsi;ipsi++)
      for (int i=0;i<3;i++)
	Action(ipsi,i)=Action_saved(ipsi,i);

    BeadSignWgt=BeadSignWgt_saved;
    TransProb[0]=TransProb_saved[0];
    TransProb[1]=TransProb_saved[1];
    Properties=properties_saved;
    Drift=Drift_saved;
  }
開發者ID:digideskio,項目名稱:qmcpack,代碼行數:21,代碼來源:Bead_ParticleSet.cpp

示例4: Core_EnableStepping

void MemCheck::JitBefore(u32 addr, bool write, int size, u32 pc)
{
	int mask = MEMCHECK_WRITE | MEMCHECK_WRITE_ONCHANGE;
	if (write && (cond & mask) == mask)
	{
		lastAddr = addr;
		lastPC = pc;
		lastSize = size;

		// We have to break to find out if it changed.
		Core_EnableStepping(true);
	}
	else
	{
		lastAddr = 0;
		Action(addr, write, size, pc);
	}
}
開發者ID:AdmiralCurtiss,項目名稱:ppsspp,代碼行數:18,代碼來源:Breakpoints.cpp

示例5: PerformActionForDir

DWORD PerformActionForDir(HWND hwnd, DWORD (*Action)(HWND,const char*), BOOL recursive)
{
	HANDLE sh;
	char  *name;
	DWORD  sum;

	sum=0;
	name=pafDir+lstrlen(pafDir);
	lstrcat(pafDir,"*.*");
    sh=FindFirstFile(pafDir,&pafdW32fd);
	*name=0;
    if (sh!=INVALID_HANDLE_VALUE)
    {
		do
		{
			if (IsAllCancelled())
				break;
			if (pafdW32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
			{
				if ((recursive) && (pafdW32fd.cFileName[0]!='.'))
				{
					name=pafDir+lstrlen(pafDir);
					lstrcat(pafDir,pafdW32fd.cFileName);
					lstrcat(pafDir,"\\");
					sum+=PerformActionForDir(hwnd,Action,recursive);
					*name=0;
				}
			}
			else
			{
				name=pafDir+lstrlen(pafDir);
				lstrcat(pafDir,pafdW32fd.cFileName);
				ShowProgressHeaderMsg(pafDir);
				ResetCancelFlag();
				sum+=Action(hwnd,pafDir);
				*name=0;
			}
		}
		while (FindNextFile(sh,&pafdW32fd));
		FindClose(sh);
    }

	return sum;
}
開發者ID:ValeryAnisimovsky,項目名稱:GameAudioPlayer,代碼行數:44,代碼來源:Misc.c

示例6: start

void start()
{
	ClockWise(1,0,number[0][med]);
	ClockWise(1,0,number[0][med]);
	ClockWise(1,0,number[0][med]);
	ClockWise(3,0,number[1][med]);
	ClockWise(5,0,number[2][med]);
	ClockWise(7,0,number[3][med]);
	while(JudgeToGO(7,number[3][med])!=1);
	
	ClockWise(2,0,number[0][_high]);
	while(JudgeToGO(2,number[0][_high])!=1);
	REG_Write(4,0,number[1][_high]);
	REG_Write(8,0,number[3][_high]);
	Action();
	while(JudgeToGO(8,number[3][_high])!=1);
	ClockWise(6,0,number[2][_high]);
	while(JudgeToGO(6,number[2][_high])!=1);
}
開發者ID:MrChang0,項目名稱:rubik,代碼行數:19,代碼來源:mofang.c

示例7: Updatable

// Gunner Constructor
Gunner::Gunner(const GunnerTemplate &aTemplate, unsigned int aId)
: Updatable(aId)
{
	SetAction(Action(this, &Gunner::Update));

	Entity *entity = Database::entity.Get(mId);
#ifdef GUNNER_TRACK_DEQUE
	mTrackPos.push_back(entity->GetPosition());
	mTrackPos.push_back(entity->GetPosition());
#else
	mTrackCount = xs_CeilToInt(aTemplate.mFollowLength/GUNNER_TRACK_GRANULARITY) + 2;
	mTrackPos = new Vector2[mTrackCount];
	mTrackFirst = 0;
	mTrackLast = 1;
	mTrackPos[mTrackFirst] = entity->GetPosition();
	mTrackPos[mTrackLast] = entity->GetPosition();
#endif
	mTrackLength = 0.0f;
}
開發者ID:Fissuras,項目名稱:videoventure,代碼行數:20,代碼來源:Gunner.cpp

示例8: Confidence

Action UCTAgent::UCB1(const State & state, const double exploration)
{
    double max = -1.0e6;
    std::vector<int> ties;

    for (int i = 0; i < ActionSize; ++i) {
        double tmp = qtable_[state][i] + exploration * Confidence(state_counts_[state], state_action_counts_[state][i]);

        if (tmp >= max) {
            if (tmp > max) {
                max = tmp;
                ties.clear();
            }
            ties.push_back(i);
        }
    }

    return Action(ties[rand() % ties.size()]);
}
開發者ID:aijunbai,項目名稱:maxq-op,代碼行數:19,代碼來源:uct.cpp

示例9: GetLastVisibleTab

void HeaderCtrl::MouseMove(Point p, dword keyflags) {
	if(isdrag) {
		ti = GetLastVisibleTab() + 1;
		for(int i = 0; i < GetCount(); i++)
			if(col[i].visible) {
				Rect r = GetTabRect(i).OffsetedHorz(-sb);
				if(p.x < r.left + r.Width() / 2) {
					ti = i;
					break;
				}
			}
		dragx = p.x;
		Refresh();
		return;
	}
	int q = GetSplit(p.x);
	int cx = ~q;
	if(cx >= 0 && cx < col.GetCount() && !IsNull(col[cx].tip))
		Tip(col[cx].tip);
	if(mode == FIXED)
		return;
	q = IsNull(q) || q >= 0 ? -1 : -1 - q;
	if(q != light)
		Refresh();
	if(!HasCapture())
		return;
	Size sz = GetSize();
	int x = mode == SCROLL ? p.x + sb : min(sz.cx, p.x);
	if(split >= 0) {
		int w = x - colRect.left;
		if(w < 0) w = 0;
		if(w != GetTabWidth(split)) {
			SetTabWidth0(split, w);
			Refresh();
			if(track) {
				Sync();
				Action();
				WhenLayout();
			}
		}
	}
}
開發者ID:AbdelghaniDr,項目名稱:mirror,代碼行數:42,代碼來源:HeaderCtrl.cpp

示例10: MoveTab

void HeaderCtrl::LeftUp(Point, dword) {
	if(isdrag) {
		if(li >= 0 && ti >= 0)
			MoveTab(li, ti);
		li = ti = -1;
		Refresh();
	}
	else
	if(pushi >= 0 && push)
		col[pushi].WhenAction();
	push = false;
	ti = li = pushi = -1;
	isdrag = false;
	Refresh();
	if(split >= 0 && !track) {
		Action();
		WhenLayout();
	}
	DoSbTotal();
}
開發者ID:AbdelghaniDr,項目名稱:mirror,代碼行數:20,代碼來源:HeaderCtrl.cpp

示例11: Updatable

Weapon::Weapon(const WeaponTemplate &aTemplate, unsigned int aId)
: Updatable(aId)
, mControlId(0)
, mChannel(aTemplate.mChannel)
, mPrevFire(0.0f)
, mTrack(0)
, mBurst(0)
, mTimer(0.0f)
, mPhase(aTemplate.mPhase)
, mAmmo(0)
{
	SetAction(Action(this, &Weapon::Update));

	// if the weapon uses ammo...
	if (aTemplate.mCost)
	{
		// find the specified resource
		mAmmo = FindResource(aId, aTemplate.mType);
	}
}
開發者ID:Fissuras,項目名稱:videoventure,代碼行數:20,代碼來源:WeaponOriginal.cpp

示例12: TEST

TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) {
  VerifyEndCallback EndCallback;

  FixedCompilationDatabase Compilations("/", std::vector<std::string>());
  std::vector<std::string> Sources;
  Sources.push_back("/a.cc");
  Sources.push_back("/b.cc");
  ClangTool Tool(Compilations, Sources);

  Tool.mapVirtualFile("/a.cc", "void a() {}");
  Tool.mapVirtualFile("/b.cc", "void b() {}");

  std::unique_ptr<FrontendActionFactory> Action(
      newFrontendActionFactory(&EndCallback, &EndCallback));
  Tool.run(Action.get());

  EXPECT_TRUE(EndCallback.Matched);
  EXPECT_EQ(2u, EndCallback.BeginCalled);
  EXPECT_EQ(2u, EndCallback.EndCalled);
}
開發者ID:CODECOMMUNITY,項目名稱:clang,代碼行數:20,代碼來源:ToolingTest.cpp

示例13: if

//=========================================================================
void TaxNodeVisitor::VisitLeavesToRoot(TreeTaxNode *node)
{
    if ( node->getGnode()  == NULL )
    {
        if ( createGraphNodes )
            graphView->CreateGraphNode(node);
        else if ( !visitNullGnodes )
            return;
    }
    bool visit_children = shouldVisitChildren(node);
    if ( visit_children )
    {
        beforeVisitChildren(node);
        ThreadSafeListLocker<TreeTaxNode *> locker(&node->children);
        for ( TaxNodeIterator it  = node->children.begin(); it != node->children.end(); it++ )
            VisitLeavesToRoot(*it);
        afterVisitChildren(node);
    }
    Action(node);
}
開發者ID:vryukhko,項目名稱:marva,代碼行數:21,代碼來源:tree_tax_node.cpp

示例14: loadAction

static std::error_code loadAction(ExecState& exec, const JSObject& ruleObject, Action& action, bool& validSelector)
{
    VM& vm = exec.vm();
    auto scope = DECLARE_THROW_SCOPE(vm);

    validSelector = true;
    const JSValue actionObject = ruleObject.get(&exec, Identifier::fromString(&exec, "action"));
    if (!actionObject || scope.exception() || !actionObject.isObject())
        return ContentExtensionError::JSONInvalidAction;

    const JSValue typeObject = actionObject.get(&exec, Identifier::fromString(&exec, "type"));
    if (!typeObject || scope.exception() || !typeObject.isString())
        return ContentExtensionError::JSONInvalidActionType;

    String actionType = typeObject.toWTFString(&exec);

    if (actionType == "block")
        action = ActionType::BlockLoad;
    else if (actionType == "ignore-previous-rules")
        action = ActionType::IgnorePreviousRules;
    else if (actionType == "block-cookies")
        action = ActionType::BlockCookies;
    else if (actionType == "css-display-none") {
        JSValue selector = actionObject.get(&exec, Identifier::fromString(&exec, "selector"));
        if (!selector || scope.exception() || !selector.isString())
            return ContentExtensionError::JSONInvalidCSSDisplayNoneActionType;

        String s = selector.toWTFString(&exec);
        if (!isValidSelector(s)) {
            // Skip rules with invalid selectors to be backwards-compatible.
            validSelector = false;
            return { };
        }
        action = Action(ActionType::CSSDisplayNoneSelector, s);
    } else if (actionType == "make-https") {
        action = ActionType::MakeHTTPS;
    } else
        return ContentExtensionError::JSONInvalidActionType;

    return { };
}
開發者ID:eocanha,項目名稱:webkit,代碼行數:41,代碼來源:ContentExtensionParser.cpp

示例15: chkForFingerPrint

//************************************************************************************************************************************************
void chkForFingerPrint()
{
	if (fps.IsPressFinger())
	{
                wdt_reset();	//reset the watchdog timer for any normal op that may take time.	
                fps.CaptureFinger(false);
		int id = fps.Identify1_N();
		if (id < 200)
		{
			//Serial.print("Verified ID:");
			//Serial.println(id);
                        blink(OKLedPin, 100, 2);
                        Action(1);   //Open the Garage door
		}
		else
		{
			//Serial.println("Finger not found");
                        blink(NotOKLedPin, 100, 3);
		}
	}  
}
開發者ID:gion86,項目名稱:Fingerprint,代碼行數:22,代碼來源:GarageDoorMonitor.c


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