本文整理汇总了C++中BGridLayout::SetMaxColumnWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ BGridLayout::SetMaxColumnWidth方法的具体用法?C++ BGridLayout::SetMaxColumnWidth怎么用?C++ BGridLayout::SetMaxColumnWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BGridLayout
的用法示例。
在下文中一共展示了BGridLayout::SetMaxColumnWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NumberSliderControl
TransparencyToolConfigView::TransparencyToolConfigView(DrawingTool* tool)
: DrawingToolConfigView(tool)
{
if (BLayout* layout = GetLayout()) {
BMessage* message = new BMessage(OPTION_CHANGED);
message->AddInt32("option", SIZE_OPTION);
message->AddInt32("value", tool->GetCurrentValue(SIZE_OPTION));
fSizeSlider =
new NumberSliderControl(StringServer::ReturnString(SIZE_STRING),
"1", message, 1, 100, false);
layout->AddView(fSizeSlider);
message = new BMessage(OPTION_CHANGED);
message->AddInt32("option", PRESSURE_OPTION);
message->AddInt32("value", tool->GetCurrentValue(PRESSURE_OPTION));
fSpeedSlider =
new NumberSliderControl(StringServer::ReturnString(SPEED_STRING),
"1", message, 1, 100, false);
layout->AddView(fSpeedSlider);
BGridLayout* gridLayout = BGridLayoutBuilder(5.0, 5.0)
.Add(fSizeSlider->LabelLayoutItem(), 0, 0)
.Add(fSizeSlider->TextViewLayoutItem(), 1, 0)
.Add(fSizeSlider->Slider(), 2, 0)
.Add(fSpeedSlider->LabelLayoutItem(), 0, 1)
.Add(fSpeedSlider->TextViewLayoutItem(), 1, 1)
.Add(fSpeedSlider->Slider(), 2, 1);
gridLayout->SetMaxColumnWidth(1, StringWidth("1000"));
gridLayout->SetMinColumnWidth(2, StringWidth("SLIDERSLIDERSLIDER"));
layout->AddView(gridLayout->View());
}
}
示例2: NumberSliderControl
HairyBrushToolConfigView::HairyBrushToolConfigView(DrawingTool* tool)
: DrawingToolConfigView(tool)
{
if (BLayout* layout = GetLayout()) {
BMessage* message = new BMessage(OPTION_CHANGED);
message->AddInt32("option", PRESSURE_OPTION);
message->AddInt32("value", tool->GetCurrentValue(PRESSURE_OPTION));
fBrushSize =
new NumberSliderControl(StringServer::ReturnString(SIZE_STRING),
"0", message, 2, 50, false);
layout->AddView(fBrushSize);
message = new BMessage(OPTION_CHANGED);
message->AddInt32("option", SIZE_OPTION);
message->AddInt32("value", tool->GetCurrentValue(SIZE_OPTION));
fBrushHairs =
new NumberSliderControl(StringServer::ReturnString(HAIRS_STRING),
"0", message, 5, 100, false);
layout->AddView(fBrushHairs);
fColorAmount =
new BSlider("", StringServer::ReturnString(COLOR_AMOUNT_STRING),
new BMessage(COLOR_AMOUNT_CHANGED), 1, 500, B_HORIZONTAL,
B_TRIANGLE_THUMB);
fColorAmount->SetLimitLabels(StringServer::ReturnString(LITTLE_STRING),
StringServer::ReturnString(MUCH_STRING));
fColorAmount->SetValue(tool->GetCurrentValue(CONTINUITY_OPTION));
fColorVariance =
new BSlider("", StringServer::ReturnString(COLOR_VARIANCE_STRING),
new BMessage(COLOR_VARIANCE_CHANGED), 0, 128, B_HORIZONTAL,
B_TRIANGLE_THUMB);
fColorVariance->SetLimitLabels(StringServer::ReturnString(NONE_STRING),
StringServer::ReturnString(RANDOM_STRING));
fColorVariance->SetValue(tool->GetCurrentValue(TOLERANCE_OPTION));
BGridLayout* gridLayout = BGridLayoutBuilder(5.0, 5.0)
.Add(fBrushSize->LabelLayoutItem(), 0, 0)
.Add(fBrushSize->TextViewLayoutItem(), 1, 0)
.Add(fBrushSize->Slider(), 2, 0)
.Add(fBrushHairs->LabelLayoutItem(), 0, 1)
.Add(fBrushHairs->TextViewLayoutItem(), 1, 1)
.Add(fBrushHairs->Slider(), 2, 1)
.SetInsets(5.0, 0.0, 0.0, 0.0);
gridLayout->SetMaxColumnWidth(1, StringWidth("1000"));
gridLayout->SetMinColumnWidth(2, StringWidth("SLIDERSLIDERSLIDER"));
layout->AddItem(BGroupLayoutBuilder(B_VERTICAL)
.Add(gridLayout)
.Add(fColorAmount)
.Add(fColorVariance)
);
}
}
示例3: r
//.........这里部分代码省略.........
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 )
{
/* Panic! */
exit( 1 );
}
listView->SetSelectionMessage( toSend );
r = listView->Bounds();
r.bottom += B_H_SCROLL_BAR_HEIGHT + 3;
r.right -= ( B_V_SCROLL_BAR_WIDTH + 10 );
layoutItem->SetExplicitMinSize( BSize( ( B_V_SCROLL_BAR_WIDTH * 2 ), r.Height() ) );
gridLayout->SetMaxColumnWidth( 0, r.Width()-70 );
gridLayout->SetMaxColumnWidth( 1, r.Width()-66 );
// Add categories to the list
PopulateCategoriesView();
/* Creating the buttons */
// Add new category button
toSend = new BMessage( kAddNewCategory );
addButton = new BButton( BRect( 0, 0, 1, 1),
"Add category",
"Add category",
toSend,
B_FOLLOW_H_CENTER | B_FOLLOW_V_CENTER );
if ( !toSend || !addButton ) {
/* Panic! */
exit( 1 );
}
addButton->ResizeToPreferred();
addButton->SetTarget( this );
layoutItem = gridLayout->AddView( addButton, 1, 0, 1, 1 );
layoutItem->SetExplicitAlignment( BAlignment( B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER ) );
// Edit old category button
toSend = new BMessage( kCategoryInvoked );
editButton = new BButton( BRect( 0, 0, 1, 1),
"Edit category",
"Edit category",
toSend,
B_FOLLOW_H_CENTER | B_FOLLOW_V_CENTER );
if ( !toSend || !editButton ) {
/* Panic! */
exit( 1 );
示例4: 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;
}