CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWCollectionSummaryWidget Class Reference

#include <Fireworks/Core/interface/FWCollectionSummaryWidget.h>

List of all members.

Public Member Functions

 ClassDef (FWCollectionSummaryWidget, 0)
void colorChangeRequested (Color_t iColorIndex)
void colorClicked ()
void displayChanged ()
 FWCollectionSummaryWidget (TGFrame *iParent, FWEventItem &iItem, TGLayoutHints *)
void infoClicked ()
void itemChanged ()
void itemColorClicked (int iIndex, Int_t iRootX, Int_t iRootY)
void labelClicked ()
void modelSelected (Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
void requestForController (FWEventItem *)
void requestForErrorInfo (FWEventItem *)
void requestForFilter (FWEventItem *)
void requestForInfo (FWEventItem *)
void requestForModelContextMenu (Int_t, Int_t)
void setBackgroundToWhite (bool)
void stateClicked ()
void toggleItemVisible ()
void toggleShowHide ()
virtual ~FWCollectionSummaryWidget ()

Private Member Functions

void colorTable ()
void createColorPopup ()
 FWCollectionSummaryWidget (const FWCollectionSummaryWidget &)
const FWCollectionSummaryWidgetoperator= (const FWCollectionSummaryWidget &)

Private Attributes

bool m_backgroundIsWhite
FWEventItemm_collection
bool m_collectionShown
FWColorPopupm_colorPopup
FWColorBoxIconm_colorSelectBox
FWBoxIconButtonm_colorSelectWidget
FWCollectionSummaryWidgetConnectionHolderm_connectionHolder
TGGC * m_graphicsContext
TGLayoutHints * m_hints
TGFrame * m_holder
int m_indexForColor
FWCustomIconsButtonm_infoButton
FWBoxIconButtonm_isVisibleButton
FWCheckBoxIconm_isVisibleCheckBox
TGTextButton * m_label
TGFrame * m_parent
FWCustomIconsButtonm_showHideButton
FWCustomIconsButtonm_stateButton
TGGC * m_tableContext
FWCollectionSummaryTableManagerm_tableManager
FWTableWidgetm_tableWidget

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 50 of file FWCollectionSummaryWidget.h.


Constructor & Destructor Documentation

FWCollectionSummaryWidget::FWCollectionSummaryWidget ( TGFrame *  iParent,
FWEventItem iItem,
TGLayoutHints *  iHints 
)

Definition at line 253 of file FWCollectionSummaryWidget.cc.

References arrow_right(), arrow_right_disabled(), FWEventItem::defaultDisplayPropertiesChanged_, displayChanged(), FWEventItem::filterChanged_, info, info_disabled(), info_over(), itemChanged(), FWEventItem::itemChanged_, m_backgroundIsWhite, m_collection, m_collectionShown, m_colorSelectBox, m_colorSelectWidget, m_connectionHolder, m_graphicsContext, m_holder, m_infoButton, m_isVisibleButton, m_isVisibleCheckBox, m_label, m_showHideButton, m_stateButton, FWEventItem::name(), FWCollectionSummaryWidgetConnectionHolder::push_back(), FWCollectionSummaryWidgetConnectionHolder::reserve(), FWColorBoxIcon::setColor(), lumiQTWidget::t, unfiltered(), and unfiltered_over().

                                                                                                               :
TGCompositeFrame(iParent),
m_collection(&iItem),
m_hints(iHints),
m_parent(iParent),
m_collectionShown(false),
m_tableContext(0),
m_indexForColor(-1),
m_colorPopup(0),
m_tableManager(0),
m_tableWidget(0),
m_backgroundIsWhite(false),
m_connectionHolder( new FWCollectionSummaryWidgetConnectionHolder)
{
   SetBackgroundColor(kWidgetColor);
   const unsigned int backgroundColor=kBlack;
   
   TGCompositeFrame* hFrame = new TGHorizontalFrame(this, 10, 10, 0, backgroundColor);
   m_holder = hFrame;
   this->AddFrame(hFrame, new TGLayoutHints(kLHintsTop | kLHintsExpandX) );
   
   m_showHideButton = new FWCustomIconsButton(this,
                                              arrow_right(!m_backgroundIsWhite),
                                              arrow_right_disabled(!m_backgroundIsWhite),
                                              arrow_right_disabled(!m_backgroundIsWhite));
   m_showHideButton->Connect("Clicked()","FWCollectionSummaryWidget",this,"toggleShowHide()");
   m_showHideButton->SetToolTipText("show/hide individual collection items");
   m_collectionShown = false;
   hFrame->AddFrame(m_showHideButton,new TGLayoutHints(kLHintsCenterY | kLHintsLeft,6,10));
   
   //m_isVisibleButton = new TGCheckButton(this,"");
   //m_isVisibleButton->SetState(kButtonDown, kFALSE);
   m_isVisibleCheckBox = new FWCheckBoxIcon(12);
   m_isVisibleButton = new FWBoxIconButton(this, m_isVisibleCheckBox,-1,GetWhiteGC()());
   m_isVisibleButton->SetBackgroundColor(backgroundColor);
   m_isVisibleButton->SetToolTipText("make all items in collection visible/invisible");
   hFrame->AddFrame(m_isVisibleButton,new TGLayoutHints(kLHintsCenterY | kLHintsLeft,0,1));
   m_isVisibleButton->Connect("Clicked()", "FWCollectionSummaryWidget", this, "toggleItemVisible()");

   m_colorSelectBox = new FWColorBoxIcon(12);
   m_colorSelectWidget = new FWBoxIconButton(this,m_colorSelectBox,-1,GetWhiteGC()());
   hFrame->AddFrame(m_colorSelectWidget,new TGLayoutHints(kLHintsCenterY | kLHintsLeft,1));
   //m_colorSelectWidget->Connect("ColorSelected(Pixel_t)", "FWCollectionSummaryWidget", this, "colorChangeRequested(Pixel_t)");
   m_colorSelectWidget->Connect("Clicked()", "FWCollectionSummaryWidget",this,"colorClicked()");
   m_colorSelectWidget->SetBackgroundColor(backgroundColor);
   m_colorSelectWidget->SetToolTipText("set default color of items in collection");
   GCValues_t t = *(   GetWhiteGC().GetAttributes());
   m_graphicsContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t,kTRUE);
   m_colorSelectBox->setColor(m_graphicsContext->GetGC());
   
   
   m_label = new BorderlessTextButton(this,
                                      m_collection->name().c_str());
   m_label->SetBackgroundColor(backgroundColor);
   m_label->SetTextJustify(kTextLeft|kTextCenterY);
   m_label->SetTextColor(static_cast<Pixel_t>(gVirtualX->GetPixel(kWhite)));
   hFrame->AddFrame(m_label, new TGLayoutHints(kLHintsCenterY | kLHintsLeft | kLHintsExpandX,5,5));
   m_label->Connect("Clicked()","FWCollectionSummaryWidget",this,"labelClicked()");
   m_label->SetToolTipText("select collection and show controller");
   
   m_stateButton = new FWCustomIconsButton(this,unfiltered(!m_backgroundIsWhite),
                                           unfiltered_over(!m_backgroundIsWhite),
                                           unfiltered_over(!m_backgroundIsWhite));
   hFrame->AddFrame(m_stateButton, new TGLayoutHints(kLHintsCenterY| kLHintsLeft));
   itemChanged();
   displayChanged();
   m_stateButton->Connect("Clicked()","FWCollectionSummaryWidget",this,"stateClicked()");
   m_stateButton->SetToolTipText("select collection and show filter");
   
   m_infoButton = new FWCustomIconsButton(this,
                                          info(!m_backgroundIsWhite),
                                          info_over(!m_backgroundIsWhite),
                                          info_disabled(!m_backgroundIsWhite)
   );
   hFrame->AddFrame(m_infoButton, new TGLayoutHints(kLHintsCenterY| kLHintsRight,2,2));
   m_infoButton->Connect("Clicked()","FWCollectionSummaryWidget",this,"infoClicked()");
   m_infoButton->SetToolTipText("select collection and show data info");

   m_connectionHolder->reserve(3);
   m_connectionHolder->push_back(m_collection->defaultDisplayPropertiesChanged_.connect(boost::bind(&FWCollectionSummaryWidget::displayChanged, this)));
   m_connectionHolder->push_back(m_collection->itemChanged_.connect(boost::bind(&FWCollectionSummaryWidget::itemChanged,this)));
   m_connectionHolder->push_back(m_collection->filterChanged_.connect(boost::bind(&FWCollectionSummaryWidget::itemChanged,this)));
   
   MapSubwindows();
   Layout();
   MapWindow();
}
FWCollectionSummaryWidget::~FWCollectionSummaryWidget ( ) [virtual]

