本文整理汇总了C++中BFont::Spacing方法的典型用法代码示例。如果您正苦于以下问题:C++ BFont::Spacing方法的具体用法?C++ BFont::Spacing怎么用?C++ BFont::Spacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFont
的用法示例。
在下文中一共展示了BFont::Spacing方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// 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();
}
示例2: fFamily
// constructor
Font::Font(const BFont& font)
: fFamily("")
, fStyle("")
, fSize(font.Size())
, fRotation(font.Rotation())
, fShear(font.Shear())
, fFalseBoldWidth(0.0)
, fHinting(true)
, fKerning(true)
, fSpacing(font.Spacing())
, fCachedFontHeightValid(true)
{
font_family family;
font_style style;
font.GetFamilyAndStyle(&family, &style);
fFamily = family;
fStyle = style;
font.GetHeight(&fCachedFontHeight);
}
示例3: PenLocation
void
BStatusBar::Draw(BRect updateRect)
{
rgb_color shineColor = ui_color(B_SHINE_COLOR);
rgb_color shadowColor = ui_color(B_SHADOW_COLOR);
rgb_color barColor = ui_color(B_STATUSBAR_COLOR);
BFont font;
font_height fontHeight;
GetFont(&font);
font.GetHeight(&fontHeight);
float sHeight = fontHeight.ascent + fontHeight.descent;
if (!IsEnabled()) {
shineColor.disable(ViewColor());
shadowColor.disable(ViewColor());
barColor.disable(ViewColor());
}
BPoint penLocation;
MovePenTo(B_ORIGIN);
MovePenBy(0, fontHeight.ascent + 1);
if (fLabel != NULL) {
if (!IsEnabled()) MovePenBy(1, 1);
penLocation = PenLocation();
SetHighColor(IsEnabled() ? ui_color(B_PANEL_TEXT_COLOR) : ui_color(B_SHINE_COLOR).disable(ViewColor()));
SetLowColor(ViewColor());
DrawString(fLabel);
if (!IsEnabled()) {
SetHighColor(ui_color(B_SHADOW_COLOR).disable(ViewColor()));
DrawString(fLabel, penLocation - BPoint(1, 1));
}
MovePenBy(font.Spacing() * font.Size(), 0);
}
if (fText != NULL) {
if (!IsEnabled()) MovePenBy(1, 1);
penLocation = PenLocation();
SetHighColor(IsEnabled() ? ui_color(B_PANEL_TEXT_COLOR) : ui_color(B_SHINE_COLOR).disable(ViewColor()));
SetLowColor(ViewColor());
DrawString(fText);
if (!IsEnabled()) {
SetHighColor(ui_color(B_SHADOW_COLOR).disable(ViewColor()));
DrawString(fText, penLocation - BPoint(1, 1));
}
}
MovePenTo(Frame().Width(), 0);
MovePenBy(0, fontHeight.ascent + 1);
if (fTrailingLabel != NULL) {
MovePenBy(-(font.StringWidth(fTrailingLabel) + 1), 0);
if (!IsEnabled()) MovePenBy(1, 1);
penLocation = PenLocation();
SetHighColor(IsEnabled() ? ui_color(B_PANEL_TEXT_COLOR) : ui_color(B_SHINE_COLOR).disable(ViewColor()));
SetLowColor(ViewColor());
DrawString(fTrailingLabel);
if (!IsEnabled()) {
SetHighColor(ui_color(B_SHADOW_COLOR).disable(ViewColor()));
penLocation -= BPoint(1, 1);
DrawString(fTrailingLabel, penLocation);
}
MovePenTo(penLocation + BPoint(-(font.Spacing() * font.Size()), 0));
}
if (fTrailingText != NULL) {
MovePenBy(-(font.StringWidth(fTrailingText) + 1), 0);
if (!IsEnabled()) MovePenBy(1, 1);
penLocation = PenLocation();
SetHighColor(IsEnabled() ? ui_color(B_PANEL_TEXT_COLOR) : ui_color(B_SHINE_COLOR).disable(ViewColor()));
SetLowColor(ViewColor());
DrawString(fTrailingText);
if (!IsEnabled()) {
SetHighColor(ui_color(B_SHADOW_COLOR).disable(ViewColor()));
DrawString(fTrailingText, penLocation - BPoint(1, 1));
}
}
BRect rect = Frame().OffsetToSelf(B_ORIGIN);
if (fLabel != NULL || fTrailingLabel != NULL || fText != NULL || fTrailingText != NULL) rect.top += sHeight + 5;
if (rect.IsValid() == false) return;
rect.bottom = rect.top + fBarHeight;
SetHighColor(shineColor.mix_copy(0, 0, 0, 5));
FillRect(rect);
SetHighColor(shineColor);
StrokeRect(rect);
//.........这里部分代码省略.........