2006-02-10 17:22:33 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _TEXT_CONTROL_H
|
|
|
|
#define _TEXT_CONTROL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Control.h>
|
2006-02-10 17:22:33 +03:00
|
|
|
#include <TextView.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
class BLayoutItem;
|
2002-07-09 16:24:59 +04:00
|
|
|
class _BTextInput_;
|
|
|
|
|
2003-06-20 14:09:19 +04:00
|
|
|
|
2006-02-10 17:22:33 +03:00
|
|
|
class BTextControl : public BControl {
|
|
|
|
public:
|
|
|
|
BTextControl(BRect frame, const char* name,
|
|
|
|
const char* label, const char* initialText,
|
|
|
|
BMessage* message,
|
|
|
|
uint32 resizeMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
|
|
|
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
|
2006-08-26 20:21:15 +04:00
|
|
|
BTextControl(const char* name,
|
|
|
|
const char* label, const char* initialText,
|
|
|
|
BMessage* message,
|
|
|
|
uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
|
|
|
|
BTextControl(const char* label,
|
|
|
|
const char* initialText,
|
|
|
|
BMessage* message);
|
2006-02-10 17:22:33 +03:00
|
|
|
virtual ~BTextControl();
|
|
|
|
|
|
|
|
BTextControl(BMessage* archive);
|
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
|
|
|
virtual status_t Archive(BMessage* archive, bool deep = true) const;
|
|
|
|
|
|
|
|
virtual void SetText(const char* text);
|
|
|
|
const char* Text() const;
|
|
|
|
|
|
|
|
virtual void SetValue(int32 value);
|
|
|
|
virtual status_t Invoke(BMessage* message = NULL);
|
|
|
|
|
|
|
|
BTextView* TextView() const;
|
|
|
|
|
|
|
|
virtual void SetModificationMessage(BMessage* message);
|
|
|
|
BMessage* ModificationMessage() const;
|
|
|
|
|
|
|
|
virtual void SetAlignment(alignment label, alignment text);
|
|
|
|
void GetAlignment(alignment* _label, alignment* _text) const;
|
|
|
|
virtual void SetDivider(float position);
|
|
|
|
float Divider() const;
|
|
|
|
|
|
|
|
virtual void Draw(BRect updateRect);
|
|
|
|
virtual void MouseDown(BPoint where);
|
|
|
|
virtual void AttachedToWindow();
|
|
|
|
virtual void MakeFocus(bool focus = true);
|
|
|
|
virtual void SetEnabled(bool enabled);
|
|
|
|
virtual void FrameMoved(BPoint newPosition);
|
|
|
|
virtual void FrameResized(float newWidth, float newHeight);
|
|
|
|
virtual void WindowActivated(bool active);
|
|
|
|
|
|
|
|
virtual void GetPreferredSize(float* _width, float* _height);
|
|
|
|
virtual void ResizeToPreferred();
|
|
|
|
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
|
|
|
BMessage* specifier, int32 what,
|
|
|
|
const char* property);
|
|
|
|
|
|
|
|
virtual void MouseUp(BPoint point);
|
|
|
|
virtual void MouseMoved(BPoint point, uint32 transit,
|
|
|
|
const BMessage* dragMessage);
|
|
|
|
virtual void DetachedFromWindow();
|
|
|
|
|
|
|
|
virtual void AllAttached();
|
|
|
|
virtual void AllDetached();
|
|
|
|
virtual status_t GetSupportedSuites(BMessage* data);
|
|
|
|
virtual void SetFlags(uint32 flags);
|
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
BLayoutItem* CreateLabelLayoutItem();
|
|
|
|
BLayoutItem* CreateTextViewLayoutItem();
|
|
|
|
|
2006-02-10 17:22:33 +03:00
|
|
|
private:
|
2006-08-26 20:21:15 +04:00
|
|
|
class LabelLayoutItem;
|
|
|
|
class TextViewLayoutItem;
|
|
|
|
|
2006-02-10 17:22:33 +03:00
|
|
|
friend class _BTextInput_;
|
2006-08-26 20:21:15 +04:00
|
|
|
friend class LabelLayoutItem;
|
|
|
|
friend class TextViewLayoutItem;
|
2006-02-10 17:22:33 +03:00
|
|
|
|
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
|
|
|
|
|
|
|
virtual void _ReservedTextControl1();
|
|
|
|
virtual void _ReservedTextControl2();
|
|
|
|
virtual void _ReservedTextControl3();
|
|
|
|
virtual void _ReservedTextControl4();
|
|
|
|
|
|
|
|
BTextControl& operator=(const BTextControl& other);
|
|
|
|
|
|
|
|
void _CommitValue();
|
2006-02-12 04:23:30 +03:00
|
|
|
void _UpdateTextViewColors(bool enabled);
|
2006-02-10 17:22:33 +03:00
|
|
|
void _InitData(const char* label, const char* initialText,
|
|
|
|
BMessage* archive = NULL);
|
2006-08-26 20:21:15 +04:00
|
|
|
void _ValidateLayout();
|
|
|
|
void _UpdateFrame();
|
2006-02-10 17:22:33 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
_BTextInput_* fText;
|
|
|
|
char* fLabel;
|
|
|
|
BMessage* fModificationMessage;
|
|
|
|
alignment fLabelAlign;
|
|
|
|
float fDivider;
|
|
|
|
float fPreviousWidth;
|
|
|
|
float fPreviousHeight;
|
2006-08-26 20:21:15 +04:00
|
|
|
BLayoutItem* fLabelLayoutItem;
|
|
|
|
BLayoutItem* fTextViewLayoutItem;
|
2006-02-10 17:22:33 +03:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
uint32 _reserved[4];
|
2006-02-10 17:22:33 +03:00
|
|
|
|
|
|
|
bool fClean;
|
|
|
|
bool fSkipSetFlags;
|
|
|
|
|
|
|
|
bool _reserved1;
|
|
|
|
bool _reserved2;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2006-02-10 17:22:33 +03:00
|
|
|
#endif // _TEXT_CONTROL_H
|