本文整理汇总了C++中BFont::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ BFont::Size方法的具体用法?C++ BFont::Size怎么用?C++ BFont::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFont
的用法示例。
在下文中一共展示了BFont::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BGroupLayout
PartitionView(const char* name, float weight, off_t offset,
int32 level, partition_id id)
:
BView(name, B_WILL_DRAW | B_SUPPORTS_LAYOUT | B_FULL_UPDATE_ON_RESIZE),
fID(id),
fWeight(weight),
fOffset(offset),
fLevel(level),
fSelected(false),
fMouseOver(false),
fGroupLayout(new BGroupLayout(B_HORIZONTAL, kLayoutInset))
{
SetLayout(fGroupLayout);
SetViewColor(B_TRANSPARENT_COLOR);
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
base = tint_color(base, B_LIGHTEN_2_TINT);
base = tint_color(base, 1 + 0.13 * (level - 1));
SetLowColor(base);
SetHighColor(tint_color(base, B_DARKEN_1_TINT));
BFont font;
GetFont(&font);
font.SetSize(ceilf(font.Size() * 0.85));
font.SetRotation(90.0);
SetFont(&font);
fGroupLayout->SetInsets(kLayoutInset, kLayoutInset + font.Size(),
kLayoutInset, kLayoutInset);
SetExplicitMinSize(BSize(font.Size() + 6, 30));
}
示例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
TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings)
:
BView(name, flags),
fSettings(settings)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ViewColor());
fTitle = new BStringView("title", B_TRANSLATE("TGA Image Translator"));
fTitle->SetFont(be_bold_font);
char detail[100];
sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)),
static_cast<int>(B_TRANSLATION_REVISION_VERSION(
TGA_TRANSLATOR_VERSION)), __DATE__);
fDetail = new BStringView("detail", detail);
fWrittenBy = new BStringView("writtenby",
B_TRANSLATE("Written by the Haiku Translation Kit Team"));
fpchkIgnoreAlpha = new BCheckBox(B_TRANSLATE("Ignore TGA alpha channel"),
new BMessage(CHANGE_IGNORE_ALPHA));
int32 val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0;
fpchkIgnoreAlpha->SetValue(val);
fpchkIgnoreAlpha->SetViewColor(ViewColor());
fpchkRLE = new BCheckBox(B_TRANSLATE("Save with RLE Compression"),
new BMessage(CHANGE_RLE));
val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0;
fpchkRLE->SetValue(val);
fpchkRLE->SetViewColor(ViewColor());
// Build the layout
SetLayout(new BGroupLayout(B_HORIZONTAL));
AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
.Add(fTitle)
.Add(fDetail)
.AddGlue()
.Add(fpchkIgnoreAlpha)
.Add(fpchkRLE)
.AddGlue()
.Add(fWrittenBy)
.AddGlue()
.SetInsets(5, 5, 5, 5)
);
BFont font;
GetFont(&font);
SetExplicitPreferredSize(BSize((font.Size() * 333)/12,
(font.Size() * 200)/12));
}
示例4: menuPrivate
void
BMenuItem::DrawContent()
{
MenuPrivate menuPrivate(fSuper);
menuPrivate.CacheFontInfo();
fSuper->MovePenBy(0, menuPrivate.Ascent());
BPoint lineStart = fSuper->PenLocation();
float labelWidth, labelHeight;
GetContentSize(&labelWidth, &labelHeight);
fSuper->SetDrawingMode(B_OP_OVER);
float frameWidth = fBounds.Width();
if (menuPrivate.State() == MENU_STATE_CLOSED) {
float rightMargin, leftMargin;
menuPrivate.GetItemMargins(&leftMargin, NULL, &rightMargin, NULL);
frameWidth = fSuper->Frame().Width() - (rightMargin + leftMargin);
}
// truncate if needed
if (frameWidth > labelWidth)
fSuper->DrawString(fLabel);
else {
char *truncatedLabel = new char[strlen(fLabel) + 4];
TruncateLabel(frameWidth, truncatedLabel);
fSuper->DrawString(truncatedLabel);
delete[] truncatedLabel;
}
if (fSuper->AreTriggersEnabled() && fTriggerIndex != -1) {
float escapements[fTriggerIndex + 1];
BFont font;
fSuper->GetFont(&font);
font.GetEscapements(fLabel, fTriggerIndex + 1, escapements);
for (int32 i = 0; i < fTriggerIndex; i++)
lineStart.x += escapements[i] * font.Size();
lineStart.x--;
lineStart.y++;
BPoint lineEnd(lineStart);
lineEnd.x += escapements[fTriggerIndex] * font.Size();
fSuper->StrokeLine(lineStart, lineEnd);
}
}
示例5: BPopUpMenu
PieView::PieView(BVolume* volume)
:
BView(NULL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_SUBPIXEL_PRECISE),
fWindow(NULL),
fScanner(NULL),
fVolume(volume),
fMouseOverInfo(),
fClicked(false),
fDragging(false),
fUpdateFileAt(false)
{
fMouseOverMenu = new BPopUpMenu(kEmptyStr, false, false);
fMouseOverMenu->AddItem(new BMenuItem(B_TRANSLATE("Get Info"), NULL),
kIdxGetInfo);
fMouseOverMenu->AddItem(new BMenuItem(B_TRANSLATE("Open"), NULL),
kIdxOpen);
fFileUnavailableMenu = new BPopUpMenu(kEmptyStr, false, false);
BMenuItem* item = new BMenuItem(B_TRANSLATE("file unavailable"), NULL);
item->SetEnabled(false);
fFileUnavailableMenu->AddItem(item);
BFont font;
GetFont(&font);
font.SetSize(ceilf(font.Size() * 1.33));
font.SetFace(B_BOLD_FACE);
SetFont(&font);
struct font_height fh;
font.GetHeight(&fh);
fFontHeight = ceilf(fh.ascent) + ceilf(fh.descent) + ceilf(fh.leading);
}
示例6: ceilf
void
TeamsColumn::InitTextMargin(BView* parent)
{
BFont font;
parent->GetFont(&font);
sTextMargin = ceilf(font.Size() * 0.8);
}
示例7: FrameResized
void NetListView::FrameResized(float width, float height)
{
BListView::FrameResized(width, height);
//Ensure the bevel on the right is drawn properly
if(width < oldWidth)
oldWidth = width;
PushState();
BRect invalRect(oldWidth, 0, oldWidth, height);
ConvertFromParent(&invalRect);
BRegion lineRegion(invalRect);
ConstrainClippingRegion(&lineRegion);
Draw(invalRect);
oldWidth = width;
PopState();
//Do word wrapping
BFont curFont;
GetFont(&curFont);
float itemWidth = Bounds().Width();
float wrapWidth = (itemWidth - 6)/curFont.Size();
for(int itemNum = 0; itemNum < CountItems(); itemNum++)
{
NetListItem* item = (NetListItem*)(Items()[itemNum]);
item->SetWidth(itemWidth);
item->CalcWordWrap(wrapWidth);
}
//DoForEach(UpdateItem, (void*)this);
Invalidate();
BListView::FrameResized(width, height);
}
示例8: ChooseFont
void CSelectionView::ChooseFont()
{
CFontMetrics metrics = gFontSizeTable[fCellView->BorderFontID()];
BFont myFont = metrics.Font();
font_height fi;
do
{
myFont.GetHeight(&fi);
if (fi.ascent + fi.descent <= Bounds().Height())
break;
float size = myFont.Size();
myFont.SetSize(size - 1);
myFont.GetHeight(&fi);
if (fi.ascent + fi.descent <= Bounds().Height())
break;
myFont.SetSize(size - 2);
myFont.GetHeight(&fi);
if (fi.ascent + fi.descent <= Bounds().Height())
break;
myFont = be_plain_font;
myFont.GetHeight(&fi);
if (fi.ascent + fi.descent <= Bounds().Height())
break;
// uh, oh, trouble...
}
while (false);
SetFont(&myFont);
Invalidate();
} /* CSelectionView::ChooseFont */
示例9:
/* virtual */
void
HeaderListItem::DrawItem(BView *owner, BRect itemRect, bool drawEverthing)
{
owner->SetDrawingMode(B_OP_COPY);
owner->PushState();
if (IsSelected()) {
rgb_color lowColor = owner->LowColor();
owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT));
owner->FillRect(itemRect);
}
owner->PopState();
itemRect.InsetBy(0, 1);
owner->StrokeRect(itemRect);
itemRect.InsetBy(1, 0);
owner->SetDrawingMode(B_OP_OVER);
BFont font;
owner->GetFont(&font);
float baseLine = itemRect.top + (itemRect.IntegerHeight() / 2 + font.Size() / 2);
for (int32 c = 0; c < sizeof(fLabels) / sizeof(fLabels[0]); c++) {
owner->MovePenTo(itemRect.left + 1 + (fRect.Width() + kDistance) * c, baseLine);
owner->DrawString(fLabels[c]);
}
}
示例10: BView
BudgetWindow::BudgetWindow(const BRect &frame)
: BWindow(frame,TRANSLATE("Budget"), B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fIncomeGrid(13,0),
fSpendingGrid(13,0)
{
fBackView = new BView("background",B_WILL_DRAW);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0.0f)
.SetInsets(0)
.Add(fBackView)
.End();
fBackView->SetViewColor(240,240,240);
fBar = new BMenuBar("menubar");
fBar->AddItem(new BMenuItem(TRANSLATE("Recalculate All"),new BMessage(M_BUDGET_RECALCULATE)));
fBar->AddItem(new BMenuItem(TRANSLATE("Set All to Zero"),new BMessage(M_BUDGET_ZERO)));
BuildBudgetSummary();
BuildStatsAndEditor();
BuildCategoryList();
BFont font;
BLayoutBuilder::Group<>(fCatBox, B_VERTICAL, 0.0f)
.SetInsets(10, font.Size() * 1.3, 10, 10)
.Add(fAmountLabel)
.Add(fAmountBox)
.AddGrid(B_USE_DEFAULT_SPACING, 1.0f)
.Add(fMonthly, 0, 0)
.Add(fWeekly, 1, 0)
.Add(fQuarterly, 0, 1)
.Add(fAnnually, 1, 1)
.End()
.End();
fAmountBox->SetText("");
fAmountBox->GetFilter()->SetMessenger(new BMessenger(this));
if(gDatabase.CountBudgetEntries()==0)
GenerateBudget(false);
RefreshBudgetGrid();
RefreshCategories();
RefreshBudgetSummary();
fCategoryList->MakeFocus(true);
BLayoutBuilder::Group<>(fBackView, B_VERTICAL, 0.0f)
.SetInsets(0)
.Add(fBar)
.AddGroup(B_VERTICAL)
.SetInsets(10, 10, 10, 10)
.AddGroup(B_HORIZONTAL)
.Add(fCategoryList)
.AddGroup(B_VERTICAL)
.Add(fCatBox)
.Add(fCatStat)
.End()
.End()
.Add(fBudgetSummary)
.End()
.End();
}
示例11: BPoint
void
KeyControl::DrawKey(BRect r, const char* c)
{
BFont font;
GetFont(&font);
SetHighColor(240,240,240);
StrokeLine(BPoint(r.left, r.top), BPoint(r.right-1, r.top));
StrokeLine(BPoint(r.left, r.top+1), BPoint(r.left, r.bottom));
SetHighColor(128,128,128);
StrokeLine(BPoint(r.left+1, r.bottom), BPoint(r.right, r.bottom));
StrokeLine(BPoint(r.right, r.bottom-1), BPoint(r.right, r.top));
SetHighColor(192,192,192);
r.InsetBy(1,1);
FillRect(r);
SetHighColor(0,0,0);
SetLowColor(192,192,192);
DrawString(c,
BPoint((r.left+r.right)/2.0f-font.StringWidth(c)/2.0f +1.0f,
r.top+font.Size()));
SetLowColor(255,255,255);
}
示例12: name
void
TermWindow::MenusBeginning()
{
TermView* view = _ActiveTermView();
// Syncronize Encode Menu Pop-up menu and Preference.
const BCharacterSet* charset
= BCharacterSetRoster::GetCharacterSetByConversionID(view->Encoding());
if (charset != NULL) {
BString name(charset->GetPrintName());
const char* mime = charset->GetMIMEName();
if (mime)
name << " (" << mime << ")";
BMenuItem* item = fEncodingMenu->FindItem(name);
if (item != NULL)
item->SetMarked(true);
}
BFont font;
view->GetTermFont(&font);
float size = font.Size();
fDecreaseFontSizeMenuItem->SetEnabled(size > kMinimumFontSize);
fIncreaseFontSizeMenuItem->SetEnabled(size < kMaximumFontSize);
BWindow::MenusBeginning();
}
示例13: 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));
}
示例14:
float
DataView::FontSize() const
{
BFont font;
GetFont(&font);
return font.Size();
}
示例15:
// SetFont
void
Painter::SetFont(const BFont& font)
{
//fFont.SetFamilyAndStyle(font.GetFamily(), font.GetStyle());
fFont.SetSpacing(font.Spacing());
fFont.SetShear(font.Shear());
fFont.SetRotation(font.Rotation());
fFont.SetSize(font.Size());
_UpdateFont();
}