Пример #1
0
	virtual void Draw(BRect updateRect)
	{
		BRect r = Bounds();
		if (fAnticipateDrop) {
			SetHighColor(0, 150, 50);
			StrokeRect(r);
			r.InsetBy(1, 1);
			StrokeRect(r);
			r.InsetBy(1, 1);
		} else {
			rgb_color lighten2 = tint_color(LowColor(), B_LIGHTEN_2_TINT);
			rgb_color darken1 = tint_color(LowColor(), B_DARKEN_1_TINT);
			BeginLineArray(4);
				AddLine(BPoint(r.left, r.bottom),
					BPoint(r.left, r.top), lighten2);
				AddLine(BPoint(r.left + 1, r.top),
					BPoint(r.right, r.top), lighten2);
				AddLine(BPoint(r.right, r.top + 1),
					BPoint(r.right, r.bottom), darken1);
				AddLine(BPoint(r.right - 1, r.bottom),
					BPoint(r.left + 1, r.bottom), darken1);
			EndLineArray();
			r.InsetBy(1, 1);
		}
		FillRect(r, B_SOLID_LOW);
	}
Пример #2
0
// Draw
void
PropertyItemView::Draw(BRect updateRect)
{
	const Property* property = GetProperty();
	if (property && fParent) {
		BRect b(Bounds());

		// just draw background and label
		rgb_color labelColor = LowColor();
		if (fEnabled)
			labelColor = tint_color(labelColor, B_DARKEN_MAX_TINT);
		else
			labelColor = tint_color(labelColor, B_DISABLED_LABEL_TINT);
		
		SetHighColor(labelColor);
		BFont font;
		GetFont(&font);
		
		BString truncated(name_for_id(property->Identifier()));
		font.TruncateString(&truncated, B_TRUNCATE_MIDDLE, fLabelWidth - 10.0);

		font_height fh;
		font.GetHeight(&fh);

		FillRect(BRect(b.left, b.top, b.left + fLabelWidth, b.bottom), B_SOLID_LOW);
		DrawString(truncated.String(), BPoint(b.left + 5.0,
											  floorf(b.top + b.Height() / 2.0
												  		   + fh.ascent / 2.0)));

		// draw a "separator" line behind the label
		SetHighColor(tint_color(LowColor(), B_DARKEN_1_TINT));
		StrokeLine(BPoint(b.left + fLabelWidth - 1.0, b.top),
				   BPoint(b.left + fLabelWidth - 1.0, b.bottom), B_SOLID_HIGH);
	}
}
Пример #3
0
void
BComboBox::AttachedToWindow()
{
	Window()->AddFilter(fWinMovedFilter);
	if (Parent()) {
		SetViewColor(Parent()->ViewColor());
		SetLowColor(ViewColor());
	}

	bool enabled = IsEnabled();
	rgb_color mc = HighColor();
	rgb_color base;
	BFont textFont;

	// mc used to be base in this line
	if (mc.red == 255 && mc.green == 255 && mc.blue == 255)
		base = ViewColor();
	else
		base = LowColor();

	fText->GetFontAndColor(0, &textFont);
	mc = enabled ? mc : disable_color(base);

	fText->SetFontAndColor(&textFont, B_FONT_ALL, &mc);

	if (!enabled)
		base = tint_color(base, B_DISABLED_MARK_TINT);
	else
		base.red = base.green = base.blue = 255;

	fText->SetLowColor(base);
	fText->SetViewColor(base);

	fText->MakeEditable(enabled);
}
Пример #4
0
void
RatingView::Draw(BRect updateRect)
{
	FillRect(updateRect, B_SOLID_LOW);
	const BBitmap* star = StarBitmap();

	if (star == NULL) {
		fprintf(stderr, "No star icon found in application resources.\n");
		return;
	}

	SetDrawingMode(B_OP_OVER);

	float x = 0;
	for (int i = 0; i < 5; i++) {
		DrawBitmap(star, BPoint(x, 0));
		x += 16 + 2;
	}

	if (fRating >= RATING_MIN && fRating < 5.0f) {
		SetDrawingMode(B_OP_OVER);

		BRect rect(Bounds());
		rect.right = x - 2;
		rect.left = ceilf(rect.left + (fRating / 5.0f) * rect.Width());

		rgb_color color = LowColor();
		color.alpha = 190;
		SetHighColor(color);

		SetDrawingMode(B_OP_ALPHA);
		FillRect(rect, B_SOLID_HIGH);
	}
}
Пример #5
0
// Draw
void
ColorField::Draw(BRect updateRect)
{
	if (fBitmapDirty && fBitmap != NULL) {
		_FillBitmap(fBitmap, fMode, fFixedValue, fOrientation);
		fBitmapDirty = false;
	}

	BRect bounds = Bounds();

	// Frame
	if (fBorderStyle == B_FANCY_BORDER) {
		rgb_color color = LowColor();
		be_control_look->DrawTextControlBorder(this, bounds, updateRect,
			color);
		BRegion region(bounds);
		ConstrainClippingRegion(&region);
	}

	// Color field fill
	if (fBitmap != NULL)
		DrawBitmap(fBitmap, bounds.LeftTop());
	else {
		SetHighColor(255, 0, 0);
		FillRect(bounds);
	}

	// Marker
	SetHighColor(0, 0, 0);
	StrokeEllipse(fMarkerPosition + bounds.LeftTop(), 5.0, 5.0);
	SetHighColor(255.0, 255.0, 255.0);
	StrokeEllipse(fMarkerPosition + bounds.LeftTop(), 4.0, 4.0);
}
Пример #6
0
void
BButton::Draw(BRect updateRect)
{
	BRect rect(Bounds());
	rgb_color background = LowColor();
	rgb_color base = background;
	uint32 flags = be_control_look->Flags(this);
	if (_Flag(FLAG_DEFAULT))
		flags |= BControlLook::B_DEFAULT_BUTTON;
	if (_Flag(FLAG_FLAT) && !IsTracking())
		flags |= BControlLook::B_FLAT;
	if (_Flag(FLAG_INSIDE))
		flags |= BControlLook::B_HOVER;

	be_control_look->DrawButtonFrame(this, rect, updateRect,
		base, background, flags);

	if (fBehavior == B_POP_UP_BEHAVIOR) {
		be_control_look->DrawButtonWithPopUpBackground(this, rect, updateRect,
			base, flags);
	} else {
		be_control_look->DrawButtonBackground(this, rect, updateRect,
			base, flags);
	}

	// always leave some room around the label
	rect.InsetBy(kLabelMargin, kLabelMargin);

	const BBitmap* icon = IconBitmap(
		(Value() == B_CONTROL_OFF
				? B_INACTIVE_ICON_BITMAP : B_ACTIVE_ICON_BITMAP)
			| (IsEnabled() ? 0 : B_DISABLED_ICON_BITMAP));
	be_control_look->DrawLabel(this, Label(), icon, rect, updateRect,
		base, flags, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
}
Пример #7
0
void
DownloadProgressView::AllAttached()
{
	SetViewColor(B_TRANSPARENT_COLOR);
	SetLowColor(245, 245, 245);
	SetHighColor(tint_color(LowColor(), B_DARKEN_1_TINT));
}
Пример #8
0
	virtual void Draw(BRect updateRect)
	{
		BRect bounds(Bounds());
		rgb_color base = LowColor();
		be_control_look->DrawInactiveTab(this, bounds, updateRect,
			base, 0, BControlLook::B_TOP_BORDER);
	}
Пример #9
0
void
AppGroupView::Draw(BRect updateRect)
{
	rgb_color menuColor = ViewColor();
	BRect bounds = Bounds();
	rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
	rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);
	bounds.bottom = bounds.top + kHeaderSize;

	// Draw the header background
	SetHighColor(tint_color(menuColor, 1.22));
	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	StrokeLine(bounds.LeftTop(), bounds.LeftBottom());
	uint32 borders = BControlLook::B_TOP_BORDER
		| BControlLook::B_BOTTOM_BORDER | BControlLook::B_RIGHT_BORDER;

	be_control_look->DrawButtonBackground(this, bounds, bounds, menuColor,
		0, borders);

	// Draw the buttons
	fCollapseRect.top = (kHeaderSize - kExpandSize) / 2;
	fCollapseRect.left = kEdgePadding * 2;
	fCollapseRect.right = fCollapseRect.left + 1.5 * kExpandSize;
	fCollapseRect.bottom = fCollapseRect.top + kExpandSize;

	fCloseRect = bounds;
	fCloseRect.top = (kHeaderSize - kExpandSize) / 2;
	fCloseRect.right -= kEdgePadding * 2;
	fCloseRect.left = fCloseRect.right - kCloseSize;
	fCloseRect.bottom = fCloseRect.top + kCloseSize;

	uint32 arrowDirection = fCollapsed
		? BControlLook::B_DOWN_ARROW : BControlLook::B_UP_ARROW;
	be_control_look->DrawArrowShape(this, fCollapseRect, fCollapseRect,
		LowColor(), arrowDirection, 0, B_DARKEN_3_TINT);

	SetPenSize(kPenSize);

	// Draw the dismiss widget
	BRect closeCross = fCloseRect;
	closeCross.InsetBy(kSmallPadding, kSmallPadding);
	rgb_color detailCol = ui_color(B_CONTROL_BORDER_COLOR);
	detailCol = tint_color(detailCol, B_LIGHTEN_2_TINT);

	StrokeRoundRect(fCloseRect, kSmallPadding, kSmallPadding);
	StrokeLine(closeCross.LeftTop(), closeCross.RightBottom());
	StrokeLine(closeCross.RightTop(), closeCross.LeftBottom());

	// Draw the label
	SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
	BString label = fLabel;
	if (fCollapsed)
		label << " (" << fInfo.size() << ")";

	SetFont(be_bold_font);

	DrawString(label.String(), BPoint(fCollapseRect.right + 2 * kEdgePadding,
				fCloseRect.bottom));
}
Пример #10
0
void
AppGroupView::Draw(BRect updateRect)
{
	rgb_color menuColor = ViewColor();
	BRect bounds = Bounds();
	rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
	rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);
	bounds.bottom = bounds.top + kHeaderSize;

	// Draw the header background
	SetHighColor(tint_color(menuColor, 1.22));
	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	StrokeLine(bounds.LeftTop(), bounds.LeftBottom());
	uint32 borders = BControlLook::B_TOP_BORDER
		| BControlLook::B_BOTTOM_BORDER | BControlLook::B_RIGHT_BORDER;

	be_control_look->DrawButtonBackground(this, bounds, bounds, menuColor,
		0, borders);

	// Draw the buttons
	fCollapseRect.top = (kHeaderSize - kExpandSize) / 2;
	fCollapseRect.left = kEdgePadding * 3;
	fCollapseRect.right = fCollapseRect.left + 1.5 * kExpandSize;
	fCollapseRect.bottom = fCollapseRect.top + kExpandSize;

	fCloseRect = bounds;
	fCloseRect.top = (kHeaderSize - kCloseSize) / 2;
	// Take off the 1 to line this up with the close button on the
	// notification view
	fCloseRect.right -= kEdgePadding * 3 - 1;
	fCloseRect.left = fCloseRect.right - kCloseSize;
	fCloseRect.bottom = fCloseRect.top + kCloseSize;

	uint32 arrowDirection = fCollapsed
		? BControlLook::B_DOWN_ARROW : BControlLook::B_UP_ARROW;
	be_control_look->DrawArrowShape(this, fCollapseRect, fCollapseRect,
		LowColor(), arrowDirection, 0, B_DARKEN_3_TINT);

	SetPenSize(kPenSize);

	// Draw the dismiss widget
	_DrawCloseButton(updateRect);

	// Draw the label
	SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
	BString label = fLabel;
	if (fCollapsed)
		label << " (" << fInfo.size() << ")";

	SetFont(be_bold_font);
	font_height fontHeight;
	GetFontHeight(&fontHeight);
	float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent)
		- ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent);

	DrawString(label.String(),
		BPoint(fCollapseRect.right + 4 * kEdgePadding, y));
}
Пример #11
0
// Draw
void
IconOptionsControl::Draw(BRect updateRect)
{
	FillRect(updateRect, B_SOLID_LOW);

	if (Label()) {
		if (!IsEnabled())
			SetHighColor(tint_color(LowColor(), B_DISABLED_LABEL_TINT));
		else
			SetHighColor(tint_color(LowColor(), B_DARKEN_MAX_TINT));

		font_height fh;
		GetFontHeight(&fh);
		BPoint p(Bounds().LeftTop());
		p.y += floorf(Bounds().Height() / 2.0 + (fh.ascent + fh.descent) / 2.0) - 2.0;
		DrawString(Label(), p);
	}
}
Пример #12
0
void StatusView::Draw(BRect update)
{
	SetDrawingMode(B_OP_COPY);
	SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
	StrokeLine(BPoint(update.left, Bounds().top), BPoint(update.right, Bounds().top));
#ifdef __HAIKU__
	BRect rect(Bounds());
	rect.top++;
	be_control_look->DrawMenuBarBackground(this, rect, update, LowColor());
#else
	SetHighColor(255, 255, 255, 255);
	StrokeLine(BPoint(update.left, Bounds().top + 1), BPoint(update.right, Bounds().top + 1));
#endif

	float width(5.0);
	font_height fh;

	GetFontHeight(&fh);

	SetDrawingMode(B_OP_OVER);
	SetHighColor(tint_color(LowColor(), 1.7));

	for (int32 i = 0; i < items.CountItems(); ++i) {
		if (i) {
			DrawSplit(width += 3);
			width += 5;
		}

		StatusItem* item(ItemAt(i));

		if (item->label.Length()) {
			DrawString(item->label.String(), BPoint(width, fh.ascent + fh.leading + 2));
		}

		if (item->alignment == STATUS_ALIGN_RIGHT)
			width = item->frame.right - StringWidth(item->value.String());
		else
			width = item->frame.left;

		DrawString(item->value.String(), BPoint(width, fh.ascent + fh.leading + 2));
		width = item->frame.right;
	}
}
Пример #13
0
void
URLInputGroup::Draw(BRect updateRect)
{
	BRect bounds(Bounds());
	rgb_color base(LowColor());
	uint32 flags = 0;
	if (fWindowActive && fTextView->IsFocus())
		flags |= BControlLook::B_FOCUSED;
	be_control_look->DrawTextControlBorder(this, bounds, updateRect, base,
		flags);
}
Пример #14
0
// _UpdateLowColor
void
PropertyItemView::_UpdateLowColor()
{
	rgb_color lowColor = fParent ? fParent->LowColor() : kWhite;
	if (fSelected)
		lowColor = tint_color(lowColor, B_DARKEN_2_TINT);

	if (lowColor != LowColor()) {
		SetLowColor(lowColor);
		Invalidate();
	}
}
Пример #15
0
	virtual	void Draw(BRect updateRect)
	{
		static rgb_color shine = { 255, 255, 255, 255 };
		static rgb_color shadow = { 0, 0, 0, 255 };
		static rgb_color text = { 0, 0, 0, 255 };
		
		BRect b(Bounds());
		
		SetHighColor(mix_color(LowColor(), shine, .5));
		StrokeLine(BPoint(0, b.bottom), BPoint(0, 0));
		StrokeLine(BPoint(0, 0), BPoint(b.right, 0));
		SetHighColor(mix_color(LowColor(), shadow, .5));
		StrokeLine(BPoint(b.right, 0), BPoint(b.right, b.bottom));
		StrokeLine(BPoint(b.right, b.bottom), BPoint(1, b.bottom));
		
		FillRect(BRect(1, 1, b.right-1, b.bottom-1), B_SOLID_LOW);
		
		font_height fh;
		GetFontHeight(&fh);
		SetHighColor(text);
		DrawString(fTip.String(), BPoint(1, fh.ascent));
	}
