ROOT logo
// @(#)root/ged:$Id: TH2Editor.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Carsten Hof 08/08/04

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TH2Editor
#define ROOT_TH2Editor

//////////////////////////////////////////////////////////////////////////
//                                                                      //
//  TH2Editor                                                           //
//                                                                      //
//  Editor changing histogram attributes                                //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGedFrame
#include "TGedFrame.h"
#endif

class TH2;
class TGComboBox;
class TGLabel;
class TGTextEntry;
class TGCheckButton;
class TString;
class TGDoubleHSlider;
class TGHSlider;
class TGNumberEntry;
class TGHButtonGroup;
class TGRadioButton;
class TGNumberEntryField;
class TGColorSelect;
class TGedPatternSelect;
class TGTextButton;

class TH2Editor : public TGedFrame {

protected:
   TH2                 *fHist;            // histogram object
   TGCompositeFrame    *fBin;             // Contains the Binning Widgets
   TGCompositeFrame    *fFit;             // Contains the Fitting Widgets
   TGTextEntry         *fTitle;           // histogram title input field
   TGComboBox          *fTypeCombo;       // histogram type combo box
   TGComboBox          *fCoordsCombo;     // Coordinate System combo box
   TGComboBox          *fContCombo;       // Contour selecting combo box
   TGLabel             *fColContLbl;      // No. of Contours Label 1
   TGLabel             *fColContLbl1;     // No. of Contours Label 2
   Int_t                fTitlePrec;       // font precision level
   TGHButtonGroup      *fDimGroup;        // Radiobuttongroup to change 2D <-> 3D-Plot
   TGRadioButton       *fDim;             // 2D-Plot RadioButton
   TGRadioButton       *fDim0;            // 3D-Plot RadioButton
   TGLayoutHints       *fDimlh;           // layout hints for 2D-Plot RadioButton
   TGLayoutHints       *fDim0lh;          // layout hints for 3D-Plot RadioButton
   TGCompositeFrame    *f6;               // Frame that contains the 2D CheckBox DrawOptions
   TGCompositeFrame    *f9;               // Frame that contains the 3D CheckBox DrawOptions
   TGCompositeFrame    *f12;              // Frame that contains the Bar-Title
   TGCompositeFrame    *f13;              // Frame that contains the Bar Width/Offset NumberEntries
   TGCompositeFrame    *f38;              // Frame that contains the Frame Fill widgets
   TGCheckButton       *fAddError;        // CheckBox connected to error bars
   TGCheckButton       *fAddPalette;      // CheckBox connected to Z option (2D)
   TGCheckButton       *fAddPalette1;     // CheckBox connected to Z option (3D)
   TGCheckButton       *fAddArr;          // CheckBox connected to Arr-Option
   TGCheckButton       *fAddBox;          // CheckBox connected to Box-Option
   TGCheckButton       *fAddScat;         // CheckBox connected to Scat-Option
   TGCheckButton       *fAddCol;          // CheckBox connected to Col-Option
   TGCheckButton       *fAddFB;           // Draw front box (or not)
   TGCheckButton       *fAddBB;           // Draw back box (or not)
   TGCheckButton       *fAddText;         // Draw bin contents as text
   TGNumberEntry       *fContLevels;      // Set number of contour levels
   TGNumberEntry       *fContLevels1;     // Set number of contour levels
   TGNumberEntry       *fBarWidth;        // Set bar width of histogram
   TGNumberEntry       *fBarOffset;       // Set bar offset of histogram
   TGCompositeFrame    *fBinXCont;        // Contains the rebin widgets for case 1
   TGHSlider           *fBinXSlider;      // Slider to set rebinning x integer value
   TGNumberEntryField  *fBinXNumberEntry; // Label which shows the rebinned bin number
   TGHSlider           *fBinYSlider;      // Slider to set rebinning y integer value
   TGNumberEntryField  *fBinYNumberEntry; // Label which shows the rebinned bin number
   TGTextButton        *fApply;           // Apply-Button to accept the rebinned histogram
   TGTextButton        *fCancel;          // Cancel-Button to reprobate the rebinned histogram
   TGCompositeFrame    *fBinXCont1;       // Contains the X Rebin Widgets for case 2
   TGHSlider           *fBinXSlider1;     // Slider to set x rebinning integer value
   TGNumberEntryField  *fBinXNumberEntry1;// Label which shows the rebinned x bin number
   TGNumberEntryField  *fXOffsetNumberEntry; // Shows the offset to the x origin of the histogram
   TGHSlider           *fXBinOffsetSld;   // Add an x-offset to the origin of the histogram