Definition at line 346 of file FWCollectionSummaryWidget.cc.

References m_colorPopup, m_connectionHolder, and m_graphicsContext.

{
   delete m_colorPopup;
   /* the following deletes lead to an infinite loop at the end of the job
   delete m_hints;
   delete m_showHideButton;
   delete m_isVisibleButton;
   delete m_colorSelectWidget;
   delete m_stateButton;
   delete m_infoButton;
    */
   gClient->GetResourcePool()->GetGCPool()->FreeGC(m_graphicsContext->GetGC());
   delete m_connectionHolder;
}
FWCollectionSummaryWidget::FWCollectionSummaryWidget ( const FWCollectionSummaryWidget ) [private]

Member Function Documentation

FWCollectionSummaryWidget::ClassDef ( FWCollectionSummaryWidget  ,
 
)
void FWCollectionSummaryWidget::colorChangeRequested ( Color_t  iColorIndex)
void FWCollectionSummaryWidget::colorClicked ( )
void FWCollectionSummaryWidget::colorTable ( ) [private]
void FWCollectionSummaryWidget::createColorPopup ( ) [private]

Definition at line 523 of file FWCollectionSummaryWidget.cc.

References FWDisplayProperties::color(), FWEventItem::colorManager(), colors, FWEventItem::defaultDisplayProperties(), FWColorManager::fillLimitedColors(), FWColorPopup::InitContent(), m_collection, m_colorPopup, and FWEventItem::name().

