inactive workspaces are drawn with darker colors

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13787 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-07-21 11:43:11 +00:00
parent b23f4579af
commit 05988bd35f
2 changed files with 26 additions and 6 deletions

View File

@ -92,7 +92,7 @@ WorkspacesLayer::_WindowFrame(const BRect& workspaceFrame,
void
WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
const BRect& screenFrame, WinBorder* window,
BRegion& backgroundRegion)
BRegion& backgroundRegion, bool active)
{
if (window->Feel() == kDesktopWindowFeel)
return;
@ -103,6 +103,14 @@ WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
// ToDo: let decorator do this!
RGBColor yellow = window->GetDecorator()->GetColors().window_tab;
RGBColor gray(180, 180, 180);
RGBColor white(255, 255, 255);
if (!active) {
_DarkenColor(yellow);
_DarkenColor(gray);
_DarkenColor(white);
}
if (tabFrame.left < frame.left)
tabFrame.left = frame.left;
@ -117,10 +125,8 @@ WorkspacesLayer::_DrawWindow(const BRect& workspaceFrame,
fDriver->StrokeLine(tabFrame.LeftTop(), tabFrame.RightBottom(), yellow);
RGBColor gray(180, 180, 180);
fDriver->StrokeRect(frame, gray);
RGBColor white(255, 255, 255);
frame.InsetBy(1, 1);
fDriver->FillRect(frame, white);
}
@ -132,7 +138,8 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
BRect rect = _WorkspaceAt(index);
Workspace* workspace = GetRootLayer()->WorkspaceAt(index);
if (workspace == GetRootLayer()->ActiveWorkspace()) {
bool active = workspace == GetRootLayer()->ActiveWorkspace();
if (active) {
// draw active frame
RGBColor black(0, 0, 0);
fDriver->StrokeRect(rect, black);
@ -149,6 +156,10 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
else
color.SetColor(51, 102, 152);
if (!active) {
_DarkenColor(color);
}
// draw windows
#ifndef NEW_CLIPPING
@ -175,7 +186,7 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
fDriver->ConstrainClippingRegion(&backgroundRegion);
for (int32 i = count; i-- > 0;) {
_DrawWindow(rect, screenFrame, windows[i], backgroundRegion);
_DrawWindow(rect, screenFrame, windows[i], backgroundRegion, active);
}
}
@ -192,6 +203,13 @@ WorkspacesLayer::_DrawWorkspace(int32 index)
}
void
WorkspacesLayer::_DarkenColor(RGBColor& color) const
{
color = tint_color(color.GetColor32(), B_DARKEN_2_TINT);
}
void
WorkspacesLayer::Draw(const BRect& updateRect)
{

View File

@ -30,8 +30,10 @@ class WorkspacesLayer : public Layer {
void _DrawWindow(const BRect& workspaceFrame,
const BRect& screenFrame, WinBorder* window,
BRegion& backgroundRegion);
BRegion& backgroundRegion, bool active);
void _DrawWorkspace(int32 index);
void _DarkenColor(RGBColor& color) const;
};
#endif // WORKSPACES_LAYER_H