Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveLineEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveLineEditor.h"
13 #include "TEveLine.h"
14 
15 #include "TVirtualPad.h"
16 #include "TColor.h"
17 
18 #include "TGLabel.h"
19 #include "TGButton.h"
20 #include "TGNumberEntry.h"
21 #include "TGColorSelect.h"
22 #include "TGDoubleSlider.h"
23 
24 /** \class TEveLineEditor
25 \ingroup TEve
26 Editor for TEveLine class.
27 */
28 
29 ClassImp(TEveLineEditor);
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 /// Constructor.
33 
34 TEveLineEditor::TEveLineEditor(const TGWindow *p, Int_t width, Int_t height,
35  UInt_t options, Pixel_t back) :
36  TGedFrame (p, width, height, options | kVerticalFrame, back),
37  fM (0),
38  fRnrLine (0),
39  fRnrPoints (0),
40  fSmooth (0)
41 {
42  fPriority = 20;
43  {
44  TGHorizontalFrame* f = new TGHorizontalFrame(this);
45 
46  fRnrPoints = new TGCheckButton(f, "Draw Marker");
47  f->AddFrame(fRnrPoints, new TGLayoutHints(kLHintsLeft, 2,1,0,0));
48  fRnrPoints->Connect("Toggled(Bool_t)", "TEveLineEditor", this, "DoRnrPoints()");
49 
50  fRnrLine = new TGCheckButton(f, "Draw Line");
51  f->AddFrame(fRnrLine, new TGLayoutHints(kLHintsLeft, 1,2,0,0));
52  fRnrLine->Connect("Toggled(Bool_t)", "TEveLineEditor", this, "DoRnrLine()");
53 
54  AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
55  }
56  fSmooth = new TGCheckButton(this, "Smooth line");
57  AddFrame(fSmooth, new TGLayoutHints(kLHintsNormal, 2,1,2,1));
58  fSmooth->Connect("Toggled(Bool_t)", "TEveLineEditor", this, "DoSmooth()");
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Set model object.
63 
64 void TEveLineEditor::SetModel(TObject* obj)
65 {
66  fM = dynamic_cast<TEveLine*>(obj);
67 
68  fRnrLine ->SetState(fM->fRnrLine ? kButtonDown : kButtonUp);
69  fRnrPoints->SetState(fM->fRnrPoints ? kButtonDown : kButtonUp);
70  fSmooth->SetState(fM->fSmooth ? kButtonDown : kButtonUp);
71 }
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 /// Slot for RnrLine.
75 
76 void TEveLineEditor::DoRnrLine()
77 {
78  fM->SetRnrLine(fRnrLine->IsOn());
79  Update();
80 }
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 /// Slot for RnrPoints.
84 
85 void TEveLineEditor::DoRnrPoints()
86 {
87  fM->SetRnrPoints(fRnrPoints->IsOn());
88  Update();
89 }
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// Slot for anti-alias.
93 
94 void TEveLineEditor::DoSmooth()
95 {
96  fM->SetSmooth(fSmooth->IsOn());
97  Update();
98 }