Ejemplo n.º 1
0
void
BScrollView::Draw(BRect updateRect)
{
	if (fBorder == B_PLAIN_BORDER) {
		SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
		StrokeRect(Bounds());
		return;
	} else if (fBorder != B_FANCY_BORDER)
		return;

	BRect bounds = Bounds();
	SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
	StrokeRect(bounds.InsetByCopy(1, 1));

	if (fHighlighted) {
		SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
		StrokeRect(bounds);
	} else {
		SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
		StrokeLine(bounds.LeftBottom(), bounds.LeftTop());
		bounds.left++;
		StrokeLine(bounds.LeftTop(), bounds.RightTop());
	
		SetHighColor(ui_color(B_SHINE_COLOR));
		StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
		bounds.top++;
		bounds.bottom--;
		StrokeLine(bounds.RightBottom(), bounds.RightTop());
	}
}
Ejemplo n.º 2
0
void HDlogView::Draw(BRect update)
{
	BView::Draw(update);

	if (fLines.size() > 0)
	{
		vector<BRect>::iterator ri;
		
		BeginLineArray(fLines.size() * 2);
		for (ri = fLines.begin(); ri != fLines.end(); ri++)
		{
			BRect r = *ri;
			if (r.Width() > r.Height())
			{
				AddLine(r.LeftTop(), r.RightTop(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
				AddLine(r.LeftBottom(), r.RightBottom(), kWhite);
			}
			else
			{
				AddLine(r.LeftTop(), r.LeftBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
				AddLine(r.RightTop(), r.RightBottom(), kWhite);
			}
		}
		EndLineArray();
	}
} /* HDlogView::Draw */
Ejemplo n.º 3
0
void BarView :: Draw( BRect r )
{
	r = Bounds() ;
	BeginLineArray( 4 ) ;

	AddLine( r.LeftTop() ,
	         ( fOrientation == B_VERTICAL ? r.LeftBottom() : r.RightTop() ) ,
	         Colours::Grey40 ) ;
	AddLine( r.RightBottom() ,
	         ( fOrientation == B_VERTICAL ? r.RightTop() : r.LeftBottom() ) ,
	         Colours::Grey40 ) ;

	if( fOrientation == B_VERTICAL )
		r.InsetBy(1,0) ;
	else
		r.InsetBy(0,1) ;
	
	AddLine( r.LeftTop() ,
	         ( fOrientation == B_VERTICAL ? r.LeftBottom() : r.RightTop() ) ,
	         Colours::White ) ;
	AddLine( r.RightBottom() ,
	         ( fOrientation == B_VERTICAL ? r.RightTop() : r.LeftBottom() ) ,
	         Colours::Grey25 ) ;
	
	EndLineArray() ;
}
Ejemplo n.º 4
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
void BmCaption::Draw( BRect updateRect) {
	BRect r = Bounds();
	if (mHighlight) {
		if (BeamOnDano)
			SetLowColor( keyboard_navigation_color());
		else {
			rgb_color highlightCol = {255, 217, 121, 255};
			SetLowColor( highlightCol);
		}
	}
	else
		SetLowColor( ui_color( B_PANEL_BACKGROUND_COLOR));
#ifndef __HAIKU__
	FillRect( r.InsetByCopy(1.0, 1.0), B_SOLID_LOW);
#else
	FillRect( BRect(r.top + 1, r.left + 1, r.right, r.bottom - 1), B_SOLID_LOW);
#endif
	SetHighColor( ui_color( B_SHINE_COLOR));
	StrokeLine( BPoint(0.0,1.0), BPoint(r.right,1.0));
	StrokeLine( BPoint(0.0,1.0), r.LeftBottom());
	SetHighColor( BmWeakenColor( B_SHADOW_COLOR, BeShadowMod));
	if (BeamOnDano)
		StrokeLine( r.RightTop(), r.RightBottom());
#ifndef __HAIKU__
	else
		// looks better on R5, as it blends with scrollbar:
		StrokeLine( r.RightTop(), r.RightBottom(), B_SOLID_LOW);
#endif
	StrokeLine( r.LeftTop(), r.RightTop());
	StrokeLine( r.LeftBottom(), r.RightBottom());

	SetHighColor( ui_color( B_PANEL_TEXT_COLOR));
	font_height fInfo;
	BFont captionFont;
	GetFont(&captionFont);
	captionFont.GetHeight( &fInfo);
	float offset = (1.0f+r.Height()-(fInfo.ascent+fInfo.descent))/2.0f;
	float freeWidth = r.Width();
	if (mHighlight && mHighlightLabel.Length()) {
		freeWidth -= StringWidth(mHighlightLabel.String())+2;
		BPoint pos( 2.0, fInfo.ascent+offset);
		DrawString( mHighlightLabel.String(), pos);
	}
	const char* text = mText.String();
	float width;
	while(1) {
		width = StringWidth(text);
		if (width+4.0 < freeWidth)
			break;
		text++;
		while((*text & 0xc0) == 0x80)
			text++;		// skip UTF8 subsequence chars
		if (!*text)
			break;
	}
	BPoint pos( r.Width()-width-2.0f, fInfo.ascent+offset);
	DrawString( text, pos);
}
Ejemplo n.º 5
0
void TPanelWindowView::Draw( BRect updateRect )
{
	BRegion Region;
	Region.Include(updateRect);
	ConstrainClippingRegion(&Region);

	float w, h;

	w = Bounds().Width();
	h = Bounds().Height();

	SetHighColor( fColor2 );
	FillRect( BRect( 0, 0, h, h ) );
	FillRect( BRect( w-h, 0, w, h ) );

	FillRect( BRect( h/2, 0, w-(h/2), h/2) );
	FillRect( BRect( 0, h/2, w, h ) );

	SetHighColor( 196, 196, 176 );
	FillRect( BRect( 0, h - 2, w, h ) );

	fPanels.Lock();
	for ( int i=0; i<fPanels.CountItems(); i++ )
	{
		TInnerPanel *panel = fPanels.ItemAt(i);
		if ( panel->Frame().Intersects( updateRect ) )
		{
			BRect rect( panel->Frame() );
			if ( rect.left < updateRect.left )
				rect.left = updateRect.left;
			if ( rect.right > updateRect.right )
				rect.right = updateRect.right;
			if ( rect.top < updateRect.top )
				rect.top = updateRect.top;
			if ( rect.bottom > updateRect.bottom )
				rect.bottom = updateRect.bottom;
			panel->Draw(rect);
		}
	}
	fPanels.Unlock();

	if ( fDrawOuterFrame )
	{
		SetDrawingMode( B_OP_COPY );
		SetHighColor( fOuterFrameColor );

		BRect bounds = Bounds();
		StrokeLine( bounds.LeftTop(), bounds.RightTop() );
		StrokeLine( bounds.LeftTop(), bounds.LeftBottom() );
		StrokeLine( bounds.RightTop(), bounds.RightBottom() );
	}

	ConstrainClippingRegion(NULL);
}
Ejemplo n.º 6
0
void Mover::Draw(BRect rect)
{
    /*	BRect r = Bounds();
    	r.top+=1;
    	r.left+=1;
    	r.right-=1;
    	r.bottom-=1;

    	SetHighColor(192,192,192);
    	FillRect(r);

    	r=Bounds();
    	SetHighColor(255,255,255);
    	StrokeLine(r.LeftBottom(),r.LeftTop());
    	StrokeLine(r.LeftTop(),r.RightTop());

    	SetHighColor(168,168,168);
    	StrokeLine(r.RightTop(),r.RightBottom());
    	StrokeLine(r.RightBottom(),r.LeftBottom());

    	SetHighColor(208,208,208);
    	StrokeLine(r.LeftBottom(),r.LeftBottom());
    	StrokeLine(r.RightTop(),r.RightTop());
    */
    BRect r = Bounds();
    SetHighColor(152,152,152);
    if (vertical)
    {
        StrokeLine(r.LeftTop(),r.LeftBottom());
        StrokeLine(r.RightTop()+BPoint(-1,0),r.RightBottom()+BPoint(-1,0));
        StrokeLine(r.RightTop(),r.RightBottom());
    }
    else
    {
        StrokeLine(r.LeftTop(),r.RightTop());
        StrokeLine(r.LeftBottom()+BPoint(0,-1),r.RightBottom()+BPoint(0,-1));
        StrokeLine(r.LeftBottom(),r.RightBottom());
    }

    SetHighColor(255,255,255);
    if (vertical)
        StrokeLine(r.LeftTop()+BPoint(1,0),r.LeftBottom()+BPoint(1,0));
    else
        StrokeLine(r.LeftTop()+BPoint(0,1),r.RightTop()+BPoint(0,1));

    SetHighColor(232,232,232);
    if (vertical)
        StrokeLine(r.RightTop()+BPoint(-2,0),r.RightBottom()+BPoint(-2,0));
    else
        StrokeLine(r.LeftBottom()+BPoint(0,-2),r.RightBottom()+BPoint(0,-2));
}
Ejemplo n.º 7
0
void
_MediaSlider_::UpdateThumb(
	bool	force)
{
	fBitmap->Lock();

	BRect bounds = fOffscreenView->Bounds();

	bounds.left += 2.0;
	bounds.right -= kThumbWidth + 3.0;

	BRect thumbRect = fThumbRect;
	thumbRect.OffsetTo(bounds.left + (bounds.right * ((float)fCurTime / (float)fTotalTime)), thumbRect.top);

	if ((!force) && (thumbRect == fThumbRect)) {
		fBitmap->Unlock();
		return;
	}

	fOffscreenView->SetLowColor(kSliderBackgroundColor);
	fOffscreenView->FillRect(fThumbRect, B_SOLID_LOW);

	BRect drawRect = fThumbRect | thumbRect;
	fThumbRect = thumbRect;

	fOffscreenView->SetHighColor(kBlack);
	fOffscreenView->StrokeRect(thumbRect, B_SOLID_HIGH);
	thumbRect.InsetBy(1.0, 1.0);

	fOffscreenView->BeginLineArray(4);
	fOffscreenView->AddLine(thumbRect.RightTop(), thumbRect.RightBottom(), kThumbDarkColor);
	fOffscreenView->AddLine(thumbRect.RightBottom(), thumbRect.LeftBottom(), kThumbDarkColor);
	fOffscreenView->AddLine(thumbRect.LeftBottom(), thumbRect.LeftTop(), kThumbLightColor);
	fOffscreenView->AddLine(thumbRect.LeftTop(), thumbRect.RightTop(), kThumbLightColor);
	fOffscreenView->EndLineArray();	
	thumbRect.InsetBy(1.0, 1.0);

	fOffscreenView->SetHighColor(kThumbBackgroundColor);
	fOffscreenView->FillRect(thumbRect, B_SOLID_HIGH);

	fOffscreenView->Sync();
	fBitmap->Unlock();

	BPoint	drawLoc(0.0, (Bounds().Height() - kSliderHeight) / 2);
	BRect	dstRect = drawRect;
	dstRect.OffsetBy(drawLoc);
	DrawBitmap(fBitmap, drawRect, dstRect);
}
Ejemplo n.º 8
0
void
_MediaBar_::Draw(
	BRect	updateRect)
{
	BRect		bounds = Bounds();
	rgb_color	viewColor = ViewColor();
	rgb_color	light = {255, 255, 255, 255};
	rgb_color	dark = tint_color(viewColor, B_DARKEN_3_TINT);

	BeginLineArray(4);
	AddLine(bounds.RightTop(), bounds.RightBottom(), dark);
	AddLine(bounds.RightBottom(), bounds.LeftBottom(), dark);
	AddLine(bounds.LeftBottom(), bounds.LeftTop(), light);
	AddLine(bounds.LeftTop(), bounds.RightTop(), light);
	EndLineArray();
}
Ejemplo n.º 9
0
// ToolDraw
void
PickManipulator::ToolDraw(BView* into, BRect itemFrame)
{
	if (itemFrame.IntegerWidth() < 4)
		return;

	itemFrame.InsetBy(1, 1);
	int32 dotCount = itemFrame.IntegerHeight() / 3;

	BPoint p(itemFrame.LeftTop());
	for (int32 i = 0; i < dotCount; i++) {
		into->SetHighColor(0, 0, 0, 75);
		into->StrokeLine(p, p);
		p = p + BPoint(1, 1);
		into->SetHighColor(255, 255, 255, 200);
		into->StrokeLine(p, p);
		p = p + BPoint(-1, 2);
	}

	itemFrame.right--;
	if (itemFrame.IntegerWidth() < 6)
		return;

	p = itemFrame.RightTop();
	for (int32 i = 0; i < dotCount; i++) {
		into->SetHighColor(0, 0, 0, 75);
		into->StrokeLine(p, p);
		p = p + BPoint(1, 1);
		into->SetHighColor(255, 255, 255, 200);
		into->StrokeLine(p, p);
		p = p + BPoint(-1, 2);
	}
}
Ejemplo n.º 10
0
// SetOrigin
void
DragCornerState::SetOrigin(BPoint origin)
{
	fOldTransform = *fParent;

	fOldTransform.InverseTransform(&origin);

	BRect box = fParent->Box();
	switch (fCorner) {
		case LEFT_TOP_CORNER:
			fOffsetFromCorner = origin - box.LeftTop();
			break;
		case RIGHT_TOP_CORNER:
			fOffsetFromCorner = origin - box.RightTop();
			break;
		case LEFT_BOTTOM_CORNER:
			fOffsetFromCorner = origin - box.LeftBottom();
			break;
		case RIGHT_BOTTOM_CORNER:
			fOffsetFromCorner = origin - box.RightBottom();
			break;
	}

	DragState::SetOrigin(origin);
}
Ejemplo n.º 11
0
void
AppGroupView::_DrawCloseButton(const BRect& updateRect)
{
	PushState();
	BRect closeRect = fCloseRect;

	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
	float tint = B_DARKEN_2_TINT;

	if (fCloseClicked) {
		BRect buttonRect(closeRect.InsetByCopy(-4, -4));
		be_control_look->DrawButtonFrame(this, buttonRect, updateRect,
			base, base,
			BControlLook::B_ACTIVATED | BControlLook::B_BLEND_FRAME);
		be_control_look->DrawButtonBackground(this, buttonRect, updateRect,
			base, BControlLook::B_ACTIVATED);
		tint *= 1.2;
		closeRect.OffsetBy(1, 1);
	}

	base = tint_color(base, tint);
	SetHighColor(base);
	SetPenSize(2);
	StrokeLine(closeRect.LeftTop(), closeRect.RightBottom());
	StrokeLine(closeRect.LeftBottom(), closeRect.RightTop());
	PopState();
}
Ejemplo n.º 12
0
void DropView::Draw(BRect update)
{
	BRect bounds = Bounds();
	//draw our bevel
	// top and left edges
	SetHighColor(150,150,150,255); // dark grey
	StrokeLine(bounds.LeftTop(), bounds.RightTop());
	StrokeLine(bounds.LeftTop(), bounds.LeftBottom());
	// bottom and right edges
	SetHighColor(250,250,250,255); // lightest grey
	StrokeLine(bounds.RightBottom(), BPoint(bounds.right, bounds.top - 1.0));
	StrokeLine(bounds.RightBottom(), BPoint(bounds.left - 1.0, bounds.bottom));
	
	// draw our highlight, or don't
	if (drawHighlight)
	{
		SetHighColor(highlightColor);
		StrokeRect(highlightRect);
	}
	
	// draw our icon
	if (hasOccupant)
	{
		SetDrawingMode(B_OP_OVER);
		DrawBitmap(iconBitmap, BPoint(3.0, 3.0));
	}
	else
		DrawBitmap(iconBitmapDark, BPoint(3.0, 3.0));
}
Ejemplo n.º 13
0
void SpinButton::DrawButton(BRect rect, int32 button)
{
    rgb_color color = ViewColor();

    rgb_color topColor = tint_color(color,
                                    button == kSpinButtonNone ?
                                    (IsEnabled() ? B_DARKEN_2_TINT : B_DARKEN_2_TINT) :
                                    (button == fButton ? B_DARKEN_1_TINT : B_LIGHTEN_MAX_TINT));

    rgb_color bottomColor = tint_color(color,
                                       button == kSpinButtonNone ?
                                       (IsEnabled() ? B_DARKEN_4_TINT : B_DARKEN_3_TINT) :
                                       (button == fButton ? B_LIGHTEN_2_TINT : B_DARKEN_1_TINT));

    BeginLineArray(4);

    AddLine(rect.LeftBottom(), rect.LeftTop(), topColor);
    AddLine(rect.LeftTop(), rect.RightTop(), topColor);

    AddLine(rect.RightTop(), rect.RightBottom(), bottomColor);
    AddLine(rect.RightBottom(), rect.LeftBottom(), bottomColor);

    EndLineArray();

    if (button != kSpinButtonNone) {
        rect.InsetBy(1, 1);
        SetHighColor(tint_color(color, B_LIGHTEN_1_TINT));
        FillRect(rect);

        BPoint point(0.5f * (rect.left + rect.right) - 2.0f,
                     0.5f * (rect.top + rect.bottom) - 0.25f +
                     (button == kSpinButtonUp ? 1.0f : -1.0f) +
                     (button == fButton ? 1.0f : 0.0f));

        rgb_color arrowColor = tint_color(color,
                                          IsEnabled() ? B_DARKEN_4_TINT : B_DISABLED_LABEL_TINT);

        BeginLineArray(3);

        for (int32 delta = 0; delta < 3; delta++) {
            AddLine(point, point + BPoint(4 - delta - delta, 0), arrowColor);
            point += BPoint(1, button == kSpinButtonUp ? -1 : 1);
        }

        EndLineArray();
    }
}
Ejemplo n.º 14
0
void NetListItem::DrawItem(BView *owner, BRect itemRect, bool drawEverything = false)
{
	rgb_color bgColor = {255, 255, 255, 255};
	switch(fType)
	{
		case INFO_EVENT:
			bgColor.blue = 220;
		break;
		case DATA_RECEIVED_EVENT:
			bgColor.red = 128;
			bgColor.green = 128;
		break;
		case DATA_SENT_EVENT:
			bgColor.green = 128;
			bgColor.blue = 128;
		break;
		default:
			bgColor = ui_color(B_PANEL_BACKGROUND_COLOR);
		break;
	}

	owner->SetHighColor(bgColor);
	owner->FillRect(itemRect);
			
	rgb_color tintedColor = tint_color(bgColor, B_DARKEN_2_TINT);
	owner->SetHighColor(tintedColor);
	owner->StrokeLine(itemRect.LeftBottom(), itemRect.RightBottom());
	owner->StrokeLine(itemRect.RightTop(), itemRect.RightBottom());
	
	tintedColor = tint_color(bgColor, B_LIGHTEN_2_TINT);
	owner->SetHighColor(tintedColor);
	owner->StrokeLine(itemRect.LeftTop(), itemRect.RightTop());
	owner->StrokeLine(itemRect.LeftTop(), itemRect.LeftBottom());
	
	owner->SetLowColor(bgColor);
	owner->SetHighColor(0, 0, 0, 255);
	
	BPoint stringPos = itemRect.LeftTop();
	stringPos.x += 4;
	stringPos.y += fFontAscent + 2;
	
	for(int lineNum = 0; fStartChar[lineNum] > -1; lineNum++)
	{ 
		owner->DrawString(&fText[fStartChar[lineNum]], fLineLen[lineNum], stringPos);
		stringPos.y += fLineHeight;
	}
}
Ejemplo n.º 15
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));
}
Ejemplo n.º 16
0
void
Renamer::Draw(BRect updateRect)
{
	BRect LittleRect = Bounds().InsetByCopy(1.0, 1.0);

	SetHighColor(170, 170, 190);
	MovePenTo(LittleRect.RightTop());
	StrokeLine(LittleRect.LeftTop());
	StrokeLine(LittleRect.LeftBottom());

	SetHighColor(220, 220, 225);
	StrokeLine(LittleRect.RightBottom());
	StrokeLine(LittleRect.RightTop());
	
	SetHighColor(60, 80, 150);
	StrokeRect(Bounds());
}
Ejemplo n.º 17
0
void
WinDecorator::_DrawFrame(BRect rect)
{
	if (fLook == B_NO_BORDER_WINDOW_LOOK)
		return;

	if (fBorderRect == fFrame)
		return;

	BRect r = fBorderRect;
	
	fDrawingEngine->SetHighColor(frame_lowercol);
	fDrawingEngine->StrokeRect(r);

	if (fLook == B_BORDERED_WINDOW_LOOK)
		return;
	
	BPoint pt;

	pt=r.RightTop();
	pt.x--;
	fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol);
	pt=r.LeftBottom();
	pt.y--;
	fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_midcol);

	fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowercol);
	fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowercol);
	
	r.InsetBy(1,1);
	pt=r.RightTop();
	pt.x--;
	fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol);
	pt=r.LeftBottom();
	pt.y--;
	fDrawingEngine->StrokeLine(r.LeftTop(),pt,frame_highcol);

	fDrawingEngine->StrokeLine(r.RightTop(),r.RightBottom(),frame_lowcol);
	fDrawingEngine->StrokeLine(r.LeftBottom(),r.RightBottom(),frame_lowcol);
	
	r.InsetBy(1,1);
	fDrawingEngine->StrokeRect(r,frame_midcol);
	r.InsetBy(1,1);
	fDrawingEngine->StrokeRect(r,frame_midcol);
}
Ejemplo n.º 18
0
void OptionsPanel :: Draw( BRect r )
{
	inherited::Draw( r ) ;
	
	r = Bounds() ;
	BeginLineArray( 1 ) ;
	AddLine( r.LeftTop()    , r.RightTop()    , Colours::Grey85 ) ;
	EndLineArray( ) ;
}
Ejemplo n.º 19
0
void
MacDecorator::_DrawZoom(BRect r)
{
    bool down = GetZoom();

    // Just like DrawZoom, but for a close button
    BRect rect(r);
    BPoint offset(r.LeftTop()),pt2(r.RightTop());

    pt2.x--;
    fDrawState.SetHighColor(RGBColor(136, 136, 136));
    fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());

    pt2 = r.LeftBottom();
    pt2.y--;
    fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());

    offset = r.RightBottom();
    pt2 = r.RightTop();
    pt2.y++;
    fDrawState.SetHighColor(RGBColor(255, 255, 255));
    fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());

    pt2 = r.LeftBottom();
    pt2.x++;
    fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());

    rect.InsetBy(1, 1);
    fDrawState.SetHighColor(RGBColor(0, 0, 0));
    fDrawingEngine->StrokeRect(rect, fDrawState.HighColor());

    rect.InsetBy(1, 1);
    _DrawBlendedRect(fDrawingEngine, rect, down);
    rect.InsetBy(1,1);
    _DrawBlendedRect(fDrawingEngine, rect, !down);

    rect.top += 2;
    rect.left--;
    rect.right++;

    fDrawState.SetHighColor(RGBColor(0, 0, 0));
    fDrawingEngine->StrokeLine(rect.LeftTop(), rect.RightTop(),
                               fDrawState.HighColor());
}
Ejemplo n.º 20
0
	// SimpleItem interface
	virtual	void Draw(BView* owner, BRect itemFrame, uint32 flags)
	{
		SimpleItem::DrawBackground(owner, itemFrame, flags);

		// text
		if (IsSelected())
			owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
		else
			owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
		font_height fh;
		owner->GetFontHeight(&fh);
		BString truncatedString(Text());
		owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
			itemFrame.Width() - kBorderOffset - kMarkWidth - kTextOffset
			- kBorderOffset);
		float height = itemFrame.Height();
		float textHeight = fh.ascent + fh.descent;
		BPoint pos;
		pos.x = itemFrame.left + kBorderOffset + kMarkWidth + kTextOffset;
		pos.y = itemFrame.top + ceilf((height - textHeight) / 2.0 + fh.ascent);
		owner->DrawString(truncatedString.String(), pos);

		if (!fMarkEnabled)
			return;

		// mark
		BRect markRect = itemFrame;
		float markRectBorderTint = B_DARKEN_1_TINT;
		float markRectFillTint = 1.04;
		float markTint = B_DARKEN_4_TINT;
					// Dark Themes
		rgb_color lowColor = owner->LowColor();
		if (lowColor.red + lowColor.green + lowColor.blue < 128 * 3) {
			markRectBorderTint = B_LIGHTEN_2_TINT;
			markRectFillTint = 0.85;
			markTint = 0.1;
		}
		markRect.left += kBorderOffset;
		markRect.right = markRect.left + kMarkWidth;
		markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
		markRect.bottom = markRect.top + kMarkWidth;
		owner->SetHighColor(tint_color(owner->LowColor(), markRectBorderTint));
		owner->StrokeRect(markRect);
		markRect.InsetBy(1, 1);
		owner->SetHighColor(tint_color(owner->LowColor(), markRectFillTint));
		owner->FillRect(markRect);
		if (fMarked) {
			markRect.InsetBy(2, 2);
			owner->SetHighColor(tint_color(owner->LowColor(),
				markTint));
			owner->SetPenSize(2);
			owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
			owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
			owner->SetPenSize(1);
		}
	}
