Ejemplo n.º 1
0
void FolderPanel :: AttachedToWindow( void )
{
	BRect r ;
	if( Parent() )
		r = Parent()->Frame() ;
	else
		r = Window()->Frame() ;
	
	font_height fh ;
	GetFontHeight( &fh ) ;
	
	r.top = 0 ;
	r.right = r.Width() ;
	r.left = 0 ;  
	r.bottom = 3 * (fh.ascent + fh.descent + fh.leading ) ;
	
	MoveTo( 0,0 ) ;
	ResizeTo( r.right, r.bottom ) ;
		
	r.left    = 25 ;
	r.right   = r.right - r.left ;
	r.top     = r.Height()/5 ;
	r.bottom  = r.bottom - r.top ;
	
	fpFolderPU->MoveTo( r.left , r.top ) ;
	fpFolderPU->ResizeTo( r.Width() , r.Height() ) ;

	fpFolderPU->SetViewColor( ViewColor() ) ;
	fpFolderPU->SetLowColor( ViewColor() ) ;

	AddChild( fpFolderPU ) ;
}
Ejemplo n.º 2
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);
}
void
LanguageListView::Draw(BRect updateRect)
{
	BOutlineListView::Draw(updateRect);

	if (fDropIndex >= 0 && fDropTargetHighlightFrame.IsValid()) {
		// TODO: decide if drawing of a drop target indicator should be moved
		//       into ControlLook
		BGradientLinear gradient;
		int step = fGlobalDropTargetIndicator ? 64 : 128;
		for (int i = 0; i < 256; i += step)
			gradient.AddColor(i % (step * 2) == 0
				? ViewColor() : ui_color(B_CONTROL_HIGHLIGHT_COLOR), i);
		gradient.AddColor(ViewColor(), 255);
		gradient.SetStart(fDropTargetHighlightFrame.LeftTop());
		gradient.SetEnd(fDropTargetHighlightFrame.RightBottom());
		if (fGlobalDropTargetIndicator) {
			BRegion region(fDropTargetHighlightFrame);
			region.Exclude(fDropTargetHighlightFrame.InsetByCopy(2.0, 2.0));
			ConstrainClippingRegion(&region);
			FillRect(fDropTargetHighlightFrame, gradient);
			ConstrainClippingRegion(NULL);
		} else
			FillRect(fDropTargetHighlightFrame, gradient);
	}
}
Ejemplo n.º 4
0
void ArpDocumentButton::AttachedToWindow()
{
	inherited::AttachedToWindow();
	#if 0
	if( ViewColor() != B_TRANSPARENT_COLOR ) SetLowColor(ViewColor());
	else SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR));
	#endif
	SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR));
	SetViewColor(B_TRANSPARENT_COLOR);
}
Ejemplo n.º 5
0
void
WorkspacesView::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
	BRegion* windowContentClipping, bool deep)
{
	// we can only draw within our own area
	BRegion redraw(ScreenAndUserClipping(windowContentClipping));
	// add the current clipping
	redraw.IntersectWith(effectiveClipping);

	int32 columns, rows;
	_GetGrid(columns, rows);

	// draw grid

	// make sure the grid around the active workspace is not drawn
	// to reduce flicker
	BRect activeRect = _WorkspaceAt(Window()->Desktop()->CurrentWorkspace());
	BRegion gridRegion(redraw);
	gridRegion.Exclude(activeRect);
	drawingEngine->ConstrainClippingRegion(&gridRegion);

	BRect frame = Bounds();
	ConvertToScreen(&frame);

	// horizontal lines

	drawingEngine->StrokeLine(BPoint(frame.left, frame.top),
		BPoint(frame.right, frame.top), ViewColor());

	for (int32 row = 0; row < rows; row++) {
		BRect rect = _WorkspaceAt(row * columns);
		drawingEngine->StrokeLine(BPoint(frame.left, rect.bottom),
			BPoint(frame.right, rect.bottom), ViewColor());
	}

	// vertical lines

	drawingEngine->StrokeLine(BPoint(frame.left, frame.top),
		BPoint(frame.left, frame.bottom), ViewColor());

	for (int32 column = 0; column < columns; column++) {
		BRect rect = _WorkspaceAt(column);
		drawingEngine->StrokeLine(BPoint(rect.right, frame.top),
			BPoint(rect.right, frame.bottom), ViewColor());
	}

	drawingEngine->ConstrainClippingRegion(&redraw);

	// draw workspaces

	for (int32 i = rows * columns; i-- > 0;) {
		_DrawWorkspace(drawingEngine, redraw, i);
	}
	fWindow->ServerWindow()->ResyncDrawState();
}
Ejemplo n.º 6
0
void
SLoadingModulesViewLight::ReGetBitmap()
{
	BWindow *window = Window();
	if(!window) return;

	bool is_hidden = window->IsHidden();

	if(!is_hidden) window->Hide();

	if(red_bitmap) delete red_bitmap;
	red_bitmap = new BBitmap(Bounds(), B_BITMAP_ACCEPTS_VIEWS, B_RGB32);
	if(red_bitmap)
	{
		SAutolock<BBitmap> autolock(red_bitmap);
		BView *bitmap_view = new BView(red_bitmap->Bounds(), NULL, B_FOLLOW_NONE, B_WILL_DRAW);
		red_bitmap->AddChild(bitmap_view);
		bitmap_view->PushState();
		bitmap_view->SetDrawingMode(B_OP_ALPHA);
		bitmap_view->SetHighColor(ViewColor());
		bitmap_view->FillRect(Bounds());
		bitmap_view->SetHighColor(203, 0, 51, 255);
		bitmap_view->FillArc(Bounds(), 0, 360);
		bitmap_view->SetHighColor(20, 20, 20, 150);
		bitmap_view->StrokeArc(Bounds(), 45, 180);
		bitmap_view->SetHighColor(220, 220, 220, 150);
		bitmap_view->StrokeArc(Bounds(), 225, 180);
		bitmap_view->PopState();
		bitmap_view->Sync();
	}

	if(green_bitmap) delete green_bitmap;
	green_bitmap = new BBitmap(Bounds(), B_BITMAP_ACCEPTS_VIEWS, B_RGB32);
	if(green_bitmap)
	{
		SAutolock<BBitmap> autolock(green_bitmap);
		BView *bitmap_view = new BView(green_bitmap->Bounds(), NULL, B_FOLLOW_NONE, B_WILL_DRAW);
		green_bitmap->AddChild(bitmap_view);
		bitmap_view->PushState();
		bitmap_view->SetDrawingMode(B_OP_ALPHA);
		bitmap_view->SetHighColor(ViewColor());
		bitmap_view->FillRect(Bounds());
		bitmap_view->SetHighColor(0, 169, 12, 255);
		bitmap_view->FillArc(Bounds(), 0, 360);
		bitmap_view->SetHighColor(20, 20, 20, 150);
		bitmap_view->StrokeArc(Bounds(), 45, 180);
		bitmap_view->SetHighColor(220, 220, 220, 150);
		bitmap_view->StrokeArc(Bounds(), 225, 180);
		bitmap_view->PopState();
		bitmap_view->Sync();
	}

	if(!is_hidden) window->Show();
}
Ejemplo n.º 7
0
void
ControlView::Draw(BRect updateRect)
{
    BRect rect(Bounds());
    SetHighColor(tint_color(ViewColor(), B_LIGHTEN_2_TINT));
    StrokeLine(rect.LeftTop(), rect.RightTop());
    StrokeLine(rect.LeftTop(), rect.LeftBottom());

    SetHighColor(tint_color(ViewColor(), B_DARKEN_2_TINT));
    StrokeLine(rect.LeftBottom(), rect.RightBottom());
    StrokeLine(rect.RightBottom(), rect.RightTop());
}
Ejemplo n.º 8
0
TGAView::TGAView(const char *name, uint32 flags, TranslatorSettings *settings)
	:
	BView(name, flags),
	fSettings(settings)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	SetLowColor(ViewColor());

 	fTitle = new BStringView("title", B_TRANSLATE("TGA Image Translator"));
 	fTitle->SetFont(be_bold_font);

 	char detail[100];
 	sprintf(detail, B_TRANSLATE("Version %d.%d.%d %s"),
 		static_cast<int>(B_TRANSLATION_MAJOR_VERSION(TGA_TRANSLATOR_VERSION)),
 		static_cast<int>(B_TRANSLATION_MINOR_VERSION(TGA_TRANSLATOR_VERSION)),
 		static_cast<int>(B_TRANSLATION_REVISION_VERSION(
 			TGA_TRANSLATOR_VERSION)), __DATE__);
 	fDetail = new BStringView("detail", detail);
 	fWrittenBy = new BStringView("writtenby",
 		B_TRANSLATE("Written by the Haiku Translation Kit Team"));

 	fpchkIgnoreAlpha = new BCheckBox(B_TRANSLATE("Ignore TGA alpha channel"),
		new BMessage(CHANGE_IGNORE_ALPHA));
 	int32 val = (fSettings->SetGetBool(TGA_SETTING_IGNORE_ALPHA)) ? 1 : 0;
 	fpchkIgnoreAlpha->SetValue(val);
 	fpchkIgnoreAlpha->SetViewColor(ViewColor());

 	fpchkRLE = new BCheckBox(B_TRANSLATE("Save with RLE Compression"),
		new BMessage(CHANGE_RLE));
 	val = (fSettings->SetGetBool(TGA_SETTING_RLE)) ? 1 : 0;
 	fpchkRLE->SetValue(val);
 	fpchkRLE->SetViewColor(ViewColor());

 	// Build the layout
 	SetLayout(new BGroupLayout(B_HORIZONTAL));

 	AddChild(BGroupLayoutBuilder(B_VERTICAL, 7)
 		.Add(fTitle)
 		.Add(fDetail)
 		.AddGlue()
 		.Add(fpchkIgnoreAlpha)
 		.Add(fpchkRLE)
 		.AddGlue()
 		.Add(fWrittenBy)
 		.AddGlue()
 		.SetInsets(5, 5, 5, 5)
 	);

 	BFont font;
 	GetFont(&font);
 	SetExplicitPreferredSize(BSize((font.Size() * 333)/12,
 		(font.Size() * 200)/12));
}
Ejemplo n.º 9
0
void DCCConnect::Draw(BRect)
{
	BView* top(Window()->ChildAt(0));

	if (this != top) {
		BeginLineArray(2);
		AddLine(Bounds().LeftTop(), Bounds().RightTop(), tint_color(ViewColor(), B_DARKEN_2_TINT));

		AddLine(Bounds().LeftTop() + BPoint(0.0, 1.0), Bounds().RightTop() + BPoint(0.0, 1.0),
				tint_color(ViewColor(), B_LIGHTEN_MAX_TINT));
		EndLineArray();
	}
}
Ejemplo n.º 10
0
void InfoBox::DrawWarningBitmap() {
	if ((float)cd_size>(float)((levelSB->MaxValue())*(2048.0F))) {
		SetDrawingMode(B_OP_COPY);
		SetHighColor(ViewColor());
		FillRect(BRect(205, 52, 205+kDataWidth, 52+kDataHeight));
		SetDrawingMode(B_OP_ALPHA);
		DrawBitmap(warningBM, BPoint(205, 52));
	} else {
		SetDrawingMode(B_OP_COPY);
		SetHighColor(ViewColor());
		FillRect(BRect(205, 52, 205+kDataWidth, 52+kDataHeight));
		SetHighColor(0,0,0);
	}
}
Ejemplo n.º 11
0
void
TTimeView::Draw(BRect /*updateRect*/)
{
	PushState();

	SetHighColor(ViewColor());
	SetLowColor(ViewColor());
	FillRect(Bounds());
	SetHighColor(0, 0, 0, 255);

	DrawString(fCurrentTimeStr, fTimeLocation);

	PopState();
}
Ejemplo n.º 12
0
void
TTimeView::Draw(BRect /*updateRect*/)
{
	PushState();

	SetHighColor(ViewColor());
	SetLowColor(ViewColor());
	FillRect(Bounds());
	SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));

	DrawString(fCurrentTimeStr, fTimeLocation);

	PopState();
}
Ejemplo n.º 13
0
//------------------------------------------------------------------------------
void BMenuField::DrawLabel(BRect bounds, BRect update)
{
	font_height fh;
	GetFontHeight(&fh);

	if (Label())
	{
		SetLowColor(ViewColor());

		float y = (float)ceil(fh.ascent + fh.descent + fh.leading) + 2.0f;
		float x;

		switch (fAlign)
		{
			case B_ALIGN_RIGHT:
				x = fDivider - StringWidth(Label()) - 3.0f;
				break;

			case B_ALIGN_CENTER:
				x = fDivider - StringWidth(Label()) / 2.0f;
				break;

			default:
				x = 3.0f;
				break;
		}
		
		SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
					 IsEnabled() ? B_DARKEN_MAX_TINT : B_DISABLED_LABEL_TINT));
		DrawString(Label(), BPoint(x, y));
	}
}
Ejemplo n.º 14
0
URLInputGroup::URLInputGroup(BMessage* goMessage)
	:
	BGroupView(B_HORIZONTAL, 0.0),
	fWindowActive(false)
{
	GroupLayout()->SetInsets(2, 2, 2, 2);

	fIconView = new PageIconView();
	GroupLayout()->AddView(fIconView, 0.0f);

	fTextView = new URLTextView(this);
	AddChild(fTextView);

	AddChild(new BSeparatorView(B_VERTICAL, B_PLAIN_BORDER));

// TODO: Fix in Haiku, no in-built support for archived BBitmaps from
// resources?
//	fGoButton = new BitmapButton("kActionGo", NULL);
	fGoButton = new BitmapButton(kGoBitmapBits, kGoBitmapWidth,
		kGoBitmapHeight, kGoBitmapFormat, goMessage);
	GroupLayout()->AddView(fGoButton, 0.0f);

	SetFlags(Flags() | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	SetLowColor(ViewColor());
	SetViewColor(B_TRANSPARENT_COLOR);

	SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
		B_ALIGN_VERTICAL_CENTER));
}
Ejemplo n.º 15
0
void ArpConfigureView::Draw(BRect )
{
	BeginLineArray(6);
	const rgb_color bgcolor = ViewColor();
	
	if( mMakeDefaultButton ) {
		BRect revFrame(mMakeDefaultButton->Frame());
		const float left = revFrame.right + floor((mSpaceWidth*3)/2);
		AddLine( BPoint(left, revFrame.top),
				 BPoint(left, revFrame.bottom),
				 tint_color(bgcolor, B_DARKEN_4_TINT) );
		AddLine( BPoint(left+1, revFrame.top),
				 BPoint(left+1, revFrame.bottom),
				 tint_color(bgcolor, .2) );
	}
	
	BRect bnd(Bounds());
	BRect panFrame(mPanel->Frame());
	AddLine( BPoint(bnd.left, bnd.bottom),
			 BPoint(bnd.left, panFrame.bottom+1),
			 tint_color(bgcolor, .2) );
	AddLine( BPoint(bnd.left, panFrame.bottom+1),
			 BPoint(bnd.right, panFrame.bottom+1),
			 tint_color(bgcolor, .2) );
	AddLine( BPoint(bnd.right, panFrame.bottom+1),
			 BPoint(bnd.right, bnd.bottom),
			 tint_color(bgcolor, B_DARKEN_4_TINT) );
	AddLine( BPoint(bnd.right, bnd.bottom),
			 BPoint(bnd.left, bnd.bottom),
			 tint_color(bgcolor, B_DARKEN_4_TINT) );
	
	EndLineArray();
}
Ejemplo n.º 16
0
void
BStringView::Draw(BRect updateRect)
{
	if (!fText)
		return;

	SetLowColor(ViewColor());

	font_height fontHeight;
	GetFontHeight(&fontHeight);

	BRect bounds = Bounds();

	float y = (bounds.top + bounds.bottom - ceilf(fontHeight.ascent)
		- ceilf(fontHeight.descent)) / 2.0 + ceilf(fontHeight.ascent);
	float x;
	switch (fAlign) {
		case B_ALIGN_RIGHT:
			x = bounds.Width() - fStringWidth;
			break;

		case B_ALIGN_CENTER:
			x = (bounds.Width() - fStringWidth) / 2.0;
			break;

		default:
			x = 0.0;
			break;
	}

	DrawString(fText, BPoint(x, y));
}
Ejemplo n.º 17
0
void MainView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg)
{
	if(!track_mouse) return;

	if(mouse_view) mouse_view->UpdateMouse(point);
	h_ruler->UpdateSlider(point);
	v_ruler->UpdateSlider(point);
	if(drag_move) {
		moveSelectedFieldsBy(BPoint(point.x - drag_start.x, point.y - drag_start.y));
		drag_start = point;
	}
//Temporary sel rect implementation
#ifdef HAIKU
	else if(drag_select) {
		SetHighColor(ViewColor());
		StrokeRect(sel_rect);
		SetHighColor(0,0,200);
		sel_rect.SetRightBottom(point);
		StrokeRect(sel_rect);	
	}
#endif
	else if(draw_crosshairs) {
		drawCrosshairs(point);
	}
}
Ejemplo n.º 18
0
void
TExpandoMenuBar::DrawBackground(BRect)
{
	if (fVertical)
		return;

	BRect bounds(Bounds());
	rgb_color menuColor = ViewColor();
	rgb_color hilite = tint_color(menuColor, B_DARKEN_1_TINT);
	rgb_color vlight = tint_color(menuColor, B_LIGHTEN_2_TINT);

	int32 last = CountItems() - 1;
	if (last >= 0)
		bounds.left = ItemAt(last)->Frame().right + 1;
	else
		bounds.left = 0;

	if (be_control_look != NULL) {
		SetHighColor(tint_color(menuColor, 1.22));
		StrokeLine(bounds.LeftTop(), bounds.LeftBottom());
		bounds.left++;
		uint32 borders = BControlLook::B_TOP_BORDER
			| BControlLook::B_BOTTOM_BORDER | BControlLook::B_RIGHT_BORDER;

		be_control_look->DrawButtonBackground(this, bounds, bounds, menuColor,
			0, borders);
	} else {
		SetHighColor(vlight);
		StrokeLine(bounds.LeftTop(), bounds.RightTop());
		StrokeLine(BPoint(bounds.left, bounds.top + 1), bounds.LeftBottom());
		SetHighColor(hilite);
		StrokeLine(BPoint(bounds.left + 1, bounds.bottom),
			bounds.RightBottom());
	}
}
Ejemplo n.º 19
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.º 20
0
// Draw
void
TestView::Draw(BRect updateRect)
{
printf("TestView::Draw(");
updateRect.PrintToStream();
	BRect r(Bounds());

	rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
	rgb_color shadow = tint_color(ViewColor(), B_DARKEN_2_TINT);

	BeginLineArray(4);
		AddLine(r.LeftTop(), r.RightTop(), light);
		AddLine(r.RightTop(), r.RightBottom(), shadow);
		AddLine(r.RightBottom(), r.LeftBottom(), shadow);
		AddLine(r.LeftBottom(), r.LeftTop(), light);
	EndLineArray();
}
Ejemplo n.º 21
0
void MainView::drawCrosshairs(const BPoint& point)
{
	SetHighColor(ViewColor());
	FillRect(Bounds());
	SetHighColor(0,0,0);
	StrokeLine(BPoint(0, point.y), BPoint(Bounds().IntegerWidth(), point.y));
	StrokeLine(BPoint(point.x, 0), BPoint(point.x, Bounds().IntegerHeight()));
}
Ejemplo n.º 22
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));
}
Ejemplo n.º 23
0
void
GearsView::Draw(BRect updateRect)
{
	SetHighColor(ViewColor());
	FillRect(updateRect);

	BRect stripeRect = Bounds();
	stripeRect.right = kStripeWidth;
	SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
	FillRect(stripeRect);

	if (fGears == NULL)
		return;

	SetDrawingMode(B_OP_ALPHA);
	SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
	DrawBitmapAsync(fGears, BPoint(5.0, 10.0));
}
Ejemplo n.º 24
0
					TestView(BRect frame, const char* name,
							  uint32 resizeFlags, uint32 flags)
						: BView(frame, name, resizeFlags, flags),
						  fTracking(false),
						  fLastMousePos(0.0, 0.0)
					{
						SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
						SetLowColor(ViewColor());
					}
