Example #1
0
void
BTextControl::Draw(BRect updateRect)
{
	bool enabled = IsEnabled();
	bool active = fText->IsFocus() && Window()->IsActive();

	BRect rect = fText->Frame();
	rect.InsetBy(-2, -2);

	if (be_control_look != NULL) {
		rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
		uint32 flags = 0;
		if (!enabled)
			flags |= BControlLook::B_DISABLED;
		if (active)
			flags |= BControlLook::B_FOCUSED;
		be_control_look->DrawTextControlBorder(this, rect, updateRect, base,
			flags);

		if (Label() != NULL) {
			if (fLayoutData->label_layout_item != NULL) {
				rect = fLayoutData->label_layout_item->FrameInParent();
			} else {
				rect = Bounds();
				rect.right = fDivider - kLabelInputSpacing;
			}

			be_control_look->DrawLabel(this, Label(), rect, updateRect,
				base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));
		}
		return;
	}

	// outer bevel

	rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR);
	rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT);
	rgb_color lighten2 = tint_color(noTint, B_LIGHTEN_2_TINT);
	rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT);
	rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT);
	rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT);
	rgb_color navigationColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);

	if (enabled)
		SetHighColor(darken1);
	else
		SetHighColor(noTint);

	StrokeLine(rect.LeftBottom(), rect.LeftTop());
	StrokeLine(rect.RightTop());

	if (enabled)
		SetHighColor(lighten2);
	else
		SetHighColor(lighten1);

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

	// inner bevel

	rect.InsetBy(1.0f, 1.0f);

	if (active) {
		SetHighColor(navigationColor);
		StrokeRect(rect);
	} else {
		if (enabled)
			SetHighColor(darken4);
		else
			SetHighColor(darken2);

		StrokeLine(rect.LeftTop(), rect.LeftBottom());
		StrokeLine(rect.LeftTop(), rect.RightTop());

		SetHighColor(noTint);
		StrokeLine(BPoint(rect.left + 1.0f, rect.bottom), rect.RightBottom());
		StrokeLine(BPoint(rect.right, rect.top + 1.0f));
	}

	// label

	if (Label()) {
		_ValidateLayoutData();
		font_height& fontHeight = fLayoutData->font_info;

		float y = Bounds().top + (Bounds().Height() + 1 - fontHeight.ascent
			- fontHeight.descent) / 2 + fontHeight.ascent;
		float x;

		float labelWidth = StringWidth(Label());
		switch (fLabelAlign) {
			case B_ALIGN_RIGHT:
				x = fDivider - labelWidth - kLabelInputSpacing;
				break;

			case B_ALIGN_CENTER:
				x = fDivider - labelWidth / 2.0;
				break;

			default:
				x = 0.0;
				break;
		}

		BRect labelArea(x, Bounds().top, x + labelWidth, Bounds().bottom);
		if (x < fDivider && updateRect.Intersects(labelArea)) {
			labelArea.right = fText->Frame().left - kLabelInputSpacing;

			BRegion clipRegion(labelArea);
			ConstrainClippingRegion(&clipRegion);
			SetHighColor(IsEnabled() ? ui_color(B_CONTROL_TEXT_COLOR)
				: tint_color(noTint, B_DISABLED_LABEL_TINT));
			DrawString(Label(), BPoint(x, y));
		}
	}
}
Example #2
0
void
BStatusBar::Draw(BRect updateRect)
{
	rgb_color backgroundColor = LowColor();

	font_height fontHeight;
	GetFontHeight(&fontHeight);
	BRect barFrame = _BarFrame(&fontHeight);
	BRect outerFrame = barFrame.InsetByCopy(-2, -2);

	BRegion background(updateRect);
	background.Exclude(outerFrame);
	FillRegion(&background, B_SOLID_LOW);

	// Draw labels/texts

	BRect rect = outerFrame;
	rect.top = 0;
	rect.bottom = outerFrame.top - 1;

	if (updateRect.Intersects(rect)) {
		// update labels
		BString leftText;
		leftText << fLabel << fText;

		BString rightText;
		rightText << fTrailingText << fTrailingLabel;

		float baseLine = ceilf(fontHeight.ascent) + 1;
		fTextDivider = rect.right;

		BFont font;
		GetFont(&font);

		if (rightText.Length()) {
			font.TruncateString(&rightText, B_TRUNCATE_BEGINNING, rect.Width());
			fTextDivider -= StringWidth(rightText.String());
		}

		if (leftText.Length()) {
			float width = max_c(0.0, fTextDivider - rect.left);
			font.TruncateString(&leftText, B_TRUNCATE_END, width);
		}

		SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));

		if (leftText.Length())
			DrawString(leftText.String(), BPoint(rect.left, baseLine));

		if (rightText.Length())
			DrawString(rightText.String(), BPoint(fTextDivider, baseLine));

	}

	// Draw bar

	if (!updateRect.Intersects(outerFrame))
		return;

	rect = outerFrame;

	if (be_control_look != NULL) {
		be_control_look->DrawStatusBar(this, rect, updateRect,
			backgroundColor, fBarColor, _BarPosition(barFrame));
		return;
	}

	// First bevel
	SetHighColor(tint_color(ui_color ( B_PANEL_BACKGROUND_COLOR ), B_DARKEN_1_TINT));
	StrokeLine(rect.LeftBottom(), rect.LeftTop());
	StrokeLine(rect.RightTop());

	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_2_TINT));
	StrokeLine(BPoint(rect.left + 1, rect.bottom), rect.RightBottom());
	StrokeLine(BPoint(rect.right, rect.top + 1));

	rect.InsetBy(1, 1);

	// Second bevel
	SetHighColor(tint_color(ui_color ( B_PANEL_BACKGROUND_COLOR ), B_DARKEN_4_TINT));
	StrokeLine(rect.LeftBottom(), rect.LeftTop());
	StrokeLine(rect.RightTop());

	SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	StrokeLine(BPoint(rect.left + 1, rect.bottom), rect.RightBottom());
	StrokeLine(BPoint(rect.right, rect.top + 1));

	rect = barFrame;
	rect.right = _BarPosition(barFrame);

	// draw bar itself

	if (rect.right >= rect.left) {
		// Bevel
		SetHighColor(tint_color(fBarColor, B_LIGHTEN_2_TINT));
		StrokeLine(rect.LeftBottom(), rect.LeftTop());
		StrokeLine(rect.RightTop());

		SetHighColor(tint_color(fBarColor, B_DARKEN_2_TINT));
		StrokeLine(BPoint(rect.left + 1, rect.bottom), rect.RightBottom());
		StrokeLine(BPoint(rect.right, rect.top + 1));

		// filling
		SetHighColor(fBarColor);
		FillRect(rect.InsetByCopy(1, 1));
	}

	if (rect.right < barFrame.right) {
		// empty space
		rect.left = rect.right + 1;
		rect.right = barFrame.right;
		SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
		FillRect(rect);
	}
}
Example #3
0
	TestView3(BRect frame, const char* name, uint32 resizeFlags, uint32 flags)
		: BView(frame, name, resizeFlags, flags)
	{
		SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
		SetHighColor(ViewColor());
	}
