#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:", kLHintsTop | kLHintsCenterX);
   fLightFrame->SetTitlePos(TGGroupFrame::kLeft);
   AddFrame(fLightFrame, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
   TGMatrixLayout *ml = new TGMatrixLayout(fLightFrame, 0, 1, 10);
   fLightFrame->SetLayoutManager(ml);
   fTopLight      = MakeLampButton("Top",      TGLLightSet::kLightTop);
   fRightLight    = MakeLampButton("Right",    TGLLightSet::kLightRight);
   fBottomLight   = MakeLampButton("Bottom",   TGLLightSet::kLightBottom);
   fLeftLight     = MakeLampButton("Left",     TGLLightSet::kLightLeft);
   fFrontLight    = MakeLampButton("Front",    TGLLightSet::kLightFront);
   fSpecularLight = MakeLampButton("Specular", TGLLightSet::kLightSpecular);
}
TGButton* TGLLightSetSubEditor::MakeLampButton(const Text_t* name, Int_t wid)
{
   
   TGButton* b = new TGCheckButton(fLightFrame, name,  wid);
   fLightFrame->AddFrame(b);
   b->Connect("Clicked()", "TGLLightSetSubEditor", this, "DoButton()");
   return b;
}
void TGLLightSetSubEditor::SetModel(TGLLightSet* m)
{
   
   fM = m;
   UInt_t ls = fM->GetLightState();
   fTopLight   ->SetState((ls & TGLLightSet::kLightTop)    ? kButtonDown : kButtonUp);
   fRightLight ->SetState((ls & TGLLightSet::kLightRight)  ? kButtonDown : kButtonUp);
   fBottomLight->SetState((ls & TGLLightSet::kLightBottom) ? kButtonDown : kButtonUp);
   fLeftLight  ->SetState((ls & TGLLightSet::kLightLeft)   ? kButtonDown : kButtonUp);
   fFrontLight ->SetState((ls & 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);
}
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.