2004-06-26 06:15:48 +04:00
|
|
|
/*
|
2005-11-29 02:36:59 +03:00
|
|
|
* Copyright 2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
2005-07-07 00:19:22 +04:00
|
|
|
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
#include "RootLayer.h"
|
|
|
|
#include "Workspace.h"
|
|
|
|
#include "WindowLayer.h"
|
2004-07-10 14:54:20 +04:00
|
|
|
|
2005-11-30 14:19:20 +03:00
|
|
|
#include <math.h>
|
2005-11-29 02:36:59 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2004-07-10 14:54:20 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
static RGBColor kDefaultColor = RGBColor(51, 102, 152);
|
2005-11-30 14:19:20 +03:00
|
|
|
const BPoint kInvalidWindowPosition = BPoint(NAN, NAN);
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2004-07-10 14:54:20 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::Workspace()
|
|
|
|
:
|
2005-11-30 14:19:20 +03:00
|
|
|
fWindows(20, true)
|
|
|
|
// this list owns its items
|
2004-06-26 06:15:48 +04:00
|
|
|
{
|
2005-11-29 02:36:59 +03:00
|
|
|
_SetDefaults();
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::~Workspace()
|
2005-07-07 00:19:22 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-11-26 23:22:30 +03:00
|
|
|
|
2005-09-16 09:10:21 +04:00
|
|
|
void
|
2005-11-30 14:19:20 +03:00
|
|
|
Workspace::SetWindows(const BObjectList<window_layer_info>& windows)
|
2004-06-26 06:15:48 +04:00
|
|
|
{
|
2005-11-29 02:36:59 +03:00
|
|
|
fWindows.MakeEmpty();
|
2005-11-30 14:19:20 +03:00
|
|
|
fWindows.AddList((BObjectList<window_layer_info> *)&windows);
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
|
|
|
|
bool
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::AddWindow(WindowLayer* window)
|
2004-06-26 06:15:48 +04:00
|
|
|
{
|
2005-11-30 14:19:20 +03:00
|
|
|
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;
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2004-07-10 14:54:20 +04:00
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
void
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::RemoveWindow(WindowLayer* window)
|
2004-06-26 06:15:48 +04:00
|
|
|
{
|
2005-11-30 14:19:20 +03:00
|
|
|
for (int32 i = fWindows.CountItems(); i-- > 0;) {
|
|
|
|
window_layer_info* info = fWindows.ItemAt(i);
|
|
|
|
|
|
|
|
if (info->window == window) {
|
|
|
|
fWindows.RemoveItemAt(i);
|
|
|
|
delete info;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2004-07-10 14:54:20 +04:00
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
void
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::SetDisplaysFromDesktop(Desktop* desktop)
|
2004-06-26 06:15:48 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
|
|
|
|
void
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::SetColor(const RGBColor& color)
|
2004-06-26 06:15:48 +04:00
|
|
|
{
|
2005-11-29 02:36:59 +03:00
|
|
|
fColor = color;
|
2004-01-12 01:12:55 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
|
|
|
|
void
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::SetSettings(BMessage& settings)
|
2005-02-28 23:23:51 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-23 21:40:35 +04:00
|
|
|
void
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::GetSettings(BMessage& settings)
|
2005-02-28 23:23:51 +03:00
|
|
|
{
|
2004-07-10 14:54:20 +04:00
|
|
|
}
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-11-24 20:45:26 +03:00
|
|
|
void
|
2005-11-29 02:36:59 +03:00
|
|
|
Workspace::_SetDefaults()
|
2005-02-28 23:23:51 +03:00
|
|
|
{
|
2005-11-29 02:36:59 +03:00
|
|
|
fColor.SetColor(kDefaultColor);
|
2005-02-28 23:23:51 +03:00
|
|
|
}
|
|
|
|
|