本文整理汇总了C++中BGridLayout::SetExplicitMinSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BGridLayout::SetExplicitMinSize方法的具体用法?C++ BGridLayout::SetExplicitMinSize怎么用?C++ BGridLayout::SetExplicitMinSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BGridLayout
的用法示例。
在下文中一共展示了BGridLayout::SetExplicitMinSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 )
{
//.........这里部分代码省略.........