コード例 #1
0
ファイル: WorkspacesView.cpp プロジェクト: mmanley/Antares
void
WorkspacesView::_DrawWorkspace(DrawingEngine* drawingEngine,
	BRegion& redraw, int32 index)
{
	BRect rect = _WorkspaceAt(index);

	Workspace workspace(*Window()->Desktop(), index);
	bool active = workspace.IsCurrent();
	if (active) {
		// draw active frame
		rgb_color black = (rgb_color){ 0, 0, 0, 255 };
		drawingEngine->StrokeRect(rect, black);
	} else if (index == fSelectedWorkspace) {
		rgb_color gray = (rgb_color){ 80, 80, 80, 255 };
		drawingEngine->StrokeRect(rect, gray);
	}

	rect.InsetBy(1, 1);

	rgb_color color = workspace.Color();
	if (!active)
		_DarkenColor(color);

	// draw windows

	BRegion backgroundRegion = redraw;

	// TODO: would be nice to get the real update region here

	BRect screenFrame = _ScreenFrame(index);

	BRegion workspaceRegion(rect);
	backgroundRegion.IntersectWith(&workspaceRegion);
	drawingEngine->ConstrainClippingRegion(&backgroundRegion);

	ServerFont font = fDrawState->Font();
	font.SetSize(fWindow->ServerWindow()->App()->PlainFont().Size());
	float reducedSize = ceilf(max_c(8.0f,
		min_c(Frame().Height(), Frame().Width()) / 15));
	if (font.Size() > reducedSize)
		font.SetSize(reducedSize);
	fDrawState->SetFont(font);
	drawingEngine->SetFont(font);

	// We draw from top down and cut the window out of the clipping region
	// which reduces the flickering
	::Window* window;
	BPoint leftTop;
	while (workspace.GetPreviousWindow(window, leftTop) == B_OK) {
		_DrawWindow(drawingEngine, rect, screenFrame, window,
			leftTop, backgroundRegion, active);
	}

	// draw background
	drawingEngine->FillRect(rect, color);

	drawingEngine->ConstrainClippingRegion(&redraw);
}
コード例 #2
0
ファイル: ServerPicture.cpp プロジェクト: naveedasmat/haiku
static void
set_font_size(DrawingContext* context, float size)
{
	ServerFont font;
	font.SetSize(size);
	context->CurrentState()->SetFont(font, B_FONT_SIZE);
}
コード例 #3
0
ファイル: ServerPicture.cpp プロジェクト: mmanley/Antares
static void
set_font_size(View* view, float size)
{
	ServerFont font;
	font.SetSize(size);
	view->CurrentState()->SetFont(font, B_FONT_SIZE);
}
コード例 #4
0
ファイル: ServerPicture.cpp プロジェクト: simonsouth/haiku
static void
set_font_size(void* _context, float size)
{
	DrawingContext* context = reinterpret_cast<DrawingContext *>(_context);
	ServerFont font;
	font.SetSize(size);
	context->CurrentState()->SetFont(font, B_FONT_SIZE);
}
コード例 #5
0
ファイル: ServerPicture.cpp プロジェクト: bhanug/haiku
static void
set_font_size(void* _canvas, float size)
{
	Canvas* const canvas = reinterpret_cast<Canvas*>(_canvas);
	ServerFont font;
	font.SetSize(size);
	canvas->CurrentState()->SetFont(font, B_FONT_SIZE);
}