2004-01-17 21:37:57 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2005-02-28 23:23:51 +03:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc.
|
2004-01-17 21:37:57 +03:00
|
|
|
//
|
|
|
|
// 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: Workspace.h
|
2005-02-28 23:23:51 +03:00
|
|
|
// Author: Adi Oanca <adioanca@cotty.iren.com>
|
2004-01-17 21:37:57 +03:00
|
|
|
// Description: Tracks workspaces
|
|
|
|
//
|
2004-07-11 14:01:01 +04:00
|
|
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
// Notes: IMPORTANT WARNING
|
|
|
|
// This object does not use any locking mechanism. It is designed
|
|
|
|
// to be used only by RootLayer class. DO NOT USE from another class!
|
2004-01-17 21:37:57 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2004-01-12 01:12:55 +03:00
|
|
|
#ifndef _WORKSPACE_H_
|
|
|
|
#define _WORKSPACE_H_
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
2004-01-13 04:03:29 +03:00
|
|
|
#include <Locker.h>
|
2004-06-26 06:15:48 +04:00
|
|
|
#include <Accelerant.h>
|
2004-01-12 01:12:55 +03:00
|
|
|
|
|
|
|
#include "RGBColor.h"
|
|
|
|
|
|
|
|
class WinBorder;
|
|
|
|
|
2004-06-26 06:15:48 +04:00
|
|
|
struct ListData
|
|
|
|
{
|
2005-02-28 23:23:51 +03:00
|
|
|
bool isFree;
|
2004-06-26 06:15:48 +04:00
|
|
|
WinBorder *layerPtr;
|
|
|
|
ListData *upperItem;
|
|
|
|
ListData *lowerItem;
|
2004-01-12 01:12:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class Workspace
|
|
|
|
{
|
|
|
|
public:
|
2005-02-28 23:23:51 +03:00
|
|
|
Workspace( const int32 ID,
|
|
|
|
const uint32 colorspace,
|
|
|
|
const RGBColor& BGColor);
|
|
|
|
~Workspace(void);
|
|
|
|
|
|
|
|
int32 ID(void) const { return fID; }
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
void AddWinBorder(WinBorder *winBorder);
|
|
|
|
void RemoveWinBorder(WinBorder *winBorder);
|
|
|
|
bool HasWinBorder(const WinBorder *winBorder) const;
|
|
|
|
|
|
|
|
WinBorder* Focus(void) const;
|
|
|
|
WinBorder* Front(void) const;
|
|
|
|
void GetWinBorderList(void **&list, int32 *itemCount ) const;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
bool MoveToBack(WinBorder *newLast);
|
|
|
|
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
|
|
|
|
|
|
|
|
bool HideWinBorder(WinBorder *winBorder);
|
|
|
|
bool ShowWinBorder(WinBorder *winBorder, bool userBusy = false);
|
|
|
|
|
|
|
|
// resolution related methods.
|
|
|
|
void SetLocalSpace(const uint32 colorspace);
|
|
|
|
uint32 LocalSpace(void) const;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
void SetBGColor(const RGBColor &c);
|
|
|
|
RGBColor BGColor(void) const;
|
|
|
|
|
|
|
|
// settings related methods
|
|
|
|
void GetSettings(const BMessage &msg);
|
|
|
|
void GetDefaultSettings(void);
|
|
|
|
void PutSettings(BMessage *msg, const int32 &index) const;
|
|
|
|
static void PutDefaultSettings(BMessage *msg, const int32 &index);
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// debug methods
|
|
|
|
void PrintToStream(void) const;
|
|
|
|
void PrintItem(ListData *item) const;
|
2004-08-23 02:33:57 +04:00
|
|
|
|
2004-01-12 01:12:55 +03:00
|
|
|
private:
|
2005-02-28 23:23:51 +03:00
|
|
|
void InsertItem(ListData *item, ListData *before);
|
|
|
|
void RemoveItem(ListData *item);
|
|
|
|
ListData* HasItem(const ListData *item, int32 *index = NULL) const;
|
|
|
|
ListData* HasItem(const WinBorder *layer, int32 *index = NULL) const;
|
|
|
|
int32 IndexOf(const ListData *item) const;
|
|
|
|
|
|
|
|
bool placeToBack(ListData *newLast);
|
|
|
|
void placeInFront(ListData *item, const bool userBusy);
|
|
|
|
|
|
|
|
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem);
|
|
|
|
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
|
|
|
|
|
|
|
|
WinBorder* searchFirstMainWindow(WinBorder *wb) const;
|
|
|
|
|
|
|
|
bool windowHasVisibleModals(const WinBorder *winBorder) const;
|
|
|
|
ListData* putModalsInFront(ListData *item);
|
|
|
|
void putFloatingInFront(ListData *item);
|
|
|
|
void saveFloatingWindows(ListData *itemNormal);
|
|
|
|
|
|
|
|
ListData* findNextFront() const;
|
|
|
|
|
|
|
|
class MemoryPool
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MemoryPool();
|
|
|
|
~MemoryPool();
|
|
|
|
ListData* GetCleanMemory(WinBorder* winborder);
|
|
|
|
void ReleaseMemory(ListData* mem);
|
|
|
|
private:
|
|
|
|
void expandBuffer(int32 start);
|
|
|
|
ListData *buffer;
|
|
|
|
int32 count;
|
|
|
|
};
|
|
|
|
|
|
|
|
int32 fID;
|
|
|
|
uint32 fSpace;
|
|
|
|
RGBColor fBGColor;
|
|
|
|
|
|
|
|
// first visible onscreen
|
|
|
|
ListData *fBottomItem;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// the last visible(or covered by other Layers)
|
|
|
|
ListData *fTopItem;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// the focus WinBorder - for keyboard events
|
|
|
|
ListData *fFocusItem;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// pointer for which "big" actions are intended
|
|
|
|
ListData *fFrontItem;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// settings for each workspace -- example taken from R5's app_server_settings file
|
|
|
|
display_timing fDisplayTiming;
|
|
|
|
int16 fVirtualWidth;
|
|
|
|
int16 fVirtualHeight;
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
MemoryPool fPool;
|
2004-01-12 01:12:55 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|