#include "TGLLightSetEditor.h"
#include <TGLLightSet.h>
#include <TVirtualPad.h>
#include <TColor.h>
#include <TGLabel.h>
#include <TGButton.h>
#include <TGNumberEntry.h>
#include <TGColorSelect.h>
#include <TGDoubleSlider.h>
ClassImp(TGLLightSetSubEditor)
TGLLightSetSubEditor::TGLLightSetSubEditor(const TGWindow *p) :
TGVerticalFrame(p),
fM (0),
fLightFrame (0),
fTopLight (0),
fRightLight (0),
fBottomLight (0),
fLeftLight (0),
fFrontLight (0),
fSpecularLight (0)
{
fLightFrame = new TGGroupFrame(this, "Light sources:", kVerticalFrame);
fLightFrame->SetTitlePos(TGGroupFrame::kLeft);
AddFrame(fLightFrame, new TGLayoutHints(kLHintsTop| kLHintsExpandX, 1, 1, 1, 1));
TGCompositeFrame* hf =0;
hf = new TGHorizontalFrame(fLightFrame);
fTopLight = MakeLampButton("Top", TGLLightSet::kLightTop, hf);
fBottomLight = MakeLampButton("Bottom", TGLLightSet::kLightBottom, hf);
fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 2, 2));
hf = new TGHorizontalFrame(fLightFrame);
fLeftLight = MakeLampButton("Left", TGLLightSet::kLightLeft, hf);
fRightLight = MakeLampButton("Right", TGLLightSet::kLightRight, hf);
fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX , 0, 0, 0, 2));
hf = new TGHorizontalFrame(fLightFrame);
fFrontLight = MakeLampButton("Front", TGLLightSet::kLightFront, hf);
fSpecularLight = MakeLampButton("Specular", TGLLightSet::kLightSpecular, hf);
fLightFrame->AddFrame(hf, new TGLayoutHints(kLHintsTop|kLHintsExpandX, 0, 0, 0, 2));
}
TGButton* TGLLightSetSubEditor::MakeLampButton(const char* name, Int_t wid,
TGCompositeFrame* parent)
{
TGButton* b = new TGCheckButton(parent, name, wid);
parent->AddFrame(b, new TGLayoutHints(kLHintsNormal|kLHintsExpandX, -2, 0, 0, 2));
b->Connect("Clicked()", "TGLLightSetSubEditor", this, "DoButton()");
return b;
}
void TGLLightSetSubEditor::SetModel(TGLLightSet* m)
{
fM = m;
UInt_t als = fM->GetLightState();
fTopLight ->SetState((als & TGLLightSet::kLightTop) ? kButtonDown : kButtonUp);
fRightLight ->SetState((als & TGLLightSet::kLightRight) ? kButtonDown : kButtonUp);
fBottomLight->SetState((als & TGLLightSet::kLightBottom) ? kButtonDown : kButtonUp);
fLeftLight ->SetState((als & TGLLightSet::kLightLeft) ? kButtonDown : kButtonUp);
fFrontLight ->SetState((als & TGLLightSet::kLightFront) ? kButtonDown : kButtonUp);
fSpecularLight->SetState(fM->GetUseSpecular() ? kButtonDown : kButtonUp);
}
void TGLLightSetSubEditor::Changed()
{
Emit("Changed()");
}
void TGLLightSetSubEditor::DoButton()
{
TGButton* b = (TGButton*) gTQSender;
fM->SetLight(TGLLightSet::ELight(b->WidgetId()), b->IsOn());
Changed();
}
ClassImp(TGLLightSetEditor)
TGLLightSetEditor::TGLLightSetEditor(const TGWindow *p,
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM (0),
fSE (0)
{
MakeTitle("TGLLightSet");
fSE = new TGLLightSetSubEditor(this);
AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
fSE->Connect("Changed()", "TGLLightSetEditor", this, "Update()");
}
TGLLightSetEditor::~TGLLightSetEditor()
{
}
void TGLLightSetEditor::SetModel(TObject* obj)
{
fM = dynamic_cast<TGLLightSet*>(obj);
fSE->SetModel(fM);
}
TGLLightSetEditor.cxx:100 TGLLightSetEditor.cxx:101 TGLLightSetEditor.cxx:102 TGLLightSetEditor.cxx:103 TGLLightSetEditor.cxx:104 TGLLightSetEditor.cxx:105 TGLLightSetEditor.cxx:106 TGLLightSetEditor.cxx:107 TGLLightSetEditor.cxx:108 TGLLightSetEditor.cxx:109 TGLLightSetEditor.cxx:110 TGLLightSetEditor.cxx:111 TGLLightSetEditor.cxx:112 TGLLightSetEditor.cxx:113 TGLLightSetEditor.cxx:114 TGLLightSetEditor.cxx:115 TGLLightSetEditor.cxx:116 TGLLightSetEditor.cxx:117 TGLLightSetEditor.cxx:118 TGLLightSetEditor.cxx:119 TGLLightSetEditor.cxx:120 TGLLightSetEditor.cxx:121 TGLLightSetEditor.cxx:122 TGLLightSetEditor.cxx:123 TGLLightSetEditor.cxx:124 TGLLightSetEditor.cxx:125 TGLLightSetEditor.cxx:126 TGLLightSetEditor.cxx:127 TGLLightSetEditor.cxx:128 TGLLightSetEditor.cxx:129 TGLLightSetEditor.cxx:130 TGLLightSetEditor.cxx:131 TGLLightSetEditor.cxx:132 TGLLightSetEditor.cxx:133 TGLLightSetEditor.cxx:134 TGLLightSetEditor.cxx:135 TGLLightSetEditor.cxx:136 TGLLightSetEditor.cxx:137 TGLLightSetEditor.cxx:138 TGLLightSetEditor.cxx:139 TGLLightSetEditor.cxx:140 TGLLightSetEditor.cxx:141 TGLLightSetEditor.cxx:142 TGLLightSetEditor.cxx:143 TGLLightSetEditor.cxx:144 TGLLightSetEditor.cxx:145 TGLLightSetEditor.cxx:146 TGLLightSetEditor.cxx:147 TGLLightSetEditor.cxx:148 TGLLightSetEditor.cxx:149 TGLLightSetEditor.cxx:150 TGLLightSetEditor.cxx:151 TGLLightSetEditor.cxx:152 TGLLightSetEditor.cxx:153