15 #include <TGResourcePool.h>
17 #include <KeySymbols.h>
100 TGTextButton* tb =
dynamic_cast<TGTextButton*
>(*it);
103 (tb)->SetText(name.c_str());
104 gClient->NeedRedraw(tb);
112 m_menu->GetEntry(
m_entry)->GetLabel()->SetString(label.c_str());
127 TGTextButton* textButton =
new TGTextButton(p,
m_name.c_str(), id, norm, font, option);
129 p->AddFrame(textButton, l);
130 TQObject::Connect(textButton,
"Clicked()",
"CSGAction",
this,
"activate()");
133 textButton->SetEnabled(kFALSE);
138 TGCheckButton* checkButton =
new TGCheckButton(p,
m_name.c_str(), id, norm, font);
140 p->AddFrame(checkButton, l);
142 if (state) checkButton->SetState(kButtonDown,
false);
143 TQObject::Connect(checkButton,
"Clicked()",
"CSGAction",
this,
"activate()");
146 checkButton->SetEnabled(kFALSE);
151 TGPictureButton* picButton =
new TGPictureButton(p, pic,
id, norm, option);
153 p->AddFrame(picButton, l);
154 TQObject::Connect(picButton,
"Clicked()",
"CSGAction",
this,
"activate()");
157 picButton->SetEnabled(kFALSE);
163 const TGPicture* upPic,
164 const TGPicture* downPic,
165 const TGPicture* disabledPic,
173 p->AddFrame(picButton, l);
174 TQObject::Connect(picButton,
"Clicked()",
"CSGAction",
this,
"activate()");
177 picButton->SetEnabled(kFALSE);
183 Int_t keycode = gVirtualX->KeysymToKeycode((
int)key);
187 if (strcmp(mod,
"CTRL") == 0) {
188 modcode = kKeyControlMask;
191 else if (strcmp(mod,
"CTRL+SHIFT") == 0) {
192 modcode = kKeyControlMask | kKeyShiftMask;
193 scText =
"<ctrl> <shift> ";
197 modcode = kKeyMod1Mask;
203 gVirtualX->GrabKey(
m_windowID, keycode, modcode, kTRUE);
204 gVirtualX->GrabKey(
m_windowID, keycode, modcode | kKeyMod2Mask, kTRUE);
205 gVirtualX->GrabKey(
m_windowID, keycode, modcode | kKeyLockMask, kTRUE);
206 gVirtualX->GrabKey(
m_windowID, keycode, modcode | kKeyMod2Mask | kKeyLockMask, kTRUE);
215 if (!(menu->HasConnection(
"Activated(Int_t)"))) TQObject::Connect(menu,
"Activated(Int_t)",
"CSGConnector",
m_connector,
"handleMenu(Int_t)");
229 FontStruct_t font = gClient->GetResourcePool()->GetMenuHiliteFont()->GetFontStruct();
230 Bool_t widthChanged = kTRUE;
233 if (realName.Contains(
"->")) {
235 while (!(realName.BeginsWith(
"->")) && realName.Length() > 0) {
236 realName.Replace(0,1,0,0);
238 realName.Replace(0,2,0,0);
241 while (gVirtualX->TextWidth(font, realName.Data(), realName.Length()) + gVirtualX->TextWidth(font, scText.Data(), scText.Length()) + 53 < (Int_t)
width) {
242 widthChanged = kFALSE;
249 while (0 != (current = (TGMenuEntry *)
next())) {
254 current = (TGMenuEntry *)
next();
318 (*it)->SetEnabled(kTRUE);
337 (*it)->SetEnabled(kFALSE);
359 for (i = kKey_a; i < kKey_a + 26; i++) {
360 if (gVirtualX->KeysymToKeycode(i) == keycode) {
361 letter = (
char)(i - kKey_a +
'a');
362 rep = TString(letter);
366 for (i = kKey_A; i < kKey_A + 26; i++) {
367 if(gVirtualX->KeysymToKeycode(i) == keycode) {
368 letter = (
char)(i - kKey_A +
'a');
369 rep = TString(letter);
373 if (keycode == gVirtualX->KeysymToKeycode(kKey_Left)) {
377 if (keycode == gVirtualX->KeysymToKeycode(kKey_Right)) {
381 if (keycode == gVirtualX->KeysymToKeycode(kKey_Space)) {
382 rep = TString(
"space");
const std::string & getName() const
ToolBarData_t * getToolBarData() const
void setMenuLabel(const std::string &label)
TGPopupMenu * getMenu() const
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())
CSGConnector * m_connector
void resizeMenu(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)
virtual void globalDisable()
void addToActionMap(CSGAction *action)
TGToolBar * getToolBar() const
void setToolTip(const std::string &tip)
virtual Bool_t isEnabled() const
Long_t getToolTipDelay() const
static TString keycodeToString(Int_t keycode)
TString getSCCombo() const
CSGActionSupervisor * m_supervisor
void setName(const std::string &name)
void createMenuEntry(TGPopupMenu *menu)
CSGAction(CSGActionSupervisor *supervisor, const char *name)
virtual void globalEnable()
std::vector< TGButton * > m_buttons
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 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)
const std::vector< CSGAction * > & getListOfActions() const
void createShortcut(UInt_t key, const char *mod, int windowID)
const std::string & getToolTip() const
T mod(const T &a, const T &b)