本文整理汇总了C++中BBox::SetExplicitAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::SetExplicitAlignment方法的具体用法?C++ BBox::SetExplicitAlignment怎么用?C++ BBox::SetExplicitAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::SetExplicitAlignment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
LookAndFeelSettingsView::LookAndFeelSettingsView(const char* name)
:
BView(name, 0),
fDecorInfoButton(NULL),
fDecorMenuField(NULL),
fDecorMenu(NULL)
{
// Decorator menu
_BuildDecorMenu();
fDecorMenuField = new BMenuField("decorator",
B_TRANSLATE("Decorator:"), fDecorMenu);
fDecorInfoButton = new BButton(B_TRANSLATE("About"),
new BMessage(kMsgDecorInfo));
// scroll bar arrow style
BBox* arrowStyleBox = new BBox("arrow style");
arrowStyleBox->SetLabel(B_TRANSLATE("Arrow style"));
fSavedDoubleArrowsValue = _DoubleScrollBarArrows();
fArrowStyleSingle = new FakeScrollBar(true, false,
new BMessage(kMsgArrowStyleSingle));
fArrowStyleDouble = new FakeScrollBar(true, true,
new BMessage(kMsgArrowStyleDouble));
BView* arrowStyleView;
arrowStyleView = BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, 1)
.Add(new BStringView("single", B_TRANSLATE("Single:")))
.Add(fArrowStyleSingle)
.AddStrut(B_USE_DEFAULT_SPACING)
.Add(new BStringView("double", B_TRANSLATE("Double:")))
.Add(fArrowStyleDouble)
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.End()
.View();
arrowStyleBox->AddChild(arrowStyleView);
arrowStyleBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
arrowStyleBox->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BStringView* scrollBarLabel
= new BStringView("scroll bar", B_TRANSLATE("Scroll bar:"));
scrollBarLabel->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
// control layout
BLayoutBuilder::Grid<>(this, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.Add(fDecorMenuField->CreateLabelLayoutItem(), 0, 0)
.Add(fDecorMenuField->CreateMenuBarLayoutItem(), 1, 0)
.Add(fDecorInfoButton, 2, 0)
.Add(scrollBarLabel, 0, 1)
.Add(arrowStyleBox, 1, 1)
.AddGlue(0, 2)
.SetInsets(B_USE_WINDOW_SPACING);
// TODO : Decorator Preview Image?
}
示例2: BMessage
ClockView::ClockView(const char* name)
:
BView(name, 0),
fCachedShowClock(B_CONTROL_ON),
fCachedShowSeconds(B_CONTROL_OFF),
fCachedShowDayOfWeek(B_CONTROL_OFF),
fCachedShowTimeZone(B_CONTROL_OFF)
{
fShowClock = new BCheckBox(B_TRANSLATE("Show clock in Deskbar"),
new BMessage(kShowHideTime));
fShowSeconds = new BCheckBox(B_TRANSLATE("Display time with seconds"),
new BMessage(kShowSeconds));
fShowDayOfWeek = new BCheckBox(B_TRANSLATE("Show day of week"),
new BMessage(kShowDayOfWeek));
fShowTimeZone = new BCheckBox(B_TRANSLATE("Show time zone"),
new BMessage(kShowTimeZone));
BView* view = BLayoutBuilder::Group<>(B_VERTICAL, 0)
.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET))
.Add(fShowSeconds)
.Add(fShowDayOfWeek)
.Add(fShowTimeZone)
.AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING)
.View();
BBox* showClockBox = new BBox("show clock box");
showClockBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
showClockBox->SetLabel(fShowClock);
showClockBox->AddChild(view);
BLayoutBuilder::Group<>(this)
.AddGroup(B_VERTICAL, 0)
.Add(showClockBox)
.End()
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING);
}
示例3: BMessage
OutputView::OutputView(Controller *controller)
:
BView("Capture Options", B_WILL_DRAW),
fController(controller)
{
SetLayout(new BGroupLayout(B_VERTICAL));
BBox *selectBox = new BBox("selection");
selectBox->SetLabel("Selection");
selectBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
AddChild(selectBox);
BBox *outputBox = new BBox("output");
outputBox->SetLabel("Output");
outputBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
AddChild(outputBox);
Settings settings;
const char *kTCLabel = "File name:";
const char *fileName = NULL;
settings.GetOutputFileName(&fileName);
fFileName = new BTextControl("file name",
kTCLabel, fileName, new BMessage(kFileNameChanged));
const char *kOutputMenuLabel = "Output Format:";
fOutputFileType = new BOptionPopUp("OutFormat",
kOutputMenuLabel, new BMessage(kFileTypeChanged));
const char *kCodecMenuLabel = "Codec:";
BPopUpMenu *popUpMenu = new BPopUpMenu("Codecs");
fCodecMenu = new BMenuField("OutCodec", kCodecMenuLabel, popUpMenu);
fWholeScreen = new BRadioButton("screen frame", "Whole screen",
new BMessage(kCheckBoxAreaSelectionChanged));
fCustomArea = new BRadioButton("custom area",
"Custom Area", new BMessage(kCheckBoxAreaSelectionChanged));
fSelectArea = new BButton("select area", "Select", new BMessage(kSelectArea));
fSelectArea->SetEnabled(false);
fMinimizeOnStart = new BCheckBox("Minimize on start",
"Minimize on recording", new BMessage(kMinimizeOnRecording));
fRectView = new PreviewView();
BView *layoutView = BLayoutBuilder::Group<>()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.Add(fFileName)
.Add(fOutputFileType)
.Add(fCodecMenu)
.Add(fMinimizeOnStart)
.End()
.View();
outputBox->AddChild(layoutView);
layoutView = BLayoutBuilder::Group<>()
.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL)
.AddGroup(B_HORIZONTAL)
.AddGroup(B_VERTICAL, 0)
.Add(fWholeScreen)
.Add(fCustomArea)
.End()
.AddGroup(B_VERTICAL)
.AddGlue()
.Add(fSelectArea)
.End()
.End()
.Add(fRectView)
.End()
.View();
selectBox->AddChild(layoutView);
fMinimizeOnStart->SetValue(settings.MinimizeOnRecording() ? B_CONTROL_ON : B_CONTROL_OFF);
// fill in the list of available file formats
media_file_format mff;
int32 cookie = 0;
bool firstFound = true;
while (get_next_file_format(&cookie, &mff) == B_OK) {
if (mff.capabilities & media_file_format::B_KNOWS_ENCODED_VIDEO) {
fOutputFileType->AddOption(mff.pretty_name, mff.family);
if (firstFound) {
fOutputFileType->MenuField()->Menu()->ItemAt(0)->SetMarked(true);
firstFound = false;
}
}
}
fWholeScreen->SetValue(B_CONTROL_ON);
UpdateSettings();
fController->SetCaptureArea(BScreen(Window()).Frame());
//.........这里部分代码省略.........
示例4: fullWidthTopAlignment
ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
: BWindow(_Frame(settings), B_TRANSLATE("Application types"),
B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
float padding = be_control_look->DefaultItemSpacing();
BAlignment labelAlignment = be_control_look->DefaultLabelAlignment();
BAlignment fullWidthTopAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_TOP);
// Application list
fTypeListView = new MimeTypeListView("listview", "application", true, true);
fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));
fTypeListView->SetInvocationMessage(new BMessage(kMsgTypeInvoked));
// TODO: this isn't the perfect solution, but otherwise the window contents
// will jump chaotically
fTypeListView->SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
fTypeListView->SetExplicitMaxSize(BSize(250, B_SIZE_UNSET));
BScrollView* scrollView = new BScrollView("scrollview", fTypeListView,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
BButton* button = new BButton("remove", B_TRANSLATE("Remove uninstalled"),
new BMessage(kMsgRemoveUninstalled));
// "Information" group
BBox* infoBox = new BBox((char*)NULL);
infoBox->SetLabel(B_TRANSLATE("Information"));
infoBox->SetExplicitAlignment(fullWidthTopAlignment);
fNameView = new StringView(B_TRANSLATE("Name:"), NULL);
fNameView->TextView()->SetExplicitAlignment(labelAlignment);
fNameView->LabelView()->SetExplicitAlignment(labelAlignment);
fSignatureView = new StringView(B_TRANSLATE("Signature:"), NULL);
fSignatureView->TextView()->SetExplicitAlignment(labelAlignment);
fSignatureView->LabelView()->SetExplicitAlignment(labelAlignment);
fPathView = new StringView(B_TRANSLATE("Path:"), NULL);
fPathView->TextView()->SetExplicitAlignment(labelAlignment);
fPathView->LabelView()->SetExplicitAlignment(labelAlignment);
BLayoutBuilder::Grid<>(infoBox, padding, padding)
.SetInsets(padding, padding * 2, padding, padding)
.Add(fNameView->LabelView(), 0, 0)
.Add(fNameView->TextView(), 1, 0, 2)
.Add(fSignatureView->LabelView(), 0, 1)
.Add(fSignatureView->TextView(), 1, 1, 2)
.Add(fPathView->LabelView(), 0, 2)
.Add(fPathView->TextView(), 1, 2, 2);
// "Version" group
BBox* versionBox = new BBox("");
versionBox->SetLabel(B_TRANSLATE("Version"));
versionBox->SetExplicitAlignment(fullWidthTopAlignment);
fVersionView = new StringView(B_TRANSLATE("Version:"), NULL);
fVersionView->TextView()->SetExplicitAlignment(labelAlignment);
fVersionView->LabelView()->SetExplicitAlignment(labelAlignment);
fDescriptionLabel = new StringView(B_TRANSLATE("Description:"), NULL);
fDescriptionLabel->LabelView()->SetExplicitAlignment(labelAlignment);
fDescriptionView = new BTextView("description");
fDescriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fDescriptionView->SetLowColor(fDescriptionView->ViewColor());
fDescriptionView->MakeEditable(false);
BLayoutBuilder::Grid<>(versionBox, padding, padding)
.SetInsets(padding, padding * 2, padding, padding)
.Add(fVersionView->LabelView(), 0, 0)
.Add(fVersionView->TextView(), 1, 0)
.Add(fDescriptionLabel->LabelView(), 0, 1)
.Add(fDescriptionView, 1, 1, 2, 2);
// Launch and Tracker buttons
fEditButton = new BButton(B_TRANSLATE("Edit" B_UTF8_ELLIPSIS),
new BMessage(kMsgEdit));
// launch and tracker buttons get messages in _SetType()
fLaunchButton = new BButton(B_TRANSLATE("Launch"));
fTrackerButton = new BButton(
B_TRANSLATE("Show in Tracker" B_UTF8_ELLIPSIS));
BLayoutBuilder::Group<>(this, B_HORIZONTAL, padding)
.AddGroup(B_VERTICAL, padding, 3)
.Add(scrollView)
.AddGroup(B_HORIZONTAL)
.Add(button)
.AddGlue()
.End()
.End()
.AddGroup(B_VERTICAL, padding)
.Add(infoBox)
.Add(versionBox)
.AddGroup(B_HORIZONTAL, padding)
.Add(fEditButton)
.Add(fLaunchButton)
.Add(fTrackerButton)
.AddGlue()
.End()
//.........这里部分代码省略.........