xref: /haiku/headers/os/game/WindowScreen.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2006, 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 
17 _IMPEXP_GAME void set_mouse_position(int32 x, int32 y);
18 	// Controls the mouse cursor position on screen
19 
20 
21 enum {
22 	B_ENABLE_VIEW_DRAWING	= 0x0001,
23 	B_ENABLE_DEBUGGER		= 0x0002
24 };
25 
26 class 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 		status_t			_SetActiveState(int32 state);
82 		status_t			_SetupAccelerantHooks(bool enable);
83 		status_t			_GetCardInfo();
84 		void				_Suspend();
85 		void				_Resume();
86 		status_t			_GetModeFromSpace(uint32 space, display_mode* mode);
87 		status_t			_InitClone();
88 		status_t			_AssertDisplayMode(display_mode* mode);
89 
90 		uint16				_reserved0;
91 		bool				_reserved1;
92 		bool				fWorkState;
93 		bool				fWindowState;
94 		bool				fActivateState;
95 		int32				fLockState;
96 		int32				fWorkspaceIndex;
97 
98 		display_mode*		fOriginalDisplayMode;
99 		display_mode*		fDisplayMode;
100 		sem_id				fActivateSem;
101 		sem_id				fDebugSem;
102 		image_id			fAddonImage;
103 		uint32				fAttributes;
104 
105 		rgb_color			fPalette[256];
106 
107 		graphics_card_info	fCardInfo;
108 		frame_buffer_info	fFrameBufferInfo;
109 
110 		char*				fDebugFrameBuffer;
111 		bool				fDebugState;
112 		bool				fDebugFirst;
113 		int32				fDebugWorkspace;
114 		int32				fDebugThreadCount;
115 		thread_id*			fDebugThreads;
116 
117 		uint32				fModeCount;
118 		display_mode*		fModeList;
119 
120 		GetAccelerantHook	fGetAccelerantHook;
121 		wait_engine_idle	fWaitEngineIdle;
122 
123 		uint32				_reserved[162];
124 };
125 
126 #endif	// _WINDOW_SCREEN_H
127