Logo ROOT  
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
26Sub-editor for TGLLightSet.
27*/
28
30
31////////////////////////////////////////////////////////////////////////////////
32
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
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{
112 fM->SetLight(TGLLightSet::ELight(b->WidgetId()), b->IsOn());
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}
@ kVerticalFrame
Definition: GuiTypes.h:381
ULong_t Pixel_t
Definition: GuiTypes.h:39
#define b(i)
Definition: RSha256.hxx:100
#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
@ kLHintsNormal
Definition: TGLayout.h:39
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
char name[80]
Definition: TGX11.cxx:109
R__EXTERN void * gTQSender
Definition: TQObject.h:44
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:187
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 SetTitlePos(ETitlePos pos=kLeft)
Definition: TGFrame.h:629
virtual void SetModel(TObject *obj)
SetModel ... forward to sub-editor.
TGLLightSetEditor(const TGLLightSetEditor &)
virtual ~TGLLightSetEditor()
Destructor.
TGLLightSetSubEditor * fSE
Sub-editor for TGLLightSet.
void SetModel(TGLLightSet *m)
New model was set, refresh data.
TGGroupFrame * fLightFrame
void DoButton()
Lights radio button was clicked.
TGButton * MakeLampButton(const char *name, Int_t wid, TGCompositeFrame *parent)
Create a button for given lamp and set it up.
TGLLightSetSubEditor(const TGLLightSetSubEditor &)
void Changed()
Data in sub-editor has been changed, emit "Changed()" signal.
Encapsulates a set of lights for OpenGL.
Definition: TGLLightSet.h:22
Bool_t GetUseSpecular() const
Definition: TGLLightSet.h:51
void SetLight(ELight light, Bool_t on)
Set a light on/off.
Definition: TGLLightSet.cxx:55
UInt_t GetLightState()
Definition: TGLLightSet.h:49
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Mother of all ROOT objects.
Definition: TObject.h:37
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
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
auto * m
Definition: textangle.C:8