xref: /haiku/src/add-ons/decorators/MacDecorator/MacDecorator.h (revision 702f22b7d20f924ae73b4aa458ba1614cc7cba09)
1 /*
2  * Copyright 2009-2014 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		DarkWyrm, bpmagic@columbus.rr.com
7  *		Adrien Destugues, pulkomandy@gmail.com
8  *		John Scipione, jscipione@gmail.com
9  */
10 #ifndef MAC_DECORATOR_H
11 #define MAC_DECORATOR_H
12 
13 
14 #include "DecorManager.h"
15 #include "RGBColor.h"
16 #include "SATDecorator.h"
17 
18 
19 class MacDecorAddOn : public DecorAddOn {
20 public:
21 								MacDecorAddOn(image_id id, const char* name);
22 
23 protected:
24 	virtual Decorator*			_AllocateDecorator(DesktopSettings& settings,
25 									BRect rect, Desktop* desktop);
26 };
27 
28 
29 class MacDecorator: public SATDecorator {
30 public:
31 								MacDecorator(DesktopSettings& settings,
32 									BRect frame, Desktop* desktop);
33 	virtual						~MacDecorator();
34 
35 			void				Draw(BRect updateRect);
36 			void				Draw();
37 
38 	virtual	Region				RegionAt(BPoint where, int32& tab) const;
39 
40 	virtual	bool				SetRegionHighlight(Region region,
41 									uint8 highlight, BRegion* dirty,
42 									int32 tab = -1);
43 
44 protected:
45 			void				_DoLayout();
46 
47 	virtual	void				_DrawFrame(BRect invalid);
48 
49 	virtual	void				_DrawTab(Decorator::Tab* tab, BRect invalid);
50 	virtual	void				_DrawButtons(Decorator::Tab* tab,
51 									const BRect& invalid);
52 	virtual	void				_DrawTitle(Decorator::Tab* tab, BRect rect);
53 
54 	virtual	void				_DrawMinimize(Decorator::Tab* tab, bool direct,
55 									BRect rect);
56 	virtual	void				_DrawZoom(Decorator::Tab* tab, bool direct,
57 									BRect rect);
58 	virtual	void				_DrawClose(Decorator::Tab* tab, bool direct,
59 									BRect rect);
60 
61 	virtual	void				_SetTitle(Tab* tab, const char* string,
62 									BRegion* updateRegion = NULL);
63 
64 	virtual	void				_MoveBy(BPoint offset);
65 	virtual	void				_ResizeBy(BPoint offset, BRegion* dirty);
66 
67 			Decorator::Tab*		_AllocateNewTab();
68 
69 	virtual	bool				_AddTab(DesktopSettings& settings,
70 									int32 index = -1,
71 									BRegion* updateRegion = NULL);
72 	virtual	bool				_RemoveTab(int32 index,
73 									BRegion* updateRegion = NULL);
74 	virtual	bool				_MoveTab(int32 from, int32 to, bool isMoving,
75 									BRegion* updateRegion = NULL);
76 
77 	virtual	void				_GetFootprint(BRegion *region);
78 
79 	virtual	void				_UpdateFont(DesktopSettings& settings);
80 
81 private:
82 			void				_DrawButton(Decorator::Tab* tab, bool direct,
83 									BRect rect, bool pressed);
84 			void				_DrawBlendedRect(DrawingEngine* engine,
85 									BRect r, bool down);
86 
87 			rgb_color			fButtonHighColor;
88 			rgb_color			fButtonLowColor;
89 
90 			rgb_color			fFrameHighColor;
91 			rgb_color			fFrameMidColor;
92 			rgb_color			fFrameLowColor;
93 			rgb_color			fFrameLowerColor;
94 
95 			rgb_color			fFocusTextColor;
96 			rgb_color			fNonFocusTextColor;
97 };
98 
99 
100 #endif	// MAC_DECORATOR_H
101