138 int max_ascent, max_descent;
142 fTHeight = max_ascent + max_descent;
161 int max_ascent, max_descent;
197 int max_ascent, max_descent;
200 fTHeight = max_ascent + max_descent;
243 memcpy(gcv.
fDashes,
"\x5\x5", 3);
248 int max_ascent, max_descent;
253 max_ascent, max_descent);
254 fTHeight = max_ascent + max_descent;
287 static const char* dashed =
"\x3\x3";
288 static const char* dotted=
"\x1\x2";
289 static const char* dasheddotted =
"\x3\x4\x1\x4";
290 static const char* ls05 =
"\x5\x3\x1\x3";
291 static const char* ls06 =
"\x5\x3\x1\x3\x1\x3\x1\x3";
292 static const char* ls07 =
"\x5\x5";
293 static const char* ls08 =
"\x5\x3\x1\x3\x1\x3";
294 static const char* ls09 =
"\x20\x5";
295 static const char* ls10 =
"\x20\x10\x1\x10";
298 if (linestyle <= 1) {
303 fLineGC->SetDashList(dashed, 2);
306 fLineGC->SetDashList(dotted, 2);
309 fLineGC->SetDashList(dasheddotted, 4);
353 fClient->GetResourcePool()->GetSelectedFgndColor());
356 fClient->GetResourcePool()->GetBlackColor());
380 int max_ascent, max_descent;
390 max_ascent, max_descent);
391 fTHeight = max_ascent + max_descent;
444 if (pic) ((
TGPicture *)pic)->AddReference();
466 const char *
t1 =
f1->GetText()->Data();
469 if ((d1 = atof(
t1)) && (d2 = atof(t2))) {
472 return strcmp(
t1, t2);
551 if (
e->EntryId() == afterID)
break;
554 if (!el && afterID != -1) {
567 fList->AddAfter(el, nw);
587 if (
e->EntryId() > lbe->
EntryId())
break;
600 fList->AddBefore(el, nw);
620 if (
e->EntryId() ==
id) {
648 if ((
e->EntryId() >= from_ID) && (
e->EntryId() <= to_ID)) {
711 if (
f->EntryId() ==
id) {
746 if (
f->EntryId() ==
id)
747 return f->IsActive();
816 int xf0, yf0, xff, yff;
823 Int_t x = pos.fX +
event->fX;
824 Int_t y = pos.fY +
event->fY;
837 if (newpos < 0) newpos = 0;
859 xff = xf0 +
f->GetWidth();
860 yff = yf0 +
f->GetHeight();
863 (
x > xf0) && (
x < xff) && (
y > yf0) && (
y < yff);
889 xff = xf0 +
f->GetWidth();
890 yff = yf0 +
f->GetHeight();
893 (
x > xf0) && (
x < xff) && (
y > yf0) && (
y < yff) && !
f->IsActive();
919 if (
fListBox->GetParent()->InheritsFrom(
"TGComboBoxPopup"))
947 int xf0, yf0, xff, yff;
952 if ((now-was) < 50)
return kFALSE;
959 Int_t x = pos.fX +
event->fX;
960 Int_t y = pos.fY +
event->fY;
966 if ((event->
fY < 10) || (event->
fY >
Int_t(dim.fHeight) - 10)) {
979 xff = xf0 +
f->GetWidth();
980 yff = yf0 +
f->GetHeight();
982 (
x > xf0) && (
x < xff) && (
y > yf0) && (
y < yff);
995 }
else if (
fListBox->GetParent()->InheritsFrom(
"TGComboBoxPopup")) {
1001 xff = xf0 +
f->GetWidth();
1002 yff = yf0 +
f->GetHeight();
1005 (
x > xf0) && (
x < xff) && (
y > yf0) && (
y < yff) && !
f->IsActive();
1043 if (vb &&
y > 0 &&
y < 10) {
1046 if (newpos < 0) newpos = 0;
1050 else if (vb &&
y > (
Int_t)dim.fHeight - 10 &&
y < (
Int_t)dim.fHeight) {
1062 yff = yf0 +
f->GetHeight();
1063 if ((
y + pos.fY > yf0) && (
y + pos.fY < yff)) {
1099 if (
f->EntryId() ==
id)
1145 fLbc->Associate(
this);
1146 fLbc->SetListBox(
this);
1181 if (
gClient->GetStyle() > 1)
break;
1207 fLbc->AddEntry(lbe, lhints);
1226 fLbc->AddEntry(lbe, lhints);
1244 fLbc->AddEntrySort(lbe, lhints);
1267 fLbc->AddEntrySort(lbe, lhints);
1282 fLbc->InsertEntry(lbe, lhints, afterID);
1317 fLbc->RemoveEntry(
id);
1321 if (!
fLbc->GetMultipleSelections()) {
1322 fLbc->RemoveEntry(
fLbc->GetSelected());
1327 fLbc->GetSelectedEntries(&li);
1332 fLbc->RemoveEntry(
e->EntryId());
1351 fLbc->RemoveEntries(from_ID, to_ID);
1362 fLbc->InsertEntry(lbe, lhints, afterID);
1375 if (lbe->
EntryId() ==
id)
return lbe;
1387 idPos =
fLbc->GetPos(
id);
1456 container =
fVport->GetContainer();
1469 if ((
Int_t) cw < 0) {
1470 Warning(
"Layout",
"width would become too small, setting to 10");
1481 container->
Resize(cw, tch);
1503 fLbc->GetList()->Sort(ascend);
1505 fLbc->ClearViewPort();
1523 fLbc->GetSelectedEntries(selected);
1540 fLbc->ClearViewPort();
1612 Emit(
"Selected(Int_t,Int_t)", args);
1625 Emit(
"DoubleClicked(Int_t,Int_t)", args);
1651 out <<
"\n // list box\n";
1652 out <<
" TGListBox *" <<
GetName() <<
" = new TGListBox(" <<
fParent->GetName();
1657 if (option && strstr(option,
"keep_names"))
1658 out <<
" " <<
GetName() <<
"->SetName(\"" <<
GetName() <<
"\");\n";
1660 if (!
fLbc->GetList())
1665 out <<
" " <<
GetName() <<
"->AddEntry(";
1666 el->fFrame->SavePrimitive(out, option);
const Mask_t kGCLineStyle
const Mask_t kGCLineWidth
const Mask_t kButtonMotionMask
const Mask_t kButtonPressMask
const Mask_t kGCFillStyle
const Mask_t kPointerMotionMask
Handle_t GContext_t
Graphics context handle.
const Mask_t kButtonReleaseMask
Handle_t FontStruct_t
Pointer to font structure.
ULong_t Pixel_t
Pixel value.
Handle_t Window_t
Window handle.
ULongptr_t Handle_t
Generic resource handle.
int Int_t
Signed integer 4 bytes (int).
long Longptr_t
Integer large enough to hold a pointer (platform-dependent).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
short Style_t
Style number (short).
const char Option_t
Option string (const char).
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
TGLayoutManager * fLayoutManager
layout manager
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Int_t MustCleanup() const override
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
TGCompositeFrame(const TGCompositeFrame &)=delete
Bool_t fMapSubwindows
kTRUE - map subwindows
TList * fList
container of frame elements
static TGLayoutHints * fgDefaultHints
virtual void ActivateItem(TGFrameElement *el)
Activate item.
TTimer * fScrollTimer
autoscroll timer
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click mouse event.
virtual void ClearViewPort()
Clear view port and redraw full content.
const TGWindow * fMsgWindow
window handling container messages
void Layout() override
Layout container entries.
TGContainer(const TGContainer &)=delete
void DoRedraw() override
Redraw content of container in the viewport region.
Bool_t fScrolling
kTRUE - when scrolling is ON
virtual TGDimension GetPageDimension() const
Returns page dimension.
virtual void DoubleClicked(TGFrame *f, Int_t btn)
Emit DoubleClicked() signal.
virtual TGPosition GetPagePosition() const
Returns page position.
TGFrameElement * fLastActiveEl
last active item
Encapsulate fonts used in the GUI system.
TGFrameElement(const TGFrameElement &)
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
static const TGGC & GetBlackGC()
Get black graphics context.
UInt_t fOptions
frame options
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
TGFrame(const TGFrame &)=delete
UInt_t fHeight
frame height
virtual UInt_t GetDefaultHeight() const
virtual void DrawBorder()
Draw frame border.
Int_t fBorderWidth
frame border width
static Pixel_t fgDefaultSelectedBackground
void DoRedraw() override
Redraw the frame.
virtual Pixel_t GetForeground() const
Return frame foreground color.
static const TGGC & GetHilightGC()
Get highlight color graphics context.
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.
TString SaveCtorArgs(std::ostream &out, UInt_t dflt_options=kChildFrame, Bool_t check_white_pixel=kFALSE)
Return options and custom color as constructor args Used in the SavePrimitive methods,...
virtual void SetWidth(UInt_t w)
static Pixel_t fgWhitePixel
virtual void SetHeight(UInt_t h)
Pixel_t fBackground
frame background color
static const TGGC & GetBckgndGC()
Get background color graphics context.
Encapsulate a graphics context used in the low level graphics.
void DoRedraw() override
Redraw icon & text listbox entry.
~TGIconLBEntry() override
Delete icon & text listbox entry.
virtual void SetPicture(const TGPicture *pic=nullptr)
Change the icon of listbox entry containing icon & text.
void DrawCopy(Handle_t id, Int_t x, Int_t y) override
Draw copy on window/pixmap.
TGIconLBEntry(const TGIconLBEntry &)=delete
const TGPicture * fPicture
void Update(TGLBEntry *e) override
Update icon & text listbox entry.
A Composite frame that contains a list of TGLBEnties.
TGLBContainer(const TGLBContainer &)=delete
Bool_t fMultiSelect
true if multi selection is switched on
virtual Bool_t GetSelection(Int_t id)
Returns kTrue if entry id is selected.
void OnAutoScroll() override
Autoscroll while close to & beyond The Wall.
void RemoveAll() override
Remove all entries in this container.
void SetVsbPosition(Int_t newPos) override
Set new vertical scroll bar position.
TGVScrollBar * GetVScrollbar() const override
Return a pointer to vertical scroll bar.
Int_t fChangeStatus
defines the changes (select or unselect) while the mouse moves over a multi selectable list box
virtual Int_t GetSelected() const
Returns id of selected entry.
Bool_t HandleButton(Event_t *event) override
Handle mouse button event in the listbox container.
void Layout() override
Layout container.
void ActivateItem(TGFrameElement *el) override
Activate item.
virtual TGLBEntry * Select(Int_t id, Bool_t sel)
Select / deselect the entry with the specified id.
TGLBEntry * fLastActive
last active listbox entry in single selection listbox
Bool_t HandleDoubleClick(Event_t *event) override
Handle double click mouse event in the listbox container.
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove entries from from_ID to to_ID (including).
TGListBox * fListBox
list box which contains this container
virtual void AddEntry(TGLBEntry *lbe, TGLayoutHints *lhints)
Add listbox entry with hints to container.
virtual Int_t GetPos(Int_t id)
Returns the position in the list box of the entry id.
virtual void AddEntrySort(TGLBEntry *lbe, TGLayoutHints *lhints)
Insert listbox entry before the list box entry with a higher id.
virtual void InsertEntry(TGLBEntry *lbe, TGLayoutHints *lhints, Int_t afterID)
Insert listbox entry after specified entry with id afterID.
virtual void RemoveEntry(Int_t id)
Remove the entry with specified id from the listbox container.
virtual void GetSelectedEntries(TList *selected)
Adds all selected entries (TGLBEntry) of the list box into the list selected.
void DoRedraw() override
redraw
~TGLBContainer() override
Delete the listbox container.
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion event in listbox container.
virtual void SetMultipleSelections(Bool_t multi)
Enables and disables multiple selections of entries.
Pixel_t fBkcolor
entry background color
Int_t fEntryId
message id of listbox entry
void DoRedraw() override
Redraw the frame.
virtual void Toggle()
Toggle active state of listbox entry.
Bool_t fActive
true if entry is active
void SetBackgroundColor(Pixel_t col) override
Set background color (override from TGWindow base class).
TGLBEntry(const TGWindow *p=nullptr, Int_t id=-1, UInt_t options=kHorizontalFrame, Pixel_t back=GetWhitePixel())
Base class entry constructor.
void Activate(Bool_t a) override
Toggle active state of listbox entry.
TGLBFrameElement(TGFrame *f, TGLayoutHints *l)
Int_t Compare(const TObject *obj) const override
Compare abstract method.
~TGLBFrameElement() override
Bool_t IsSortable() const override
This class describes layout hints used by the layout classes.
Style_t fLineStyle
line style
TGGC * fLineGC
line graphics context
UInt_t fLineLength
line length
UInt_t fLineWidth
line width
void DrawCopy(Handle_t id, Int_t x, Int_t y) override
Draw copy on window/pixmap.
void DoRedraw() override
Redraw line style listbox entry.
void Update(TGLBEntry *e) override
Update line style listbox entry.
virtual void SetLineWidth(Int_t width)
Set or change line width in an entry.
virtual void SetLineStyle(Style_t style)
Set the line style corresponding to the TPad line styles.
~TGLineLBEntry() override
Delete line style listbox entry.
TGLineLBEntry(const TGLineLBEntry &)=delete
virtual void InitListBox()
Initiate the internal classes of a list box.
Bool_t fIntegralHeight
true if height should be multiple of fItemVsize
virtual void AddEntrySort(TGString *s, Int_t id)
Add entry with specified string and id to listbox sorted by increasing id.
TGListBox(const TGListBox &)=delete
virtual void SortByName(Bool_t ascend=kTRUE)
Sort entries by name.
TGViewPort * fVport
listbox viewport (see TGCanvas.h)
UInt_t fItemVsize
maximum height of single entry
TGDimension GetDefaultSize() const override
Return default size of listbox widget.
virtual Int_t GetNumberOfEntries() const
TGLBContainer * fLbc
listbox container
virtual TGLBEntry * GetSelectedEntry() const
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
virtual void NewEntry(const char *s="Entry")
method used to add entry via context menu
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
virtual Int_t GetSelected() const
Return id of selected listbox item.
~TGListBox() override
Delete a listbox widget.
void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) override
Move and resize the listbox widget.
virtual void SetTopEntry(Int_t id=-1)
Scroll the entry with id to the top of the listbox.
void ChangeBackground(Pixel_t back) override
Change background to all entries.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
void Layout() override
Layout the listbox components.
virtual void DoubleClicked(Int_t widgetId, Int_t id)
Emit DoubleClicked signal with list box id and entry id.
virtual void InsertEntry(TGString *s, Int_t id, Int_t afterID)
Insert entry with specified string and id behind the entry with afterID.
virtual void SelectionChanged()
virtual Bool_t GetMultipleSelections() const
void SetContainer(TGFrame *f)
TGVScrollBar * fVScrollbar
vertical scrollbar
void DrawBorder() override
Draw borders of the list box widget.
virtual TGLBEntry * GetEntry(Int_t id) const
Returns list box entry with specified id.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a list box widget as a C++ statement(s) on output stream out.
virtual void GetSelectedEntries(TList *selected)
Adds all selected entries (TGLBEntry) of the list box into the list selected.
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Remove a range of entries defined by from_ID and to_ID.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages generated by the listbox container and forward messages to the listbox message handl...
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
void RemoveAll() override
Remove all entries.
virtual void Selected(Int_t widgetId, Int_t id)
Emit Selected signal with list box id and entry id.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Text string listbox entries.
Bool_t fTextChanged
true if text has been changed
const TGString * GetText() const
GContext_t fNormGC
text drawing graphics context
static const TGFont * fgDefaultFont
void DoRedraw() override
Redraw text listbox entry.
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a list box entry widget as a C++ statement(s) on output stream out.
void DrawCopy(Handle_t id, Int_t x, Int_t y) override
Draw text listbox entry on window/pixmap.
const char * GetTitle() const override
Returns title of object.
UInt_t fTHeight
text height
~TGTextLBEntry() override
Delete text listbox entry.
TGString * fText
entry text string
void Update(TGLBEntry *e) override
FontStruct_t fFontStruct
font used to draw string
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use for a text listbox entry.
static const TGGC & GetDefaultGC()
Return default graphics context in use for a text listbox entry.
TGTextLBEntry(const TGTextLBEntry &)=delete
static TGGC * fgDefaultGC
void SetText(TGString *new_text)
Set or change text in text entry.
ROOT GUI Window base class.
const TGWindow * fParent
Parent window.
@ kEditDisableLayout
window layout cannot be edited
@ kEditDisableBtnEnable
window can handle mouse button events
@ kEditDisableGrab
window grab cannot be edited
@ kEditDisable
disable edit of this window
@ kEditDisableKeyEnable
window can handle keyboard events
virtual void SetWindowName(const char *name=nullptr)
Set window name.
virtual Bool_t IsMapped()
Returns kTRUE if window is mapped on screen, kFALSE otherwise.
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".
virtual const char * GetTitle() const
Returns title of object.
TObject()
TObject constructor.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Ceil(Double_t x)
Rounds x upward, returning the smallest integral value that is not less than x.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
UInt_t fState
key or button mask
Int_t fYRoot
coordinates relative to root
UInt_t fCode
key or button code
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Graphics context structure.
Int_t fDashOffset
patterned/dashed line information
Int_t fLineWidth
line width
Mask_t fMask
bit mask specifying which fields are valid
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Char_t fDashes[8]
dash pattern list (dash length per byte)
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
Int_t fDashLen
number of dashes in fDashes