   TGCompositeFrame    *fBinYCont1;       // Contains the Y Rebin Widgets for case 2
   TGHSlider           *fBinYSlider1;     // Slider to set y rebinning integer value
   TGNumberEntryField  *fBinYNumberEntry1;// Label which shows the rebinned y bin number
   TGNumberEntryField  *fYOffsetNumberEntry; // Shows the offset to the y origin of the histogram
   TGHSlider           *fYBinOffsetSld;   // Add an y-offset to the origin of the histogram
   TGDoubleHSlider     *fSliderX;         // Slider to set x-axis range
   TGNumberEntryField  *fSldXMin;         // Contains the minimum value of the x-Axis
   TGNumberEntryField  *fSldXMax;         // Contains the maximum value of the x-Axis
   TGDoubleHSlider     *fSliderY;         // Slider to set y-axis range
   TGNumberEntryField  *fSldYMin;         // Contains the minimum value of the y-Axis
   TGNumberEntryField  *fSldYMax;         // Contains the maximum value of the y-Axis
   TGCheckButton       *fDelaydraw;       // Delayed drawing of the new axis range
   TGColorSelect       *fFrameColor;      // Select the Frame Color
   TGedPatternSelect   *fFramePattern;    // Select the Frame Pattern Style
   TString              fCutString;       // Contais info about graphical cuts (if any)

   static  TGComboBox *BuildHistTypeComboBox(TGFrame *parent, Int_t id);
   static  TGComboBox *BuildHistCoordsComboBox(TGFrame *parent, Int_t id);
   static  TGComboBox *BuildHistContComboBox(TGFrame* parent, Int_t id);

   virtual void   ConnectSignals2Slots();
           void   CreateBinTab();       // Creates the Bin Tab (part of the SetGedEditor)

private:
   void    PaintBox3D(Float_t *p1, Float_t *p2,Float_t *p3, Float_t *p4);
   TString GetHistTypeLabel();
   TString GetHistCoordsLabel();
   TString GetHistContLabel();
   TString GetHistAdditiveLabel();
   TString GetCutOptionString();

   Int_t     fPx1old,
             fPy1old,
             fPx2old,
             fPy2old;
   Float_t   fP1oldx[3],
             fP2oldx[3],
             fP3oldx[3],
             fP4oldx[3],
             fP5oldx[3],
             fP6oldx[3],
             fP7oldx[3],
             fP8oldx[3];
   Float_t   fP1oldy[3],
             fP2oldy[3],
             fP3oldy[3],
             fP4oldy[3],
             fP5oldy[3],
             fP6oldy[3],
             fP7oldy[3],
             fP8oldy[3];
   TH2      *fBinHist;         // Cloned histogram for rebin
   Double_t  fOldXOffset;      // saves the old x offset of the histogram
   Double_t  fOldYOffset;      // saves the old y offset of the histogram

public:
   TH2Editor(const TGWindow *p = 0, 
             Int_t width = 140, Int_t height = 30,
             UInt_t options = kChildFrame,
             Pixel_t back = GetDefaultFrameBackground());
   virtual ~TH2Editor();

   virtual Bool_t AcceptModel(TObject* model);
   virtual void   SetModel(TObject* obj);
   virtual void   ActivateBaseClassEditors(TClass* cl);