Referenced by colorClicked(), and itemColorClicked().

{
   if (0==m_colorPopup)
   {
      std::vector<Color_t> colors;
      m_collection->colorManager()->fillLimitedColors(colors);
     
      m_colorPopup = new FWColorPopup(gClient->GetDefaultRoot(), m_collection->defaultDisplayProperties().color());
      m_colorPopup->InitContent(m_collection->name().c_str(), colors);
      m_colorPopup->Connect("ColorSelected(Color_t)","FWCollectionSummaryWidget", this, "colorChangeRequested(Color_t)");
   }
}
void FWCollectionSummaryWidget::displayChanged ( )
void FWCollectionSummaryWidget::infoClicked ( )
void FWCollectionSummaryWidget::itemChanged ( )

Definition at line 407 of file FWCollectionSummaryWidget.cc.

References alert(), alert_over(), FWEventItem::errorMessage(), filtered(), filtered_over(), FWEventItem::filterExpression(), FWEventItem::hasError(), m_backgroundIsWhite, m_collection, m_stateButton, FWCustomIconsButton::swapIcons(), unfiltered(), and unfiltered_over().

Referenced by FWCollectionSummaryWidget(), and setBackgroundToWhite().

{
   const TGPicture* picture = 0;
   const TGPicture* down = 0;
   const TGPicture* disabled=0;
   if(m_collection->hasError()) {
      picture = alert(!m_backgroundIsWhite);
      down = alert_over(!m_backgroundIsWhite);
      disabled = alert_over(!m_backgroundIsWhite);
      m_stateButton->SetToolTipText(m_collection->errorMessage().c_str());
   } else {
      if(m_collection->filterExpression().size()) {
         picture = filtered(!m_backgroundIsWhite);
         down = filtered_over(!m_backgroundIsWhite);
         disabled = filtered_over(!m_backgroundIsWhite);
      } else {
         picture = unfiltered(!m_backgroundIsWhite);
         down = unfiltered_over(!m_backgroundIsWhite);
         disabled = unfiltered_over(!m_backgroundIsWhite);
      }
      m_stateButton->SetToolTipText("select collection and show filter");
   }
   m_stateButton->swapIcons(picture,down,disabled);
}
void FWCollectionSummaryWidget::itemColorClicked ( int  iIndex,
Int_t  iRootX,
Int_t  iRootY 
)
void FWCollectionSummaryWidget::labelClicked ( )
void FWCollectionSummaryWidget::modelSelected ( Int_t  iRow,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
)
const FWCollectionSummaryWidget& FWCollectionSummaryWidget::operator= ( const FWCollectionSummaryWidget ) [private]
void FWCollectionSummaryWidget::requestForController ( FWEventItem iItem)

Definition at line 605 of file FWCollectionSummaryWidget.cc.

Referenced by labelClicked().

{
   Emit("requestForController(FWEventItem*)",reinterpret_cast<long>(iItem));
}
void FWCollectionSummaryWidget::requestForErrorInfo ( FWEventItem iItem)

