Logo ROOT   6.14/05
Reference Guide
TGLLightSetEditor.cxx
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Matevz Tadel, Feb 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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 "TGLLightSetEditor.h"
13 #include <TGLLightSet.h>
14 
15 #include <TVirtualPad.h>
16 #include <TColor.h>
17 
18 #include <TGLabel.h>
19 #include <TGButton.h>
20 #include <TGNumberEntry.h>
21 #include <TGColorSelect.h>
22 #include <TGDoubleSlider.h>
23 
24 /** \class TGLLightSetSubEditor
25 \ingroup opengl
26 Sub-editor for TGLLightSet.
27 */
28 
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 
34  TGVerticalFrame(p),
35  fM (0),
36 
37  fLightFrame (0),
38  fTopLight (0),
39  fRightLight (0),
40  fBottomLight (0),
41  fLeftLight (0),
42  fFrontLight (0),
43  fSpecularLight (0)
44 {
45  // Constructor.
46 
47  fLightFrame = new TGGroupFrame(this, "Light sources:", kVerticalFrame);//, kLHintsTop | kLHintsCenterX);
50  TGCompositeFrame* hf =0;
51 
56 
61 
65 
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Create a button for given lamp and set it up.
71 
73  TGCompositeFrame* parent)
74 {
75  TGButton* b = new TGCheckButton(parent, name, wid);
76  parent->AddFrame(b, new TGLayoutHints(kLHintsNormal|kLHintsExpandX, -2, 0, 0, 2));
77  b->Connect("Clicked()", "TGLLightSetSubEditor", this, "DoButton()");
78  return b;
79 }
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// New model was set, refresh data.
83 
85 {
86  fM = m;
87  UInt_t als = fM->GetLightState();
88 
92  fLeftLight ->SetState((als & TGLLightSet::kLightLeft) ? kButtonDown : kButtonUp);
94 
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// Data in sub-editor has been changed, emit "Changed()" signal.
100 
102 {
103  Emit("Changed()");
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// Lights radio button was clicked.
108 
110 {
113  Changed();
114 }
115 
116 
117 //______________________________________________________________________________
118 // TGLLightSetEditor
119 //
120 // Editor for TGLLightSet.
121 
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// Constructor.
126 
128  Int_t width, Int_t height,
129  UInt_t options, Pixel_t back) :
130  TGedFrame(p, width, height, options | kVerticalFrame, back),
131  fM (0),
132  fSE (0)
133 {
134  MakeTitle("TGLLightSet");
135 
136  fSE = new TGLLightSetSubEditor(this);
137  AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
138  fSE->Connect("Changed()", "TGLLightSetEditor", this, "Update()");
139 }
140 
141 ////////////////////////////////////////////////////////////////////////////////
142 /// Destructor.
143 
145 {
146 }
147 
148 ////////////////////////////////////////////////////////////////////////////////
149 /// SetModel ... forward to sub-editor.
150 
152 {
153  fM = dynamic_cast<TGLLightSet*>(obj);
154  fSE->SetModel(fM);
155 }
void DoButton()
Lights radio button was clicked.
void SetLight(ELight light, Bool_t on)
Set a light on/off.
Definition: TGLLightSet.cxx:55
auto * m
Definition: textangle.C:8
virtual Bool_t IsOn() const
Definition: TGButton.h:119
R__EXTERN void * gTQSender
Definition: TQObject.h:45
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
Definition: TGaxis.cxx:2551
Int_t WidgetId() const
Definition: TGWidget.h:80
TGGroupFrame * fLightFrame
int Int_t
Definition: RtypesCore.h:41
TGLLightSetEditor(const TGLLightSetEditor &)
Encapsulates a set of lights for OpenGL.
Definition: TGLLightSet.h:21
TGButton * MakeLampButton(const char *name, Int_t wid, TGCompositeFrame *parent)
Create a button for given lamp and set it up.
void Changed()
Data in sub-editor has been changed, emit "Changed()" signal.
virtual void SetTitlePos(ETitlePos pos=kLeft)
Definition: TGFrame.h:651
ULong_t Pixel_t
Definition: GuiTypes.h:39
Sub-editor for TGLLightSet.
UInt_t GetLightState()
Definition: TGLLightSet.h:49
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
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void SetModel(TObject *obj)
SetModel ... forward to sub-editor.
void SetModel(TGLLightSet *m)
New model was set, refresh data.
virtual ~TGLLightSetEditor()
Destructor.
#define ClassImp(name)
Definition: Rtypes.h:359
TGLLightSetSubEditor * fSE
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:37
Bool_t GetUseSpecular() const
Definition: TGLLightSet.h:51
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
TGLLightSetSubEditor(const TGLLightSetSubEditor &)
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
char name[80]
Definition: TGX11.cxx:109
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185