Files
haiku-beta6/src/servers/app/server/RootLayer.cpp
T

113 lines
3.4 KiB
C++
Raw Normal View History

//------------------------------------------------------------------------------
// Copyright (c) 2001-2003, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: RootLayer.cpp
// Author: Gabe Yoder <[email protected]>
2003-02-15 15:28:22 +00:00
// DarkWyrm <[email protected]>
// Description: Class used for the top layer of each workspace's Layer tree
//
//------------------------------------------------------------------------------
#include <View.h>
#include "DisplayDriver.h"
#include "Layer.h"
#include "RootLayer.h"
#include "Desktop.h"
2003-02-17 16:24:27 +00:00
#include "PatternHandler.h" // for pattern_union
2003-02-17 22:36:05 +00:00
#include "ServerConfig.h"
#include "TokenHandler.h"
#include <TokenSpace.h>
#include <stdio.h>
//! TokenHandler object used to provide IDs for RootLayers(WorkSpaces)
TokenHandler rlayer_token_handler;
//#define DEBUG_ROOTLAYER
/*!
\brief Sets up internal variables needed by the RootLayer
2003-02-17 15:02:38 +00:00
\param rect Frame of the root layer
\param layername Name of the root layer. Not really used.
\param gfxdriver Pointer to the related graphics driver
*/
2003-02-17 15:02:38 +00:00
RootLayer::RootLayer(BRect rect, const char *layername, DisplayDriver *gfxdriver)
: Layer(rect, layername, B_NULL_TOKEN, B_FOLLOW_NONE, 0, NULL)
{
_view_token = rlayer_token_handler.GetToken();
2003-11-14 00:15:29 +00:00
fDriver = gfxdriver;
_hidden = false;
}
2003-02-17 15:02:38 +00:00
//! Frees all allocated heap memory (which happens to be none) ;)
RootLayer::~RootLayer()
{
}
/*!
\brief Sets the background color of the Screen
\param col The new background color
*/
void RootLayer::SetColor(const RGBColor &col)
{
2003-11-14 00:15:29 +00:00
_layerdata->viewcolor = col;
}
/*!
\brief Returns the background color of the Screen
\return The background color
*/
RGBColor RootLayer::GetColor(void) const
{
2003-11-14 00:15:29 +00:00
return _layerdata->viewcolor;
}
2003-02-15 15:28:22 +00:00
//! Empty function to disable moving the RootLayer
void RootLayer::MoveBy(float x, float y)
{
}
2003-02-15 15:28:22 +00:00
//! Reimplemented for RootLayer special case
void RootLayer::ResizeBy(float x, float y)
{
2003-11-14 00:15:29 +00:00
_frame.right += x;
_frame.bottom += y;
2003-02-15 15:28:22 +00:00
2003-11-14 00:15:29 +00:00
_full.Set( _frame ); // NO ConvertTopTop !!!
2003-02-15 15:28:22 +00:00
2003-11-14 00:15:29 +00:00
// We need to rebuild ALL regions because the screen is black now,
// and ALL views/Layers need redrawing.
RebuildRegions( _frame );
// Invalidate the hole screen, because we've changed resolution
// and the screen is black.
Invalidate( _frame );
2003-02-15 15:28:22 +00:00
}
/*!
\brief Assigns a particular display driver to the RootLayer
\param d The new display driver (ignored if NULL)
*/
void RootLayer::SetDriver(DisplayDriver *driver)
{
2003-11-14 00:15:29 +00:00
fDriver = driver;
}