   virtual void DoTitle(const char *text);
   virtual void DoHistView();
   virtual void DoHistSimple();
   virtual void DoHistComplex();
   virtual void DoHistChanges();
   virtual void DoAddArr(Bool_t on);
   virtual void DoAddBox(Bool_t on);
   virtual void DoAddCol(Bool_t on);
   virtual void DoAddScat(Bool_t on);
   virtual void DoAddText(Bool_t on);
   virtual void DoAddError(Bool_t on);
   virtual void DoAddPalette(Bool_t on);
   virtual void DoAddFB();
   virtual void DoAddBB();
   virtual void DoContLevel();
   virtual void DoContLevel1();
   virtual void DoBarWidth();
   virtual void DoBarOffset();
   virtual void DoBinPressed();
   virtual void DoBinMoved();
   virtual void DoBinReleased();
   virtual void DoBinLabel();
   virtual void DoApply();
   virtual void DoCancel();
   virtual void DoBinReleased1();
   virtual void DoBinMoved1();
   virtual void DoBinLabel1();
   virtual void DoOffsetMoved();
   virtual void DoOffsetReleased();
   virtual void DoOffsetPressed();
   virtual void DoBinOffset();
   virtual void DoSliderXMoved();
   virtual void DoSliderXPressed();
   virtual void DoSliderXReleased();
   virtual void DoXAxisRange();
   virtual void DoSliderYMoved();
   virtual void DoSliderYPressed();
   virtual void DoSliderYReleased();
   virtual void DoYAxisRange();
   virtual void DoFillColor(Pixel_t);
   virtual void DoFillPattern(Style_t);

   Int_t* Dividers(Int_t n);

   ClassDef(TH2Editor,0)  // TH2 editor
};

