Logo ROOT   6.10/09
Reference Guide
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 // Cleanup these includes:
18 #include "TGLabel.h"
19 #include "TGButton.h"
20 #include "TGNumberEntry.h"
21 #include "TGColorSelect.h"
22 #include "TGColorDialog.h"
23 
24 
25 /** \class TEveShapeEditor
26 \ingroup TEve
27 GUI editor for TEveShape.
28 */
29 
31 
32 ////////////////////////////////////////////////////////////////////////////////
33 /// Constructor.
34 
36  UInt_t options, Pixel_t back) :
37  TGedFrame(p, width, height, options | kVerticalFrame, back),
38  fM(0),
39  fLineWidth(0),
40  fLineColor(0),
41  fDrawFrame(0),
42  fHighlightFrame(0)
43 {
44  MakeTitle("TEveShape");
45 
46  {
48 
49  TGLabel *l = new TGLabel(f, "LineColor:");
50  f->AddFrame(l, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 0));
51  fLineColor = new TGColorSelect(f, 0, -1);
52  fLineColor->Connect("ColorSelected(Pixel_t)", "TEveShapeEditor", this, "DoLineColor(Pixel_t)");
53  f->AddFrame(fLineColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
54 
55  fLineWidth = new TGNumberEntry(f, 0., 4, -1,
58  fLineWidth->GetNumberEntry()->SetToolTipText("Line width of outline.");
59  fLineWidth->Connect("ValueSet(Long_t)", "TEveShapeEditor", this, "DoLineWidth()");
60  f->AddFrame(fLineWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
61 
62  AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
63  }
64  {
66 
67  fDrawFrame = new TGCheckButton(f, "Draw Frame");
68  f->AddFrame(fDrawFrame, new TGLayoutHints(kLHintsLeft, 1,2,0,0));
69  fDrawFrame->Connect("Toggled(Bool_t)", "TEveShapeEditor", this, "DoDrawFrame()");
70 
71  fHighlightFrame = new TGCheckButton(f, "Highlight Frame");
73  fHighlightFrame->Connect("Toggled(Bool_t)", "TEveShapeEditor", this, "DoHighlightFrame()");
74 
75  AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
76  }
77 }
78 
79 ////////////////////////////////////////////////////////////////////////////////
80 /// Set model object.
81 
83 {
84  fM = dynamic_cast<TEveShape*>(obj);
85 
90 }
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 /// Slot for setting line with of polygon outline.
94 
96 {
98  Update();
99 }
100 
101 ////////////////////////////////////////////////////////////////////////////////
102 /// Slot for setting line color of polygon outline.
103 
105 {
107  Update();
108 }
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 /// Slot for DrawFrame.
112 
114 {
116  Update();
117 }
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// Slot for HighlightFrame.
121 
123 {
125  Update();
126 }
void DoHighlightFrame()
Slot for HighlightFrame.
Abstract base-class for 2D/3D shapes.
Definition: TEveShape.h:22
GUI editor for TEveShape.
virtual void SetHighlightFrame(Bool_t f)
Definition: TEveShape.h:63
virtual void SetModel(TObject *obj)
Set model object.
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
void SetColor(Pixel_t color, Bool_t emit=kTRUE)
Set color.
virtual void SetNumber(Double_t val)
virtual void SetLineWidth(Float_t lw)
Definition: TEveShape.h:61
virtual void SetLineColor(Color_t c)
Definition: TEveShape.h:60
TGCheckButton * fHighlightFrame
TGCheckButton * fDrawFrame
int Int_t
Definition: RtypesCore.h:41
Bool_t fHighlightFrame
Definition: TEveShape.h:42
TGNumberEntry * fLineWidth
Float_t fLineWidth
Definition: TEveShape.h:39
void DoDrawFrame()
Slot for DrawFrame.
void DoLineColor(Pixel_t color)
Slot for setting line color of polygon outline.
ULong_t Pixel_t
Definition: GuiTypes.h:39
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
TGCompositeFrame(const TGCompositeFrame &)
virtual void SetDrawFrame(Bool_t f)
Definition: TEveShape.h:62
virtual Bool_t IsOn() const
Definition: TGButton.h:311
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:867
TEveShape * fM
unsigned int UInt_t
Definition: RtypesCore.h:42
TEveShapeEditor(const TEveShapeEditor &)
TLine * l
Definition: textangle.C:4
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb"...
Definition: TColor.cxx:1707
TGColorSelect * fLineColor
const Bool_t kFALSE
Definition: RtypesCore.h:92
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:1917
Bool_t fDrawFrame
Definition: TEveShape.h:41
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
virtual Double_t GetNumber() const
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
void DoLineWidth()
Slot for setting line with of polygon outline.
Mother of all ROOT objects.
Definition: TObject.h:37
TGNumberEntryField * GetNumberEntry() const
Color_t fLineColor
Definition: TEveShape.h:38
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96