Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEveShapeEditor.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 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 "TEveShapeEditor.h"
13#include "TEveShape.h"
14
15#include "TColor.h"
16
17#include "TGLabel.h"
18#include "TGButton.h"
19#include "TGNumberEntry.h"
20#include "TGColorSelect.h"
21
22
23/** \class TEveShapeEditor
24\ingroup TEve
25GUI editor for TEveShape.
26*/
27
28
29////////////////////////////////////////////////////////////////////////////////
30/// Constructor.
31
33 UInt_t options, Pixel_t back) :
34 TGedFrame(p, width, height, options | kVerticalFrame, back),
35 fM(nullptr),
36 fLineWidth(nullptr),
37 fLineColor(nullptr),
38 fDrawFrame(nullptr),
39 fHighlightFrame(nullptr)
40{
41 MakeTitle("TEveShape");
42
43 {
45
46 TGLabel *l = new TGLabel(f, "LineColor:");
47 f->AddFrame(l, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0));
48 fLineColor = new TGColorSelect(f, 0, -1);
49 fLineColor->Connect("ColorSelected(Pixel_t)", "TEveShapeEditor", this, "DoLineColor(Pixel_t)");
50 f->AddFrame(fLineColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
51
52 fLineWidth = new TGNumberEntry(f, 0., 4, -1,
55 fLineWidth->GetNumberEntry()->SetToolTipText("Line width of outline.");
56 fLineWidth->Connect("ValueSet(Long_t)", "TEveShapeEditor", this, "DoLineWidth()");
57 f->AddFrame(fLineWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
58
59 AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
60 }
61 {
63
64 fDrawFrame = new TGCheckButton(f, "Draw Frame");
65 f->AddFrame(fDrawFrame, new TGLayoutHints(kLHintsLeft, 1,2,0,0));
66 fDrawFrame->Connect("Toggled(Bool_t)", "TEveShapeEditor", this, "DoDrawFrame()");
67
68 fHighlightFrame = new TGCheckButton(f, "Highlight Frame");
69 f->AddFrame(fHighlightFrame, new TGLayoutHints(kLHintsLeft, 2,1,0,0));
70 fHighlightFrame->Connect("Toggled(Bool_t)", "TEveShapeEditor", this, "DoHighlightFrame()");
71
72 AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
73 }
74}
75
76////////////////////////////////////////////////////////////////////////////////
77/// Set model object.
78
80{
81 fM = dynamic_cast<TEveShape*>(obj);
82
83 fLineWidth->SetNumber(fM->fLineWidth);
84 fLineColor->SetColor(TColor::Number2Pixel(fM->fLineColor), kFALSE);
85 fDrawFrame ->SetState(fM->fDrawFrame ? kButtonDown : kButtonUp);
86 fHighlightFrame->SetState(fM->fHighlightFrame ? kButtonDown : kButtonUp);
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Slot for setting line with of polygon outline.
91
93{
94 fM->SetLineWidth(fLineWidth->GetNumber());
95 Update();
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Slot for setting line color of polygon outline.
100
102{
103 fM->SetLineColor(TColor::GetColor(pixel));
104 Update();
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Slot for DrawFrame.
109
111{
112 fM->SetDrawFrame(fDrawFrame->IsOn());
113 Update();
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Slot for HighlightFrame.
118
120{
121 fM->SetHighlightFrame(fHighlightFrame->IsOn());
122 Update();
123}
@ kVerticalFrame
Definition GuiTypes.h:382
@ kHorizontalFrame
Definition GuiTypes.h:383
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define f(i)
Definition RSha256.hxx:104
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsTop
Definition TGLayout.h:27
static Int_t GetColor(const char *hexcolor)
static ULong_t Number2Pixel(Int_t ci)
void DoHighlightFrame()
Slot for HighlightFrame.
TGCheckButton * fDrawFrame
TGNumberEntry * fLineWidth
TEveShapeEditor(const TEveShapeEditor &)
TGColorSelect * fLineColor
void DoLineColor(Pixel_t color)
Slot for setting line color of polygon outline.
void SetModel(TObject *obj) override
Set model object.
void DoLineWidth()
Slot for setting line with of polygon outline.
TGCheckButton * fHighlightFrame
void DoDrawFrame()
Slot for DrawFrame.
Abstract base-class for 2D/3D shapes.
Definition TEveShape.h:26
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:1109
TGCompositeFrame(const TGCompositeFrame &)=delete
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
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.
@ kNEAPositive
Positive number.
@ kNESRealOne
Fixed fraction real, one digit.
@ 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:94
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Mother of all ROOT objects.
Definition TObject.h:42
TLine l
Definition textangle.C:4