#endif

 TH2Editor.h:1
 TH2Editor.h:2
 TH2Editor.h:3
 TH2Editor.h:4
 TH2Editor.h:5
 TH2Editor.h:6
 TH2Editor.h:7
 TH2Editor.h:8
 TH2Editor.h:9
 TH2Editor.h:10
 TH2Editor.h:11
 TH2Editor.h:12
 TH2Editor.h:13
 TH2Editor.h:14
 TH2Editor.h:15
 TH2Editor.h:16
 TH2Editor.h:17
 TH2Editor.h:18
 TH2Editor.h:19
 TH2Editor.h:20
 TH2Editor.h:21
 TH2Editor.h:22
 TH2Editor.h:23
 TH2Editor.h:24
 TH2Editor.h:25
 TH2Editor.h:26
 TH2Editor.h:27
 TH2Editor.h:28
 TH2Editor.h:29
 TH2Editor.h:30
 TH2Editor.h:31
 TH2Editor.h:32
 TH2Editor.h:33
 TH2Editor.h:34
 TH2Editor.h:35
 TH2Editor.h:36
 TH2Editor.h:37
 TH2Editor.h:38
 TH2Editor.h:39
 TH2Editor.h:40
 TH2Editor.h:41
 TH2Editor.h:42
 TH2Editor.h:43
 TH2Editor.h:44
 TH2Editor.h:45
 TH2Editor.h:46
 TH2Editor.h:47
 TH2Editor.h:48
 TH2Editor.h:49
 TH2Editor.h:50
 TH2Editor.h:51
 TH2Editor.h:52
 TH2Editor.h:53
 TH2Editor.h:54
 TH2Editor.h:55
 TH2Editor.h:56
 TH2Editor.h:57
 TH2Editor.h:58
 TH2Editor.h:59
 TH2Editor.h:60
 TH2Editor.h:61
 TH2Editor.h:62
 TH2Editor.h:63
 TH2Editor.h:64
 TH2Editor.h:65
 TH2Editor.h:66
 TH2Editor.h:67
 TH2Editor.h:68
 TH2Editor.h:69
 TH2Editor.h:70
 TH2Editor.h:71
 TH2Editor.h:72
 TH2Editor.h:73
 TH2Editor.h:74
 TH2Editor.h:75
 TH2Editor.h:76
 TH2Editor.h:77
 TH2Editor.h:78
 TH2Editor.h:79
 TH2Editor.h:80
 TH2Editor.h:81
 TH2Editor.h:82
 TH2Editor.h:83
 TH2Editor.h:84
 TH2Editor.h:85
 TH2Editor.h:86
 TH2Editor.h:87
 TH2Editor.h:88
 TH2Editor.h:89
 TH2Editor.h:90
 TH2Editor.h:91
 TH2Editor.h:92
 TH2Editor.h:93
 TH2Editor.h:94
 TH2Editor.h:95
 TH2Editor.h:96
 TH2Editor.h:97
 TH2Editor.h:98
 TH2Editor.h:99
 TH2Editor.h:100
 TH2Editor.h:101
 TH2Editor.h:102
 TH2Editor.h:103
 TH2Editor.h:104
 TH2Editor.h:105
 TH2Editor.h:106
 TH2Editor.h:107
 TH2Editor.h:108
 TH2Editor.h:109
 TH2Editor.h:110
 TH2Editor.h:111
 TH2Editor.h:112
 TH2Editor.h:113
 TH2Editor.h:114
 TH2Editor.h:115
 TH2Editor.h:116
 TH2Editor.h:117
 TH2Editor.h:118
 TH2Editor.h:119
 TH2Editor.h:120
 TH2Editor.h:121
 TH2Editor.h:122
 TH2Editor.h:123
 TH2Editor.h:124
 TH2Editor.h:125
 TH2Editor.h:126
 TH2Editor.h:127
 TH2Editor.h:128
 TH2Editor.h:129
 TH2Editor.h:130
 TH2Editor.h:131
 TH2Editor.h:132
 TH2Editor.h:133
 TH2Editor.h:134
 TH2Editor.h:135
 TH2Editor.h:136
 TH2Editor.h:137
 TH2Editor.h:138
 TH2Editor.h:139
 TH2Editor.h:140
 TH2Editor.h:141
 TH2Editor.h:142
 TH2Editor.h:143
 TH2Editor.h:144
 TH2Editor.h:145
 TH2Editor.h:146
 TH2Editor.h:147
 TH2Editor.h:148
 TH2Editor.h:149
 TH2Editor.h:150
 TH2Editor.h:151
 TH2Editor.h:152
 TH2Editor.h:153
 TH2Editor.h:154
 TH2Editor.h:155
 TH2Editor.h:156
 TH2Editor.h:157
 TH2Editor.h:158
 TH2Editor.h:159
 TH2Editor.h:160
 TH2Editor.h:161
 TH2Editor.h:162
 TH2Editor.h:163
 TH2Editor.h:164
 TH2Editor.h:165
 TH2Editor.h:166
 TH2Editor.h:167
 TH2Editor.h:168
 TH2Editor.h:169
 TH2Editor.h:170
 TH2Editor.h:171
 TH2Editor.h:172
 TH2Editor.h:173
 TH2Editor.h:174
 TH2Editor.h:175
 TH2Editor.h:176
 TH2Editor.h:177
 TH2Editor.h:178
 TH2Editor.h:179
 TH2Editor.h:180
 TH2Editor.h:181
 TH2Editor.h:182
 TH2Editor.h:183
 TH2Editor.h:184
 TH2Editor.h:185
 TH2Editor.h:186
 TH2Editor.h:187
 TH2Editor.h:188
 TH2Editor.h:189
 TH2Editor.h:190
 TH2Editor.h:191
 TH2Editor.h:192
 TH2Editor.h:193
 TH2Editor.h:194
 TH2Editor.h:195
 TH2Editor.h:196
 TH2Editor.h:197
 TH2Editor.h:198
 TH2Editor.h:199
 TH2Editor.h:200
 TH2Editor.h:201
 TH2Editor.h:202
 TH2Editor.h:203
 TH2Editor.h:204
 TH2Editor.h:205
 TH2Editor.h:206
 TH2Editor.h:207