ROOT  6.06/09
Reference Guide
TEveElementEditor.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 "TEveElementEditor.h"
13 #include "TEveElement.h"
14 #include "TEveTransEditor.h"
15 
16 #include "TVirtualPad.h"
17 #include "TColor.h"
18 
19 #include "TGLabel.h"
20 #include "TGButton.h"
21 #include "TGNumberEntry.h"
22 #include "TGColorSelect.h"
23 #include "TGDoubleSlider.h"
24 
25 /** \class TEveElementEditor
26 \ingroup TEve
27 Editor for TEveElement class.
28 */
29 
31 
32 ////////////////////////////////////////////////////////////////////////////////
33 /// Constructor.
34 
36  Int_t width, Int_t height,
37  UInt_t options, Pixel_t back) :
38  TGedFrame(p, width, height, options | kVerticalFrame, back),
39 
40  fRE (0),
41  fHFrame (0),
42  fPreLabel (0),
43  fRnrSelf (0),
44  fRnrChildren (0),
45  fRnrState (0),
46  fMainColor (0),
47  fTransparency (0),
48  fTrans (0)
49 {
50  MakeTitle("TEveElement");
51  fPriority = 0;
52 
53  fHFrame = new TGHorizontalFrame(this);
54 
55  fPreLabel = new TGLabel(fHFrame, "Show:");
57  fRnrSelf = new TGCheckButton(fHFrame, "Self");
60  ("Toggled(Bool_t)",
61  "TEveElementEditor", this, "DoRnrSelf()");
62 
63  fRnrChildren = new TGCheckButton(fHFrame, "Children");
66  ("Toggled(Bool_t)",
67  "TEveElementEditor", this, "DoRnrChildren()");
68 
69  fRnrState = new TGCheckButton(fHFrame, "");
72  ("Toggled(Bool_t)",
73  "TEveElementEditor", this, "DoRnrState()");
74 
75  fMainColor = new TGColorSelect(fHFrame, 0, -1);
78  ("ColorSelected(Pixel_t)",
79  "TEveElementEditor", this, "DoMainColor(Pixel_t)");
80 
81  fTransparency = new TGNumberEntry(fHFrame, 0., 2, -1,
85  fTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
88  ("ValueSet(Long_t)",
89  "TEveElementEditor", this, "DoTransparency()");
90 
91  AddFrame(fHFrame, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
92 
93  fTrans = new TEveTransSubEditor(this);
94  fTrans->Connect("UseTrans()", "TEveElementEditor", this, "Update()");
95  fTrans->Connect("TransChanged()", "TEveElementEditor", this, "Update()");
97 }
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Set model object.
101 
103 {
104  fRE = dynamic_cast<TEveElement*>(obj);
105 
107  fRnrSelf ->UnmapWindow();
110  if (fRE->CanEditElement()) {
111  fPreLabel->MapWindow();
112  if (fRE->SingleRnrState()) {
114  fRnrState->MapWindow();
115  } else {
118  fRnrSelf->MapWindow();
120  }
121  }
122 
123  if (fRE->CanEditMainColor()) {
126  } else {
128  }
129  if (fRE->CanEditMainTransparency()) {
132  } else {
134  }
135  if (fRE->CanEditMainTrans()) {
137  fTrans->MapWindow();
138  } else {
139  fTrans->UnmapWindow();
140  }
141 
142  fHFrame->Layout();
143 }
144 
145 ////////////////////////////////////////////////////////////////////////////////
146 /// Slot for RnrSelf.
147 
149 {
151  Update();
152 }
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 /// Slot for RnrChildren.
156 
158 {
160  Update();
161 }
162 
163 ////////////////////////////////////////////////////////////////////////////////
164 /// Slot for RnrState.
165 
167 {
169  Update();
170 }
171 
172 ////////////////////////////////////////////////////////////////////////////////
173 /// Slot for MainColor.
174 
176 {
177  fRE->SetMainColorPixel(color);
178  Update();
179 }
180 
181 ////////////////////////////////////////////////////////////////////////////////
182 /// Slot for Transparency.
183 
185 {
187  Update();
188 }
virtual Bool_t GetRnrState() const
Definition: TEveElement.h:256
void DoTransparency()
Slot for Transparency.
TEveElementEditor(const TEveElementEditor &)
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
void DoRnrSelf()
Slot for RnrSelf.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void SetNumber(Double_t val)
TGColorSelect * fMainColor
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
TGCheckButton * fRnrChildren
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
void DoRnrState()
Slot for RnrState.
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
TGNumberEntryField * GetNumberEntry() const
ULong_t Pixel_t
Definition: GuiTypes.h:41
virtual Bool_t GetRnrChildren() const
Definition: TEveElement.h:255
virtual Color_t GetMainColor() const
Definition: TEveElement.h:270
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
virtual Bool_t CanEditMainTrans() const
Definition: TEveElement.h:284
virtual Bool_t GetRnrSelf() const
Definition: TEveElement.h:254
TGHorizontalFrame * fHFrame
void DoRnrChildren()
Slot for RnrChildren.
virtual void SetModel(TObject *obj)
Set model object.
virtual Bool_t CanEditMainColor() const
Definition: TEveElement.h:264
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
ClassImp(TEveElementEditor)
TGNumberEntry * fTransparency
Editor for TEveElement class.
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
virtual Bool_t IsOn() const
Definition: TGButton.h:315
TEveTransSubEditor * fTrans
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1862
TGCheckButton * fRnrSelf
Sub-editor for TEveTrans class.
virtual Bool_t SingleRnrState() const
Definition: TEveElement.h:253
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
void SetModel(TEveTrans *t)
Set model object.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
Mother of all ROOT objects.
Definition: TObject.h:58
char Char_t
Definition: RtypesCore.h:29
virtual void UnmapWindow()
Definition: TGFrame.h:269
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:310
TGCheckButton * fRnrState
virtual void MapWindow()
Definition: TGFrame.h:267
void SetMainColorPixel(Pixel_t pixel)
Convert pixel to Color_t and call SetMainColor().
virtual Char_t GetMainTransparency() const
Definition: TEveElement.h:279
virtual Bool_t CanEditElement() const
Definition: TEveElement.h:252
virtual Double_t GetNumber() const
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
virtual TEveTrans * PtrMainTrans(Bool_t create=kTRUE)
Return pointer to main transformation.
TObject * obj
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:33
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
void DoMainColor(Pixel_t color)
Slot for MainColor.
virtual Bool_t CanEditMainTransparency() const
Definition: TEveElement.h:277
Int_t fPriority
Definition: TGedFrame.h:61