本文整理汇总了C++中BFont::SetRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ BFont::SetRotation方法的具体用法?C++ BFont::SetRotation怎么用?C++ BFont::SetRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BFont
的用法示例。
在下文中一共展示了BFont::SetRotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
status_t
CanvasMessage::ReadFontState(BFont& font)
{
uint8 encoding, spacing;
uint16 face;
uint32 flags, familyAndStyle;
font_direction direction;
float falseBoldWidth, rotation, shear, size;
Read(direction);
Read(encoding);
Read(flags);
Read(spacing);
Read(shear);
Read(rotation);
Read(falseBoldWidth);
Read(size);
Read(face);
status_t result = Read(familyAndStyle);
if (result != B_OK)
return result;
font.SetFamilyAndStyle(familyAndStyle);
font.SetEncoding(encoding);
font.SetFlags(flags);
font.SetSpacing(spacing);
font.SetShear(shear);
font.SetRotation(rotation);
font.SetFalseBoldWidth(falseBoldWidth);
font.SetSize(size);
font.SetFace(face);
return B_OK;
}
示例2: 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));
}
示例3: Draw
virtual void Draw(BRect updateRect)
{
if (fMouseOver) {
float tint = (B_NO_TINT + B_LIGHTEN_1_TINT) / 2.0;
SetHighColor(tint_color(HighColor(), tint));
SetLowColor(tint_color(LowColor(), tint));
}
BRect b(Bounds());
if (fSelected) {
SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
StrokeRect(b, B_SOLID_HIGH);
b.InsetBy(1, 1);
StrokeRect(b, B_SOLID_HIGH);
b.InsetBy(1, 1);
} else if (fLevel > 0) {
StrokeRect(b, B_SOLID_HIGH);
b.InsetBy(1, 1);
}
FillRect(b, B_SOLID_LOW);
// prevent the text from moving when border width changes
if (!fSelected)
b.InsetBy(1, 1);
float width;
BFont font;
GetFont(&font);
font_height fh;
font.GetHeight(&fh);
// draw the partition label, but only if we have no child partition
// views
BPoint textOffset;
if (CountChildren() > 0) {
font.SetRotation(0.0);
SetFont(&font);
width = b.Width();
textOffset = b.LeftTop();
textOffset.x += 3;
textOffset.y += ceilf(fh.ascent);
} else {
width = b.Height();
textOffset = b.LeftBottom();
textOffset.x += ceilf(fh.ascent);
}
BString name(Name());
font.TruncateString(&name, B_TRUNCATE_END, width);
SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT));
DrawString(name.String(), textOffset);
}
示例4:
// GetBFont
BFont
Font::GetBFont() const
{
BFont font;
font.SetFamilyAndStyle(fFamily.String(), fStyle.String());
font.SetSize(fSize);
font.SetRotation(fRotation);
font.SetShear(fShear);
font.SetSpacing(fSpacing);
return font;
}
示例5: testFontRotation
static void testFontRotation(BView* view, BRect frame)
{
BFont font;
view->GetFont(&font);
font.SetRotation(90);
view->SetFont(&font, B_FONT_ROTATION);
view->DrawString("This is a test!", BPoint(frame.Width() / 2, frame.bottom - 3));
view->GetFont(&font);
if (font.Rotation() != 90.0)
fprintf(stderr, "Error: Rotation is %f but should be 90.0\n", font.Rotation());
}