Ejemplo n.º 21
0
static void testSetDrawingMode(BView *view, BRect frame)
{
	frame.InsetBy(2, 2);
	view->StrokeLine(frame.LeftTop(), frame.RightBottom());
	view->StrokeLine(frame.LeftBottom(), frame.RightTop());
	view->SetDrawingMode(B_OP_ALPHA);
	rgb_color color = kRed;
	color.alpha = 127;	
	view->SetHighColor(color);
	view->FillRect(frame, B_SOLID_HIGH);
}
Ejemplo n.º 22
0
void
MacDecorator::_DrawClose(BRect r)
{
    bool down = GetClose();

    // Just like DrawZoom, but for a close button
    BRect rect(r);

    BPoint offset(r.LeftTop()), pt2(r.RightTop());

    // Topleft dark grey border
    pt2.x--;
    fDrawingEngine->SetHighColor(RGBColor(136, 136, 136));
    fDrawingEngine->StrokeLine(offset, pt2);

    pt2 = r.LeftBottom();
    pt2.y--;
    fDrawingEngine->StrokeLine(offset, pt2);

    // Bottomright white border
    offset = r.RightBottom();
    pt2 = r.RightTop();
    pt2.y++;
    fDrawingEngine->SetHighColor(RGBColor(255, 255, 255));
    fDrawingEngine->StrokeLine(offset, pt2);

    pt2 = r.LeftBottom();
    pt2.x++;
    fDrawingEngine->StrokeLine(offset, pt2);

    // Black outline
    rect.InsetBy(1, 1);
    fDrawingEngine->SetHighColor(RGBColor(0, 0, 0));
    fDrawingEngine->StrokeRect(rect);

    // Double-shaded button
    rect.InsetBy(1, 1);
    _DrawBlendedRect(fDrawingEngine, rect, down);
    rect.InsetBy(1, 1);
    _DrawBlendedRect(fDrawingEngine, rect, !down);
}
Ejemplo n.º 23
0
void TCuePosition::Outline(BRect outline)
{
	// Use the rect for the four corners
	Corner1(outline.LeftTop());
	Corner2(outline.RightTop());
	Corner3(outline.RightBottom());
	Corner4(outline.LeftBottom());

	// Set the registration in the center
	BPoint center(outline.left + outline.Width() / 2, outline.top +
			outline.Height() / 2);
	Registration(center);
}
Ejemplo n.º 24
0
void HTabSheet::Draw(BRect update)
{
	BRect f;
	BPoint p;

	font_height fh;
	be_plain_font->GetHeight(&fh);

	f = fClientArea;
	f.top = fListArea.top;
	f.bottom = ceil(fClientArea.top - 8 * gFactor);

	f.InsetBy(2, 2);
	
	SetLowColor(0x77, 0xdd, 0xdd);
	FillRect(f, B_SOLID_LOW);

	p.x = f.left + 4;
	p.y = f.bottom - fh.descent;
	DrawString((char *)fDescs.ItemAt(fCurrent), p);
	SetLowColor(ViewColor());

	BeginLineArray(8);

	f.InsetBy(-2, -2);
	AddLine(f.LeftTop(), f.RightTop(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	AddLine(f.LeftTop(), f.LeftBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	AddLine(f.RightTop(), f.RightBottom(), kWhite);
	AddLine(f.LeftBottom(), f.RightBottom(), kWhite);
	
	f.InsetBy(1, 1);
	AddLine(f.LeftTop(), f.RightTop(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
	AddLine(f.LeftTop(), f.LeftBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
	AddLine(f.RightTop(), f.RightBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	AddLine(f.LeftBottom(), f.RightBottom(), tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
	
	EndLineArray();
} /* HTabSheet::Draw */
Ejemplo n.º 25
0
// Adapted from c.lenz' ToolTipView::Draw()
void TipView::Draw(
	BRect										updateRect) {

	BRect r = Bounds();

	// Draw border and fill
	SetDrawingMode(B_OP_ALPHA);
	SetHighColor(m_borderLoColor);
	StrokeLine(r.LeftBottom(), r.RightBottom());
	StrokeLine(r.RightTop(), r.RightBottom());
	SetHighColor(m_borderHiColor);
	StrokeLine(r.LeftTop(), r.RightTop());
	StrokeLine(r.LeftTop(), r.LeftBottom());
	SetHighColor(m_viewColor);
	SetDrawingMode(B_OP_ALPHA);
	r.InsetBy(1.0, 1.0);
	FillRect(r);

	// Draw text
	SetDrawingMode(B_OP_OVER);
	SetHighColor(m_textColor);
	
	BPoint p = m_offset;
	for(uint32 n = 0; n < m_lineSet.size(); ++n) {
		
		uint32 from = m_lineSet[n];
		uint32 to = (n < m_lineSet.size()-1) ? m_lineSet[n+1]-1 :
			m_text.Length();
		
		if(to > from)
			DrawString(
				m_text.String() + from,
				to - from,
				p);
			
		p.y += (m_fontHeight.ascent + m_fontHeight.descent + m_fontHeight.leading);
	}
}
Ejemplo n.º 26
0
/**
	Draws space between child views.
*/
void SplitView::DrawSplitter(BRect frame, bool active)
{
	// Do not cache ui_color values, they may change anytime.
	rgb_color back = ui_color(B_PANEL_BACKGROUND_COLOR);
	rgb_color hi = tint_color(back, B_LIGHTEN_1_TINT);
	rgb_color lo = tint_color(back, B_DARKEN_1_TINT);

	// Border
	BeginLineArray(4);
	AddLine(frame.LeftTop(), frame.RightTop(), hi);
	AddLine(frame.LeftTop(), frame.LeftBottom(), hi);
	AddLine(frame.RightBottom(), frame.LeftBottom(), lo);
	AddLine(frame.RightBottom(), frame.RightTop(), lo);
	EndLineArray();

	// Background
	frame.InsetBy(1,1);
	SetLowColor(back);
	SetHighColor(tint_color(back, B_LIGHTEN_MAX_TINT));
	//SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
	FillRect(frame, active ? B_MIXED_COLORS : B_SOLID_LOW);
	
}
Ejemplo n.º 27
0
// paint border & background
void TempoView::Draw(BRect rect) {
	BRect bounds = Bounds();

	// colors:
	rgb_color borderHi = {153,153,153,255};
	rgb_color borderSh = {87,87,87,255};
	rgb_color edgeHi = {244,244,244,255};
	rgb_color edgeSh = {197,197,197,255};
	
	// draw the outer border:
	
	// top-left
	SetHighColor(edgeHi);
	StrokeLine(bounds.LeftTop(), bounds.RightTop());
	StrokeLine(bounds.LeftTop(), bounds.LeftBottom()-BPoint(0,1));
	
	// bottom-right
	SetHighColor(borderSh);
	StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
	StrokeLine(bounds.RightTop(), bounds.RightBottom()-BPoint(0,1));
	SetHighColor(borderHi);
	bounds.bottom--;
	StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
}
Ejemplo n.º 28
0
    // SimpleItem interface
    virtual	void	Draw(BView* owner, BRect itemFrame, uint32 flags)
    {
        SimpleItem::DrawBackground(owner, itemFrame, flags);

        // text
        owner->SetHighColor(0, 0, 0, 255);
        font_height fh;
        owner->GetFontHeight(&fh);
        BString truncatedString(Text());
        owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
                              itemFrame.Width()
                              - kBorderOffset
                              - kMarkWidth
                              - kTextOffset
                              - kBorderOffset);
        float height = itemFrame.Height();
        float textHeight = fh.ascent + fh.descent;
        BPoint pos;
        pos.x = itemFrame.left
                + kBorderOffset + kMarkWidth + kTextOffset;
        pos.y = itemFrame.top
                + ceilf((height - textHeight) / 2.0 + fh.ascent);
        owner->DrawString(truncatedString.String(), pos);

        if (!fMarkEnabled)
            return;

        // mark
        BRect markRect = itemFrame;
        markRect.left += kBorderOffset;
        markRect.right = markRect.left + kMarkWidth;
        markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
        markRect.bottom = markRect.top + kMarkWidth;
        owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_1_TINT));
        owner->StrokeRect(markRect);
        markRect.InsetBy(1, 1);
        owner->SetHighColor(tint_color(owner->LowColor(), 1.04));
        owner->FillRect(markRect);
        if (fMarked) {
            markRect.InsetBy(2, 2);
            owner->SetHighColor(tint_color(owner->LowColor(),
                                           B_DARKEN_4_TINT));
            owner->SetPenSize(2);
            owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
            owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
            owner->SetPenSize(1);
        }
    }
Ejemplo n.º 29
0
void PatternMenuButton::Draw (BRect update)
{
	extern ColorMenuButton *locolor, *hicolor;
	rgb_color Hi = hicolor->color();
	rgb_color Lo = locolor->color();
	update = Bounds();
	SetHighColor (Hi);
	SetLowColor (Lo);
	FillRect (update, pat());
	SetHighColor (Grey8);
	SetDrawingMode (B_OP_ADD);
	StrokeLine (update.LeftBottom(), update.LeftTop());
	StrokeLine (update.RightTop());
	SetDrawingMode (B_OP_SUBTRACT);
	StrokeLine (update.RightBottom());
	StrokeLine (update.LeftBottom());
}
Ejemplo n.º 30
0
void WebTabView::_DrawCloseButton(BView* owner, BRect& frame,
	const BRect& updateRect, bool isFirst, bool isLast, bool isFront)
{
	BRect closeRect = _CloseRectFrame(frame);
	frame.right = closeRect.left - be_control_look->DefaultLabelSpacing();

	closeRect.left = (closeRect.left + closeRect.right) / 2 - 3;
	closeRect.right = closeRect.left + 6;
	closeRect.top = (closeRect.top + closeRect.bottom) / 2 - 3;
	closeRect.bottom = closeRect.top + 6;

	rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
	float tint = B_DARKEN_1_TINT;
	if (!IsFront()) {
		base = tint_color(base, tint);
		tint *= 1.02;
	}

	if (fOverCloseRect)
		tint *= 1.4;
	else
		tint *= 1.2;

	if (fClicked && fOverCloseRect) {
		// Draw the button frame
		BRect buttonRect(closeRect.InsetByCopy(-4, -4));
		be_control_look->DrawButtonFrame(owner, buttonRect, updateRect,
			base, base,
			BControlLook::B_ACTIVATED | BControlLook::B_BLEND_FRAME);
		be_control_look->DrawButtonBackground(owner, buttonRect, updateRect,
			base, BControlLook::B_ACTIVATED);
		closeRect.OffsetBy(1, 1);
		tint *= 1.2;
	}

	// Draw the ×
	base = tint_color(base, tint);
	owner->SetHighColor(base);
	owner->SetPenSize(2);
	owner->StrokeLine(closeRect.LeftTop(), closeRect.RightBottom());
	owner->StrokeLine(closeRect.LeftBottom(), closeRect.RightTop());
	owner->SetPenSize(1);
}