TGTextEntry


class description - source file - inheritance tree

class TGTextEntry : public TGFrame, public TGWidget


    protected:
void Backspace() void CopyText() const void CursorLeft(Bool_t mark = kFALSE, Int_t steps = 1) void CursorRight(Bool_t mark = kFALSE, Int_t steps = 1) void CursorWordBackward(Bool_t mark = kFALSE) void CursorWordForward(Bool_t mark = kFALSE) void Cut() void Del() virtual void DoRedraw() void End(Bool_t mark = kFALSE) Int_t GetCharacterIndex(Int_t xcoord) TString GetDisplayText() const void Home(Bool_t mark = kFALSE) virtual void Init() virtual void Insert(const char*) virtual Bool_t IsCursorOutOfFrame() void MarkWord(Int_t pos) Int_t MaxMark() const Int_t MinMark() const void NewMark(Int_t pos) void Paste() virtual void PastePrimary(Window_t wid, Atom_t property, Bool_t del) void Remove() virtual void ScrollByChar() virtual void SetCursorPosition(Int_t pos) virtual void UpdateOffset() public:
TGTextEntry TGTextEntry(const TGWindow* p, TGTextBuffer* text, Int_t id = -1, GContext_t norm = fgDefaultGC, FontStruct_t font = fgDefaultFontStruct, UInt_t option = kSunkenFrame|kDoubleBorder, ULong_t back = fgWhitePixel) TGTextEntry TGTextEntry(const TGWindow* parent, const char* text, Int_t id = -1) TGTextEntry TGTextEntry(const TString& contents, const TGWindow* parent, Int_t id = -1) TGTextEntry TGTextEntry(TGTextEntry&) virtual void ~TGTextEntry() virtual void AppendText(const char* text) TClass* Class() virtual void Clear(Option_t* option) void Deselect() virtual void DrawBorder() ETextJustification GetAlignment() const TGTextBuffer* GetBuffer() const Int_t GetCursorPosition() const TGTextEntry::EEchoMode GetEchoMode() const TGTextEntry::EInsertMode GetInsertMode() const TString GetMarkedText() const Int_t GetMaxLength() const const char* GetText() const virtual Bool_t HandleButton(Event_t* event) virtual Bool_t HandleConfigureNotify(Event_t* event) virtual Bool_t HandleDoubleClick(Event_t* event) virtual Bool_t HandleFocusChange(Event_t* event) virtual Bool_t HandleKey(Event_t* event) virtual Bool_t HandleMotion(Event_t* event) virtual Bool_t HandleSelection(Event_t* event) virtual Bool_t HandleTimer(TTimer* t) Bool_t HasMarkedText() const virtual void InsertText(const char* text, Int_t pos) virtual TClass* IsA() const Bool_t IsEdited() const Bool_t IsFrameDrawn() const virtual void RemoveText(Int_t start, Int_t end) virtual void ReturnPressed() void SelectAll() virtual void SetAlignment(ETextJustification mode = kTextLeft) virtual void SetEchoMode(TGTextEntry::EEchoMode mode = kNormal) void SetEdited(Bool_t flag = kTRUE) void SetEnabled(Bool_t flag = kTRUE) virtual void SetFocus() void SetFont(const char* fontName) virtual void SetFont(FontStruct_t font) virtual void SetFrameDrawn(Bool_t flag = kTRUE) virtual void SetInsertMode(TGTextEntry::EInsertMode mode = kInsert) virtual void SetMaxLength(Int_t maxlen) virtual void SetState(Bool_t state) virtual void SetText(const char* text) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) virtual void TextChanged(const char* text = 0)

Data Members

