本文整理汇总了C++中BRect::Center方法的典型用法代码示例。如果您正苦于以下问题:C++ BRect::Center方法的具体用法?C++ BRect::Center怎么用?C++ BRect::Center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BRect
的用法示例。
在下文中一共展示了BRect::Center方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Frame
void
BRadioButton::Draw(BRect updateRect)
{
if (Window() == NULL) return;
BFont font;
GetFont(&font);
font_height fontHeight;
font.GetHeight(&fontHeight);
float sHeight = fontHeight.ascent + fontHeight.descent;
BRect rect = Frame().OffsetToSelf(B_ORIGIN);
rect.InsetBy(5, (rect.Height() - sHeight) / 2);
if (rect.IsValid() == false) return;
if ((IsFocus() || IsFocusChanging()) && IsEnabled() && Label() != NULL) {
BPoint penLocation;
penLocation.Set(rect.left + rect.Height() + 5, rect.Center().y + sHeight / 2 + 1);
SetHighColor((IsFocus() && Window()->IsActivate()) ? ui_color(B_NAVIGATION_BASE_COLOR) : ViewColor());
StrokeLine(penLocation, penLocation + BPoint(font.StringWidth(Label()), 0));
}
if (IsFocusChanging()) return;
rgb_color shineColor = ui_color(B_SHINE_COLOR);
rgb_color shadowColor = ui_color(B_SHADOW_COLOR);
if (!IsEnabled()) {
shineColor.disable(ViewColor());
shadowColor.disable(ViewColor());
}
rect.right = rect.left + rect.Height();
SetHighColor(shineColor.mix_copy(0, 0, 0, 5));
FillEllipse(rect);
SetHighColor(shineColor);
StrokeArc(rect, 225, 180);
SetHighColor(shadowColor);
StrokeArc(rect, 45, 180);
if (Value() == B_CONTROL_ON) {
SetHighColor(shadowColor.mix_copy(255, 255, 255, 50));
BRect r = rect.InsetByCopy(3, 3);
FillEllipse(r);
}
if (Label() != NULL) {
BPoint penLocation;
penLocation.x = rect.right + 5;
penLocation.y = rect.Center().y - sHeight / 2.f;
penLocation.y += fontHeight.ascent + 1;
SetHighColor(IsEnabled() ? ui_color(B_PANEL_TEXT_COLOR) : ui_color(B_SHINE_COLOR).disable(ViewColor()));
SetLowColor(ViewColor());
DrawString(Label(), penLocation);
if (!IsEnabled()) {
SetHighColor(ui_color(B_SHADOW_COLOR).disable(ViewColor()));
DrawString(Label(), penLocation - BPoint(1, 1));
}
}
}