Пример #16
0
void
ShowImageStatusView::Draw(BRect updateRect)
{
	rgb_color darkShadow = tint_color(LowColor(), B_DARKEN_2_TINT);
	rgb_color shadow = tint_color(LowColor(), B_DARKEN_1_TINT);
	rgb_color light = tint_color(LowColor(), B_LIGHTEN_MAX_TINT);

	BRect b(Bounds());

	BeginLineArray(5);
		AddLine(BPoint(b.left, b.top),
				BPoint(b.right, b.top), darkShadow);
		b.top += 1.0;
		AddLine(BPoint(b.left, b.top),
				BPoint(b.right, b.top), light);
		AddLine(BPoint(b.right, b.top + 1.0),
				BPoint(b.right, b.bottom), shadow);
		AddLine(BPoint(b.right - 1.0, b.bottom),
				BPoint(b.left + 1.0, b.bottom), shadow);
		AddLine(BPoint(b.left, b.bottom),
				BPoint(b.left, b.top + 1.0), light);
	EndLineArray();

	b.InsetBy(1.0, 1.0);

	// Truncate and layout text
	BString truncated(fText);
	BFont font;
	GetFont(&font);
	font.TruncateString(&truncated, B_TRUNCATE_MIDDLE, b.Width() - 4.0);
	font_height fh;
	font.GetHeight(&fh);

	FillRect(b, B_SOLID_LOW);
	SetDrawingMode(B_OP_OVER);
	DrawString(truncated.String(), BPoint(b.left + 2.0,
		floorf(b.top + b.Height() / 2.0 + fh.ascent / 2.0)));
}
Пример #17
0
// Draw
void
FontValueView::Draw(BRect updateRect)
{
	BRect b(Bounds());
	// focus indication
	if (IsFocus()) {
		SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
		StrokeRect(b);
		b.InsetBy(1.0, 1.0);
		BRegion clipping;
		clipping.Include(b);
		ConstrainClippingRegion(&clipping);
		b.left --;
	}
	// background
	FillRect(b, B_SOLID_LOW);

	rgb_color labelColor = LowColor();
	if (fEnabled)
		labelColor = tint_color(labelColor, B_DARKEN_MAX_TINT);
	else
		labelColor = tint_color(labelColor, B_DISABLED_LABEL_TINT);

	SetHighColor(labelColor);

	b.InsetBy(2.0, 1.0);

	float center = floorf(b.top + b.Height() / 2.0);

	BPoint arrow[3];
	arrow[0] = BPoint(b.left, center - 3.0);
	arrow[1] = BPoint(b.left, center + 3.0);
	arrow[2] = BPoint(b.left + 3.0, center);

	FillPolygon(arrow, 3);

	b.left += 6.0;

	BFont font;
	GetFont(&font);

	font_height fh;
	font.GetHeight(&fh);

	BString truncated(fCurrentFont);
	font.TruncateString(&truncated, B_TRUNCATE_END, b.Width());

	DrawString(truncated.String(),
			   BPoint(b.left, floorf(center + fh.ascent / 2.0)));
}
Пример #18
0
    ItemCountView()
        :
        BView("item count view", B_WILL_DRAW),
        fItemCount(0)
    {
        BFont font(be_plain_font);
        font.SetSize(9.0f);
        SetFont(&font);

        SetViewColor(B_TRANSPARENT_COLOR);
        SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));

        SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT));
    }
