本文整理汇总了C++中BStringView::SetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringView::SetFont方法的具体用法?C++ BStringView::SetFont怎么用?C++ BStringView::SetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BStringView
的用法示例。
在下文中一共展示了BStringView::SetFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BStringView
quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*> CheckView::MakeField(uint16 width,
string name, uint16* xpos, uint16* ypos)
{
BStringView* sv = new BStringView(BRect((*xpos), (*ypos),
(*xpos) + width, (*ypos) + 10),
(name + "Text").c_str(), name.c_str());
BFont font;
sv->GetFont(&font);
font.SetSize(10);
sv->SetFont(&font);
AddChild(sv);
BTextControl* tc = new BTextControl(BRect((*xpos) - 5, (*ypos) + 10,
(*xpos) + width, (*ypos) + 10), (name + "Field").c_str(),
"", "", 0);
(*xpos) += width;
tc->SetDivider(0);
AddChild(tc);
BPopUpMenu* pu = new BPopUpMenu("", true, false);
BMenuField* mf = new BMenuField(BRect((*xpos) + 2, (*ypos) + 9,
(*xpos) + 2, (*ypos) + 9), (name + "Menu").c_str(), "", pu);
mf->SetDivider(0);
AddChild(mf);
(*xpos) += 30;
return quadruplet<BTextControl*, BPopUpMenu*, BMenuField*, BStringView*>(tc, pu, mf, sv);
}
示例2: BView
ConfigView::ConfigView(const BRect &frame, uint32 resize, uint32 flags)
: BView(frame, B_TRANSLATE("RTF-Translator Settings"), resize, flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BStringView *titleView = new BStringView("title",
B_TRANSLATE("Rich Text Format (RTF) translator"));
titleView->SetFont(be_bold_font);
char version[256];
snprintf(version, sizeof(version), B_TRANSLATE("Version %d.%d.%d, %s"),
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(RTF_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_MINOR_VERSION(RTF_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
RTF_TRANSLATOR_VERSION)), __DATE__);
BStringView *versionView = new BStringView("version", version);
BStringView *copyrightView = new BStringView(
"Copyright", B_UTF8_COPYRIGHT "2004-2006 Haiku Inc.");
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(titleView)
.Add(versionView)
.Add(copyrightView)
.AddGlue();
}
示例3: 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();
}
示例4: BMessage
ServiceView::ServiceView(const char* name, const char* executable,
const char* title, const char* description, BNetworkSettings& settings)
:
BView("service", 0),
fName(name),
fExecutable(executable),
fSettings(settings)
{
BStringView* titleView = new BStringView("service", title);
titleView->SetFont(be_bold_font);
titleView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
BTextView* descriptionView = new BTextView("description");
descriptionView->SetText(description);
descriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
descriptionView->MakeEditable(false);
fEnableButton = new BButton("toggler", B_TRANSLATE("Enable"),
new BMessage(kMsgToggleService));
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(titleView)
.Add(descriptionView)
.AddGroup(B_HORIZONTAL)
.AddGlue()
.Add(fEnableButton);
SetExplicitMinSize(BSize(200, B_SIZE_UNSET));
_UpdateEnableButton();
fWasEnabled = IsEnabled();
}
示例5: BStringView
WonderBrushView::WonderBrushView(const BRect &frame, const char *name,
uint32 resize, uint32 flags, TranslatorSettings *settings)
: BView(frame, name, resize, flags),
fSettings(settings)
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BStringView *titleView = new BStringView("title",
B_TRANSLATE("WonderBrush image translator"));
titleView->SetFont(be_bold_font);
char version[100];
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(WBI_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_MINOR_VERSION(WBI_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
WBI_TRANSLATOR_VERSION)), __DATE__);
BStringView *versionView = new BStringView("version", version);
BStringView *copyrightView = new BStringView("copyright", kWBICopyright);
BStringView *copyright2View = new BStringView("copyright2", B_TRANSLATE("written by:"));
BStringView *copyright3View = new BStringView("copyright3", kAuthor);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(titleView)
.Add(versionView)
.Add(copyrightView)
.AddGlue()
.Add(copyright2View)
.Add(copyright3View);
}
示例6: StartConfig
void Clock::StartConfig(BView *view)
{
tview = new BStringView(BRect(10, 10, 200, 35), B_EMPTY_STRING, "Simple Clock");
tview->SetFont(be_bold_font);
tview->SetFontSize(15);
view->AddChild(tview);
view->AddChild(new BStringView(BRect(10, 40, 200, 65), B_EMPTY_STRING, " Ver 0.1, ©3dEyes**"));
}
示例7: 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;
}
示例8: BView
AskName::AskName():
BWindow(BRect(100, 100, 500, 200), "Enter your name",
B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE
| B_NOT_MINIMIZABLE),
Text(NULL),
text(NULL)
{
BView *back;
BButton * Accept;
BTextView *TV;
BStringView *str;
const char *names[] =
{
"BeOS forever!",
"BShisen Rules!",
"Thanks Sheppy",
"Say NO to drugs!",
"Say NO to piracy!",
"Say YES to BeOS!",
"Just say \"BShisen\"",
"Say YES to BShisen!",
};
back = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(216, 216, 216);
AddChild(back);
str = new BStringView(BRect(10, 10, 390, 25), "",
"Congratulations! Enter your name for posterity.");
str->SetFont(be_bold_font);
back->AddChild(str);
Accept = new BButton( BRect(10, 60+5, 90, 75+5), "Accept",
"Accept", new BMessage(ACCEPT_BUTTON));
Accept->MakeDefault(true);
back->AddChild(Accept);
Text = new BTextControl(BRect(10, 35, 390, 50), "",
"Your Name", "", NULL);
Text->SetDivider(Text->StringWidth("Your Name "));
TV = Text->TextView();
TV->SetMaxBytes(31);
Text->SetText(REGISTERED ? names[rand() % 8] : "I Want To Register!");
back->AddChild(Text);
Text->MakeFocus(true);
}
示例9: r
SetKeyWindow::SetKeyWindow(BPoint p, int32 i, BView *v) : BWindow(BRect(p.x,p.y,p.x,p.y),Language.get("SET_KEY_WINDOW"), B_TITLED_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
, index(i), parent(v)
{
BRect r(0,0,300,150);
ResizeTo(r.Width(), r.Height());
MoveBy(-r.Width()/2, -r.Height()/2);
BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
r.InsetBy(8,8);
r.bottom = r.top+19;
BStringView *st;
r.right = r.left + be_bold_font->StringWidth(Language.get("KEY_SETTINGS_FOR"));
view->AddChild(st = new BStringView(r, NULL, Language.get("KEY_SETTINGS_FOR") ));
st->SetFont(be_bold_font);
r.left = r.right+8;
r.right = Bounds().right-8;
view->AddChild(new BStringView(r, NULL, Language.get(KeyBind.GetID(index)) ));
// request the installed message
key = KeyBind.GetKey( KeyBind.GetID(index) );
key2 = KeyBind.GetKeyAlt( KeyBind.GetID(index) );
mod = KeyBind.GetMod( KeyBind.GetID(index) );
mod2 = KeyBind.GetModAlt( KeyBind.GetID(index) );
message = KeyBind.GetMessage( KeyBind.GetID(index) );
menu = KeyBind.IsMenuItem( KeyBind.GetID(index) );
r.OffsetBy(0,30);
r.left = 8;
float x = 8 + MAX( be_plain_font->StringWidth(Language.get("PRIMARY")), be_plain_font->StringWidth(Language.get("ALTERNATE")));
r.right = Bounds().right -96;
view->AddChild(control1 = new KeyControl(r, Language.get("PRIMARY"), key, mod, menu));
control1->SetDivider(x);
view->AddChild(new BButton(BRect(r.right+8, r.top, Bounds().right-8, r.bottom), NULL, Language.get("CLEAR"), new BMessage(CLEAR1)) );
r.OffsetBy(0,30);
view->AddChild(control2 = new KeyControl(r, Language.get("ALTERNATE"), key2, mod2, false));
control2->SetDivider(x);
view->AddChild(new BButton(BRect(r.right+8, r.top, Bounds().right-8, r.bottom), NULL, Language.get("CLEAR"), new BMessage(CLEAR2)) );
r = Bounds();
r.InsetBy(8,8);
r.top = r.bottom - 23;
r.left = r.right - 80;
view->AddChild(new BButton(r, NULL, Language.get("APPLY"), new BMessage(SET)) );
r.OffsetBy(-(r.Width()+8), 0);
view->AddChild(new BButton(r, NULL, Language.get("CANCEL"), new BMessage(B_QUIT_REQUESTED)) );
AddChild(view);
Run();
Show();
}
示例10: rect
AlertView::AlertView(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
// we will wait 12 seconds until we send a message
fSeconds(12)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fBitmap = InitIcon();
BRect rect(60, 8, 400, 36);
BStringView *stringView = new BStringView(rect, NULL,
"Do you wish to keep these settings?");
stringView->SetFont(be_bold_font);
stringView->ResizeToPreferred();
AddChild(stringView);
rect = stringView->Frame();
rect.OffsetBy(0, rect.Height());
fCountdownView = new BStringView(rect, "countdown", NULL);
UpdateCountdownView();
fCountdownView->ResizeToPreferred();
AddChild(fCountdownView);
BButton* keepButton = new BButton(rect, "keep", "Keep",
new BMessage(BUTTON_KEEP_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
keepButton->ResizeToPreferred();
AddChild(keepButton);
BButton* button = new BButton(rect, "undo", "Undo",
new BMessage(BUTTON_UNDO_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
AddChild(button);
// we're resizing ourselves to the right size
// (but we're not implementing GetPreferredSize(), bad style!)
float width = stringView->Frame().right;
if (fCountdownView->Frame().right > width)
width = fCountdownView->Frame().right;
if (width < Bounds().Width())
width = Bounds().Width();
float height
= fCountdownView->Frame().bottom + 24 + button->Bounds().Height();
ResizeTo(width, height);
keepButton->MoveTo(Bounds().Width() - 8 - keepButton->Bounds().Width(),
Bounds().Height() - 8 - keepButton->Bounds().Height());
button->MoveTo(keepButton->Frame().left - button->Bounds().Width() - 8,
keepButton->Frame().top);
keepButton->MakeDefault(true);
}
示例11: BGroupView
ConfigView::ConfigView(TranslatorSettings *settings)
: BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
{
fSettings = settings;
BStringView *titleView = new BStringView("title", B_TRANSLATE("Apple icon translator"));
titleView->SetFont(be_bold_font);
char version[256];
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
int(B_TRANSLATION_MAJOR_VERSION(ICNS_TRANSLATOR_VERSION)),
int(B_TRANSLATION_MINOR_VERSION(ICNS_TRANSLATOR_VERSION)),
int(B_TRANSLATION_REVISION_VERSION(ICNS_TRANSLATOR_VERSION)),
__DATE__);
BStringView *versionView = new BStringView("version", version);
BStringView *copyrightView = new BStringView("copyright",
B_UTF8_COPYRIGHT "2005-2006 Haiku Inc.");
BStringView *copyright2View = new BStringView("my_copyright",
B_UTF8_COPYRIGHT "2012 Gerasim Troeglazov <[email protected]>.");
BStringView *infoView = new BStringView("support_sizes",
B_TRANSLATE("Valid sizes: 16, 32, 48, 128, 256, 512, 1024"));
BStringView *info2View = new BStringView("support_colors",
B_TRANSLATE("Valid colors: RGB32, RGBA32"));
BStringView *copyright3View = new BStringView("copyright3",
"libicns v0.8.1\n");
BStringView *copyright4View = new BStringView("copyright4",
"2001-2012 Mathew Eis <[email protected]>");
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(titleView)
.Add(versionView)
.Add(copyrightView)
.Add(copyright2View)
.AddGlue()
.Add(infoView)
.Add(info2View)
.AddGlue()
.Add(copyright3View)
.Add(copyright4View);
SetExplicitPreferredSize(GroupLayout()->MinSize());
}
示例12: rect
// This is used to provide a consistent look for the settings view for screen
// savers without any configuration.
void
BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName, const char* info)
{
BRect rect(15, 15, 20, 20);
BStringView* stringView = new BStringView(rect, "module", moduleName);
stringView->SetFont(be_bold_font);
stringView->ResizeToPreferred();
view->AddChild(stringView);
rect.OffsetBy(0, stringView->Bounds().Height() + 4);
stringView = new BStringView(rect, "info", info);
stringView->ResizeToPreferred();
view->AddChild(stringView);
}
示例13: r
BView *
LibraryWindow::AddHeader(BPoint location, const char *label)
{
Lock();
BRect r(location.x,location.y,location.x + 1, location.y + 1);
BStringView *header = new BStringView(r,"header",label);
fCheckList->AddChild(header);
header->SetFont(be_bold_font);
header->SetHighColor(0,0,255);
header->ResizeToPreferred();
Unlock();
return header;
}
示例14: BMessage
void
UninstallView::_InitView()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fAppList = new BListView("pkg_list", B_SINGLE_SELECTION_LIST);
fAppList->SetSelectionMessage(new BMessage(P_MSG_SELECT));
BScrollView* scrollView = new BScrollView("list_scroll", fAppList,
0, false, true, B_NO_BORDER);
BStringView* descriptionLabel = new BStringView("desc_label",
B_TRANSLATE("Package description"));
descriptionLabel->SetFont(be_bold_font);
fDescription = new BTextView("description", B_WILL_DRAW);
fDescription->MakeSelectable(false);
fDescription->MakeEditable(false);
fDescription->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fDescription->SetText(fNoPackageSelectedString);
fButton = new BButton("removal", B_TRANSLATE("Remove"),
new BMessage(P_MSG_REMOVE));
fButton->SetEnabled(false);
const float spacing = be_control_look->DefaultItemSpacing();
BGroupLayoutBuilder builder(GroupLayout());
builder.Add(scrollView)
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
.Add(BGroupLayoutBuilder(B_VERTICAL)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(descriptionLabel)
.AddGlue()
)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
.Add(fDescription)
)
.SetInsets(spacing, spacing, spacing, spacing)
)
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
.Add(BGroupLayoutBuilder(B_HORIZONTAL)
.AddGlue()
.Add(fButton)
.SetInsets(spacing, spacing, spacing, spacing)
)
;
}
示例15: BView
ConfigView::ConfigView(uint32 flags)
: BView("EXRTranslator Settings", flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BStringView *fTitle = new BStringView("title",
B_TRANSLATE("EXR image translator"));
fTitle->SetFont(be_bold_font);
char version[256];
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
int(B_TRANSLATION_MAJOR_VERSION(EXR_TRANSLATOR_VERSION)),
int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
__DATE__);
BStringView *fVersion = new BStringView("version", version);
BStringView *fCopyright = new BStringView("copyright",
B_UTF8_COPYRIGHT "2008 Haiku Inc.");
BStringView *fCopyright2 = new BStringView("copyright2",
B_TRANSLATE("Based on OpenEXR (http://www.openexr.com)"));
BStringView *fCopyright3 = new BStringView("copyright3",
B_UTF8_COPYRIGHT "2006, Industrial Light & Magic,");
BStringView *fCopyright4 = new BStringView("copyright4",
B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd"));
// Build the layout
BLayoutBuilder::Group<>(this, B_VERTICAL, 7)
.SetInsets(5)
.Add(fTitle)
.Add(fVersion)
.AddGlue()
.Add(fCopyright)
.Add(fCopyright2)
.AddGlue()
.Add(fCopyright3)
.Add(fCopyright4)
.AddGlue();
BFont font;
GetFont(&font);
SetExplicitPreferredSize(BSize(font.Size() * 400 / 12,
font.Size() * 200 / 12));
}