/*
<img src="gif/TAttFillEditor.gif">
*/
//End_Html
#include "TAttFillEditor.h"
#include "TGedPatternSelect.h"
#include "TGColorSelect.h"
#include "TColor.h"
ClassImp(TAttFillEditor)
enum EFillWid {
kCOLOR,
kPATTERN
};
TAttFillEditor::TAttFillEditor(const TGWindow *p, Int_t width,
Int_t height, UInt_t options, Pixel_t back)
: TGedFrame(p, width, height, options | kVerticalFrame, back)
{
fPriority = 2;
fAttFill = 0;
MakeTitle("Fill");
TGCompositeFrame *f2 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
fColorSelect = new TGColorSelect(f2, 0, kCOLOR);
f2->AddFrame(fColorSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
fColorSelect->Associate(this);
fPatternSelect = new TGedPatternSelect(f2, 1, kPATTERN);
f2->AddFrame(fPatternSelect, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
fPatternSelect->Associate(this);
AddFrame(f2, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
}
TAttFillEditor::~TAttFillEditor()
{
}
void TAttFillEditor::ConnectSignals2Slots()
{
fColorSelect->Connect("ColorSelected(Pixel_t)", "TAttFillEditor", this, "DoFillColor(Pixel_t)");
fPatternSelect->Connect("PatternSelected(Style_t)", "TAttFillEditor", this, "DoFillPattern(Style_t)");
fInit = kFALSE;
}
void TAttFillEditor::SetModel(TObject* obj)
{
fAttFill = dynamic_cast<TAttFill *>(obj);
fAvoidSignal = kTRUE;
Color_t c = fAttFill->GetFillColor();
Pixel_t p = TColor::Number2Pixel(c);
fColorSelect->SetColor(p, kFALSE);
Style_t s = fAttFill->GetFillStyle();
fPatternSelect->SetPattern(s, kFALSE);
if (fInit) ConnectSignals2Slots();
fAvoidSignal = kFALSE;
}
void TAttFillEditor::DoFillColor(Pixel_t color)
{
if (fAvoidSignal) return;
fAttFill->SetFillColor(TColor::GetColor(color));
Update();
}
void TAttFillEditor::DoFillPattern(Style_t pattern)
{
if (fAvoidSignal) return;
fAttFill->SetFillStyle(pattern);
Update();
}
Last change: Wed Jun 25 08:34:53 2008
Last generated: 2008-06-25 08:34
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.