本文整理汇总了C++中BSize::SetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ BSize::SetWidth方法的具体用法?C++ BSize::SetWidth怎么用?C++ BSize::SetWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BSize
的用法示例。
在下文中一共展示了BSize::SetWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMenu
//.........这里部分代码省略.........
return;
}
fDateSelector->SetViewColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
fDateSelector->SetFont( &fixedFont );
topLeftCorner.x = SPACING + 5;
topLeftCorner.y = SPACING;
// Build the list of months.
BPopUpMenu* listOfMonths = CreateMonthsMenu(monthNames);
//-----------------------------------------------------
// FIRST ROW.
//-----------------------------------------------------
/*----------------------------------------------------------------------------
* Adding months menu with option to scroll forward and backward
*----------------------------------------------------------------------------*/
// Add the item to scroll list of months back
BMessage* messageOfItem = new BMessage( kMonthDecreased );
DayItem* itemToAdd = new DayItem("‹", messageOfItem);
if ( !itemToAdd ) {
/* Panic! */
fLastError = B_NO_MEMORY;
return;
}
itemToAdd->SetServiceItem( true );
itemToAdd->SetFrontColor( fColorForServiceItems );
itemToAdd->SetBackColor( ui_color( B_MENU_BACKGROUND_COLOR ) );
itemToAdd->SetEnabled( true );
rectSize.SetHeight( fixedFontHeightString );
rectSize.SetWidth( 25 );
// rectSize.SetWidth( ( float )fixedFont.StringWidth("‹") + SPACING );
fDateSelector->AddItem( itemToAdd,
BRect( topLeftCorner, rectSize ) );
itemToAdd->SetTarget( this );
topLeftCorner.x += rectSize.Width() + SPACING;
// Add the list of months
BString longestMonth = monthNames[ 1 ].longName;
for ( int i = 2; i < ( int )monthNames.size(); i++ )
{
if ( ( ( BString )( monthNames[ i ].longName ) ).Length() > longestMonth.Length() )
{
longestMonth = monthNames[i].longName;
}
}
rectSize.SetHeight( plainFontHeightString );
rectSize.SetWidth( (float)plainFont.StringWidth( longestMonth.String() ) + 10 + SPACING );
fDateSelector->AddItem( listOfMonths,
BRect(topLeftCorner, rectSize) );
topLeftCorner.x += rectSize.Width() + SPACING;
// Add the item to scroll list of months forward.
messageOfItem = new BMessage( kMonthIncreased );
if ( !messageOfItem ) {
// Panic!
fLastError = B_NO_MEMORY;
return;
}
itemToAdd = new DayItem( "›", messageOfItem );
if ( !itemToAdd ) {
/* Panic! */