예제 #1
0
void
NotificationView::_CalculateSize()
{
	float height = fHeight;

	if (fNotification->Type() == B_PROGRESS_NOTIFICATION) {
		font_height fh;
		be_plain_font->GetHeight(&fh);
		float fontHeight = fh.ascent + fh.descent + fh.leading;
		height += 9 + (kSmallPadding * 2) + (kEdgePadding * 1)
			+ fontHeight * 2;
	}

	SetExplicitMinSize(BSize(0, height));
	SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height));
}
예제 #2
0
void
UnicodeBlockView::_CreateBlocks()
{
	float minWidth = 0;
	for (uint32 i = 0; i < kNumUnicodeBlocks; i++) {
		BlockListItem* item = new BlockListItem(kUnicodeBlocks[i].name, i);
		fBlocks.AddItem(item);

		float width = StringWidth(item->Text());
		if (minWidth < width)
			minWidth = width;
	}

	SetExplicitMinSize(BSize(minWidth / 2, 32));
	SetExplicitMaxSize(BSize(minWidth, B_SIZE_UNSET));

	_UpdateBlocks();
}
예제 #3
0
Activity::Activity(const char* name)
	:
	BView(name, B_WILL_DRAW | B_FRAME_EVENTS),
	fIsRunning(false),
	fBitmap(NULL)
{
	fPattern.data[0] = 0x0f;
	fPattern.data[1] = 0x1e;
	fPattern.data[2] = 0x3c;
	fPattern.data[3] = 0x78;
	fPattern.data[4] = 0xf0;
	fPattern.data[5] = 0xe1;
	fPattern.data[6] = 0xc3;
	fPattern.data[7] = 0x87;

	SetExplicitMinSize(BSize(17, 17));
	SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 17));
};
예제 #4
0
void
ToolBar::SetFontSize(int const& fontSize)
{
	fFontSize = fontSize;
	
	BFont font;
    GetFont(&font);
    font.SetSize(fFontSize);
    font.SetFlags(Flags() | B_FORCE_ANTIALIASING);
    font.SetFace(B_CONDENSED_FACE /*| B_BOLD_FACE*/);
    SetFont(&font);
    GetFontHeight(&fFontHeight);

    fMargin.Set(5, 3, 5, 0);
    fButtonMargin.Set(5, 0, 5, 2);

    float height = ceilf(fFontHeight.ascent + 2 * fFontHeight.descent +
        fMargin.top + fMargin.bottom + fButtonMargin.top + fButtonMargin.bottom);

    fIconWidth = height - fMargin.top - fMargin.bottom - fButtonMargin.top -
        fButtonMargin.bottom - fFontHeight.descent - 2;

    SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height));
    SetExplicitMinSize(BSize(0, height));

    fGradient.SetStart(0, 0);
    fGradient.SetEnd(0, height);
    fGradient.AddColor(make_color(230, 230, 255, 255), 0);
    fGradient.AddColor(make_color(180, 180, 255, 255), 255);

    fGradientHighlight.SetStart(0, 0);
    fGradientHighlight.SetEnd(0, height);
    fGradientHighlight.AddColor(make_color(210, 210, 255, 255), 0);
    fGradientHighlight.AddColor(make_color(150, 150, 255, 255), 255);

    fGradientPressed.SetStart(0, 0);
    fGradientPressed.SetEnd(0, height);
    fGradientPressed.AddColor(make_color(180, 180, 255, 255), 0);
    fGradientPressed.AddColor(make_color(130, 130, 255, 255), 255);

    Invalidate();
}
예제 #5
0
	DescriptionTextView(const char* name, float minHeight)
		:
		BTextView(name)
	{
		SetExplicitMinSize(BSize(B_SIZE_UNSET, minHeight));
	}