KaliVeda
1.12/06
Heavy-Ion Analysis Toolkit
|
Enhanced version of ROOT TGListView widget.
Created by KVClassFactory on Wed Apr 9 11:51:38 2008 Author: franklan
http://indra.in2p3.fr/KaliVedaDoc/images/KVLVContainer.png
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 145 of file KVListView.h.
Additional Inherited Members | |
![]() | |
enum | EEditMode |
enum | EStatusBits |
![]() | |
enum | EDeprecatedStatusBits |
enum | EStatusBits |
![]() | |
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 Int_t | GetCounter () |
![]() | |
static Longptr_t | GetDtorOnly () |
static Bool_t | GetObjectStat () |
static void | SetDtorOnly (void *obj) |
static void | SetObjectStat (Bool_t stat) |
![]() | |
static Bool_t | AreAllSignalsBlocked () |
static Bool_t | BlockAllSignals (Bool_t b) |
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 Bool_t | Disconnect (const char *class_name, const char *signal, void *receiver=0, const char *slot=0) |
static Bool_t | Disconnect (TQObject *sender, const char *signal=0, void *receiver=0, const char *slot=0) |
![]() | |
kCanvasNoScroll | |
kCanvasScrollBoth | |
kCanvasScrollHorizontal | |
kCanvasScrollVertical | |
![]() | |
kEditDisable | |
kEditDisableBtnEnable | |
kEditDisableEvents | |
kEditDisableGrab | |
kEditDisableHeight | |
kEditDisableKeyEnable | |
kEditDisableLayout | |
kEditDisableResize | |
kEditDisableWidth | |
kEditEnable | |
kIsHtmlView | |
![]() | |
kBitMask | |
kCanDelete | |
kCannotPick | |
kHasUUID | |
kInconsistent | |
kInvalidObject | |
kIsOnHeap | |
kIsReferenced | |
kMustCleanup | |
kNoContextMenu | |
kNotDeleted | |
kObjInCanvas | |
kOverwrite | |
kSingleKey | |
kWriteDelete | |
kZombie | |
![]() | |
virtual void | DoRedraw () |
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 |
virtual void * | GetSender () |
virtual void | StartGuiBuilding (Bool_t on=kTRUE) |
![]() | |
TGWindow (const TGWindow &tgw) | |
TGWindow (Window_t id) | |
TGWindow & | operator= (const TGWindow &tgw) |
![]() | |
TGObject & | operator= (const TGObject &tgo) |
![]() | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
void | MakeZombie () |
![]() | |
virtual const char * | GetSenderClassName () const |
![]() | |
static FontStruct_t | GetDefaultFontStruct () |
static const TGGC & | GetDefaultGC () |
![]() | |
static Time_t | GetLastClick () |
![]() | |
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) |
![]() | |
static const TGFont * | fgDefaultFont |
static TGGC * | fgDefaultGC |
![]() | |
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 Int_t | fgCounter |
![]() | |
static Bool_t | fgAllSignalsBlocked |
#include <KVListView.h>
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 156 of file KVListView.h.
|
inline |
Definition at line 226 of file KVListView.h.
|
inline |
Definition at line 214 of file KVListView.h.
|
inline |
Definition at line 222 of file KVListView.h.
|
inline |
Definition at line 218 of file KVListView.h.
Definition at line 198 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 277 of file KVListView.h.
Call with on=kFALSE to disable objects' context menus opening with mouse right-click
Definition at line 282 of file KVListView.h.
Call with on=kFALSE to disable objects' Browse() method being called with mouse double-click
Definition at line 271 of file KVListView.h.
Definition at line 290 of file KVListView.h.
|
inlinevirtual |
Definition at line 172 of file KVListView.h.
|
inline |
Definition at line 202 of file KVListView.h.
Definition at line 210 of file KVListView.h.
Definition at line 206 of file KVListView.h.
Definition at line 194 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 167 of file KVListView.h.
|
inline |
return first object in currently displayed list
Definition at line 261 of file KVListView.h.
|
inline |
return last object in currently displayed list
Definition at line 266 of file KVListView.h.
|
inline |
Definition at line 234 of file KVListView.h.
|
inline |
Definition at line 230 of file KVListView.h.
|
inline |
Definition at line 294 of file KVListView.h.
|
inline |
Definition at line 301 of file KVListView.h.
|
inline |
list of selected objects (derived from TObject) in the order they were picked DO NOT DELETE!!!
Definition at line 250 of file KVListView.h.
|
inline |
list of selected KVLVEntry objects DELETE AFTER USE !!!
Definition at line 238 of file KVListView.h.
|
inline |
list of selected objects (derived from TObject) DELETE AFTER USE !!!
Definition at line 244 of file KVListView.h.
|
inline |
return list of all objects (selected or unselected) in list view
Definition at line 256 of file KVListView.h.
Handle messages generated by the list view container.
Reimplemented from TGListView.
Definition at line 47 of file KVListView.cpp.
|
inlinevirtual |
Definition at line 189 of file KVListView.h.
Definition at line 181 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 160 of file KVListView.h.
Definition at line 305 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 176 of file KVListView.h.
|
inlinevirtual |
Definition at line 185 of file KVListView.h.
|
protected |
Definition at line 150 of file KVListView.h.
|
protected |
maximum width of columns
Definition at line 149 of file KVListView.h.
|
protected |
class of objects in list
Definition at line 148 of file KVListView.h.
|
protected |
number of selected items
Definition at line 147 of file KVListView.h.