本文整理汇总了C++中BLayoutItem::SetExplicitSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BLayoutItem::SetExplicitSize方法的具体用法?C++ BLayoutItem::SetExplicitSize怎么用?C++ BLayoutItem::SetExplicitSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLayoutItem
的用法示例。
在下文中一共展示了BLayoutItem::SetExplicitSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BPopUpMenu
MediaConverterWindow::MediaConverterWindow(BRect frame)
:
BWindow(frame, B_TRANSLATE_SYSTEM_NAME("MediaConverter"),
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE
| B_NOT_V_RESIZABLE | B_ASYNCHRONOUS_CONTROLS
| B_AUTO_UPDATE_SIZE_LIMITS),
fVideoQuality(75),
fAudioQuality(75),
fSaveFilePanel(NULL),
fOpenFilePanel(NULL),
fOutputDirSpecified(false),
fEnabled(true),
fConverting(false),
fCancelling(false)
{
BPath outputDir;
if (find_directory(B_USER_DIRECTORY, &outputDir) != B_OK)
outputDir.SetTo("/boot/home");
fOutputDir.SetTo(outputDir.Path());
fMenuBar = new BMenuBar("menubar");
_CreateMenu();
float padding = be_control_look->DefaultItemSpacing();
fListView = new MediaFileListView();
fListView->SetExplicitMinSize(BSize(padding * kMinSourceWidth, B_SIZE_UNSET));
BScrollView* scroller = new BScrollView(NULL, fListView, 0, false, true);
// file list view box
fSourcesBox = new BBox(B_FANCY_BORDER, scroller);
fSourcesBox->SetLayout(new BGroupLayout(B_HORIZONTAL, 0));
// fSourcesBox's layout adjusted in _UpdateLabels
// info box
fInfoView = new MediaFileInfoView();
fInfoView->SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
B_ALIGN_VERTICAL_UNSET));
fInfoBox = new BBox(B_FANCY_BORDER, fInfoView);
// output menu fields
fFormatMenu = new BMenuField(NULL, B_TRANSLATE("File format:"),
new BPopUpMenu(""));
fAudioMenu = new BMenuField(NULL, B_TRANSLATE("Audio encoding:"),
new BPopUpMenu(""));
fVideoMenu = new BMenuField(NULL, B_TRANSLATE("Video encoding:"),
new BPopUpMenu(""));
// output folder
fDestButton = new BButton(B_TRANSLATE("Output folder"),
new BMessage(OUTPUT_FOLDER_MESSAGE));
BAlignment labelAlignment(be_control_look->DefaultLabelAlignment());
fOutputFolder = new BStringView(NULL, outputDir.Path());
fOutputFolder->SetExplicitAlignment(labelAlignment);
// start/end duration
fStartDurationTC = new BTextControl(NULL, "0", NULL);
BLayoutItem* startDuration = fStartDurationTC->CreateTextViewLayoutItem();
startDuration->SetExplicitSize(BSize(padding * kDurationWidth, B_SIZE_UNSET));
startDuration->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
fEndDurationTC = new BTextControl(NULL, "0", NULL);
BLayoutItem* endDuration = fEndDurationTC->CreateTextViewLayoutItem();
endDuration->SetExplicitSize(BSize(padding * kDurationWidth, B_SIZE_UNSET));
endDuration->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
// video quality
fVideoQualitySlider = new BSlider("VSlider", "" ,
new BMessage(VIDEO_QUALITY_CHANGED_MESSAGE), 1, 100, B_HORIZONTAL);
fVideoQualitySlider->SetModificationMessage(
new BMessage(VIDEO_QUALITY_CHANGED_MESSAGE));
fVideoQualitySlider->SetValue(fVideoQuality);
fVideoQualitySlider->SetEnabled(false);
fVideoQualitySlider->SetExplicitSize(BSize(padding * kQualitySliderWidth,
B_SIZE_UNSET));
// audio quality
fAudioQualitySlider = new BSlider("ASlider", "" ,
new BMessage(AUDIO_QUALITY_CHANGED_MESSAGE), 1, 100, B_HORIZONTAL);
fAudioQualitySlider->SetModificationMessage(
new BMessage(AUDIO_QUALITY_CHANGED_MESSAGE));
fAudioQualitySlider->SetValue(fAudioQuality);
fAudioQualitySlider->SetEnabled(false);
fAudioQualitySlider->SetExplicitSize(BSize(padding * kQualitySliderWidth,
B_SIZE_UNSET));
// output format box
BView* outputGrid = BLayoutBuilder::Grid<>()
.Add(fFormatMenu->CreateLabelLayoutItem(), 0, 0)
.Add(fFormatMenu->CreateMenuBarLayoutItem(), 1, 0)
.Add(fAudioMenu->CreateLabelLayoutItem(), 0, 1)
.Add(fAudioMenu->CreateMenuBarLayoutItem(), 1, 1)
.Add(fVideoMenu->CreateLabelLayoutItem(), 0, 2)
.Add(fVideoMenu->CreateMenuBarLayoutItem(), 1, 2)
.Add(fDestButton, 0, 3)
.Add(fOutputFolder, 1, 3)
.Add(fStartDurationTC->CreateLabelLayoutItem(), 0, 4)
.Add(startDuration, 1, 4)
.Add(fEndDurationTC->CreateLabelLayoutItem(), 0, 5)
//.........这里部分代码省略.........