TEveArrowEditor.cxx

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveArrowEditor.cxx 25696 2008-10-03 16:58:43Z matevz $
00002 // Author: Matevz Tadel 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TEveArrowEditor.h"
00013 #include "TEveArrow.h"
00014 #include "TVirtualPad.h"
00015 #include "TGLabel.h"
00016 #include "TEveGValuators.h"
00017 
00018 //______________________________________________________________________________
00019 // GUI editor for TEveArrow.
00020 //
00021 
00022 ClassImp(TEveArrowEditor);
00023 
00024 //______________________________________________________________________________
00025 TEveArrowEditor::TEveArrowEditor(const TGWindow *p, Int_t width, Int_t height,
00026                                  UInt_t options, Pixel_t back) :
00027    TGedFrame(p, width, height, options | kVerticalFrame, back),
00028    fM(0),
00029 
00030    fTubeR(0),
00031    fConeR(0),
00032    fConeL(0),
00033 
00034    fOrigin(0),
00035    fVector(0)
00036 {
00037    // Constructor.
00038 
00039    MakeTitle("TEveArrow");
00040    Int_t labelW = 51;
00041 
00042    fTubeR = new TEveGValuator(this, "TubeR:", 90, 0);
00043    fTubeR->SetLabelWidth(labelW);
00044    fTubeR->SetNELength(6);
00045    fTubeR->Build();
00046    fTubeR->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
00047    fTubeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoTubeR()");
00048    AddFrame(fTubeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00049 
00050    fConeR = new TEveGValuator(this, "ConeR:", 90, 0);
00051    fConeR->SetLabelWidth(labelW);
00052    fConeR->SetNELength(6);
00053    fConeR->Build();
00054    fConeR->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
00055    fConeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeR()");
00056    AddFrame(fConeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00057 
00058    fConeL = new TEveGValuator(this, "ConeL:", 90, 0);
00059    fConeL->SetLabelWidth(labelW);
00060    fConeL->SetNELength(6);
00061    fConeL->Build();
00062    fConeL->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
00063    fConeL->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeL()");
00064    AddFrame(fConeL, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00065 
00066    TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
00067    {
00068       TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
00069       TGLabel* labp = new TGLabel(hfp, "Origin");
00070       labp->SetTextFont(font);
00071       hfp->AddFrame(labp);
00072       AddFrame(hfp,  new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
00073       fOrigin = new TEveGTriVecValuator(this, "Origin", 160, 20);
00074       fOrigin->SetNELength(6);
00075       fOrigin->Build(kFALSE, "", "", "");
00076       fOrigin->SetLimits(-1e5, 1e5, TGNumberFormat::kNESRealThree);
00077       AddFrame(fOrigin, new TGLayoutHints(kLHintsTop , 0,0,0,0));
00078    }
00079 
00080    {
00081       TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
00082       TGLabel* labp = new TGLabel(hfp, "Vector");
00083       labp->SetTextFont(font);
00084       hfp->AddFrame(labp);
00085       AddFrame(hfp,  new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
00086       fVector = new TEveGTriVecValuator(this, "Vector", 160, 20);
00087       fVector->SetNELength(6);
00088       fVector->Build(kFALSE, "", "", "");
00089       fVector->SetLimits(-1e5, 1e5, TGNumberFormat::kNESRealThree);
00090       AddFrame(fVector, new TGLayoutHints(kLHintsTop , 0,0,0,0));
00091    }
00092 
00093    fVector->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
00094    fOrigin->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
00095 }
00096 
00097 //______________________________________________________________________________
00098 void TEveArrowEditor::SetModel(TObject* obj)
00099 {
00100    // Set model object.
00101 
00102    fM = dynamic_cast<TEveArrow*>(obj);
00103 
00104    fTubeR->SetValue(fM->fTubeR);
00105    fTubeR->SetValue(fM->fTubeR);
00106    fConeL->SetValue(fM->fConeL);
00107 
00108    fOrigin->SetValues(&fM->fOrigin[0]);
00109    fVector->SetValues(&fM->fVector[0]);
00110 }
00111 
00112 //______________________________________________________________________________
00113 void TEveArrowEditor::DoTubeR()
00114 {
00115    // Slot for TubeR.
00116 
00117    fM->SetTubeR(fTubeR->GetValue());
00118    Update();
00119 }
00120 
00121 //______________________________________________________________________________
00122 void TEveArrowEditor::DoConeR()
00123 {
00124    // Slot for ConeR.
00125 
00126    fM->SetConeR(fConeR->GetValue());
00127    Update();
00128 }
00129 
00130 //______________________________________________________________________________
00131 void TEveArrowEditor::DoConeL()
00132 {
00133    // Slot for ConeL.
00134 
00135    fM->SetConeL(fConeL->GetValue());
00136    Update();
00137 }
00138 
00139 //______________________________________________________________________________
00140 void TEveArrowEditor::DoVertex()
00141 {
00142    // Slot for origin and vector.
00143 
00144    Double_t v[3];
00145    fOrigin->GetValues(v);
00146    fM->fOrigin.Set(v);
00147    fVector->GetValues(v);
00148    fM->fVector.Set(v);
00149    Update();
00150 }
00151 
00152 

Generated on Tue Jul 5 14:16:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1