CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
FWColorSelect Class Reference

#include <FWColorSelect.h>

Inheritance diagram for FWColorSelect:

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)
 
void SetColorByIndex (Color_t iColor, Bool_t iSendSignal)
 
void UpdateColors ()
 
 ~FWColorSelect ()
 

Private Attributes

const FWColorManagerfColorManager
 
FWColorPopupfFireworksPopup
 
std::string fLabel
 
Color_t fSelectedColor
 

Detailed Description

Definition at line 116 of file FWColorSelect.h.

Constructor & Destructor Documentation

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().

333  :
334  TGColorSelect(p, TColor::Number2Pixel(index), id),
335  fLabel(label),
337  fFireworksPopup(0),
338  fColorManager(iManager)
339 {
340  std::vector<Color_t> colors;
342 
343  fFireworksPopup = new FWColorPopup(gClient->GetDefaultRoot(), fColor);
345  fFireworksPopup->Connect("ColorSelected(Color_t)","FWColorSelect", this, "SetColorByIndex(Color_t)");
346 
347  fColorManager->colorsHaveChanged_.connect(boost::bind(&FWColorSelect::UpdateColors,this));
348 }
void InitContent(const char *name, const std::vector< Color_t > &colors, bool backgroundIsBlack=true)
FWColorPopup * fFireworksPopup
void fillLimitedColors(std::vector< Color_t > &cv) const
vector< Color_t > colors
const std::string & label() const
Color_t fSelectedColor
const FWColorManager * fColorManager
std::string fLabel
sigc::signal< void > colorsHaveChanged_
FWColorSelect::~FWColorSelect ( )

Definition at line 350 of file FWColorSelect.cc.

References fFireworksPopup.

351 {
352  delete fFireworksPopup;
353 }
FWColorPopup * fFireworksPopup

Member Function Documentation

FWColorSelect::ClassDef ( FWColorSelect  ,
 
)
void FWColorSelect::ColorChosen ( Color_t  iColor)

Definition at line 425 of file FWColorSelect.cc.

Referenced by SetColorByIndex().

426 {
427  Emit("ColorChosen(Color_t)", iColor);
428 }
Bool_t FWColorSelect::HandleButton ( Event_t *  event)
virtual

Definition at line 355 of file FWColorSelect.cc.

References create_public_lumi_plots::ax, FWColorManager::backgroundColorIndex(), colors, fColorManager, fFireworksPopup, FWColorManager::fillLimitedColors(), fSelectedColor, FWColorManager::kBlackIndex, FWColorPopup::PlacePopup(), FWColorPopup::ResetColors(), and FWColorPopup::SetSelection().

356 {
357  TGFrame::HandleButton(event);
358  if (!IsEnabled()) return kTRUE;
359 
360  if (event->fCode != kButton1) return kFALSE;
361 
362  if ((event->fType == kButtonPress) && HasFocus()) WantFocus();
363 
364  if (event->fType == kButtonPress)
365  {
366  fPressPos.fX = fX;
367  fPressPos.fY = fY;
368 
369  if (fState != kButtonDown) {
370  fPrevState = fState;
371  SetState(kButtonDown);
372  }
373  }
374  else
375  {
376  if (fState != kButtonUp)
377  {
378  SetState(kButtonUp);
379 
380  // case when it was dragged during guibuilding
381  if ((fPressPos.fX != fX) || (fPressPos.fY != fY))
382  {
383  return kFALSE;
384  }
385 
386  Window_t wdummy;
387  Int_t ax, ay;
388 
389  std::vector<Color_t> colors;
391 
394 
395  gVirtualX->TranslateCoordinates(fId, gClient->GetDefaultRoot()->GetId(), 0, fHeight, ax, ay, wdummy);
396  fFireworksPopup->PlacePopup(ax, ay, fFireworksPopup->GetDefaultWidth(), fFireworksPopup->GetDefaultHeight());
397  }
398  }
399  return kTRUE;
400 }
FWColorPopup * fFireworksPopup
void fillLimitedColors(std::vector< Color_t > &cv) const
void PlacePopup(Int_t x, Int_t y, UInt_t w, UInt_t h)
vector< Color_t > colors
BackgroundColorIndex backgroundColorIndex() const
void ResetColors(const std::vector< Color_t > &colors, bool backgroundIsBlack=true)
void SetSelection(Color_t)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
Color_t fSelectedColor
const FWColorManager * fColorManager
const std::string& FWColorSelect::label ( ) const
inline
void FWColorSelect::SetColorByIndex ( Color_t  iColor)
void FWColorSelect::SetColorByIndex ( Color_t  iColor,
Bool_t  iSendSignal 
)

Definition at line 409 of file FWColorSelect.cc.

References ColorChosen(), and fSelectedColor.

410 {
411  fSelectedColor = iColor;
412  SetColor(TColor::Number2Pixel(iColor), kFALSE);
413  if (iSendSignal)
414  {
416  }
417 }
void ColorChosen(Color_t)
Color_t fSelectedColor
void FWColorSelect::UpdateColors ( )

Definition at line 419 of file FWColorSelect.cc.

References fSelectedColor.

Referenced by FWColorSelect().

420 {
421  SetColor(fSelectedColor, kFALSE);
422 }
Color_t fSelectedColor

Member Data Documentation

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().