1/*
2 * Copyright (C) 2010 Stephan A��mus <superstippi@gmx.de>
3 *
4 * All rights reserved. Distributed under the terms of the MIT License.
5 */
6#ifndef TAB_VIEW_H
7#define TAB_VIEW_H
8
9#include <AbstractLayoutItem.h>
10#include <Rect.h>
11#include <String.h>
12
13
14class BMessage;
15class BView;
16class TabContainerView;
17class TabLayoutItem;
18
19
20class TabView {
21public:
22								TabView();
23	virtual						~TabView();
24
25	virtual	BSize				MinSize();
26	virtual	BSize				PreferredSize();
27	virtual	BSize				MaxSize();
28
29			void 				Draw(BRect updateRect);
30	virtual	void				DrawBackground(BView* owner, BRect frame,
31									const BRect& updateRect);
32	virtual	void				DrawContents(BView* owner, BRect frame,
33									const BRect& updateRect);
34
35	virtual	void				MouseDown(BPoint where, uint32 buttons);
36	virtual	void				MouseUp(BPoint where);
37	virtual	void				MouseMoved(BPoint where, uint32 transit,
38									const BMessage* dragMessage);
39
40	virtual	void				Update();
41
42			BLayoutItem*		LayoutItem() const;
43
44			void				SetContainerView(TabContainerView* view);
45			TabContainerView*	ContainerView() const;
46
47			void				SetLabel(const char* label);
48			const BString&		Label() const;
49
50			BRect				Frame() const;
51
52private:
53			float				_LabelHeight() const;
54
55private:
56			TabContainerView*	fContainerView;
57			TabLayoutItem*		fLayoutItem;
58
59			BString				fLabel;
60};
61
62
63class TabLayoutItem : public BAbstractLayoutItem {
64public:
65								TabLayoutItem(TabView* parent);
66
67	virtual	bool				IsVisible();
68	virtual	void				SetVisible(bool visible);
69
70	virtual	BRect				Frame();
71	virtual	void				SetFrame(BRect frame);
72
73	virtual	BView*				View();
74
75	virtual	BSize				BaseMinSize();
76	virtual	BSize				BaseMaxSize();
77	virtual	BSize				BasePreferredSize();
78	virtual	BAlignment			BaseAlignment();
79
80			TabView*			Parent() const;
81			void				InvalidateContainer();
82			void				InvalidateContainer(BRect frame);
83private:
84			TabView*			fParent;
85			BRect				fFrame;
86			bool				fVisible;
87};
88
89
90
91#endif // TAB_VIEW_H
92