JG ROOT Tools libraries  version 5.0 - august 2014
RGHistoPlotAttrSelect.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file RGHistoPlotAttrSelect.hh
3  *
4  * Include file for class RGHistoPlotAttrSelect
5  */
6 //======================================================================
7 
8 #ifndef RG_HISTO_PLOT_ATTR_SELECT_HH
9 #define RG_HISTO_PLOT_ATTR_SELECT_HH
10 
11 // ROOT include files
12 #include <TGLabel.h>
13 #include <TH1.h>
14 
15 // widgets include file
16 #include "RGLineAttrSelect.hh"
17 #include "RGFillAttrSelect.hh"
18 #include "RGMarkerAttrSelect.hh"
19 #include "RGHistoPlotModeSelect.hh"
20 
21 ///! RGHistoPlotAttrSelect widget options
23 {
24  rgHPASHisto2D = 0x00000001,
25  rgHPASHisto3D = 0x00000002,
26 
27  // suppression des modes 2D/3D
28  rgHPASNo2DView = 0x00000010,
29  rgHPASNo3DView = 0x00000020,
30  rgHPASAngles3D = 0x00000100,
31 
32  // options des widgets
33  rgHPASGroupLayout = 0x00001000,
34  rgHPASNoLabel = 0x00002000,
35  rgHPASExpandColorNumber = 0x00004000
36 };
37 
38 
39 //======================================================================
40 /*! class RGHistoPlotAttrSelect
41  *
42  * Widget for histogram plot attributes selection.
43  *
44  * Options:
45  * - \b rgHPASGroupLayout: use group frames instead of lines with labels
46  * - \b rgHPASNoLabel: no labels
47  * - \b rgHPASHisto2D: select attributes for 2D histograms (default is 1D)
48  * - \b rgHPASHisto3D: select attributes for 3D histograms (default is 1D)
49  * - \b rgHPASAngles3D: display angles widgets for 3D views
50  * - \b rgHPASExpandColorNumber: color widget is expandable, instead of
51  * fill widget (default)
52  *
53  * See versions of the widgets for 1D and 2D (with 3D angles) histograms,
54  * in the compact version:
55  *
56  * 1D: \image html RGHistoPlotAttrSelect_1D.gif
57  *
58  * 2D: \image html RGHistoPlotAttrSelect_2D-ang.gif
59  *
60  * The same widgets in the group version:
61  *
62  * 1D: \image html RGHistoPlotAttrSelect_1D-group.gif
63  *
64  * 2D: \image html RGHistoPlotAttrSelect_2D-group.gif
65  */
66 class RGHistoPlotAttrSelect : public TGVerticalFrame
67 {
68  //------------------------------------------------------------
69  /*! \object_doc{RGHistoPlotAttrSelect} */
71  //------------------------------------------------------------
72 
73  protected:
74  UInt_t options; ///< Options
75  Int_t plot_mode; ///< Initial plot mode
76 
77  TAttLine att_line; ///< Initial line attributes
78  TAttFill att_fill; ///< Initial fill attributes
79  TAttMarker att_marker; ///< Initial marker attributes
80 
81  Double_t angle_theta; ///< 3D view angle
82  Double_t angle_phi; ///< 3D view angle
83 
84  // widgets
85  bool inhibit_slot; ///< Flag to inhibit slots (TGNumberEntry)
86 
87  RGLineAttrSelect * w_line_select; ///< Selection
88  RGFillAttrSelect * w_fill_select; ///< Selection
90 
91  TGCompositeFrame * w_mode_frame; ///< Mode frame
92  RGHistoPlotModeSelect * w_mode_select; ///< Selection widget
93  TGHorizontalFrame * w_angles_frame; ///< Angles frame
94  TGNumberEntry * w_theta_entry; ///< Theta angle widget
95  TGNumberEntry * w_phi_entry; ///< Phi angle widget
96 
97  //------------------------------------------------------------
98  // Constructors / affectation / destructor
99  public:
100  RGHistoPlotAttrSelect ( TGWindow * p = NULL,
101  const Int_t mode = 0,
102  TAttLine l = TAttLine(1,1,1),
103  TAttFill f = TAttFill(1,0),
104  TAttMarker m = TAttMarker(1,20,1.),
105  UInt_t opt = 0 );
106 
107 
108  private:
109  RGHistoPlotAttrSelect ( const RGHistoPlotAttrSelect &original );
110 
111  public:
112  virtual ~RGHistoPlotAttrSelect ( );
113 
114  //------------------------------------------------------------
115  protected:
116  virtual void InitModes ( );
117  virtual void Construct ( );
118  virtual void ConstructDefault ( );
119  virtual void ConstructGroups ( );
120 
121  public:
122  virtual void MapSubwindows ( );
123 
124  //------------------------------------------------------------
125  // Functions
126  virtual Int_t DrawHisto ( TH1 * hptr, const string &add_opts = "", TPad * padptr = NULL ) const;
127  virtual Int_t DrawHistoCopy ( TH1 * hptr, const string &add_opts = "", TPad * padptr = NULL ) const;
128  virtual Int_t DrawHistoNormalized ( TH1 * hptr, const Double_t norm, const string &add_opts = "", TPad * padptr = NULL ) const;
129  virtual void SetState ( const Bool_t b = kTRUE );
130 
131  virtual RGLineAttrSelect * GetLineAttrSelectWidget ( ) const; // inline
132  virtual RGFillAttrSelect * GetFillAttrSelectWidget ( ) const; // inline
133  virtual RGMarkerAttrSelect * GetMarkerAttrSelectWidget ( ) const; // inline
134 
135  virtual void ChangeDimension ( const Int_t dim );
136 
137 
138  virtual void SetLineAttr ( const TAttLine &att, const Bool_t emit = kTRUE );
139  virtual void SetFillAttr ( const TAttFill &att, const Bool_t emit = kTRUE );
140  virtual void SetMarkerAttr ( const TAttMarker &att, const Bool_t emit = kTRUE );
141  virtual void SetPlotMode ( const Int_t mode, const Bool_t emit = kTRUE );
142  virtual void SetAngles ( const Double_t theta, const Double_t phi, const Bool_t emit = kTRUE );
143 
144  virtual TAttLine GetLineAttr ( ) const; // inline
145  virtual TAttFill GetFillAttr ( ) const; // inline
146  virtual TAttMarker GetMarkerAttr ( ) const; // inline
147  virtual Double_t GetTheta ( ) const; // inline
148  virtual Double_t GetPhi ( ) const; // inline
149  virtual Int_t GetPlotMode ( ) const; // inline
150  virtual string GetPlotOption ( ) const; // inline
151  static string GetPlotOption ( const Int_t dim, const Int_t mode ); // inline
152 
153  virtual void SetAttributes ( const TH1 *h, const Bool_t emit = kTRUE );
154  virtual void AttrToHisto ( TH1 *h ) const;
155 
156  //------------------------------------------------------------
157  // Slots
158  virtual void ModeSelectionUpdate ( Int_t sel );
159  virtual void AnglesValueChanged ( );
160 
161  //------------------------------------------------------------
162  // Signals
163  virtual void LineChanged ( ); // *SIGNAL*
164  virtual void FillChanged ( ); // *SIGNAL*
165  virtual void MarkerChanged ( ); // *SIGNAL*
166  virtual void ModeSelected ( Int_t m ); // *SIGNAL*
167  virtual void AnglesChanged ( ); // *SIGNAL*
168 
169  //------------------------------------------------------------
170  /*! For ROOT dictionary.*/
172 };
173 
174 //----------------------------------------------------------------------
175 // Inline functions
177 
178 //======================================================================
179 #endif
180 
virtual void SetPlotMode(const Int_t mode, const Bool_t emit=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:489
RGMarkerAttrSelect * w_marker_select
Selection.
Definition: RGHistoPlotAttrSelect.hh:89
virtual void ConstructDefault()
Definition: RGHistoPlotAttrSelect.cpp:166
virtual void MarkerChanged()
Definition: RGHistoPlotAttrSelect.icc:97
virtual void ModeSelected(Int_t m)
Definition: RGHistoPlotAttrSelect.icc:101
Double_t angle_phi
3D view angle
Definition: RGHistoPlotAttrSelect.hh:82
TGNumberEntry * w_theta_entry
Theta angle widget.
Definition: RGHistoPlotAttrSelect.hh:94
virtual RGLineAttrSelect * GetLineAttrSelectWidget() const
Definition: RGHistoPlotAttrSelect.icc:11
virtual void MapSubwindows()
Definition: RGHistoPlotAttrSelect.cpp:392
virtual Int_t DrawHistoCopy(TH1 *hptr, const string &add_opts="", TPad *padptr=NULL) const
Definition: RGHistoPlotAttrSelect.icc:72
virtual void Construct()
Definition: RGHistoPlotAttrSelect.cpp:97
virtual void ConstructGroups()
Definition: RGHistoPlotAttrSelect.cpp:288
virtual void InitModes()
Definition: RGHistoPlotAttrSelect.cpp:75
Definition: RGMarkerAttrSelect.hh:41
virtual void SetAngles(const Double_t theta, const Double_t phi, const Bool_t emit=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:502
TAttLine att_line
Initial line attributes.
Definition: RGHistoPlotAttrSelect.hh:77
Int_t plot_mode
Initial plot mode.
Definition: RGHistoPlotAttrSelect.hh:75
bool inhibit_slot
Flag to inhibit slots (TGNumberEntry)
Definition: RGHistoPlotAttrSelect.hh:85
virtual void SetFillAttr(const TAttFill &att, const Bool_t emit=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:460
virtual void ChangeDimension(const Int_t dim)
Definition: RGHistoPlotAttrSelect.cpp:86
virtual void AttrToHisto(TH1 *h) const
Definition: RGHistoPlotAttrSelect.cpp:538
virtual void ModeSelectionUpdate(Int_t sel)
Definition: RGHistoPlotAttrSelect.cpp:557
Definition: RGHistoPlotModeSelect.hh:82
RGLineAttrSelect * w_line_select
Selection.
Definition: RGHistoPlotAttrSelect.hh:87
virtual void LineChanged()
Definition: RGHistoPlotAttrSelect.icc:89
virtual Int_t DrawHistoNormalized(TH1 *hptr, const Double_t norm, const string &add_opts="", TPad *padptr=NULL) const
Definition: RGHistoPlotAttrSelect.icc:82
virtual string GetPlotOption() const
Definition: RGHistoPlotAttrSelect.icc:49
TGNumberEntry * w_phi_entry
Phi angle widget.
Definition: RGHistoPlotAttrSelect.hh:95
virtual void SetAttributes(const TH1 *h, const Bool_t emit=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:523
ClassDef(RGHistoPlotAttrSelect, 0)
virtual TAttMarker GetMarkerAttr() const
Definition: RGHistoPlotAttrSelect.icc:33
virtual RGMarkerAttrSelect * GetMarkerAttrSelectWidget() const
Definition: RGHistoPlotAttrSelect.icc:19
TAttMarker att_marker
Initial marker attributes.
Definition: RGHistoPlotAttrSelect.hh:79
RGHistoPlotAttrSelectOptions
! RGHistoPlotAttrSelect widget options
Definition: RGHistoPlotAttrSelect.hh:22
virtual Double_t GetTheta() const
Definition: RGHistoPlotAttrSelect.icc:41
Double_t angle_theta
3D view angle
Definition: RGHistoPlotAttrSelect.hh:81
GObject(RGHistoPlotAttrSelect)
virtual TAttFill GetFillAttr() const
Definition: RGHistoPlotAttrSelect.icc:29
UInt_t options
Options.
Definition: RGHistoPlotAttrSelect.hh:74
virtual TAttLine GetLineAttr() const
Definition: RGHistoPlotAttrSelect.icc:25
virtual void AnglesChanged()
Definition: RGHistoPlotAttrSelect.icc:105
virtual Double_t GetPhi() const
Definition: RGHistoPlotAttrSelect.icc:45
virtual void SetState(const Bool_t b=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:412
virtual void FillChanged()
Definition: RGHistoPlotAttrSelect.icc:93
TGCompositeFrame * w_mode_frame
Mode frame.
Definition: RGHistoPlotAttrSelect.hh:91
virtual void AnglesValueChanged()
Definition: RGHistoPlotAttrSelect.cpp:594
virtual void SetLineAttr(const TAttLine &att, const Bool_t emit=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:445
virtual ~RGHistoPlotAttrSelect()
Definition: RGHistoPlotAttrSelect.cpp:66
RGFillAttrSelect * w_fill_select
Selection.
Definition: RGHistoPlotAttrSelect.hh:88
Definition: RGLineAttrSelect.hh:42
virtual RGFillAttrSelect * GetFillAttrSelectWidget() const
Definition: RGHistoPlotAttrSelect.icc:15
RGHistoPlotAttrSelect(TGWindow *p=NULL, const Int_t mode=0, TAttLine l=TAttLine(1, 1, 1), TAttFill f=TAttFill(1, 0), TAttMarker m=TAttMarker(1, 20, 1.), UInt_t opt=0)
Definition: RGHistoPlotAttrSelect.cpp:24
TGHorizontalFrame * w_angles_frame
Angles frame.
Definition: RGHistoPlotAttrSelect.hh:93
Definition: RGHistoPlotAttrSelect.hh:66
virtual void SetMarkerAttr(const TAttMarker &att, const Bool_t emit=kTRUE)
Definition: RGHistoPlotAttrSelect.cpp:474
TAttFill att_fill
Initial fill attributes.
Definition: RGHistoPlotAttrSelect.hh:78
RGHistoPlotModeSelect * w_mode_select
Selection widget.
Definition: RGHistoPlotAttrSelect.hh:92
virtual Int_t DrawHisto(TH1 *hptr, const string &add_opts="", TPad *padptr=NULL) const
Definition: RGHistoPlotAttrSelect.icc:64
virtual Int_t GetPlotMode() const
Definition: RGHistoPlotAttrSelect.icc:37
Definition: RGFillAttrSelect.hh:43