JG ROOT Tools libraries  version 5.0 - august 2014
RGListRequester.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file RGListRequester.hh
3  *
4  * Include file for class RGListRequester
5  */
6 //======================================================================
7 
8 #ifndef RG_LIST_REQUESTER_HH
9 #define RG_LIST_REQUESTER_HH
10 
11 #include "RGBaseRequester.hh"
12 #include "RGItemListBox.hh"
13 #include "RDico.hh"
14 
15 
16 /*! New options for RGListRequester.*/
18 {
19  rgReqNoDoubleClick = 0x00010000 // inhibit double-click
20 };
21 
22 //======================================================================
23 /*! class RGListRequester
24  *
25  * Request for a selection in a list of elements, presented with a
26  * text name.
27  *
28  * Depending on the constructor, the request returns (\b N beeing the
29  * number of entries):
30  * - the close button and an array of \b N logic values indicating whether
31  * elements are selected or not (multiple selection);
32  * - the close button and a result between 0 and \b N-1 of the selected
33  * element (single selection), or -1 if no element is selected;
34  * - a result between 0 and \b N-1 of the selected element (single selection),
35  * or -1 if no element is selected.
36  *
37  * According to the case, the returned value in case of cancellation may
38  * be modified.
39  *
40  * Specific options:
41  * - \b rgReqNoDoubleClick inhibits the single selection double-click
42  *
43  * \note
44  * a double-click causes the first button click.
45  */
47 {
48  //------------------------------------------------------------
49  /*! \object_doc{RGListRequester} */
51  //------------------------------------------------------------
52 
53  protected:
54 
55 #ifndef __MAKECINT__
56  int * select_adr; ///< Pointer on selection result (single selection)
57  bool * select_table; ///< Array of selection values (multiple selection)
58 
59  int selected; ///< Selected element (last)
60  bool select_multi; ///< Multiple selection flag
61 
62  const string *items_list; ///< Array of list elements names
63  int items_number; ///< Number of elements
64  int max_visible; ///< Display: number of visible elements
65 
66  UInt_t list_width; ///< List width
67  UInt_t list_height; ///< List height
68 #endif
69 
70  // widgets
71  RGItemListBox * w_select_list; ///< Selection list widget
72 
73 
74  //------------------------------------------------------------
75  // Constructors / affectation / destructor
76  public:
77  // Button value return and selection array (multiple)
78  RGListRequester ( const TGWindow * parent,
79  const TGWindow * main,
80  const string items[],
81  const u_int items_num,
82  int & result,
83  bool *& table,
84  const char * title,
85  const char * buttons = rDico.brq_ok_cancel.c_str(),
86  const ULong_t opts = 0,
87  const int & display = 0,
88  const bool auto_start = true);
89 
90  // Button value return and selection value (single)
91  RGListRequester ( const TGWindow * parent,
92  const TGWindow * main,
93  const string items[],
94  const u_int items_num,
95  int & result,
96  int & selection,
97  const char * title,
98  const char * buttons = rDico.brq_ok_cancel.c_str(),
99  const ULong_t opts = 0,
100  const int & display = 0,
101  const bool auto_start = true);
102 
103  // Selection value (single)
104  RGListRequester ( const TGWindow * parent,
105  const TGWindow * main,
106  const string items[],
107  const u_int items_num,
108  int & selection,
109  const char * title,
110  const char * buttons = rDico.brq_ok_cancel.c_str(),
111  const ULong_t opts = 0,
112  const int & display = 0,
113  const bool auto_start = true);
114 
115  // Constructor for derived classes: no return
116  RGListRequester ( const TGWindow * parent,
117  const TGWindow * main,
118  const string * items,
119  const u_int items_num,
120  const char * title,
121  const char * buttons = rDico.brq_ok_cancel.c_str(),
122  const ULong_t opts = 0,
123  const int & display = 0,
124  const bool multi = false );
125 
126  private:
127  RGListRequester ( const RGListRequester & req );
128 
129  public:
130  virtual ~RGListRequester();
131 
132  //------------------------------------------------------------
133  // Construction
134  virtual void Construct ( );
135  virtual void MapRequester ( );
136 
137  // Execution
138  //virtual void Request ( );
139 
140  virtual void ItemSelected ( Int_t n );
141  virtual void DoubleClicked ( Int_t n );
142 
143  //------------------------------------------------------------
144  // Slots
145  virtual void ProcessButton ( Int_t n );
146 
147  //------------------------------------------------------------
148  /*! For ROOT dictionary.*/
150 };
151 
152 
153 //======================================================================
154 #endif
155 
Definition: RGBaseRequester.hh:91
Definition: RGItemListBox.hh:123
bool * select_table
Array of selection values (multiple selection)
Definition: RGListRequester.hh:57
RGListRequestOptions
Definition: RGListRequester.hh:17
GObject(RGListRequester)
RGItemListBox * w_select_list
Selection list widget.
Definition: RGListRequester.hh:71
virtual void DoubleClicked(Int_t n)
Definition: RGListRequester.cpp:404
virtual void ProcessButton(Int_t n)
Definition: RGListRequester.cpp:424
virtual ~RGListRequester()
Definition: RGListRequester.cpp:257
string brq_ok_cancel
Button texts.
Definition: RDico.hh:189
const string * items_list
Array of list elements names.
Definition: RGListRequester.hh:62
Definition: RGListRequester.hh:46
RGListRequester(const TGWindow *parent, const TGWindow *main, const string items[], const u_int items_num, int &result, bool *&table, const char *title, const char *buttons=rDico.brq_ok_cancel.c_str(), const ULong_t opts=0, const int &display=0, const bool auto_start=true)
Definition: RGListRequester.cpp:36
int selected
Selected element (last)
Definition: RGListRequester.hh:59
virtual void Construct()
Definition: RGListRequester.cpp:266
ClassDef(RGListRequester, 0)
virtual void MapRequester()
Definition: RGListRequester.cpp:349
UInt_t list_width
List width.
Definition: RGListRequester.hh:66
RDico & rDico
! Unique instance of the dictionary class
Definition: RDico.cpp:12
UInt_t list_height
List height.
Definition: RGListRequester.hh:67
int items_number
Number of elements.
Definition: RGListRequester.hh:63
bool select_multi
Multiple selection flag.
Definition: RGListRequester.hh:60
int * select_adr
Pointer on selection result (single selection)
Definition: RGListRequester.hh:56
int max_visible
Display: number of visible elements.
Definition: RGListRequester.hh:64
virtual void ItemSelected(Int_t n)
Definition: RGListRequester.cpp:393