Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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 <TGButton.h>
16
17/** \class TGLLightSetSubEditor
18\ingroup opengl
19Sub-editor for TGLLightSet.
20*/
21
22
23////////////////////////////////////////////////////////////////////////////////
24
27 fM (nullptr),
28
29 fLightFrame (nullptr),
30 fTopLight (nullptr),
31 fRightLight (nullptr),
32 fBottomLight (nullptr),
33 fLeftLight (nullptr),
34 fFrontLight (nullptr),
35 fSpecularLight (nullptr)
36{
37 // Constructor.
38
39 fLightFrame = new TGGroupFrame(this, "Light sources:", kVerticalFrame);//, kLHintsTop | kLHintsCenterX);
40 fLightFrame->SetTitlePos(TGGroupFrame::kLeft);
42 TGCompositeFrame* hf =nullptr;
43
47 fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 2, 2));
48
52 fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX , 0, 0, 0, 2));
53
57
58 fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 0, 2));
59}
60
61////////////////////////////////////////////////////////////////////////////////
62/// Create a button for given lamp and set it up.
63
65 TGCompositeFrame* parent)
66{
67 TGButton* b = new TGCheckButton(parent, name, wid);
68 parent->AddFrame(b, new TGLayoutHints(kLHintsNormal|kLHintsExpandX, -2, 0, 0, 2));
69 b->Connect("Clicked()", "TGLLightSetSubEditor", this, "DoButton()");
70 return b;
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// New model was set, refresh data.
75
77{
78 fM = m;
79 UInt_t als = fM->GetLightState();
80
86
87 fSpecularLight->SetState(fM->GetUseSpecular() ? kButtonDown : kButtonUp);
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Data in sub-editor has been changed, emit "Changed()" signal.
92
94{
95 Emit("Changed()");
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Lights radio button was clicked.
100
102{
104 fM->SetLight(TGLLightSet::ELight(b->WidgetId()), b->IsOn());
105 Changed();
106}
107
108
109//______________________________________________________________________________
110// TGLLightSetEditor
111//
112// Editor for TGLLightSet.
113
114
115////////////////////////////////////////////////////////////////////////////////
116/// Constructor.
117
119 Int_t width, Int_t height,
120 UInt_t options, Pixel_t back) :
121 TGedFrame(p, width, height, options | kVerticalFrame, back),
122 fM (nullptr),
123 fSE (nullptr)
124{
125 MakeTitle("TGLLightSet");
126
127 fSE = new TGLLightSetSubEditor(this);
128 AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
129 fSE->Connect("Changed()", "TGLLightSetEditor", this, "Update()");
130}
131
132////////////////////////////////////////////////////////////////////////////////
133/// Destructor.
134
138
139////////////////////////////////////////////////////////////////////////////////
140/// SetModel ... forward to sub-editor.
141
143{
144 fM = dynamic_cast<TGLLightSet*>(obj);
145 fSE->SetModel(fM);
146}
@ kVerticalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
#define b(i)
Definition RSha256.hxx:100
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
@ kButtonDown
Definition TGButton.h:54
@ kButtonUp
Definition TGButton.h:53
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
char name[80]
Definition TGX11.cxx:148
externvoid * gTQSender
Definition TQObject.h:46
A button abstract base class.
Definition TGButton.h:68
Selects different options.
Definition TGButton.h:264
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 with a border and a title.
Definition TGFrame.h:532
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
void SetModel(TObject *obj) override
SetModel ... forward to sub-editor.
TGLLightSetEditor(const TGLLightSetEditor &)=delete
TGLLightSetSubEditor * fSE
~TGLLightSetEditor() override
Destructor.
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 &)=delete
void Changed()
Data in sub-editor has been changed, emit "Changed()" signal.
Encapsulates a set of lights for OpenGL.
Definition TGLLightSet.h:22
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGVerticalFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Definition TGFrame.h:378
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
Mother of all ROOT objects.
Definition TObject.h:42
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
TMarker m
Definition textangle.C:8