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
|
|
|
};
|
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
class Workspace {
|
|
|
|
public:
|
2005-09-16 09:10:21 +04:00
|
|
|
class State {
|
|
|
|
public:
|
2005-09-23 01:43:23 +04:00
|
|
|
State() : Front(NULL), Focus(NULL), WindowList(50) { }
|
2005-09-16 09:10:21 +04:00
|
|
|
WinBorder* Front;
|
|
|
|
WinBorder* Focus;
|
2005-09-20 02:41:48 +04:00
|
|
|
WinBorder* Active;
|
2005-09-16 09:10:21 +04:00
|
|
|
BList WindowList;
|
|
|
|
};
|
2005-02-28 23:23:51 +03:00
|
|
|
Workspace( const int32 ID,
|
|
|
|
const uint32 colorspace,
|
|
|
|
const RGBColor& BGColor);
|
2005-07-07 00:19:22 +04:00
|
|
|
~Workspace();
|
|
|
|
|
|
|
|
int32 ID() const { return fID; }
|
2005-02-28 23:23:51 +03:00
|
|
|
|
|
|
|
void AddWinBorder(WinBorder *winBorder);
|
|
|
|
void RemoveWinBorder(WinBorder *winBorder);
|
|
|
|
bool HasWinBorder(const WinBorder *winBorder) const;
|
|
|
|
|
2005-07-07 00:19:22 +04:00
|
|
|
WinBorder* Focus() const;
|
|
|
|
WinBorder* Front() const;
|
|
|
|
WinBorder* Active() const;
|
2005-09-16 09:10:21 +04:00
|
|
|
void GetState(Workspace::State *state) const;
|
|
|
|
bool AttemptToSetFront(WinBorder *newFront);
|
|
|
|
bool AttemptToSetFocus(WinBorder *newFocus);
|
|
|
|
bool AttemptToMoveToBack(WinBorder *newBack);
|
2005-09-19 02:43:31 +04:00
|
|
|
bool AttemptToActivate(WinBorder *toActivate);
|
2005-07-07 00:19:22 +04:00
|
|
|
|
2005-03-13 02:26:05 +03:00
|
|
|
bool GetWinBorderList(void **list, int32 *itemCount ) const;
|
2005-07-07 00:19:22 +04:00
|
|
|
|
|
|
|
bool SetFocus(WinBorder* newFocus);
|
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);
|
2005-06-07 05:29:12 +04:00
|
|
|
void PutSettings(BMessage *msg, const uint8 &index) const;
|
|
|
|
static void PutDefaultSettings(BMessage *msg, const uint8 &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;
|
2005-04-23 14:05:33 +04:00
|
|
|
WinBorder* searchANormalWindow(WinBorder *wb) const;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
|
|
|
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;
|
2005-07-07 00:19:22 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// the last visible(or covered by other Layers)
|
|
|
|
ListData *fTopItem;
|
2005-07-07 00:19:22 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// the focus WinBorder - for keyboard events
|
|
|
|
ListData *fFocusItem;
|
2005-07-07 00:19:22 +04:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
// pointer for which "big" actions are intended
|
|
|
|
ListData *fFrontItem;
|
2005-07-07 00:19:22 +04:00
|
|
|
ListData* fActiveItem;
|
|
|
|
|
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
|