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


C++ BLooper::AddHandler方法代码示例

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


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

示例1:

/**
	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

示例2:

/**
	RemoveHandler(BHandler* handler)
	@case		handler is valid, looper is unlocked
	@param		handler	Valid BHandler pointer, assigned to looper
	@results	goes to debugger, but removes handler anyway
 */
void TRemoveHandlerTest::RemoveHandler3()
{
	DEBUGGER_ESCAPE;

	BLooper Looper;
	BHandler Handler;
	Looper.AddHandler(&Handler);
	Looper.Unlock();
	CPPUNIT_ASSERT(Looper.RemoveHandler(&Handler));
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:16,代码来源:RemoveHandlerTest.cpp

示例3: BMessageFilter

/**
	RemoveHandler(BHandler* handler)
	@case		Valid looper and handler; handler has filters
	@param		handler	Valid BHandler pointer
	@results	RemoveHandler() returns true
				handler->FilterList() returns NULL after removal
 */
void TRemoveHandlerTest::RemoveHandler5()
{
	BLooper Looper;
	BHandler Handler;
	BMessageFilter* MessageFilter = new BMessageFilter('1234');

	Handler.AddFilter(MessageFilter);
	Looper.AddHandler(&Handler);
	CPPUNIT_ASSERT(Looper.RemoveHandler(&Handler));
	CPPUNIT_ASSERT(Handler.FilterList());
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:18,代码来源:RemoveHandlerTest.cpp

示例4: IsTargetLocal

/*
	bool IsTargetLocal() const
	@case 3			this is initialized to local target with specific handler
	@results		should return true.
 */
void TargetTester::IsTargetLocalTest3()
{
	// create looper and handler
	status_t result = B_OK;
	BLooper *looper = new BLooper;
	looper->Run();
	LooperQuitter quitter(looper);
	BHandler *handler = new BHandler;
	HandlerDeleter deleter(handler);
	CHK(looper->Lock());
	looper->AddHandler(handler);
	looper->Unlock();
	// create the messenger and do the checks
	BMessenger messenger(handler, NULL, &result);
	CHK(messenger.IsTargetLocal() == true);
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:21,代码来源:TargetTester.cpp

示例5:

/*!	\brief		Adds the handler to window's looper
 */
void 		CalendarModulePreferencesView::AttachedToWindow()
{
	BLooper* looper = this->Looper();
	if ( looper && looper->LockLooper() )
	{
		looper->AddHandler( ( BHandler* )this );
		looper->UnlockLooper();	
	}
	
	UpdateTargetting();		// Updates targets of all contents
	
	BView::AttachedToWindow();
	
	// Fill the rest of the interface
	this->Looper()->PostMessage( calendarModules->FindMarked()->Message(), this );
	
}	// <-- end of CalendarModulePreferencesView::AttachedToWindow()
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:19,代码来源:CalendarModulePreferencesView.cpp

示例6:

/*!	\brief		Setting the view as preferred handler
 */
void	CategoryPreferencesView::AttachedToWindow( void )
{
	BLooper* looper = this->Looper();
	if ( looper && looper->LockLooper() )
	{
		looper->AddHandler( ( BHandler* )this );
		looper->UnlockLooper();	
	}
	
	addButton->SetTarget( this );
	editButton->SetTarget( this );
	listView->SetTarget( this );
	
	for ( int i = 0; i < listMenu->CountItems(); ++i )
	{
		( listMenu->ItemAt( i ) )->SetTarget( this );
	}
	
	BView::AttachedToWindow();
	
}	// <-- end of function CategoryPreferencesView::AttachedToWindow
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:23,代码来源:CategoryPreferencesView.cpp

示例7: AttachedToWindow

/*!	
	\brief			Sets up the view color and calls this view's children.
*/
void CalendarControl::AttachedToWindow() {
	
	// Get the view color of the father
	if ( Parent() ) {
		SetViewColor( Parent()->ViewColor() );
	}
	// Attach to window both current view and all of its children
	BControl::AttachedToWindow();
	
	// This view should respond to the messages - thus the Looper must know it
	BLooper* looper = ( BLooper* )Looper();
	if ( looper && looper->LockLooper() ) {
		looper->AddHandler( ( BHandler* )this );
		looper->UnlockLooper();
	}
	
	UpdateTargets( fDateSelector );
	
	this->InvalidateLayout();
	this->Relayout();
	this->Invalidate();
}
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:25,代码来源:CalendarControl.cpp

示例8: r

/*!	\brief			Constructor of CategoryPreferencesView
 *	\details		It's a descendant of BView.
 *	\param[in]	frame	The frame rectangle of the view.
 */
CategoryPreferencesView::CategoryPreferencesView( BRect frame )
	:
	BView( frame,
		   "Category Preferences",
		   B_FOLLOW_ALL_SIDES,
		   B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE )
{
	BLayoutItem* layoutItem = NULL;
	BMessage* toSend = NULL;
	menuField = NULL;
	
	this->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
	
	/*!	\note	Layout of the view
	 *			The view has a grid layout. It's arranged in the following way:
	 *			1)	Left column - list of Categories (CategoryList) that
	 *				contains all categories currently available.
	 *			2) 	Right column - three buttons, from top to bottom:
	 *				2a)	Edit currently selected category - guess what it's doing
	 *				2b) Add a new category
	 *				2c)	Merge a current directory into another one + menu with
	 *					all categories. The category selected in the list is disabled.
	 * \note	Restrictions:
	 *			a) The list of categories is scrolled.
	 *			b) If no category is selected, then
	 *				i) 	"Edit" button is disabled
	 *				ii)	"Merge to" field is disabled
	 *			
	 */
	BGridLayout* gridLayout = new BGridLayout();
	if ( !gridLayout )
	{
		/* Panic! */
		exit( 1 );
	}
	// Margins from the sides of the view and spacing between the elements
	gridLayout->SetInsets( 5, 5, 5, 5 );
	gridLayout->SetHorizontalSpacing( 10 );
	gridLayout->SetVerticalSpacing( 10 );
	this->SetLayout( gridLayout );
	gridLayout->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_USE_FULL_HEIGHT ) );
	gridLayout->SetExplicitMinSize( BSize( (this->Bounds()).Width(), (this->Bounds()).Height() ) );
	

	BRect rect = gridLayout->Frame();
	printf ( "The frame is %d pixels wide and %d pixels high.\n",
			 (int )rect.Width(),
			 (int )rect.Height() );
	
	
	/* Creating the CategoryListView with its scroller */
	BRect r( this->Bounds() );
	r.InsetBySelf( 5, 10 );	// Margins near the border of the view
	r.right = (int)(r.right / 2) - B_V_SCROLL_BAR_WIDTH;
	r.bottom -= 0;
	
	listView = new CategoryListView( r, "List View" );
	if ( ! listView ) {
		/* Panic! */
		exit( 1 );
	}
	BLooper* looper = this->Looper();
	if ( looper && looper->LockLooper() )
	{
		looper->AddHandler( ( BHandler* )this );
		looper->UnlockLooper();	
	}
	
	scroller = new BScrollView( "Scroller",
								listView,
								B_FOLLOW_LEFT | B_FOLLOW_TOP,
								0, 	// Flags
								true,
								true );
	if ( !scroller )
	{
		/* Panic! */
		exit( 1 );
	}
	layoutItem = gridLayout->AddView( scroller, 0, 0, 1, 3 );
	if ( !layoutItem ) {
		/* Panic! */
		exit( 1 );
	}
	layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT,
												  B_ALIGN_USE_FULL_HEIGHT ) );
	toSend = new BMessage( kCategoryInvoked );
	if ( !toSend )
	{
		/* Panic! */
		exit( 1 );
	}
	listView->SetInvocationMessage( toSend );
	toSend = new BMessage( kCategorySelected );
	if ( !toSend )
	{
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:haiku-pim-svn,代码行数:101,代码来源:CategoryPreferencesView.cpp


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