CMS 3D CMS Logo

IgQtAppToolBarService Class Reference

#include <Iguana/Studio/interface/IgQtAppToolBarService.h>

Inheritance diagram for IgQtAppToolBarService:

IgStateElement

List of all members.

Public Member Functions

QToolButton * getToolBarButton (const int barId, const int buttonId)
 IgQtAppToolBarService (IgState *state, QWidget *mainWindow)
QToolBar * toolBar (const int id, const std::string &label)
QToolButton * toolBarButton (IgState *state, const int barId, const int buttonId, const QIconSet &iconSet, const std::string &name, QObject *target, const char *slot, const char *signal="")
 ~IgQtAppToolBarService (void)

Private Types

typedef std::map< int, QToolBar * > ToolBarMap
typedef std::map< int,
QToolButton * > 
ToolButtonMap

Private Member Functions

 IG_DECLARE_STATE_ELEMENT (IgQtAppToolBarService)
 IgQtAppToolBarService (const IgQtAppToolBarService &)
IgQtAppToolBarServiceoperator= (const IgQtAppToolBarService &)

Private Attributes

QWidget * m_mainWindow
IgStatem_state
ToolBarMap m_toolBarMap
ToolButtonMap m_toolButtonMap


Detailed Description

Definition at line 25 of file IgQtAppToolBarService.h.


Member Typedef Documentation

typedef std::map<int, QToolBar *> IgQtAppToolBarService::ToolBarMap [private]

Definition at line 57 of file IgQtAppToolBarService.h.

typedef std::map<int, QToolButton *> IgQtAppToolBarService::ToolButtonMap [private]

Definition at line 58 of file IgQtAppToolBarService.h.


Constructor & Destructor Documentation

IgQtAppToolBarService::IgQtAppToolBarService ( IgState state,
QWidget *  mainWindow 
)

Definition at line 27 of file IgQtAppToolBarService.cc.

References ASSERT, and IgState::put().

00029     : m_state (state),
00030       m_mainWindow (mainWindow)
00031 {
00032     ASSERT (state);
00033     ASSERT (mainWindow);
00034     state->put (s_key, this);
00035 }

IgQtAppToolBarService::~IgQtAppToolBarService ( void   ) 

Definition at line 37 of file IgQtAppToolBarService.cc.

References ASSERT, IgState::detach(), m_mainWindow, and m_state.

00038 {
00039     ASSERT (m_state);
00040     ASSERT (m_mainWindow);
00041     m_state->detach (s_key);
00042 }

IgQtAppToolBarService::IgQtAppToolBarService ( const IgQtAppToolBarService  )  [private]


Member Function Documentation

QToolButton * IgQtAppToolBarService::getToolBarButton ( const int  barId,
const int  buttonId 
)

Definition at line 110 of file IgQtAppToolBarService.cc.

References m_toolButtonMap.

Referenced by Ig3DWindow::cameraToggled(), and Ig3DBaseWindow::viewingModeCallback().

00112 {
00113     if (m_toolButtonMap.find(barId * 10000 + buttonId) !=
00114         m_toolButtonMap.end ())
00115       return m_toolButtonMap [barId * 10000 + buttonId];
00116     else
00117       return 0;
00118 }

IgQtAppToolBarService::IG_DECLARE_STATE_ELEMENT ( IgQtAppToolBarService   )  [private]

IgQtAppToolBarService& IgQtAppToolBarService::operator= ( const IgQtAppToolBarService  )  [private]

QToolBar * IgQtAppToolBarService::toolBar ( const int  id,
const std::string &  label 
)

Definition at line 45 of file IgQtAppToolBarService.cc.

References m_mainWindow, and m_toolBarMap.

Referenced by toolBarButton().

00047 {
00048     if (m_toolBarMap[id] == 0)
00049     {
00050         QToolBar *bar = new QToolBar (static_cast<QMainWindow *>(m_mainWindow),
00051                                       label.c_str ());
00052         bar->setCaption (label.c_str ());
00053         m_toolBarMap[id] = bar; 
00054     }
00055     return m_toolBarMap[id];    
00056 }

QToolButton * IgQtAppToolBarService::toolBarButton ( IgState state,
const int  barId,
const int  buttonId,
const QIconSet &  iconSet,
const std::string &  name,
QObject *  target,
const char *  slot,
const char *  signal = "" 
)

Definition at line 61 of file IgQtAppToolBarService.cc.

References reco::fitHelper::add(), IgQtAppContextService::add(), createQtConnection(), DBSPlugin::get(), m_toolButtonMap, qtConnectionCallback(), qtShowHideCallback(), parseConfig::service, and toolBar().

Referenced by IgSpareWindow::initToolBar(), IgLegoWindow::initToolBar(), IgRPhiWindow::initToolBar(), Ig3DWindow::initToolBar(), IgRZWindow::initToolBar(), and Ig3DBaseWindow::initToolBar().

00069 {
00070     std::string realSignal (signal);
00071     std::string realSlot (slot);
00072     
00073     if (realSignal == "")
00074       realSignal  = SIGNAL (clicked ());
00075 
00076     // FIXME: toolbar must already exists otherwise the name is set to
00077     // ""    
00078     QToolBar *toolBar = this->toolBar (barId, std::string (""));
00079 
00080     // FIXME: Ugly way of having unique ids...  
00081     QToolButton *button = 0;
00082     if (m_toolButtonMap[barId * 10000 + buttonId] == 0)
00083     {
00084         button = new QToolButton (toolBar);
00085         button->setIconSet (iconSet);
00086         
00087         m_toolButtonMap[barId * 10000 + buttonId] = button;
00088         QToolTip::add (button, name.c_str ());
00089     }
00090     else
00091       button = m_toolButtonMap[barId * 10000 + buttonId];
00092     
00093     IgQtAppContextService *service = IgQtAppContextService::get (state);
00094     if (realSlot != "")
00095     {
00096         service->add (qtConnectionCallback, 
00097                       createQtConnection (button, 
00098                                           realSignal.c_str (), 
00099                                           target,
00100                                           slot));
00101         service->add (qtShowHideCallback, button); 
00102     }
00103     else
00104       service->add (qtShowHideCallback, button, false); 
00105 
00106     return button;
00107 }


Member Data Documentation

QWidget* IgQtAppToolBarService::m_mainWindow [private]

Definition at line 50 of file IgQtAppToolBarService.h.

Referenced by toolBar(), and ~IgQtAppToolBarService().

IgState* IgQtAppToolBarService::m_state [private]

Definition at line 49 of file IgQtAppToolBarService.h.

Referenced by ~IgQtAppToolBarService().

ToolBarMap IgQtAppToolBarService::m_toolBarMap [private]

Definition at line 60 of file IgQtAppToolBarService.h.

Referenced by toolBar().

ToolButtonMap IgQtAppToolBarService::m_toolButtonMap [private]

Definition at line 61 of file IgQtAppToolBarService.h.

Referenced by getToolBarButton(), and toolBarButton().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:26 2009 for CMSSW by  doxygen 1.5.4