Example #4
0
void
SeekSlider::Draw(BRect updateRect)
{
    BRect r(Bounds());

    // draw both sides (the original from Be doesn't seem
    // to make a difference for enabled/disabled state)
//	DrawBitmapAsync(fLeftSideBits, r.LeftTop());
//	DrawBitmapAsync(fRightSideBits, BPoint(sliderEnd + 1.0, r.top));
    // colors for the slider area between the two bitmaps
    rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
    rgb_color shadow = tint_color(background, B_DARKEN_2_TINT);
    rgb_color softShadow = tint_color(background, B_DARKEN_1_TINT);
    rgb_color darkShadow = tint_color(background, B_DARKEN_4_TINT);
    rgb_color midShadow = tint_color(background, B_DARKEN_3_TINT);
    rgb_color light = tint_color(background, B_LIGHTEN_MAX_TINT);
    rgb_color softLight = tint_color(background, B_LIGHTEN_1_TINT);
    rgb_color green = kSeekGreen;
    rgb_color greenShadow = kSeekGreenShadow;
    rgb_color black = kBlack;
    rgb_color dotGrey = midShadow;
    rgb_color dotGreen = greenShadow;
    // draw frame
    _StrokeFrame(r, softShadow, softShadow, light, light);
    r.InsetBy(1.0, 1.0);
    _StrokeFrame(r, black, black, softShadow, softShadow);
    if (IsEnabled()) {
        // *** enabled look ***
        r.InsetBy(1.0, 1.0);
        // inner shadow
        _StrokeFrame(r, greenShadow, greenShadow, green, green);
        r.top++;
        r.left++;
        _StrokeFrame(r, greenShadow, greenShadow, green, green);
        // inside area
        r.InsetBy(1.0, 1.0);
        SetHighColor(green);
        FillRect(r);
        // dots
        int32 dotCount = (int32)(r.Width() / 6.0);
        BPoint dotPos;
        dotPos.y = r.top + 2.0;
        SetHighColor(dotGreen);

        float knobWidth2 = SEEK_SLIDER_KNOB_WIDTH / 2.0;
        float sliderStart = (r.left + knobWidth2);

        for (int32 i = 0; i < dotCount; i++) {
            dotPos.x = sliderStart + i * 6.0;
            StrokeLine(dotPos, BPoint(dotPos.x, dotPos.y + 6.0));
        }
        // slider handle
        r.top -= 4.0;
        r.bottom += 3.0;
        r.left = fKnobPos - knobWidth2;
        r.right = fKnobPos + knobWidth2;
        // black outline
        float handleBottomSize = 2.0;
        float handleArrowSize = 6.0;
        BeginLineArray(10);
        // upper handle
        AddLine(BPoint(r.left, r.top + handleBottomSize),
                BPoint(r.left, r.top), black);
        AddLine(BPoint(r.left + 1.0, r.top),
                BPoint(r.right, r.top), black);
        AddLine(BPoint(r.right, r.top + 1.0),
                BPoint(r.right, r.top + handleBottomSize), black);
        AddLine(BPoint(r.right - 1.0, r.top + handleBottomSize + 1.0),
                BPoint(fKnobPos, r.top + handleArrowSize), black);
        AddLine(BPoint(fKnobPos - 1.0, r.top + handleArrowSize - 1.0),
                BPoint(r.left + 1.0, r.top + handleBottomSize + 1.0), black);
        // lower handle
        AddLine(BPoint(r.left, r.bottom),
                BPoint(r.left, r.bottom - handleBottomSize), black);
        AddLine(BPoint(r.left + 1.0, r.bottom - handleBottomSize - 1.0),
                BPoint(fKnobPos, r.bottom - handleArrowSize), black);
        AddLine(BPoint(fKnobPos + 1.0, r.bottom - handleArrowSize + 1.0),
                BPoint(r.right, r.bottom - handleBottomSize), black);
        AddLine(BPoint(r.right, r.bottom - handleBottomSize + 1.0),
                BPoint(r.right, r.bottom), black);
        AddLine(BPoint(r.right - 1.0, r.bottom),
                BPoint(r.left + 1.0, r.bottom), black);
        EndLineArray();
        // inner red light and shadow lines
        r.InsetBy(1.0, 1.0);
        handleBottomSize--;
        handleArrowSize -= 2.0;
        BeginLineArray(10);
        // upper handle
        AddLine(BPoint(r.left, r.top + handleBottomSize),
                BPoint(r.left, r.top), kSeekRedLight);
        AddLine(BPoint(r.left + 1.0, r.top),
                BPoint(r.right, r.top), kSeekRedLight);
        AddLine(BPoint(r.right, r.top + 1.0),
                BPoint(r.right, r.top + handleBottomSize), kSeekRedShadow);
        AddLine(BPoint(r.right - 1.0, r.top + handleBottomSize + 1.0),
                BPoint(fKnobPos, r.top + handleArrowSize), kSeekRedShadow);
        AddLine(BPoint(fKnobPos - 1.0, r.top + handleArrowSize - 1.0),
                BPoint(r.left + 1.0, r.top + handleBottomSize + 1.0), kSeekRedLight);
        // lower handle
        AddLine(BPoint(r.left, r.bottom),
                BPoint(r.left, r.bottom - handleBottomSize), kSeekRedLight);
        AddLine(BPoint(r.left + 1.0, r.bottom - handleBottomSize - 1.0),
                BPoint(fKnobPos, r.bottom - handleArrowSize), kSeekRedLight);
        AddLine(BPoint(fKnobPos + 1.0, r.bottom - handleArrowSize + 1.0),
                BPoint(r.right, r.bottom - handleBottomSize), kSeekRedShadow);
        AddLine(BPoint(r.right, r.bottom - handleBottomSize + 1.0),
                BPoint(r.right, r.bottom), kSeekRedShadow);
        AddLine(BPoint(r.right - 1.0, r.bottom),
                BPoint(r.left + 1.0, r.bottom), kSeekRedShadow);
        EndLineArray();
        // fill rest of handles with red
        SetHighColor(kSeekRed);
        r.InsetBy(1.0, 1.0);
        handleArrowSize -= 2.0;
        BPoint arrow[3];
        // upper handle arrow
        arrow[0].x = r.left;
        arrow[0].y = r.top;
        arrow[1].x = r.right;
        arrow[1].y = r.top;
        arrow[2].x = fKnobPos;
        arrow[2].y = r.top + handleArrowSize;
        FillPolygon(arrow, 3);
        // lower handle arrow
        arrow[0].x = r.left;
        arrow[0].y = r.bottom;
        arrow[1].x = r.right;
        arrow[1].y = r.bottom;
        arrow[2].x = fKnobPos;
        arrow[2].y = r.bottom - handleArrowSize;
        FillPolygon(arrow, 3);
    } else {
        // *** disabled look ***
        r.InsetBy(1.0, 1.0);
        _StrokeFrame(r, darkShadow, darkShadow, darkShadow, darkShadow);
        r.InsetBy(1.0, 1.0);
        _StrokeFrame(r, darkShadow, darkShadow, darkShadow, darkShadow);
        r.InsetBy(1.0, 1.0);
        SetHighColor(darkShadow);
        SetLowColor(shadow);
        // stripes
        float width = floorf(StringWidth(fDisabledString.String()));
        float textPos = r.left + r.Width() / 2.0 - width / 2.0;
        pattern stripes = { { 0xc7, 0x8f, 0x1f, 0x3e, 0x7c, 0xf8, 0xf1, 0xe3 } };
        BRect stripesRect(r);
        stripesRect.right = textPos - 5.0;
        FillRect(stripesRect, stripes);
        stripesRect.left = textPos + width + 3.0;
        stripesRect.right = r.right;
        FillRect(stripesRect, stripes);
        // info text
        r.left = textPos - 4.0;
        r.right = textPos + width + 2.0;
        FillRect(r);
        SetHighColor(shadow);
        SetLowColor(darkShadow);
        font_height fh;
        GetFontHeight(&fh);
        DrawString(fDisabledString.String(),
                   BPoint(textPos, r.top + ceilf(fh.ascent) - 1.0));
    }
}
//! Redraw the button depending on whether it's up or down
void
CPUButton::Draw(BRect rect)
{
	bool value = (bool)Value();
	SetHighColor(value ? fOnColor : fOffColor);

	if (!fReplicant) {
		SetLowColor(Parent()->LowColor());
		FillRect(Bounds(), B_SOLID_LOW);
	}

	BRect bounds = Bounds();
	if (fReplicant && !fReplicantInDeskbar) {
		bounds.bottom -= 4;
		bounds.right -= 4;
	} else if (!fReplicant) {
		bounds.bottom -= 7;
		bounds.right -= 7;
	}
	BRect color_rect(bounds);
	color_rect.InsetBy(2, 2);
	if (value) {
		color_rect.bottom -= 1;
		color_rect.right -= 1;
	}
	FillRect(bounds);

	if (value)
		SetHighColor(80, 80, 80);
	else
		SetHighColor(255, 255, 255);

	BPoint start(0, 0);
	BPoint end(bounds.right, 0);
	StrokeLine(start, end);
	end.Set(0, bounds.bottom);
	StrokeLine(start, end);

	if (value)
		SetHighColor(32, 32, 32);
	else
		SetHighColor(216, 216, 216);

	start.Set(1, 1);
	end.Set(bounds.right - 1, 1);
	StrokeLine(start, end);
	end.Set(1, bounds.bottom - 1);
	StrokeLine(start, end);

	if (value)
		SetHighColor(216, 216, 216);
	else
		SetHighColor(80, 80, 80);

	start.Set(bounds.left + 1, bounds.bottom - 1);
	end.Set(bounds.right - 1, bounds.bottom - 1);
	StrokeLine(start, end);
	start.Set(bounds.right - 1, bounds.top + 1);
	StrokeLine(start, end);

	if (value)
		SetHighColor(255, 255, 255);
	else
		SetHighColor(32, 32, 32);

	start.Set(bounds.left, bounds.bottom);
	end.Set(bounds.right, bounds.bottom);
	StrokeLine(start, end);
	start.Set(bounds.right, bounds.top);
	StrokeLine(start, end);

	if (value) {
		SetHighColor(0, 0, 0);
		start.Set(bounds.left + 2, bounds.bottom - 2);
		end.Set(bounds.right - 2, bounds.bottom - 2);
		StrokeLine(start, end);
		start.Set(bounds.right - 2, bounds.top + 2);
		StrokeLine(start, end);
	}

	// Try to keep the text centered
	BFont font;
	GetFont(&font);
	int label_width = (int)font.StringWidth(Label());
	int rect_width = bounds.IntegerWidth() - 1;
	int rect_height = bounds.IntegerHeight();
	font_height fh;
	font.GetHeight(&fh);
	int label_height = (int)fh.ascent;
	int x_pos = (int)(((double)(rect_width - label_width) / 2.0) + 0.5);
	int y_pos = (rect_height - label_height) / 2 + label_height;

	MovePenTo(x_pos, y_pos);
	SetHighColor(0, 0, 0);
	SetDrawingMode(B_OP_OVER);
	DrawString(Label());
}
Example #6
0
void
ActivityView::Draw(BRect updateRect)
{
	bool drawBackground = true;
	if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0)
		drawBackground = false;

	_DrawHistory(drawBackground);

	if (!fShowLegend)
		return;

	// draw legend
	BRect legendFrame = _LegendFrame();
	SetLowColor(fLegendBackgroundColor);
	if (drawBackground) {
		BRect backgroundFrame(legendFrame);
		backgroundFrame.bottom += kDraggerSize;
		FillRect(backgroundFrame, B_SOLID_LOW);
	}

	BAutolock _(fSourcesLock);

	font_height fontHeight;
	GetFontHeight(&fontHeight);

	for (int32 i = 0; i < fSources.CountItems(); i++) {
		DataSource* source = fSources.ItemAt(i);
		DataHistory* values = fValues.ItemAt(i);
		BRect frame = _LegendFrameAt(legendFrame, i);

		// draw color box
		BRect colorBox = _LegendColorFrameAt(legendFrame, i);
		BRect rect = colorBox;
		uint32 flags = BControlLook::B_BLEND_FRAME;
		be_control_look->DrawTextControlBorder(this, rect,
			rect, fLegendBackgroundColor, flags);
		SetHighColor(source->Color());
		FillRect(rect);

		// show current value and label
		float y = frame.top + ceilf(fontHeight.ascent);
		int64 value = values->ValueAt(values->End());
		BString text;
		source->Print(text, value);
		float width = StringWidth(text.String());

		BString label = source->Label();
		float possibleLabelWidth = frame.right - colorBox.right - 12 - width;
		// TODO: TruncateString() is broken... remove + 5 when fixed!
		if (ceilf(StringWidth(label.String()) + 5) > possibleLabelWidth)
			label = source->ShortLabel();
		TruncateString(&label, B_TRUNCATE_MIDDLE, possibleLabelWidth);

		if (drawBackground)
			SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
		else {
			rgb_color c = Parent()->ViewColor();
			rgb_color textColor = c.red + c.green * 1.5f + c.blue * 0.50f
				>= 300 ? kBlack : kWhite;

			int32 mask;
			bool tmpOutline = false;
			bool outline = fCachedOutline;
			int8 indice = 0;

			if (fCachedWorkspace != current_workspace()) {
				while (fBackgroundInfo.FindInt32("be:bgndimginfoworkspaces",
						indice, &mask) == B_OK
					&& fBackgroundInfo.FindBool("be:bgndimginfoerasetext",
						indice, &tmpOutline) == B_OK) {
					if (((1 << current_workspace()) & mask) != 0) {
						outline = tmpOutline;
						fCachedWorkspace = current_workspace();
						fCachedOutline = outline;
						break;
					}
					indice++;
				}
			}

			if (outline) {
				SetDrawingMode(B_OP_ALPHA);
				SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);

				BFont font;
				GetFont(&font);
				if (textColor == kBlack) {
					// Black text with white halo/glow
					rgb_color glowColor = kWhite;

					font.SetFalseBoldWidth(2.0);
					SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);

					glowColor.alpha = 30;
					SetHighColor(glowColor);
					DrawString(label.String(), BPoint(6 + colorBox.right, y));
					DrawString(text.String(), BPoint(frame.right - width, y));

					font.SetFalseBoldWidth(1.0);
					SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);

					glowColor.alpha = 65;
					SetHighColor(glowColor);
					DrawString(label.String(), BPoint(6 + colorBox.right, y));
					DrawString(text.String(), BPoint(frame.right - width, y));

					font.SetFalseBoldWidth(0.0);
					SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);
				} else {
					// white text with black outline
					rgb_color outlineColor = kBlack;

					font.SetFalseBoldWidth(1.0);
					SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);

					outlineColor.alpha = 30;
					SetHighColor(outlineColor);
					DrawString(label.String(), BPoint(6 + colorBox.right, y));
					DrawString(text.String(), BPoint(frame.right - width, y));

					font.SetFalseBoldWidth(0.0);
					SetFont(&font, B_FONT_FALSE_BOLD_WIDTH);

					outlineColor.alpha = 200;
					SetHighColor(outlineColor);
					DrawString(label.String(), BPoint(6 + colorBox.right + 1,
						y + 1));
					DrawString(text.String(), BPoint(frame.right - width + 1,
						y + 1));
				}
			}
			SetDrawingMode(B_OP_OVER);
			SetHighColor(textColor);
		}
		DrawString(label.String(), BPoint(6 + colorBox.right, y));
		DrawString(text.String(), BPoint(frame.right - width, y));
	}
}
Example #7
0
void
PadView::Draw(BRect updateRect)
{
	rgb_color background = LowColor();
	rgb_color light = tint_color(background, B_LIGHTEN_MAX_TINT);
	rgb_color shadow = tint_color(background, B_DARKEN_2_TINT);
	BRect r(Bounds());
	BeginLineArray(4);
		AddLine(BPoint(r.left, r.bottom), BPoint(r.left, r.top), light);
		AddLine(BPoint(r.left + 1.0, r.top), BPoint(r.right, r.top), light);
		AddLine(BPoint(r.right, r.top + 1.0), BPoint(r.right, r.bottom), shadow);
		AddLine(BPoint(r.right - 1.0, r.bottom), BPoint(r.left + 1.0, r.bottom), shadow);
	EndLineArray();
	r.InsetBy(1.0, 1.0);
	StrokeRect(r, B_SOLID_LOW);
	r.InsetBy(1.0, 1.0);
	// dots along top
	BPoint dot = r.LeftTop();
	int32 current;
	int32 stop;
	BPoint offset;
	BPoint next;
	if (Orientation() == B_VERTICAL) {
		current = (int32)dot.x;
		stop = (int32)r.right;
		offset = BPoint(0, 1);
		next = BPoint(1, -4);
		r.top += 5.0;
	} else {
		current = (int32)dot.y;
		stop = (int32)r.bottom;
		offset = BPoint(1, 0);
		next = BPoint(-4, 1);
		r.left += 5.0;
	}
	int32 num = 1;
	while (current <= stop) {
		rgb_color col1;
		rgb_color col2;
		if (num == 1) {
			col1 = shadow;
			col2 = background;
		} else if (num == 2) {
			col1 = background;
			col2 = light;
		} else {
			col1 = background;
			col2 = background;
			num = 0;
		}
		SetHighColor(col1);
		StrokeLine(dot, dot, B_SOLID_HIGH);
		SetHighColor(col2);
		dot += offset;
		StrokeLine(dot, dot, B_SOLID_HIGH);
		dot += offset;
		StrokeLine(dot, dot, B_SOLID_LOW);
		dot += offset;
		SetHighColor(col1);
		StrokeLine(dot, dot, B_SOLID_HIGH);
		dot += offset;
		SetHighColor(col2);
		StrokeLine(dot, dot, B_SOLID_HIGH);
		// next pixel
		num++;
		dot += next;
		current++;
	}
	FillRect(r, B_SOLID_LOW);
}
Example #8
0
void
View::Draw(BRect updateRect)
{
	SetHighColor(fLastColor, fLastColor, fLastColor);
	DrawString(&fLastKey, 1, BPoint(20, 70));
}
Example #9
0
// Draw
void
TestView::Draw(BRect updateRect)
{
	if (fCopyBitsJustCalled) {
		printf("TestView::Draw(%.1f, %.1f, %.1f, %.1f) after CopyBits()\n",
			   updateRect.left, updateRect.top, updateRect.right, updateRect.bottom);
		fCopyBitsJustCalled = false;
	}

	// background
//	SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR));
//	FillRect(updateRect);

	BRect r(Bounds());

	// draw some pattern with lines
	float width = r.Width();
	float height = r.Height();
	int32 lineCount = 20;
	SetPenSize(2.0);
	for (int32 i = 0; i < lineCount; i++) {
		SetHighColor(255, (255 / lineCount) * i, 255 - (255 / lineCount) * i);
		StrokeLine(BPoint(r.left + (width / lineCount) * i, r.top),
				   BPoint(r.left, r.top + (height / lineCount) * i));
		StrokeLine(BPoint(r.right - (width / lineCount) * i, r.bottom),
				   BPoint(r.right, r.bottom - (height / lineCount) * i));
	}
	StrokeLine(BPoint(r.left, r.bottom), BPoint(r.right, r.top));

	// source and dest rect
	SetPenSize(1.0);

	SetHighColor(0, 255, 0, 255);
	StrokeRect(fSourceRect);

	SetHighColor(0, 0, 255, 255);
	StrokeRect(fDestRect);

	// text
	SetHighColor(128, 0, 50, 255);

	const char* message = "Left-Click and drag";
	width = StringWidth(message);
	BPoint p(r.left + r.Width() / 2.0 - width / 2.0,
			 r.top + r.Height() / 2.0 - 50.0);

	DrawString(message, p);

	message = "to set source rect!";
	width = StringWidth(message);
	p.x = r.left + r.Width() / 2.0 - width / 2.0;
	p.y += 20;

	DrawString(message, p);

	message = "Right-Click and drag";
	width = StringWidth(message);
	p.x = r.left + r.Width() / 2.0 - width / 2.0;
	p.y += 30.0;

	DrawString(message, p);

	message = "to set destination rect!";
	width = StringWidth(message);
	p.x = r.left + r.Width() / 2.0 - width / 2.0;
	p.y += 20;

	DrawString(message, p);
}
Example #10
0
void
KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
                             BRect rect, bool pressed)
{
    rgb_color base = key->dark ? kDarkColor : kBrightColor;
    rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
    key_kind keyKind = kNormalKey;
    int32 deadKey = 0;
    bool secondDeadKey = false;
    bool isDeadKeyEnabled = true;

    char text[32];
    if (fKeymap != NULL) {
        _GetKeyLabel(key, text, sizeof(text), keyKind);
        deadKey = fKeymap->DeadKey(key->code, fModifiers, &isDeadKeyEnabled);
        secondDeadKey = fKeymap->IsDeadSecondKey(key->code, fModifiers,
                        fDeadKey);
    } else {
        // Show the key code if there is no keymap
        snprintf(text, sizeof(text), "%02" B_PRIx32, key->code);
    }

    _SetFontSize(view, keyKind);

    if (secondDeadKey)
        base = kSecondDeadKeyColor;
    else if (deadKey > 0 && isDeadKeyEnabled)
        base = kDeadKeyColor;

    if (key->shape == kRectangleKeyShape) {
        _DrawKeyButton(view, rect, updateRect, base, background, pressed);

        rect.InsetBy(1, 1);

        _GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
        be_control_look->DrawLabel(view, text, rect, updateRect,
                                   base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
    } else if (key->shape == kEnterKeyShape) {
        BRect topLeft = rect;
        BRect topRight = rect;
        BRect bottomLeft = rect;
        BRect bottomRight = rect;

        // TODO: for some reason, this does not always equal the bottom of
        // the other keys...
        bottomLeft.top = floorf(rect.top
                                + fLayout->DefaultKeySize().height * fFactor - fGap - 1);
        bottomLeft.right = floorf(rect.left
                                  + (key->frame.Width() - key->second_row) * fFactor - fGap - 2);

        topLeft.bottom = bottomLeft.top;
        topLeft.right = bottomLeft.right + 1;
        // add one to make the borders meet

        topRight.bottom = topLeft.bottom;
        topRight.left = topLeft.right;

        bottomRight.top = bottomLeft.top;
        bottomRight.left = bottomLeft.right;

        // draw top left corner
        be_control_look->DrawButtonFrame(view, topLeft, updateRect,
                                         4.0f, 0.0f, 4.0f, 0.0f, base, background,
                                         pressed ? BControlLook::B_ACTIVATED : 0,
                                         BControlLook::B_LEFT_BORDER | BControlLook::B_TOP_BORDER
                                         | BControlLook::B_BOTTOM_BORDER);
        be_control_look->DrawButtonBackground(view, topLeft, updateRect,
                                              4.0f, 0.0f, 4.0f, 0.0f, base,
                                              pressed ? BControlLook::B_ACTIVATED : 0,
                                              BControlLook::B_LEFT_BORDER | BControlLook::B_TOP_BORDER
                                              | BControlLook::B_BOTTOM_BORDER);

        // draw top right corner
        be_control_look->DrawButtonFrame(view, topRight, updateRect,
                                         0.0f, 4.0f, 0.0f, 0.0f, base, background,
                                         pressed ? BControlLook::B_ACTIVATED : 0,
                                         BControlLook::B_TOP_BORDER | BControlLook::B_RIGHT_BORDER);
        be_control_look->DrawButtonBackground(view, topRight, updateRect,
                                              0.0f, 4.0f, 0.0f, 0.0f, base,
                                              pressed ? BControlLook::B_ACTIVATED : 0,
                                              BControlLook::B_TOP_BORDER | BControlLook::B_RIGHT_BORDER);

        // draw bottom right corner
        be_control_look->DrawButtonFrame(view, bottomRight, updateRect,
                                         0.0f, 0.0f, 4.0f, 4.0f, base, background,
                                         pressed ? BControlLook::B_ACTIVATED : 0,
                                         BControlLook::B_LEFT_BORDER | BControlLook::B_RIGHT_BORDER
                                         | BControlLook::B_BOTTOM_BORDER);
        be_control_look->DrawButtonBackground(view, bottomRight, updateRect,
                                              0.0f, 0.0f, 4.0f, 4.0f, base,
                                              pressed ? BControlLook::B_ACTIVATED : 0,
                                              BControlLook::B_LEFT_BORDER | BControlLook::B_RIGHT_BORDER
                                              | BControlLook::B_BOTTOM_BORDER);

        // clip out the bottom left corner
        bottomLeft.right += 1;
        bottomLeft.top -= 2;
        BRegion region(rect);
        region.Exclude(bottomLeft);
        view->ConstrainClippingRegion(&region);

        // Fill in the rect with the background color
        SetHighColor(background);
        FillRect(rect);

        // draw the button background
        BRect bgRect = rect.InsetByCopy(2, 2);
        be_control_look->DrawButtonBackground(view, bgRect, updateRect,
                                              4.0f, 4.0f, 0.0f, 4.0f, base,
                                              pressed ? BControlLook::B_ACTIVATED : 0);

        rect.left = bottomLeft.right;
        _GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));

        // draw the button label
        be_control_look->DrawLabel(view, text, rect, updateRect,
                                   base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));

        // reset the clipping region
        view->ConstrainClippingRegion(NULL);
    }
}
void
BStatusView::Draw(BRect updateRect)
{
	if (fBitmap) {
		BPoint location;
		location.x = (fStatusBar->Frame().left
			- fBitmap->Bounds().Width()) / 2;
		location.y = (Bounds().Height()- fBitmap->Bounds().Height()) / 2;
		DrawBitmap(fBitmap, location);
	}

	BRect bounds(Bounds());
	be_control_look->DrawRaisedBorder(this, bounds, updateRect, ViewColor());

	SetHighColor(0, 0, 0);

	BPoint tp = fStatusBar->Frame().LeftBottom();
	font_height fh;
	GetFontHeight(&fh);
	tp.y += ceilf(fh.leading) + ceilf(fh.ascent);
	if (IsPaused()) {
		DrawString(B_TRANSLATE("Paused: click to resume or stop"), tp);
		return;
	}

	BFont font;
	GetFont(&font);
	float normalFontSize = font.Size();
	float smallFontSize = max_c(normalFontSize * 0.8f, 8.0f);
	float availableSpace = fStatusBar->Frame().Width();
	availableSpace -= be_control_look->DefaultLabelSpacing();
		// subtract to provide some room between our two strings

	float destinationStringWidth = 0.f;
	BString destinationString(_DestinationString(&destinationStringWidth));
	availableSpace -= destinationStringWidth;

	float statusStringWidth = 0.f;
	BString statusString(_StatusString(availableSpace, smallFontSize,
		&statusStringWidth));

	if (statusStringWidth > availableSpace) {
		TruncateString(&destinationString, B_TRUNCATE_MIDDLE,
			availableSpace + destinationStringWidth - statusStringWidth);
	}

	BPoint textPoint = fStatusBar->Frame().LeftBottom();
	textPoint.y += ceilf(fh.leading) + ceilf(fh.ascent);

	if (destinationStringWidth > 0) {
		DrawString(destinationString.String(), textPoint);
	}

	SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT));
	font.SetSize(smallFontSize);
	SetFont(&font, B_FONT_SIZE);

	textPoint.x = fStatusBar->Frame().right - statusStringWidth;
	DrawString(statusString.String(), textPoint);

	font.SetSize(normalFontSize);
	SetFont(&font, B_FONT_SIZE);
}
BStatusView::BStatusView(BRect bounds, thread_id thread, StatusWindowState type)
	:
	BView(bounds, "StatusView", B_FOLLOW_NONE, B_WILL_DRAW),
	fType(type),
	fBitmap(NULL),
	fThread(thread)
{
	Init();

	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetLowColor(ViewColor());
	SetHighColor(20, 20, 20);
	SetDrawingMode(B_OP_OVER);

	const float buttonWidth = 22;
	const float buttonHeight = 20;

	BRect rect(bounds);
	rect.OffsetTo(B_ORIGIN);
	rect.left += 40;
	rect.right -= buttonWidth * 2 + 12;
	rect.top += 6;
	rect.bottom = rect.top + 15;

	BString caption;
	int32 id = 0;

	switch (type) {
		case kCopyState:
			caption = B_TRANSLATE("Preparing to copy items" B_UTF8_ELLIPSIS);
			id = R_CopyStatusBitmap;
			break;

		case kMoveState:
			caption = B_TRANSLATE("Preparing to move items" B_UTF8_ELLIPSIS);
			id = R_MoveStatusBitmap;
			break;

		case kCreateLinkState:
			caption = B_TRANSLATE("Preparing to create links"
				B_UTF8_ELLIPSIS);
			id = R_MoveStatusBitmap;
			break;

		case kTrashState:
			caption = B_TRANSLATE("Preparing to empty Trash" B_UTF8_ELLIPSIS);
			id = R_TrashStatusBitmap;
			break;

		case kVolumeState:
			caption = B_TRANSLATE("Searching for disks to mount"
				B_UTF8_ELLIPSIS);
			break;

		case kDeleteState:
			caption = B_TRANSLATE("Preparing to delete items"
				B_UTF8_ELLIPSIS);
			id = R_TrashStatusBitmap;
			break;

		case kRestoreFromTrashState:
			caption = B_TRANSLATE("Preparing to restore items"
				B_UTF8_ELLIPSIS);
			break;

		default:
			TRESPASS();
			break;
	}

	if (caption.Length() != 0) {
		fStatusBar = new BStatusBar(rect, "StatusBar", caption.String());
		fStatusBar->SetBarHeight(12);
		float width, height;
		fStatusBar->GetPreferredSize(&width, &height);
		fStatusBar->ResizeTo(fStatusBar->Frame().Width(), height);
		AddChild(fStatusBar);

		// Figure out how much room we need to display the additional status
		// message below the bar
		font_height fh;
		GetFontHeight(&fh);
		BRect f = fStatusBar->Frame();
		// Height is 3 x the "room from the top" + bar height + room for
		// string.
		ResizeTo(Bounds().Width(), f.top + f.Height() + fh.leading + fh.ascent
			+ fh.descent + f.top);
	}

	if (id != 0) {
		GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, id,
			&fBitmap);
	}

	rect = Bounds();
	rect.left = rect.right - buttonWidth * 2 - 7;
	rect.right = rect.left + buttonWidth;
	rect.top = floorf((rect.top + rect.bottom) / 2 + 0.5) - buttonHeight / 2;
	rect.bottom = rect.top + buttonHeight;

	fPauseButton = new TCustomButton(rect, kPauseButton);
	fPauseButton->ResizeTo(buttonWidth, buttonHeight);
	AddChild(fPauseButton);

	rect.OffsetBy(buttonWidth + 2, 0);
	fStopButton = new TCustomButton(rect, kStopButton);
	fStopButton->ResizeTo(buttonWidth, buttonHeight);
	AddChild(fStopButton);
}
Example #13
0
void
ProcessController::DoDraw(bool force)
{
	BRect bounds(Bounds());

	float h = floorf(bounds.Height ()) - 2;
	float top = 1, left = 1;
	float bottom = top + h;
	float barWidth = layout[gCPUcount].cpu_width;
	// interspace
	float right = left + gCPUcount * (barWidth + layout[gCPUcount].cpu_inter)
		- layout[gCPUcount].cpu_inter; // right of CPU frame...
	if (force && Parent()) {
		SetHighColor(Parent()->ViewColor());
		FillRect(BRect(right + 1, top - 1, right + 2, bottom + 1));
	}

	if (force) {
		SetHighColor(frame_color);
		StrokeRect(BRect(left - 1, top - 1, right, bottom + 1));
		if (gCPUcount > 1 && layout[gCPUcount].cpu_inter == 1) {
			for (int x = 1; x < gCPUcount; x++)
				StrokeLine(BPoint(left + x * barWidth + x - 1, top),
					BPoint(left + x * barWidth + x - 1, bottom));
		}
	}
	float leftMem = bounds.Width() - layout[gCPUcount].mem_width;
	if (force)
		StrokeRect(BRect(leftMem - 1, top - 1,
			leftMem + layout[gCPUcount].mem_width, bottom + 1));

	for (int x = 0; x < gCPUcount; x++) {
		right = left + barWidth - 1;
		float rem = fCPUTimes[x] * (h + 1);
		float barHeight = floorf (rem);
		rem -= barHeight;
		float limit = bottom - barHeight;	// horizontal line
		float previousLimit = bottom - fLastBarHeight[x];
		float idleTop = top;

		if (!force && previousLimit > top)
			idleTop = previousLimit - 1;
		if (limit > idleTop) {
			SetHighColor(idle_color);
			FillRect(BRect(left, idleTop, right, limit - 1));
		}
		if (barHeight <= h) {
			rgb_color fraction_color;
			mix_colors(fraction_color, idle_color, active_color, rem);
			SetHighColor(fraction_color);
			StrokeLine(BPoint(left, bottom - barHeight), BPoint(right,
				bottom - barHeight));
		}
		float active_bottom = bottom;
		if (!force && previousLimit < bottom)
			active_bottom = previousLimit + 1;
		if (limit < active_bottom) {
			SetHighColor(active_color);
			FillRect(BRect(left, limit + 1, right, active_bottom));
		}
		left += layout[gCPUcount].cpu_width + layout[gCPUcount].cpu_inter;
		fLastBarHeight[x] = barHeight;
	}

	float rightMem = bounds.Width() - 1;
	float rem = fMemoryUsage * (h + 1);
	float barHeight = floorf(rem);
	rem -= barHeight;

	rgb_color used_memory_color;
	float sq = fMemoryUsage * fMemoryUsage;
	sq *= sq;
	sq *= sq;
	mix_colors(used_memory_color, memory_color, swap_color, sq);

	float limit = bottom - barHeight;	// horizontal line
	float previousLimit = bottom - fLastMemoryHeight;
	float free_top = top;
	if (!force && previousLimit > top)
		free_top = previousLimit - 1;
	if (limit > free_top) {
		SetHighColor (idle_color);
		FillRect(BRect(leftMem, free_top, rightMem, limit - 1));
	}
	if (barHeight <= h) {
		rgb_color fraction_color;
		mix_colors(fraction_color, idle_color, used_memory_color, rem);
		SetHighColor(fraction_color);
		StrokeLine(BPoint(leftMem, bottom - barHeight), BPoint(rightMem,
			bottom - barHeight));
	}
	float usedBottom = bottom;
//	if (!force && previousLimit < bottom)
//		usedBottom = previousLimit + 1;
	if (limit < usedBottom) {
		SetHighColor(used_memory_color);
		FillRect(BRect(leftMem, limit + 1, rightMem, usedBottom));
	}
	fLastMemoryHeight = barHeight;
}
Example #14
0
void ArpDocumentButton::Draw(BRect)
{
	enum {
		ShineColor = 0,
		MedShineColor = 1,
		ShadowColor = 2,
		MedShadowColor = 3,
		NumColors = 4
	};
	
	static float ColorTints[NumColors] = {
		.2, B_DARKEN_2_TINT,
		B_DARKEN_4_TINT, B_DARKEN_1_TINT
	};
	
	static int32 StandardMap[NumColors] = {
		ShineColor, MedShineColor,
		ShadowColor, MedShadowColor
	};
	
	static int32 PressedMap[NumColors] = {
		ShadowColor, MedShadowColor,
		ShineColor, MedShineColor
	};
	
	rgb_color bgcolor = LowColor();
	if( mDropped ) bgcolor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
	
	BRect bounds(Bounds());
	
	ArpD(cdb << ADH << "Drawing ArpDocument Button..." << endl);
	ArpD(cdb << ADH << "Initial view bounds=" << bounds << endl);
	
	int32* cmap = mPressed ? PressedMap : StandardMap;
	
	BeginLineArray(8);
	rgb_color curcol;
	
	if( bounds.IsValid() ) {
		ArpD(cdb << ADH << "Drawing interior frame at bounds=" << bounds
						<< endl);
		curcol = tint_color(bgcolor, ColorTints[cmap[MedShineColor]]);
		AddLine( BPoint(bounds.left, bounds.bottom),
				 BPoint(bounds.left, bounds.top),
				 curcol );
		AddLine( BPoint(bounds.left, bounds.top),
				 BPoint(bounds.right, bounds.top),
				 curcol );
		
		curcol = tint_color(bgcolor, ColorTints[cmap[ShadowColor]]);
		AddLine( BPoint(bounds.right, bounds.top),
				 BPoint(bounds.right, bounds.bottom),
				 curcol );
		AddLine( BPoint(bounds.right, bounds.bottom),
				 BPoint(bounds.left, bounds.bottom),
				 curcol );
		
		bounds.InsetBy(1, 1);
	}
	
	if( bounds.IsValid() ) {
		ArpD(cdb << ADH << "Drawing interior frame at bounds=" << bounds
						<< endl);
		curcol = tint_color(bgcolor, ColorTints[cmap[ShineColor]]);
		if( IsFocus() ) curcol = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
		AddLine( BPoint(bounds.left, bounds.bottom),
				 BPoint(bounds.left, bounds.top),
				 curcol );
		AddLine( BPoint(bounds.left, bounds.top),
				 BPoint(bounds.right, bounds.top),
				 curcol );
		
		curcol = tint_color(bgcolor, ColorTints[cmap[MedShadowColor]]);
		if( IsFocus() ) curcol = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
		AddLine( BPoint(bounds.right, bounds.top),
				 BPoint(bounds.right, bounds.bottom),
				 curcol );
		AddLine( BPoint(bounds.right, bounds.bottom),
				 BPoint(bounds.left, bounds.bottom),
				 curcol );
					
		bounds.InsetBy(1, 1);
	}
	
	EndLineArray();
	
	BRect ibounds;
	BBitmap* shownBitmap = 0;
	
	if( mPressed ) bgcolor = tint_color(LowColor(), B_DARKEN_MAX_TINT);
	else if( mMenued ) bgcolor = tint_color(LowColor(), B_DARKEN_2_TINT);
	
	if( bounds.IsValid() ) {
		
		shownBitmap = mDocIcon;
		if( shownBitmap ) ibounds = shownBitmap->Bounds();
		if( mSmallIcon
			&& ( !ibounds.IsValid()
				|| ibounds.Width() > bounds.Width()
				|| ibounds.Height() > bounds.Height() ) ) {
			shownBitmap = mSmallIcon;
			ibounds = shownBitmap->Bounds();
		}
		
		ArpD(cdb << ADH << "Current view bounds=" << bounds
						<< ", icon bounds=" << ibounds << endl);

		SetHighColor(bgcolor);
		const float xdiff = bounds.Width() - ibounds.Width();
		const float xoff = floor(xdiff/2);
		if( xdiff > 0 ) {
			// Fill in background to left and right of bitmap.
			if( xoff > 0 ) {
				FillRect(BRect(bounds.left, bounds.top,
							   bounds.left+xoff-1, bounds.bottom));
			}
			FillRect(BRect(bounds.right-(xdiff-xoff)+1, bounds.top,
						   bounds.right, bounds.bottom));
			bounds.left += xoff;
			bounds.right -= (xdiff-xoff);
			ArpD(cdb << ADH << "Fill view X to bounds=" << bounds << endl);
		} else {
			#if 1
			ibounds.left -= xoff;
			ibounds.right += (xdiff-xoff);
			#endif
			ArpD(cdb << ADH << "Indent icon X to bounds=" << ibounds << endl);
		}
		
		const float ydiff = bounds.Height() - ibounds.Height();
		const float yoff = floor(ydiff/2);
		if( ydiff > 0 ) {
			// Fill in background to left and right of bitmap.
			if( yoff > 0 ) {
				FillRect(BRect(bounds.left, bounds.top,
							   bounds.right, bounds.top+yoff-1));
			}
			FillRect(BRect(bounds.left, bounds.bottom-(ydiff-yoff)+1,
						   bounds.right, bounds.bottom));
			bounds.top += yoff;
			bounds.bottom -= (ydiff-yoff);
			ArpD(cdb << ADH << "Fill view Y to bounds=" << bounds << endl);
		} else {
			#if 1
			ibounds.top -= yoff;
			ibounds.bottom += (ydiff-yoff);
			#endif
			ArpD(cdb << ADH << "Indent icon Y to bounds=" << ibounds << endl);
		}
	}
	
	if( bounds.IsValid() && ibounds.IsValid() && shownBitmap ) {
		ArpD(cdb << ADH << "Drawing icon at bounds=" << bounds
						<< ", icon bounds=" << ibounds << endl);
		SetHighColor(bgcolor);
		SetLowColor(bgcolor);
		FillRect(bounds);
		SetDrawingMode(B_OP_ALPHA);
		SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE);
		DrawBitmapAsync(shownBitmap, ibounds, bounds);
		SetDrawingMode(B_OP_COPY);
	}
}