Logo ROOT  
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
27Editor 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
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
110 if (fRE->CanEditElement()) {
112 if (fRE->SingleRnrState()) {
115 } else {
120 }
121 }
122
123 if (fRE->CanEditMainColor()) {
126 } else {
128 }
132 } else {
134 }
135 if (fRE->CanEditMainTrans()) {
137 fTrans->MapWindow();
138 } else {
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}
@ kVerticalFrame
Definition: GuiTypes.h:381
ULong_t Pixel_t
Definition: GuiTypes.h:39
char Char_t
Definition: RtypesCore.h:31
const Bool_t kFALSE
Definition: RtypesCore.h:90
#define ClassImp(name)
Definition: Rtypes.h:361
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kButtonDown
Definition: TGButton.h:54
@ kButtonUp
Definition: TGButton.h:53
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2016
Editor for TEveElement class.
TGNumberEntry * fTransparency
void DoTransparency()
Slot for Transparency.
TEveTransSubEditor * fTrans
void DoRnrChildren()
Slot for RnrChildren.
TGCheckButton * fRnrState
void DoMainColor(Pixel_t color)
Slot for MainColor.
void DoRnrState()
Slot for RnrState.
TGHorizontalFrame * fHFrame
TGColorSelect * fMainColor
TGCheckButton * fRnrSelf
TGCheckButton * fRnrChildren
TEveElementEditor(const TEveElementEditor &)
virtual void SetModel(TObject *obj)
Set model object.
void DoRnrSelf()
Slot for RnrSelf.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:34
virtual TEveTrans * PtrMainTrans(Bool_t create=kTRUE)
Return pointer to main transformation.
virtual Bool_t SingleRnrState() const
Definition: TEveElement.h:253
void SetMainColorPixel(Pixel_t pixel)
Convert pixel to Color_t and call SetMainColor().
virtual void SetMainTransparency(Char_t t)
Set main-transparency.
virtual Bool_t CanEditMainTransparency() const
Definition: TEveElement.h:277
virtual Bool_t CanEditElement() const
Definition: TEveElement.h:252
virtual Bool_t CanEditMainColor() const
Definition: TEveElement.h:264
virtual Bool_t CanEditMainTrans() const
Definition: TEveElement.h:284
virtual Bool_t SetRnrChildren(Bool_t rnr)
Set render state of this element's children, i.e.
virtual Bool_t GetRnrState() const
Definition: TEveElement.h:256
virtual Color_t GetMainColor() const
Definition: TEveElement.h:270
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
virtual Bool_t GetRnrChildren() const
Definition: TEveElement.h:255
virtual Char_t GetMainTransparency() const
Definition: TEveElement.h:279
virtual Bool_t GetRnrSelf() const
Definition: TEveElement.h:254
virtual Bool_t SetRnrSelf(Bool_t rnr)
Set render state of this element, i.e.
Sub-editor for TEveTrans class.
void SetModel(TEveTrans *t)
Set model object.
virtual Bool_t IsOn() const
Definition: TGButton.h:311
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1202
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1241
virtual void MapWindow()
map window
Definition: TGFrame.h:229
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:272
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:231
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual Double_t GetNumber() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
Int_t fPriority
Definition: TGedFrame.h:59
Mother of all ROOT objects.
Definition: TObject.h:37
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:866