本文整理汇总了C++中BLayoutItem::SetExplicitMaxSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BLayoutItem::SetExplicitMaxSize方法的具体用法?C++ BLayoutItem::SetExplicitMaxSize怎么用?C++ BLayoutItem::SetExplicitMaxSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLayoutItem
的用法示例。
在下文中一共展示了BLayoutItem::SetExplicitMaxSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: streamNodeSource
void
TFilePanel::RestoreState()
{
BNode defaultingNode;
if (DefaultStateSourceNode(kDefaultFilePanelTemplate, &defaultingNode,
false)) {
AttributeStreamFileNode streamNodeSource(&defaultingNode);
RestoreWindowState(&streamNodeSource);
PoseView()->Init(&streamNodeSource);
} else {
RestoreWindowState(NULL);
PoseView()->Init(NULL);
}
// Finish UI creation now that the PoseView is initialized
BLayoutItem* item
= fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
BSize minSize = item->MinSize();
BSize maxSize = item->MaxSize();
item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight));
item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight));
BRect rect(fBorderedView->Frame());
rect.right = rect.left + kCountViewWidth;
rect.top = rect.bottom + 1;
rect.bottom = rect.top + PoseView()->HScrollBar()->Bounds().Height() - 1;
PoseView()->CountView()->MoveTo(rect.LeftTop());
PoseView()->CountView()->ResizeTo(rect.Size());
PoseView()->CountView()->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fBackView->AddChild(PoseView()->CountView(), fBorderedView);
PoseView()->HScrollBar()->MoveBy(kCountViewWidth + 1, 0);
PoseView()->HScrollBar()->ResizeBy(-kCountViewWidth - 1, 0);
// The Be Book states that the BTitleView will have a name of "TitleView",
// and so some apps will try to grab it by that name and move it around.
// They don't need to, because resizing "PoseView" (really the BorderedView)
// will resize the BTitleView as well. So just create a dummy view here
// so that they don't get NULL when trying to find the view.
BView* dummyTitleView = new BView(BRect(), "TitleView", B_FOLLOW_NONE, 0);
fBackView->AddChild(dummyTitleView);
dummyTitleView->Hide();
}
示例2: size
//.........这里部分代码省略.........
/* Panic! */
fLastError = B_NO_MEMORY;
return;
}
fCalendarModuleLabel = new BStringView( BRect( 0, 0, 1, 1 ),
"label for the calendar module selector",
"Calendar:" );
if ( !fCalendarModuleLabel ) {
/* Panic! */
fLastError = B_NO_MEMORY;
return;
}
fCalendarModuleLabel->ResizeToPreferred();
fCalendarsMenu = CreateMenuOfCalendarModules();
if ( !fCalendarsMenu ) {
/* Panic! */
fLastError = B_NO_MEMORY;
return;
}
fCalendarModuleSelector = new BMenuField( BRect( 0, 0, 1, 1 ),
"calendar module selector",
NULL, // Label is created separately
fCalendarsMenu );
if ( !fCalendarModuleSelector ) {
/* Panic! */
fLastError = B_NO_MEMORY;
return;
}
fCalendarModuleSelector->ResizeToPreferred();
// Create the menu
CreateMenu();
BRect stringViewFrame = fLabel->Frame();
BPoint topLeftCorner = stringViewFrame.RightTop();
BSize size( BUTTON_WIDTH, stringViewFrame.Height() + SPACING );
fMenuBar = new BMenuBar( BRect(topLeftCorner, size),
"menuBar",
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
B_ITEMS_IN_ROW,
false);
if (! fMenuBar) {
// Panic!
fLastError = B_NO_MEMORY;
return;
}
fMenuBar->SetBorder( B_BORDER_EACH_ITEM );
fMenuBar->AddItem( fDateSelector );
// Update the selected date label to currently selected moment of time
UpdateText();
// Initializing the layout
BGridLayout* lay = new BGridLayout( );
if (!lay) {
// Panic!
fLastError = B_NO_MEMORY;
return;
}
lay->SetInsets(0, 5, 0, 0);
lay->SetSpacing( 10, 5 );
lay->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_MIDDLE ) );
this->SetLayout(lay);
BLayoutItem* layoutItem;
layoutItem = lay->AddView( fLabel, 0, 0 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT, B_ALIGN_TOP ) );
layoutItem = lay->AddView( fDateLabel, 1, 0 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );
layoutItem = lay->AddView( fMenuBar, 2, 0 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_RIGHT, B_ALIGN_TOP ) );
layoutItem->SetExplicitMaxSize( size );
layoutItem = lay->AddView( fCalendarModuleLabel, 0, 1 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_LEFT, B_ALIGN_MIDDLE ) );
layoutItem = lay->AddView( fCalendarModuleSelector, 1, 1 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );
lay->SetColumnWeight( 0, 0 );
lay->SetColumnWeight( 1, 1000 );
lay->SetColumnWeight( 2, 0 );
lay->SetMaxColumnWidth( 2, BUTTON_WIDTH );
this->InvalidateLayout();
this->Relayout();
this->Invalidate();
fLastError = B_OK;
}
示例3: setSize
//.........这里部分代码省略.........
// Prepare the overall BBox
toReturn = new BBox( frame, "Color selector" );
if ( ! toReturn )
return NULL;
toReturn->SetLabel( "Set up colors" );
// Set up the layout for this BBox
BGroupLayout* groupLayout = new BGroupLayout( B_VERTICAL );
if ( !groupLayout ) {
delete toReturn;
return NULL;
}
groupLayout->SetInsets( 10, 15, 10, 5 );
groupLayout->SetSpacing( 2 );
toReturn->SetLayout( groupLayout );
// Label over the CategoryListView for the viewer
BStringView* viewerString = new BStringView( BRect( 0, 0, 1, 1 ),
"Colors Changer Explanation",
"Double-click the color to edit it." );
if ( !viewerString )
{
delete toReturn;
return NULL;
}
viewerString->ResizeToPreferred();
layoutItem = groupLayout->AddView( 0, viewerString, 0 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );
toSend = new BMessage( kCategoryInvoked );
if ( !toSend )
{
/* Panic! */
exit( 1 );
}
toSend->AddString( "Calendar module", id );
CategoryListView* menuColors = new CategoryListView( BRect( 0,
0,
tempRect.Width() + B_V_SCROLL_BAR_WIDTH,
tempRect.Height() + B_H_SCROLL_BAR_HEIGHT ),
"Colors list view" );
if ( !menuColors ) {
// menuString->RemoveSelf(); delete menuString;
// viewerString->RemoveSelf(); delete viewerString;
delete toReturn; return NULL;
}
menuColors->SetInvocationMessage( toSend );
// Fill the CategoryListView for the menu colors
sb.SetTo( "Color for displaying weekdays in the controls" );
CategoryListItem* toAdd = new CategoryListItem( prefs->GetWeekdaysColor( false ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying weekends in the controls" );
toAdd = new CategoryListItem( prefs->GetWeekendsColor( false ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying weekdays in Viewer" );
toAdd = new CategoryListItem( prefs->GetWeekdaysColor( true ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying weekends in Viewer" );
toAdd = new CategoryListItem( prefs->GetWeekendsColor( true ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying service items in the controls" );
toAdd = new CategoryListItem( prefs->GetServiceItemsColor( false ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
sb.SetTo( "Color for displaying service items in the Viewer" );
toAdd = new CategoryListItem( prefs->GetServiceItemsColor( true ),
sb );
if ( toAdd ) {
menuColors->AddItem( toAdd );
}
menuColors->ResizeToPreferred();
// BSize setSize( menuColors->Bounds().Width(), menuColors->Bounds().Height() );
BSize setSize( frame.Width(), menuColors->Bounds().Height()+5 );
layoutItem = groupLayout->AddView( 1, menuColors, 0 );
layoutItem->SetExplicitMaxSize( setSize );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP ) );
groupLayout->InvalidateLayout();
return toReturn;
} // <-- end of function CalendarModulePreferecesView::BuildColorSelectors