#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 Text_t* 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);
}
Last change: Wed Jun 25 08:41:01 2008
Last generated: 2008-06-25 08:41
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.