Definition at line 599 of file FWCollectionSummaryWidget.cc.

{
   Emit("requestForErrorInfo(FWEventItem*)",reinterpret_cast<long>(iItem));
}
void FWCollectionSummaryWidget::requestForFilter ( FWEventItem iItem)

Definition at line 593 of file FWCollectionSummaryWidget.cc.

Referenced by stateClicked().

{
   Emit("requestForFilter(FWEventItem*)", reinterpret_cast<long>(iItem));
}
void FWCollectionSummaryWidget::requestForInfo ( FWEventItem iItem)

Definition at line 587 of file FWCollectionSummaryWidget.cc.

Referenced by infoClicked().

{
   Emit("requestForInfo(FWEventItem*)",reinterpret_cast<long>(iItem));
}
void FWCollectionSummaryWidget::requestForModelContextMenu ( Int_t  iGlobalX,
Int_t  iGlobalY 
)

Definition at line 611 of file FWCollectionSummaryWidget.cc.

References harvestRelVal::args.

Referenced by modelSelected().

{
   Long_t args[2];
   args[0]=static_cast<Long_t>(iGlobalX);
   args[1]=static_cast<Long_t> (iGlobalY);
   Emit("requestForModelContextMenu(Int_t,Int_t)",args); 
}   
void FWCollectionSummaryWidget::setBackgroundToWhite ( bool  iToWhite)

Definition at line 653 of file FWCollectionSummaryWidget.cc.

References arrow_down(), arrow_down_disabled(), arrow_right(), arrow_right_disabled(), FWDisplayProperties::color(), colorTable(), FWEventItem::defaultDisplayProperties(), info, info_disabled(), info_over(), itemChanged(), FWEventItem::itemIsSelected(), m_backgroundIsWhite, m_collection, m_collectionShown, m_colorSelectWidget, m_graphicsContext, m_holder, m_infoButton, m_isVisibleButton, m_label, m_showHideButton, selectContext(), setLabelBackgroundColor(), FWBoxIconButton::setNormCG(), and FWCustomIconsButton::swapIcons().

Referenced by FWSummaryManager::newItem().

{
   if(iToWhite == m_backgroundIsWhite) {
      return;
   }
   Pixel_t bc = 0x000000;
   Pixel_t fg = 0xffffff;
   if(iToWhite) {
      bc = 0xffffff;
      fg = 0x000000;
      m_backgroundIsWhite=true;
      SetBackgroundColor(kWidgetColorLight);
      m_isVisibleButton->setNormCG(GetBlackGC()());
      m_colorSelectWidget->setNormCG(GetBlackGC()());
      selectContext()->SetForeground(0xafafFF);
   } else {
      m_backgroundIsWhite=false;
      SetBackgroundColor(kWidgetColor);
      m_isVisibleButton->setNormCG(GetWhiteGC()());
      m_colorSelectWidget->setNormCG(GetWhiteGC()());
      selectContext()->SetForeground(gClient->GetResourcePool()->GetSelectedGC()->GetBackground());
   }
   //this forces the icons to be changed to the correct background
   itemChanged();
   m_graphicsContext->SetForeground(gVirtualX->GetPixel(m_collection->defaultDisplayProperties().color()));
   {
      const TGPicture* picture = info(!m_backgroundIsWhite);
      const TGPicture* over = info_over(!m_backgroundIsWhite);
      const TGPicture* disabled = info_disabled(!m_backgroundIsWhite);
      m_infoButton->swapIcons(picture,
                              over,
                              disabled);
   }
   if(m_collectionShown) {
      const TGPicture* picture = arrow_down(!m_backgroundIsWhite);
      const TGPicture* down = arrow_down_disabled(!m_backgroundIsWhite);
      const TGPicture* disabled = arrow_down_disabled(!m_backgroundIsWhite);
      m_showHideButton->swapIcons(picture,down,disabled);
   } else {
      const TGPicture* picture = arrow_right(!m_backgroundIsWhite);
      const TGPicture* down = arrow_right_disabled(!m_backgroundIsWhite);
      const TGPicture* disabled = arrow_right_disabled(!m_backgroundIsWhite);
      m_showHideButton->swapIcons(picture,down,disabled);
   }
   colorTable();
   m_holder->SetBackgroundColor(bc);
   setLabelBackgroundColor(m_label,m_collection->itemIsSelected(),m_backgroundIsWhite);
   m_label->SetTextColor(fg);
   m_isVisibleButton->SetBackgroundColor(bc);
   m_colorSelectWidget->SetBackgroundColor(bc);
   fClient->NeedRedraw(m_isVisibleButton);
   fClient->NeedRedraw(m_colorSelectWidget);
   fClient->NeedRedraw(m_holder);
   fClient->NeedRedraw(this);
}
void FWCollectionSummaryWidget::stateClicked ( )
void FWCollectionSummaryWidget::toggleItemVisible ( )
void FWCollectionSummaryWidget::toggleShowHide ( )

