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


C++ BLooper类代码示例

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


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

示例1: Quit

/**
	Quit()
	@case	Looper is unlocked
	@result	Prints message "ERROR - you must Lock a looper before calling
			Quit(), team=%ld, looper=%s\n"
 */
void
TQuitTest::QuitTest1()
{
	BLooper* looper = new BLooper;
	looper->Unlock();
	looper->Quit();
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:13,代码来源:QuitTest.cpp

示例2: switch

void
ColorPickerPanel::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case MSG_CANCEL:
		case MSG_DONE:
		{
			BMessage msg('PSTE');
			BLooper* looper = fTarget ? fTarget->Looper() : be_app;
			if (fMessage)
				msg = *fMessage;
			if (message->what == MSG_DONE)
				store_color_in_message(&msg, fColorPickerView->Color());
			msg.AddRect("panel frame", Frame());
			msg.AddInt32("panel mode", fColorPickerView->Mode());
			msg.AddBool("begin", true);
			looper->PostMessage(&msg, fTarget);
			PostMessage(B_QUIT_REQUESTED);
			break;
		}
		default:
			Panel::MessageReceived(message);
			break;
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:25,代码来源:ColorPickerPanel.cpp

示例3: RemoveHandler

/**
	RemoveHandler(BHandler* handler)
	@case		handler is NULL
	@param		handler	NULL
	@results	RemoveHandler() returns false.  R5 implementation seg faults;
				we've fixed that.
 */
void TRemoveHandlerTest::RemoveHandler1()
{
	BLooper Looper;
#ifndef TEST_R5
	CPPUNIT_ASSERT(!Looper.RemoveHandler(NULL));
#endif
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:14,代码来源:RemoveHandlerTest.cpp

示例4: MakeFocus

void TTimeTextView::MakeFocus(bool focusState)
{
	BTextView::MakeFocus(focusState);
	
	// Inform target
	if ( focusState == false)
	{
		if (m_Target)
		{
			BLooper *looper = m_Target->Looper();
			
			if ( looper->Lock() )
			{
				CheckLastEdit();
				
				for (int16 index = 1; index < 5; index++)
					ConvertToTime(index);
				
				if (m_MessageID)
				{
					BMessage *message = new BMessage(m_MessageID);
					message->AddInt32("TheTime", m_Time);
					m_Target->MessageReceived( message);
					looper->Unlock();
					delete message;
				}
			}			
		}
	}
}
开发者ID:ModeenF,项目名称:UltraDV,代码行数:30,代码来源:TTimeTextView.cpp

示例5:

void
BHandler::SetFilterList(BList* filters)
{
	BLooper* looper = fLooper;
	if (looper != NULL && !looper->IsLocked()) {
		debugger("Owning Looper must be locked before calling SetFilterList");
		return;
	}

	/**
		@note	I would like to use BObjectList internally, but this function is
				spec'd such that fFilters would get deleted and then assigned
				'filters', which would obviously mess this up.  Wondering if
				anyone ever assigns a list of filters and then checks against
				FilterList() to see if they are the same.
	 */

	// TODO: Explore issues with using BObjectList
	if (fFilters != NULL) {
		fFilters->DoForEach(FilterDeleter);
		delete fFilters;
	}

	fFilters = filters;
	if (fFilters) {
		for (int32 i = 0; i < fFilters->CountItems(); ++i) {
			BMessageFilter* filter =
				static_cast<BMessageFilter*>(fFilters->ItemAt(i));
			if (filter != NULL)
				filter->SetLooper(looper);
		}
	}
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:33,代码来源:Handler.cpp

示例6: IsTargetLocal

/*
	bool IsTargetLocal() const
	@case 2			this is initialized to local target with preferred handler
	@results		should return true.
 */
void TargetTester::IsTargetLocalTest2()
{
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BMessenger messenger(NULL, looper, &result);
	CHK(messenger.IsTargetLocal() == true);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:14,代码来源:TargetTester.cpp

示例7: quitter

/*
	BHandler *Target(BLooper **looper) const
	@case 2			this is initialized to local target with preferred handler,
					looper is NULL
	@results		should return NULL.
 */
void TargetTester::TargetTest2()
{
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BMessenger messenger(NULL, looper, &result);
	CHK(messenger.Target(NULL) == NULL);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:15,代码来源:TargetTester.cpp

示例8: Looper

// SelectionChanged
void
SimpleListView::SelectionChanged()
{
	BLooper* looper = Looper();
	if (fSelectionChangeMessage && looper) {
		BMessage message(*fSelectionChangeMessage);
		looper->PostMessage(&message);
	}
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例9:

void
TQuitTest::QuitTest2()
{
	BLooper* looper = new BLooper;
	looper->Run();

	BMessage reply;
	BMessenger(looper).SendMessage(B_QUIT_REQUESTED, &reply);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:9,代码来源:QuitTest.cpp

示例10: SetNextHandler

/**
	SetNextHandler(BHandler* handler);
	NextHandler();
	@case			Handler1 and Handler2 belong to the same locked BLooper
	@param	handler	Valid BHandler pointer
	@results		Returns Handler2
 */
void TSetNextHandlerTest::SetNextHandler11()
{
	BLooper Looper;
	BHandler Handler1;
	BHandler Handler2;
	Looper.AddHandler(&Handler1);
	Looper.AddHandler(&Handler2);
	Handler1.SetNextHandler(&Handler2);
	CPPUNIT_ASSERT(Handler1.NextHandler() == &Handler2);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:17,代码来源:SetNextHandlerTest.cpp

示例11: Looper

status_t ObservableHandler::notify(
	BMessage*								message) {
#if DEBUG
	BLooper* l = Looper();
	ASSERT(l);
	ASSERT(l->IsLocked());
#endif

	return Invoke(message);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:10,代码来源:ObservableHandler.cpp

示例12: Unlock

		void Unlock()
		{
			if (fHasLock)
			{
				BLooper *looper;
				fMessenger->Target(&looper);
				if (looper)
					looper->Unlock();
				fHasLock = false;
			}
		}
开发者ID:axeld,项目名称:driveencryption,代码行数:11,代码来源:PaneSwitch.cpp

示例13: gui_window_destroy

void gui_window_destroy(struct gui_window *g)
{
	if (!g)
		return;

	if (g->prev)
		g->prev->next = g->next;
	else
		window_list = g->next;

	if (g->next)
		g->next->prev = g->prev;


	LOG(("Destroying gui_window %p", g));
	assert(g != NULL);
	assert(g->bw != NULL);
	LOG(("     Scaffolding: %p", g->scaffold));
	LOG(("     Window name: %s", g->bw->name));

	if (g->view == NULL)
		return;
	if (!g->view->LockLooper())
		return;

	BLooper *looper = g->view->Looper();
	/* If we're a top-level gui_window, destroy our scaffold */
	if (g->toplevel) {
		g->view->RemoveSelf();
		delete g->view;
		nsbeos_scaffolding_destroy(g->scaffold);
	} else {
		g->view->RemoveSelf();
		delete g->view;
		looper->Unlock();
	}
	//XXX 
	//looper->Unlock();

#warning FIXME

#if 0 /* GTK */
	/* If we're a top-level gui_window, destroy our scaffold */
	if (g->scrolledwindow == NULL) {
	  	gtk_widget_destroy(GTK_WIDGET(g->viewport));
		nsgtk_scaffolding_destroy(g->scaffold);
	} else {
	  	gtk_widget_destroy(GTK_WIDGET(g->scrolledwindow));
	}
#endif

	free(g);

}
开发者ID:pcwalton,项目名称:NetSurf,代码行数:54,代码来源:window.cpp

示例14: MouseWatcher

int32 MouseWatcher(void* data)
{
	BMessenger* TheMessenger = (BMessenger*)data;
	BPoint PreviousPos;
	uint32 PreviousButtons;
	bool FirstCheck = true;
	BMessage MessageToSend;
	MessageToSend.AddPoint("where",BPoint(0,0));
	MessageToSend.AddInt32("buttons",0);
	MessageToSend.AddInt32("modifiers",0);
	while(true)
	{
		if (!TheMessenger->LockTarget())
		{
			delete TheMessenger;
			return 0;			// window is dead so exit
		}
		BLooper *TheLooper;
		BView* TheView = (BView*)TheMessenger->Target(&TheLooper);
		BPoint Where;
		uint32 Buttons;
		TheView->GetMouse(&Where,&Buttons,false);
		if(FirstCheck)
		{
			PreviousPos = Where;
			PreviousButtons = Buttons;
			FirstCheck = false;
		}
		bool Send = false;
		if(Buttons != PreviousButtons || Buttons == 0 || Where != PreviousPos)
		{
			if(Buttons == 0)
				MessageToSend.what = MW_MOUSE_UP;
			else if(Buttons != PreviousButtons)
				MessageToSend.what = MW_MOUSE_DOWN;
			else
				MessageToSend.what = MW_MOUSE_MOVED;
			MessageToSend.ReplacePoint("where",Where);
			MessageToSend.ReplaceInt32("buttons",Buttons);
			MessageToSend.ReplaceInt32("modifiers",modifiers());
			Send = true;
		}
		TheLooper->Unlock();
		if(Send)
			TheMessenger->SendMessage(&MessageToSend);
		if(Buttons == 0)
		{
			//Button was released
			delete TheMessenger;
			return 0;
		}
		snooze(50000);
	}
}
开发者ID:mariuz,项目名称:haiku,代码行数:54,代码来源:MouseWatcher.cpp

示例15: instance

SharedTimerHaiku* SharedTimerHaiku::instance()
{
    BLooper* looper = BLooper::LooperForThread(find_thread(0));
    static SharedTimerHaiku* timer;

    if (!timer) {
        BAutolock lock(looper);
        timer = new SharedTimerHaiku();
        looper->AddCommonFilter(timer);
    }

    return timer;
}
开发者ID:,项目名称:,代码行数:13,代码来源:


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