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(enum orientation orientation,
17									border_style border = B_PLAIN_BORDER);
18								BSeparatorView(const char* name,
19									const char* label,
20									enum orientation orientation
21										= B_HORIZONTAL,
22									border_style border = B_FANCY_BORDER,
23									const BAlignment& alignment
24										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
25											B_ALIGN_VERTICAL_CENTER));
26								BSeparatorView(const char* name,
27									BView* labelView,
28									enum orientation orientation
29										= B_HORIZONTAL,
30									border_style border = B_FANCY_BORDER,
31									const BAlignment& alignment
32										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
33											B_ALIGN_VERTICAL_CENTER));
34								BSeparatorView(const char* label = NULL,
35									enum orientation orientation
36										= B_HORIZONTAL,
37									border_style border = B_FANCY_BORDER,
38									const BAlignment& alignment
39										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
40											B_ALIGN_VERTICAL_CENTER));
41								BSeparatorView(BView* labelView,
42									enum orientation orientation
43										= B_HORIZONTAL,
44									border_style border = B_FANCY_BORDER,
45									const BAlignment& alignment
46										= BAlignment(B_ALIGN_HORIZONTAL_CENTER,
47											B_ALIGN_VERTICAL_CENTER));
48
49								BSeparatorView(BMessage* archive);
50
51	virtual						~BSeparatorView();
52
53	static 	BArchivable*		Instantiate(BMessage* archive);
54	virtual	status_t			Archive(BMessage* into,
55									bool deep = true) const;
56
57	virtual	void				Draw(BRect updateRect);
58
59	virtual	void				GetPreferredSize(float* width, float* height);
60	virtual	BSize				MinSize();
61	virtual	BSize				MaxSize();
62	virtual	BSize				PreferredSize();
63
64			void				SetOrientation(enum orientation orientation);
65			void				SetAlignment(const BAlignment& aligment);
66			void				SetBorderStyle(border_style border);
67
68			void				SetLabel(const char* label);
69			void				SetLabel(BView* view, bool deletePrevious);
70
71	virtual status_t			Perform(perform_code code, void* data);
72
73protected:
74	virtual	void				DoLayout();
75
76private:
77	// FBC padding
78	virtual	void				_ReservedSeparatorView1();
79	virtual	void				_ReservedSeparatorView2();
80	virtual	void				_ReservedSeparatorView3();
81	virtual	void				_ReservedSeparatorView4();
82	virtual	void				_ReservedSeparatorView5();
83	virtual	void				_ReservedSeparatorView6();
84	virtual	void				_ReservedSeparatorView7();
85	virtual	void				_ReservedSeparatorView8();
86	virtual	void				_ReservedSeparatorView9();
87	virtual	void				_ReservedSeparatorView10();
88
89private:
90			void				_Init(const char* label, BView* labelView,
91									enum orientation orientation,
92									BAlignment alignment, border_style border);
93
94			float				_BorderSize() const;
95			BRect				_MaxLabelBounds() const;
96
97private:
98			BString				fLabel;
99			BView*				fLabelView;
100
101			orientation			fOrientation;
102			BAlignment			fAlignment;
103			border_style		fBorder;
104
105			uint32				_reserved[10];
106};
107
108#endif // _SEPARATOR_VIEW_H
109