CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

FWColorRow Class Reference

#include <FWColorSelect.h>

List of all members.

Public Member Functions

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

Protected Member Functions

virtual void DoRedraw ()

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 = 0)

Definition at line 74 of file FWColorSelect.cc.

References fSelectedIndex.

                                        :
   TGHorizontalFrame(p, 10, 10, kOwnBackground, TGFrame::GetBlackPixel()),
   fBackgroundIsBlack(kTRUE)
{
   fSelectedIndex = -1;
}
FWColorRow::~FWColorRow ( ) [virtual]

Definition at line 81 of file FWColorSelect.cc.

{
   Cleanup();
}

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

{
   fCc.push_back(new FWColorFrame(this, color));
   AddFrame(fCc.back(), new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, kCFPadLeft, kCFPadRight, kCFPadAbove, kCFPadBelow));
   fCc.back()->Connect("ColorSelected(Color_t)", "FWColorRow", this, "ColorChanged(Color_t)");
}
FWColorRow::ClassDef ( FWColorRow  ,
 
)
void FWColorRow::ColorChanged ( Color_t  ci)

Definition at line 140 of file FWColorSelect.cc.

{
   Emit("ColorChanged(Color_t)", ci);
}
void FWColorRow::DoRedraw ( ) [protected, virtual]

Definition at line 96 of file FWColorSelect.cc.

References DrawHighlight().

void FWColorRow::DrawHighlight ( ) [private]

Definition at line 102 of file FWColorSelect.cc.

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

Referenced by DoRedraw().

{
   if (fSelectedIndex >= 0)
   {
      Int_t x = fSelectedIndex * (fCc.at(fSelectedIndex)->GetWidth() + kCFPadLeft + kCFPadRight) + kCFPadLeft;
      Int_t y = kCFPadBelow;
      Int_t w = fCc.at(fSelectedIndex)->GetWidth();
      Int_t h = fCc.at(fSelectedIndex)->GetHeight();
      gVirtualX->DrawRectangle(fId, GetShadowGC()(), x - kHLOffsetX, y - kHLOffsetY, w + kHLExtraWidth, h + kHLExtraHeight);
   }
}
Int_t FWColorRow::FindColorIndex ( Color_t  iColor) const

Definition at line 127 of file FWColorSelect.cc.

References fCc, and getHLTprescales::index.

Referenced by FWColorPopup::SetSelection().

{
   Int_t returnValue = -1;
   Int_t index       =  0;
   for(std::vector<FWColorFrame*>::const_iterator it = fCc.begin(), itEnd = fCc.end();
       it != itEnd; ++it, ++index)
   {
      if ((*it)->GetColor() == iColor)
         return index;
   }
   return returnValue;
}
Int_t FWColorRow::GetSelectedIndex ( ) const [inline]

Definition at line 63 of file FWColorSelect.h.

References fSelectedIndex.

{ return fSelectedIndex; }
void FWColorRow::ResetColor ( Int_t  iIndex,
Color_t  iColor 
)

Definition at line 121 of file FWColorSelect.cc.

References fCc.

Referenced by FWColorPopup::ResetColors().

{
   fCc[iIndex]->SetColor(iColor);
}
void FWColorRow::SetBackgroundToBlack ( Bool_t  toBlack)

Definition at line 86 of file FWColorSelect.cc.

References fBackgroundIsBlack.

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

{
   fBackgroundIsBlack= toBlack;
   if (fBackgroundIsBlack) {
      SetBackgroundColor(TGFrame::GetBlackPixel());
   } else {
      SetBackgroundColor(TGFrame::GetWhitePixel());
   }
}
void FWColorRow::SetSelectedIndex ( Int_t  i) [inline]

Definition at line 64 of file FWColorSelect.h.

References fSelectedIndex, and i.

Referenced by FWColorPopup::SetSelection().


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(), FWColorRow(), GetSelectedIndex(), and SetSelectedIndex().