Definition at line 471 of file FWCollectionSummaryWidget.cc.

References arrow_down(), arrow_down_disabled(), arrow_right(), arrow_right_disabled(), colorTable(), m_backgroundIsWhite, m_collection, m_collectionShown, m_hints, m_parent, m_showHideButton, m_tableContext, m_tableManager, m_tableWidget, FWTableWidget::Resize(), selectContext(), FWTableWidget::SetHeaderBackgroundColor(), FWCustomIconsButton::swapIcons(), and lumiQTWidget::t.

{
   const TGPicture* picture = 0;
   const TGPicture* down = 0;
   const TGPicture* disabled=0;
   
   if(m_collectionShown) {
      picture = arrow_right(!m_backgroundIsWhite);
      down = arrow_right_disabled(!m_backgroundIsWhite);
      disabled = arrow_right_disabled(!m_backgroundIsWhite);
      m_collectionShown = false;
      HideFrame(m_tableWidget);
      m_hints->SetLayoutHints(kLHintsExpandX);
   } else {
      picture = arrow_down(!m_backgroundIsWhite);
      down = arrow_down_disabled(!m_backgroundIsWhite);
      disabled = arrow_down_disabled(!m_backgroundIsWhite);
      m_collectionShown = true;
      
      if(0 == m_tableManager) {
         GCValues_t t = *(GetWhiteGC().GetAttributes());
         t.fFont = gClient->GetResourcePool()->GetIconFont()->GetFontHandle();
         m_tableContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&t,kTRUE);
         
         TGGC* hilightContext=selectContext();
         m_tableManager= new FWCollectionSummaryTableManager(m_collection,m_tableContext,hilightContext,this);
         m_tableWidget = new FWTableWidget(m_tableManager,this);
         m_tableWidget->SetHeaderBackgroundColor(fClient->GetResourcePool()->GetFrameGC()->GetBackground());
         colorTable();
         AddFrame(m_tableWidget, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY));
         m_tableWidget->Connect("rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)","FWCollectionSummaryWidget",this,"modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");

         MapSubwindows();
         Layout();
      }
      ShowFrame(m_tableWidget);
      m_hints->SetLayoutHints(kLHintsExpandX|kLHintsExpandY);
      //NOTE: if I don't do the resize then the vertical scrollbars for the table are 
      // messed up when the number of entries in the table can be fully scene but 
      // a scrollbar is still added which thinks only a tiny area of the list can be seen
      m_tableWidget->Resize(m_tableWidget->GetWidth(),m_tableWidget->GetHeight());
   }
   
   if(0!=m_parent) {
      m_parent->Layout();
   }
   m_showHideButton->swapIcons(picture,down,disabled);
}

Member Data Documentation

Definition at line 104 of file FWCollectionSummaryWidget.h.

Referenced by FWCollectionSummaryWidget().

TGLayoutHints* FWCollectionSummaryWidget::m_hints [private]

Definition at line 97 of file FWCollectionSummaryWidget.h.

Referenced by toggleShowHide().

Definition at line 108 of file FWCollectionSummaryWidget.h.

Referenced by FWCollectionSummaryWidget(), and setBackgroundToWhite().

Definition at line 106 of file FWCollectionSummaryWidget.h.

Referenced by FWCollectionSummaryWidget(), and setBackgroundToWhite().

TGTextButton* FWCollectionSummaryWidget::m_label [private]

Definition at line 98 of file FWCollectionSummaryWidget.h.

Referenced by toggleShowHide().

Definition at line 105 of file FWCollectionSummaryWidget.h.

Referenced by FWCollectionSummaryWidget(), and itemChanged().

Definition at line 111 of file FWCollectionSummaryWidget.h.

Referenced by colorTable(), and toggleShowHide().

Definition at line 115 of file FWCollectionSummaryWidget.h.

Referenced by toggleShowHide().

Definition at line 116 of file FWCollectionSummaryWidget.h.

Referenced by colorTable(), and toggleShowHide().