1/*
2 * Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef	_WINDOW_SCREEN_H
6#define	_WINDOW_SCREEN_H
7
8
9#include <Accelerant.h>
10#include <GraphicsCard.h>
11#include <OS.h>
12#include <SupportDefs.h>
13#include <Window.h>
14#include <kernel/image.h>
15
16
17void set_mouse_position(int32 x, int32 y);
18	// Controls the mouse cursor position on screen
19
20
21enum {
22	B_ENABLE_VIEW_DRAWING	= 0x0001,
23	B_ENABLE_DEBUGGER		= 0x0002
24};
25
26class BWindowScreen : public BWindow {
27	public:
28							BWindowScreen(const char* title, uint32 space,
29								status_t* _error, bool debugMode = false);
30	        				BWindowScreen(const char* title, uint32 space,
31	        					uint32 attributes, status_t* _error);
32		virtual				~BWindowScreen();
33
34		virtual void		Quit();
35		virtual void		ScreenConnected(bool active);
36        void				Disconnect();
37
38		virtual	void		WindowActivated(bool active);
39		virtual void		WorkspaceActivated(int32 workspace, bool active);
40		virtual void		ScreenChanged(BRect screenSize, color_space depth);
41
42		virtual void		Hide();
43		virtual void		Show();
44
45		void				SetColorList(rgb_color* list, int32 firstIndex = 0,
46								int32 lastIndex = 255);
47		status_t			SetSpace(uint32 space);
48
49		bool				CanControlFrameBuffer();
50		status_t			SetFrameBuffer(int32 width, int32 height);
51		status_t			MoveDisplayArea(int32 x, int32 y);
52
53		rgb_color*			ColorList();
54		frame_buffer_info*	FrameBufferInfo();
55		graphics_card_hook	CardHookAt(int32 index);
56		graphics_card_info*	CardInfo();
57
58		void				RegisterThread(thread_id thread);
59		virtual	void		SuspensionHook(bool active);
60		void				Suspend(char* label);
61
62	private:
63		virtual status_t	Perform(perform_code d, void* arg);
64
65#if 0
66		void*				IOBase();
67			// deprecated API, always returns NULL
68#endif
69
70		virtual void		_ReservedWindowScreen1();
71		virtual void		_ReservedWindowScreen2();
72		virtual void		_ReservedWindowScreen3();
73		virtual void		_ReservedWindowScreen4();
74
75		// not implemented:
76							BWindowScreen();
77							BWindowScreen(BWindowScreen& other);
78							BWindowScreen &operator=(BWindowScreen& other);
79
80		status_t			_InitData(uint32 space, uint32 attributes);
81		void				_DisposeData();
82
83		status_t			_LockScreen(bool lock);
84		status_t			_Activate();
85		status_t			_Deactivate();
86
87		status_t			_SetupAccelerantHooks();
88		void				_ResetAccelerantHooks();
89
90		status_t			_GetCardInfo();
91		void				_Suspend();
92		void				_Resume();
93		status_t			_GetModeFromSpace(uint32 space, display_mode* mode);
94		status_t			_InitClone();
95		status_t			_AssertDisplayMode(display_mode* mode);
96
97		uint16				_reserved0;
98		bool				_reserved1;
99		bool				fWorkState;
100		bool				fWindowState;
101		bool				fActivateState;
102		int32				fLockState;
103		int32				fWorkspaceIndex;
104
105		display_mode*		fOriginalDisplayMode;
106		display_mode*		fDisplayMode;
107		sem_id				fDebugSem;
108		image_id			fAddonImage;
109		uint32				fAttributes;
110
111		rgb_color			fPalette[256];
112
113		graphics_card_info	fCardInfo;
114		frame_buffer_info	fFrameBufferInfo;
115
116		char*				fDebugFrameBuffer;
117		bool				fDebugState;
118		bool				fDebugFirst;
119		int32				fDebugWorkspace;
120		int32				fDebugThreadCount;
121		thread_id*			fDebugThreads;
122
123		uint32				fModeCount;
124		display_mode*		fModeList;
125
126		GetAccelerantHook	fGetAccelerantHook;
127		wait_engine_idle	fWaitEngineIdle;
128
129		uint32				_reserved[163];
130};
131
132#endif	// _WINDOW_SCREEN_H
133