haiku/src/servers/app/Workspace.cpp

109 lines
1.5 KiB
C++
Raw Normal View History

/*
* Copyright 2005, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, axeld@pinc-software.de
*/
#include "RootLayer.h"
#include "Workspace.h"
#include "WindowLayer.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
static RGBColor kDefaultColor = RGBColor(51, 102, 152);
const BPoint kInvalidWindowPosition = BPoint(NAN, NAN);
Workspace::Workspace()
:
fWindows(20, true)
// this list owns its items
{
_SetDefaults();
}
Workspace::~Workspace()
{
}
void
Workspace::SetWindows(const BObjectList<window_layer_info>& windows)
{
fWindows.MakeEmpty();
fWindows.AddList((BObjectList<window_layer_info> *)&windows);
}
bool
Workspace::AddWindow(WindowLayer* window)
{
window_layer_info* info = new (nothrow) window_layer_info;
if (info == NULL)
return false;
info->position = kInvalidWindowPosition;
info->window = window;
bool success = fWindows.AddItem(info);
if (!success)
delete info;
return success;
}
void
Workspace::RemoveWindow(WindowLayer* window)
{
for (int32 i = fWindows.CountItems(); i-- > 0;) {
window_layer_info* info = fWindows.ItemAt(i);
if (info->window == window) {
fWindows.RemoveItemAt(i);
delete info;
return;
}
}
}
void
Workspace::SetDisplaysFromDesktop(Desktop* desktop)
{
}
void
Workspace::SetColor(const RGBColor& color)
{
fColor = color;
}
void
Workspace::SetSettings(BMessage& settings)
{
}
void
Workspace::GetSettings(BMessage& settings)
{
}
void
Workspace::_SetDefaults()
{
fColor.SetColor(kDefaultColor);
}