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

C++ Invoke函数代码示例

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

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



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

示例1: Invoke

void ArpTwoStateButton::MouseDown(BPoint where)
{
	inherited::MouseDown(where);
	mSwitched = !mPressed;

	/* Quick hack */
	mPressed = !mPressed;
	BMessage*	msg = 0;
	if( Message() ) msg = new BMessage( *Message() );
	if( msg ) msg->AddBool("on", mPressed);
	Invoke(msg);

	Invalidate();
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:14,代码来源:ArpTwoStateButton.cpp


示例2: va_start

void uDelegate::Invoke(uTRef retval, size_t count, ...)
{
    va_list ap;
    va_start(ap, count);
    void** args = count > 0
        ? (void**)U_ALLOCA(count * sizeof(void*))
        : NULL;

    for (size_t i = 0; i < count; i++)
        args[i] = va_arg(ap, void*);

    va_end(ap);
    Invoke(retval, args, count);
}
开发者ID:brapastor,项目名称:Fuse_Pract,代码行数:14,代码来源:ObjectModel.cpp


示例3: string

void
Spinner::MessageReceived(BMessage *msg)
{
	if (msg->what == M_TEXT_CHANGED) {
		BString string(fTextControl->Text());
		int32 newvalue = 0;
		
		sscanf(string.String(),"%ld",&newvalue);
		if (newvalue >= GetMin() && newvalue <= GetMax()) {
			// new value is in range, so set it and go
			SetValue(newvalue);
			Invoke();
			Draw(Bounds());
			ValueChanged(Value());
		} else {
			// new value is out of bounds. Clip to range if current value is not
			// at the end of its range
			if (newvalue < GetMin() && Value() != GetMin()) {
				SetValue(GetMin());
				Invoke();
				Draw(Bounds());
				ValueChanged(Value());
			} else if (newvalue>GetMax() && Value() != GetMax()) {
				SetValue(GetMax());
				Invoke();
				Draw(Bounds());
				ValueChanged(Value());
			} else {
				char string[100];
				sprintf(string,"%ld",Value());
				fTextControl->SetText(string);
			}
		}
	}
	else
		BControl::MessageReceived(msg);
}
开发者ID:Barrett17,项目名称:Faber,代码行数:37,代码来源:Spinner.cpp


示例4: TEST_F

TEST_F(DataTest, testGetData) {{
	InSequence s;
	char buffer[256];
	memset(buffer, 0, sizeof(buffer));
	HDDEDATA hData = (HDDEDATA)88772;
		
	EXPECT_CALL(winApi, DdeGetData(hData, _, sizeof(buffer), 5))
		.Times(1)
		.WillOnce(Invoke(this, &DataTest::DdeGetData));

	auto_drop<Data> data(new Data(&instance, &winApi, hData));

	ASSERT_EQ(8, data->getData((LPBYTE)buffer, sizeof(buffer), 5));
	ASSERT_STREQ("zulu 19", buffer);
}}
开发者ID:robot-aquila,项目名称:wquik,代码行数:15,代码来源:DataTest.cpp


示例5: TEST_F

TEST_F(ScriptRunnerTest, QueueReentrantScript_Async)
{
    MockScriptLoader scriptLoader1(m_element.get());
    MockScriptLoader scriptLoader2(m_element.get());
    MockScriptLoader scriptLoader3(m_element.get());

    m_scriptRunner->queueScriptForExecution(&scriptLoader1, ScriptRunner::ASYNC_EXECUTION);
    m_scriptRunner->queueScriptForExecution(&scriptLoader2, ScriptRunner::ASYNC_EXECUTION);
    m_scriptRunner->queueScriptForExecution(&scriptLoader3, ScriptRunner::ASYNC_EXECUTION);
    m_scriptRunner->notifyScriptReady(&scriptLoader1, ScriptRunner::ASYNC_EXECUTION);

    EXPECT_CALL(scriptLoader1, execute()).WillOnce(Invoke([&scriptLoader2, this] {
        m_order.push_back(1);
        m_scriptRunner->notifyScriptReady(&scriptLoader2, ScriptRunner::ASYNC_EXECUTION);
    }));

    EXPECT_CALL(scriptLoader2, execute()).WillOnce(Invoke([&scriptLoader3, this] {
        m_order.push_back(2);
        m_scriptRunner->notifyScriptReady(&scriptLoader3, ScriptRunner::ASYNC_EXECUTION);
    }));

    EXPECT_CALL(scriptLoader3, execute()).WillOnce(Invoke([this] {
        m_order.push_back(3);
    }));

    // Make sure that re-entrant calls to notifyScriptReady don't cause ScriptRunner::execute to do
    // more work than expected.
    m_platform.runSingleTask();
    EXPECT_THAT(m_order, ElementsAre(1));

    m_platform.runSingleTask();
    EXPECT_THAT(m_order, ElementsAre(1, 2));

    m_platform.runSingleTask();
    EXPECT_THAT(m_order, ElementsAre(1, 2, 3));
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:36,代码来源:ScriptRunnerTest.cpp


示例6: switch

void ArpColourControl::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case _R_MSG:
			Invoke();
			if (mR && mA) {
				((_ArpRgbaControl*)mA)->SetColor(mR->Value(), -1, -1);
				mA->Invalidate();
			}
//			printf("R Changed\n");
			break;
		case _G_MSG:
			Invoke();
			if (mG && mA) {
				((_ArpRgbaControl*)mA)->SetColor(-1, mG->Value(), -1);
				mA->Invalidate();
			}
//			printf("G Changed\n");
			break;
		case _B_MSG:
			Invoke();
			if (mB && mA) {
				((_ArpRgbaControl*)mA)->SetColor(-1, -1, mB->Value());
				mA->Invalidate();
			}
//			printf("B Changed\n");
			break;
		case _A_MSG:
			Invoke();
//			printf("A Changed\n");
			break;
		default:
			inherited::MessageReceived(msg);
			break;
	}
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:36,代码来源:ArpColourControl.cpp


示例7: TEST_F

TEST_F(ScriptRunnerTest, QueueReentrantScript_ManyAsyncScripts)
{
    OwnPtrWillBeRawPtr<MockScriptLoader> scriptLoaders[20];
    for (int i = 0; i < 20; i++)
        scriptLoaders[i] = nullptr;

    for (int i = 0; i < 20; i++) {
        scriptLoaders[i] = MockScriptLoader::create(m_element.get());
        EXPECT_CALL(*scriptLoaders[i], isReady()).WillRepeatedly(Return(true));

        m_scriptRunner->queueScriptForExecution(scriptLoaders[i].get(), ScriptRunner::ASYNC_EXECUTION);

        if (i > 0) {
            EXPECT_CALL(*scriptLoaders[i], execute()).WillOnce(Invoke([this, i] {
                m_order.append(i);
            }));
        }
    }

    m_scriptRunner->notifyScriptReady(scriptLoaders[0].get(), ScriptRunner::ASYNC_EXECUTION);
    m_scriptRunner->notifyScriptReady(scriptLoaders[1].get(), ScriptRunner::ASYNC_EXECUTION);

    EXPECT_CALL(*scriptLoaders[0], execute()).WillOnce(Invoke([&scriptLoaders, this] {
        for (int i = 2; i < 20; i++)
            m_scriptRunner->notifyScriptReady(scriptLoaders[i].get(), ScriptRunner::ASYNC_EXECUTION);
        m_order.append(0);
    }));

    m_platform.runAllTasks();

    int expected[] = {
        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
    };

    EXPECT_THAT(m_order, testing::ElementsAreArray(expected));
}
开发者ID:iHaD,项目名称:chromium-1,代码行数:36,代码来源:ScriptRunnerTest.cpp


示例8: Bounds

void
BIconButton::MouseUp(BPoint where)
{
	if (!IsValid())
		return;

	if (IsEnabled() && _HasFlags(STATE_PRESSED)
		&& Bounds().Contains(where)) {
		Invoke();
	} else if (Bounds().Contains(where))
		SetInside(true);

	_SetFlags(STATE_PRESSED, false);
	_SetTracking(false);
}
开发者ID:Barrett17,项目名称:Faber,代码行数:15,代码来源:IconButton.cpp


示例9: MouseDown

	virtual void MouseDown(BPoint point)
	{
		// Don't reopen the menu if it's already open or freshly closed.
		bigtime_t clickSpeed = 2000000;
		get_click_speed(&clickSpeed);
		bigtime_t clickTime = Window()->CurrentMessage()->FindInt64("when");
		if (!IsEnabled() || (Value() == B_CONTROL_ON) 
			|| clickTime < fCloseTime + clickSpeed) {
			return;
		}

		// Invoke must be called before setting B_CONTROL_ON
		// for the button to stay "down"
		Invoke();
		SetValue(B_CONTROL_ON);
	}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:16,代码来源:TabManager.cpp


示例10: Bounds

void
BRadioButton::MouseUp(BPoint point)
{
	if (!IsTracking())
		return;

	fOutlined = Bounds().Contains(point);
	if (fOutlined) {
		fOutlined = false;
		SetValue(B_CONTROL_ON);
		Invoke();
	}
	Invalidate();

	SetTracking(false);
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:16,代码来源:RadioButton.cpp


示例11: main

int main()
{
	Lua lua;
	auto global = lua.GetGlobalEnvironment();
	
	// Write a function in Lua
	lua.RunScript(
		"function addTwo(a)\n"
		"  return a+2\n"
		"end\n"
	);

	auto addTwo = global.Get< LuaFunction<int(int)> >("addTwo");
	
	return addTwo.Invoke(5) != 7;
}
开发者ID:lambage,项目名称:Lambgine,代码行数:16,代码来源:testfunctionreturn.cpp


示例12: get_click_speed

void ArpIntControl::MouseUp(BPoint pt)
{
	if (IsEnabled() == false) return;

	if (mMotion) mMotion->MouseUp(pt);
	if ( mDownPt == pt && Bounds().Contains(pt) ) {
		/* Start the edit timer in case the user is invoking an inline
		 * text view.
		 */
		bigtime_t	doubleClickTime;
		get_click_speed(&doubleClickTime);
		doubleClickTime *= 2;
		SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
		StartTimer(BMessage(EDIT_START_MSG), doubleClickTime);
	} else Invoke();
}
开发者ID:tgkokk,项目名称:Sequitur,代码行数:16,代码来源:ArpIntControl.cpp


示例13: SetValue

void
BButton::MouseUp(BPoint where)
{
	if (!IsTracking())
		return;

	if (Bounds().Contains(where)) {
		if (fBehavior == B_TOGGLE_BEHAVIOR)
			SetValue(_Flag(FLAG_WAS_PRESSED) ? B_CONTROL_OFF : B_CONTROL_ON);

		Invoke();
	} else if (_Flag(FLAG_FLAT))
		Invalidate();

	SetTracking(false);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:16,代码来源:Button.cpp


示例14: SetValue

//------------------------------------------------------------------------------
void BControl::KeyDown(const char *bytes, int32 numBytes)
{
	if (*bytes == B_ENTER || *bytes == B_SPACE)
	{
		if (!fEnabled)
			return;

		if (Value())
			SetValue(B_CONTROL_OFF);
		else
			SetValue(B_CONTROL_ON);
		
		Invoke();
	}
	else
		BView::KeyDown(bytes, numBytes);
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:18,代码来源:Control.cpp


示例15: switch

void
ColorStepView::MessageReceived(BMessage *message)
{
	switch (message->what) {
		case kMSGSliderChanged:
			fSliderPosition = fSlider->Position();
			_CalculatePerformanceSteps();
			Invalidate();
			break;
		case kSteppingChanged:
			Invoke();
			break;
		default:
			BView::MessageReceived(message);
			break;
	}
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:17,代码来源:ColorStepView.cpp


示例16: snooze

void
BPictureButton::MouseUp(BPoint point)
{
	if (IsEnabled() && IsTracking()) {
		if (Bounds().Contains(point)) {
			if (fBehavior == B_ONE_STATE_BUTTON) {
				if (Value() == B_CONTROL_ON) {
					snooze(75000);
					SetValue(B_CONTROL_OFF);
				}
			}
			Invoke();
		}

		SetTracking(false);
	}
}
开发者ID:naveedasmat,项目名称:haiku,代码行数:17,代码来源:PictureButton.cpp


示例17: CallMethod

wxVariant wxAutomationObject::CallMethod(const wxString& member,
        const wxVariant& arg1, const wxVariant& arg2,
        const wxVariant& arg3, const wxVariant& arg4,
        const wxVariant& arg5, const wxVariant& arg6)
{
    const wxVariant** args = new const wxVariant*[6];
    int i = 0;
    if (!arg1.IsNull())
    {
        args[i] = & arg1;
        i ++;
    }
    if (!arg2.IsNull())
    {
        args[i] = & arg2;
        i ++;
    }
    if (!arg3.IsNull())
    {
        args[i] = & arg3;
        i ++;
    }
    if (!arg4.IsNull())
    {
        args[i] = & arg4;
        i ++;
    }
    if (!arg5.IsNull())
    {
        args[i] = & arg5;
        i ++;
    }
    if (!arg6.IsNull())
    {
        args[i] = & arg6;
        i ++;
    }
    wxVariant retVariant;
    if (!Invoke(member, DISPATCH_METHOD, retVariant, i, NULL, args))
    {
        retVariant.MakeNull();
    }
    delete[] args;
    return retVariant;
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:45,代码来源:automtn.cpp


示例18: GetProperty

wxVariant wxAutomationObject::GetProperty(const wxString& property,
        const wxVariant& arg1, const wxVariant& arg2,
        const wxVariant& arg3, const wxVariant& arg4,
        const wxVariant& arg5, const wxVariant& arg6)
{
    const wxVariant** args = new const wxVariant*[6];
    int i = 0;
    if (!arg1.IsNull())
    {
        args[i] = & arg1;
        i ++;
    }
    if (!arg2.IsNull())
    {
        args[i] = & arg2;
        i ++;
    }
    if (!arg3.IsNull())
    {
        args[i] = & arg3;
        i ++;
    }
    if (!arg4.IsNull())
    {
        args[i] = & arg4;
        i ++;
    }
    if (!arg5.IsNull())
    {
        args[i] = & arg5;
        i ++;
    }
    if (!arg6.IsNull())
    {
        args[i] = & arg6;
        i ++;
    }
    wxVariant retVariant;
    if (!Invoke(property, DISPATCH_PROPERTYGET, retVariant, i, NULL, args))
    {
        retVariant.MakeNull();
    }
    delete[] args;
    return retVariant;
}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:45,代码来源:automtn.cpp


示例19: TEST

TEST(ClosureTest, ClosureDeletesSelf) {
  TestQObject sender;
  TestQObject receiver;
  _detail::ClosureBase* closure = NewClosure(
      &sender, SIGNAL(Emitted()),
      &receiver, SLOT(Invoke()));
  _detail::ObjectHelper* helper = closure->helper();
  QSignalSpy spy(helper, SIGNAL(destroyed()));
  EXPECT_EQ(0, receiver.invoked());
  sender.Emit();
  EXPECT_EQ(1, receiver.invoked());

  EXPECT_EQ(0, spy.count());
  QEventLoop loop;
  QObject::connect(helper, SIGNAL(destroyed()), &loop, SLOT(quit()));
  loop.exec();
  EXPECT_EQ(1, spy.count());
}
开发者ID:GitAnt,项目名称:Clementine,代码行数:18,代码来源:closure_test.cpp


示例20: DEBUG

/** \brief Invoked
 * Handles when an icon within the view is invoked. If it is a directory
 * it should, the current directory should move into it. If it is a file
 * it should be opened if possible and otherwise it should be downloaded.
 *
 * \todo Should attempt to dowload and open the remote file if it's not a directory?
 * \todo What should be the default action when the file type is unknown?
 */
void RemoteIconView::Invoked( uint nIcon, IconData* pcData )
{
//	DEBUG( "RemoteIconView::Invoked on icon %i (%s)\n", nIcon, GetIconString( nIcon, 0 ).c_str() );
	
	RemoteIconData* pcRData = (RemoteIconData*)pcData;
	
	if( pcRData->m_cNode.IsDir() ) {
		Path cPath = m_zPath;
		cPath.Append( pcRData->m_cNode.m_zName );
		DEBUG( "RemoteView: Changing to %s\n", cPath.GetPath().c_str() );
		if( m_pcDirChangedMsg ) {
			Message cTmp = *m_pcDirChangedMsg;
			cTmp.AddString( "file/path", cPath.GetPath() );
			Invoke( &cTmp );
		}
		SetPath( cPath.GetPath() );
	}
}
开发者ID:PyroOS,项目名称:Pyro,代码行数:26,代码来源:remoteview.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ InvokeViaPolicy函数代码示例发布时间:2022-05-30
下一篇:
C++ InvitePlayerToWar函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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