29 ClassImp(TGLLightSetSubEditor);
33 TGLLightSetSubEditor::TGLLightSetSubEditor(
const TGWindow *p) :
47 fLightFrame =
new TGGroupFrame(
this,
"Light sources:", kVerticalFrame);
48 fLightFrame->SetTitlePos(TGGroupFrame::kLeft);
49 AddFrame(fLightFrame,
new TGLayoutHints(kLHintsTop| kLHintsExpandX, 1, 1, 1, 1));
50 TGCompositeFrame* hf =0;
52 hf =
new TGHorizontalFrame(fLightFrame);
53 fTopLight = MakeLampButton(
"Top", TGLLightSet::kLightTop, hf);
54 fBottomLight = MakeLampButton(
"Bottom", TGLLightSet::kLightBottom, hf);
55 fLightFrame->AddFrame(hf,
new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 2, 2));
57 hf =
new TGHorizontalFrame(fLightFrame);
58 fLeftLight = MakeLampButton(
"Left", TGLLightSet::kLightLeft, hf);
59 fRightLight = MakeLampButton(
"Right", TGLLightSet::kLightRight, hf);
60 fLightFrame->AddFrame(hf,
new TGLayoutHints(kLHintsTop|kLHintsExpandX , 0, 0, 0, 2));
62 hf =
new TGHorizontalFrame(fLightFrame);
63 fFrontLight = MakeLampButton(
"Front", TGLLightSet::kLightFront, hf);
64 fSpecularLight = MakeLampButton(
"Specular", TGLLightSet::kLightSpecular, hf);
66 fLightFrame->AddFrame(hf,
new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 0, 2));
72 TGButton* TGLLightSetSubEditor::MakeLampButton(
const char* name, Int_t wid,
73 TGCompositeFrame* parent)
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()");
84 void TGLLightSetSubEditor::SetModel(TGLLightSet* m)
87 UInt_t als = fM->GetLightState();
89 fTopLight ->SetState((als & TGLLightSet::kLightTop) ? kButtonDown : kButtonUp);
90 fRightLight ->SetState((als & TGLLightSet::kLightRight) ? kButtonDown : kButtonUp);
91 fBottomLight->SetState((als & TGLLightSet::kLightBottom) ? kButtonDown : kButtonUp);
92 fLeftLight ->SetState((als & TGLLightSet::kLightLeft) ? kButtonDown : kButtonUp);
93 fFrontLight ->SetState((als & TGLLightSet::kLightFront) ? kButtonDown : kButtonUp);
95 fSpecularLight->SetState(fM->GetUseSpecular() ? kButtonDown : kButtonUp);
101 void TGLLightSetSubEditor::Changed()
109 void TGLLightSetSubEditor::DoButton()
111 TGButton* b = (TGButton*) gTQSender;
112 fM->SetLight(TGLLightSet::ELight(b->WidgetId()), b->IsOn());
122 ClassImp(TGLLightSetEditor);
127 TGLLightSetEditor::TGLLightSetEditor(
const TGWindow *p,
128 Int_t width, Int_t height,
129 UInt_t options, Pixel_t back) :
130 TGedFrame(p, width, height, options | kVerticalFrame, back),
134 MakeTitle(
"TGLLightSet");
136 fSE =
new TGLLightSetSubEditor(
this);
137 AddFrame(fSE,
new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
138 fSE->Connect(
"Changed()",
"TGLLightSetEditor",
this,
"Update()");
144 TGLLightSetEditor::~TGLLightSetEditor()
151 void TGLLightSetEditor::SetModel(TObject* obj)
153 fM =
dynamic_cast<TGLLightSet*
>(obj);