![]() |
![]() |
#include <FWColorSelect.h>
Public Member Functions | |
ClassDef (FWColorSelect, 0) | |
void | ColorChosen (Color_t) |
FWColorSelect (const TGWindow *p, const char *label, Color_t colorIndex, const FWColorManager *, Int_t id) | |
virtual Bool_t | HandleButton (Event_t *event) |
const std::string & | label () const |
void | SetColorByIndex (Color_t iColor, Bool_t iSendSignal) |
void | SetColorByIndex (Color_t iColor) |
void | UpdateColors () |
~FWColorSelect () | |
Private Attributes | |
const FWColorManager * | fColorManager |
FWColorPopup * | fFireworksPopup |
std::string | fLabel |
Color_t | fSelectedColor |
Definition at line 116 of file FWColorSelect.h.
FWColorSelect::FWColorSelect | ( | const TGWindow * | p, |
const char * | label, | ||
Color_t | colorIndex, | ||
const FWColorManager * | iManager, | ||
Int_t | id | ||
) |
Definition at line 332 of file FWColorSelect.cc.
References colors, FWColorManager::colorsHaveChanged_, fColorManager, fFireworksPopup, FWColorManager::fillLimitedColors(), fLabel, FWColorPopup::InitContent(), and UpdateColors().
: TGColorSelect(p, TColor::Number2Pixel(index), id), fLabel(label), fSelectedColor(index), fFireworksPopup(0), fColorManager(iManager) { std::vector<Color_t> colors; fColorManager->fillLimitedColors(colors); fFireworksPopup = new FWColorPopup(gClient->GetDefaultRoot(), fColor); fFireworksPopup->InitContent(fLabel.c_str(), colors); fFireworksPopup->Connect("ColorSelected(Color_t)","FWColorSelect", this, "SetColorByIndex(Color_t)"); fColorManager->colorsHaveChanged_.connect(boost::bind(&FWColorSelect::UpdateColors,this)); }
FWColorSelect::~FWColorSelect | ( | ) |
Definition at line 350 of file FWColorSelect.cc.
References fFireworksPopup.
{ delete fFireworksPopup; }
FWColorSelect::ClassDef | ( | FWColorSelect | , |
0 | |||
) |
void FWColorSelect::ColorChosen | ( | Color_t | iColor | ) |
Definition at line 425 of file FWColorSelect.cc.
Referenced by SetColorByIndex().
{
Emit("ColorChosen(Color_t)", iColor);
}
Bool_t FWColorSelect::HandleButton | ( | Event_t * | event | ) | [virtual] |
Definition at line 355 of file FWColorSelect.cc.
References FWColorManager::backgroundColorIndex(), colors, fColorManager, fFireworksPopup, FWColorManager::fillLimitedColors(), fSelectedColor, FWColorManager::kBlackIndex, FWColorPopup::PlacePopup(), FWColorPopup::ResetColors(), and FWColorPopup::SetSelection().
{ TGFrame::HandleButton(event); if (!IsEnabled()) return kTRUE; if (event->fCode != kButton1) return kFALSE; if ((event->fType == kButtonPress) && HasFocus()) WantFocus(); if (event->fType == kButtonPress) { fPressPos.fX = fX; fPressPos.fY = fY; if (fState != kButtonDown) { fPrevState = fState; SetState(kButtonDown); } } else { if (fState != kButtonUp) { SetState(kButtonUp); // case when it was dragged during guibuilding if ((fPressPos.fX != fX) || (fPressPos.fY != fY)) { return kFALSE; } Window_t wdummy; Int_t ax, ay; std::vector<Color_t> colors; fColorManager->fillLimitedColors(colors); fFireworksPopup->ResetColors(colors, fColorManager->backgroundColorIndex()==FWColorManager::kBlackIndex); fFireworksPopup->SetSelection(fSelectedColor); gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(), 0, fHeight, ax, ay, wdummy); fFireworksPopup->PlacePopup(ax, ay, fFireworksPopup->GetDefaultWidth(), fFireworksPopup->GetDefaultHeight()); } } return kTRUE; }
const std::string& FWColorSelect::label | ( | ) | const [inline] |
void FWColorSelect::SetColorByIndex | ( | Color_t | iColor | ) |
Definition at line 403 of file FWColorSelect.cc.
Referenced by CmsShowCommonPopup::CmsShowCommonPopup(), CmsShowModelPopup::colorSetChanged(), CmsShowEDI::colorSetChanged(), CmsShowModelPopup::disconnectAll(), CmsShowEDI::disconnectAll(), CmsShowEDI::fillEDIFrame(), CmsShowModelPopup::fillModelPopup(), CmsShowModelPopup::updateDisplay(), and CmsShowEDI::updateDisplay().
{ SetColorByIndex(iColor, kTRUE); }
void FWColorSelect::SetColorByIndex | ( | Color_t | iColor, |
Bool_t | iSendSignal | ||
) |
Definition at line 409 of file FWColorSelect.cc.
References ColorChosen(), and fSelectedColor.
{ fSelectedColor = iColor; SetColor(TColor::Number2Pixel(iColor), kFALSE); if (iSendSignal) { ColorChosen(fSelectedColor); } }
void FWColorSelect::UpdateColors | ( | ) |
Definition at line 419 of file FWColorSelect.cc.
References fSelectedColor.
Referenced by FWColorSelect().
{ SetColor(fSelectedColor, kFALSE); }
const FWColorManager* FWColorSelect::fColorManager [private] |
Definition at line 122 of file FWColorSelect.h.
Referenced by FWColorSelect(), and HandleButton().
FWColorPopup* FWColorSelect::fFireworksPopup [private] |
Definition at line 121 of file FWColorSelect.h.
Referenced by FWColorSelect(), HandleButton(), and ~FWColorSelect().
std::string FWColorSelect::fLabel [private] |
Definition at line 119 of file FWColorSelect.h.
Referenced by FWColorSelect(), and label().
Color_t FWColorSelect::fSelectedColor [private] |
Definition at line 120 of file FWColorSelect.h.
Referenced by HandleButton(), SetColorByIndex(), and UpdateColors().