ROOT logo
// @(#)root/eve:$Id: TEveGridStepperEditor.cxx 21246 2007-12-06 17:55:44Z matevz $
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

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

#include "TEveGridStepperEditor.h"
#include "TEveGridStepper.h"
#include "TEveGValuators.h"

#include "TVirtualPad.h"
#include "TColor.h"

#include "TGLabel.h"
#include "TGSlider.h"
#include "TGButton.h"
#include "TGNumberEntry.h"

//______________________________________________________________________________
// TEveGridStepperSubEditor
//
// Sub-editor for TEveGridStepper class.

ClassImp(TEveGridStepperSubEditor)

//______________________________________________________________________________
TEveGridStepperSubEditor::TEveGridStepperSubEditor(const TGWindow *p) :
   TGVerticalFrame(p),
   fM (0),
   fNx(0), fNy(0), fNz(0),
   fDx(0), fDy(0), fDz(0)
{
   // Constructor.

   Int_t labelW = 15;

   TGHorizontalFrame* hf = new TGHorizontalFrame(this);

   {
      TGGroupFrame* f = new TGGroupFrame(hf, "NumRows", kVerticalFrame);
      f->SetWidth(30);
      hf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));

      fNx = new TEveGValuator(f,"X:", 200, 0);
      fNx->SetNELength(3);
      fNx->SetLabelWidth(labelW);
      fNx->SetShowSlider(kFALSE);
      fNx->Build();
      fNx->SetLimits(1, 15);
      fNx->Connect("ValueSet(Double_t)",
                   "TEveGridStepperSubEditor", this, "DoNs()");
      f->AddFrame(fNx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

      fNy = new TEveGValuator(f,"Y:", 200, 0);
      fNy->SetNELength(3);
      fNy->SetLabelWidth(labelW);
      fNy->SetShowSlider(kFALSE);
      fNy->Build();
      fNy->SetLimits(1, 15);
      fNy->Connect("ValueSet(Double_t)",
                   "TEveGridStepperSubEditor", this, "DoNs()");
      f->AddFrame(fNy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

      fNz = new TEveGValuator(f,"Z:", 200, 0);
      fNz->SetNELength(3);
      fNz->SetLabelWidth(labelW);
      fNz->SetShowSlider(kFALSE);
      fNz->Build();
      fNz->SetLimits(1, 15);
      fNz->Connect("ValueSet(Double_t)",
                   "TEveGridStepperSubEditor", this, "DoNs()");
      f->AddFrame(fNz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

      //AddFrame(f, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
   }
   {
      TGGroupFrame* f = new TGGroupFrame(hf, "Step", kVerticalFrame);
      f->SetWidth(130);
      hf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));

      fDx = new TEveGValuator(f,"X:", 200, 0);
      fDx->SetNELength(5);
      fDx->SetLabelWidth(labelW);
      fDx->SetShowSlider(kFALSE);
      fDx->Build();
      fDx->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
      fDx->Connect("ValueSet(Double_t)",
                   "TEveGridStepperSubEditor", this, "DoDs()");
      f->AddFrame(fDx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

      fDy = new TEveGValuator(f,"Y:", 200, 0);
      fDy->SetNELength(5);
      fDy->SetLabelWidth(labelW);
      fDy->SetShowSlider(kFALSE);
      fDy->Build();
      fDy->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
      fDy->Connect("ValueSet(Double_t)",
                   "TEveGridStepperSubEditor", this, "DoDs()");
      f->AddFrame(fDy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

      fDz = new TEveGValuator(f,"Z:", 200, 0);
      fDz->SetNELength(5);
      fDz->SetLabelWidth(labelW);
      fDz->SetShowSlider(kFALSE);
      fDz->Build();
      fDz->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
      fDz->Connect("ValueSet(Double_t)",
                   "TEveGridStepperSubEditor", this, "DoDs()");
      f->AddFrame(fDz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));

      //AddFrame(f, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
   }
   AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
}

//______________________________________________________________________________
void TEveGridStepperSubEditor::SetModel(TEveGridStepper* m)
{
   // Set model object.

   fM = m;

   fNx->SetValue(fM->fNx);
   fNy->SetValue(fM->fNy);
   fNz->SetValue(fM->fNz);

   fDx->SetValue(fM->fDx);
   fDy->SetValue(fM->fDy);
   fDz->SetValue(fM->fDz);
}

//______________________________________________________________________________
void TEveGridStepperSubEditor::Changed()
{
   // Emit Changed signal.

   Emit("Changed()");
}

//______________________________________________________________________________
void TEveGridStepperSubEditor::DoNs()
{
   // Slot for changing fN's.

   fM->SetNs((Int_t)fNx->GetValue(), (Int_t)fNy->GetValue(), (Int_t)fNz->GetValue());
   Changed();
}

//______________________________________________________________________________
void TEveGridStepperSubEditor::DoDs()
{
   // Slot for changing fD's.

   fM->SetDs(fDx->GetValue(), fDy->GetValue(), fDz->GetValue());
   Changed();
}


//______________________________________________________________________________
// TEveGridStepperEditor
//
// Editor for TEveGridStepper class.

ClassImp(TEveGridStepperEditor)

//______________________________________________________________________________
TEveGridStepperEditor::TEveGridStepperEditor(const TGWindow *p, Int_t width, Int_t height,
                                             UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),
   fM  (0),
   fSE (0)
{
   // Constructor.

   MakeTitle("TEveGridStepper");

   fSE = new TEveGridStepperSubEditor(this);
   AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
   fSE->Connect("Changed()", "TEveGridStepperEditor", this, "Update()");
}

//______________________________________________________________________________
void TEveGridStepperEditor::SetModel(TObject* obj)
{
   // Set model object.

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