protected:
TGTextBuffer* fText text buffer Int_t fStartX selection begin in pixels Int_t fEndX selection end in pixels Int_t fStartIX selection begin in characters Int_t fEndIX selection end in characters Bool_t fSelectionOn selection status (on/off) Int_t fOffset start position of text (in pixels) Int_t fCursorX cursor position in pixels Int_t fCursorIX cursor position in characters Bool_t fCursorOn cursor status (on/off) FontStruct_t fFontStruct text font GContext_t fNormGC normal drawing context GContext_t fSelGC GContext_t fSelbackGC selection mode drawing contexts TBlinkTimer* fCurBlink cursor blink timer Int_t fMaxLen maximum length of text Bool_t fEdited kFALSE, if the line edit's contents have not been changed since the construction Bool_t fFrameDrawn kTRUE draw itself inside a two-pixel frame, kFALSE draw without any frame TGTextEntry::EEchoMode fEchoMode echo mode (kNormal(default), kNoEcho, kPassword) TGTextEntry::EInsertMode fInsertMode text insertion mode (kInsert(default) , kReplace) ETextJustification fAlignment alignment mode available (kTextLeft(default), kTextRight, kTextCenterX defined in TGWidget.h) static TString* fgClipboardText application clipboard text static Cursor_t fgDefaultCursor static GContext_t fgDefaultGC static GContext_t fgDefaultSelectedGC static GContext_t fgDefaultSelectedBackgroundGC static FontStruct_t fgDefaultFontStruct public:
static const TGTextEntry::EEchoMode kNormal static const TGTextEntry::EEchoMode kNoEcho static const TGTextEntry::EEchoMode kPassword static const TGTextEntry::EInsertMode kInsert static const TGTextEntry::EInsertMode kReplace

Class Description

                                                                      
 TGTextEntry                                                          
                                                                      
 A TGTextEntry is a one line text input widget.                       
                                                                      
 Changing text in the text entry widget will generate the event:      
 kC_TEXTENTRY, kTE_TEXTCHANGED, widget id, 0.                         
                                                                      
 This widget has the behaviour e.g. of the "Location" field in        
 netscape. That includes handling Control/Shift key modifiers and     
 scrolling the text.                                                  


 enum TGTextEntry::EEchoMode

 This enum type describes the ways in which TGTextEntry can display
 its contents. The currently defined values are:

/*

*/

 See also SetEchoMode(), GetEchoMode().

 enum TGTextEntry::EInsertMode

 This enum type describes the way how typed characters are
 inserted in the text entry. This mode is switched by "Insert" key.

/*

*/


 enum TGWidget::ETextJustification

 This enum type (defined in TGWidget.h) describes the text alignment modes.
 These modes are valid untill text fits the frame width

/*

*/



 The key press event handler converts a key press to some line editor action.
 Here are the default key bindings:

/*

All other keys with valid ASCII codes insert themselves into the line.
*/




TGTextEntry(const TGWindow *p, TGTextBuffer *text, Int_t id, GContext_t norm, FontStruct_t font, UInt_t options, ULong_t back) : TGFrame(p, 1, 1, options, back)
 Create a text entry widget. It will adopt the TGTextBuffer object
 (i.e. the text buffer will be deleted by the text entry widget).

TGTextEntry(const TGWindow *parent, const char *text, Int_t id): TGFrame(parent, 1, 1, kSunkenFrame | kDoubleBorder, fgWhitePixel)
 Simple text entry constructor.

TGTextEntry(const TString &contents, const TGWindow *parent, Int_t id) : TGFrame(parent, 1, 1, kSunkenFrame | kDoubleBorder, fgWhitePixel)
 Simple test entry constructor. Notice TString argument comes before the
 parent argument (to make this ctor different from the first one taking a
 const char*).

~TGTextEntry()
 Delete a text entry widget.

void Init()
 Do default initialization.

void ReturnPressed()
 This signal is emitted when the return or enter key is pressed.

void TextChanged(const char *)
 This signal is emitted every time the text has changed.

TString GetDisplayText() const
 Returns the text that's currently displayed.  This is normally
 the same as GetText(), but can be e.g.
 "*****" if EEchoMode is kPassword or
 ""      if it is kNoEcho.