Ejemplo n.º 25
0
void KouhoView::Draw( BRect rect )
{
	BTextView::Draw( rect );
	rgb_color viewcolor = ViewColor();
	SetHighColor( selection_color );
	SetDrawingMode( B_OP_MIN );
	FillRect( highlightRect );
//	SetViewColor( viewcolor );
}
Ejemplo n.º 26
0
MessageView::MessageView(BRect rect, DataEditor &editor)
	: TypeEditorView(rect, B_TRANSLATE("Message View"), B_FOLLOW_ALL, 0, editor)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	rect = Bounds().InsetByCopy(10, 10);
	rect.right -= B_V_SCROLL_BAR_WIDTH;
	rect.bottom -= B_H_SCROLL_BAR_HEIGHT;

	fTextView = new BTextView(rect, B_EMPTY_STRING,
		rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5),
		B_FOLLOW_ALL, B_WILL_DRAW);
	fTextView->SetViewColor(ViewColor());
	fTextView->SetLowColor(ViewColor());

	BScrollView *scrollView = new BScrollView("scroller", fTextView,
		B_FOLLOW_ALL, B_WILL_DRAW, true, true);
	AddChild(scrollView);
}
Ejemplo n.º 27
0
void ConfigHeadLine::Draw(BRect updateRect)
{
	rgb_color highcolor = HighColor();

	SetHighColor(ViewColor());
	FillRect(Bounds());
	SetHighColor(highcolor);
	DrawString(fText.String(), BPoint(17, Bounds().Height() - 5));
	BView::Draw(updateRect);
}
Ejemplo n.º 28
0
void PaneSwitch::Draw(BRect)
{
	if (fPressing)
		DrawInState(kPressed);
	else if (Value())
		DrawInState(kExpanded);
	else
		DrawInState(kCollapsed);

	rgb_color markColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
	
	bool focused = IsFocus() && Window()->IsActive();
	BRect bounds(Bounds());
	BeginLineArray(2);
	AddLine(BPoint(bounds.left + 2, bounds.bottom - 1),
		BPoint(bounds.right - 2, bounds.bottom - 1), focused ? markColor : ViewColor());
	AddLine(BPoint(bounds.left + 2, bounds.bottom),
		BPoint(bounds.right - 2, bounds.bottom), focused ? kWhite : ViewColor());
	EndLineArray();
}
Ejemplo n.º 29
0
void
PackagesView::Draw(BRect updateRect)
{
    if (CountChildren() > 0)
        return;

    be_control_look->DrawLabel(this,
                               B_TRANSLATE("No optional packages available."),
                               Bounds(), updateRect, ViewColor(), BControlLook::B_DISABLED,
                               BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
}
Ejemplo n.º 30
0
void
PositionView::MouseDown(BPoint where)
{
	if (fOptions != 0)
		SetMouseEventMask(B_POINTER_EVENTS, fOptions);

	SetViewColor(kPressedColor);
	SetLowColor(ViewColor());
	fPosition = where;
	Invalidate();
}