xref: /haiku/src/tests/kits/interface/layout/widget_layout_test/StringView.h (revision bc3955fea5b07e2e94a27fc05e4bb58fe6f0319b)
1 /*
2  * Copyright 2007, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef WIDGET_LAYOUT_TEST_STRING_VIEW_H
6 #define WIDGET_LAYOUT_TEST_STRING_VIEW_H
7 
8 
9 #include <String.h>
10 
11 #include "View.h"
12 
13 
14 class StringView : public View {
15 public:
16 								StringView(const char* string);
17 
18 			void				SetString(const char* string);
19 			void				SetAlignment(alignment align);
20 			void				SetTextColor(rgb_color color);
21 
22 	virtual	BSize				MinSize();
23 
24 			void				SetExplicitMinSize(BSize size);
25 
26 	virtual	void				AddedToContainer();
27 
28 	virtual	void				Draw(BView* container, BRect updateRect);
29 
30 private:
31 			void				_UpdateStringMetrics();
32 
33 private:
34 			BString				fString;
35 			alignment			fAlignment;
36 			rgb_color			fTextColor;
37 			float				fStringAscent;
38 			float				fStringDescent;
39 			float				fStringWidth;
40 			BSize				fExplicitMinSize;
41 };
42 
43 
44 #endif	// WIDGET_LAYOUT_TEST_STRING_VIEW_H
45