1/*
2 * Copyright 2001-2010, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		DarkWyrm <bpmagic@columbus.rr.com>
7 *		Stephan Aßmus <superstippi@gmx.de>
8 *		Clemens Zeidler <haiku@clemens-zeidler.de>
9 */
10#ifndef DEFAULT_DECORATOR_H
11#define DEFAULT_DECORATOR_H
12
13
14#include <Region.h>
15
16#include "DecorManager.h"
17#include "RGBColor.h"
18
19
20class Desktop;
21
22
23class BeDecorAddOn : public DecorAddOn {
24public:
25								BeDecorAddOn(image_id id, const char* name);
26
27protected:
28	virtual Decorator*			_AllocateDecorator(DesktopSettings& settings,
29									BRect rect, window_look look, uint32 flags);
30};
31
32
33class BeDecorator: public Decorator {
34public:
35								BeDecorator(DesktopSettings& settings,
36									BRect frame, window_look look,
37									uint32 flags);
38	virtual						~BeDecorator();
39
40	virtual float				TabLocation() const
41									{ return (float)fTabOffset; }
42
43	virtual	bool				GetSettings(BMessage* settings) const;
44
45	virtual	void				Draw(BRect updateRect);
46	virtual	void				Draw();
47
48	virtual	void				GetSizeLimits(int32* minWidth, int32* minHeight,
49									int32* maxWidth, int32* maxHeight) const;
50
51	virtual Region				RegionAt(BPoint where) const;
52
53protected:
54	virtual void				_DoLayout();
55
56	virtual void				_DrawFrame(BRect r);
57	virtual void				_DrawTab(BRect r);
58
59	virtual void				_DrawClose(BRect r);
60	virtual void				_DrawTitle(BRect r);
61	virtual void				_DrawZoom(BRect r);
62
63	virtual	void				_SetTitle(const char* string,
64									BRegion* updateRegion = NULL);
65
66	virtual void				_FontsChanged(DesktopSettings& settings,
67									BRegion* updateRegion);
68	virtual void				_SetLook(DesktopSettings& settings,
69									window_look look,
70									BRegion* updateRegion = NULL);
71	virtual void				_SetFlags(uint32 flags,
72									BRegion* updateRegion = NULL);
73
74	virtual void				_SetFocus();
75
76	virtual	void				_MoveBy(BPoint offset);
77	virtual	void				_ResizeBy(BPoint offset, BRegion* dirty);
78
79	virtual bool				_SetTabLocation(float location,
80									BRegion* updateRegion = NULL);
81
82	virtual	bool				_SetSettings(const BMessage& settings,
83									BRegion* updateRegion = NULL);
84
85	virtual	void				_GetFootprint(BRegion* region);
86
87private:
88			void				_UpdateFont(DesktopSettings& settings);
89			void				_DrawBlendedRect(BRect r, bool down);
90			void				_GetButtonSizeAndOffset(const BRect& tabRect,
91									float* offset, float*size) const;
92			void				_LayoutTabItems(const BRect& tabRect);
93
94private:
95			RGBColor			fButtonHighColor;
96			RGBColor			fButtonLowColor;
97			RGBColor			fTextColor;
98			RGBColor			fTabColor;
99
100			RGBColor*			fFrameColors;
101
102			// Individual rects for handling window frame
103			// rendering the proper way
104			BRect				fRightBorder;
105			BRect				fLeftBorder;
106			BRect				fTopBorder;
107			BRect				fBottomBorder;
108
109			int32				fBorderWidth;
110
111			uint32				fTabOffset;
112			float				fTabLocation;
113			float				fTextOffset;
114
115			float				fMinTabSize;
116			float				fMaxTabSize;
117			BString				fTruncatedTitle;
118			int32				fTruncatedTitleLength;
119
120			bool				fWasDoubleClick;
121};
122
123
124#endif	// DEFAULT_DECORATOR_H
125