本文整理汇总了C++中BStringView::SetExplicitAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringView::SetExplicitAlignment方法的具体用法?C++ BStringView::SetExplicitAlignment怎么用?C++ BStringView::SetExplicitAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BStringView
的用法示例。
在下文中一共展示了BStringView::SetExplicitAlignment方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apiString
InfoView::InfoView()
:
BGroupView(B_TRANSLATE("Information"), B_HORIZONTAL)
{
BStringView* rendererView = new BStringView(NULL,
(const char*)glGetString(GL_RENDERER));
rendererView->SetExplicitAlignment(kLabelAlignment);
rendererView->SetFont(be_bold_font);
BStringView* vendorNameView = new BStringView(NULL,
(const char*)glGetString(GL_VENDOR));
vendorNameView->SetExplicitAlignment(kLabelAlignment);
BStringView* glVersionView = new BStringView(NULL,
(const char*)glGetString(GL_VERSION));
glVersionView->SetExplicitAlignment(kLabelAlignment);
BString apiString("GLU ");
apiString << (const char*)gluGetString(GLU_VERSION);
apiString << ", GLUT ";
apiString << (int32)GLUT_API_VERSION;
BStringView* apiVersionView = new BStringView(NULL, apiString.String());
apiVersionView->SetExplicitAlignment(kLabelAlignment);
BLayoutBuilder::Group<>(this)
.AddGroup(B_VERTICAL, 0)
.Add(rendererView)
.Add(vendorNameView)
.Add(glVersionView)
.Add(apiVersionView)
.End();
}
示例2: labelAlignment
HVIFView::HVIFView(const char* name, uint32 flags, TranslatorSettings *settings)
:
BView(name, flags, new BGroupLayout(B_VERTICAL)),
fSettings(settings)
{
BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL);
BStringView* title= new BStringView("title",
B_TRANSLATE("Native Haiku icon format translator"));
title->SetFont(be_bold_font);
title->SetExplicitAlignment(labelAlignment);
char versionString[256];
snprintf(versionString, sizeof(versionString),
B_TRANSLATE("Version %d.%d.%d, %s"),
int(B_TRANSLATION_MAJOR_VERSION(HVIF_TRANSLATOR_VERSION)),
int(B_TRANSLATION_MINOR_VERSION(HVIF_TRANSLATOR_VERSION)),
int(B_TRANSLATION_REVISION_VERSION(HVIF_TRANSLATOR_VERSION)),
__DATE__);
BStringView* version = new BStringView("version", versionString);
version->SetExplicitAlignment(labelAlignment);
BStringView* copyright = new BStringView("copyright",
B_UTF8_COPYRIGHT"2009 Haiku Inc.");
copyright->SetExplicitAlignment(labelAlignment);
int32 renderSize = fSettings->SetGetInt32(HVIF_SETTING_RENDER_SIZE);
BString label = B_TRANSLATE("Render size:");
label << " " << renderSize;
fRenderSize = new BSlider("renderSize", label.String(),
NULL, 1, 32, B_HORIZONTAL);
fRenderSize->SetValue(renderSize / 8);
fRenderSize->SetHashMarks(B_HASH_MARKS_BOTTOM);
fRenderSize->SetHashMarkCount(16);
fRenderSize->SetModificationMessage(
new BMessage(HVIF_SETTING_RENDER_SIZE_CHANGED));
fRenderSize->SetExplicitAlignment(labelAlignment);
float padding = 5.0f;
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
.SetInsets(padding)
.Add(title)
.Add(version)
.Add(copyright)
.Add(fRenderSize)
.AddGlue();
BFont font;
GetFont(&font);
SetExplicitPreferredSize(
BSize((font.Size() * 270) / 12, (font.Size() * 100) / 12));
}
示例3: 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?
}
示例4: BStringView
BView*
AboutView::_CreateLabel(const char* name, const char* label)
{
BStringView* labelView = new BStringView(name, label);
labelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
labelView->SetFont(be_bold_font);
return labelView;
}
示例5: unlimited
void
MediaWindow::_MakeEmptyParamView()
{
fParamWeb = NULL;
BStringView* stringView = new BStringView("noControls",
B_TRANSLATE("This hardware has no controls."));
BSize unlimited(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED);
stringView->SetExplicitMaxSize(unlimited);
BAlignment centered(B_ALIGN_HORIZONTAL_CENTER,
B_ALIGN_VERTICAL_CENTER);
stringView->SetExplicitAlignment(centered);
stringView->SetAlignment(B_ALIGN_CENTER);
fContentLayout->AddView(stringView);
fContentLayout->SetVisibleItem(fContentLayout->CountItems() - 1);
rgb_color panel = stringView->LowColor();
stringView->SetHighColor(tint_color(panel,
B_DISABLED_LABEL_TINT));
}
示例6: labelAlignment
SGIView::SGIView(const char* name, uint32 flags, TranslatorSettings* settings)
:
BView(name, flags, new BGroupLayout(B_VERTICAL)),
fSettings(settings)
{
BPopUpMenu* menu = new BPopUpMenu("pick compression");
uint32 currentCompression =
fSettings->SetGetInt32(SGI_SETTING_COMPRESSION);
// create the menu items with the various compression methods
add_menu_item(menu, SGI_COMP_NONE, B_TRANSLATE("None"),
currentCompression);
//menu->AddSeparatorItem();
add_menu_item(menu, SGI_COMP_RLE, B_TRANSLATE("RLE"), currentCompression);
// DON'T turn this on, it's so slow that I didn't wait long enough
// the one time I tested this. So I don't know if the code even works.
// Supposedly, this would look for an already written scanline, and
// modify the scanline tables so that the current row is not written
// at all...
//add_menu_item(menu, SGI_COMP_ARLE, "Agressive RLE", currentCompression);
fCompressionMF = new BMenuField("compression",
B_TRANSLATE("Use compression:"), menu);
BAlignment labelAlignment(B_ALIGN_LEFT, B_ALIGN_NO_VERTICAL);
BStringView* titleView = new BStringView("title",
B_TRANSLATE("SGI image translator"));
titleView->SetFont(be_bold_font);
titleView->SetExplicitAlignment(labelAlignment);
char detail[100];
sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(SGI_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_MINOR_VERSION(SGI_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
SGI_TRANSLATOR_VERSION)), __DATE__);
BStringView* detailView = new BStringView("details", detail);
detailView->SetExplicitAlignment(labelAlignment);
BTextView* infoView = new BTextView("info");
infoView->SetText(BString(B_TRANSLATE("written by:\n"))
.Append(author)
.Append(B_TRANSLATE("\n\nbased on GIMP SGI plugin v1.5:\n"))
.Append(kSGICopyright).String());
infoView->SetExplicitAlignment(labelAlignment);
infoView->SetWordWrap(false);
infoView->MakeEditable(false);
infoView->MakeResizable(true);
infoView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
float padding = 5.0f;
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
.SetInsets(padding)
.Add(titleView)
.Add(detailView)
.AddGroup(B_HORIZONTAL)
.Add(fCompressionMF)
.AddGlue()
.End()
.Add(infoView)
.AddGlue();
BFont font;
GetFont(&font);
SetExplicitPreferredSize(BSize((font.Size() * 390) / 12,
(font.Size() * 180) / 12));
// TODO: remove this workaround for ticket #4217
infoView->SetExplicitPreferredSize(
BSize(infoView->LineWidth(4), infoView->TextHeight(0, 80)));
infoView->SetExplicitMaxSize(infoView->ExplicitPreferredSize());
infoView->SetExplicitMinSize(infoView->ExplicitPreferredSize());
}
示例7: alignment
SettingsWindow::SettingsWindow(BRect frame)
:
BWindow(frame, B_TRANSLATE("MediaPlayer settings"), B_FLOATING_WINDOW_LOOK,
B_FLOATING_ALL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
{
const float kSpacing = be_control_look->DefaultItemSpacing();
BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, kSpacing / 2);
settingsBox->SetLayout(settingsLayout);
BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, kSpacing / 2);
buttonBox->SetLayout(buttonLayout);
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
B_TRANSLATE("Play mode"));
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
B_TRANSLATE("View options"));
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
B_TRANSLATE("Volume of background clips"));
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
playModeLabel->SetExplicitAlignment(alignment);
playModeLabel->SetFont(be_bold_font);
viewOptionsLabel->SetExplicitAlignment(alignment);
viewOptionsLabel->SetFont(be_bold_font);
bgMoviesModeLabel->SetExplicitAlignment(alignment);
bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart",
B_TRANSLATE("Automatically start playing"),
new BMessage(M_SETTINGS_CHANGED));
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
B_TRANSLATE("Close window after playing video"),
new BMessage(M_SETTINGS_CHANGED));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
B_TRANSLATE("Close window after playing audio"),
new BMessage(M_SETTINGS_CHANGED));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
B_TRANSLATE("Loop video"),
new BMessage(M_SETTINGS_CHANGED));
fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
B_TRANSLATE("Loop audio"),
new BMessage(M_SETTINGS_CHANGED));
fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
B_TRANSLATE("Use hardware video overlays if available"),
new BMessage(M_SETTINGS_CHANGED));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
B_TRANSLATE("Scale movies smoothly (non-overlay mode)"),
new BMessage(M_SETTINGS_CHANGED));
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
B_TRANSLATE("Scale controls in full screen mode"),
new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP = new BOptionPopUp("subtitleSize",
B_TRANSLATE("Subtitle size:"), new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Small"), mpSettings::SUBTITLE_SIZE_SMALL);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Medium"), mpSettings::SUBTITLE_SIZE_MEDIUM);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Large"), mpSettings::SUBTITLE_SIZE_LARGE);
fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement",
B_TRANSLATE("Subtitle placement:"), new BMessage(M_SETTINGS_CHANGED));
fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of video"),
mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO);
fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of screen"),
mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN);
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED));
fRevertB = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(M_SETTINGS_REVERT));
BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(M_SETTINGS_CANCEL));
BButton* okButton = new BButton("ok", B_TRANSLATE("OK"),
new BMessage(M_SETTINGS_SAVE));
okButton->MakeDefault(true);
// Build the layout
BGroupLayout* volumeGroup;
BGroupLayout* startGroup;
BGroupLayout* playGroup;
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.AddGroup(settingsLayout)
//.........这里部分代码省略.........
示例8: alignment
SettingsWindow::SettingsWindow(BRect frame)
: BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
B_FLOATING_APP_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
#ifdef __ANTARES__
| B_AUTO_UPDATE_SIZE_LIMITS)
#else
)
#endif
{
#ifdef __ANTARES__
BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, 5);
settingsBox->SetLayout(settingsLayout);
BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, 5);
buttonBox->SetLayout(buttonLayout);
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
"Play mode");
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
"View options");
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
"Play background clips at");
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
playModeLabel->SetExplicitAlignment(alignment);
playModeLabel->SetFont(be_bold_font);
viewOptionsLabel->SetExplicitAlignment(alignment);
viewOptionsLabel->SetFont(be_bold_font);
bgMoviesModeLabel->SetExplicitAlignment(alignment);
bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart",
"Automatically start playing", new BMessage(M_AUTOSTART));
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
"Close window when done playing movies",
new BMessage(M_CLOSE_WINDOW_MOVIE));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
"Close window when done playing sounds",
new BMessage(M_CLOSE_WINDOW_SOUNDS));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
"Loop movies by default", new BMessage(M_LOOP_MOVIE));
fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
"Loop sounds by default", new BMessage(M_LOOP_SOUND));
fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
"Use hardware video overlays if available",
new BMessage(M_USE_OVERLAYS));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
"Scale movies smoothly (non-overlay mode)",
new BMessage(M_SCALE_BILINEAR));
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Full volume", new BMessage(M_START_FULL_VOLUME));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
"Low volume", new BMessage(M_START_HALF_VOLUME));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Muted", new BMessage(M_START_MUTE_VOLUME));
fRevertB = new BButton("revert", "Revert",
new BMessage(M_SETTINGS_REVERT));
BButton* cancelButton = new BButton("cancel", "Cancel",
new BMessage(M_SETTINGS_CANCEL));
BButton* okButton = new BButton("ok", "OK",
new BMessage(M_SETTINGS_SAVE));
okButton->MakeDefault(true);
// Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(BGroupLayoutBuilder(settingsLayout)
.Add(playModeLabel)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(fAutostartCB)
.Add(BGridLayoutBuilder(5, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 0)
.Add(fCloseWindowMoviesCB, 1, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 1)
.Add(fCloseWindowSoundsCB, 1, 1)
)
.Add(fLoopMoviesCB)
.Add(fLoopSoundsCB)
)
)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
.Add(viewOptionsLabel)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
//.........这里部分代码省略.........
示例9: gccFourHybrid
AboutView::AboutView()
: BView("aboutview", B_WILL_DRAW | B_PULSE_NEEDED),
fLastActionTime(system_time()),
fScrollRunner(NULL)
{
// Begin Construction of System Information controls
system_info systemInfo;
get_system_info(&systemInfo);
// Create all the various labels for system infomation
// OS Version
char string[1024];
strcpy(string, B_TRANSLATE("Unknown"));
// the version is stored in the BEOS:APP_VERSION attribute of libbe.so
BPath path;
if (find_directory(B_BEOS_LIB_DIRECTORY, &path) == B_OK) {
path.Append("libbe.so");
BAppFileInfo appFileInfo;
version_info versionInfo;
BFile file;
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK
&& appFileInfo.SetTo(&file) == B_OK
&& appFileInfo.GetVersionInfo(&versionInfo,
B_APP_VERSION_KIND) == B_OK
&& versionInfo.short_info[0] != '\0')
strcpy(string, versionInfo.short_info);
}
// Add revision from uname() info
utsname unameInfo;
if (uname(&unameInfo) == 0) {
long revision;
if (sscanf(unameInfo.version, "r%ld", &revision) == 1) {
char version[16];
snprintf(version, sizeof(version), "%ld", revision);
strlcat(string, " (", sizeof(string));
strlcat(string, B_TRANSLATE("Revision"), sizeof(string));
strlcat(string, " ", sizeof(string));
strlcat(string, version, sizeof(string));
strlcat(string, ")", sizeof(string));
}
}
BStringView* versionView = new BStringView("ostext", string);
versionView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
// GCC version
BEntry gccFourHybrid("/boot/system/lib/gcc2/libstdc++.r4.so");
BEntry gccTwoHybrid("/boot/system/lib/gcc4/libsupc++.so");
if (gccFourHybrid.Exists() || gccTwoHybrid.Exists())
snprintf(string, sizeof(string), B_TRANSLATE("GCC %d Hybrid"),
__GNUC__);
else
snprintf(string, sizeof(string), "GCC %d", __GNUC__);
BStringView* gccView = new BStringView("gcctext", string);
gccView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
// CPU count, type and clock speed
char processorLabel[256];
if (systemInfo.cpu_count > 1) {
snprintf(processorLabel, sizeof(processorLabel),
B_TRANSLATE("%ld Processors:"), systemInfo.cpu_count);
} else
strlcpy(processorLabel, B_TRANSLATE("Processor:"),
sizeof(processorLabel));
BString cpuType;
cpuType << get_cpu_vendor_string(systemInfo.cpu_type)
<< " " << get_cpu_model_string(&systemInfo);
BStringView* cpuView = new BStringView("cputext", cpuType.String());
cpuView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
int32 clockSpeed = get_rounded_cpu_speed();
if (clockSpeed < 1000)
sprintf(string, B_TRANSLATE("%ld MHz"), clockSpeed);
else
sprintf(string, B_TRANSLATE("%.2f GHz"), clockSpeed / 1000.0f);
BStringView* frequencyView = new BStringView("frequencytext", string);
frequencyView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
// RAM
BStringView *memSizeView = new BStringView("ramsizetext",
MemSizeToString(string, sizeof(string), &systemInfo));
memSizeView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fMemView = new BStringView("ramtext",
MemUsageToString(string, sizeof(string), &systemInfo));
fMemView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
//.........这里部分代码省略.........
示例10: BMessage
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
const BEntry& entry)
:
BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
B_TRANSLATE("Application type"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
B_FRAME_EVENTS | B_AUTO_UPDATE_SIZE_LIMITS),
fChangedProperties(0)
{
float padding = be_control_look->DefaultItemSpacing();
BAlignment labelAlignment = be_control_look->DefaultLabelAlignment();
BMenuBar* menuBar = new BMenuBar((char*)NULL);
menuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
BMenu* menu = new BMenu(B_TRANSLATE("File"));
fSaveMenuItem = new BMenuItem(B_TRANSLATE("Save"),
new BMessage(kMsgSave), 'S');
fSaveMenuItem->SetEnabled(false);
menu->AddItem(fSaveMenuItem);
BMenuItem* item;
menu->AddItem(item = new BMenuItem(
B_TRANSLATE("Save into resource file" B_UTF8_ELLIPSIS), NULL));
item->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W', B_COMMAND_KEY));
menuBar->AddItem(menu);
// Signature
fSignatureControl = new BTextControl(B_TRANSLATE("Signature:"), NULL,
new BMessage(kMsgSignatureChanged));
fSignatureControl->SetModificationMessage(
new BMessage(kMsgSignatureChanged));
// filter out invalid characters that can't be part of a MIME type name
BTextView* textView = fSignatureControl->TextView();
textView->SetMaxBytes(B_MIME_TYPE_LENGTH);
const char* disallowedCharacters = "<>@,;:\"()[]?=";
for (int32 i = 0; disallowedCharacters[i]; i++) {
textView->DisallowChar(disallowedCharacters[i]);
}
// "Application Flags" group
BBox* flagsBox = new BBox("flagsBox");
fFlagsCheckBox = new BCheckBox("flags", B_TRANSLATE("Application flags"),
new BMessage(kMsgToggleAppFlags));
fFlagsCheckBox->SetValue(B_CONTROL_ON);
fSingleLaunchButton = new BRadioButton("single",
B_TRANSLATE("Single launch"), new BMessage(kMsgAppFlagsChanged));
fMultipleLaunchButton = new BRadioButton("multiple",
B_TRANSLATE("Multiple launch"), new BMessage(kMsgAppFlagsChanged));
fExclusiveLaunchButton = new BRadioButton("exclusive",
B_TRANSLATE("Exclusive launch"), new BMessage(kMsgAppFlagsChanged));
fArgsOnlyCheckBox = new BCheckBox("args only", B_TRANSLATE("Args only"),
new BMessage(kMsgAppFlagsChanged));
fBackgroundAppCheckBox = new BCheckBox("background",
B_TRANSLATE("Background app"), new BMessage(kMsgAppFlagsChanged));
flagsBox->AddChild(BGridLayoutBuilder()
.Add(fSingleLaunchButton, 0, 0).Add(fArgsOnlyCheckBox, 1, 0)
.Add(fMultipleLaunchButton, 0, 1).Add(fBackgroundAppCheckBox, 1, 1)
.Add(fExclusiveLaunchButton, 0, 2)
.SetInsets(padding, padding, padding, padding));
flagsBox->SetLabel(fFlagsCheckBox);
// "Icon" group
BBox* iconBox = new BBox("IconBox");
iconBox->SetLabel(B_TRANSLATE("Icon"));
fIconView = new IconView("icon");
fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
.Add(fIconView)
.SetInsets(padding, padding, padding, padding));
// "Supported Types" group
BBox* typeBox = new BBox("typesBox");
typeBox->SetLabel(B_TRANSLATE("Supported types"));
fTypeListView = new SupportedTypeListView("Suppported Types",
B_SINGLE_SELECTION_LIST);
fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));
BScrollView* scrollView = new BScrollView("type scrollview", fTypeListView,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
fAddTypeButton = new BButton("add type",
B_TRANSLATE("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType));
//.........这里部分代码省略.........
示例11: BMessage
FormatSettingsView::FormatSettingsView()
:
BView("WindowsSettingsView", B_FRAME_EVENTS)
{
fUseLanguageStringsCheckBox = new BCheckBox(
B_TRANSLATE("Use month/day-names from preferred language"),
new BMessage(kStringsLanguageChange));
BStringView* fullDateLabel
= new BStringView("", B_TRANSLATE("Full format:"));
fullDateLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* longDateLabel
= new BStringView("", B_TRANSLATE("Long format:"));
longDateLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* mediumDateLabel
= new BStringView("", B_TRANSLATE("Medium format:"));
mediumDateLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* shortDateLabel
= new BStringView("", B_TRANSLATE("Short format:"));
shortDateLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fFullDateExampleView = new BStringView("", "");
fFullDateExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fLongDateExampleView = new BStringView("", "");
fLongDateExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fMediumDateExampleView = new BStringView("", "");
fMediumDateExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fShortDateExampleView = new BStringView("", "");
fShortDateExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
f24HourRadioButton = new BRadioButton("", B_TRANSLATE("24 hour"),
new BMessage(kClockFormatChange));
f12HourRadioButton = new BRadioButton("", B_TRANSLATE("12 hour"),
new BMessage(kClockFormatChange));
float spacing = be_control_look->DefaultItemSpacing();
BStringView* fullTimeLabel
= new BStringView("", B_TRANSLATE("Full format:"));
fullTimeLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* longTimeLabel
= new BStringView("", B_TRANSLATE("Long format:"));
longTimeLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* mediumTimeLabel
= new BStringView("", B_TRANSLATE("Medium format:"));
mediumTimeLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* shortTimeLabel
= new BStringView("", B_TRANSLATE("Short format:"));
shortTimeLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fFullTimeExampleView = new BStringView("", "");
fFullTimeExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fLongTimeExampleView = new BStringView("", "");
fLongTimeExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fMediumTimeExampleView = new BStringView("", "");
fMediumTimeExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fShortTimeExampleView = new BStringView("", "");
fShortTimeExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* positiveNumberLabel
= new BStringView("", B_TRANSLATE("Positive:"));
positiveNumberLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* negativeNumberLabel
= new BStringView("", B_TRANSLATE("Negative:"));
negativeNumberLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fPositiveNumberExampleView = new BStringView("", "");
fPositiveNumberExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
B_ALIGN_VERTICAL_UNSET));
fNegativeNumberExampleView = new BStringView("", "");
fNegativeNumberExampleView->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT,
B_ALIGN_VERTICAL_UNSET));
BStringView* positiveMonetaryLabel
= new BStringView("", B_TRANSLATE("Positive:"));
positiveMonetaryLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* negativeMonetaryLabel
= new BStringView("", B_TRANSLATE("Negative:"));
negativeMonetaryLabel->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
//.........这里部分代码省略.........
示例12: leftAlignment
ConfigView::ConfigView(TranslatorSettings *settings)
: BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
{
fSettings = settings;
BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET);
BStringView *stringView = new BStringView("title", "OptiPNG Translator");
stringView->SetFont(be_bold_font);
stringView->SetExplicitAlignment(leftAlignment);
AddChild(stringView);
float spacing = be_control_look->DefaultItemSpacing();
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
char version[256];
sprintf(version, "Version %d.%d.%d, %s",
int(B_TRANSLATION_MAJOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)),
int(B_TRANSLATION_MINOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)),
int(B_TRANSLATION_REVISION_VERSION(OPTIPNG_TRANSLATOR_VERSION)),
__DATE__);
stringView = new BStringView("version", version);
stringView->SetExplicitAlignment(leftAlignment);
AddChild(stringView);
stringView = new BStringView("my_copyright",
B_UTF8_COPYRIGHT "2013 Luke <[email protected]>.");
stringView->SetExplicitAlignment(leftAlignment);
AddChild(stringView);
AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing));
fOptimizationLevel = new BSlider(
"optimization",
"Optimization level:", new BMessage(kMsgOptim),
0, 7, B_HORIZONTAL, B_BLOCK_THUMB);
fOptimizationLevel->SetHashMarks(B_HASH_MARKS_BOTTOM);
fOptimizationLevel->SetHashMarkCount(8);
fOptimizationLevel->SetLimitLabels("Low", "High");
fOptimizationLevel->SetValue(
fSettings->SetGetInt32(OPTIPNG_SETTING_OPTIMIZATION_LEVEL));
AddChild(fOptimizationLevel);
fBitDepthCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_BIT_DEPTH_REDUCTION,
"Reduce bit depth:", new BMessage(kMsgBitDepth));
if (fSettings->SetGetBool(OPTIPNG_SETTING_BIT_DEPTH_REDUCTION))
fBitDepthCheckBox->SetValue(B_CONTROL_ON);
AddChild(fBitDepthCheckBox);
fColorTypeCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_COLOR_TYPE_REDUCTION,
"Reduce color type:", new BMessage(kMsgColorType));
if (fSettings->SetGetBool(OPTIPNG_SETTING_COLOR_TYPE_REDUCTION))
fColorTypeCheckBox->SetValue(B_CONTROL_ON);
AddChild(fColorTypeCheckBox);
fPaletteCheckBox = new BCheckBox((char*)OPTIPNG_SETTING_PALETTE_REDUCTION,
"Reduce palette size:", new BMessage(kMsgPaletteReduc));
if (fSettings->SetGetBool(OPTIPNG_SETTING_PALETTE_REDUCTION))
fPaletteCheckBox->SetValue(B_CONTROL_ON);
AddChild(fPaletteCheckBox);
AddChild(BSpaceLayoutItem::CreateGlue());
GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
SetExplicitPreferredSize(GroupLayout()->MinSize());
}
示例13: BCheckBox
void
PartitionsPage::_FillPartitionsView(BView* view)
{
// show | name | type | size | path
int32 rowNumber = 0;
BMessage message;
for (int32 i = 0; fSettings->FindMessage("partition", i, &message) == B_OK;
i++, rowNumber++) {
// get partition data
bool show;
BString name;
BString type;
BString path;
int64 size;
message.FindBool("show", &show);
message.FindString("name", &name);
message.FindString("type", &type);
message.FindString("path", &path);
message.FindInt64("size", &size);
// check box
BCheckBox* checkBox = new BCheckBox("show", "",
_CreateControlMessage(kMessageShow, i));
if (show)
checkBox->SetValue(1);
// name
BTextControl* nameControl = new BTextControl("name", "",
name.String(), _CreateControlMessage(kMessageName, i));
nameControl->SetExplicitMinSize(BSize(StringWidth("WWWWWWWWWWWWWW"),
B_SIZE_UNSET));
// size
BString sizeText;
_CreateSizeText(size, &sizeText);
sizeText << ", " << type.String();
BStringView* typeView = new BStringView("type", sizeText.String());
typeView->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET));
// path
BStringView* pathView = new BStringView("path", path.String());
pathView->SetExplicitAlignment(
BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET));
if (rowNumber > 0) {
BLayoutBuilder::Grid<>((BGridLayout*)view->GetLayout())
.Add(new BSeparatorView(B_HORIZONTAL), 0, rowNumber, 4, 1)
.SetRowWeight(rowNumber, 0);
rowNumber++;
}
BLayoutBuilder::Grid<>((BGridLayout*)view->GetLayout())
.Add(checkBox, 0, rowNumber, 1, 2)
.Add(nameControl, 1, rowNumber, 1, 2)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 2, rowNumber)
.Add(typeView, 3, rowNumber)
.Add(pathView, 3, rowNumber + 1)
.SetRowWeight(rowNumber + 1, 1);
rowNumber++;
}
}