CMS 3D CMS Logo

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 //
12 
13 // system include files
14 #include <boost/bind.hpp>
15 #include "TGMenu.h"
16 
17 // user include files
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
33  : CSGAction(iSupervisor, iName),
34  m_upPic(nullptr),
35  m_downPic(nullptr),
36  m_disabledPic(nullptr),
37  m_runningUpPic(nullptr),
38  m_runningDownPic(nullptr),
39  m_button(nullptr),
40  m_isRunning(false) {
41  activated.connect(boost::bind(&CSGContinuousAction::switchMode, this));
42 }
43 
45  const TGPicture* upPic,
46  const TGPicture* downPic,
47  const TGPicture* disabledPic,
48  const TGPicture* upRunningPic,
49  const TGPicture* downRunningPic,
50  TGLayoutHints* l,
51  Int_t id,
52  GContext_t norm,
53  UInt_t option) {
54  m_upPic = upPic;
55  m_downPic = downPic;
56  m_disabledPic = disabledPic;
57  m_runningUpPic = upRunningPic;
58  m_runningDownPic = downRunningPic;
59  m_button = CSGAction::createCustomIconsButton(p, upPic, downPic, disabledPic, l, id, norm, option);
60 }
61 
63  if (!m_isRunning) {
64  m_isRunning = true;
66  if (getToolBar() && !m_runningImageFileName.empty()) {
67  getToolBar()->ChangeIcon(getToolBarData(), m_runningImageFileName.c_str());
68  }
69  if (nullptr != m_button) {
70  const TGPicture* tUp = m_runningUpPic;
71  const TGPicture* tDown = m_runningDownPic;
72  m_button->swapIcons(tUp, tDown, m_disabledPic);
73  }
74  if (nullptr != getMenu()) {
75  getMenu()->CheckEntry(getMenuEntry());
76  }
77  started_();
78  } else {
79  stop();
80  stopped_();
81  }
82 }
83 
85  m_isRunning = false;
86  if (getToolBar() && !m_imageFileName.empty()) {
87  getToolBar()->ChangeIcon(getToolBarData(), m_imageFileName.c_str());
88  }
89  if (nullptr != m_button) {
90  const TGPicture* tUp = m_upPic;
91  const TGPicture* tDown = m_downPic;
92 
93  m_button->swapIcons(tUp, tDown, m_disabledPic);
94  }
95  if (nullptr != getMenu()) {
96  getMenu()->UnCheckEntry(getMenuEntry());
97  }
98 }
99 
101 
103  if (!m_isRunning) {
105  }
106 }
107 
108 //
109 // const member functions
110 //
111 
112 //
113 // static member functions
114 //
funct::false
false
Definition: Factorize.h:34
FWCustomIconsButton.h
CSGActionSupervisor
Definition: CSGActionSupervisor.h:27
CSGAction::globalDisable
virtual void globalDisable()
Definition: CSGAction.cc:284
CSGAction::createCustomIconsButton
FWCustomIconsButton * createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, TGLayoutHints *l=nullptr, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
Definition: CSGAction.cc:155
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSGAction::getToolBarData
ToolBarData_t * getToolBarData() const
Definition: CSGAction.cc:265
CSGAction
Definition: CSGAction.h:38
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
CSGContinuousAction::globalEnable
void globalEnable() override
Definition: CSGContinuousAction.cc:100
CSGContinuousAction::m_button
FWCustomIconsButton * m_button
Definition: CSGContinuousAction.h:76
FWCustomIconsButton::swapIcons
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
Definition: FWCustomIconsButton.cc:78
CSGContinuousAction::stop
void stop()
Definition: CSGContinuousAction.cc:84
CSGContinuousAction::createCustomIconsButton
void createCustomIconsButton(TGCompositeFrame *p, const TGPicture *upPic, const TGPicture *downPic, const TGPicture *disabledPic, const TGPicture *upRunningPic, const TGPicture *downRunningPic, TGLayoutHints *l=nullptr, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=0)
Definition: CSGContinuousAction.cc:44
CSGAction::activated
sigc::signal< void > activated
Definition: CSGAction.h:100
CSGContinuousAction::m_runningDownPic
const TGPicture * m_runningDownPic
Definition: CSGContinuousAction.h:74
CSGAction::getToolBar
TGToolBar * getToolBar() const
Definition: CSGAction.cc:267
CSGContinuousAction::started_
sigc::signal< void > started_
Definition: CSGContinuousAction.h:52
CSGContinuousAction::m_isRunning
bool m_isRunning
Definition: CSGContinuousAction.h:78
CSGContinuousAction::m_disabledPic
const TGPicture * m_disabledPic
Definition: CSGContinuousAction.h:72
CSGContinuousAction::m_runningUpPic
const TGPicture * m_runningUpPic
Definition: CSGContinuousAction.h:73
CSGContinuousAction::m_imageFileName
std::string m_imageFileName
Definition: CSGContinuousAction.h:67
CSGContinuousAction.h
CSGContinuousAction::m_upPic
const TGPicture * m_upPic
Definition: CSGContinuousAction.h:70
CSGContinuousAction::m_downPic
const TGPicture * m_downPic
Definition: CSGContinuousAction.h:71
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
CSGContinuousAction::CSGContinuousAction
CSGContinuousAction(CSGActionSupervisor *sup, const char *name)
Definition: CSGContinuousAction.cc:32
CSGContinuousAction::globalDisable
void globalDisable() override
Definition: CSGContinuousAction.cc:102
CSGAction::getMenuEntry
int getMenuEntry() const
Definition: CSGAction.cc:259
CSGContinuousAction::stopped_
sigc::signal< void > stopped_
Definition: CSGContinuousAction.h:53
CSGContinuousAction::switchMode
void switchMode()
Definition: CSGContinuousAction.cc:62
CSGAction::globalEnable
virtual void globalEnable()
Definition: CSGAction.cc:279
CSGAction::getMenu
TGPopupMenu * getMenu() const
Definition: CSGAction.cc:257
CSGContinuousAction::m_runningImageFileName
std::string m_runningImageFileName
Definition: CSGContinuousAction.h:68