KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVNameValueListGUI Class Reference

Detailed Description

GUI for setting KVNameValueList parameters.

Created by KVClassFactory on Fri Feb 17 09:32:40 2017 Author: John Frankland,,,

This is a lightweight transient dialog box which can be used to set an arbitrary list of parameters. The parameters are contained in a KVNameValueList. To use, do:

KVNameValueList params{{"FixLimits?",false}, {"Min",0.0}, {"Max",100.0}};
bool cancel_pressed{false};
auto param_gui = new KVNameValueListGUI(nullptr, &params, &cancel_pressed);
param_gui->DisplayDialog();
if(!cancel_pressed)
{
params.Print();
}
GUI for setting KVNameValueList parameters.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.

[Note that this example is for stand-alone use of the GUI. The first argument to the constructor is usually the TGMainFrame of your GUI application]

If the user presses 'Cancel', the original values of the parameters are restored.

Boolean parameters can be used to 'enable' other parameters in the GUI, i.e. with the previous example, if you do:

param_gui->EnableDependingOnBool("Min","FixLimits?");
param_gui->EnableDependingOnBool("Max","FixLimits?");
param_gui->DisplayDialog();

then the "Min" and "Max" input widgets in the GUI will only be enabled when the "FixLimits?" parameter is true, and will be en/disabled when the check box for this parameter is checked/unchecked.

Definition at line 55 of file KVNameValueListGUI.h.

#include <KVNameValueListGUI.h>

Inheritance diagram for KVNameValueListGUI:

Public Member Functions

 KVNameValueListGUI (const TGWindow *main, KVNameValueList *params, Bool_t *cancel_pressed, Bool_t wait_for_main=kTRUE)
 Constructor.
 
virtual ~KVNameValueListGUI ()
 Destructor.
 
 ClassDef (KVNameValueListGUI, 1) void DisplayDialog()
 
void CloseWindow ()
 
void DoClose ()
 
bool EnableDependingOnBool (const TString &value_to_enable, const TString &bool_parameter)
 
void ReadData ()
 
void RestoreData ()
 return all values to original state
 

Private Member Functions

virtual TObjectAddABool (Int_t i, TGHorizontalFrame *hf)
 
virtual TObjectAddADouble (Int_t i, TGHorizontalFrame *hf)
 
virtual TObjectAddAInt (Int_t i, TGHorizontalFrame *hf)
 
virtual TObjectAddAString (Int_t i, TGHorizontalFrame *hf)
 
TObjectGetDataWidget (const TString &parname) const
 
TObjectGetDataWidget (int i) const
 
KVNameValueListGetList () const
 
TGTransientFrameGetMain () const
 

Private Attributes

Bool_tfCancel
 
TGTextButtonfCancelBut
 Cancel button.
 
TObjArray fData
 
UInt_t fHeight
 
TGTransientFramefMain
 
Bool_tfOK
 set to kTRUE if OK button is pressed
 
TGTextButtonfOKBut
 OK button.
 
KVNameValueList fOriginal
 
Bool_t fWaitForMain
 
UInt_t fWidth
 
UInt_t max_width
 
KVNameValueListtheList
 

Constructor & Destructor Documentation

◆ KVNameValueListGUI()

KVNameValueListGUI::KVNameValueListGUI ( const TGWindow main,
KVNameValueList params,
Bool_t cancel_pressed,
Bool_t  wait_for_main = kTRUE 
)

Constructor.

Definition at line 138 of file KVNameValueListGUI.cpp.

◆ ~KVNameValueListGUI()

KVNameValueListGUI::~KVNameValueListGUI ( )
virtual

Destructor.

Definition at line 213 of file KVNameValueListGUI.cpp.

Member Function Documentation

◆ AddABool()

TObject * KVNameValueListGUI::AddABool ( Int_t  i,
TGHorizontalFrame hf 
)
privatevirtual

Definition at line 30 of file KVNameValueListGUI.cpp.

◆ AddADouble()

TObject * KVNameValueListGUI::AddADouble ( Int_t  i,
TGHorizontalFrame hf 
)
privatevirtual

Definition at line 43 of file KVNameValueListGUI.cpp.

◆ AddAInt()

