KaliVeda
Toolkit for HIC analysis
|
Enhanced version of ROOT TGListView widget.
Created by KVClassFactory on Wed Apr 9 11:51:38 2008 Author: franklan
KVListView takes a list of objects (TObject or derived class) and presents them as a list of items with different data for each object presented in separate columns.
The user specifies the common base-class of the objects to display, the number of columns, and the data to be presented in each column.
The example in the figure shown above (displaying a list of KVDBRun objects) was generated with the following code:
lvRuns = new KVListView(KVDBRunClass(), cfRuns, 500, 250); // 'cfRuns' is pointer to parent frame lvRuns->SetDataColumns(4); //set number of columns to 4 lvRuns->SetDataColumn(0, "Run", "GetNumber"); //by default, the data presented in a column with title "Toto" will be retrieved lvRuns->SetDataColumn(1, "Events", "", kTextRight); //from each object by calling the "GetToto" method of the class given to the KVListView ctor. lvRuns->SetDataColumn(2, "Date", "GetDatime"); //in case the "getter" method has a non-standard name, it can be given explicitly. lvRuns->GetDataColumn(2)->SetIsDateTime(); //some special treatment is afforded to date/time data. see method doc. lvRuns->SetDataColumn(3, "Comments", "", kTextLeft);// specify text alignment for data lvRuns->ActivateSortButtons();//when clicking a column header, the list is sorted according to that column's data. ... //clicking a second time the same column sorts objects in the opposite sense.
To display objects, put them in a TList and call
lvRuns->Display( pointer_to_TList );
Items in the list can be selected using either:
(By default, multiple selection of objects is allowed. Call AllowMultipleSelection(kFALSE) to disable).
When the selection changes, the KVListView emits the
SelectionChanged()
signal.
The list of the currently selected objects can be retrieved with the method
GetSelectedObjects()
which returns a TList of the currently selected objects (delete list after use), or
GetPickOrderedSelectedObjects()
which returns a TList of the currently selected objects IN THE ORDER THEY WERE CLICKED
By default, double-left-clicking an object will execute the
Browse()
method of the object. This method is defined for all TObjects, it can be overridden in derived classes in order to do something interesting and/or useful.
Alternatively, using method
SetDoubleClickAction(const char* receiver_class, void* receiver, const char* slot)
you can define a different behaviour when objects are double-clicked using signals & slots.
If you want to deactivate the double-click actions, call
AllowDoubleClick(kFALSE)
By default, context menus are active, which means that right-clicking an object opens its context menu. Call method
AllowContextMenu(kFALSE)
to deactivate all context menus, or
AddContextMenuClassException(TClass*)
to activate/deactivate context menus for specific classes, depending on whether context menus are globally activated or not.
See also 'Wrapper classes' below.
An icon is shown next to each item in the list. This icon is defined (for most ROOT objects e.g. histograms of different types) in the $ROOTSYS/etc/root.mimes file. Other icons can be added in .kvrootrc as in the following example:
+KaliVeda.GUI.MimeTypes: TCutG KaliVeda.GUI.MimeTypes.TCutG.Icon: cut_t.xpm
which adds an icon (pair of scissors) for the TCutG class (not defined in root.mimes).
See also 'Wrapper classes' below.
For convenience, the objects placed in the list may be of a class which provides a 'wrapper' around the actual object of interest.
In this case, it is possible (if the 'wrapper' inherits from KVBase) to have the icon and the context menu of each object reflect the object of interest, rather than the wrapper.
To do so, call method
SetUseObjLabelAsRealClass(kTRUE)
and have the wrapper class' GetLabel()
and GetObject()
methods return the class name and address of the wrapped object.
Definition at line 146 of file KVListView.h.
#include <KVListView.h>
Private Attributes | |
TContextMenu * | fContextMenu |
UInt_t | fMaxColumnSize |
maximum width of columns | |
TClass * | fObjClass |
class of objects in list | |
int | nselected |
number of selected items | |
Additional Inherited Members | |
Public Types inherited from TGWindow | |
enum | EEditMode |
enum | EStatusBits |
Public Types inherited from TObject | |
enum | EDeprecatedStatusBits |
enum | EStatusBits |
Static Public Member Functions inherited from TGListView | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TGCanvas | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TGFrame | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static const TGGC & | GetBckgndGC () |
static const TGGC & | GetBlackGC () |
static Pixel_t | GetBlackPixel () |
static Pixel_t | GetDefaultFrameBackground () |
static Pixel_t | GetDefaultSelectedBackground () |
static const TGGC & | GetHilightGC () |
static const TGGC & | GetShadowGC () |
static const TGGC & | GetWhiteGC () |
static Pixel_t | GetWhitePixel () |
Static Public Member Functions inherited from TGWindow | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Int_t | GetCounter () |
Static Public Member Functions inherited from TGObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
static Bool_t | GetObjectStat () |
static void | SetDtorOnly (void *obj) |
static void | SetObjectStat (Bool_t stat) |
Static Public Member Functions inherited from TQObject | |
static Bool_t | AreAllSignalsBlocked () |
static Bool_t | BlockAllSignals (Bool_t b) |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static Bool_t | Connect (const char *sender_class, const char *signal, const char *receiver_class, void *receiver, const char *slot) |
static Bool_t | Connect (TQObject *sender, const char *signal, const char *receiver_class, void *receiver, const char *slot) |
static const char * | DeclFileName () |
static Bool_t | Disconnect (const char *class_name, const char *signal, void *receiver=nullptr, const char *slot=nullptr) |
static Bool_t | Disconnect (TQObject *sender, const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr) |
Public Attributes inherited from TGCanvas | |
kCanvasNoScroll | |
kCanvasScrollBoth | |
kCanvasScrollHorizontal | |
kCanvasScrollVertical | |
Public Attributes inherited from TGWindow | |
kEditDisable | |
kEditDisableBtnEnable | |
kEditDisableEvents | |
kEditDisableGrab | |
kEditDisableHeight | |
kEditDisableKeyEnable | |
kEditDisableLayout | |
kEditDisableResize | |
kEditDisableWidth | |
kEditEnable | |
kIsHtmlView | |
Public Attributes inherited from TObject | |
kBitMask | |
kCanDelete | |
kCannotPick | |
kHasUUID | |
kInconsistent | |
kInvalidObject | |
kIsOnHeap | |
kIsReferenced | |
kMustCleanup | |
kNoContextMenu | |
kNotDeleted | |
kObjInCanvas | |
kOverwrite | |
kSingleKey | |
kWriteDelete | |
kZombie | |
Protected Member Functions inherited from TGFrame | |
void | DoRedraw () override |
virtual void | Draw3dRectangle (UInt_t type, Int_t x, Int_t y, UInt_t w, UInt_t h) |
TString | GetOptionString () const |
const TGResourcePool * | GetResourcePool () const |
void * | GetSender () override |
virtual void | StartGuiBuilding (Bool_t on=kTRUE) |
Protected Member Functions inherited from TGWindow | |
TGWindow (const TGWindow &tgw) | |
TGWindow (Window_t id) | |
TGWindow & | operator= (const TGWindow &tgw) |
Protected Member Functions inherited from TGObject | |
TGObject & | operator= (const TGObject &tgo) |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
void | MakeZombie () |
Protected Member Functions inherited from TQObject | |
virtual const char * | GetSenderClassName () const |
Static Protected Member Functions inherited from TGListView | |
static FontStruct_t | GetDefaultFontStruct () |
static const TGGC & | GetDefaultGC () |
Static Protected Member Functions inherited from TGFrame | |
static Time_t | GetLastClick () |
Static Protected Member Functions inherited from TQObject | |
static Int_t | CheckConnectArgs (TQObject *sender, TClass *sender_class, const char *signal, TClass *receiver_class, const char *slot) |
static TString | CompressName (const char *method_name) |
static Bool_t | ConnectToClass (const char *sender_class, const char *signal, TClass *receiver_class, void *receiver, const char *slot) |
static Bool_t | ConnectToClass (TQObject *sender, const char *signal, TClass *receiver_class, void *receiver, const char *slot) |
Protected Attributes inherited from TGListView | |
TGTextButton ** | fColHeader |
TString * | fColNames |
Int_t * | fColumns |
FontStruct_t | fFontStruct |
TGHeaderFrame * | fHeader |
Int_t * | fJmode |
Bool_t | fJustChanged |
TGDimension | fMaxSize |
UInt_t | fMinColumnSize |
Int_t | fNColumns |
GContext_t | fNormGC |
TGVFileSplitter ** | fSplitHeader |
EListViewMode | fViewMode |
Protected Attributes inherited from TGCanvas | |
TGHScrollBar * | fHScrollbar |
Int_t | fScrolling |
TGViewPort * | fVport |
TGVScrollBar * | fVScrollbar |
Protected Attributes inherited from TGFrame | |
Pixel_t | fBackground |
Int_t | fBorderWidth |
Int_t | fDNDState |
UInt_t | fEventMask |
TGFrameElement * | fFE |
UInt_t | fHeight |
UInt_t | fMaxHeight |
UInt_t | fMaxWidth |
UInt_t | fMinHeight |
UInt_t | fMinWidth |
UInt_t | fOptions |
UInt_t | fWidth |
Int_t | fX |
Int_t | fY |
kDeleteWindowCalled | |
Protected Attributes inherited from TGWindow | |
UInt_t | fEditDisabled |
TString | fName |
Bool_t | fNeedRedraw |
const TGWindow * | fParent |
Protected Attributes inherited from TGObject | |
TGClient * | fClient |
Handle_t | fId |
Protected Attributes inherited from TObject | |
kOnlyPrepStep | |
Protected Attributes inherited from TQObject | |
TList * | fListOfConnections |
TList * | fListOfSignals |
Bool_t | fSignalsBlocked |
Static Protected Attributes inherited from TGListView | |
static const TGFont * | fgDefaultFont |
static TGGC * | fgDefaultGC |
Static Protected Attributes inherited from TGFrame | |
static const TGGC * | fgBckgndGC |
static const TGGC * | fgBlackGC |
static Pixel_t | fgBlackPixel |
static Window_t | fgDbw |
static Int_t | fgDbx |
static Int_t | fgDby |
static Pixel_t | fgDefaultFrameBackground |
static Pixel_t | fgDefaultSelectedBackground |
static const TGGC * | fgHilightGC |
static Bool_t | fgInit |
static UInt_t | fgLastButton |
static Time_t | fgLastClick |
static const TGGC * | fgShadowGC |
static UInt_t | fgUserColor |
static const TGGC * | fgWhiteGC |
static Pixel_t | fgWhitePixel |
Static Protected Attributes inherited from TGWindow | |
static Int_t | fgCounter |
Static Protected Attributes inherited from TQObject | |
static Bool_t | fgAllSignalsBlocked |
KVListView::KVListView | ( | TClass * | obj_class, |
const TGWindow * | p, | ||
UInt_t | w, | ||
UInt_t | h, | ||
UInt_t | options = kSunkenFrame | kDoubleBorder , |
||
Pixel_t | back = GetDefaultFrameBackground() |
||
) |
Create list view widget for objects of class obj_class. A KVLVContainer object is also created and set as the container in use. The view mode is set to kLVDetails (only one possible, no icons) Scrolling increments are set to 1 (vertical) & 19 (horizontal)
Definition at line 24 of file KVListView.cpp.
|
inlinevirtual |
Definition at line 157 of file KVListView.h.
|
inline |
Definition at line 227 of file KVListView.h.
|
inline |
Definition at line 215 of file KVListView.h.
|
inline |
Definition at line 223 of file KVListView.h.
|
inline |
Definition at line 219 of file KVListView.h.
Definition at line 199 of file KVListView.h.
|
virtual |
Connects the column header buttons (if defined) to the container's Sort(const Char_t*) method. Each button, when pressed, sends a "Clicked" signal which activates "Sort" with the name of the button/column as argument.
Definition at line 72 of file KVListView.cpp.
The global context menu status (allowed or not allowed) is set by AllowContextMenu(). If required, this can be overridden for specific classes by calling this method for each required class. In this case, any objects in the list of precisely this class (not derived classes) will have the opposite behaviour to that defined by AllowContextMenu(), i.e. if context menus are globally disabled, this method defines the classes for which a context menu is authorised, and vice-versa.
Definition at line 235 of file KVListView.cpp.
Deprecated: use AllowDoubleClick()
Definition at line 278 of file KVListView.h.
Call with on=kFALSE to disable objects' context menus opening with mouse right-click
Definition at line 283 of file KVListView.h.
Call with on=kFALSE to disable objects' Browse() method being called with mouse double-click
Definition at line 272 of file KVListView.h.
Definition at line 291 of file KVListView.h.
|
inlinevirtual |
Definition at line 173 of file KVListView.h.
|
inline |
Definition at line 203 of file KVListView.h.
Definition at line 211 of file KVListView.h.
Definition at line 207 of file KVListView.h.
Definition at line 195 of file KVListView.h.
Returns index of data column from its name. Return -1 if not found.
Definition at line 124 of file KVListView.cpp.
|
inlinevirtual |
Definition at line 168 of file KVListView.h.
|
inline |
return first object in currently displayed list
Definition at line 262 of file KVListView.h.
|
inline |
return last object in currently displayed list
Definition at line 267 of file KVListView.h.
|
inline |
Definition at line 235 of file KVListView.h.
|
inline |
Definition at line 231 of file KVListView.h.
|
inline |
Definition at line 295 of file KVListView.h.
|
inline |
Definition at line 302 of file KVListView.h.
|
inline |
list of selected objects (derived from TObject) in the order they were picked DO NOT DELETE!!!
Definition at line 251 of file KVListView.h.
|
inline |
list of selected KVLVEntry objects DELETE AFTER USE !!!
Definition at line 239 of file KVListView.h.
|
inline |
list of selected objects (derived from TObject) DELETE AFTER USE !!!
Definition at line 245 of file KVListView.h.
|
inline |
return list of all objects (selected or unselected) in list view
Definition at line 257 of file KVListView.h.
Handle messages generated by the list view container.
Reimplemented from TGFrame.
Definition at line 47 of file KVListView.cpp.
|
inlinevirtual |
Definition at line 190 of file KVListView.h.
|
inlinevirtual |
Definition at line 182 of file KVListView.h.
|
virtual |
Define column with index = 0, 1, ... name = name of column (shown in column header button) method = method to call to fill column with data (by default, "Getname") mode = text alignment for data in column (kTextCenterX [default], kTextLeft, kTextRight) column header name is always center aligned
Definition at line 106 of file KVListView.cpp.
Definition at line 91 of file KVListView.cpp.
|
virtual |
Set default column width of the columns headers. Limit minimum size of a column to total width / number of columns If only one column it will span the whole viewport
Reimplemented from TGListView.
Definition at line 145 of file KVListView.cpp.
void KVListView::SetDoubleClickAction | ( | const char * | receiver_class, |
void * | receiver, | ||
const char * | slot | ||
) |
Overrides the default 'double-click' action. By default, double-clicking on an object in the list will call the Browse(TBrowser*) method of the selected object. Use this method to override this behaviour. When an object is double-clicked the method 'slot' of the object 'receiver' of class 'receiver_class' will be called. The method in question must have the signature receiver_class::slot(TObject*) The address of the selected (T)object is passed as argument.
Definition at line 210 of file KVListView.cpp.
Definition at line 161 of file KVListView.h.
Definition at line 306 of file KVListView.h.
If list contains KVBase-derived objects, calling this method with yes=kTRUE will cause the string returned by the objects' KVBase::GetLabel() method to be used as the class name of the object
Definition at line 189 of file KVListView.cpp.
Sort list according to data in given column (=0, 1, ...)
Definition at line 177 of file KVListView.h.
|
inlinevirtual |
Definition at line 186 of file KVListView.h.
|
private |
Definition at line 151 of file KVListView.h.
|
private |
maximum width of columns
Definition at line 150 of file KVListView.h.
|
private |
class of objects in list
Definition at line 149 of file KVListView.h.
|
private |
number of selected items
Definition at line 148 of file KVListView.h.