本文整理汇总了C++中BStringView::GetFontHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ BStringView::GetFontHeight方法的具体用法?C++ BStringView::GetFontHeight怎么用?C++ BStringView::GetFontHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BStringView
的用法示例。
在下文中一共展示了BStringView::GetFontHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttachedToWindow
void VisualColorControl::AttachedToWindow()
{
BPoint *points = new BPoint[3];
points[0] = BPoint(0,0);
points[1] = BPoint(-4,-4);
points[2] = BPoint(4,-4);
// calculate the initial ramps
CalcRamps();
// create the arrow-pictures
BeginPicture(new BPicture());
SetHighColor(100,100,255);
FillPolygon(points,3);
SetHighColor(0,0,0);
StrokePolygon(points,3);
down_arrow = EndPicture();
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
BStringView *sv = new BStringView(BRect(0,COLOR_HEIGHT/2,1,COLOR_HEIGHT/2),"label view",label1);
AddChild(sv);
float sv_width = sv->StringWidth(label1);
sv_width = max_c(sv_width,sv->StringWidth(label2));
sv_width = max_c(sv_width,sv->StringWidth(label3));
font_height fHeight;
sv->GetFontHeight(&fHeight);
sv->ResizeTo(sv_width,fHeight.ascent+fHeight.descent);
sv->MoveBy(0,-(fHeight.ascent+fHeight.descent)/2.0);
BRect sv_frame = sv->Frame();
sv_frame.OffsetBy(0,COLOR_HEIGHT);
sv->SetAlignment(B_ALIGN_CENTER);
sv = new BStringView(sv_frame,"label view",label2);
AddChild(sv);
sv->SetAlignment(B_ALIGN_CENTER);
sv_frame.OffsetBy(0,COLOR_HEIGHT);
sv = new BStringView(sv_frame,"label view",label3);
AddChild(sv);
sv->SetAlignment(B_ALIGN_CENTER);
sv_frame.OffsetBy(0,COLOR_HEIGHT);
sv = new BStringView(sv_frame,"label view",label4);
AddChild(sv);
sv->SetAlignment(B_ALIGN_CENTER);
ramp_left_edge = sv->Bounds().IntegerWidth()+2;
ResizeBy(ramp_left_edge,0);
delete[] points;
}
示例2: bad_alloc
ResultWindow::ResultWindow()
:
BWindow(BRect(0, 0, 400, 300), "Package changes", B_TITLED_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS,
B_ALL_WORKSPACES),
fDoneSemaphore(-1),
fClientWaiting(false),
fAccepted(false),
fContainerView(NULL),
fCancelButton(NULL),
fApplyButton(NULL)
{
fDoneSemaphore = create_sem(0, "package changes");
if (fDoneSemaphore < 0)
throw std::bad_alloc();
BStringView* topTextView = NULL;
BViewPort* viewPort = NULL;
BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
.SetInsets(B_USE_SMALL_INSETS)
.Add(topTextView = new BStringView(NULL,
"The following additional package changes have to be made:"))
.Add(new BScrollView(NULL, viewPort = new BViewPort(), 0, false, true))
.AddGroup(B_HORIZONTAL)
.Add(fCancelButton = new BButton("Cancel", new BMessage(B_CANCEL)))
.AddGlue()
.Add(fApplyButton = new BButton("Apply changes",
new BMessage(kApplyMessage)))
.End();
topTextView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
viewPort->SetChildView(fContainerView = new BGroupView(B_VERTICAL, 0));
// set small scroll step (large step will be set by the view port)
font_height fontHeight;
topTextView->GetFontHeight(&fontHeight);
float smallStep = ceilf(fontHeight.ascent + fontHeight.descent);
viewPort->ScrollBar(B_VERTICAL)->SetSteps(smallStep, smallStep);
}