CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
FWColorRow Class Reference

#include <FWColorSelect.h>

Inheritance diagram for FWColorRow:

Public Member Functions

virtual void AddColor (Color_t color)
 
 ClassDefOverride (FWColorRow, 0)
 
void ColorChanged (Color_t)
 
Int_t FindColorIndex (Color_t) const
 
 FWColorRow (const TGWindow *p=nullptr)
 
Int_t GetSelectedIndex () const
 
void ResetColor (Int_t, Color_t)
 
void SetBackgroundToBlack (Bool_t)
 
void SetSelectedIndex (Int_t i)
 
 ~FWColorRow () override
 

Protected Member Functions

void DoRedraw () override
 

Protected Attributes

Bool_t fBackgroundIsBlack
 
std::vector< FWColorFrame * > fCc
 
Int_t fSelectedIndex
 

Private Member Functions

void DrawHighlight ()
 

Detailed Description

Definition at line 40 of file FWColorSelect.h.

Constructor & Destructor Documentation

FWColorRow::FWColorRow ( const TGWindow *  p = nullptr)

Definition at line 74 of file FWColorSelect.cc.

References fSelectedIndex.

74  :
75  TGHorizontalFrame(p, 10, 10, kOwnBackground, TGFrame::GetBlackPixel()),
76  fBackgroundIsBlack(kTRUE)
77 {
78  fSelectedIndex = -1;
79 }
Int_t fSelectedIndex
Definition: FWColorSelect.h:46
Bool_t fBackgroundIsBlack
Definition: FWColorSelect.h:45
FWColorRow::~FWColorRow ( )
override

Definition at line 81 of file FWColorSelect.cc.

82 {
83  Cleanup();
84 }

Member Function Documentation

void FWColorRow::AddColor ( Color_t  color)
virtual

Definition at line 114 of file FWColorSelect.cc.

References fCc, kCFPadAbove, kCFPadBelow, kCFPadLeft, and kCFPadRight.

Referenced by FWColorPopup::SetColors().

115 {
116  fCc.push_back(new FWColorFrame(this, color));
117  AddFrame(fCc.back(), new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, kCFPadLeft, kCFPadRight, kCFPadAbove, kCFPadBelow));
118  fCc.back()->Connect("ColorSelected(Color_t)", "FWColorRow", this, "ColorChanged(Color_t)");
119 }
std::vector< FWColorFrame * > fCc
Definition: FWColorSelect.h:47
FWColorRow::ClassDefOverride ( FWColorRow  ,
 
)
void FWColorRow::ColorChanged ( Color_t  ci)

Definition at line 140 of file FWColorSelect.cc.

References FWColorPopup::fgFreePalette.

141 {
142  Emit("ColorChanged(Color_t)", ci);
143 }
void FWColorRow::DoRedraw ( )
overrideprotected

Definition at line 96 of file FWColorSelect.cc.

References DrawHighlight().

97 {
98  TGCompositeFrame::DoRedraw();
99  DrawHighlight();
100 }
void DrawHighlight()
void FWColorRow::DrawHighlight ( )
private

Definition at line 102 of file FWColorSelect.cc.

References fCc, fSelectedIndex, h, kCFPadBelow, kCFPadLeft, kCFPadRight, kHLExtraHeight, kHLExtraWidth, kHLOffsetX, kHLOffsetY, w, x, and y.

Referenced by DoRedraw().

103 {
104  if (fSelectedIndex >= 0)
105  {
106  Int_t x = fSelectedIndex * (fCc.at(fSelectedIndex)->GetWidth() + kCFPadLeft + kCFPadRight) + kCFPadLeft;
107  Int_t y = kCFPadBelow;
108  Int_t w = fCc.at(fSelectedIndex)->GetWidth();
109  Int_t h = fCc.at(fSelectedIndex)->GetHeight();
110  gVirtualX->DrawRectangle(fId, GetShadowGC()(), x - kHLOffsetX, y - kHLOffsetY, w + kHLExtraWidth, h + kHLExtraHeight);
111  }
112 }
Int_t fSelectedIndex
Definition: FWColorSelect.h:46
const double w
Definition: UKUtility.cc:23
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::vector< FWColorFrame * > fCc
Definition: FWColorSelect.h:47
Int_t FWColorRow::FindColorIndex ( Color_t  iColor) const

Definition at line 127 of file FWColorSelect.cc.

References fCc.

Referenced by FWColorPopup::SetSelection().

128 {
129  Int_t returnValue = -1;
130  Int_t index = 0;
131  for(std::vector<FWColorFrame*>::const_iterator it = fCc.begin(), itEnd = fCc.end();
132  it != itEnd; ++it, ++index)
133  {
134  if ((*it)->GetColor() == iColor)
135  return index;
136  }
137  return returnValue;
138 }
std::vector< FWColorFrame * > fCc
Definition: FWColorSelect.h:47
Int_t FWColorRow::GetSelectedIndex ( ) const
inline

Definition at line 63 of file FWColorSelect.h.

63 { return fSelectedIndex; }
Int_t fSelectedIndex
Definition: FWColorSelect.h:46
void FWColorRow::ResetColor ( Int_t  iIndex,
Color_t  iColor 
)

Definition at line 121 of file FWColorSelect.cc.

References fCc.

Referenced by FWColorPopup::ResetColors().

122 {
123  fCc[iIndex]->SetColor(iColor);
124 }
std::vector< FWColorFrame * > fCc
Definition: FWColorSelect.h:47
void FWColorRow::SetBackgroundToBlack ( Bool_t  toBlack)

Definition at line 86 of file FWColorSelect.cc.

References fBackgroundIsBlack.

Referenced by FWColorPopup::ResetColors(), and FWColorPopup::SetColors().

87 {
88  fBackgroundIsBlack= toBlack;
89  if (fBackgroundIsBlack) {
90  SetBackgroundColor(TGFrame::GetBlackPixel());
91  } else {
92  SetBackgroundColor(TGFrame::GetWhitePixel());
93  }
94 }
Bool_t fBackgroundIsBlack
Definition: FWColorSelect.h:45
void FWColorRow::SetSelectedIndex ( Int_t  i)
inline

Definition at line 64 of file FWColorSelect.h.

References FWColorFrame::ClassDefOverride(), and mps_fire::i.

Referenced by FWColorPopup::SetSelection().

64 { fSelectedIndex = i; }
Int_t fSelectedIndex
Definition: FWColorSelect.h:46

Member Data Documentation

Bool_t FWColorRow::fBackgroundIsBlack
protected

Definition at line 45 of file FWColorSelect.h.

Referenced by SetBackgroundToBlack().

std::vector<FWColorFrame *> FWColorRow::fCc
protected

Definition at line 47 of file FWColorSelect.h.

Referenced by AddColor(), DrawHighlight(), FindColorIndex(), and ResetColor().

Int_t FWColorRow::fSelectedIndex
protected

Definition at line 46 of file FWColorSelect.h.

Referenced by DrawHighlight(), and FWColorRow().