Пример #19
0
void
BMenuField::Draw(BRect update)
{
	BRect bounds(Bounds());
	bool active = IsFocus() && Window()->IsActive();

	DrawLabel(bounds, update);

	BRect frame(fMenuBar->Frame());

	if (be_control_look != NULL) {
		frame.InsetBy(-kVMargin, -kVMargin);
		rgb_color base = fMenuBar->LowColor();
		rgb_color background = LowColor();
		uint32 flags = 0;
		if (!fMenuBar->IsEnabled())
			flags |= BControlLook::B_DISABLED;
		if (active)
			flags |= BControlLook::B_FOCUSED;
		be_control_look->DrawMenuFieldFrame(this, frame, update, base,
			background, flags);
		return;
	}

	if (frame.InsetByCopy(-kVMargin, -kVMargin).Intersects(update)) {
		SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
		StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
			BPoint(frame.left - 1.0f, frame.bottom - 1.0f));
		StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
			BPoint(frame.right - 1.0f, frame.top - 1.0f));

		StrokeLine(BPoint(frame.left + 1.0f, frame.bottom + 1.0f),
			BPoint(frame.right + 1.0f, frame.bottom + 1.0f));
		StrokeLine(BPoint(frame.right + 1.0f, frame.top + 1.0f));

		SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_4_TINT));
		StrokeLine(BPoint(frame.left - 1.0f, frame.bottom),
			BPoint(frame.left - 1.0f, frame.bottom));
		StrokeLine(BPoint(frame.right, frame.top - 1.0f),
			BPoint(frame.right, frame.top - 1.0f));
	}

	if (active || fTransition) {
		SetHighColor(active ? ui_color(B_KEYBOARD_NAVIGATION_COLOR) :
			ViewColor());
		StrokeRect(frame.InsetByCopy(-kVMargin, -kVMargin));

		fTransition = false;
	}
}
Пример #20
0
void Stringview1::Clear() {
	
	rgb_color lc=LowColor();
	rgb_color hc=HighColor();
	
	SetHighColor(190,190,190,255);
	FillRect(Bounds(),B_SOLID_HIGH);
	hasIcon=false;
	text->SetTo("");
	typetext->SetTo("");

	SetLowColor(lc);
	SetHighColor(hc);

}
Пример #21
0
void
BSlider::Draw(BRect updateRect)
{
	// clear out background
	BRegion background(updateRect);
	background.Exclude(BarFrame());
	bool drawBackground = true;
	if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
		// This view is embedded somewhere, most likely the Tracker Desktop
		// shelf.
		drawBackground = false;
	}

	// ToDo: the triangle thumb doesn't delete its background, so we still have
	// to do it Note, this also creates a different behaviour for subclasses,
	// depending on the thumb style - if possible this should be avoided.
	if (Style() == B_BLOCK_THUMB) {
		BRect thumbFrame = ThumbFrame();
		if (be_control_look != NULL) {
			// fill background where shadow will be...
			// TODO: Such drawint dependent behavior should be moved into
			// BControlLook of course.
			thumbFrame.right--;
			thumbFrame.bottom--;
		}
		background.Exclude(thumbFrame);
	}