TObject * KVNameValueListGUI::AddAInt ( Int_t  i,
TGHorizontalFrame hf 
)
privatevirtual

Definition at line 59 of file KVNameValueListGUI.cpp.

◆ AddAString()

TObject * KVNameValueListGUI::AddAString ( Int_t  i,
TGHorizontalFrame hf 
)
privatevirtual

Definition at line 17 of file KVNameValueListGUI.cpp.

◆ ClassDef()

KVNameValueListGUI::ClassDef ( KVNameValueListGUI  ,
 
)

◆ CloseWindow()

void KVNameValueListGUI::CloseWindow ( )

Definition at line 237 of file KVNameValueListGUI.cpp.

◆ DoClose()

void KVNameValueListGUI::DoClose ( )

Definition at line 227 of file KVNameValueListGUI.cpp.

◆ EnableDependingOnBool()

bool KVNameValueListGUI::EnableDependingOnBool ( const TString value_to_enable,
const TString bool_parameter 
)

If the list of parameters contains a boolean variable with name bool_parameter, one or more of the widgets (number entry field, text entry field, etc.) can be disabled or enabled depending on the boolean state.

if bool_parameter is not the name of a boolean in the list, or value_to_enable cannot be found in the list, returns false. otherwise, returns true in case of success.

Definition at line 252 of file KVNameValueListGUI.cpp.

◆ GetDataWidget() [1/2]

TObject * KVNameValueListGUI::GetDataWidget ( const TString parname) const
inlineprivate

Return pointer to widget corresponding to named parameter in list

Definition at line 90 of file KVNameValueListGUI.h.

◆ GetDataWidget() [2/2]

TObject * KVNameValueListGUI::GetDataWidget ( int  i) const
inlineprivate

Definition at line 78 of file KVNameValueListGUI.h.

◆ GetList()

KVNameValueList * KVNameValueListGUI::GetList ( ) const
inlineprivate

Definition at line 82 of file KVNameValueListGUI.h.

◆ GetMain()

TGTransientFrame * KVNameValueListGUI::GetMain ( ) const
inlineprivate

Definition at line 86 of file KVNameValueListGUI.h.

◆ ReadData()

void KVNameValueListGUI::ReadData ( )

Definition at line 77 of file KVNameValueListGUI.cpp.

◆ RestoreData()

void KVNameValueListGUI::RestoreData ( )

return all values to original state

Definition at line 101 of file KVNameValueListGUI.cpp.

Member Data Documentation

◆ fCancel

Bool_t* KVNameValueListGUI::fCancel
private

Definition at line 69 of file KVNameValueListGUI.h.

◆ fCancelBut

TGTextButton* KVNameValueListGUI::fCancelBut
private

Cancel button.

Definition at line 63 of file KVNameValueListGUI.h.

◆ fData

TObjArray KVNameValueListGUI::fData
private

Definition at line 67 of file KVNameValueListGUI.h.

◆ fHeight

UInt_t KVNameValueListGUI::fHeight
private

Definition at line 66 of file KVNameValueListGUI.h.

◆ fMain

TGTransientFrame* KVNameValueListGUI::fMain
private

Definition at line 61 of file KVNameValueListGUI.h.

◆ fOK

Bool_t* KVNameValueListGUI::fOK
private

set to kTRUE if OK button is pressed

Definition at line 64 of file KVNameValueListGUI.h.

◆ fOKBut

TGTextButton* KVNameValueListGUI::fOKBut
private

OK button.

Definition at line 62 of file KVNameValueListGUI.h.

◆ fOriginal

KVNameValueList KVNameValueListGUI::fOriginal
private

Definition at line 59 of file KVNameValueListGUI.h.

◆ fWaitForMain

Bool_t KVNameValueListGUI::fWaitForMain
private

Definition at line 70 of file KVNameValueListGUI.h.

◆ fWidth

UInt_t KVNameValueListGUI::fWidth
private

Definition at line 66 of file KVNameValueListGUI.h.

◆ max_width

UInt_t KVNameValueListGUI::max_width
private

Definition at line 65 of file KVNameValueListGUI.h.

◆ theList

KVNameValueList* KVNameValueListGUI::theList
private

Definition at line 58 of file KVNameValueListGUI.h.