#include <Fireworks/Core/interface/CSGAction.h>
Public Member Functions | |
void | activate () |
void | addSCToMenu () |
void | createCheckButton (TGCompositeFrame *p, TGLayoutHints *l=0, Bool_t state=true, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), FontStruct_t font=TGTextButton::GetDefaultFontStruct()) |
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) |
void | createMenuEntry (TGPopupMenu *menu) |
void | createPictureButton (TGCompositeFrame *p, const TGPicture *pic, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), UInt_t option=kRaisedFrame|kDoubleBorder) |
void | createShortcut (UInt_t key, const char *mod, int windowID) |
void | createTextButton (TGCompositeFrame *p, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), FontStruct_t font=TGTextButton::GetDefaultFontStruct(), UInt_t option=kRaisedFrame|kDoubleBorder) |
CSGAction (CSGActionSupervisor *supervisor, const char *name) | |
void | disable () |
void | enable () |
Int_t | getKeycode () const |
TGPopupMenu * | getMenu () const |
int | getMenuEntry () const |
Int_t | getModcode () const |
const std::string & | getName () const |
TString | getSCCombo () const |
TGToolBar * | getToolBar () const |
ToolBarData_t * | getToolBarData () const |
const std::string & | getToolTip () const |
virtual void | globalDisable () |
virtual void | globalEnable () |
virtual Bool_t | isEnabled () const |
Bool_t | resizeMenuEntry () |
void | setMenuLabel (const std::string &label) |
void | setName (const std::string &name) |
void | setToolTip (const std::string &tip) |
virtual | ~CSGAction () |
Static Public Member Functions | |
static TString | keycodeToString (Int_t keycode) |
Public Attributes | |
sigc::signal< void > | activated |
Private Member Functions | |
CSGAction (const CSGAction &) | |
void | disableImp () |
void | enableImp () |
const CSGAction & | operator= (const CSGAction &) |
Private Attributes | |
std::vector< TGButton * > | m_buttons |
CSGConnector * | m_connector |
Bool_t | m_enabled |
int | m_entry |
Bool_t | m_globalEnabled |
Int_t | m_keycode |
TGPopupMenu * | m_menu |
Int_t | m_modcode |
std::string | m_name |
TString | m_scCombo |
CSGActionSupervisor * | m_supervisor |
TGToolBar * | m_toolBar |
ToolBarData_t * | m_tools |
std::string | m_toolTip |
int | m_windowID |
Description: <one line="" class="" summary>="">
Usage: <usage>
Definition at line 39 of file CSGAction.h.
CSGAction::CSGAction | ( | CSGActionSupervisor * | supervisor, |
const char * | name | ||
) |
Definition at line 38 of file CSGAction.cc.
References CSGActionSupervisor::addToActionMap(), CSGActionSupervisor::getListOfActions(), m_connector, m_enabled, m_entry, m_globalEnabled, m_keycode, m_menu, m_modcode, m_name, m_supervisor, m_toolBar, m_tools, m_toolTip, m_windowID, and mergeVDriftHistosByStation::name.
: m_connector(0) { m_enabled = true; m_globalEnabled = true; m_supervisor = supervisor; m_name = name; m_toolTip = ""; m_menu = 0; m_toolBar = 0; m_tools = 0; m_connector = new CSGConnector(this, m_supervisor); m_supervisor->addToActionMap(this); m_entry = m_supervisor->getListOfActions().size(); m_keycode = 0; m_modcode = 0; m_windowID = -1; }
CSGAction::~CSGAction | ( | ) | [virtual] |
Definition at line 61 of file CSGAction.cc.
References m_connector.
{ delete m_connector; //Don't delete GUI parts since they are owned by their GUI parent }
CSGAction::CSGAction | ( | const CSGAction & | ) | [private] |
void CSGAction::activate | ( | ) | [inline] |
void CSGAction::addSCToMenu | ( | ) |
Definition at line 224 of file CSGAction.cc.
References m_menu, m_supervisor, CSGActionSupervisor::resizeMenu(), and resizeMenuEntry().
Referenced by createMenuEntry(), and createShortcut().
{ Bool_t widthChanged = resizeMenuEntry(); if (widthChanged) m_supervisor->resizeMenu(m_menu); }
void CSGAction::createCheckButton | ( | TGCompositeFrame * | p, |
TGLayoutHints * | l = 0 , |
||
Bool_t | state = true , |
||
Int_t | id = -1 , |
||
GContext_t | norm = TGButton::GetDefaultGC() () , |
||
FontStruct_t | font = TGTextButton::GetDefaultFontStruct() |
||
) |
Definition at line 138 of file CSGAction.cc.
References CSGActionSupervisor::getToolTipDelay(), isEnabled(), m_buttons, m_name, m_supervisor, and m_toolTip.
{ TGCheckButton* checkButton = new TGCheckButton(p, m_name.c_str(), id, norm, font); if (m_toolTip != "") checkButton->SetToolTipText(m_toolTip.c_str(), m_supervisor->getToolTipDelay()); p->AddFrame(checkButton, l); if (state) checkButton->SetState(kButtonDown, false); TQObject::Connect(checkButton, "Clicked()", "CSGAction", this, "activate()"); m_buttons.push_back(checkButton); if(!isEnabled()) { checkButton->SetEnabled(kFALSE); } }
FWCustomIconsButton * CSGAction::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 at line 163 of file CSGAction.cc.
References CSGActionSupervisor::getToolTipDelay(), isEnabled(), m_buttons, m_supervisor, and m_toolTip.
Referenced by CmsShowMainFrame::CmsShowMainFrame().
{ FWCustomIconsButton* picButton = new FWCustomIconsButton(p, upPic, downPic, disabledPic, 0, id, norm, option); if (m_toolTip != "") picButton->SetToolTipText(m_toolTip.c_str(), m_supervisor->getToolTipDelay()); p->AddFrame(picButton, l); TQObject::Connect(picButton, "Clicked()", "CSGAction", this, "activate()"); m_buttons.push_back(picButton); if(!isEnabled()) { picButton->SetEnabled(kFALSE); } return picButton; }
void CSGAction::createMenuEntry | ( | TGPopupMenu * | menu | ) |
Definition at line 214 of file CSGAction.cc.
References addSCToMenu(), isEnabled(), m_connector, m_entry, m_keycode, m_menu, m_name, and relval_steps::menu.
Referenced by CmsShowMainFrame::CmsShowMainFrame(), and CmsShowMainFrame::createNewViewerAction().
void CSGAction::createPictureButton | ( | TGCompositeFrame * | p, |
const TGPicture * | pic, | ||
TGLayoutHints * | l = 0 , |
||
Int_t | id = -1 , |
||
GContext_t | norm = TGButton::GetDefaultGC() () , |
||
UInt_t | option = kRaisedFrame|kDoubleBorder |
||
) |
Definition at line 151 of file CSGAction.cc.
References CSGActionSupervisor::getToolTipDelay(), isEnabled(), m_buttons, m_supervisor, and m_toolTip.
{ TGPictureButton* picButton = new TGPictureButton(p, pic, id, norm, option); if (m_toolTip != "") picButton->SetToolTipText(m_toolTip.c_str(), m_supervisor->getToolTipDelay()); p->AddFrame(picButton, l); TQObject::Connect(picButton, "Clicked()", "CSGAction", this, "activate()"); m_buttons.push_back(picButton); if(!isEnabled()) { picButton->SetEnabled(kFALSE); } }
void CSGAction::createShortcut | ( | UInt_t | key, |
const char * | mod, | ||
int | windowID | ||
) |
Definition at line 183 of file CSGAction.cc.
References addSCToMenu(), keycodeToString(), m_keycode, m_menu, m_modcode, m_scCombo, and m_windowID.
Referenced by CmsShowMainFrame::CmsShowMainFrame().
{ Int_t keycode = gVirtualX->KeysymToKeycode((int)key); m_windowID = windowID; Int_t modcode; TString scText; if (strcmp(mod, "CTRL") == 0) { modcode = kKeyControlMask; scText = "<ctrl> "; } else if (strcmp(mod, "CTRL+SHIFT") == 0) { modcode = kKeyControlMask | kKeyShiftMask; scText = "<ctrl> <shift> "; } else { // Default to ALT for now modcode = kKeyMod1Mask; scText = "<alt> "; } scText += keycodeToString(keycode); m_scCombo = scText; gVirtualX->GrabKey(m_windowID, keycode, modcode, kTRUE); gVirtualX->GrabKey(m_windowID, keycode, modcode | kKeyMod2Mask, kTRUE); gVirtualX->GrabKey(m_windowID, keycode, modcode | kKeyLockMask, kTRUE); gVirtualX->GrabKey(m_windowID, keycode, modcode | kKeyMod2Mask | kKeyLockMask, kTRUE); m_keycode = keycode; m_modcode = modcode; if (m_menu != 0) addSCToMenu(); }
void CSGAction::createTextButton | ( | TGCompositeFrame * | p, |
TGLayoutHints * | l = 0 , |
||
Int_t | id = -1 , |
||
GContext_t | norm = TGButton::GetDefaultGC() () , |
||
FontStruct_t | font = TGTextButton::GetDefaultFontStruct() , |
||
UInt_t | option = kRaisedFrame|kDoubleBorder |
||
) |
Definition at line 127 of file CSGAction.cc.
References CSGActionSupervisor::getToolTipDelay(), isEnabled(), m_buttons, m_name, m_supervisor, and m_toolTip.
Referenced by FWConvTrackHitsDetailView::build(), and FWTrackHitsDetailView::build().
{ TGTextButton* textButton = new TGTextButton(p, m_name.c_str(), id, norm, font, option); if (m_toolTip != "") textButton->SetToolTipText(m_toolTip.c_str(), m_supervisor->getToolTipDelay()); p->AddFrame(textButton, l); TQObject::Connect(textButton, "Clicked()", "CSGAction", this, "activate()"); m_buttons.push_back(textButton); if(!isEnabled()) { textButton->SetEnabled(kFALSE); } }
void CSGAction::disable | ( | ) |
Definition at line 290 of file CSGAction.cc.
References disableImp(), and m_enabled.
Referenced by CmsShowMainFrame::CmsShowMainFrame(), CmsShowMainFrame::enableComplexNavigation(), CmsShowMainFrame::enableNext(), and CmsShowMainFrame::enablePrevious().
{ m_enabled = false; disableImp(); }
void CSGAction::disableImp | ( | ) | [private] |
Definition at line 332 of file CSGAction.cc.
References isEnabled(), m_buttons, m_entry, m_keycode, m_menu, m_modcode, m_toolBar, and m_windowID.
Referenced by disable(), and globalDisable().
{ if(!isEnabled()) { if (m_menu != 0) m_menu->DisableEntry(m_entry); for(std::vector<TGButton*>::iterator it = m_buttons.begin(), itEnd = m_buttons.end(); it != itEnd; ++it) { (*it)->SetEnabled(kFALSE); } if (m_toolBar != 0) m_toolBar->GetButton(m_entry)->SetEnabled(kFALSE); if (m_keycode != 0) { gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode, kFALSE); gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode | kKeyMod2Mask, kFALSE); gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode | kKeyLockMask, kFALSE); gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode | kKeyMod2Mask | kKeyLockMask, kFALSE); } } }
void CSGAction::enable | ( | ) |
Definition at line 285 of file CSGAction.cc.
References enableImp(), and m_enabled.
Referenced by CmsShowMain::checkPosition(), FWFFService::checkPosition(), FWFFLooper::checkPosition(), CmsShowMainFrame::enableComplexNavigation(), CmsShowMainFrame::enableNavigatorControls(), CmsShowMainFrame::enableNext(), and CmsShowMainFrame::enablePrevious().
void CSGAction::enableImp | ( | ) | [private] |
Definition at line 313 of file CSGAction.cc.
References isEnabled(), m_buttons, m_entry, m_keycode, m_menu, m_modcode, m_toolBar, and m_windowID.
Referenced by enable(), and globalEnable().
{ if(isEnabled()) { if (m_menu != 0) m_menu->EnableEntry(m_entry); for(std::vector<TGButton*>::iterator it = m_buttons.begin(), itEnd = m_buttons.end(); it != itEnd; ++it) { (*it)->SetEnabled(kTRUE); } if (m_toolBar != 0) m_toolBar->GetButton(m_entry)->SetEnabled(kTRUE); if (m_keycode != 0) { gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode, kTRUE); gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode | kKeyMod2Mask, kTRUE); gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode | kKeyLockMask, kTRUE); gVirtualX->GrabKey(m_windowID, m_keycode, m_modcode | kKeyMod2Mask | kKeyLockMask, kTRUE); } } }
Int_t CSGAction::getKeycode | ( | ) | const |
TGPopupMenu * CSGAction::getMenu | ( | ) | const |
Definition at line 261 of file CSGAction.cc.
References m_menu.
Referenced by CSGContinuousAction::stop(), and CSGContinuousAction::switchMode().
{ return m_menu; }
int CSGAction::getMenuEntry | ( | ) | const |
Definition at line 265 of file CSGAction.cc.
References m_entry.
Referenced by CSGContinuousAction::stop(), and CSGContinuousAction::switchMode().
{ return m_entry; }
Int_t CSGAction::getModcode | ( | ) | const |
const std::string & CSGAction::getName | ( | void | ) | const |
TString CSGAction::getSCCombo | ( | ) | const |
TGToolBar * CSGAction::getToolBar | ( | ) | const |
Definition at line 281 of file CSGAction.cc.
References m_toolBar.
Referenced by CSGContinuousAction::stop(), and CSGContinuousAction::switchMode().
{ return m_toolBar; }
ToolBarData_t * CSGAction::getToolBarData | ( | ) | const |
Definition at line 277 of file CSGAction.cc.
References m_tools.
Referenced by CSGContinuousAction::stop(), and CSGContinuousAction::switchMode().
{ return m_tools; }
const std::string & CSGAction::getToolTip | ( | ) | const |
void CSGAction::globalDisable | ( | ) | [virtual] |
Reimplemented in CSGContinuousAction.
Definition at line 303 of file CSGAction.cc.
References disableImp(), and m_globalEnabled.
{ m_globalEnabled=false; disableImp(); }
void CSGAction::globalEnable | ( | ) | [virtual] |
Reimplemented in CSGContinuousAction.
Definition at line 296 of file CSGAction.cc.
References enableImp(), and m_globalEnabled.
{ m_globalEnabled=true; enableImp(); }
Bool_t CSGAction::isEnabled | ( | ) | const [virtual] |
Definition at line 309 of file CSGAction.cc.
References m_enabled, and m_globalEnabled.
Referenced by CmsShowMain::checkPosition(), createCheckButton(), createCustomIconsButton(), createMenuEntry(), createPictureButton(), createTextButton(), disableImp(), enableImp(), CmsShowMainFrame::nextIsEnabled(), and CmsShowMainFrame::previousIsEnabled().
{ return m_enabled && m_globalEnabled; }
TString CSGAction::keycodeToString | ( | Int_t | keycode | ) | [static] |
Definition at line 356 of file CSGAction.cc.
References i.
Referenced by createShortcut().
{ int i; char letter; TString rep; for (i = kKey_a; i < kKey_a + 26; i++) { if (gVirtualX->KeysymToKeycode(i) == keycode) { letter = (char)(i - kKey_a + 'a'); rep = TString(letter); return rep; } } for (i = kKey_A; i < kKey_A + 26; i++) { if(gVirtualX->KeysymToKeycode(i) == keycode) { letter = (char)(i - kKey_A + 'a'); rep = TString(letter); return rep; } } if (keycode == gVirtualX->KeysymToKeycode(kKey_Left)) { rep = TString("<-"); return rep; } if (keycode == gVirtualX->KeysymToKeycode(kKey_Right)) { rep = TString("->"); return rep; } rep = TString(""); return rep; }
Bool_t CSGAction::resizeMenuEntry | ( | ) |
Definition at line 229 of file CSGAction.cc.
References cond::rpcobimon::current, m_entry, m_menu, m_name, m_scCombo, and tablePrinter::width.
Referenced by addSCToMenu().
{ FontStruct_t font = gClient->GetResourcePool()->GetMenuHiliteFont()->GetFontStruct(); Bool_t widthChanged = kTRUE; UInt_t width = m_menu->GetWidth(); TString realName(m_name); if (realName.Contains("->")) { // Should make function to do this and store in member data... while (!(realName.BeginsWith("->")) && realName.Length() > 0) { realName.Replace(0,1,0,0); } realName.Replace(0,2,0,0); } TString scText = m_scCombo; while (gVirtualX->TextWidth(font, realName.Data(), realName.Length()) + gVirtualX->TextWidth(font, scText.Data(), scText.Length()) + 53 < (Int_t)width) { widthChanged = kFALSE; realName += " "; } realName += "\t"; realName += scText; TIter next(m_menu->GetListOfEntries()); TGMenuEntry *current; while (0 != (current = (TGMenuEntry *)next())) { if (current == m_menu->GetEntry(m_entry)) { break; } } current = (TGMenuEntry *)next(); m_menu->DeleteEntry(m_entry); m_menu->AddEntry(realName, m_entry, 0, 0, current); return widthChanged; }
void CSGAction::setMenuLabel | ( | const std::string & | label | ) |
void CSGAction::setName | ( | const std::string & | name | ) |
Definition at line 94 of file CSGAction.cc.
References m_buttons, m_name, and mergeVDriftHistosByStation::name.
void CSGAction::setToolTip | ( | const std::string & | tip | ) |
Definition at line 117 of file CSGAction.cc.
References CSGActionSupervisor::getToolTipDelay(), m_buttons, m_supervisor, m_tools, and m_toolTip.
Referenced by FWConvTrackHitsDetailView::build(), FWTrackHitsDetailView::build(), and CmsShowMainFrame::CmsShowMainFrame().
{ m_toolTip = tip; for(std::vector<TGButton*>::iterator it = m_buttons.begin(), itEnd = m_buttons.end(); it != itEnd; ++it) { (*it)->SetToolTipText(tip.c_str(), m_supervisor->getToolTipDelay()); } if (m_tools != 0) m_tools->fTipText = tip.c_str(); }
sigc::signal<void> CSGAction::activated |
Definition at line 89 of file CSGAction.h.
Referenced by activate(), FWConvTrackHitsDetailView::build(), FWTrackHitsDetailView::build(), CmsShowMainFrame::CloseWindow(), CSGContinuousAction::CSGContinuousAction(), FWGUIManager::FWGUIManager(), CmsShowMainFrame::quit(), and CmsShowMain::setupDataHandling().
std::vector<TGButton*> CSGAction::m_buttons [private] |
Definition at line 103 of file CSGAction.h.
Referenced by createCheckButton(), createCustomIconsButton(), createPictureButton(), createTextButton(), disableImp(), enableImp(), setName(), and setToolTip().
CSGConnector* CSGAction::m_connector [private] |
Definition at line 110 of file CSGAction.h.
Referenced by createMenuEntry(), CSGAction(), and ~CSGAction().
Bool_t CSGAction::m_enabled [private] |
Definition at line 111 of file CSGAction.h.
Referenced by CSGAction(), disable(), enable(), and isEnabled().
int CSGAction::m_entry [private] |
Definition at line 107 of file CSGAction.h.
Referenced by createMenuEntry(), CSGAction(), disableImp(), enableImp(), getMenuEntry(), resizeMenuEntry(), and setMenuLabel().
Bool_t CSGAction::m_globalEnabled [private] |
Definition at line 112 of file CSGAction.h.
Referenced by CSGAction(), globalDisable(), globalEnable(), and isEnabled().
Int_t CSGAction::m_keycode [private] |
Definition at line 104 of file CSGAction.h.
Referenced by createMenuEntry(), createShortcut(), CSGAction(), disableImp(), enableImp(), and getKeycode().
TGPopupMenu* CSGAction::m_menu [private] |
Definition at line 106 of file CSGAction.h.
Referenced by addSCToMenu(), createMenuEntry(), createShortcut(), CSGAction(), disableImp(), enableImp(), getMenu(), resizeMenuEntry(), and setMenuLabel().
Int_t CSGAction::m_modcode [private] |
Definition at line 105 of file CSGAction.h.
Referenced by createShortcut(), CSGAction(), disableImp(), enableImp(), and getModcode().
std::string CSGAction::m_name [private] |
Definition at line 100 of file CSGAction.h.
Referenced by createCheckButton(), createMenuEntry(), createTextButton(), CSGAction(), getName(), resizeMenuEntry(), and setName().
TString CSGAction::m_scCombo [private] |
Definition at line 102 of file CSGAction.h.
Referenced by createShortcut(), getSCCombo(), and resizeMenuEntry().
CSGActionSupervisor* CSGAction::m_supervisor [private] |
Definition at line 99 of file CSGAction.h.
Referenced by addSCToMenu(), createCheckButton(), createCustomIconsButton(), createPictureButton(), createTextButton(), CSGAction(), and setToolTip().
TGToolBar* CSGAction::m_toolBar [private] |
Definition at line 108 of file CSGAction.h.
Referenced by CSGAction(), disableImp(), enableImp(), and getToolBar().
ToolBarData_t* CSGAction::m_tools [private] |
Definition at line 109 of file CSGAction.h.
Referenced by CSGAction(), getToolBarData(), and setToolTip().
std::string CSGAction::m_toolTip [private] |
Definition at line 101 of file CSGAction.h.
Referenced by createCheckButton(), createCustomIconsButton(), createPictureButton(), createTextButton(), CSGAction(), getToolTip(), and setToolTip().
int CSGAction::m_windowID [private] |
Definition at line 113 of file CSGAction.h.
Referenced by createShortcut(), CSGAction(), disableImp(), and enableImp().