library: libGui
#include "TGTextEntry.h"

TGTextEntry


class description - source file - inheritance tree (.pdf)

class TGTextEntry : public TGFrame, public TGWidget

Inheritance Chart:
TObject
<-
TGObject
<-
TGWindow
TQObject
<-
TGFrame
TGWidget
<-
TGTextEntry
<-
TGNumberEntryField

    protected:
void CopyText() const virtual void DoRedraw() Int_t GetCharacterIndex(Int_t xcoord) static const TGGC& GetDefaultSelectedBackgroundGC() const static const TGGC& GetDefaultSelectedGC() const 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() public:
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) TGTextEntry(const TGTextEntry&) virtual ~TGTextEntry() virtual void AppendText(const char* text) void Backspace() static TClass* Class() virtual void Clear(Option_t* option = "") void CursorLeft(Bool_t mark = kFALSE, Int_t steps = 1) virtual void CursorOutDown() virtual void CursorOutLeft() virtual void CursorOutRight() virtual void CursorOutUp() 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() void Deselect() virtual void DoubleClicked() virtual void DrawBorder() void End(Bool_t mark = kFALSE) ETextJustification GetAlignment() const TGTextBuffer* GetBuffer() const Int_t GetCursorPosition() const static FontStruct_t GetDefaultFontStruct() static const TGGC& GetDefaultGC() const TString GetDisplayText() const TGTextEntry::EEchoMode GetEchoMode() const virtual Pixel_t GetForeground() const TGTextEntry::EInsertMode GetInsertMode() const TString GetMarkedText() const Int_t GetMaxLength() const const char* GetText() const virtual const char* GetTitle() const virtual Bool_t HandleButton(Event_t* event) virtual Bool_t HandleConfigureNotify(Event_t* event) virtual Bool_t HandleCrossing(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 HandleSelectionRequest(Event_t* event) virtual Bool_t HandleTimer(TTimer* t) Bool_t HasMarkedText() const Bool_t HasOwnFont() const void Home(Bool_t mark = kFALSE) virtual void Insert(const char*) virtual void InsertText(const char* text, Int_t pos) virtual TClass* IsA() const Bool_t IsEdited() const Bool_t IsFrameDrawn() const virtual void Layout() void MarkWord(Int_t pos) Int_t MaxMark() const Int_t MinMark() const void NewMark(Int_t pos) void Remove() virtual void RemoveText(Int_t start, Int_t end) virtual void ReturnPressed() virtual void SavePrimitive(ofstream& out, Option_t* option) void SelectAll() virtual void SetAlignment(ETextJustification mode = kTextLeft) virtual void SetCursorPosition(Int_t pos) virtual void SetEchoMode(TGTextEntry::EEchoMode mode = kNormal) void SetEdited(Bool_t flag = kTRUE) void SetEnabled(Bool_t flag = kTRUE) virtual void SetFocus() virtual void SetFont(TGFont* font, Bool_t local = kFALSE) virtual void SetFont(FontStruct_t font, Bool_t local = kFALSE) virtual void SetFont(const char* fontName, Bool_t local = kFALSE) virtual void SetForegroundColor(Pixel_t fore) 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 SetTextColor(Pixel_t color, Bool_t local = kFALSE) virtual void SetTextColor(TColor* color, Bool_t local = kFALSE) virtual void SetTitle(const char* label) virtual void SetToolTipText(const char* text, Long_t delayms = 1000) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void TabPressed() 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 TGGC fNormGC normal drawing context TGGC fSelGC selected text drawing context GContext_t fSelbackGC selected background drawing context Atom_t fClipboard clipboard property TBlinkTimer* fCurBlink cursor blink timer TGToolTip* fTip associated tooltip 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) Bool_t fHasOwnFont kTRUE - font defined locally, kFALSE - globally static TString* fgClipboardText application clipboard text static const TGFont* fgDefaultFont static const TGGC* fgDefaultSelectedGC static const TGGC* fgDefaultSelectedBackgroundGC static const TGGC* fgDefaultGC 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.                         
 Hitting the enter key will generate:                                 
 kC_TEXTENTRY, kTE_ENTER, widget id, 0.                               
 Hitting the tab key will generate:                                   
 kC_TEXTENTRY, kTE_TAB, 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 | kOwnBackground, 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 | kOwnBackground, fgWhitePixel)
 Simple text entry constructor.

TGTextEntry(const TString &contents, const TGWindow *parent, Int_t id) : TGFrame(parent, 1, 1, kSunkenFrame | kDoubleBorder | kOwnBackground, 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 TabPressed()
 This signal is emitted when the <TAB> key is pressed.

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

void CursorOutLeft()
 This signal is emitted when cursor is going out of left side.

void CursorOutRight()
 This signal is emitted when cursor is going out of right side.

void CursorOutUp()
 This signal is emitted when cursor is going out of upper side.

void CursorOutDown()
 This signal is emitted when cursor is going out of bottom side.

void DoubleClicked()
 This signal is emitted when widget is double clicked.

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 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 HandleCrossing(Event_t *event)
 Handle mouse crossing event.

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 widget.

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.

Bool_t HandleSelectionRequest(Event_t *event)
 Handle request to send current clipboard contents to requestor window.

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 SetToolTipText(const char *text, Long_t delayms)
 Set tool tip text associated with this text entry. The delay is in
 milliseconds (minimum 250). To remove tool tip call method with
 text = 0.

void SetFocus()
 sets focus

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().

void SetFont(FontStruct_t font, Bool_t local)
 Changes text font.
 If local is kTRUE font is changed locally.

void SetFont(const char *fontName, Bool_t local)
 Changes text font specified by name.
 If global is true font is changed locally.

void SetFont(TGFont *font, Bool_t local)
 Changes text font specified by pointer to TGFont object.
 If global is true font is changed locally.

void SetTextColor(Pixel_t color, Bool_t local)
 Changes text color.
 If local is true color is changed locally

void SetTextColor(TColor *color, Bool_t global)
 Changes text color.
 If global is true color is changed globally

FontStruct_t GetDefaultFontStruct()

const TGGC& GetDefaultGC()

const TGGC& GetDefaultSelectedGC()

const TGGC& GetDefaultSelectedBackgroundGC()

void SavePrimitive(ofstream &out, Option_t *option)
 Save a text entry widget as a C++ statement(s) on output stream out



Inline Functions


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


Author: Fons Rademakers 08/01/98
Last update: root/gui:$Name: $:$Id: TGTextEntry.cxx,v 1.32 2005/09/05 13:33:08 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


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.