#ifndef ROOT_TGTextEntry
#define ROOT_TGTextEntry
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
#ifndef ROOT_TGTextBuffer
#include "TGTextBuffer.h"
#endif
class TBlinkTimer;
class TGToolTip;
class TColor;
class TGTextEntry : public TGFrame, public TGWidget {
public:
enum EEchoMode { kNormal, kNoEcho, kPassword };
enum EInsertMode { kInsert, kReplace };
protected:
TGTextBuffer *fText;
Int_t fStartX;
Int_t fEndX;
Int_t fStartIX;
Int_t fEndIX;
Bool_t fSelectionOn;
Int_t fOffset;
Int_t fCursorX;
Int_t fCursorIX;
Bool_t fCursorOn;
FontStruct_t fFontStruct;
TGGC fNormGC;
TGGC fSelGC;
GContext_t fSelbackGC;
Atom_t fClipboard;
TBlinkTimer *fCurBlink;
TGToolTip *fTip;
Int_t fMaxLen;
Bool_t fEdited;
Bool_t fFrameDrawn;
EEchoMode fEchoMode;
EInsertMode fInsertMode;
ETextJustification fAlignment;
Bool_t fHasOwnFont;
void CopyText() const;
virtual void DoRedraw();
Int_t GetCharacterIndex(Int_t xcoord);
virtual void Init();
virtual Bool_t IsCursorOutOfFrame();
void Paste();
virtual void PastePrimary(Window_t wid, Atom_t property, Bool_t del);
virtual void ScrollByChar();
virtual void UpdateOffset();
static TString *fgClipboardText;
static const TGFont *fgDefaultFont;
static const TGGC *fgDefaultSelectedGC;
static const TGGC *fgDefaultSelectedBackgroundGC;
static const TGGC *fgDefaultGC;
static const TGGC &GetDefaultSelectedGC();
static const TGGC &GetDefaultSelectedBackgroundGC();
private:
TGTextEntry(const TGTextEntry&);
TGTextEntry& operator=(const TGTextEntry&);
public:
static FontStruct_t GetDefaultFontStruct();
static const TGGC &GetDefaultGC();
TGTextEntry(const TGWindow *p, TGTextBuffer *text, Int_t id = -1,
GContext_t norm = GetDefaultGC()(),
FontStruct_t font = GetDefaultFontStruct(),
UInt_t option = kSunkenFrame | kDoubleBorder,
Pixel_t back = GetWhitePixel());
TGTextEntry(const TGWindow *parent = 0, const char *text = 0, Int_t id = -1);
TGTextEntry(const TString &contents, const TGWindow *parent, Int_t id = -1);
virtual ~TGTextEntry();
virtual void AppendText(const char *text);
void Backspace();
void Clear(Option_t *option="");
void CursorLeft(Bool_t mark = kFALSE , Int_t steps = 1);
void CursorRight(Bool_t mark = kFALSE , Int_t steps = 1);
void CursorWordForward(Bool_t mark = kFALSE);
void CursorWordBackward(Bool_t mark = kFALSE);
void Cut();
void Del();
void Deselect();
virtual void DrawBorder();
void End(Bool_t mark = kFALSE);
ETextJustification GetAlignment() const { return fAlignment; }
TGTextBuffer *GetBuffer() const { return fText; }
Int_t GetCursorPosition() const { return fCursorIX; }
TString GetDisplayText() const;
EEchoMode GetEchoMode() const { return fEchoMode; }
EInsertMode GetInsertMode() const { return fInsertMode; }
TString GetMarkedText() const;
Int_t GetMaxLength() const { return fMaxLen; }
const char *GetText() const { return fText->GetString(); }
virtual TGToolTip *GetToolTip() const { return fTip; }
virtual const char *GetTitle() const { return GetText(); }
Bool_t HasMarkedText() const { return fSelectionOn && (fStartIX != fEndIX); }
Pixel_t GetTextColor() const { return fNormGC.GetForeground(); }
FontStruct_t GetFontStruct() const { return fFontStruct; }
void Home(Bool_t mark = kFALSE);
virtual void Insert(const char *);
virtual void InsertText(const char *text, Int_t pos);
Bool_t IsFrameDrawn() const { return fFrameDrawn; }
Bool_t IsEdited() const { return fEdited; }
virtual void Layout() { UpdateOffset(); }
void MarkWord(Int_t pos);
Int_t MaxMark() const { return fStartIX > fEndIX ? fStartIX : fEndIX; }
Int_t MinMark() const { return fStartIX < fEndIX ? fStartIX : fEndIX; }
void NewMark(Int_t pos);
void Remove();
virtual void RemoveText(Int_t start, Int_t end);
virtual void SetFont(TGFont *font, Bool_t local = kTRUE);
virtual void SetFont(FontStruct_t font, Bool_t local = kTRUE);
virtual void SetFont(const char *fontName, Bool_t local = kTRUE);
virtual void SetTextColor(Pixel_t color, Bool_t local = kTRUE);
virtual void SetTextColor(TColor *color, Bool_t local = kTRUE);
virtual void SetText(const char *text);
virtual void SetToolTipText(const char *text, Long_t delayms = 500);
virtual void SetMaxLength(Int_t maxlen);
virtual void SelectAll();
virtual void SetAlignment(ETextJustification mode = kTextLeft);
virtual void SetInsertMode(EInsertMode mode = kInsert);
virtual void SetEchoMode(EEchoMode mode = kNormal);
void SetEnabled(Bool_t flag = kTRUE) { SetState( flag ); }
virtual void SetCursorPosition(Int_t pos);
void SetEdited(Bool_t flag = kTRUE) { fEdited = flag; }
virtual void SetFocus();
virtual void SetFrameDrawn(Bool_t flag = kTRUE);
virtual void SetState(Bool_t state);
virtual void SetTitle(const char *label) { SetText(label); }
virtual void SetForegroundColor(Pixel_t fore) { SetTextColor(fore, kFALSE); }
Pixel_t GetForeground() const { return fNormGC.GetForeground(); }
Bool_t HasOwnFont() const { return fHasOwnFont; }
virtual void SavePrimitive(ostream &out, Option_t *option = "");
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleDoubleClick(Event_t *event);
virtual Bool_t HandleCrossing(Event_t *event);
virtual Bool_t HandleMotion(Event_t *event);
virtual Bool_t HandleKey(Event_t *event);
virtual Bool_t HandleFocusChange(Event_t *event);
virtual Bool_t HandleSelection(Event_t *event);
virtual Bool_t HandleSelectionClear(Event_t *event);
virtual Bool_t HandleSelectionRequest(Event_t *event);
virtual Bool_t HandleTimer(TTimer *t);
virtual Bool_t HandleConfigureNotify(Event_t *event);
virtual void TextChanged(const char *text = 0);
virtual void ReturnPressed();
virtual void TabPressed();
virtual void CursorOutLeft();
virtual void CursorOutRight();
virtual void CursorOutUp();
virtual void CursorOutDown();
virtual void DoubleClicked();
ClassDef(TGTextEntry,0)
};
#endif
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.