xref: /haiku/src/servers/app/WorkspacesView.h (revision 4c07199d8201fcf267e90be0d24b76799d03cea6)
1 /*
2  * Copyright 2005-2008, Haiku Inc.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  */
8 #ifndef WORKSPACES_VIEW_H
9 #define WORKSPACES_VIEW_H
10 
11 
12 #include "View.h"
13 
14 
15 class WorkspacesView : public View {
16 public:
17 					WorkspacesView(BRect frame, BPoint scrollingOffset,
18 						const char* name, int32 token, uint32 resize,
19 						uint32 flags);
20 	virtual			~WorkspacesView();
21 
22 	virtual	void	AttachedToWindow(::Window* window);
23 	virtual	void	DetachedFromWindow();
24 
25 	virtual	void	Draw(DrawingEngine* drawingEngine,
26 						const BRegion* effectiveClipping,
27 						const BRegion* windowContentClipping, bool deep = false);
28 
29 	virtual	void	MouseDown(BMessage* message, BPoint where);
30 	virtual	void	MouseUp(BMessage* message, BPoint where);
31 	virtual	void	MouseMoved(BMessage* message, BPoint where);
32 
33 			void	WindowChanged(::Window* window);
34 			void	WindowRemoved(::Window* window);
35 
36 private:
37 			void	_GetGrid(int32& columns, int32& rows);
38 			BRect	_ScreenFrame(int32 index);
39 			BRect	_WorkspaceAt(int32 index);
40 			BRect	_WorkspaceAt(BPoint where, int32& index);
41 			BRect	_WindowFrame(const BRect& workspaceFrame,
42 						const BRect& screenFrame, const BRect& windowFrame,
43 						BPoint windowPosition);
44 
45 			void	_DrawWindow(DrawingEngine* drawingEngine,
46 						const BRect& workspaceFrame, const BRect& screenFrame,
47 						::Window* window, BPoint windowPosition,
48 						BRegion& backgroundRegion, bool workspaceActive);
49 			void	_DrawWorkspace(DrawingEngine* drawingEngine,
50 						BRegion& redraw, int32 index);
51 
52 			void	_DarkenColor(rgb_color& color) const;
53 			void	_Invalidate() const;
54 
55 private:
56 	::Window*		fSelectedWindow;
57 	int32			fSelectedWorkspace;
58 	bool			fHasMoved;
59 	BPoint			fClickPoint;
60 	BPoint			fLeftTopOffset;
61 };
62 
63 #endif	// WORKSPACES_VIEW_H
64