232 class TBlinkTimer :
public TTimer {
243 Bool_t TBlinkTimer::Notify()
245 fTextEntry->HandleTimer(0);
262 TGGC *normgc = fClient->GetResourcePool()->GetGCPool()->FindGC(
norm);
269 fNormGC = GetDefaultGC();
319 if (
this == gBlinkingEntry) gBlinkingEntry = 0;
341 int tw, max_ascent, max_descent;
349 Resize(tw + 8, max_ascent + max_descent + 7);
408 Emit(
"ReturnPressed()");
416 Emit(
"ShiftTabPressed()");
427 Emit(
"TabPressed()");
446 Emit(
"CursorOutLeft()");
454 Emit(
"CursorOutRight()");
462 Emit(
"CursorOutUp()");
470 Emit(
"CursorOutDown()");
478 Emit(
"DoubleClicked()");
527 int tw, ix, up, down, len;
533 if (xcoord < 0)
return 0;
534 if (xcoord > tw)
return len;
539 while (up-down > 1) {
546 if (tw == xcoord)
break;
648 fMaxLen = maxlen < 0 ? 0 : maxlen;
712 Int_t pos = newPos < len ? newPos : len;
713 fEndIX = pos < 0 ? 0 : pos;
771 while (i >= 0 && isprint(
GetText()[i]) && !isspace(
GetText()[i])) i--;
773 Int_t newStartIX = i;
777 while(isspace(
GetText()[i])) i++;
796 for (
int i=0; i<t.
Length(); i++) {
797 if (t[i] <
' ') t[i] =
' ';
871 while (i > 0 && isspace(
GetText()[i-1])) --i;
872 while (i > 0 && !isspace(
GetText()[i-1])) --i;
1064 if (
gClient->GetStyle() < 2) {
1087 Int_t x,
y, max_ascent, max_descent,
h;
1102 h = max_ascent + max_descent;
1125 Int_t charWidth = ind < 0 || fCursorIX > len - 1 ? 4 :
1139 int xs, ws, ixs, iws;
1149 dt.
Data() + ixs, iws);
1236 gVirtualX->LookupString(event, tmp,
sizeof(tmp), keysym);
1257 switch ((
EKeySym)keysym & ~0x20) {
1304 }
else if (n && keysym <127 && keysym >=32 &&
1473 gBlinkingEntry =
this;
1517 reply.
fTime =
event->fTime;
1518 reply.
fUser[0] =
event->fUser[0];
1519 reply.
fUser[1] =
event->fUser[1];
1520 reply.
fUser[2] =
event->fUser[2];
1521 reply.
fUser[3] =
event->fUser[3];
1537 buffer =
new char[len+1];
1561 gVirtualX->GetPasteBuffer(wid, property, data, nchar, del);
1651 if (textWidth > 0 && textWidth > w) {
1668 if (text && strlen(text))
1677 if (gBlinkingEntry && (gBlinkingEntry !=
this)) {
1693 newText.Insert(position, text);
1718 newText.
Remove(pos, len);
1850 parFont.
Form(
"%s::GetDefaultFontStruct()",IsA()->
GetName());
1853 parGC.
Form(
"%s::GetDefaultGC()()",IsA()->
GetName());
1859 parFont.
Form(
"ufont->GetFontStruct()");
1865 parGC.
Form(
"uGC->GetGC()");
1871 out <<
" TGTextEntry *";
1880 out <<
");" << std::endl;
1882 out <<
"," <<
fWidgetId <<
");" << std::endl;
1885 out <<
"," <<
fWidgetId <<
"," << parGC.
Data() <<
");" << std::endl;
1889 <<
");" << std::endl;
1899 if (option && strstr(option,
"keep_names"))
1900 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");" << std::endl;
1904 out <<
" " <<
GetName() <<
"->SetAlignment(";
1907 out <<
"kTextLeft);" << std::endl;
1910 out <<
"kTextRight);" << std::endl;
1913 out <<
"kTextCenterX);" << std::endl;
1915 out <<
" " <<
GetName() <<
"->SetText(" << quote <<
GetText() << quote
1916 <<
");" << std::endl;
1919 <<
"->GetDefaultHeight());" << std::endl;
1922 out <<
" " <<
GetName() <<
"->SetDefaultSize(";
1930 out <<
GetName() <<
"->SetToolTipText(" << quote
1931 << tiptext << quote <<
");" << std::endl;
void CursorRight(Bool_t mark=kFALSE, Int_t steps=1)
Moves the cursor rightwards one or more characters.
static const TGGC & GetDefaultGC()
Return default graphics context.
static const TGGC * fgDefaultSelectedBackgroundGC
virtual Bool_t HandleSelectionRequest(Event_t *event)
Handle request to send current clipboard contents to requestor window.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
object has not been deleted
Bool_t HasMarkedText() const
Int_t GetMaxLength() const
virtual UInt_t GetOptions() const
virtual void DrawBorder()
Draw the border of the text entry widget.
static const TGGC & GetDefaultSelectedBackgroundGC()
Return graphics context for highlighted frame background.
virtual void Init()
Do default initialization.
virtual void ShiftTabPressed()
This signal is emitted when <SHIFT> and <TAB> keys are pressed.
virtual void SetAlignment(ETextJustification mode=kTextLeft)
Sets the alignment of the text entry.
void Reset()
Reset the timer.
virtual void TabPressed()
This signal is emitted when the <TAB> key is pressed.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
virtual Bool_t HandleSelectionClear(Event_t *event)
Handle selection clear event.
const Mask_t kKeyShiftMask
const Mask_t kButtonMotionMask
TString & ReplaceAll(const TString &s1, const TString &s2)
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
void SetForeground(Pixel_t v)
Set foreground color.
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Bool_t TestBit(UInt_t f) const
virtual Bool_t HandleSelection(Event_t *event)
Handle text selection event.
static Pixel_t GetWhitePixel()
Get white pixel value.
virtual Bool_t HandleConfigureNotify(Event_t *event)
Handles resize events for this widget.
const Mask_t kLeaveWindowMask
virtual void SetTextColor(Pixel_t color, Bool_t local=kTRUE)
Changes text color.
const Mask_t kWABitGravity
const TGResourcePool * GetResourcePool() const
virtual void DrawBorder()
Draw frame border.
Cursor_t GetTextCursor() const
static Pixel_t fgWhitePixel
Short_t Min(Short_t a, Short_t b)
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...
virtual void UpdateOffset()
Updates start text offset according GetAlignment() mode, if cursor is out of frame => scroll the text...
TString & Prepend(const char *cs)
virtual void SetInsertMode(EInsertMode mode=kInsert)
Sets the mode how characters are entered to the text entry.
UInt_t GetTextLength() const
static const TGGC & GetDefaultSelectedGC()
Return selection graphics context.
void CursorWordBackward(Bool_t mark=kFALSE)
Moves the cursor one word to the left.
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save the used font as a C++ statement(s) on output stream out.
EInsertMode GetInsertMode() const
TString GetMarkedText() const
Returns the text marked by the user (e.g.
virtual void SetState(Bool_t state)
Set state of widget. If kTRUE=enabled, kFALSE=disabled.
virtual void SelectAll()
Selects all text (i.e.
void Deselect()
Deselects all text (i.e.
void MarkWord(Int_t pos)
Marks the word nearest to cursor position.
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual void ReturnPressed()
This signal is emitted when the return or enter key is pressed.
TGTextEntry * gBlinkingEntry
ETextJustification fAlignment
void ProcessLine(TString cmd, Long_t msg, Long_t parm1, Long_t parm2)
Execute string "cmd" via the interpreter.
void Cut()
Copies the marked text to the clipboard and deletes it, if there is any.
virtual void SetFocus()
Set focus to this text entry.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion event in the text entry widget.
const char * GetString() const
virtual Bool_t HandleTimer(TTimer *t)
Handle cursor blink timer.
void AddText(Int_t pos, const char *text)
void Del()
Deletes the character on the right side of the text cursor.
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
static const TGGC * fgDefaultSelectedGC
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event in text entry widget.
void NewMark(Int_t pos)
New character mark at position pos.
void End(Bool_t mark=kFALSE)
Moves the text cursor to the right end of the line.
UInt_t GetBufferLength() const
virtual void SetMaxLength(Int_t maxlen)
Set the maximum length of the text in the editor.
virtual void SetDefaultSize(UInt_t w, UInt_t h)
Set the default / minimal size of the widget.
virtual void RequestFocus()
TGTextBuffer * GetBuffer() const
virtual Bool_t Notify()
Notify when timer times out.
void RemoveText(Int_t pos, Int_t length)
const Mask_t kButtonPressMask
const Mask_t kKeyPressMask
void SetFont(FontH_t v)
Set font.
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...
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...
R__EXTERN TSystem * gSystem
EEchoMode GetEchoMode() const
virtual Bool_t HandleKey(Event_t *event)
The key press event handler converts a key press to some line editor action.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
ULong_t GetPixel() const
Return pixel value corresponding to this color.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a text entry widget as a C++ statement(s) on output stream out.
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.
void CopyText() const
Copies the marked text to the clipboard, if there is any and GetEchoMode() is kNormal.
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use.
Int_t GetCharacterIndex(Int_t xcoord)
Returns the index of the character to whose left edge xcoord is closest.
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle mouse double click event in the text entry widget.
Handles synchronous and a-synchronous timer events.
virtual void TextChanged(const char *text=0)
This signal is emitted every time the text has changed.
void Remove()
Deletes all characters on the right side of the cursor.
static const TGGC * fgDefaultGC
virtual void CursorOutRight()
This signal is emitted when cursor is going out of right side.
static const TGFont * fgDefaultFont
virtual Bool_t HandleFocusChange(Event_t *event)
Handle focus change event in text entry widget.
static const TGGC & GetBlackGC()
Get black graphics context.
virtual TGDimension GetDefaultSize() const
Return the default / minimal size of the widget.
const char * GetString() const
virtual Bool_t HandleConfigureNotify(Event_t *event)
This event is generated when the frame is resized.
const char * GetText() const
TString & Remove(Ssiz_t pos)
virtual void CursorOutUp()
This signal is emitted when cursor is going out of upper side.
const Mask_t kEnterWindowMask
void SavePrimitive(std::ostream &out, Option_t *option="")
Save graphics context info as a C++ statement(s) on output stream out.
void CursorLeft(Bool_t mark=kFALSE, Int_t steps=1)
Moves the cursor leftwards one or more characters.
virtual Bool_t IsCursorOutOfFrame()
Returns kTRUE if cursor is out of frame.
const Mask_t kStructureNotifyMask
virtual void Insert(const char *)
Removes any currently selected text, inserts newText, sets it as the new contents of the text entry...
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
const Mask_t kButtonReleaseMask
virtual void CursorOutDown()
This signal is emitted when cursor is going out of bottom side.
virtual void DoRedraw()
Draw the text entry widget.
static RooMathCoreReg dummy
FontStruct_t GetFontStruct() const
virtual void DoubleClicked()
This signal is emitted when widget is double clicked.
const Mask_t kWAWinGravity
virtual void CursorOutLeft()
This signal is emitted when cursor is going out of left side.
The color creation and management class.
Bool_t IsFrameDrawn() const
Atom_t GetClipboard() const
virtual void SetFont(TGFont *font, Bool_t local=kTRUE)
Changes text font specified by pointer to TGFont object.
virtual void ScrollByChar()
Shift position of cursor by one character.
TGTextEntry(const TGTextEntry &)
virtual void AddTimer(TTimer *t)
Add timer to list of system timers.
virtual Bool_t HandleCrossing(Event_t *event)
Handle mouse crossing event.
Short_t Max(Short_t a, Short_t b)
const Mask_t kFocusChangeMask
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
void Backspace()
Deletes the character on the left side of the text cursor and moves the cursor one position to the le...
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
void CursorWordForward(Bool_t mark=kFALSE)
Moves the cursor one word to the right.
void Paste()
Inserts text at the cursor position, deleting any previous marked text.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
virtual ~TGTextEntry()
Delete a text entry widget.
const Mask_t kKeyControlMask
void Home(Bool_t mark=kFALSE)
Moves the text cursor to the left end of the line.
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...
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...
void Clear(Option_t *option="")
Clears up the text entry.
const Mask_t kAnyModifier
virtual void SetEchoMode(EEchoMode mode=kNormal)
The echo modes available are:
double norm(double *x, double *p)
static const TGGC & GetShadowGC()
Get shadow color graphics context.
static const TGGC & GetBckgndGC()
Get background color graphics context.
static TString * fgClipboardText
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
virtual void SetWindowName(const char *name=0)
Set window name.
TString GetDisplayText() const
Returns the text that's currently displayed.
const char * Data() const