CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSGContinuousAction.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : CSGContinuousAction
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Jul 29 10:21:18 EDT 2008
11 // $Id: CSGContinuousAction.cc,v 1.6 2009/08/26 18:59:20 amraktad Exp $
12 //
13 
14 // system include files
15 #include <boost/bind.hpp>
16 #include "TGMenu.h"
17 
18 // user include files
21 
22 //
23 // constants, enums and typedefs
24 //
25 
26 //
27 // static data member definitions
28 //
29 
30 //
31 // constructors and destructor
32 //
34  CSGAction(iSupervisor,iName),
35  m_upPic(0),
36  m_downPic(0),
37  m_disabledPic(0),
38  m_runningUpPic(0),
39  m_runningDownPic(0),
40  m_button(0),
41  m_isRunning(false)
42 {
43  activated.connect(boost::bind(&CSGContinuousAction::switchMode, this));
44 }
45 
46 void
48  const TGPicture* upPic,
49  const TGPicture* downPic,
50  const TGPicture* disabledPic,
51  const TGPicture* upRunningPic,
52  const TGPicture* downRunningPic,
53  TGLayoutHints* l,
54  Int_t id,
55  GContext_t norm,
56  UInt_t option)
57 {
58  m_upPic=upPic;
59  m_downPic=downPic;
60  m_disabledPic=disabledPic;
61  m_runningUpPic=upRunningPic;
62  m_runningDownPic=downRunningPic;
63  m_button =
64  CSGAction::createCustomIconsButton(p,upPic,downPic,disabledPic,l,id,norm,option);
65 }
66 
67 void
69 {
70  if(!m_isRunning) {
71  m_isRunning = true;
73  if(getToolBar() && m_runningImageFileName.size()) {
74  getToolBar()->ChangeIcon(getToolBarData(),m_runningImageFileName.c_str());
75  }
76  if(0!=m_button) {
77  const TGPicture* tUp = m_runningUpPic;
78  const TGPicture* tDown = m_runningDownPic;
79  m_button->swapIcons(tUp,tDown,m_disabledPic);
80  }
81  if(0!=getMenu()) {
82  getMenu()->CheckEntry(getMenuEntry());
83  }
84  started_();
85  } else {
86  stop();
87  stopped_();
88  }
89 }
90 
91 void
93 {
94  m_isRunning=false;
95  if(getToolBar() && m_imageFileName.size()) {
96  getToolBar()->ChangeIcon(getToolBarData(),m_imageFileName.c_str());
97  }
98  if(0!=m_button) {
99  const TGPicture* tUp = m_upPic;
100  const TGPicture* tDown = m_downPic;
101 
102  m_button->swapIcons(tUp,tDown,m_disabledPic);
103  }
104  if(0!=getMenu()) {
105  getMenu()->UnCheckEntry(getMenuEntry());
106  }
107 
108 }
109 
110 
111 void
113 {
115 }
116 
117 void
119 {
120  if(!m_isRunning) {
122  }
123 }
124 
125 //
126 // const member functions
127 //
128 
129 //
130 // static member functions
131 //
ToolBarData_t * getToolBarData() const
Definition: CSGAction.cc:277
TGPopupMenu * getMenu() const
Definition: CSGAction.cc:261
sigc::signal< void > activated
Definition: CSGAction.h:89
FWCustomIconsButton * m_button
virtual void globalDisable()
Definition: CSGAction.cc:303
const TGPicture * m_downPic
TGToolBar * getToolBar() const
Definition: CSGAction.cc:281
const TGPicture * m_upPic
void createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, const TGPicture *upRunningPic, const TGPicture *downRunningPic, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
virtual void globalDisable()
sigc::signal< void > started_
CSGContinuousAction(CSGActionSupervisor *sup, const char *name)
int getMenuEntry() const
Definition: CSGAction.cc:265
std::string m_runningImageFileName
sigc::signal< void > stopped_
const TGPicture * m_runningUpPic
const TGPicture * m_disabledPic
const TGPicture * m_runningDownPic
unsigned int UInt_t
Definition: FUTypes.h:12
virtual void globalEnable()
Definition: CSGAction.cc:296
FWCustomIconsButton * createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
Definition: CSGAction.cc:163
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)