#include "TEveElementEditor.h"
#include "TEveElement.h"
#include "TEveTransEditor.h"
#include "TVirtualPad.h"
#include "TColor.h"
#include "TGLabel.h"
#include "TGButton.h"
#include "TGNumberEntry.h"
#include "TGColorSelect.h"
#include "TGDoubleSlider.h"
ClassImp(TEveElementEditor);
TEveElementEditor::TEveElementEditor(const TGWindow *p,
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fRE (0),
fHFrame (0),
fPreLabel (0),
fRnrSelf (0),
fRnrChildren (0),
fRnrState (0),
fMainColor (0),
fTransparency (0),
fTrans (0)
{
MakeTitle("TEveElement");
fPriority = 0;
fHFrame = new TGHorizontalFrame(this);
fPreLabel = new TGLabel(fHFrame, "Show:");
fHFrame->AddFrame(fPreLabel, new TGLayoutHints(kLHintsLeft, 1, 6, 2, 0));
fRnrSelf = new TGCheckButton(fHFrame, "Self");
fHFrame->AddFrame(fRnrSelf, new TGLayoutHints(kLHintsLeft, 0, 2, 1, 1));
fRnrSelf->Connect
("Toggled(Bool_t)",
"TEveElementEditor", this, "DoRnrSelf()");
fRnrChildren = new TGCheckButton(fHFrame, "Children");
fHFrame->AddFrame(fRnrChildren, new TGLayoutHints(kLHintsLeft, 0, 1, 1, 1));
fRnrChildren->Connect
("Toggled(Bool_t)",
"TEveElementEditor", this, "DoRnrChildren()");
fRnrState = new TGCheckButton(fHFrame, "");
fHFrame->AddFrame(fRnrState, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
fRnrState->Connect
("Toggled(Bool_t)",
"TEveElementEditor", this, "DoRnrState()");
fMainColor = new TGColorSelect(fHFrame, 0, -1);
fHFrame->AddFrame(fMainColor, new TGLayoutHints(kLHintsLeft, 2, 0, -2, 0));
fMainColor->Connect
("ColorSelected(Pixel_t)",
"TEveElementEditor", this, "DoMainColor(Pixel_t)");
fTransparency = new TGNumberEntry(fHFrame, 0., 2, -1,
TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax, 0, 100);
fTransparency->SetHeight(18);
fTransparency->GetNumberEntry()->SetToolTipText("Transparency: 0 is opaque, 100 fully transparent.");
fHFrame->AddFrame(fTransparency, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
fTransparency->Connect
("ValueSet(Long_t)",
"TEveElementEditor", this, "DoTransparency()");
AddFrame(fHFrame, new TGLayoutHints(kLHintsTop, 0, 0, 0, 0));
fTrans = new TEveTransSubEditor(this);
fTrans->Connect("UseTrans()", "TEveElementEditor", this, "Update()");
fTrans->Connect("TransChanged()", "TEveElementEditor", this, "Update()");
AddFrame(fTrans, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 0, 0));
}
void TEveElementEditor::SetModel(TObject* obj)
{
fRE = dynamic_cast<TEveElement*>(obj);
fPreLabel ->UnmapWindow();
fRnrSelf ->UnmapWindow();
fRnrChildren->UnmapWindow();
fRnrState ->UnmapWindow();
if (fRE->CanEditElement()) {
fPreLabel->MapWindow();
if (fRE->SingleRnrState()) {
fRnrState->SetState(fRE->GetRnrState() ? kButtonDown : kButtonUp);
fRnrState->MapWindow();
} else {
fRnrSelf->SetState(fRE->GetRnrSelf() ? kButtonDown : kButtonUp);
fRnrChildren->SetState(fRE->GetRnrChildren() ? kButtonDown : kButtonUp);
fRnrSelf->MapWindow();
fRnrChildren->MapWindow();
}
}
if (fRE->CanEditMainColor()) {
fMainColor->SetColor(TColor::Number2Pixel(fRE->GetMainColor()), kFALSE);
fMainColor->MapWindow();
} else {
fMainColor->UnmapWindow();
}
if (fRE->CanEditMainTransparency()) {
fTransparency->SetNumber(fRE->GetMainTransparency());
fTransparency->MapWindow();
} else {
fTransparency->UnmapWindow();
}
if (fRE->CanEditMainTrans()) {
fTrans->SetModel(fRE->PtrMainTrans());
fTrans->MapWindow();
} else {
fTrans->UnmapWindow();
}
fHFrame->Layout();
}
void TEveElementEditor::DoRnrSelf()
{
fRE->SetRnrSelf(fRnrSelf->IsOn());
Update();
}
void TEveElementEditor::DoRnrChildren()
{
fRE->SetRnrChildren(fRnrChildren->IsOn());
Update();
}
void TEveElementEditor::DoRnrState()
{
fRE->SetRnrState(fRnrState->IsOn());
Update();
}
void TEveElementEditor::DoMainColor(Pixel_t color)
{
fRE->SetMainColorPixel(color);
Update();
}
void TEveElementEditor::DoTransparency()
{
fRE->SetMainTransparency((Char_t)(fTransparency->GetNumber()));
Update();
}
TEveElementEditor.cxx:100 TEveElementEditor.cxx:101 TEveElementEditor.cxx:102 TEveElementEditor.cxx:103 TEveElementEditor.cxx:104 TEveElementEditor.cxx:105 TEveElementEditor.cxx:106 TEveElementEditor.cxx:107 TEveElementEditor.cxx:108 TEveElementEditor.cxx:109 TEveElementEditor.cxx:110 TEveElementEditor.cxx:111 TEveElementEditor.cxx:112 TEveElementEditor.cxx:113 TEveElementEditor.cxx:114 TEveElementEditor.cxx:115 TEveElementEditor.cxx:116 TEveElementEditor.cxx:117 TEveElementEditor.cxx:118 TEveElementEditor.cxx:119 TEveElementEditor.cxx:120 TEveElementEditor.cxx:121 TEveElementEditor.cxx:122 TEveElementEditor.cxx:123 TEveElementEditor.cxx:124 TEveElementEditor.cxx:125 TEveElementEditor.cxx:126 TEveElementEditor.cxx:127 TEveElementEditor.cxx:128 TEveElementEditor.cxx:129 TEveElementEditor.cxx:130 TEveElementEditor.cxx:131 TEveElementEditor.cxx:132 TEveElementEditor.cxx:133 TEveElementEditor.cxx:134 TEveElementEditor.cxx:135 TEveElementEditor.cxx:136 TEveElementEditor.cxx:137 TEveElementEditor.cxx:138 TEveElementEditor.cxx:139 TEveElementEditor.cxx:140 TEveElementEditor.cxx:141 TEveElementEditor.cxx:142 TEveElementEditor.cxx:143 TEveElementEditor.cxx:144 TEveElementEditor.cxx:145 TEveElementEditor.cxx:146 TEveElementEditor.cxx:147 TEveElementEditor.cxx:148 TEveElementEditor.cxx:149 TEveElementEditor.cxx:150 TEveElementEditor.cxx:151 TEveElementEditor.cxx:152 TEveElementEditor.cxx:153 TEveElementEditor.cxx:154 TEveElementEditor.cxx:155 TEveElementEditor.cxx:156 TEveElementEditor.cxx:157 TEveElementEditor.cxx:158 TEveElementEditor.cxx:159 TEveElementEditor.cxx:160 TEveElementEditor.cxx:161 TEveElementEditor.cxx:162 TEveElementEditor.cxx:163 TEveElementEditor.cxx:164 TEveElementEditor.cxx:165 TEveElementEditor.cxx:166 TEveElementEditor.cxx:167 TEveElementEditor.cxx:168 TEveElementEditor.cxx:169 TEveElementEditor.cxx:170 TEveElementEditor.cxx:171 TEveElementEditor.cxx:172 TEveElementEditor.cxx:173 TEveElementEditor.cxx:174 TEveElementEditor.cxx:175 TEveElementEditor.cxx:176 TEveElementEditor.cxx:177 TEveElementEditor.cxx:178 TEveElementEditor.cxx:179 TEveElementEditor.cxx:180 TEveElementEditor.cxx:181 TEveElementEditor.cxx:182 TEveElementEditor.cxx:183 TEveElementEditor.cxx:184 TEveElementEditor.cxx:185 TEveElementEditor.cxx:186 TEveElementEditor.cxx:187 TEveElementEditor.cxx:188 TEveElementEditor.cxx:189 TEveElementEditor.cxx:190 TEveElementEditor.cxx:191 TEveElementEditor.cxx:192 TEveElementEditor.cxx:193 TEveElementEditor.cxx:194 TEveElementEditor.cxx:195 TEveElementEditor.cxx:196