void SetFont(FontStruct_t font)
 Changes text entry font.

void SetFont(const char *fontName)
 Changes text entry font specified by name.

void SetState(Bool_t state)
 Set state of widget. If kTRUE=enabled, kFALSE=disabled.

Int_t GetCharacterIndex(Int_t xcoord)
 Returns the index of the character to whose left edge goalx is closest.

void SetFrameDrawn(Bool_t enable)
 Sets the text entry to draw itself inside a two-pixel frame if
 enable is kTRUE, and to draw itself without any frame if enable is
 kFALSE. The default is kTRUE.

void SetAlignment(ETextJustification mode)
 Sets the alignment of the text entry.
 Possible values are kTextLeft(default), kTextRight, kTextCenterX.
 See also GetAlignment().

void SetInsertMode(EInsertMode mode)
 Sets the mode how characters are entered to the text entry.

void SetText(const char *text)
 Sets text entry to text, clears the selection and moves
 the cursor to the end of the line.
 If necessary the text is truncated to fit MaxLength().
 See also  GetText().

void SetMaxLength(Int_t maxlen)
 Set the maximum length of the text in the editor.  If the text is
 currently too long, it is chopped off at the limit. Any marked text will
 be unmarked.  The cursor position is set to 0 and the first part of the
 string is shown.   The range  of maxlen  is (0,255)
 See  also GetMaxLength().

void SetEchoMode(EEchoMode mode)
 The echo modes available are:

 

 It is always possible to cut and paste any marked text;  only the widget's own
 display is affected.
 See also GetEchoMode(), GetDisplayText()

TString GetMarkedText() const
 Returns the text marked by the user (e.g. by clicking and
 dragging), or zero if no text is marked.
 See also  HasMarkedText()

void NewMark(Int_t newPos)
 New character mark at position pos
 See also SetCursorPosition()

void SetCursorPosition(Int_t newPos)
 Set the cursor position to newPos.
 See also NewMark().

void MarkWord(Int_t pos)
 Marks the word nearest to cursor position
 See also HandleDoubleClick()

void Insert(const char *newText)
 Removes any currently selected text, inserts newText,
 sets it as the new contents of the text entry.

void CursorRight(Bool_t mark, Int_t steps)
 Moves the cursor rightwards one or more characters.
 See also CursorLeft().

void CursorLeft(Bool_t mark, Int_t steps)
 Moves the cursor leftwards one or more characters.
 See also CursorRight().

void CursorWordForward(Bool_t mark)
 Moves the cursor one word to the right.  If mark is kTRUE, the text
 is marked.
 See also CursorWordBackward().

void CursorWordBackward(Bool_t mark)
 Moves the cursor one word to the left.  If mark is kTRUE, the text
 is marked.
 See also CursorWordForward().

void Backspace()
 Deletes the character on the left side of the text cursor and moves the
 cursor one position to the left. If a text has been marked by the user
 (e.g. by clicking and dragging) the cursor will be put at the beginning
 of the marked text and the marked text will be removed.
 See also  Del().

void Del()
 Deletes the character on the right side of the text cursor. If a text
 has been marked by the user (e.g. by clicking and dragging) the cursor
 will be put at the beginning of the marked text and the marked text will
 be removed.
 See also Backspace().

void Remove()
 Deletes all characters on the right side of the cursor
 See also Del() Backspace().

void CopyText() const
 Copies the marked text to the clipboard, if there is any and
 GetEchoMode() is kNormal.
 See also  Cut() Paste().

void Paste()
 Inserts text at the cursor position, deleting any
 previous marked text.
 See also CopyText() Cut().

void Cut()
 Copies the marked text to the clipboard and deletes it, if there is any.
 See also CopyText() Paste().

void Clear(Option_t *)
 Clears up the text entry.

