Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TColor.h"
17
18#include "TGLabel.h"
19#include "TGNumberEntry.h"
20#include "TGColorSelect.h"
21
22/** \class TEveElementEditor
23\ingroup TEve
24Editor for TEveElement class.
25*/
26
28
29////////////////////////////////////////////////////////////////////////////////
30/// Constructor.
31
34 UInt_t options, Pixel_t back) :
35 TGedFrame(p, width, height, options | kVerticalFrame, back),
36
37 fRE (nullptr),
38 fHFrame (nullptr),
39 fPreLabel (nullptr),
40 fRnrSelf (nullptr),
41 fRnrChildren (nullptr),
42 fRnrState (nullptr),
43 fMainColor (nullptr),
44 fTransparency (nullptr),
45 fTrans (nullptr)
46{
47 MakeTitle("TEveElement");
48 fPriority = 0;
49
50 fHFrame = new TGHorizontalFrame(this);
51
52 fPreLabel = new TGLabel(fHFrame, "Show:");
53 fHFrame->AddFrame(fPreLabel, new TGLayoutHints(kLHintsLeft, 1, 6, 2, 0));
54 fRnrSelf = new TGCheckButton(fHFrame, "Self");
55 fHFrame->AddFrame(fRnrSelf, new TGLayoutHints(kLHintsLeft, 0, 2, 1, 1));
56 fRnrSelf->Connect
57 ("Toggled(Bool_t)",
58 "TEveElementEditor", this, "DoRnrSelf()");
59
60 fRnrChildren = new TGCheckButton(fHFrame, "Children");
61 fHFrame->AddFrame(fRnrChildren, new TGLayoutHints(kLHintsLeft, 0, 1, 1, 1));
62 fRnrChildren->Connect
63 ("Toggled(Bool_t)",
64 "TEveElementEditor", this, "DoRnrChildren()");
65
67 fHFrame->AddFrame(fRnrState, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
68 fRnrState->Connect
69 ("Toggled(Bool_t)",
70 "TEveElementEditor", this, "DoRnrState()");
71
72 fMainColor = new TGColorSelect(fHFrame, 0, -1);
73 fHFrame->AddFrame(fMainColor, new TGLayoutHints(kLHintsLeft, 2, 0, -2, 0));
74 fMainColor->Connect
75 ("ColorSelected(Pixel_t)",
76 "TEveElementEditor", this, "DoMainColor(Pixel_t)");
77
78 fTransparency = new TGNumberEntry(fHFrame, 0., 2, -1,
81 fTransparency->SetHeight(18);
82 fTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
83 fHFrame->AddFrame(fTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
84 fTransparency->Connect
85 ("ValueSet(Long_t)",
86 "TEveElementEditor", this, "DoTransparency()");
87
88 AddFrame(fHFrame, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
89
90 fTrans = new TEveTransSubEditor(this);
91 fTrans->Connect("UseTrans()", "TEveElementEditor", this, "Update()");
92 fTrans->Connect("TransChanged()", "TEveElementEditor", this, "Update()");
94}
95
96////////////////////////////////////////////////////////////////////////////////
97/// Set model object.
98
100{
101 fRE = dynamic_cast<TEveElement*>(obj);
102
103 fPreLabel ->UnmapWindow();
104 fRnrSelf ->UnmapWindow();
105 fRnrChildren->UnmapWindow();
106 fRnrState ->UnmapWindow();
107 if (fRE->CanEditElement()) {
108 fPreLabel->MapWindow();
109 if (fRE->SingleRnrState()) {
110 fRnrState->SetState(fRE->GetRnrState() ? kButtonDown : kButtonUp);
111 fRnrState->MapWindow();
112 } else {
113 fRnrSelf->SetState(fRE->GetRnrSelf() ? kButtonDown : kButtonUp);
114 fRnrChildren->SetState(fRE->GetRnrChildren() ? kButtonDown : kButtonUp);
115 fRnrSelf->MapWindow();
116 fRnrChildren->MapWindow();
117 }
118 }
119
120 if (fRE->CanEditMainColor()) {
121 fMainColor->SetColor(TColor::Number2Pixel(fRE->GetMainColor()), kFALSE);
122 fMainColor->MapWindow();
123 } else {
124 fMainColor->UnmapWindow();
125 }
126 if (fRE->CanEditMainTransparency()) {
127 fTransparency->SetNumber(fRE->GetMainTransparency());
128 fTransparency->MapWindow();
129 } else {
130 fTransparency->UnmapWindow();
131 }
132 if (fRE->CanEditMainTrans()) {
133 fTrans->SetModel(fRE->PtrMainTrans());
134 fTrans->MapWindow();
135 } else {
136 fTrans->UnmapWindow();
137 }
138
139 fHFrame->Layout();
140}
141
142////////////////////////////////////////////////////////////////////////////////
143/// Slot for RnrSelf.
144
146{
147 fRE->SetRnrSelf(fRnrSelf->IsOn());
148 Update();
149}
150
151////////////////////////////////////////////////////////////////////////////////
152/// Slot for RnrChildren.
153
155{
156 fRE->SetRnrChildren(fRnrChildren->IsOn());
157 Update();
158}
159
160////////////////////////////////////////////////////////////////////////////////
161/// Slot for RnrState.
162
164{
165 fRE->SetRnrState(fRnrState->IsOn());
166 Update();
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Slot for MainColor.
171
173{
174 fRE->SetMainColorPixel(color);
175 Update();
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Slot for Transparency.
180
182{
183 fRE->SetMainTransparency((Char_t)(fTransparency->GetNumber()));
184 Update();
185}
@ kVerticalFrame
Definition GuiTypes.h:381
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
#define ClassImp(name)
Definition Rtypes.h:377
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2320
Editor for TEveElement class.
void SetModel(TObject *obj) override
Set model object.
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 &)
void DoRnrSelf()
Slot for RnrSelf.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
Sub-editor for TEveTrans class.
Selects different options.
Definition TGButton.h:264
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
@ kNEANonNegative
Non-negative number.
@ kNESInteger
Style of number entry field.
@ kNELLimitMinMax
Both lower and upper limits.
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedFrame(const TGedFrame &)=delete
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
Int_t fPriority
location in GedEditor
Definition TGedFrame.h:53
Mother of all ROOT objects.
Definition TObject.h:41