Make UEFI boot-platform build again
[haiku.git] / headers / os / interface / TextControl.h
blob3c8792bc7171f46c18a5eab5619717459ffeb63a
1 /*
2 * Copyright 2006-2015, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _TEXT_CONTROL_H
6 #define _TEXT_CONTROL_H
9 #include <Control.h>
10 #include <TextView.h>
13 class BLayoutItem;
14 namespace BPrivate {
15 class _BTextInput_;
19 class BTextControl : public BControl {
20 public:
21 BTextControl(BRect frame, const char* name,
22 const char* label, const char* initialText,
23 BMessage* message,
24 uint32 resizeMask = B_FOLLOW_LEFT_TOP,
25 uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
26 BTextControl(const char* name,
27 const char* label, const char* initialText,
28 BMessage* message,
29 uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
30 BTextControl(const char* label,
31 const char* initialText,
32 BMessage* message);
33 virtual ~BTextControl();
35 BTextControl(BMessage* archive);
36 static BArchivable* Instantiate(BMessage* archive);
37 virtual status_t Archive(BMessage* archive,
38 bool deep = true) const;
40 virtual void SetText(const char* text);
41 const char* Text() const;
42 int32 TextLength() const;
43 void MarkAsInvalid(bool invalid);
45 virtual void SetValue(int32 value);
46 virtual status_t Invoke(BMessage* message = NULL);
48 BTextView* TextView() const;
50 virtual void SetModificationMessage(BMessage* message);
51 BMessage* ModificationMessage() const;
53 virtual void SetAlignment(alignment label, alignment text);
54 void GetAlignment(alignment* _label,
55 alignment* _text) const;
56 virtual void SetDivider(float position);
57 float Divider() const;
59 virtual void Draw(BRect updateRect);
60 virtual void MouseDown(BPoint where);
61 virtual void AttachedToWindow();
62 virtual void MakeFocus(bool focus = true);
63 virtual void SetEnabled(bool enable);
64 virtual void FrameMoved(BPoint newPosition);
65 virtual void FrameResized(float newWidth, float newHeight);
66 virtual void WindowActivated(bool active);
68 virtual void GetPreferredSize(float* _width,
69 float* _height);
70 virtual void ResizeToPreferred();
72 virtual void MessageReceived(BMessage* message);
73 virtual BHandler* ResolveSpecifier(BMessage* message,
74 int32 index, BMessage* specifier,
75 int32 what, const char* property);
77 virtual void MouseUp(BPoint where);
78 virtual void MouseMoved(BPoint where, uint32 transit,
79 const BMessage* dragMessage);
80 virtual void DetachedFromWindow();
82 virtual void AllAttached();
83 virtual void AllDetached();
84 virtual status_t GetSupportedSuites(BMessage* data);
85 virtual void SetFlags(uint32 flags);
87 virtual BSize MinSize();
88 virtual BSize MaxSize();
89 virtual BSize PreferredSize();
90 virtual BAlignment LayoutAlignment();
92 BLayoutItem* CreateLabelLayoutItem();
93 BLayoutItem* CreateTextViewLayoutItem();
95 protected:
96 virtual status_t AllArchived(BMessage* into) const;
97 virtual status_t AllUnarchived(const BMessage* from);
99 virtual void LayoutInvalidated(bool descendants);
100 virtual void DoLayout();
102 virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
104 private:
105 // FBC padding and forbidden methods
106 virtual status_t Perform(perform_code d, void* arg);
108 virtual void _ReservedTextControl1();
109 virtual void _ReservedTextControl2();
110 virtual void _ReservedTextControl3();
111 virtual void _ReservedTextControl4();
113 BTextControl& operator=(const BTextControl& other);
115 private:
116 class LabelLayoutItem;
117 class TextViewLayoutItem;
118 struct LayoutData;
120 friend class _BTextInput_;
121 friend class LabelLayoutItem;
122 friend class TextViewLayoutItem;
124 void _CommitValue();
125 void _UpdateTextViewColors(bool enable);
126 void _InitData(const char* label,
127 const BMessage* archive = NULL);
128 void _InitText(const char* initialText,
129 const BMessage* archive = NULL);
130 void _ValidateLayout();
131 void _LayoutTextView();
132 void _UpdateFrame();
134 void _ValidateLayoutData();
136 private:
137 BPrivate::_BTextInput_* fText;
138 BMessage* fModificationMessage;
139 alignment fLabelAlign;
140 float fDivider;
142 LayoutData* fLayoutData;
143 uint32 fLook;
145 uint32 _reserved[8];
149 #endif // _TEXT_CONTROL_H