void Home(Bool_t mark)
 Moves the text cursor to the left end of the line. If mark is kTRUE text
 will be marked towards the first position, if not any marked text will
 be unmarked if the cursor is moved.
 See also End().

void End(Bool_t mark)
 Moves the text cursor to the right end of the line. If mark is kTRUE text
 will be marked towards the last position, if not any marked text will
 be unmarked if the cursor is moved.
 See also Home().

void SelectAll()
 Selects all text (i.e. marks it) and moves the cursor to the
 end. Useful when a default value has been inserted. If the user
 types before clicking on the widget the selected text will be
 erased.

void Deselect()
 Deselects all text (i.e. removes marking) and leaves the cursor at the
 current position.

void DrawBorder()
 Draw the border of the text entry widget.

void DoRedraw()
 Draw the text entry widget.

Bool_t HandleKey(Event_t* event)
  The key press event handler converts a key press to some line editor action.
  Here are the default key bindings:

  

  All other keys with valid ASCII codes insert themselves into the line.

Bool_t HandleButton(Event_t *event)
 Handle mouse button event in text entry widget.

Bool_t HandleMotion(Event_t *event)
 Handle mouse motion event in the text entry widget.

Bool_t HandleDoubleClick(Event_t *event)
 Handle  mouse  double click event in the text entry widge

Bool_t HandleConfigureNotify(Event_t* event)
 Handles resize events for this widget.

Bool_t HandleFocusChange(Event_t *event)
 Handle focus change event in text entry widget.

Bool_t HandleSelection(Event_t *event)
 Handle text selection event.

void PastePrimary(Window_t wid, Atom_t property, Bool_t del)
 Paste text from selection (either primary or cut buffer) into
 text entry widget.

Bool_t HandleTimer(TTimer *)
 Handle cursor blink timer.

Bool_t IsCursorOutOfFrame()
 Returns kTRUE if cursor is out of frame.

void ScrollByChar()
 Shift position of cursor by one character.

void UpdateOffset()
 Updates start text offset according GetAlignment() mode,
 if cursor is out of frame => scroll the text.
 See also SetAlignment() and ScrollByChar().

void SetFocus()
 Gives the keyboard input focus to this text entry widget.

void InsertText(const char *text, Int_t pos)
 Inserts text at position pos, clears the selection and moves
 the cursor to the end of the line.
 If necessary the text is truncated to fit MaxLength().
 See also GetText(), SetText(), AppendText(), RemoveText().

void AppendText(const char *text)
 Appends text to the end of text entry, clears the selection
 and moves the cursor to the end of the line.
 If necessary the text is truncated to fit MaxLength().
 See also GetText(), InsertText(), SetText(), RemoveText().

void RemoveText(Int_t start, Int_t end)
 Removes text at the range, clears the selection and moves
 the cursor to the end of the line.
 See also GetText(), InsertText(), SetText(), AppendText().



Inline Functions


                           Int_t MinMark() const
                           Int_t MaxMark() const
                   TGTextBuffer* GetBuffer() const
                     const char* GetText() const
                          Bool_t IsFrameDrawn() const
                          Bool_t IsEdited() const
          TGTextEntry::EEchoMode GetEchoMode() const
        TGTextEntry::EInsertMode GetInsertMode() const
              ETextJustification GetAlignment() const
                            void SetEnabled(Bool_t flag = kTRUE)
                           Int_t GetCursorPosition() const
                          Bool_t HasMarkedText() const
                            void SetEdited(Bool_t flag = kTRUE)
                           Int_t GetMaxLength() const
                         TClass* Class()
                         TClass* IsA() const
                            void ShowMembers(TMemberInspector& insp, char* parent)
                            void Streamer(TBuffer& b)
                     TGTextEntry TGTextEntry(TGTextEntry&)


Author: Fons Rademakers 08/01/98
Last update: 2.23/07 21/10/99 18.30.15 by Fons Rademakers
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - 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.