1/*
2 * Copyright 2009, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _SEPARATOR_VIEW_H
6#define _SEPARATOR_VIEW_H
7
8
9#include <Alignment.h>
10#include <String.h>
11#include <View.h>
12
13
14class BSeparatorView : public BView {
15public:
16								BSeparatorView(orientation orientation,
17									border_style border = B_PLAIN_BORDER);
18								BSeparatorView(const char* name,
19									const char* label,
20									orientation orientation = B_HORIZONTAL,
21									border_style border = B_FANCY_BORDER,
22									const BAlignment& alignment
23										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
24											B_ALIGN_VERTICAL_CENTER));
25								BSeparatorView(const char* name,
26									BView* labelView,
27									orientation orientation = B_HORIZONTAL,
28									border_style border = B_FANCY_BORDER,
29									const BAlignment& alignment
30										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
31											B_ALIGN_VERTICAL_CENTER));
32								BSeparatorView(const char* label = NULL,
33									orientation orientation = B_HORIZONTAL,
34									border_style border = B_FANCY_BORDER,
35									const BAlignment& alignment
36										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
37											B_ALIGN_VERTICAL_CENTER));
38								BSeparatorView(BView* labelView,
39									orientation orientation = B_HORIZONTAL,
40									border_style border = B_FANCY_BORDER,
41									const BAlignment& alignment
42										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
43											B_ALIGN_VERTICAL_CENTER));
44
45								BSeparatorView(BMessage* archive);
46
47	virtual						~BSeparatorView();
48
49	static 	BArchivable*		Instantiate(BMessage* archive);
50	virtual	status_t			Archive(BMessage* into,
51									bool deep = true) const;
52
53	virtual	void				Draw(BRect updateRect);
54
55	virtual	void				GetPreferredSize(float* width, float* height);
56	virtual	BSize				MinSize();
57	virtual	BSize				MaxSize();
58	virtual	BSize				PreferredSize();
59
60			void				SetOrientation(orientation orientation);
61			void				SetAlignment(const BAlignment& aligment);
62			void				SetBorderStyle(border_style border);
63
64			void				SetLabel(const char* label);
65			void				SetLabel(BView* view, bool deletePrevious);
66
67	virtual status_t			Perform(perform_code code, void* data);
68
69protected:
70	virtual	void				DoLayout();
71
72private:
73	// FBC padding
74	virtual	void				_ReservedSeparatorView1();
75	virtual	void				_ReservedSeparatorView2();
76	virtual	void				_ReservedSeparatorView3();
77	virtual	void				_ReservedSeparatorView4();
78	virtual	void				_ReservedSeparatorView5();
79	virtual	void				_ReservedSeparatorView6();
80	virtual	void				_ReservedSeparatorView7();
81	virtual	void				_ReservedSeparatorView8();
82	virtual	void				_ReservedSeparatorView9();
83	virtual	void				_ReservedSeparatorView10();
84
85private:
86			void				_Init(const char* label, BView* labelView,
87									orientation orientation,
88									BAlignment alignment, border_style border);
89
90			float				_BorderSize() const;
91			BRect				_MaxLabelBounds() const;
92
93private:
94			BString				fLabel;
95			BView*				fLabelView;
96
97			orientation			fOrientation;
98			BAlignment			fAlignment;
99			border_style		fBorder;
100
101			uint32				_reserved[10];
102};
103
104#endif // _SEPARATOR_VIEW_H
105