Decorator.cpp revision 03b82a62
105bd1efeSAxel Dörfler/*
2bb2e9b06SClemens Zeidler * Copyright 2001-2011, Haiku.
305bd1efeSAxel Dörfler * Distributed under the terms of the MIT License.
405bd1efeSAxel Dörfler *
505bd1efeSAxel Dörfler * Authors:
605bd1efeSAxel Dörfler *		DarkWyrm <bpmagic@columbus.rr.com>
705bd1efeSAxel Dörfler *		Stephan A��mus <superstippi@gmx.de>
8369b4ff1SClemens Zeidler *		Clemens Zeidler <haiku@clemens-zeidler.de>
989d652d5SIngo Weinhold *		Ingo Weinhold <ingo_weinhold@gmx.de>
1005bd1efeSAxel Dörfler */
1105bd1efeSAxel Dörfler
123a5082aaSAxel Dörfler
133a83c7b1SAxel Dörfler/*!	Base class for window decorators */
1405bd1efeSAxel Dörfler
153a5082aaSAxel Dörfler
16a3d04b0eSDarkWyrm#include "Decorator.h"
173a83c7b1SAxel Dörfler
183a83c7b1SAxel Dörfler#include <stdio.h>
1905bd1efeSAxel Dörfler
2005bd1efeSAxel Dörfler#include <Region.h>
2105bd1efeSAxel Dörfler
223a83c7b1SAxel Dörfler#include "DrawingEngine.h"
237641924eSAdi Oanca
2405bd1efeSAxel Dörfler
25bb2e9b06SClemens ZeidlerDecorator::Tab::Tab()
26bb2e9b06SClemens Zeidler	:
27bb2e9b06SClemens Zeidler	zoomRect(),
28bb2e9b06SClemens Zeidler	closeRect(),
29bb2e9b06SClemens Zeidler	minimizeRect(),
30bb2e9b06SClemens Zeidler
31bb2e9b06SClemens Zeidler	closePressed(false),
32bb2e9b06SClemens Zeidler	zoomPressed(false),
33bb2e9b06SClemens Zeidler	minimizePressed(false),
341c141573SClemens Zeidler
351c141573SClemens Zeidler	look(B_TITLED_WINDOW_LOOK),
361c141573SClemens Zeidler	flags(0),
37bb2e9b06SClemens Zeidler	isFocused(false),
38bb2e9b06SClemens Zeidler	title("")
39bb2e9b06SClemens Zeidler{
40bb2e9b06SClemens Zeidler
41bb2e9b06SClemens Zeidler}
42bb2e9b06SClemens Zeidler
43bb2e9b06SClemens Zeidler
443a83c7b1SAxel Dörfler/*!	\brief Constructor
453a83c7b1SAxel Dörfler
463a83c7b1SAxel Dörfler	Does general initialization of internal data members and creates a colorset
470a3f410fSAxel Dörfler	object.
483a83c7b1SAxel Dörfler
49a3d04b0eSDarkWyrm	\param rect Size of client area
50a3d04b0eSDarkWyrm	\param wlook style of window look. See Window.h
51a3d04b0eSDarkWyrm	\param wfeel style of window feel. See Window.h
52a3d04b0eSDarkWyrm	\param wflags various window flags. See Window.h
53a3d04b0eSDarkWyrm*/
541c141573SClemens ZeidlerDecorator::Decorator(DesktopSettings& settings, BRect rect)
5585f8bb71SAxel Dörfler	:
562cfe93e7SStephan Aßmus	fDrawingEngine(NULL),
5785f8bb71SAxel Dörfler	fDrawState(),
5885f8bb71SAxel Dörfler
59bb2e9b06SClemens Zeidler	fTitleBarRect(),
602cfe93e7SStephan Aßmus	fFrame(rect),
612cfe93e7SStephan Aßmus	fResizeRect(),
622cfe93e7SStephan Aßmus	fBorderRect(),
6385f8bb71SAxel Dörfler
64bb2e9b06SClemens Zeidler	fTopTab(NULL),
6509301a49SClemens Zeidler
6609301a49SClemens Zeidler	fFootprintValid(false)
67a3d04b0eSDarkWyrm{
682b602c73SIngo Weinhold	memset(&fRegionHighlights, HIGHLIGHT_NONE, sizeof(fRegionHighlights));
69a3d04b0eSDarkWyrm}
70a3d04b0eSDarkWyrm
7185f8bb71SAxel Dörfler
72a3d04b0eSDarkWyrm/*!
73a3d04b0eSDarkWyrm	\brief Destructor
740a3f410fSAxel Dörfler
75a3d04b0eSDarkWyrm	Frees the color set and the title string
76a3d04b0eSDarkWyrm*/
7759345e26SStephan AßmusDecorator::~Decorator()
78a3d04b0eSDarkWyrm{
79a3d04b0eSDarkWyrm}
80a3d04b0eSDarkWyrm
8185f8bb71SAxel Dörfler
82bb2e9b06SClemens ZeidlerDecorator::Tab*
831c141573SClemens ZeidlerDecorator::AddTab(DesktopSettings& settings, const char* title,
841c141573SClemens Zeidler	window_look look, uint32 flags, int32 index, BRegion* updateRegion)
85bb2e9b06SClemens Zeidler{
86bb2e9b06SClemens Zeidler	Decorator::Tab* tab = _AllocateNewTab();
87bb2e9b06SClemens Zeidler	if (tab == NULL)
88bb2e9b06SClemens Zeidler		return NULL;
89bb2e9b06SClemens Zeidler	tab->title = title;
901c141573SClemens Zeidler	tab->look = look;
911c141573SClemens Zeidler	tab->flags = flags;
92bb2e9b06SClemens Zeidler
93bb2e9b06SClemens Zeidler	bool ok = false;
94bb2e9b06SClemens Zeidler	if (index >= 0) {
95bb2e9b06SClemens Zeidler		if (fTabList.AddItem(tab, index) == true)
96bb2e9b06SClemens Zeidler			ok = true;
97bb2e9b06SClemens Zeidler	} else if (fTabList.AddItem(tab) == true)
98bb2e9b06SClemens Zeidler		ok = true;
99bb2e9b06SClemens Zeidler
100bb2e9b06SClemens Zeidler	if (ok == false) {
101bb2e9b06SClemens Zeidler		delete tab;
102bb2e9b06SClemens Zeidler		return NULL;
103bb2e9b06SClemens Zeidler	}
104bb2e9b06SClemens Zeidler
1051c141573SClemens Zeidler	Decorator::Tab* oldTop = fTopTab;
1061c141573SClemens Zeidler	fTopTab = tab;
1071c141573SClemens Zeidler	if (_AddTab(settings, index, updateRegion) == false) {
108bb2e9b06SClemens Zeidler		fTabList.RemoveItem(tab);
109bb2e9b06SClemens Zeidler		delete tab;
1101c141573SClemens Zeidler		fTopTab = oldTop;
111bb2e9b06SClemens Zeidler		return NULL;
112bb2e9b06SClemens Zeidler	}
113bb2e9b06SClemens Zeidler
114bb2e9b06SClemens Zeidler	_InvalidateFootprint();
115bb2e9b06SClemens Zeidler	return tab;
116bb2e9b06SClemens Zeidler}
117bb2e9b06SClemens Zeidler
118bb2e9b06SClemens Zeidler
119bb2e9b06SClemens Zeidlerbool
120bb2e9b06SClemens ZeidlerDecorator::RemoveTab(int32 index, BRegion* updateRegion)
121bb2e9b06SClemens Zeidler{
122bb2e9b06SClemens Zeidler	Decorator::Tab* tab = fTabList.RemoveItemAt(index);
123bb2e9b06SClemens Zeidler	if (tab == NULL)
124bb2e9b06SClemens Zeidler		return false;
125bb2e9b06SClemens Zeidler
126bb2e9b06SClemens Zeidler	_RemoveTab(index, updateRegion);
127bb2e9b06SClemens Zeidler
128bb2e9b06SClemens Zeidler	delete tab;
129bb2e9b06SClemens Zeidler	_InvalidateFootprint();
130bb2e9b06SClemens Zeidler	return true;
131bb2e9b06SClemens Zeidler}
132bb2e9b06SClemens Zeidler
133bb2e9b06SClemens Zeidler
134bb2e9b06SClemens Zeidlerbool
135bb2e9b06SClemens ZeidlerDecorator::MoveTab(int32 from, int32 to, bool isMoving, BRegion* updateRegion)
136bb2e9b06SClemens Zeidler{
137bb2e9b06SClemens Zeidler	if (_MoveTab(from, to, isMoving, updateRegion) == false)
138bb2e9b06SClemens Zeidler		return false;
139bb2e9b06SClemens Zeidler	if (fTabList.MoveItem(from, to) == false) {
140bb2e9b06SClemens Zeidler		// move the tab back
141bb2e9b06SClemens Zeidler		_MoveTab(from, to, isMoving, updateRegion);
142bb2e9b06SClemens Zeidler		return false;
143bb2e9b06SClemens Zeidler	}
144bb2e9b06SClemens Zeidler	return true;
145bb2e9b06SClemens Zeidler}
146bb2e9b06SClemens Zeidler
147bb2e9b06SClemens Zeidler
148bb2e9b06SClemens Zeidlerint32
149bb2e9b06SClemens ZeidlerDecorator::TabAt(const BPoint& where) const
150bb2e9b06SClemens Zeidler{
151bb2e9b06SClemens Zeidler	for (int32 i = 0; i < fTabList.CountItems(); i++) {
152bb2e9b06SClemens Zeidler		Decorator::Tab* tab = fTabList.ItemAt(i);
153bb2e9b06SClemens Zeidler		if (tab->tabRect.Contains(where))
154bb2e9b06SClemens Zeidler			return i;
155bb2e9b06SClemens Zeidler	}
156bb2e9b06SClemens Zeidler
157bb2e9b06SClemens Zeidler	return -1;
158bb2e9b06SClemens Zeidler}
159bb2e9b06SClemens Zeidler
160bb2e9b06SClemens Zeidler
161bb2e9b06SClemens Zeidlervoid
16203b82a62SRene GollentDecorator::SetTopTab(int32 tab)
163bb2e9b06SClemens Zeidler{
164bb2e9b06SClemens Zeidler	fTopTab = fTabList.ItemAt(tab);
165bb2e9b06SClemens Zeidler}
166bb2e9b06SClemens Zeidler
167bb2e9b06SClemens Zeidler
1683a83c7b1SAxel Dörfler/*!	\brief Assigns a display driver to the decorator
16958468dfeSStephan Aßmus	\param driver A valid DrawingEngine object
170a3d04b0eSDarkWyrm*/
17159345e26SStephan Aßmusvoid
1722cfe93e7SStephan AßmusDecorator::SetDrawingEngine(DrawingEngine* engine)
173a3d04b0eSDarkWyrm{
1742cfe93e7SStephan Aßmus	fDrawingEngine = engine;
175a3d04b0eSDarkWyrm	// lots of subclasses will depend on the driver for text support, so call
17659345e26SStephan Aßmus	// _DoLayout() after we have it
1773a83c7b1SAxel Dörfler	if (fDrawingEngine)
17859345e26SStephan Aßmus		_DoLayout();
179a3d04b0eSDarkWyrm}
180a3d04b0eSDarkWyrm
18185f8bb71SAxel Dörfler
1823a83c7b1SAxel Dörfler/*!	\brief Sets the decorator's window flags
183a3d04b0eSDarkWyrm
184a3d04b0eSDarkWyrm	While this call will not update the screen, it will affect how future
185a3d04b0eSDarkWyrm	updates work and immediately affects input handling.
1863a83c7b1SAxel Dörfler
1873a83c7b1SAxel Dörfler	\param flags New value for the flags
188a3d04b0eSDarkWyrm*/
18959345e26SStephan Aßmusvoid
1901c141573SClemens ZeidlerDecorator::SetFlags(int32 tab, uint32 flags, BRegion* updateRegion)
191a3d04b0eSDarkWyrm{
1923a83c7b1SAxel Dörfler	// we're nice to our subclasses - we make sure B_NOT_{H|V|}_RESIZABLE
1933a83c7b1SAxel Dörfler	// are in sync (it's only a semantical simplification, not a necessity)
194fc21e33eSAxel Dörfler	if ((flags & (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE))
195fc21e33eSAxel Dörfler			== (B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE))
196fc21e33eSAxel Dörfler		flags |= B_NOT_RESIZABLE;
197fc21e33eSAxel Dörfler	if (flags & B_NOT_RESIZABLE)
198fc21e33eSAxel Dörfler		flags |= B_NOT_H_RESIZABLE | B_NOT_V_RESIZABLE;
199fc21e33eSAxel Dörfler
2001c141573SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
2011c141573SClemens Zeidler	if (decoratorTab == NULL)
2021c141573SClemens Zeidler		return;
2031c141573SClemens Zeidler	_SetFlags(decoratorTab, flags, updateRegion);
204962281e8SClemens Zeidler	_InvalidateFootprint();
205962281e8SClemens Zeidler		// the border might have changed (smaller/larger tab)
206a3d04b0eSDarkWyrm}
207a3d04b0eSDarkWyrm
20885f8bb71SAxel Dörfler
2090a3f410fSAxel Dörfler/*!	\brief Called whenever the system fonts are changed.
2102a8283e4SDarkWyrm*/
21159345e26SStephan Aßmusvoid
2120a3f410fSAxel DörflerDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
2132a8283e4SDarkWyrm{
21409301a49SClemens Zeidler	_FontsChanged(settings, updateRegion);
215962281e8SClemens Zeidler	_InvalidateFootprint();
2162a8283e4SDarkWyrm}
2172a8283e4SDarkWyrm
21885f8bb71SAxel Dörfler
2193a83c7b1SAxel Dörfler/*!	\brief Sets the decorator's window look
22085f8bb71SAxel Dörfler	\param look New value for the look
221a3d04b0eSDarkWyrm*/
22259345e26SStephan Aßmusvoid
2231c141573SClemens ZeidlerDecorator::SetLook(int32 tab, DesktopSettings& settings, window_look look,
22485f8bb71SAxel Dörfler	BRegion* updateRect)
225a3d04b0eSDarkWyrm{
2261c141573SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
2271c141573SClemens Zeidler	if (decoratorTab == NULL)
2281c141573SClemens Zeidler		return;
2291c141573SClemens Zeidler	_SetLook(decoratorTab, settings, look, updateRect);
230962281e8SClemens Zeidler	_InvalidateFootprint();
231962281e8SClemens Zeidler		// the border very likely changed
232a3d04b0eSDarkWyrm}
233a3d04b0eSDarkWyrm
23485f8bb71SAxel Dörfler
235bb2e9b06SClemens Zeidler/*!	\brief Returns the decorator's window look
236bb2e9b06SClemens Zeidler	\return the decorator's window look
237bb2e9b06SClemens Zeidler*/
238bb2e9b06SClemens Zeidlerwindow_look
2391c141573SClemens ZeidlerDecorator::Look(int32 tab) const
240bb2e9b06SClemens Zeidler{
2411c141573SClemens Zeidler	return TabAt(tab)->look;
242bb2e9b06SClemens Zeidler}
243bb2e9b06SClemens Zeidler
244bb2e9b06SClemens Zeidler
245bb2e9b06SClemens Zeidler/*!	\brief Returns the decorator's window flags
246bb2e9b06SClemens Zeidler	\return the decorator's window flags
247bb2e9b06SClemens Zeidler*/
248bb2e9b06SClemens Zeidleruint32
2491c141573SClemens ZeidlerDecorator::Flags(int32 tab) const
250bb2e9b06SClemens Zeidler{
2511c141573SClemens Zeidler	return TabAt(tab)->flags;
252bb2e9b06SClemens Zeidler}
253bb2e9b06SClemens Zeidler
254bb2e9b06SClemens Zeidler
255bb2e9b06SClemens Zeidler/*!	\brief Returns the decorator's border rectangle
256bb2e9b06SClemens Zeidler	\return the decorator's border rectangle
257bb2e9b06SClemens Zeidler*/
258bb2e9b06SClemens ZeidlerBRect
259bb2e9b06SClemens ZeidlerDecorator::BorderRect() const
260bb2e9b06SClemens Zeidler{
261bb2e9b06SClemens Zeidler	return fBorderRect;
262bb2e9b06SClemens Zeidler}
263bb2e9b06SClemens Zeidler
264bb2e9b06SClemens Zeidler
265bb2e9b06SClemens ZeidlerBRect
266bb2e9b06SClemens ZeidlerDecorator::TitleBarRect() const
267bb2e9b06SClemens Zeidler{
268bb2e9b06SClemens Zeidler	return fTitleBarRect;
269bb2e9b06SClemens Zeidler}
270bb2e9b06SClemens Zeidler
271bb2e9b06SClemens Zeidler
272bb2e9b06SClemens Zeidler/*!	\brief Returns the decorator's tab rectangle
273bb2e9b06SClemens Zeidler	\return the decorator's tab rectangle
274bb2e9b06SClemens Zeidler*/
275bb2e9b06SClemens ZeidlerBRect
276bb2e9b06SClemens ZeidlerDecorator::TabRect(int32 tab) const
277bb2e9b06SClemens Zeidler{
278bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
279bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
280bb2e9b06SClemens Zeidler		return BRect();
281bb2e9b06SClemens Zeidler	return decoratorTab->tabRect;
282bb2e9b06SClemens Zeidler}
283bb2e9b06SClemens Zeidler
284bb2e9b06SClemens Zeidler
285bb2e9b06SClemens ZeidlerBRect
286bb2e9b06SClemens ZeidlerDecorator::TabRect(Decorator::Tab* tab) const
287bb2e9b06SClemens Zeidler{
288bb2e9b06SClemens Zeidler	return tab->tabRect;
289bb2e9b06SClemens Zeidler}
290bb2e9b06SClemens Zeidler
291bb2e9b06SClemens Zeidler
2923a83c7b1SAxel Dörfler/*!	\brief Sets the close button's value.
2930a3f410fSAxel Dörfler
29459345e26SStephan Aßmus	Note that this does not update the button's look - it just updates the
29559345e26SStephan Aßmus	internal button value
2963a83c7b1SAxel Dörfler
2973a83c7b1SAxel Dörfler	\param is_down Whether the button is down or not
298a3d04b0eSDarkWyrm*/
29959345e26SStephan Aßmusvoid
300bb2e9b06SClemens ZeidlerDecorator::SetClose(int32 tab, bool pressed)
301a3d04b0eSDarkWyrm{
302bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
303bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
304bb2e9b06SClemens Zeidler		return;
305bb2e9b06SClemens Zeidler
306bb2e9b06SClemens Zeidler	if (pressed != decoratorTab->closePressed) {
307bb2e9b06SClemens Zeidler		decoratorTab->closePressed = pressed;
308bb2e9b06SClemens Zeidler		DrawClose(tab);
30959345e26SStephan Aßmus	}
310a3d04b0eSDarkWyrm}
311a3d04b0eSDarkWyrm
3123a83c7b1SAxel Dörfler/*!	\brief Sets the minimize button's value.
3130a3f410fSAxel Dörfler
31459345e26SStephan Aßmus	Note that this does not update the button's look - it just updates the
31559345e26SStephan Aßmus	internal button value
3163a83c7b1SAxel Dörfler
3173a83c7b1SAxel Dörfler	\param is_down Whether the button is down or not
318a3d04b0eSDarkWyrm*/
31959345e26SStephan Aßmusvoid
320bb2e9b06SClemens ZeidlerDecorator::SetMinimize(int32 tab, bool pressed)
321a3d04b0eSDarkWyrm{
322bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
323bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
324bb2e9b06SClemens Zeidler		return;
325bb2e9b06SClemens Zeidler
326bb2e9b06SClemens Zeidler	if (pressed != decoratorTab->minimizePressed) {
327bb2e9b06SClemens Zeidler		decoratorTab->minimizePressed = pressed;
328bb2e9b06SClemens Zeidler		DrawMinimize(tab);
32959345e26SStephan Aßmus	}
330a3d04b0eSDarkWyrm}
331a3d04b0eSDarkWyrm
3323a83c7b1SAxel Dörfler/*!	\brief Sets the zoom button's value.
3330a3f410fSAxel Dörfler
33459345e26SStephan Aßmus	Note that this does not update the button's look - it just updates the
33559345e26SStephan Aßmus	internal button value
3363a83c7b1SAxel Dörfler
3373a83c7b1SAxel Dörfler	\param is_down Whether the button is down or not
338a3d04b0eSDarkWyrm*/
33959345e26SStephan Aßmusvoid
340bb2e9b06SClemens ZeidlerDecorator::SetZoom(int32 tab, bool pressed)
341a3d04b0eSDarkWyrm{
342bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
343bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
344bb2e9b06SClemens Zeidler		return;
345bb2e9b06SClemens Zeidler
346bb2e9b06SClemens Zeidler	if (pressed != decoratorTab->zoomPressed) {
347bb2e9b06SClemens Zeidler		decoratorTab->zoomPressed = pressed;
348bb2e9b06SClemens Zeidler		DrawZoom(tab);
34959345e26SStephan Aßmus	}
35059345e26SStephan Aßmus}
35159345e26SStephan Aßmus
352614de12dSAxel Dörfler
3533a83c7b1SAxel Dörfler/*!	\brief Updates the value of the decorator title
35459345e26SStephan Aßmus	\param string New title value
35559345e26SStephan Aßmus*/
35659345e26SStephan Aßmusvoid
357bb2e9b06SClemens ZeidlerDecorator::SetTitle(int32 tab, const char* string, BRegion* updateRegion)
35859345e26SStephan Aßmus{
359bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
360bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
361bb2e9b06SClemens Zeidler		return;
362bb2e9b06SClemens Zeidler
363bb2e9b06SClemens Zeidler	decoratorTab->title.SetTo(string);
364bb2e9b06SClemens Zeidler	_SetTitle(decoratorTab, string, updateRegion);
36509301a49SClemens Zeidler
366962281e8SClemens Zeidler	_InvalidateFootprint();
367962281e8SClemens Zeidler		// the border very likely changed
368962281e8SClemens Zeidler
36959345e26SStephan Aßmus	// TODO: redraw?
370a3d04b0eSDarkWyrm}
371a3d04b0eSDarkWyrm
372614de12dSAxel Dörfler
3733a83c7b1SAxel Dörfler/*!	\brief Returns the decorator's title
374a3d04b0eSDarkWyrm	\return the decorator's title
375a3d04b0eSDarkWyrm*/
37659345e26SStephan Aßmusconst char*
377bb2e9b06SClemens ZeidlerDecorator::Title(int32 tab) const
378a3d04b0eSDarkWyrm{
379bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
380bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
381bb2e9b06SClemens Zeidler		return "";
382bb2e9b06SClemens Zeidler	return decoratorTab->title;
383a3d04b0eSDarkWyrm}
384a3d04b0eSDarkWyrm
38585f8bb71SAxel Dörfler
386bb2e9b06SClemens Zeidlerconst char*
387bb2e9b06SClemens ZeidlerDecorator::Title(Decorator::Tab* tab) const
38859345e26SStephan Aßmus{
389bb2e9b06SClemens Zeidler	return tab->title;
3907641924eSAdi Oanca}
3917641924eSAdi Oanca
39285f8bb71SAxel Dörfler
393bb2e9b06SClemens Zeidlerbool
394bb2e9b06SClemens ZeidlerDecorator::SetTabLocation(int32 tab, float location, bool isShifting,
395bb2e9b06SClemens Zeidler	BRegion* updateRegion)
39659345e26SStephan Aßmus{
397bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
398bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
399bb2e9b06SClemens Zeidler		return false;
400bb2e9b06SClemens Zeidler	if (_SetTabLocation(decoratorTab, location, isShifting, updateRegion)) {
401bb2e9b06SClemens Zeidler		_InvalidateFootprint();
402bb2e9b06SClemens Zeidler		return true;
403bb2e9b06SClemens Zeidler	}
404bb2e9b06SClemens Zeidler	return false;
4057641924eSAdi Oanca}
4067641924eSAdi Oanca
40703b82a62SRene Gollent
4083a83c7b1SAxel Dörfler
409bb2e9b06SClemens Zeidler/*!	\brief Changes the focus value of the decorator
410bb2e9b06SClemens Zeidler
411bb2e9b06SClemens Zeidler	While this call will not update the screen, it will affect how future
412bb2e9b06SClemens Zeidler	updates work.
413bb2e9b06SClemens Zeidler
414bb2e9b06SClemens Zeidler	\param active True if active, false if not
41559345e26SStephan Aßmus*/
416bb2e9b06SClemens Zeidlervoid
417bb2e9b06SClemens ZeidlerDecorator::SetFocus(int32 tab, bool active)
41859345e26SStephan Aßmus{
419bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
420bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
421bb2e9b06SClemens Zeidler		return;
422bb2e9b06SClemens Zeidler	decoratorTab->isFocused = active;
423bb2e9b06SClemens Zeidler	_SetFocus(decoratorTab);
424bb2e9b06SClemens Zeidler	// TODO: maybe it would be cleaner to handle the redraw here.
42559345e26SStephan Aßmus}
42659345e26SStephan Aßmus
4273a83c7b1SAxel Dörfler
42859345e26SStephan Aßmusbool
429bb2e9b06SClemens ZeidlerDecorator::IsFocus(int32 tab) const
43059345e26SStephan Aßmus{
431bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
432bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
433bb2e9b06SClemens Zeidler		return false;
434bb2e9b06SClemens Zeidler	return decoratorTab->isFocused;
435bb2e9b06SClemens Zeidler};
43659345e26SStephan Aßmus
4373a83c7b1SAxel Dörfler
43859345e26SStephan Aßmusbool
439bb2e9b06SClemens ZeidlerDecorator::IsFocus(Decorator::Tab* tab) const
44059345e26SStephan Aßmus{
441bb2e9b06SClemens Zeidler	return tab->isFocused;
44259345e26SStephan Aßmus}
44359345e26SStephan Aßmus
4443a83c7b1SAxel Dörfler
44559345e26SStephan Aßmusvoid
4463a83c7b1SAxel DörflerDecorator::GetSizeLimits(int32* minWidth, int32* minHeight, int32* maxWidth,
4473a83c7b1SAxel Dörfler	int32* maxHeight) const
44859345e26SStephan Aßmus{
44959345e26SStephan Aßmus}
45059345e26SStephan Aßmus
4513a83c7b1SAxel Dörfler
4523a83c7b1SAxel Dörfler//	#pragma mark - virtual methods
4533a83c7b1SAxel Dörfler
4543a83c7b1SAxel Dörfler
45509301a49SClemens Zeidler/*!	\brief Returns a cached footprint if available otherwise recalculate it
456a3d04b0eSDarkWyrm*/
45709301a49SClemens Zeidlerconst BRegion&
45809301a49SClemens ZeidlerDecorator::GetFootprint()
459a3d04b0eSDarkWyrm{
46009301a49SClemens Zeidler	if (!fFootprintValid) {
46109301a49SClemens Zeidler		_GetFootprint(&fFootprint);
46209301a49SClemens Zeidler		fFootprintValid = true;
46309301a49SClemens Zeidler	}
46409301a49SClemens Zeidler	return fFootprint;
46559345e26SStephan Aßmus}
466247a9343SDarkWyrm
467247a9343SDarkWyrm
46889d652d5SIngo Weinhold/*!	\brief Performs hit-testing for the decorator.
46989d652d5SIngo Weinhold
47089d652d5SIngo Weinhold	The base class provides a basic implementation, recognizing only button and
47189d652d5SIngo Weinhold	tab hits. Derived classes must override/enhance it to handle borders and
47289d652d5SIngo Weinhold	corners correctly.
47389d652d5SIngo Weinhold
47489d652d5SIngo Weinhold	\param where The point to be tested.
47589d652d5SIngo Weinhold	\return Either of the following, depending on what was hit:
47689d652d5SIngo Weinhold		- \c REGION_NONE: None of the decorator regions.
47789d652d5SIngo Weinhold		- \c REGION_TAB: The window tab (but none of the buttons embedded).
47889d652d5SIngo Weinhold		- \c REGION_CLOSE_BUTTON: The close button.
47989d652d5SIngo Weinhold		- \c REGION_ZOOM_BUTTON: The zoom button.
48089d652d5SIngo Weinhold		- \c REGION_MINIMIZE_BUTTON: The minimize button.
48189d652d5SIngo Weinhold		- \c REGION_LEFT_BORDER: The left border.
48289d652d5SIngo Weinhold		- \c REGION_RIGHT_BORDER: The right border.
48389d652d5SIngo Weinhold		- \c REGION_TOP_BORDER: The top border.
48489d652d5SIngo Weinhold		- \c REGION_BOTTOM_BORDER: The bottom border.
48589d652d5SIngo Weinhold		- \c REGION_LEFT_TOP_CORNER: The left-top corner.
48689d652d5SIngo Weinhold		- \c REGION_LEFT_BOTTOM_CORNER: The left-bottom corner.
48789d652d5SIngo Weinhold		- \c REGION_RIGHT_TOP_CORNER: The right-top corner.
48889d652d5SIngo Weinhold		- \c REGION_RIGHT_BOTTOM_CORNER The right-bottom corner.
48959345e26SStephan Aßmus*/
49089d652d5SIngo WeinholdDecorator::Region
491bb2e9b06SClemens ZeidlerDecorator::RegionAt(BPoint where, int32& tabIndex) const
492bb2e9b06SClemens Zeidler{
493bb2e9b06SClemens Zeidler	tabIndex = -1;
494bb2e9b06SClemens Zeidler
495bb2e9b06SClemens Zeidler	for (int32 i = 0; i < fTabList.CountItems(); i++) {
496bb2e9b06SClemens Zeidler		Decorator::Tab* tab = fTabList.ItemAt(i);
497bb2e9b06SClemens Zeidler		if (tab->closeRect.Contains(where)) {
498bb2e9b06SClemens Zeidler			tabIndex = i;
499bb2e9b06SClemens Zeidler			return REGION_CLOSE_BUTTON;
500bb2e9b06SClemens Zeidler		}
501bb2e9b06SClemens Zeidler		if (tab->zoomRect.Contains(where)) {
502bb2e9b06SClemens Zeidler			tabIndex = i;
503bb2e9b06SClemens Zeidler			return REGION_ZOOM_BUTTON;
504bb2e9b06SClemens Zeidler		}
505bb2e9b06SClemens Zeidler		if (tab->tabRect.Contains(where)) {
506bb2e9b06SClemens Zeidler			tabIndex = i;
507bb2e9b06SClemens Zeidler			return REGION_TAB;
508bb2e9b06SClemens Zeidler		}
509bb2e9b06SClemens Zeidler	}
51089d652d5SIngo Weinhold
51189d652d5SIngo Weinhold	return REGION_NONE;
51259345e26SStephan Aßmus}
513a3d04b0eSDarkWyrm
5143a83c7b1SAxel Dörfler
5153a83c7b1SAxel Dörfler/*!	\brief Moves the decorator frame and all default rectangles
5160a3f410fSAxel Dörfler
517a3d04b0eSDarkWyrm	If a subclass implements this method, be sure to call Decorator::MoveBy
5183a83c7b1SAxel Dörfler	to ensure that internal members are also updated. All members of the
5193a83c7b1SAxel Dörfler	Decorator class are automatically moved in this method
5203a83c7b1SAxel Dörfler
5213a83c7b1SAxel Dörfler	\param x X Offset
5223a83c7b1SAxel Dörfler	\param y y Offset
523a3d04b0eSDarkWyrm*/
52459345e26SStephan Aßmusvoid
52559345e26SStephan AßmusDecorator::MoveBy(float x, float y)
526a3d04b0eSDarkWyrm{
527e067fed5SStephan Aßmus	MoveBy(BPoint(x, y));
528a3d04b0eSDarkWyrm}
529a3d04b0eSDarkWyrm
5303a83c7b1SAxel Dörfler
5313a83c7b1SAxel Dörfler/*!	\brief Moves the decorator frame and all default rectangles
5320a3f410fSAxel Dörfler
533a3d04b0eSDarkWyrm	If a subclass implements this method, be sure to call Decorator::MoveBy
5343a83c7b1SAxel Dörfler	to ensure that internal members are also updated. All members of the
5353a83c7b1SAxel Dörfler	Decorator class are automatically moved in this method
5363a83c7b1SAxel Dörfler
5373a83c7b1SAxel Dörfler	\param offset BPoint containing the offsets
538a3d04b0eSDarkWyrm*/
53959345e26SStephan Aßmusvoid
5403a83c7b1SAxel DörflerDecorator::MoveBy(BPoint offset)
541a3d04b0eSDarkWyrm{
54209301a49SClemens Zeidler	if (fFootprintValid)
54309301a49SClemens Zeidler		fFootprint.OffsetBy(offset.x, offset.y);
54409301a49SClemens Zeidler
54509301a49SClemens Zeidler	_MoveBy(offset);
546a3d04b0eSDarkWyrm}
547a3d04b0eSDarkWyrm
5483a83c7b1SAxel Dörfler
5493a83c7b1SAxel Dörfler/*!	\brief Resizes the decorator frame
5500a3f410fSAxel Dörfler
5513a83c7b1SAxel Dörfler	This is a required function for subclasses to implement - the default does
5523a83c7b1SAxel Dörfler	nothing. Note that window resize flags should be followed and fFrame should
5533a83c7b1SAxel Dörfler	be resized accordingly. It would also be a wise idea to ensure that the
5540a3f410fSAxel Dörfler	window's rectangles are not inverted.
5553a83c7b1SAxel Dörfler
5563a83c7b1SAxel Dörfler	\param x x offset
5573a83c7b1SAxel Dörfler	\param y y offset
558a3d04b0eSDarkWyrm*/
55959345e26SStephan Aßmusvoid
560e067fed5SStephan AßmusDecorator::ResizeBy(float x, float y, BRegion* dirty)
561a3d04b0eSDarkWyrm{
562e067fed5SStephan Aßmus	ResizeBy(BPoint(x, y), dirty);
563a3d04b0eSDarkWyrm}
564a3d04b0eSDarkWyrm
565b30e9021SStephan Aßmus
56609301a49SClemens Zeidlervoid
56709301a49SClemens ZeidlerDecorator::ResizeBy(BPoint offset, BRegion* dirty)
56809301a49SClemens Zeidler{
56909301a49SClemens Zeidler	_ResizeBy(offset, dirty);
570962281e8SClemens Zeidler	_InvalidateFootprint();
57109301a49SClemens Zeidler}
57209301a49SClemens Zeidler
57309301a49SClemens Zeidler
5742b602c73SIngo Weinhold/*!	\brief Sets a specific highlight for a decorator region.
5752b602c73SIngo Weinhold
5762b602c73SIngo Weinhold	Can be overridden by derived classes, but the base class version must be
5772b602c73SIngo Weinhold	called, if the highlight shall be applied.
5782b602c73SIngo Weinhold
5792b602c73SIngo Weinhold	\param region The decorator region.
5802b602c73SIngo Weinhold	\param highlight The value identifying the kind of highlight.
5812b602c73SIngo Weinhold	\param dirty The dirty region to be extended, if the highlight changes. Can
5822b602c73SIngo Weinhold		be \c NULL.
5832b602c73SIngo Weinhold	\return \c true, if the highlight could be applied.
5842b602c73SIngo Weinhold*/
5852b602c73SIngo Weinholdbool
586bb2e9b06SClemens ZeidlerDecorator::SetRegionHighlight(Region region, uint8 highlight, BRegion* dirty,
587bb2e9b06SClemens Zeidler	int32 tab)
5882b602c73SIngo Weinhold{
5892b602c73SIngo Weinhold	int32 index = (int32)region - 1;
5902b602c73SIngo Weinhold	if (index < 0 || index >= REGION_COUNT - 1)
5912b602c73SIngo Weinhold		return false;
5922b602c73SIngo Weinhold
593a54ffcd2SClemens Zeidler	if (fRegionHighlights[index] == highlight)
594a54ffcd2SClemens Zeidler		return true;
5952b602c73SIngo Weinhold	fRegionHighlights[index] = highlight;
5962b602c73SIngo Weinhold
5972b602c73SIngo Weinhold	if (dirty != NULL)
5982b602c73SIngo Weinhold		ExtendDirtyRegion(region, *dirty);
5992b602c73SIngo Weinhold
6002b602c73SIngo Weinhold	return true;
6012b602c73SIngo Weinhold}
6022b602c73SIngo Weinhold
6032b602c73SIngo Weinhold
604b30e9021SStephan Aßmusbool
605b30e9021SStephan AßmusDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
606b30e9021SStephan Aßmus{
60709301a49SClemens Zeidler	if (_SetSettings(settings, updateRegion)) {
608962281e8SClemens Zeidler		_InvalidateFootprint();
60909301a49SClemens Zeidler		return true;
61009301a49SClemens Zeidler	}
611b30e9021SStephan Aßmus	return false;
612b30e9021SStephan Aßmus}
613b30e9021SStephan Aßmus
614b30e9021SStephan Aßmus
615b30e9021SStephan Aßmusbool
616b30e9021SStephan AßmusDecorator::GetSettings(BMessage* settings) const
617b30e9021SStephan Aßmus{
618b30e9021SStephan Aßmus	return false;
619b30e9021SStephan Aßmus}
620b30e9021SStephan Aßmus
621b30e9021SStephan Aßmus
6223a83c7b1SAxel Dörfler/*!	\brief Updates the decorator's look in the area \a rect
6233a83c7b1SAxel Dörfler
624a3d04b0eSDarkWyrm	The default version updates all areas which intersect the frame and tab.
6253a83c7b1SAxel Dörfler
6263a83c7b1SAxel Dörfler	\param rect The area to update.
627a3d04b0eSDarkWyrm*/
62859345e26SStephan Aßmusvoid
6293a83c7b1SAxel DörflerDecorator::Draw(BRect rect)
630a3d04b0eSDarkWyrm{
6313a83c7b1SAxel Dörfler	_DrawFrame(rect & fFrame);
632bb2e9b06SClemens Zeidler	_DrawTabs(rect & fTitleBarRect);
633a3d04b0eSDarkWyrm}
634a3d04b0eSDarkWyrm
6353a83c7b1SAxel Dörfler
636a3d04b0eSDarkWyrm//! Forces a complete decorator update
63759345e26SStephan Aßmusvoid
63859345e26SStephan AßmusDecorator::Draw()
639a3d04b0eSDarkWyrm{
6402cfe93e7SStephan Aßmus	_DrawFrame(fFrame);
641bb2e9b06SClemens Zeidler	_DrawTabs(fTitleBarRect);
642a3d04b0eSDarkWyrm}
643a3d04b0eSDarkWyrm
6443a83c7b1SAxel Dörfler
645bb2e9b06SClemens Zeidler//! draws the frame
64659345e26SStephan Aßmusvoid
647bb2e9b06SClemens ZeidlerDecorator::DrawFrame()
648a3d04b0eSDarkWyrm{
649bb2e9b06SClemens Zeidler	_DrawFrame(fFrame);
650a3d04b0eSDarkWyrm}
651a3d04b0eSDarkWyrm
6523a83c7b1SAxel Dörfler
653bb2e9b06SClemens Zeidler//! draws the tab, title, and buttons
65459345e26SStephan Aßmusvoid
655bb2e9b06SClemens ZeidlerDecorator::DrawTab(int32 tabIndex)
656a3d04b0eSDarkWyrm{
657bb2e9b06SClemens Zeidler	Decorator::Tab* tab = fTabList.ItemAt(tabIndex);
658bb2e9b06SClemens Zeidler	if (tab == NULL)
659bb2e9b06SClemens Zeidler		return;
660bb2e9b06SClemens Zeidler
661bb2e9b06SClemens Zeidler	_DrawTab(tab, tab->tabRect);
66286b01082SClemens Zeidler	_DrawZoom(tab, false, tab->zoomRect);
66386b01082SClemens Zeidler	_DrawMinimize(tab, false, tab->minimizeRect);
664bb2e9b06SClemens Zeidler	_DrawTitle(tab, tab->tabRect);
66586b01082SClemens Zeidler	_DrawClose(tab, false, tab->closeRect);
666a3d04b0eSDarkWyrm}
667a3d04b0eSDarkWyrm
6683a83c7b1SAxel Dörfler
669bb2e9b06SClemens Zeidler//! Draws the close button
67059345e26SStephan Aßmusvoid
671bb2e9b06SClemens ZeidlerDecorator::DrawClose(int32 tab)
672a3d04b0eSDarkWyrm{
673bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
674bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
675bb2e9b06SClemens Zeidler		return;
67686b01082SClemens Zeidler	_DrawClose(decoratorTab, true, decoratorTab->closeRect);
677a3d04b0eSDarkWyrm}
678a3d04b0eSDarkWyrm
6793a83c7b1SAxel Dörfler
680bb2e9b06SClemens Zeidler//! draws the minimize button
68159345e26SStephan Aßmusvoid
682bb2e9b06SClemens ZeidlerDecorator::DrawMinimize(int32 tab)
683a3d04b0eSDarkWyrm{
684bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
685bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
686bb2e9b06SClemens Zeidler		return;
687bb2e9b06SClemens Zeidler	_DrawTab(decoratorTab, decoratorTab->minimizeRect);
688a3d04b0eSDarkWyrm}
689a3d04b0eSDarkWyrm
6903a83c7b1SAxel Dörfler
6913a83c7b1SAxel Dörfler//! draws the title
69259345e26SStephan Aßmusvoid
693bb2e9b06SClemens ZeidlerDecorator::DrawTitle(int32 tab)
694a3d04b0eSDarkWyrm{
695bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
696bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
697bb2e9b06SClemens Zeidler		return;
698bb2e9b06SClemens Zeidler	_DrawTitle(decoratorTab, decoratorTab->tabRect);
699a3d04b0eSDarkWyrm}
700a3d04b0eSDarkWyrm
7013a83c7b1SAxel Dörfler
702a3d04b0eSDarkWyrm//! draws the zoom button
70359345e26SStephan Aßmusvoid
704bb2e9b06SClemens ZeidlerDecorator::DrawZoom(int32 tab)
705a3d04b0eSDarkWyrm{
706bb2e9b06SClemens Zeidler	Decorator::Tab* decoratorTab = fTabList.ItemAt(tab);
707bb2e9b06SClemens Zeidler	if (decoratorTab == NULL)
708bb2e9b06SClemens Zeidler		return;
70986b01082SClemens Zeidler	_DrawZoom(decoratorTab, true, decoratorTab->zoomRect);
710a3d04b0eSDarkWyrm}
711a3d04b0eSDarkWyrm
71223ae77aaSAxel Dörfler
713f7e1df75SStephan Aßmusrgb_color
71423ae77aaSAxel DörflerDecorator::UIColor(color_which which)
71523ae77aaSAxel Dörfler{
71623ae77aaSAxel Dörfler	// TODO: for now - calling ui_color() from within the app_server
71723ae77aaSAxel Dörfler	//	will always return the default colors (as there is no be_app)
71823ae77aaSAxel Dörfler	return ui_color(which);
71923ae77aaSAxel Dörfler}
72023ae77aaSAxel Dörfler
72123ae77aaSAxel Dörfler
7222b602c73SIngo Weinhold/*!	\brief Extends a dirty region by a decorator region.
7232b602c73SIngo Weinhold
7242b602c73SIngo Weinhold	Must be implemented by derived classes.
7252b602c73SIngo Weinhold
7262b602c73SIngo Weinhold	\param region The decorator region.
7272b602c73SIngo Weinhold	\param dirty The dirty region to be extended.
7282b602c73SIngo Weinhold*/
7292b602c73SIngo Weinholdvoid
7302b602c73SIngo WeinholdDecorator::ExtendDirtyRegion(Region region, BRegion& dirty)
7312b602c73SIngo Weinhold{
7322b602c73SIngo Weinhold}
7332b602c73SIngo Weinhold
7342b602c73SIngo Weinhold
73559345e26SStephan Aßmus//! Function for calculating layout for the decorator
73659345e26SStephan Aßmusvoid
73759345e26SStephan AßmusDecorator::_DoLayout()
738a3d04b0eSDarkWyrm{
739a3d04b0eSDarkWyrm}
740a3d04b0eSDarkWyrm
7413a83c7b1SAxel Dörfler
7423a83c7b1SAxel Dörfler/*!	\brief Actually draws the frame
7433a83c7b1SAxel Dörfler	\param rect Area of the frame to update
744a3d04b0eSDarkWyrm*/
74559345e26SStephan Aßmusvoid
7463a83c7b1SAxel DörflerDecorator::_DrawFrame(BRect rect)
747a3d04b0eSDarkWyrm{
748a3d04b0eSDarkWyrm}
749a3d04b0eSDarkWyrm
7503a83c7b1SAxel Dörfler
751bb2e9b06SClemens Zeidler
752bb2e9b06SClemens Zeidlervoid
753bb2e9b06SClemens ZeidlerDecorator::_DrawTabs(BRect rect)
754bb2e9b06SClemens Zeidler{
755bb2e9b06SClemens Zeidler	Decorator::Tab* focusTab = NULL;
756bb2e9b06SClemens Zeidler	for (int32 i = 0; i < fTabList.CountItems(); i++) {
757bb2e9b06SClemens Zeidler		Decorator::Tab* tab = fTabList.ItemAt(i);
758bb2e9b06SClemens Zeidler		if (tab->isFocused) {
759bb2e9b06SClemens Zeidler			focusTab = tab;
760bb2e9b06SClemens Zeidler			continue;
761bb2e9b06SClemens Zeidler		}
762bb2e9b06SClemens Zeidler		_DrawTab(tab, rect);
763bb2e9b06SClemens Zeidler	}
764bb2e9b06SClemens Zeidler	if (focusTab != NULL)
765bb2e9b06SClemens Zeidler		_DrawTab(focusTab, rect);
766bb2e9b06SClemens Zeidler}
767bb2e9b06SClemens Zeidler
768bb2e9b06SClemens Zeidler
7693a83c7b1SAxel Dörfler/*!	\brief Actually draws the tab
7700a3f410fSAxel Dörfler
7713a83c7b1SAxel Dörfler	This function is called when the tab itself needs drawn. Other items,
7723a83c7b1SAxel Dörfler	like the window title or buttons, should not be drawn here.
7733a83c7b1SAxel Dörfler
7743a83c7b1SAxel Dörfler	\param rect Area of the tab to update
775a3d04b0eSDarkWyrm*/
77659345e26SStephan Aßmusvoid
777bb2e9b06SClemens ZeidlerDecorator::_DrawTab(Decorator::Tab* tab, BRect rect)
778a3d04b0eSDarkWyrm{
779a3d04b0eSDarkWyrm}
780a3d04b0eSDarkWyrm
7813a83c7b1SAxel Dörfler
7823a83c7b1SAxel Dörfler/*!	\brief Actually draws the close button
7833a83c7b1SAxel Dörfler
7843a83c7b1SAxel Dörfler	Unless a subclass has a particularly large button, it is probably
7853a83c7b1SAxel Dörfler	unnecessary to check the update rectangle.
7863a83c7b1SAxel Dörfler
7873a83c7b1SAxel Dörfler	\param rect Area of the button to update
788a3d04b0eSDarkWyrm*/
78959345e26SStephan Aßmusvoid
79086b01082SClemens ZeidlerDecorator::_DrawClose(Decorator::Tab* tab, bool direct, BRect rect)
791a3d04b0eSDarkWyrm{
792a3d04b0eSDarkWyrm}
793a3d04b0eSDarkWyrm
7943a83c7b1SAxel Dörfler
7953a83c7b1SAxel Dörfler/*!	\brief Actually draws the title
7963a83c7b1SAxel Dörfler
7973a83c7b1SAxel Dörfler	The main tasks for this function are to ensure that the decorator draws
7983a83c7b1SAxel Dörfler	the title only in its own area and drawing the title itself.
7993a83c7b1SAxel Dörfler	Using B_OP_COPY for drawing the title is recommended because of the marked
8003a83c7b1SAxel Dörfler	performance hit of the other drawing modes, but it is not a requirement.
8013a83c7b1SAxel Dörfler
8023a83c7b1SAxel Dörfler	\param rect area of the title to update
803a3d04b0eSDarkWyrm*/
80459345e26SStephan Aßmusvoid
805bb2e9b06SClemens ZeidlerDecorator::_DrawTitle(Decorator::Tab* tab, BRect rect)
806a3d04b0eSDarkWyrm{
807a3d04b0eSDarkWyrm}
808a3d04b0eSDarkWyrm
8093a83c7b1SAxel Dörfler
8103a83c7b1SAxel Dörfler/*!	\brief Actually draws the zoom button
8110a3f410fSAxel Dörfler
8123a83c7b1SAxel Dörfler	Unless a subclass has a particularly large button, it is probably
8133a83c7b1SAxel Dörfler	unnecessary to check the update rectangle.
8143a83c7b1SAxel Dörfler
8153a83c7b1SAxel Dörfler	\param rect Area of the button to update
816a3d04b0eSDarkWyrm*/
81759345e26SStephan Aßmusvoid
81886b01082SClemens ZeidlerDecorator::_DrawZoom(Decorator::Tab* tab, bool direct, BRect rect)
819a3d04b0eSDarkWyrm{
820a3d04b0eSDarkWyrm}
821a3d04b0eSDarkWyrm
822dae7413eSDarkWyrm/*!
82359345e26SStephan Aßmus	\brief Actually draws the minimize button
8240a3f410fSAxel Dörfler
8253a83c7b1SAxel Dörfler	Unless a subclass has a particularly large button, it is probably
8263a83c7b1SAxel Dörfler	unnecessary to check the update rectangle.
8273a83c7b1SAxel Dörfler
8283a83c7b1SAxel Dörfler	\param rect Area of the button to update
829dae7413eSDarkWyrm*/
83059345e26SStephan Aßmusvoid
83186b01082SClemens ZeidlerDecorator::_DrawMinimize(Decorator::Tab* tab, bool direct, BRect rect)
832bb2e9b06SClemens Zeidler{
833bb2e9b06SClemens Zeidler}
834bb2e9b06SClemens Zeidler
835bb2e9b06SClemens Zeidler
836bb2e9b06SClemens Zeidlerbool
837bb2e9b06SClemens ZeidlerDecorator::_SetTabLocation(Decorator::Tab* tab, float location, bool isShifting,
838bb2e9b06SClemens Zeidler	BRegion* /*updateRegion*/)
839dae7413eSDarkWyrm{
840bb2e9b06SClemens Zeidler	return false;
841dae7413eSDarkWyrm}
842dae7413eSDarkWyrm
8433a83c7b1SAxel Dörfler
84459345e26SStephan Aßmus//! Hook function called when the decorator changes focus
84559345e26SStephan Aßmusvoid
846bb2e9b06SClemens ZeidlerDecorator::_SetFocus(Decorator::Tab* tab)
847a3d04b0eSDarkWyrm{
848a3d04b0eSDarkWyrm}
84909301a49SClemens Zeidler
85009301a49SClemens Zeidler
85109301a49SClemens Zeidlervoid
85209301a49SClemens ZeidlerDecorator::_FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
85309301a49SClemens Zeidler{
85409301a49SClemens Zeidler}
85509301a49SClemens Zeidler
85609301a49SClemens Zeidler
85709301a49SClemens Zeidlervoid
8581c141573SClemens ZeidlerDecorator::_SetLook(Decorator::Tab* tab, DesktopSettings& settings,
8591c141573SClemens Zeidler	window_look look, BRegion* updateRect)
86009301a49SClemens Zeidler{
8611c141573SClemens Zeidler	tab->look = look;
86209301a49SClemens Zeidler}
86309301a49SClemens Zeidler
86409301a49SClemens Zeidler
86509301a49SClemens Zeidlervoid
8661c141573SClemens ZeidlerDecorator::_SetFlags(Decorator::Tab* tab, uint32 flags, BRegion* updateRegion)
86709301a49SClemens Zeidler{
8681c141573SClemens Zeidler	tab->flags = flags;
86909301a49SClemens Zeidler}
87009301a49SClemens Zeidler
87109301a49SClemens Zeidler
87209301a49SClemens Zeidlervoid
87309301a49SClemens ZeidlerDecorator::_MoveBy(BPoint offset)
87409301a49SClemens Zeidler{
875bb2e9b06SClemens Zeidler	for (int32 i = 0; i < fTabList.CountItems(); i++) {
876bb2e9b06SClemens Zeidler		Decorator::Tab* tab = fTabList.ItemAt(i);
877bb2e9b06SClemens Zeidler
878bb2e9b06SClemens Zeidler		tab->zoomRect.OffsetBy(offset);
879bb2e9b06SClemens Zeidler		tab->closeRect.OffsetBy(offset);
880bb2e9b06SClemens Zeidler		tab->minimizeRect.OffsetBy(offset);
881bb2e9b06SClemens Zeidler		tab->tabRect.OffsetBy(offset);
882bb2e9b06SClemens Zeidler	}
883bb2e9b06SClemens Zeidler	fTitleBarRect.OffsetBy(offset);
88409301a49SClemens Zeidler	fFrame.OffsetBy(offset);
88509301a49SClemens Zeidler	fResizeRect.OffsetBy(offset);
88609301a49SClemens Zeidler	fBorderRect.OffsetBy(offset);
88709301a49SClemens Zeidler}
88809301a49SClemens Zeidler
88909301a49SClemens Zeidler
89009301a49SClemens Zeidlerbool
89109301a49SClemens ZeidlerDecorator::_SetSettings(const BMessage& settings, BRegion* updateRegion)
89209301a49SClemens Zeidler{
89309301a49SClemens Zeidler	return false;
89409301a49SClemens Zeidler}
89509301a49SClemens Zeidler
89609301a49SClemens Zeidler
89709301a49SClemens Zeidler/*!	\brief Returns the "footprint" of the entire window, including decorator
89809301a49SClemens Zeidler
89909301a49SClemens Zeidler	This function is required by all subclasses.
90009301a49SClemens Zeidler
90109301a49SClemens Zeidler	\param region Region to be changed to represent the window's screen
90209301a49SClemens Zeidler		footprint
90309301a49SClemens Zeidler*/
90409301a49SClemens Zeidlervoid
90509301a49SClemens ZeidlerDecorator::_GetFootprint(BRegion *region)
90609301a49SClemens Zeidler{
90709301a49SClemens Zeidler}
908962281e8SClemens Zeidler
909962281e8SClemens Zeidler
910962281e8SClemens Zeidlervoid
911962281e8SClemens ZeidlerDecorator::_InvalidateFootprint()
912962281e8SClemens Zeidler{
913962281e8SClemens Zeidler	fFootprintValid = false;
914962281e8SClemens Zeidler}
915