本文整理汇总了C++中BGridLayout::PreferredSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BGridLayout::PreferredSize方法的具体用法?C++ BGridLayout::PreferredSize怎么用?C++ BGridLayout::PreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BGridLayout
的用法示例。
在下文中一共展示了BGridLayout::PreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BRect
//.........这里部分代码省略.........
"Label",
NULL,
label.String(),
NULL );
} else {
labelView = new BStringView( BRect (0, 0, 1, 1),
"Label",
label.String() );
}
if ( !labelView )
{
/* Panic! */
exit(1);
}
labelView->ResizeToPreferred();
item = layout->AddView( labelView, 0, 0, 3, 1 );
if ( !item ) { /* Panic! */ exit(1); }
item->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_CENTER ) );
// item->SetExplicitMinSize( BSize( width, height ) );
// Construct color control
BMessage* toSend = new BMessage( kColorChanged );
if ( !toSend ) { /* Panic! */ exit(1); }
colorControl = new BColorControl( BPoint( 0, 0 ),
B_CELLS_32x8,
4.0,
"Color Control",
toSend );
if ( !colorControl )
{
/* Panic! */
exit(1);
}
colorControl->GetPreferredSize( &width, &height );
colorControl->ResizeTo( width, height );
colorControl->SetTarget( this );
item = layout->AddView( colorControl, 0, 1, 3, 1 );
if ( !item ) { /* Panic! */ exit(1); }
item->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );
// Construct last two buttons
// Revert button
toSend = new BMessage( kColorReverted );
if ( !toSend ) { /* Panic! */ exit(1); }
revertButton = new BButton( BRect( 0, 0, 1, 1),
"Revert button",
"Revert",
toSend );
if ( !revertButton ) { /* Panic! */ exit(1); }
revertButton->ResizeToPreferred();
// Ok button
toSend = new BMessage( kColorSelected );
if ( !toSend ) { /* Panic! */ exit(1); }
okButton = new BButton( BRect( 0, 0, 1, 1),
"Ok button",
"Ok",
toSend,
B_FOLLOW_RIGHT | B_FOLLOW_TOP );
if ( !okButton ) { /* Panic! */ exit(1); }
okButton->ResizeToPreferred();
// Attach the buttons to current layout
item = layout->AddView( revertButton, 0, 2 );
if ( ! item ) { /* Panic! */ exit(1); }
item->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT, B_ALIGN_MIDDLE ) );