331 int tw, max_ascent, max_descent;
339 Resize(tw + 8, max_ascent + max_descent + 7);
398 Emit(
"ReturnPressed()");
406 Emit(
"ShiftTabPressed()");
417 Emit(
"TabPressed()");
436 Emit(
"CursorOutLeft()");
444 Emit(
"CursorOutRight()");
452 Emit(
"CursorOutUp()");
460 Emit(
"CursorOutDown()");
468 Emit(
"DoubleClicked()");
517 int tw, ix, up, down,
len;
523 if (xcoord < 0)
return 0;
524 if (xcoord > tw)
return len;
529 while (up-down > 1) {
536 if (tw == xcoord)
break;
638 fMaxLen = maxlen < 0 ? 0 : maxlen;
703 fEndIX = pos < 0 ? 0 : pos;
761 while (i >= 0 && isprint(
GetText()[i]) && !isspace(
GetText()[i])) i--;
763 Int_t newStartIX = i;
767 while(isspace(
GetText()[i])) i++;
786 for (
int i=0; i<t.
Length(); i++) {
787 if (t[i] <
' ') t[i] =
' ';
861 while (i > 0 && isspace(
GetText()[i-1])) --i;
862 while (i > 0 && !isspace(
GetText()[i-1])) --i;
1054 if (
gClient->GetStyle() < 2) {
1077 Int_t x,
y, max_ascent, max_descent,
h;
1092 h = max_ascent + max_descent;
1115 Int_t charWidth = ind < 0 || fCursorIX >
len - 1 ? 4 :
1129 int xs, ws, ixs, iws;
1139 dt.
Data() + ixs, iws);
1246 switch ((
EKeySym)keysym & ~0x20) {
1291 }
else if (
n && keysym <127 && keysym >=32 &&
1505 reply.
fTime =
event->fTime;
1506 reply.
fUser[0] =
event->fUser[0];
1507 reply.
fUser[1] =
event->fUser[1];
1508 reply.
fUser[2] =
event->fUser[2];
1509 reply.
fUser[3] =
event->fUser[3];
1525 buffer =
new char[
len+1];
1637 if (textWidth > 0 && textWidth >
w) {
1845 parFont.
Form(
"ufont->GetFontStruct()");
1851 parGC.
Form(
"uGC->GetGC()");
1857 out <<
" TGTextEntry *";
1866 out <<
");" << std::endl;
1868 out <<
"," <<
fWidgetId <<
");" << std::endl;
1871 out <<
"," <<
fWidgetId <<
"," << parGC.
Data() <<
");" << std::endl;
1875 <<
");" << std::endl;
1886 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
1890 out <<
" " <<
GetName() <<
"->SetAlignment(";
1893 out <<
"kTextLeft);" << std::endl;
1896 out <<
"kTextRight);" << std::endl;
1899 out <<
"kTextCenterX);" << std::endl;
1901 out <<
" " <<
GetName() <<
"->SetText(" << quote <<
GetText() << quote
1902 <<
");" << std::endl;
1905 <<
"->GetDefaultHeight());" << std::endl;
1908 out <<
" " <<
GetName() <<
"->SetDefaultSize(";
1916 out <<
GetName() <<
"->SetToolTipText(" << quote
1917 << tiptext << quote <<
");" << std::endl;
const Mask_t kWABitGravity
const Mask_t kButtonMotionMask
const Mask_t kFocusChangeMask
const Mask_t kButtonPressMask
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Handle_t Window_t
Window handle.
const Mask_t kWAWinGravity
const Mask_t kAnyModifier
const Mask_t kKeyPressMask
Handle_t GContext_t
Graphics context handle.
const Mask_t kKeyShiftMask
const Mask_t kKeyControlMask
const Mask_t kLeaveWindowMask
const Mask_t kStructureNotifyMask
const Mask_t kButtonReleaseMask
const Mask_t kEnterWindowMask
ULong_t Pixel_t
Pixel value.
Handle_t FontStruct_t
Pointer to font structure.
const Atom_t kCutBuffer
in /usr/include/X11/Xatom.h
TGTextEntry * gBlinkingEntry
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t del
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t nchar
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t property
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
Option_t Option_t TPoint TPoint const char text
R__EXTERN TSystem * gSystem
Bool_t Notify() override
Notify when timer times out and reset the timer.
TBlinkTimer(TGTextEntry *t, Long_t ms)
The color creation and management class.
ULong_t GetPixel() const
Return pixel value corresponding to this color.
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
const TGResourcePool * GetResourcePool() const
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Encapsulate fonts used in the GUI system.
FontStruct_t GetFontStruct() const
void SavePrimitive(std::ostream &out, Option_t *="") override
Save the used font as a C++ statement(s) on output stream out.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
static const TGGC & GetBlackGC()
Get black graphics context.
UInt_t fOptions
frame options
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
static Pixel_t GetWhitePixel()
Get white pixel value.
UInt_t fHeight
frame height
virtual void DrawBorder()
Draw frame border.
Int_t fBorderWidth
frame border width
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
static const TGGC & GetHilightGC()
Get highlight color graphics context.
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual UInt_t GetOptions() const
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
static Pixel_t fgWhitePixel
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Pixel_t fBackground
frame background color
static const TGGC & GetBckgndGC()
Get background color graphics context.
TGGC * FindGC(const TGGC *gc)
Find graphics context. Returns 0 in case gc is not found.
Encapsulate a graphics context used in the low level graphics.
void SetFont(FontH_t v)
Set font.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save graphics context info as a C++ statement(s) on output stream out.
void SetForeground(Pixel_t v)
Set foreground color.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
Cursor_t GetTextCursor() const
Atom_t GetClipboard() const
TGGCPool * GetGCPool() const
const char * GetString() const
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
UInt_t GetBufferLength() const
void AddText(Int_t pos, const char *text)
const char * GetString() const
void RemoveText(Int_t pos, Int_t length)
UInt_t GetTextLength() const
A TGTextEntry is a one line text input widget.
virtual void SetState(Bool_t state)
Set state of widget. If kTRUE=enabled, kFALSE=disabled.
Int_t fOffset
start position of text (in pixels)
virtual void SetFocus()
Set focus to this text entry.
void CursorLeft(Bool_t mark=kFALSE, Int_t steps=1)
Moves the cursor leftwards one or more characters.
Bool_t fFrameDrawn
kTRUE draw itself inside a two-pixel frame, kFALSE draw without any frame
void CursorRight(Bool_t mark=kFALSE, Int_t steps=1)
Moves the cursor rightwards one or more characters.
Bool_t HasMarkedText() const
Int_t fStartIX
selection begin in characters
virtual void SetEchoMode(EEchoMode mode=kNormal)
The echo modes available are:
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
UInt_t fDefHeight
default height
Bool_t HandleConfigureNotify(Event_t *event) override
Handles resize events for this widget.
virtual void SetMaxLength(Int_t maxlen)
Set the maximum length of the text in the editor.
EEchoMode fEchoMode
OPTION={GetMethod="GetEchoMode";SetMethod="SetEchoMode";Items=(kNormal="Normal",kNoEcho="No Echo",...
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
virtual 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.
Int_t fStartX
selection begin in pixels
Bool_t HandleKey(Event_t *event) override
The key press event handler converts a key press to some line editor action.
TGTextBuffer * fText
text buffer
Bool_t HandleSelectionRequest(Event_t *event) override
Handle request to send current clipboard contents to requestor window.
TString GetDisplayText() const
Returns the text that's currently displayed.
UInt_t fDefWidth
default width
virtual ~TGTextEntry()
Delete a text entry widget.
TGGC fNormGC
normal drawing context
Bool_t fHasOwnFont
kTRUE - font defined locally, kFALSE - globally
void Clear(Option_t *option="") override
Clears up the text entry.
void Deselect()
Deselects all text (i.e.
TBlinkTimer * fCurBlink
cursor blink timer
void CopyText() const
Copies the marked text to the clipboard, if there is any and GetEchoMode() is kNormal.
static TString * fgClipboardText
application clipboard text
virtual void UpdateOffset()
Updates start text offset according GetAlignment() mode, if cursor is out of frame => scroll the text...
TGTextBuffer * GetBuffer() const
const char * GetText() const
Bool_t HandleTimer(TTimer *t) override
Handle cursor blink timer.
virtual void TabPressed()
This signal is emitted when the <TAB> key is pressed.
Bool_t HandleSelectionClear(Event_t *event) override
Handle selection clear event.
void CursorWordBackward(Bool_t mark=kFALSE)
Moves the cursor one word to the left.
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
void Backspace()
Deletes the character on the left side of the text cursor and moves the cursor one position to the le...
TString GetMarkedText() const
Returns the text marked by the user (e.g.
Bool_t HandleSelection(Event_t *event) override
Handle text selection event.
void Del()
Deletes the character on the right side of the text cursor.
Bool_t fCursorOn
cursor status (on/off)
static const TGFont * fgDefaultFont
Bool_t HandleDoubleClick(Event_t *event) override
Handle mouse double click event in the text entry widget.
TGToolTip * fTip
associated tooltip
void NewMark(Int_t pos)
New character mark at position pos.
Bool_t IsFrameDrawn() const
static const TGGC & GetDefaultSelectedBackgroundGC()
Return graphics context for highlighted frame background.
TGTextEntry(const TGTextEntry &)=delete
virtual 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 li...
virtual void SelectAll()
Selects all text (i.e.
virtual void CursorOutRight()
This signal is emitted when cursor is going out of right side.
void Paste()
Inserts text at the cursor position, deleting any previous marked text.
virtual void SetFrameDrawn(Bool_t flag=kTRUE)
Sets the text entry to draw itself inside a two-pixel frame if enable is kTRUE, and to draw itself wi...
EInsertMode fInsertMode
OPTION={GetMethod="GetInsertMode";SetMethod="SetInsertMode";Items=(kInsert="Insert",...
virtual void SetAlignment(ETextJustification mode=kTextLeft)
Sets the alignment of the text entry.
Int_t fEndIX
selection end in characters
Atom_t fClipboard
clipboard property
virtual void ScrollByChar()
Shift position of cursor by one character.
Int_t GetCharacterIndex(Int_t xcoord)
Returns the index of the character to whose left edge xcoord is closest.
TGGC fSelGC
selected text drawing context
TClass * IsA() const override
EInsertMode GetInsertMode() const
virtual void ShiftTabPressed()
This signal is emitted when SHIFT and TAB keys are pressed.
Int_t fEndX
selection end in pixels
virtual void ReturnPressed()
This signal is emitted when the return or enter key is pressed.
static const TGGC * fgDefaultSelectedGC
GContext_t fSelbackGC
selected background drawing context
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
EEchoMode GetEchoMode() const
ETextJustification fAlignment
OPTION={GetMethod="GetAlignment";SetMethod="SetAlignment";Items=(kTextLeft="Left",...
Bool_t fSelectionOn
selection status (on/off)
Bool_t HandleFocusChange(Event_t *event) override
Handle focus change event in text entry widget.
virtual void SetTextColor(Pixel_t color, Bool_t local=kTRUE)
Changes text color.
void DoRedraw() override
Draw the text entry widget.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in the text entry widget.
FontStruct_t fFontStruct
text font
virtual void CursorOutLeft()
This signal is emitted when cursor is going out of left side.
TGDimension GetDefaultSize() const override
Return the default / minimal size of the widget.
void DrawBorder() override
Draw the border of the text entry widget.
void Cut()
Copies the marked text to the clipboard and deletes it, if there is any.
static const TGGC * fgDefaultGC
void End(Bool_t mark=kFALSE)
Moves the text cursor to the right end of the line.
virtual 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.
virtual void CursorOutDown()
This signal is emitted when cursor is going out of bottom side.
virtual void SetFont(TGFont *font, Bool_t local=kTRUE)
Changes text font specified by pointer to TGFont object.
virtual Bool_t IsCursorOutOfFrame()
Returns kTRUE if cursor is out of frame.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a text entry widget as a C++ statement(s) on output stream out.
virtual void SetInsertMode(EInsertMode mode=kInsert)
Sets the mode how characters are entered to the text entry.
void CursorWordForward(Bool_t mark=kFALSE)
Moves the cursor one word to the right.
virtual void Insert(const char *)
Removes any currently selected text, inserts newText, sets it as the new contents of the text entry.
virtual void Init()
Do default initialization.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in text entry widget.
Bool_t fEdited
kFALSE, if the line edit's contents have not been changed since the construction
void MarkWord(Int_t pos)
Marks the word nearest to cursor position.
virtual void TextChanged(const char *text=nullptr)
This signal is emitted every time the text has changed.
void Home(Bool_t mark=kFALSE)
Moves the text cursor to the left end of the line.
virtual void DoubleClicked()
This signal is emitted when widget is double clicked.
virtual void PastePrimary(Window_t wid, Atom_t property, Bool_t del)
Paste text from selection (either primary or cut buffer) into text entry widget.
Int_t fCursorX
cursor position in pixels
static const TGGC & GetDefaultSelectedGC()
Return selection graphics context.
virtual void CursorOutUp()
This signal is emitted when cursor is going out of upper side.
static const TGGC & GetDefaultGC()
Return default graphics context.
Int_t GetMaxLength() const
Int_t fMaxLen
maximum length of text
Int_t fCursorIX
cursor position in characters
Bool_t HandleCrossing(Event_t *event) override
Handle mouse crossing event.
void Remove()
Deletes all characters on the right side of the cursor.
static const TGGC * fgDefaultSelectedBackgroundGC
ROOT GUI Window base class.
virtual void RequestFocus()
request focus
const TGWindow * fParent
Parent window.
@ kEditDisableHeight
window height cannot be edited
virtual void SetWindowName(const char *name=nullptr)
Set window name.
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
UInt_t fEditDisabled
flags used for "guibuilding"
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
TString & Insert(Ssiz_t pos, const char *s)
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Prepend(const char *cs)
TString & Remove(Ssiz_t pos)
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
Handles synchronous and a-synchronous timer events.
void Reset()
Reset the timer.
R__ALWAYS_INLINE bool HasBeenDeleted(const TObject *obj)
Check if the TObject's memory has been deleted.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
EGEventType fType
of event (see EGEventType)
Time_t fTime
time event event occurred in ms
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Attributes that can be used when creating or changing a window.
Mask_t fMask
bit mask specifying which fields are valid
Int_t fWinGravity
one of the window gravity values
Int_t fBitGravity
one of bit gravity values