xref: /haiku/src/apps/people/AttributeTextControl.h (revision 385ee03ba83b7a40d315e17b03031b3ca37820c0)
1 /*
2  * Copyright 2005-2011, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Robert Polic
7  *
8  * Copyright 1999, Be Incorporated.   All Rights Reserved.
9  * This file may be used under the terms of the Be Sample Code License.
10  */
11 #ifndef ATTRIBUTE_TEXT_CONTROL_H
12 #define ATTRIBUTE_TEXT_CONTROL_H
13 
14 #include <String.h>
15 #include <TextControl.h>
16 
17 
18 class AttributeTextControl : public BTextControl {
19 public:
20 								AttributeTextControl(const char* label,
21 									const char* attribute);
22 	virtual						~AttributeTextControl();
23 
24 	virtual	void				MouseDown(BPoint);
25 	virtual	void				MouseMoved(BPoint, uint32, const BMessage*);
26 
27 			bool				HasChanged();
28 			void				Revert();
29 			void				Update();
30 
31 			const BString&		Attribute() const
32 									{ return fAttribute; }
33 
34 private:
35 			const BString&		_MakeUniformUrl(BString &url) const;
36 			const BString&		_BuildMimeString(BString &mimeType,
37 									const BString &url) const;
38 
39 			bool				_ContainsUrl() const;
40 
41 			BRect				_VisibleLabelBounds() const;
42 			void				_HandleLabelClicked(const char*);
43 
44 private:
45 			BString				fAttribute;
46 			BString				fOriginalValue;
47 };
48 
49 #endif // ATTRIBUTE_TEXT_CONTROL_H
50