10 #include "KVListView.h"
11 #include "KVLVContainer.h"
12 #include "KVLVEntry.h"
55 return fContainer->fSortType * fContainer->fSortData->Compare(r1, r2);
71 fMethCall.Execute(obj,
"", i);
80 fMethCall.Execute(obj,
"", i);
91 fMethCall.Execute(obj,
"", lret);
96 fMethCall.Execute(obj,
"", &cret);
107 fMethCall.Execute(obj,
"", lret);
135 case (
Int_t)kTString :
141 result.Form(fDataFormat, lret);
146 result.Form(fDataFormat, dret);
156 std::cout <<
"Error in <KVLVColumnData::GetDataString> : column " << fName <<
" : this type is not supported "
157 << (
Int_t)fMethCall.ReturnType() << std::endl;
195 if (with_reference) {
198 TString ptr_type = fMethCall.GetMethod()->GetReturnTypeName();
199 fIsKVDatime = ptr_type.
Contains(
"KVDatime");
215 return (d1 < d2 ? -1 : (d1 > d2 ? 1 : 0));
239 return (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0));
251 return (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0));
277 return Compare_string(ob1, ob2);
281 return Compare_long(ob1, ob2);
285 return Compare_double(ob1, ob2);
290 return Compare_date(ob1, ob2);
294 std::cout <<
"Error in <KVLVColumnData::Compare> : this type is not supported "
295 << (
Int_t)fMethCall.ReturnType() << std::endl;
348 Connect(
"Clicked(TGFrame*,Int_t,Int_t,Int_t)",
349 "KVLVContainer",
this,
"OpenContextMenu(TGFrame*,Int_t,Int_t,Int_t)");
350 Connect(
"DoubleClicked(TGFrame*,Int_t,Int_t,Int_t)",
351 "KVLVContainer",
this,
"DoDoubleClick(TGFrame*,Int_t,Int_t,Int_t)");
394 for (
int i = 0; i <
fNcols; i++) {
468 if (list_of_objects->
GetEntries() > max_entries) {
471 Form(
"The list contains more than %d items. Do you want to display all items ?",
478 TIter next(list_of_objects);
480 while ((o = next()) && (
N++) < max_entries) list2.
Add(o);
549 if (
l && !
l->GetSize())
return;
554 while ((obj = nxt())) {
577 for (
int i = 0; i < ncols; i++) {
608 if (
f->GetUserData() == userData) {
631 if (
f->GetUserData() == userData) {
655 if (val ==
data)
return f;
675 if (val ==
data)
return f;
695 if (val ==
data)
return f;
740 printf(
"%ld\n",
data);
767 while (!
data.End()) {
807 for(
auto& r_ind :
data)
1083 Connect(
"DoubleClickAction(TObject*)", receiver_class, receiver, slot);
1093 Emit(
"DoubleClickAction(TObject*)", (
Long_t)obj);
1109 if (list.IsEmpty()) {
1113 else if (list.GetEntries() == 1) {
1162 Emit(
"SelectAll()");
const Mask_t kKeyControlMask
Int_t Compare(const void *item1, const void *item2)
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 result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
char * Form(const char *fmt,...)
Base class for KaliVeda framework.
const Char_t * GetLabel() const
virtual TObject * GetObject() const
Extension of TDatime to handle various useful date formats.
const Char_t * String(EKVDateFormat fmt=kCTIME)
Utility class describing the data used to fill each column of the list view container.
Int_t Compare_double(TObject *o1, TObject *o2)
const Char_t * GetDataString(TObject *)
Format string with column data for object.
Int_t Compare_date(TObject *o1, TObject *o2)
Int_t Compare(TObject *ob1, TObject *ob2)
Int_t Compare_long(TObject *o1, TObject *o2)
Int_t Compare_string(TObject *o1, TObject *o2)
virtual void SetIsDateTime(KVDatime::EKVDateFormat fmt=KVDatime::kCTIME, Bool_t with_reference=kTRUE)
void GetData(TObject *, Long_t &)
Extension of TGLVContainer for KVListView widget.
KVSeqCollection * fPickOrderedObjects
list of currently selected objects, in order of selection
void ActivateItemWithData(void *userData, Bool_t activate=kTRUE)
KVLVColumnData * fSortData
name of column (i.e. type of data) currently used to sort objects
virtual void FillList(const TCollection *=0)
void AddDataColumn(const char *columnName)
virtual void Display(const TCollection *=0)
void DoubleClickAction(TObject *)
void SelectAll() override
void SetNewColumnName(const char* columnName);
TObject * GetFirstInList()
Returns first object in currently displayed list.
Bool_t HandleButton(Event_t *event) override
Override TGContainer method in order to set fControlClick flag.
TContextMenu * fContextMenu
used to display popup context menu for items
virtual ~KVLVContainer()
Destructor.
void OpenContextMenu(TGFrame *, Int_t, Int_t, Int_t)
Bool_t fUserDoubleClickAction
user-defined double-click action instead of Browse() override method
void ActivateItemWithColumnData(const Char_t *colname, const Char_t *data, Bool_t activate=kTRUE)
Bool_t fAllowContextMenu
can objects' context menu be opened with right-click ?
Int_t fNcols
number of data columns
void DoDoubleClick(TGFrame *, Int_t, Int_t, Int_t)
Bool_t fUseObjLabelAsRealClass
if kTRUE, object's classname read from KVBase::GetLabel() (objects must be KVBase-derived!...
Bool_t fControlClick
set to kTRUE when user ctrl-clicks an item
void RemoveAll() override
TGLVEntry * FindItemWithColumnData(const Char_t *colname, const Char_t *data)
Bool_t fAllowDoubleClick
do something when object double-clicked ?
friend class KVLVFrameElement
void ActivateItemsWithColumnData(const Char_t *colname, const KVNumberList &data, Bool_t activate=kTRUE)
Bool_t fKeepUserItems
internal use only, do not clear list of user items in RemoveAll() override
KVLVColumnData ** fColData
description of column data
KVLVContainer(const TGWindow *p=0, UInt_t w=1, UInt_t h=1, UInt_t options=kSunkenFrame, Pixel_t back=GetDefaultFrameBackground())
TObject * GetLastInList()
Returns last object in currently displayed list.
KVUnownedList GetSelectedObjects()
virtual void SetDataColumns(Int_t ncols)
void AddContextMenuClassException(TClass *)
KVUnownedList GetSelectedItems()
Int_t fSortType
current sorting mode of contents (ascending or descending)
virtual void SetDataColumn(Int_t index, TClass *cl, const Char_t *name, const Char_t *method="")
void AddFrame(TGFrame *f, TGLayoutHints *l=0) override
Add an item to the list.
KVUnownedList fUserItems
list of currently displayed items, used by Refresh()
void Sort(int column)
Sort objects in container according to contents of given column.
virtual void ActivateItemFromSelectAll(TGFrameElement *el)
Activate item.
TList * fContextMenuClassExceptions
list of classes for which we override value of fAllowContextMenu
void SetDoubleClickAction(const char *receiver_class, void *receiver, const char *slot)
TGLVEntry * FindItemWithData(void *userData)
Find item with fUserData == userData in container.
Int_t * fSortDir
direction of sorting for each column
Bool_t fIsResized
used to resize columns exactly once
One item/line in a KVListView window.
Extension of TGFrameElement used by KVLVContainer.
Bool_t IsSortable() const
KVLVContainer * fContainer
Int_t Compare(const TObject *obj) const
Method responsible for sorting the objects in the GUI list.
Enhanced version of ROOT TGListView widget.
Strings used to represent a set of ranges of values.
TObject * Remove(TObject *obj) override
Remove object from list.
void Add(TObject *obj) override
TObject * FindObject(const char *name) const override
void AddLast(TObject *obj) override
void Clear(Option_t *option="") override
virtual void SetCleanup(Bool_t enable=kTRUE)
Extended TList class which does not own its objects by default.
virtual Int_t GetEntries() const
virtual const char * GetValue(const char *name, const char *dflt) const
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
void MapSubwindows() override
static TGLayoutHints * fgDefaultHints
virtual void Associate(const TGWindow *w)
const TGWindow * fMsgWindow
virtual void CurrentChanged(Int_t x, Int_t y)
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
void RemoveAll() override
virtual TGPosition GetPagePosition() const
TGFrameElement * fLastActiveEl
virtual Bool_t IsActive() const
virtual void Activate(Bool_t)
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Bool_t HandleButton(Event_t *event) override
void SetMultipleSelection(Bool_t multi=kTRUE)
virtual void AddItem(TGLVEntry *item)
void DeActivateItem(TGFrameElement *el) override
void ActivateItem(TGFrameElement *el) override
TGListView * GetListView() const
Bool_t GetMultipleSelection() const
void * GetUserData() const
virtual void ResizeColumns()
virtual const TGWindow * GetMainFrame() const
const TGWindow * GetParent() const
void Clear(Option_t *option="") override
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
TObject * Last() const override
TObject * First() const override
virtual void Sort(Bool_t order=kSortAscending)
static const EReturnType kLong
static const EReturnType kString
static const EReturnType kDouble
virtual void Browse(TBrowser *b)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
void Emit(const char *signal)
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
const char * Data() const
void Form(const char *fmt,...)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
List of runfiles specified by run number and file index ,.
Specifies a runfile according to run number and file index ,.