xref: /haiku/src/servers/app/stackandtile/Tiling.h (revision 19ae20e67e91fc09cc9fc5c0e60e21e24e7a53eb)
1 /*
2  * Copyright 2010, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Clemens Zeidler <haiku@clemens-zeidler.de>
7  */
8 #ifndef TILING_H
9 #define TILING_H
10 
11 #include "ObjectList.h"
12 
13 #include "Decorator.h"
14 #include "StackAndTile.h"
15 #include "SATGroup.h"
16 
17 
18 class SATWindow;
19 
20 
21 class SATTiling : public SATSnappingBehaviour {
22 public:
23 							SATTiling(SATWindow* window);
24 							~SATTiling();
25 
26 		bool				FindSnappingCandidates(SATGroup* group);
27 		bool				JoinCandidates();
28 
29 		void				WindowLookChanged(window_look look);
30 private:
31 		bool				_IsTileableWindow(Window* window);
32 
33 		bool				_FindFreeAreaInGroup(SATGroup* group);
34 		bool				_FindFreeAreaInGroup(SATGroup* group,
35 								Corner::position_t corner);
36 
37 		bool				_InteresstingCrossing(Crossing* crossing,
38 								Corner::position_t corner, BRect& windowFrame);
39 		bool				_FindFreeArea(SATGroup* group,
40 								const Crossing* crossing,
41 								Corner::position_t areaCorner,
42 								BRect& windowFrame);
43 		bool				_HasOverlapp(SATGroup* group);
44 		bool				_CheckArea(SATGroup* group,
45 								Corner::position_t corner, BRect& windowFrame,
46 								float& error);
47 		bool				_CheckMinFreeAreaSize();
48 		float				_FreeAreaError(BRect& windowFrame);
49 		bool				_IsCornerInFreeArea(Corner::position_t corner,
50 								BRect& windowFrame);
51 
52 		BRect				_FreeAreaSize();
53 
54 		void				_HighlightWindows(SATGroup* group,
55 								bool highlight = true);
56 		bool				_SearchHighlightWindow(Tab* tab, Tab* firstOrthTab,
57 								Tab* secondOrthTab, const TabList* orthTabs,
58 								Corner::position_t areaCorner,
59 								Decorator::Region region, bool highlight);
60 		void				_HighlightWindows(WindowArea* area,
61 								Decorator::Region region, bool highlight);
62 
63 		void				_ResetSearchResults();
64 
65 		SATWindow*			fSATWindow;
66 
67 		SATGroup*			fFreeAreaGroup;
68 		Tab*				fFreeAreaLeft;
69 		Tab*				fFreeAreaRight;
70 		Tab*				fFreeAreaTop;
71 		Tab*				fFreeAreaBottom;
72 };
73 
74 #endif
75