2005-06-23 21:40:35 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2005, Haiku.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
* Adrian Oanca <adioanca@cotty.iren.ro>
|
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
|
|
|
* Stefano Ceccherini (burton666@libero.it)
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
2003-02-07 15:53:57 +03:00
|
|
|
#ifndef _SERVERWIN_H_
|
|
|
|
#define _SERVERWIN_H_
|
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <GraphicsDefs.h>
|
2005-06-24 02:43:11 +04:00
|
|
|
#include <PortLink.h>
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <Locker.h>
|
2005-05-16 19:39:58 +04:00
|
|
|
#include <Message.h>
|
|
|
|
#include <OS.h>
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <Rect.h>
|
|
|
|
#include <String.h>
|
2003-02-24 18:47:06 +03:00
|
|
|
#include <Window.h>
|
2005-05-16 19:39:58 +04:00
|
|
|
|
2005-06-17 20:34:22 +04:00
|
|
|
#include "SubWindowList.h"
|
2005-05-16 19:39:58 +04:00
|
|
|
#include "TokenSpace.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
|
|
|
|
class BString;
|
2003-02-12 04:11:55 +03:00
|
|
|
class BMessenger;
|
2003-02-07 15:53:57 +03:00
|
|
|
class BPoint;
|
2003-09-25 16:28:08 +04:00
|
|
|
class BMessage;
|
2005-06-24 02:43:11 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
class ServerApp;
|
|
|
|
class Decorator;
|
2003-02-14 04:53:53 +03:00
|
|
|
class WinBorder;
|
2003-02-20 16:13:01 +03:00
|
|
|
class Workspace;
|
2005-04-27 21:26:57 +04:00
|
|
|
class RootLayer;
|
2003-09-09 01:18:39 +04:00
|
|
|
class Layer;
|
2005-06-03 18:20:10 +04:00
|
|
|
class ServerPicture;
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2003-10-09 03:18:30 +04:00
|
|
|
#define AS_UPDATE_DECORATOR 'asud'
|
|
|
|
#define AS_UPDATE_COLORS 'asuc'
|
|
|
|
#define AS_UPDATE_FONTS 'asuf'
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\class ServerWindow ServerWindow.h
|
|
|
|
\brief Shadow BWindow class
|
|
|
|
|
|
|
|
A ServerWindow handles all the intraserver tasks required of it by its BWindow. There are
|
|
|
|
too many tasks to list as being done by them, but they include handling View transactions,
|
|
|
|
coordinating and linking a window's WinBorder half with its messaging half, dispatching
|
|
|
|
mouse and key events from the server to its window, and other such things.
|
|
|
|
*/
|
2005-06-23 22:48:10 +04:00
|
|
|
class ServerWindow : public BLocker {
|
2003-02-07 15:53:57 +03:00
|
|
|
public:
|
2005-06-24 02:43:11 +04:00
|
|
|
ServerWindow(const char *title, ServerApp *app,
|
|
|
|
port_id clientPort, port_id looperPort,
|
|
|
|
int32 handlerID, BRect frame, uint32 look,
|
|
|
|
uint32 feel, uint32 flags, uint32 workspace);
|
|
|
|
virtual ~ServerWindow();
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
status_t InitCheck();
|
|
|
|
bool Run();
|
|
|
|
void Quit();
|
2005-04-16 17:30:49 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
void ReplaceDecorator();
|
|
|
|
void Show();
|
|
|
|
void Hide();
|
|
|
|
|
|
|
|
void PostMessage(int32 code);
|
2005-04-16 17:30:49 +04:00
|
|
|
|
|
|
|
// methods for sending various messages to client.
|
2005-06-24 02:43:11 +04:00
|
|
|
void NotifyQuitRequested();
|
|
|
|
void NotifyMinimize(bool minimize);
|
|
|
|
void NotifyZoom();
|
|
|
|
void NotifyScreenModeChanged(const BRect frame,
|
|
|
|
const color_space cspace);
|
2005-05-26 19:04:45 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
// util methods.
|
|
|
|
void SendMessageToClient(const BMessage* msg,
|
|
|
|
int32 target = B_NULL_TOKEN,
|
|
|
|
bool usePreferred = false) const;
|
2005-06-10 19:50:24 +04:00
|
|
|
|
|
|
|
// TODO: Ouch, that's not exactly a nice name
|
|
|
|
inline BMessage &ClientViewsWithInvalidCoords()
|
|
|
|
{ return fClientViewsWithInvalidCoords; };
|
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
// to who we belong. who do we own. our title.
|
2005-06-23 21:40:35 +04:00
|
|
|
inline ServerApp* App() const { return fServerApp; }
|
|
|
|
inline const WinBorder* GetWinBorder() const { return fWinBorder; }
|
2005-06-23 22:48:10 +04:00
|
|
|
inline const char* Title() const { return fTitle; }
|
2005-04-16 17:30:49 +04:00
|
|
|
|
|
|
|
// related thread/team_id(s).
|
2005-06-23 21:40:35 +04:00
|
|
|
inline team_id ClientTeam() const { return fClientTeam; }
|
|
|
|
inline thread_id Thread() const { return fThread; }
|
2005-04-16 17:30:49 +04:00
|
|
|
|
|
|
|
// server "private" - try not to use.
|
2005-06-23 21:40:35 +04:00
|
|
|
inline int32 ClientToken() const { return fHandlerToken; }
|
2005-06-17 20:34:22 +04:00
|
|
|
|
|
|
|
// ToDo: public??
|
|
|
|
SubWindowList fSubWindowList;
|
2004-03-28 19:00:08 +04:00
|
|
|
|
2004-06-19 14:23:14 +04:00
|
|
|
private:
|
2005-04-16 17:30:49 +04:00
|
|
|
// methods for retrieving and creating a tree strcture of Layers.
|
2005-06-16 04:46:02 +04:00
|
|
|
Layer* CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent);
|
2005-06-15 01:28:56 +04:00
|
|
|
void SetLayerState(Layer *layer, BPrivate::LinkReceiver &link);
|
|
|
|
void SetLayerFontState(Layer *layer, BPrivate::LinkReceiver &link);
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
// message handling methods.
|
|
|
|
void _DispatchMessage(int32 code, BPrivate::LinkReceiver &link);
|
|
|
|
void _DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link);
|
|
|
|
void _MessageLooper();
|
|
|
|
|
|
|
|
static int32 _message_thread(void *_window);
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2005-06-03 18:20:10 +04:00
|
|
|
// TODO: Move me elsewhere
|
|
|
|
status_t PictureToRegion(ServerPicture *picture,
|
|
|
|
BRegion &,
|
|
|
|
bool inverse,
|
|
|
|
BPoint where);
|
2005-06-23 22:48:10 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
const char* fTitle;
|
2005-06-23 21:40:35 +04:00
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
ServerApp* fServerApp;
|
|
|
|
WinBorder* fWinBorder;
|
2005-06-23 21:40:35 +04:00
|
|
|
|
|
|
|
team_id fClientTeam;
|
|
|
|
thread_id fThread;
|
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
port_id fMessagePort;
|
2005-06-23 21:40:35 +04:00
|
|
|
port_id fClientReplyPort;
|
2005-04-16 17:30:49 +04:00
|
|
|
port_id fClientLooperPort;
|
2005-06-15 01:28:56 +04:00
|
|
|
|
2005-06-24 02:43:11 +04:00
|
|
|
BPrivate::PortLink fLink;
|
2005-06-24 03:21:10 +04:00
|
|
|
bool fQuitting;
|
2005-04-16 17:30:49 +04:00
|
|
|
|
2005-05-16 19:39:58 +04:00
|
|
|
BMessage fClientViewsWithInvalidCoords;
|
|
|
|
|
2005-04-16 17:30:49 +04:00
|
|
|
int32 fHandlerToken;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2005-05-26 17:56:42 +04:00
|
|
|
Layer* fCurrentLayer;
|
2003-02-07 15:53:57 +03:00
|
|
|
};
|
|
|
|
|
2005-06-15 01:28:56 +04:00
|
|
|
#endif // _SERVERWIN_H_
|