#if USE_OFF_SCREEN_VIEW
	if (!fOffScreenBits)
		return;

	if (fOffScreenBits->Lock()) {
		fOffScreenView->SetViewColor(ViewColor());
		fOffScreenView->SetLowColor(LowColor());
#endif

		if (drawBackground && background.Frame().IsValid())
			OffscreenView()->FillRegion(&background, B_SOLID_LOW);

#if USE_OFF_SCREEN_VIEW
		fOffScreenView->Sync();
		fOffScreenBits->Unlock();
	}
#endif

	DrawSlider();
}
Пример #22
0
void
BitmapButton::DrawBackground(BRect& bounds, BRect updateRect)
{
	if (Message() != NULL && (fMouseInside || fMouseDown)) {
		rgb_color color = LowColor();
		uint32 flags = 0;
		if (fMouseDown)
			flags |= BControlLook::B_ACTIVATED;

		be_control_look->DrawButtonFrame(this, bounds, updateRect,
			color, color, flags);
		be_control_look->DrawButtonBackground(this, bounds, updateRect,
			color, flags);
	} else {
		BitmapView::DrawBackground(bounds, updateRect);
	}
}
Пример #23
0
void
ViewBuffer::Clear(uint8 attr)
{
	if (LockLooper()) {
		SetLowColor(GetPaletteEntry(BackgroundColor(attr)));
		SetViewColor(LowColor());
		FillRect(Frame(), B_SOLID_LOW);
		Sync();
		UnlockLooper();
	}
	
	fCursorX = -1;
	fCursorY = -1;

	if (fGlyphGrid)
		memset(fGlyphGrid, 0, fRows * fColumns * sizeof(uint16));
}
Пример #24
0
void
Stringview1::SetText(const char *utext) {

	rgb_color lc=LowColor();
	rgb_color hc=HighColor();
	
	SetHighColor(190,190,190,255);
	FillRect(BRect(0,0,StringWidth(text->String())+8,Bounds().Height()),B_SOLID_HIGH);
	SetHighColor(0,0,0,255);
	SetLowColor(255,255,255,255);
	text->SetTo(utext);
	DrawString(text->String(), BPoint(3,12));
	
	SetLowColor(lc);
	SetHighColor(hc);

}
void
ActivityView::_Init(const BMessage* settings)
{
	fHistoryBackgroundColor = (rgb_color){255, 255, 240};
	fLegendBackgroundColor = LowColor();
		// the low color is restored by the BView unarchiving
	fOffscreen = NULL;
#ifdef __HAIKU__
	fHistoryLayoutItem = NULL;
	fLegendLayoutItem = NULL;
#endif
	SetViewColor(B_TRANSPARENT_COLOR);

	fLastRefresh = 0;
	fDrawResolution = 1;
	fZooming = false;

	fSystemInfoHandler = new SystemInfoHandler;

	if (settings == NULL
		|| settings->FindInt64("refresh interval", &fRefreshInterval) != B_OK)
		fRefreshInterval = kInitialRefreshInterval;

	if (settings == NULL
		|| settings->FindBool("show legend", &fShowLegend) != B_OK)
		fShowLegend = true;

	if (settings == NULL)
		return;

	ssize_t colorLength;
	rgb_color *color;
	if (settings->FindData("history background color", B_RGB_COLOR_TYPE,
			(const void **)&color, &colorLength) == B_OK
		&& colorLength == sizeof(rgb_color))
		fHistoryBackgroundColor = *color;

	const char* name;
	for (int32 i = 0; settings->FindString("source", i, &name) == B_OK; i++)
		AddDataSource(DataSource::FindSource(name), settings);

	fAboutWindow = NULL;
}
Пример #26
0
void
BAbstractSpinner::_DrawLabel(BRect updateRect)
{
	BRect rect(Bounds());
	rect.right = fDivider;
	if (!rect.IsValid() || !rect.Intersects(updateRect))
		return;

	_ValidateLayoutData();

	const char* label = Label();
	if (label == NULL)
		return;

	// horizontal position
	float x;
	switch (fAlignment) {
		case B_ALIGN_RIGHT:
			x = fDivider - fLayoutData->label_width - 3.0f;
			break;

		case B_ALIGN_CENTER:
			x = fDivider - roundf(fLayoutData->label_width / 2.0f);
			break;

		default:
			x = 0.0f;
			break;
	}

	// vertical position
	font_height& fontHeight = fLayoutData->font_info;
	float y = rect.top
		+ roundf((rect.Height() + 1.0f - fontHeight.ascent
			- fontHeight.descent) / 2.0f)
		+ fontHeight.ascent + kFrameMargin * 2;

	uint32 flags = 0;
	if (!IsEnabled())
		flags |= BControlLook::B_DISABLED;

	be_control_look->DrawLabel(this, label, LowColor(), flags, BPoint(x, y));
}
Пример #27
0
BRect
BButton::_DrawDefault(BRect bounds, bool enabled)
{
	rgb_color low = LowColor();
	rgb_color focusColor = tint_color(low, enabled ?
		(B_DARKEN_1_TINT + B_DARKEN_2_TINT) / 2
		: (B_NO_TINT + B_DARKEN_1_TINT) / 2);

	SetHighColor(focusColor);

	StrokeRect(bounds, B_SOLID_LOW);
	bounds.InsetBy(1.0, 1.0);
	StrokeRect(bounds);
	bounds.InsetBy(1.0, 1.0);
	StrokeRect(bounds);
	bounds.InsetBy(1.0, 1.0);

	return bounds;
}
Пример #28
0
void Stringview1::Draw(BRect updateRect) {

	
	rgb_color lc=LowColor();
	rgb_color hc=HighColor();
	
//	if (hasIcon) DrawBitmap(bmp,BRect(600,0,615,15));
	SetHighColor(0,0,0,255);
	SetLowColor(255,255,255,255);
	SetFontSize(10.0);
	DrawString(text->String(), BPoint(3,12));
	DrawString(typetext->String(), BPoint(Bounds().Width()-20-StringWidth(typetext->String()),12));
	
	SetLowColor(lc);
	SetHighColor(hc);
//	BView::Draw(updateRect);

//	be_app->PostMessage('HL01');
}
Пример #29
0
void
BSlider::AttachedToWindow()
{
	ResizeToPreferred();

#if USE_OFF_SCREEN_VIEW
	BRect bounds(Bounds());

	if (!fOffScreenView) {
		fOffScreenView = new BView(bounds, "", B_FOLLOW_ALL, B_WILL_DRAW);

		BFont font;
		GetFont(&font);
		fOffScreenView->SetFont(&font);
	}

	if (!fOffScreenBits) {
		fOffScreenBits = new BBitmap(bounds, B_RGBA32, true, false);

		if (fOffScreenBits && fOffScreenView)
			fOffScreenBits->AddChild(fOffScreenView);

	} else if (fOffScreenView)
		fOffScreenBits->AddChild(fOffScreenView);
#endif // USE_OFF_SCREEN_VIEW

	BControl::AttachedToWindow();

	BView* view = OffscreenView();
	if (view && view->LockLooper()) {
		view->SetViewColor(B_TRANSPARENT_COLOR);
		view->SetLowColor(LowColor());
		view->UnlockLooper();
	}

	int32 value = Value();
	SetValue(value);
		// makes sure the value is within valid bounds
	_SetLocationForValue(Value());
		// makes sure the location is correct
	UpdateTextChanged();
}
Пример #30
0
void
BIconButton::Draw(BRect updateRect)
{
	rgb_color background;
	if (fCustomBackground)
		background = {120,120,120};
	else
		background = LowColor();

	BRect r(Bounds());

	uint32 flags = 0;
	BBitmap* bitmap = fNormalBitmap;
	if (!IsEnabled()) {
		flags |= BControlLook::B_DISABLED;
		bitmap = fDisabledBitmap;
	}
	if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED))
		flags |= BControlLook::B_ACTIVATED;

	if (ShouldDrawBorder()) {
		DrawBorder(r, updateRect, background, flags);
		DrawBackground(r, updateRect, background, flags);
	} else {
		SetHighColor(background);
		FillRect(r);
	}

	if (bitmap && bitmap->IsValid()) {
		if (bitmap->ColorSpace() == B_RGBA32
			|| bitmap->ColorSpace() == B_RGBA32_BIG) {
			SetDrawingMode(B_OP_ALPHA);
			SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
		}
		float x = r.left + floorf((r.Width()
			- bitmap->Bounds().Width()) / 2.0 + 0.5);
		float y = r.top + floorf((r.Height()
			- bitmap->Bounds().Height()) / 2.0 + 0.5);
		DrawBitmap(bitmap, BPoint(x, y));
	}
}