2004-01-17 21:37:57 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2005-06-24 03:46:17 +04:00
|
|
|
// Copyright (c) 2001-2005, Haiku, Inc. All rights reserved.
|
|
|
|
// Distributed under the terms of the MIT license.
|
2004-01-17 21:37:57 +03:00
|
|
|
//
|
2005-06-24 03:46:17 +04:00
|
|
|
// File Name: Desktop.h
|
2005-01-17 00:35:02 +03:00
|
|
|
// Author: Adi Oanca <adioanca@cotty.iren.ro>
|
2005-06-24 03:46:17 +04:00
|
|
|
// Stephan Aßmus <superstippi@gmx.de>
|
2004-01-17 21:37:57 +03:00
|
|
|
// Description: Class used to encapsulate desktop management
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
2004-01-12 01:12:55 +03:00
|
|
|
#ifndef _DESKTOP_H_
|
|
|
|
#define _DESKTOP_H_
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <InterfaceDefs.h>
|
2004-01-12 01:12:55 +03:00
|
|
|
#include <List.h>
|
2005-06-24 03:46:17 +04:00
|
|
|
#include <Locker.h>
|
2003-07-06 23:48:17 +04:00
|
|
|
#include <Menu.h>
|
2005-06-25 12:45:00 +04:00
|
|
|
#include <ServerScreen.h>
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
class BMessage;
|
|
|
|
class BPortLink;
|
|
|
|
class DisplayDriver;
|
|
|
|
class HWInterface;
|
|
|
|
class Layer;
|
2004-01-12 01:12:55 +03:00
|
|
|
class RootLayer;
|
2003-08-31 21:38:34 +04:00
|
|
|
class WinBorder;
|
2003-01-24 18:19:27 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
class Desktop {
|
|
|
|
public:
|
2004-01-22 03:32:07 +03:00
|
|
|
// startup methods
|
2005-06-24 03:46:17 +04:00
|
|
|
Desktop();
|
|
|
|
virtual ~Desktop();
|
|
|
|
|
|
|
|
void Init();
|
2004-01-22 03:32:07 +03:00
|
|
|
|
|
|
|
// 1-BigScreen or n-SmallScreens
|
2005-06-24 03:46:17 +04:00
|
|
|
void InitMode();
|
2004-01-22 03:32:07 +03:00
|
|
|
|
|
|
|
// Methods for multiple monitors.
|
2005-06-25 12:45:00 +04:00
|
|
|
inline Screen* ScreenAt(int32 index) const
|
|
|
|
{ return static_cast<Screen *>(fScreenList.ItemAt(index)); }
|
|
|
|
inline int32 ScreenCount() const
|
|
|
|
{ return fScreenList.CountItems(); }
|
|
|
|
inline Screen* ActiveScreen() const
|
|
|
|
{ return fActiveScreen; }
|
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
void SetActiveRootLayerByIndex(int32 index);
|
|
|
|
void SetActiveRootLayer(RootLayer* layer);
|
2005-06-25 12:45:00 +04:00
|
|
|
inline RootLayer* RootLayerAt(int32 index)
|
|
|
|
{ return static_cast<RootLayer *>(fRootLayerList.ItemAt(index)); }
|
|
|
|
RootLayer* ActiveRootLayer() const
|
|
|
|
{ return fActiveRootLayer;}
|
|
|
|
int32 ActiveRootLayerIndex() const
|
|
|
|
{
|
|
|
|
int32 rootLayerCount = CountRootLayers();
|
|
|
|
|
|
|
|
for (int32 i = 0; i < rootLayerCount; i++) {
|
|
|
|
if (fActiveRootLayer == (RootLayer *)fRootLayerList.ItemAt(i))
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int32 CountRootLayers() const
|
|
|
|
{ return fRootLayerList.CountItems(); }
|
|
|
|
|
|
|
|
|
|
|
|
inline DisplayDriver* GetDisplayDriver() const
|
|
|
|
{ return ScreenAt(0)->GetDisplayDriver(); }
|
|
|
|
inline HWInterface* GetHWInterface() const
|
|
|
|
{ return ScreenAt(0)->GetHWInterface(); }
|
2005-06-24 03:46:17 +04:00
|
|
|
|
2004-01-22 03:32:07 +03:00
|
|
|
|
|
|
|
// Methods for layer(WinBorder) manipulation.
|
2005-06-24 03:46:17 +04:00
|
|
|
void AddWinBorder(WinBorder *winBorder);
|
|
|
|
void RemoveWinBorder(WinBorder *winBorder);
|
|
|
|
void SetWinBorderFeel(WinBorder *winBorder,
|
|
|
|
uint32 feel);
|
|
|
|
void AddWinBorderToSubset(WinBorder *winBorder,
|
|
|
|
WinBorder *toWinBorder);
|
|
|
|
void RemoveWinBorderFromSubset(WinBorder *winBorder,
|
|
|
|
WinBorder *fromWinBorder);
|
2004-07-07 00:51:16 +04:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token,
|
|
|
|
team_id teamID);
|
2005-02-28 23:23:51 +03:00
|
|
|
// get list of registed windows
|
2005-06-24 03:46:17 +04:00
|
|
|
const BList& WindowList() const
|
|
|
|
{
|
|
|
|
if (!IsLocked())
|
|
|
|
debugger("You must lock before getting registered windows list\n");
|
|
|
|
return fWinBorderList;
|
|
|
|
}
|
2005-02-28 23:23:51 +03:00
|
|
|
|
|
|
|
// locking with regards to registered windows list
|
2005-06-24 03:46:17 +04:00
|
|
|
bool Lock()
|
|
|
|
{ return fWinLock.Lock(); }
|
|
|
|
void Unlock()
|
|
|
|
{ return fWinLock.Unlock(); }
|
|
|
|
bool IsLocked() const
|
|
|
|
{ return fWinLock.IsLocked(); }
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-01-22 03:32:07 +03:00
|
|
|
// Methods for various desktop stuff handled by the server
|
2005-06-24 03:46:17 +04:00
|
|
|
void SetScrollBarInfo(const scroll_bar_info &info);
|
|
|
|
scroll_bar_info ScrollBarInfo() const;
|
2004-01-22 03:32:07 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
void SetMenuInfo(const menu_info &info);
|
|
|
|
menu_info MenuInfo() const;
|
2004-01-22 03:32:07 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
void UseFFMouse(const bool &useffm);
|
|
|
|
bool FFMouseInUse() const;
|
|
|
|
void SetFFMouseMode(const mode_mouse &value);
|
|
|
|
mode_mouse FFMouseMode() const;
|
2004-01-22 03:32:07 +03:00
|
|
|
|
|
|
|
// Debugging methods
|
2005-06-24 03:46:17 +04:00
|
|
|
void PrintToStream();
|
|
|
|
void PrintVisibleInRootLayerNo(int32 no);
|
2004-01-22 03:32:07 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
private:
|
|
|
|
void _AddGraphicsCard(HWInterface* interface);
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2005-06-24 03:46:17 +04:00
|
|
|
BList fWinBorderList;
|
|
|
|
BLocker fWinLock;
|
|
|
|
|
|
|
|
BList fRootLayerList;
|
|
|
|
RootLayer* fActiveRootLayer;
|
|
|
|
|
|
|
|
BList fScreenList;
|
|
|
|
Screen* fActiveScreen;
|
|
|
|
|
|
|
|
scroll_bar_info fScrollBarInfo;
|
|
|
|
menu_info fMenuInfo;
|
|
|
|
mode_mouse fMouseMode;
|
|
|
|
bool fFFMouseMode;
|
2004-01-12 01:12:55 +03:00
|
|
|
};
|
2003-07-06 23:48:17 +04:00
|
|
|
|
2005-05-28 17:43:13 +04:00
|
|
|
extern Desktop *gDesktop;
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2004-05-26 20:38:58 +04:00
|
|
|
#endif // _DESKTOP_H_
|