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
23
24////////////////////////////////////////////////////////////////////////////////
25
28 fM (nullptr),
29
30 fLightFrame (nullptr),
31 fTopLight (nullptr),
32 fRightLight (nullptr),
33 fBottomLight (nullptr),
34 fLeftLight (nullptr),
35 fFrontLight (nullptr),
36 fSpecularLight (nullptr)
37{
38 // Constructor.
39
40 fLightFrame = new TGGroupFrame(this, "Light sources:", kVerticalFrame);//, kLHintsTop | kLHintsCenterX);
41 fLightFrame->SetTitlePos(TGGroupFrame::kLeft);
43 TGCompositeFrame* hf =nullptr;
44
48 fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 2, 2));
49
53 fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX , 0, 0, 0, 2));
54
58
59 fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 0, 2));
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// Create a button for given lamp and set it up.
64
66 TGCompositeFrame* parent)
67{
68 TGButton* b = new TGCheckButton(parent, name, wid);
69 parent->AddFrame(b, new TGLayoutHints(kLHintsNormal|kLHintsExpandX, -2, 0, 0, 2));
70 b->Connect("Clicked()", "TGLLightSetSubEditor", this, "DoButton()");
71 return b;
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// New model was set, refresh data.
76
78{
79 fM = m;
80 UInt_t als = fM->GetLightState();
81
87
88 fSpecularLight->SetState(fM->GetUseSpecular() ? kButtonDown : kButtonUp);
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Data in sub-editor has been changed, emit "Changed()" signal.
93
95{
96 Emit("Changed()");
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Lights radio button was clicked.
101
103{
105 fM->SetLight(TGLLightSet::ELight(b->WidgetId()), b->IsOn());
106 Changed();
107}
108
109
110//______________________________________________________________________________
111// TGLLightSetEditor
112//
113// Editor for TGLLightSet.
114
116
117////////////////////////////////////////////////////////////////////////////////
118/// Constructor.
119
122 UInt_t options, Pixel_t back) :
123 TGedFrame(p, width, height, options | kVerticalFrame, back),
124 fM (nullptr),
125 fSE (nullptr)
126{
127 MakeTitle("TGLLightSet");
128
129 fSE = new TGLLightSetSubEditor(this);
130 AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
131 fSE->Connect("Changed()", "TGLLightSetEditor", this, "Update()");
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Destructor.
136
140
141////////////////////////////////////////////////////////////////////////////////
142/// SetModel ... forward to sub-editor.
143
145{
146 fM = dynamic_cast<TGLLightSet*>(obj);
147 fSE->SetModel(fM);
148}
@ kVerticalFrame
Definition GuiTypes.h:381
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define b(i)
Definition RSha256.hxx:100
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
#define ClassImp(name)
Definition Rtypes.h:377
@ 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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition TGX11.cxx:110
R__EXTERN void * 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:1117
TGCompositeFrame(const TGCompositeFrame &)=delete
A composite frame with a border and a title.
Definition TGFrame.h:522
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
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:376
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:95
Mother of all ROOT objects.
Definition TObject.h:41
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
TMarker m
Definition textangle.C:8