122 const char gHelpBuilder[] =
"\
123 Start/Stop Edit Mode\n\
124 ************************************************\n\
125 o Select File menu / Edit\n\
126 o Select Start Edit button on the toolbar\n\
127 o Ctrl-Double-Click on the project frame\n\
128 o Double-Click to activate quick edit action (defined in root.mimes)\n\
130 Select, Grab, Drop\n\
131 ************************************************\n\
132 It is possible to select & drag any frame and drop it to another frame\n\
134 o Press left mouse button Click or Ctrl-Click to select an object.\n\
135 o Press right mouse button to activate context menu\n\
136 o Multiple selection can be done in two ways (grabbing):\n\
137 - draw lasso and press Return key\n\
138 - press Shift key and draw lasso\n\
140 - select frame and press Ctrl-Return key\n\
141 o Changing layout order of widgets:\n\
142 - set broken layout mode via toolbar button or check button\n\
143 \'Layout subframes\' in tab \'Layout\'\n\
144 - select a widget and use arrow keys to change the layout order\n\
146 - remove the selection (if any) by using the space bar\n\
147 - draw lasso and use the four toolbar buttons for widget alignment\n\
148 - arrow keys align the frames too, if you prefer the keyboard\n\
151 ************************************************\n\
152 o Return - grab selected frames\n\
153 o Ctrl-Return - drop frames\n\
154 o Del - delete selected frame\n\
155 o Shift-Del - crop\n\
158 o Ctrl-V - paste frame into the last clicked position\n\
159 o Ctrl-L - compact frame\n\
160 o Ctrl-B - enable/disable layout\n\
161 o Ctrl-H - switch Horizontal-Vertical layout\n\
162 o Ctrl-G - switch ON/OFF grid\n\
164 o Ctrl-O - open and execute ROOT macro file\n\
165 o Ctrl-N - create new main frame\n\
166 o Ctrl-Z - undo last action (not implemented)\n\
167 o Shift-Ctrl-Z - redo (not implemented)\n\
170 ************************************************\n\
172 For more information, please see the GuiBuilder Howto page at:\n\
174 http://root.cern.ch/root/HowtoGuiBuilder.html\n\
178 const char gHelpAboutBuilder[] =
"\
181 ************************************************************\n\
182 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *\n\
183 * All rights reserved. *\n\
185 * For the licensing terms see $ROOTSYS/LICENSE. *\n\
186 * For the list of contributors see $ROOTSYS/README/CREDITS.*\n\
187 ************************************************************\n\
192 static ToolBarData_t gToolBarData[] = {
193 {
"bld_edit.png",
"Start Edit (Ctrl-Dbl-Click)", kFALSE, kEditableAct, 0 },
194 {
"",
"", kFALSE, -1, 0 },
195 {
"bld_new.png",
"New (Ctrl-N)", kFALSE, kNewAct, 0 },
196 {
"bld_open.png",
"Open (Ctrl-O)", kFALSE, kOpenAct, 0 },
197 {
"bld_save.png",
"Save As (Ctrl-S)", kFALSE, kSaveAct, 0 },
198 {
"",
"", kFALSE, -1, 0 },
201 {
"",
"", kFALSE, -1, 0 },
202 {
"bld_compact.png",
"Compact selected frame (Ctrl-L)", kFALSE, kCompactAct, 0 },
203 {
"bld_break.png",
"Disable/Enable layout (Ctrl-B)", kFALSE, kBreakLayoutAct, 0 },
204 {
"bld_hbox.png",
"Layout selected frame horizontally (Ctrl-H)", kFALSE, kLayoutHAct, 0 },
205 {
"bld_vbox.png",
"Layout selected frame vertically (Ctrl-H)", kFALSE, kLayoutVAct, 0 },
206 {
"bld_grid.png",
"On/Off grid (Ctrl+G)", kFALSE, kGridAct, 0 },
207 {
"",
"", kFALSE, -1, 0 },
208 {
"bld_AlignTop.png",
"Align selected frames to the top line of lasso (Up Arrow)", kFALSE, kUpAct, 0 },
209 {
"bld_AlignBtm.png",
"Align selected frames to the down line of lasso (Down Arrow)", kFALSE, kDownAct, 0 },
210 {
"bld_AlignLeft.png",
"Align selected frames to the left line of lasso (Left Arrow)", kFALSE, kLeftAct, 0 },
211 {
"bld_AlignRight.png",
"Align selected frames to the right line of lasso (Right Arrow)", kFALSE, kRightAct, 0 },
212 {
"",
"", kFALSE, -1, 0 },
213 {
"bld_cut.png",
"Cut (Ctrl-X)", kFALSE, kCutAct, 0 },
214 {
"bld_copy.png",
"Copy (Ctrl-C)", kFALSE, kCopyAct, 0 },
215 {
"bld_paste.png",
"Paste frame into the last clicked position (Ctrl-V)", kFALSE, kPasteAct, 0 },
217 {
"bld_delete.png",
"Delete (Del/Backspace)", kFALSE, kDeleteAct, 0 },
218 {
"bld_crop.png",
"Crop (Shift-Del)", kFALSE, kCropAct, 0 },
222 { 0, 0, kFALSE, 0, 0 }
226 ClassImp(TRootGuiBuilder);
229 TGGC *TRootGuiBuilder::fgBgnd = 0;
230 TGGC *TRootGuiBuilder::fgBgndPopup = 0;
231 TGGC *TRootGuiBuilder::fgBgndPopupHlght = 0;
242 class TGuiBldMenuTitle :
public TGMenuTitle {
251 virtual ~TGuiBldMenuTitle() {}
252 TGuiBldMenuTitle(
const TGWindow *p, TGHotString *s, TGPopupMenu *menu) :
253 TGMenuTitle(p, s, menu) {
254 fEditDisabled = kEditDisable;
255 fBgndColor = TRootGuiBuilder::GetBgnd();
256 SetBackgroundColor(fBgndColor);
257 AddInput(kEnterWindowMask | kLeaveWindowMask);
260 Bool_t HandleCrossing(Event_t *event);
266 Bool_t TGuiBldMenuTitle::HandleCrossing(Event_t *event)
268 if (event->fType == kEnterNotify) {
269 fBgndColor = TRootGuiBuilder::GetPopupHlght();
271 fBgndColor = TRootGuiBuilder::GetBgnd();
280 void TGuiBldMenuTitle::DoRedraw()
284 int x, y, max_ascent, max_descent;
287 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
290 gVirtualX->SetForeground(fNormGC, GetDefaultSelectedBackground());
291 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
292 gVirtualX->SetForeground(fNormGC, GetForeground());
293 fLabel->Draw(fId, fSelGC, x, y + max_ascent);
295 gVirtualX->SetForeground(fNormGC, fBgndColor);
296 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
297 gVirtualX->SetForeground(fNormGC, GetForeground());
298 fLabel->Draw(fId, fNormGC, x, y + max_ascent);
300 if (fBgndColor == TRootGuiBuilder::GetPopupHlght()) {
301 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
302 0, 0, GetWidth()-1, GetHeight()-1);
308 class TGuiBldPopupMenu :
public TGPopupMenu {
311 virtual ~TGuiBldPopupMenu() { }
313 TGPopupMenu(gClient->GetDefaultRoot()) {
314 fEditDisabled = kEditDisable;
315 SetBackgroundColor(TRootGuiBuilder::GetPopupBgnd());
318 void DrawEntry(TGMenuEntry *entry);
324 void TGuiBldPopupMenu::DrawEntry(TGMenuEntry *entry)
329 if (entry->GetStatus() & kMenuHideMask)
332 if (entry->GetStatus() & kMenuDefaultMask) {
333 font = fHifontStruct;
334 gcval.fMask = kGCFont;
335 gcval.fFont = gVirtualX->GetFontHandle(font);
336 gVirtualX->ChangeGC(fNormGC, &gcval);
337 gVirtualX->ChangeGC(fSelGC, &gcval);
343 UInt_t sep = fEntrySep;
344 Int_t max_ascent, max_descent;
345 gVirtualX->GetFontProperties(font, max_ascent, max_descent);
346 if (entry->GetShortcut())
347 tw = 7 + gVirtualX->TextWidth(fFontStruct, entry->GetShortcutText(),
348 entry->GetShortcut()->Length());
350 Int_t tx = entry->GetEx() + fXl;
351 Int_t ty = entry->GetEy() + max_ascent + 2;
352 UInt_t h = max_ascent + max_descent + sep;
354 if (entry->GetPic() != 0) {
355 picposy = entry->GetEy() + h / 2;
356 picposy -= entry->GetPic()->GetHeight() / 2;
359 switch (entry->GetType()) {
363 if ((entry->GetStatus() & kMenuActiveMask) &&
364 entry->GetType() != kMenuLabel) {
365 if (entry->GetStatus() & kMenuEnableMask) {
366 gVirtualX->FillRectangle(fId,
367 TRootGuiBuilder::GetPopupHlghtGC()->GetGC(),
368 entry->GetEx()+1, entry->GetEy(),
369 fMenuWidth-6, h - 1);
370 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
371 entry->GetEx()+ 1, entry->GetEy()-1,
372 fMenuWidth - entry->GetEx()- 6, h - 1);
375 if (entry->GetType() == kMenuPopup) {
376 DrawTrianglePattern(fSelGC, fMenuWidth-10, entry->GetEy() + 3,
377 fMenuWidth-6, entry->GetEy() + 11);
380 if (entry->GetStatus() & kMenuCheckedMask) {
381 DrawCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
385 if (entry->GetStatus() & kMenuRadioMask) {
386 DrawRCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
390 if (entry->GetPic() != 0) {
391 entry->GetPic()->Draw(fId, fSelGC, 8, picposy);
394 entry->GetLabel()->Draw(fId,
395 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
396 GetShadowGC()(), tx, ty);
397 if (entry->GetShortcut())
398 entry->GetShortcut()->Draw(fId,
399 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
400 GetShadowGC()(), fMenuWidth - tw, ty);
402 if ( entry->GetType() != kMenuLabel) {
403 gVirtualX->FillRectangle(fId,
404 TRootGuiBuilder::GetBgndGC()->GetGC(),
405 entry->GetEx()+1, entry->GetEy()-1, tx-4, h);
407 gVirtualX->FillRectangle(fId,
408 TRootGuiBuilder::GetPopupBgndGC()->GetGC(),
409 tx-1, entry->GetEy()-1, fMenuWidth-tx-1, h);
411 gVirtualX->FillRectangle(fId, TGFrame::GetBckgndGC()(),
412 entry->GetEx()+1, entry->GetEy()-1,
413 fMenuWidth - entry->GetEx()- 3, h);
416 if (entry->GetType() == kMenuPopup) {
417 DrawTrianglePattern(fNormGC, fMenuWidth-10, entry->GetEy() + 3,
418 fMenuWidth-6, entry->GetEy() + 11);
421 if (entry->GetStatus() & kMenuCheckedMask) {
422 DrawCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
426 if (entry->GetStatus() & kMenuRadioMask) {
427 DrawRCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
431 if (entry->GetPic() != 0) {
432 entry->GetPic()->Draw(fId, fNormGC, 8, picposy);
435 if (entry->GetStatus() & kMenuEnableMask) {
436 entry->GetLabel()->Draw(fId, fNormGC, tx, ty);
437 if (entry->GetShortcut())
438 entry->GetShortcut()->Draw(fId, fNormGC, fMenuWidth - tw, ty);
440 entry->GetLabel()->Draw(fId, GetHilightGC()(), tx+1, ty+1);
441 entry->GetLabel()->Draw(fId, GetShadowGC()(), tx, ty);
442 if (entry->GetShortcut()) {
443 entry->GetShortcut()->Draw(fId, GetHilightGC()(),
444 fMenuWidth - tw+1, ty+1);
445 entry->GetShortcut()->Draw(fId, GetShadowGC()(),
446 fMenuWidth - tw, ty);
453 gVirtualX->FillRectangle(fId, TRootGuiBuilder::GetBgndGC()->GetGC(),
454 entry->GetEx()+1, entry->GetEy()-1,
456 gVirtualX->DrawLine(fId, TGFrame::GetBlackGC()(), tx+1,
457 entry->GetEy()+1, fMenuWidth-sep,
463 if (entry->GetStatus() & kMenuDefaultMask) {
464 gcval.fFont = gVirtualX->GetFontHandle(fFontStruct);
465 gVirtualX->ChangeGC(fNormGC, &gcval);
466 gVirtualX->ChangeGC(fSelGC, &gcval);
471 class TGuiBldToolButton :
public TGPictureButton {
480 virtual ~TGuiBldToolButton() { }
481 TGuiBldToolButton(
const TGWindow *p,
const TGPicture *pic, Int_t
id = -1) :
482 TGPictureButton(p, pic, id) {
483 fBgndColor = TRootGuiBuilder::GetBgnd();
484 ChangeOptions(GetOptions() & ~kRaisedFrame);
487 Bool_t IsDown()
const {
return (fOptions & kSunkenFrame); }
488 void SetState(EButtonState state, Bool_t emit = kTRUE);
489 Bool_t HandleCrossing(Event_t *event);
490 void SetBackgroundColor(Pixel_t bgnd) { fBgndColor = bgnd; TGFrame::SetBackgroundColor(bgnd); }
496 void TGuiBldToolButton::DoRedraw()
498 int x = (fWidth - fTWidth) >> 1;
499 int y = (fHeight - fTHeight) >> 1;
500 UInt_t w = GetWidth() - 1;
501 UInt_t h = GetHeight()- 1;
503 TGFrame::SetBackgroundColor(fBgndColor);
506 if (fState == kButtonDown || fState == kButtonEngaged) {
511 const TGPicture *pic = fPic;
512 if (fState == kButtonDisabled) {
513 if (!fPicD) CreateDisabledPicture();
514 pic = fPicD ? fPicD : fPic;
516 if (fBgndColor == TRootGuiBuilder::GetPopupHlght()) {
518 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(), 0, 0, w, h);
520 pic->Draw(fId, fNormGC, x, y);
526 Bool_t TGuiBldToolButton::HandleCrossing(Event_t *event)
529 if (event->fType == kEnterNotify) {
536 if ((event->fType == kEnterNotify) && (fState != kButtonDisabled)) {
537 fBgndColor = TRootGuiBuilder::GetPopupHlght();
539 fBgndColor = TRootGuiBuilder::GetBgnd();
541 if (event->fType == kLeaveNotify) {
542 fBgndColor = TRootGuiBuilder::GetBgnd();
543 if (fState != kButtonDisabled && fState != kButtonEngaged)
544 SetState(kButtonUp, kFALSE);
555 void TGuiBldToolButton::SetState(EButtonState state, Bool_t emit)
557 Bool_t was = !IsDown();
559 if (state != fState) {
563 fOptions &= ~kRaisedFrame;
564 fOptions |= kSunkenFrame;
566 case kButtonDisabled:
568 fOptions &= ~kRaisedFrame;
569 fOptions &= ~kSunkenFrame;
574 if (emit) EmitSignals(was);
582 TRootGuiBuilder::TRootGuiBuilder(
const TGWindow *p) : TGuiBuilder(),
583 TGMainFrame(p ? p : gClient->GetDefaultRoot(), 1, 1)
585 SetCleanup(kDeepCleanup);
593 fManager = (TGuiBldDragManager *)gDragManager;
595 gDragManager = fManager =
new TGuiBldDragManager();
597 fManager->SetBuilder(
this);
599 fMenuBar =
new TGMdiMenuBar(
this, 10, 10);
600 AddFrame(fMenuBar,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
603 AddFrame(
new TGHorizontal3DLine(
this),
new TGLayoutHints(kLHintsTop |
604 kLHintsExpandX, 0,0,2,2));
606 fToolDock =
new TGDockableFrame(
this);
607 AddFrame(fToolDock,
new TGLayoutHints(kLHintsExpandX, 0, 0, 1, 0));
608 fToolDock->SetWindowName(
"GuiBuilder ToolBar");
610 fToolBar =
new TGToolBar(fToolDock);
611 fToolDock->AddFrame(fToolBar,
new TGLayoutHints(kLHintsTop |
616 for (
int i = 0; gToolBarData[i].fPixmap; i++) {
617 if (strlen(gToolBarData[i].fPixmap) == 0) {
622 const TGPicture *pic = fClient->GetPicture(gToolBarData[i].fPixmap);
623 TGuiBldToolButton *pb =
new TGuiBldToolButton(fToolBar, pic,
624 gToolBarData[i].fId);
625 pb->SetStyle(gClient->GetStyle());
627 pb->SetToolTipText(gToolBarData[i].fTipText);
629 TGToolTip *tip = pb->GetToolTip();
632 tip->Connect(
"Reset()",
"TRootGuiBuilder",
this,
"UpdateStatusBar(=0)");
633 tip->Connect(
"Hide()",
"TRootGuiBuilder",
this,
"EraseStatusBar()");
635 fToolBar->AddButton(
this, pb, spacing);
638 if (gToolBarData[i].fId == kEditableAct) {
643 if ((gToolBarData[i].fId == kUndoAct) ||
644 (gToolBarData[i].fId == kRedoAct)) {
645 pb->SetState(kButtonDisabled);
649 fToolBar->Connect(
"Clicked(Int_t)",
"TGuiBldDragManager", fManager,
650 "HandleAction(Int_t)");
652 AddFrame(
new TGHorizontal3DLine(
this),
new TGLayoutHints(kLHintsTop |
653 kLHintsExpandX, 0,0,2,5));
655 TGCompositeFrame *cf =
new TGHorizontalFrame(
this, 1, 1);
656 AddFrame(cf,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
665 fShutter =
new TGShutter(cf, kSunkenFrame);
666 cf->AddFrame(fShutter,
new TGLayoutHints(kLHintsNormal | kLHintsExpandY));
667 fShutter->ChangeOptions(fShutter->GetOptions() | kFixedWidth);
669 TGVSplitter *splitter =
new TGVSplitter(cf);
670 splitter->SetFrame(fShutter, kTRUE);
671 cf->AddFrame(splitter,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
673 fMain =
new TGMdiMainFrame(cf, fMenuBar, 1, 1);
674 fMain->Connect(
"FrameClosed(Int_t)",
"TRootGuiBuilder",
this,
675 "HandleWindowClosed(Int_t)");
677 TQObject::Connect(
"TGMdiFrame",
"CloseWindow()",
"TRootGuiBuilder",
this,
678 "MaybeCloseWindow()");
680 cf->AddFrame(fMain,
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
682 fMain->GetContainer()->SetEditDisabled(kEditDisable);
684 const TGPicture *pbg = fClient->GetPicture(
"bld_bg.png");
686 fMain->GetContainer()->SetBackgroundPixmap(pbg->GetPicture());
690 fEditor =
new TGuiBldEditor(cf);
691 cf->AddFrame(fEditor,
new TGLayoutHints(kLHintsNormal | kLHintsExpandY));
692 fManager->SetPropertyEditor(fEditor);
693 fEditor->SetEmbedded();
696 AddSection(
"Projects");
697 AddSection(
"Buttons");
698 AddSection(
"Containers");
701 AddSection(
"Complex Input");
702 AddSection(
"Display");
703 AddSection(
"Dialogs");
706 AddSection(
"User's Macros");
707 TGShutterItem *item = fShutter->GetItem(
"User's Macros");
708 TGCompositeFrame *cont = (TGCompositeFrame *)item->GetContainer();
709 cont->SetBackgroundColor(TColor::Number2Pixel(18));
711 TGuiBldAction *act =
new TGuiBldAction(
"TGMainFrame",
"Empty Frame",
714 act->fPic =
"bld_mainframe.xpm";
715 AddAction(act,
"Projects");
717 act =
new TGuiBldAction(
"TGMainFrame",
"Horizontal Frame", kGuiBldProj);
718 act->fAct =
"horizontal";
719 act->fPic =
"bld_mainframe.xpm";
720 AddAction(act,
"Projects");
722 act =
new TGuiBldAction(
"TGMainFrame",
"Vertical Frame", kGuiBldProj);
723 act->fAct =
"vertical";
724 act->fPic =
"bld_mainframe.xpm";
725 AddAction(act,
"Projects");
728 act =
new TGuiBldAction(
"TGTextButton",
"Text Button", kGuiBldCtor);
729 act->fAct =
"new TGTextButton()";
730 act->fPic =
"bld_textbutton.xpm";
731 AddAction(act,
"Buttons");
733 act =
new TGuiBldAction(
"TGCheckButton",
"Check Button", kGuiBldCtor);
734 act->fAct =
"new TGCheckButton()";
735 act->fPic =
"bld_checkbutton.xpm";
736 AddAction(act,
"Buttons");
738 act =
new TGuiBldAction(
"TGRadioButton",
"Radio Button", kGuiBldCtor);
739 act->fAct =
"new TGRadioButton()";
740 act->fPic =
"bld_radiobutton.xpm";
741 AddAction(act,
"Buttons");
743 act =
new TGuiBldAction(
"TGPictureButton",
"Picture Button", kGuiBldCtor);
744 act->fAct =
"new TGPictureButton()";
745 act->fPic =
"bld_image.xpm";
746 AddAction(act,
"Buttons");
748 act =
new TGuiBldAction(
"TGTextEntry",
"Text Entry", kGuiBldCtor);
749 act->fAct =
"new TGTextEntry()";
750 act->fPic =
"bld_entry.xpm";
751 AddAction(act,
"Input");
753 act =
new TGuiBldAction(
"TGTextEdit",
"Text Edit", kGuiBldCtor);
754 act->fAct =
"TRootGuiBuilder::BuildTextEdit()";
755 act->fPic =
"bld_text.xpm";
756 AddAction(act,
"Input");
758 act =
new TGuiBldAction(
"TGNumberEntry",
"Number Entry", kGuiBldCtor);
759 act->fAct =
"new TGNumberEntry()";
760 act->fPic =
"bld_numberentry.xpm";
761 AddAction(act,
"Input");
763 act =
new TGuiBldAction(
"TGComboBox",
"Combo Box", kGuiBldCtor);
764 act->fAct =
"TRootGuiBuilder::BuildComboBox()";
765 act->fPic =
"bld_combobox.xpm";
766 AddAction(act,
"Input");
768 act =
new TGuiBldAction(
"TGListBox",
"List Box", kGuiBldCtor);
769 act->fAct =
"TRootGuiBuilder::BuildListBox()";
770 act->fPic =
"bld_listbox.xpm";
771 AddAction(act,
"Input");
773 act =
new TGuiBldAction(
"TGHSlider",
"Horizontal Slider", kGuiBldCtor);
774 act->fAct =
"new TGHSlider()";
775 act->fPic =
"bld_hslider.xpm";
776 AddAction(act,
"Input");
778 act =
new TGuiBldAction(
"TGVSlider",
"Vertical Slider", kGuiBldCtor);
779 act->fAct =
"new TGVSlider()";
780 act->fPic =
"bld_vslider.xpm";
781 AddAction(act,
"Input");
783 act =
new TGuiBldAction(
"TGHScrollBar",
"HScrollbar", kGuiBldCtor);
784 act->fAct =
"TRootGuiBuilder::BuildHScrollBar()";
785 act->fPic =
"bld_hscrollbar.xpm";
786 AddAction(act,
"Input");
788 act =
new TGuiBldAction(
"TGVScrollBar",
"VScrollbar", kGuiBldCtor);
789 act->fAct =
"TRootGuiBuilder::BuildVScrollBar()";
790 act->fPic =
"bld_vscrollbar.xpm";
791 AddAction(act,
"Input");
793 act =
new TGuiBldAction(
"TGListTree",
"List Tree", kGuiBldCtor);
794 act->fAct =
"TRootGuiBuilder::BuildListTree()";
795 act->fPic =
"bld_listtree.xpm";
796 AddAction(act,
"Complex Input");
798 act =
new TGuiBldAction(
"TGLabel",
"Text Label", kGuiBldCtor);
799 act->fAct =
"new TGLabel()";
800 act->fPic =
"bld_label.xpm";
801 AddAction(act,
"Display");
803 act =
new TGuiBldAction(
"TGIcon",
"Icon", kGuiBldCtor);
804 act->fAct =
"new TGIcon()";
805 act->fPic =
"bld_image.xpm";
806 AddAction(act,
"Display");
808 act =
new TGuiBldAction(
"TGHorizontal3DLine",
"Horizontal Line",
810 act->fAct =
"TRootGuiBuilder::BuildH3DLine()";
811 act->fPic =
"bld_hseparator.xpm";
812 AddAction(act,
"Display");
814 act =
new TGuiBldAction(
"TGVertical3DLine",
"Vertical Line", kGuiBldCtor);
815 act->fAct =
"TRootGuiBuilder::BuildV3DLine()";
816 act->fPic =
"bld_vseparator.xpm";
817 AddAction(act,
"Display");
819 act =
new TGuiBldAction(
"TGStatusBar",
"Status Bar", kGuiBldCtor);
820 act->fAct =
"new TGStatusBar()";
821 act->fPic =
"bld_statusbar.xpm";
822 act->fHints =
new TGLayoutHints(kLHintsBottom | kLHintsExpandX);
823 AddAction(act,
"Bars");
825 act =
new TGuiBldAction(
"TGHProgressBar",
"HProgress Bar", kGuiBldCtor);
826 act->fAct =
"TRootGuiBuilder::BuildHProgressBar()";
827 act->fPic =
"bld_hprogressbar.xpm";
828 AddAction(act,
"Display");
830 act =
new TGuiBldAction(
"TGVProgressBar",
"VProgress Bar", kGuiBldCtor);
831 act->fAct =
"TRootGuiBuilder::BuildVProgressBar()";
832 act->fPic =
"bld_vprogressbar.xpm";
833 AddAction(act,
"Display");
835 act =
new TGuiBldAction(
"TRootEmbeddedCanvas",
"Embed Canvas", kGuiBldCtor);
836 act->fAct =
"new TRootEmbeddedCanvas()";
837 act->fPic =
"bld_embedcanvas.xpm";
838 AddAction(act,
"Display");
841 act =
new TGuiBldAction(
"TGHorizontalFrame",
"Horizontal Frame",
843 act->fAct =
"new TGHorizontalFrame(0,200,100)";
844 act->fPic =
"bld_hbox.xpm";
845 AddAction(act,
"Containers");
847 act =
new TGuiBldAction(
"TGVerticalFrame",
"Vertical Frame", kGuiBldCtor);
848 act->fAct =
"new TGVerticalFrame(0,100,200)";
849 act->fPic =
"bld_vbox.xpm";
850 AddAction(act,
"Containers");
852 act =
new TGuiBldAction(
"TGGroupFrame",
"Group Frame", kGuiBldCtor);
853 act->fAct =
"new TGGroupFrame()";
854 act->fPic =
"bld_groupframe.xpm";
855 AddAction(act,
"Containers");
857 act =
new TGuiBldAction(
"TGTab",
"Tabbed Frame", kGuiBldCtor);
858 act->fAct =
"TRootGuiBuilder::BuildTab()";
859 act->fPic =
"bld_tab.xpm";
860 AddAction(act,
"Containers");
862 act =
new TGuiBldAction(
"TGShutter",
"Shutter", kGuiBldCtor);
863 act->fAct =
"TRootGuiBuilder::BuildShutter()";
864 act->fPic =
"bld_shutter.png";
865 AddAction(act,
"Containers");
868 act =
new TGuiBldAction(
"TGCanvas",
"Scrolled Canvas", kGuiBldCtor);
869 act->fAct =
"TRootGuiBuilder::BuildCanvas()";
870 act->fPic =
"bld_canvas.xpm";
871 AddAction(act,
"Containers");
883 act =
new TGuiBldAction(
"TGColorSelect",
"Color Selector", kGuiBldFunc);
884 act->fAct =
"new TGColorSelect()";
885 act->fPic =
"bld_colorselect.xpm";
886 AddAction(act,
"Dialogs");
888 fShutter->Resize(140, fShutter->GetHeight());
890 fStatusBar =
new TGStatusBar(
this, 40, 10);
891 AddFrame(fStatusBar,
new TGLayoutHints(kLHintsBottom | kLHintsExpandX,
894 PropagateBgndColor(
this, GetBgnd());
895 SetEditDisabled(kEditDisable);
902 gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);
903 MoveResize(100, 100, ww - 200, hh - 200);
904 SetWMPosition(100, 100);
906 SetWindowName(
"ROOT GuiBuilder");
907 SetIconName(
"ROOT GuiBuilder");
908 fIconPic = SetIconPixmap(
"bld_rgb.xpm");
909 SetClassHints(
"ROOT",
"GuiBuilder");
914 fMenuFile->Connect(
"Activated(Int_t)",
"TRootGuiBuilder",
this,
915 "HandleMenu(Int_t)");
916 fMenuWindow->Connect(
"Activated(Int_t)",
"TRootGuiBuilder",
this,
917 "HandleMenu(Int_t)");
918 fMenuHelp->Connect(
"Activated(Int_t)",
"TRootGuiBuilder",
this,
919 "HandleMenu(Int_t)");
922 if (gVirtualX->InheritsFrom(
"TGX11"))
924 UpdateStatusBar(
"Ready");
927 fEditor->SwitchLayout();
933 TRootGuiBuilder::~TRootGuiBuilder()
935 if (fIconPic) gClient->FreePicture(fIconPic);
945 void TRootGuiBuilder::CloseWindow()
947 TGWindow *root = (TGWindow*)fClient->GetRoot();
948 if (root) root->SetEditable(kFALSE);
952 if (fMain->GetNumberOfFrames() == 0) {
953 fMenuFile->DisableEntry(kGUIBLD_FILE_CLOSE);
954 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
955 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
957 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
958 fMenuFile->EnableEntry(kGUIBLD_FILE_START);
959 fMenuFile->EnableEntry(kGUIBLD_FILE_CLOSE);
962 TGButton *btn = fToolBar->GetButton(kGridAct);
964 btn->SetState(!fClient->IsEditable() ? kButtonDisabled : kButtonUp);
968 if (fClosing == -1) {
972 SwitchToolbarButton();
979 TGButton *TRootGuiBuilder::FindActionButton(
const char *name,
const char *sect)
981 if (!name || !sect)
return 0;
983 TGShutterItem *item = fShutter->GetItem(sect);
986 TGCompositeFrame *cont = (TGCompositeFrame *)item->GetContainer();
987 TGHorizontalFrame *hf;
990 TIter next(cont->GetList());
994 while ((fe = (TGFrameElement*)next())) {
995 hf = (TGHorizontalFrame*)fe->fFrame;
996 btn = (TGButton*)((TGFrameElement*)hf->GetList()->First())->fFrame;
997 lb = (TGLabel*)((TGFrameElement*)hf->GetList()->Last())->fFrame;
998 if (*(lb->GetText()) == name) {
999 return (TGButton*)btn;
1008 void TRootGuiBuilder::AddAction(TGuiBldAction *act,
const char *sect)
1010 if (!act || !sect)
return;
1012 TGShutterItem *item = fShutter->GetItem(sect);
1016 TGCompositeFrame *cont = (TGCompositeFrame *)item->GetContainer();
1017 cont->SetBackgroundColor(TColor::Number2Pixel(18));
1019 const TGPicture *pic = 0;
1020 if (!act->fPicture) {
1021 act->fPicture = fClient->GetPicture(act->fPic);
1023 pic = act->fPicture;
1025 TGHorizontalFrame *hf =
new TGHorizontalFrame(cont);
1028 btn =
new TGPictureButton(hf, pic);
1030 btn =
new TGTextButton(hf, act->GetName());
1033 btn->SetToolTipText(act->GetTitle(), 200);
1034 btn->SetUserData((
void*)act);
1035 btn->Connect(
"Clicked()",
"TRootGuiBuilder",
this,
"HandleButtons()");
1037 hf->AddFrame(btn,
new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1039 TGLabel *lb =
new TGLabel(hf, act->fType != kGuiBldMacro ? act->GetTitle() :
1041 lb->SetBackgroundColor(cont->GetBackground());
1042 hf->AddFrame(lb,
new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1043 hf->SetBackgroundColor(cont->GetBackground());
1046 cont->SetEditDisabled(kEditDisable);
1047 hf->SetEditDisabled(kEditDisable);
1049 cont->AddFrame(hf,
new TGLayoutHints(kLHintsExpandX | kLHintsTop, 2, 2, 2, 0));
1050 cont->MapSubwindows();
1057 void TRootGuiBuilder::AddSection(
const char *sect)
1059 static int id = 10000;
1060 TGShutterItem *item =
new TGShutterItem(fShutter,
new TGHotString(sect),
1062 fShutter->AddItem(item);
1063 item->Connect(
"Selected()",
"TRootGuiBuilder",
this,
"HandleMenu(=3)");
1069 void TRootGuiBuilder::HandleButtons()
1073 if (fActionButton) {
1074 parent = (TGFrame*)fActionButton->GetParent();
1075 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1076 fClient->NeedRedraw(parent, kTRUE);
1079 if (!fClient->IsEditable()) {
1080 HandleMenu(kGUIBLD_FILE_START);
1083 fActionButton = (TGButton *)gTQSender;
1084 TGuiBldAction *act = (TGuiBldAction *)fActionButton->GetUserData();
1085 parent = (TGFrame*)fActionButton->GetParent();
1087 parent->ChangeOptions(parent->GetOptions() | kSunkenFrame);
1088 fClient->NeedRedraw(parent, kTRUE);
1092 fManager->UngrabFrame();
1093 if (fAction->fType != kGuiBldCtor) ExecuteAction();
1100 TGFrame *TRootGuiBuilder::ExecuteAction()
1102 if (!fAction || fAction->fAct.IsNull())
return 0;
1106 if (!fClient->IsEditable() && (fAction->fType != kGuiBldMacro)) {
1107 TGMdiFrame *current = fMain->GetCurrent();
1108 if (current) current->SetEditable(kTRUE);
1113 switch (fAction->fType) {
1115 s = fAction->fAct.Data();
1121 TGWindow *root = (TGWindow*)fClient->GetRoot();
1122 if (root) root->SetEditable(kFALSE);
1123 gROOT->Macro(fAction->fAct.Data());
1124 if (root) root->SetEditable(kTRUE);
1129 ret = (TGFrame *)gROOT->ProcessLineFast(fAction->fAct.Data());
1141 void TRootGuiBuilder::InitMenu()
1143 fMenuFile =
new TGuiBldPopupMenu();
1144 fMenuFile->AddEntry(
new TGHotString(
"&Edit (Ctrl+double-click)"),
1145 kGUIBLD_FILE_START, 0,
1146 fClient->GetPicture(
"bld_edit.png"));
1147 fMenuFile->AddEntry(
new TGHotString(
"&Stop (Ctrl+double-click)"),
1148 kGUIBLD_FILE_STOP, 0,
1149 fClient->GetPicture(
"bld_stop.png"));
1150 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1151 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1152 fMenuFile->AddSeparator();
1153 fMenuFile->AddEntry(
new TGHotString(
"&New Project"), kGUIBLD_FILE_NEW,
1154 0, fClient->GetPicture(
"bld_new.png"));
1155 fMenuFile->AddEntry(
new TGHotString(
"&Open"), kGUIBLD_FILE_OPEN,
1156 0, fClient->GetPicture(
"bld_open.png"));
1157 fMenuFile->AddEntry(
new TGHotString(
"&Close"), kGUIBLD_FILE_CLOSE,
1158 0, fClient->GetPicture(
"bld_delete.png"));
1159 fMenuFile->AddEntry(
new TGHotString(
"&Save project as"), kGUIBLD_FILE_SAVE,
1160 0, fClient->GetPicture(
"bld_save.png"));
1161 fMenuFile->DisableEntry(kGUIBLD_FILE_CLOSE);
1162 fMenuFile->AddSeparator();
1163 fMenuFile->AddEntry(
new TGHotString(
"E&xit"), kGUIBLD_FILE_EXIT,
1164 0, fClient->GetPicture(
"bld_exit.png"));
1170 fMenuWindow =
new TGuiBldPopupMenu();
1171 fMenuWindow->AddEntry(
new TGHotString(
"Tile &Horizontally"),
1172 kGUIBLD_WINDOW_HOR);
1173 fMenuWindow->AddEntry(
new TGHotString(
"Tile &Vertically"),
1174 kGUIBLD_WINDOW_VERT);
1175 fMenuWindow->AddEntry(
new TGHotString(
"&Cascade"),
1176 kGUIBLD_WINDOW_CASCADE);
1177 fMenuWindow->AddSeparator();
1179 fMenuWindow->AddEntry(
new TGHotString(
"&Arrange icons"),
1180 kGUIBLD_WINDOW_ARRANGE);
1181 fMenuWindow->AddSeparator();
1182 fMenuWindow->AddEntry(
new TGHotString(
"&Opaque resize"),
1183 kGUIBLD_WINDOW_OPAQUE);
1184 fMenuWindow->CheckEntry(kGUIBLD_WINDOW_OPAQUE);
1186 fMenuHelp =
new TGuiBldPopupMenu();
1187 fMenuHelp->AddEntry(
new TGHotString(
"&Contents"), kGUIBLD_HELP_CONTENTS);
1188 fMenuHelp->AddSeparator();
1189 fMenuHelp->AddEntry(
new TGHotString(
"&About"), kGUIBLD_HELP_ABOUT);
1193 TGMenuBar *bar = fMenuBar->GetMenuBar();
1195 TGuiBldMenuTitle *title;
1196 title =
new TGuiBldMenuTitle(bar,
new TGHotString(
"&File"), fMenuFile);
1197 bar->AddTitle(title,
new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1202 title =
new TGuiBldMenuTitle(bar,
new TGHotString(
"&Windows"), fMenuWindow);
1203 bar->AddTitle(title,
new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1205 title =
new TGuiBldMenuTitle(bar,
new TGHotString(
"&Help"), fMenuHelp);
1206 bar->AddTitle(title,
new TGLayoutHints(kLHintsTop | kLHintsRight,4,4,0,0));
1208 fMenuBar->SetEditDisabled(kEditDisable);
1209 PropagateBgndColor(fMenuBar, GetBgnd());
1215 void TRootGuiBuilder::ChangeSelected(TGFrame *f)
1224 void TRootGuiBuilder::EnableLassoButtons(Bool_t on)
1228 btn = fToolBar->GetButton(kUpAct);
1230 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1233 btn = fToolBar->GetButton(kDownAct);
1235 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1238 btn = fToolBar->GetButton(kRightAct);
1240 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1243 btn = fToolBar->GetButton(kLeftAct);
1245 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1248 btn = fToolBar->GetButton(kDeleteAct);
1250 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1253 btn = fToolBar->GetButton(kGrabAct);
1255 btn->SetState(kButtonUp);
1258 btn = fToolBar->GetButton(kCropAct);
1260 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1268 void TRootGuiBuilder::EnableSelectedButtons(Bool_t on)
1270 fSelected = fManager->GetSelected();
1275 btn = fToolBar->GetButton(kCompactAct);
1276 if (btn) btn->SetState(kButtonDisabled);
1278 btn = fToolBar->GetButton(kLayoutVAct);
1279 if (btn) btn->SetState(kButtonDisabled);
1281 btn = fToolBar->GetButton(kLayoutHAct);
1282 if (btn) btn->SetState(kButtonDisabled);
1284 btn = fToolBar->GetButton(kBreakLayoutAct);
1285 if (btn) btn->SetState(kButtonDisabled);
1289 Bool_t comp = kFALSE;
1290 TGLayoutManager *lm = 0;
1291 Bool_t hor = kFALSE;
1292 Bool_t fixed = kFALSE;
1294 Bool_t compact_disable = kTRUE;
1296 if (fSelected->InheritsFrom(TGCompositeFrame::Class())) {
1297 lm = ((TGCompositeFrame*)fSelected)->GetLayoutManager();
1299 hor = lm && lm->InheritsFrom(TGHorizontalLayout::Class());
1300 fixed = !fManager->CanChangeLayout(fSelected);
1301 compact_disable = !fManager->CanCompact(fSelected);
1306 btn = fToolBar->GetButton(kCompactAct);
1307 if (btn) btn->SetState(enable && comp && !fixed && !compact_disable ?
1308 kButtonUp : kButtonDisabled);
1310 btn = fToolBar->GetButton(kLayoutHAct);
1312 btn->SetState(enable && comp && !hor && !fixed ? kButtonUp :
1316 btn = fToolBar->GetButton(kLayoutVAct);
1318 btn->SetState(enable && comp && hor && !fixed ? kButtonUp :
1322 btn = fToolBar->GetButton(kBreakLayoutAct);
1324 btn->SetState(enable && comp && !fixed ? kButtonUp : kButtonDisabled);
1340 void TRootGuiBuilder::EnableEditButtons(Bool_t on)
1344 Bool_t lasso = fManager->IsLassoDrawn() && on;
1346 btn = fToolBar->GetButton(kReplaceAct);
1348 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1351 btn = fToolBar->GetButton(kCutAct);
1353 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1356 btn = fToolBar->GetButton(kDropAct);
1358 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1361 btn = fToolBar->GetButton(kCopyAct);
1363 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1366 btn = fToolBar->GetButton(kPasteAct);
1368 btn->SetState(!on || !fManager->IsPasteFrameExist() ?
1369 kButtonDisabled : kButtonUp);
1372 btn = fToolBar->GetButton(kCropAct);
1374 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1377 btn = fToolBar->GetButton(kDeleteAct);
1379 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1386 void TRootGuiBuilder::Update()
1392 EnableLassoButtons(fManager->IsLassoDrawn());
1393 fSelected = fManager->GetSelected();
1394 EnableSelectedButtons(fSelected);
1395 EnableEditButtons(fClient->IsEditable() && (fManager->IsLassoDrawn() ||
1396 fManager->GetSelected() ||
1397 fManager->IsPasteFrameExist()));
1399 if (fActionButton) {
1400 TGFrame *parent = (TGFrame*)fActionButton->GetParent();
1401 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1402 fClient->NeedRedraw(parent, kTRUE);
1405 if (!fClient->IsEditable()) {
1406 UpdateStatusBar(
"");
1407 fMenuFile->EnableEntry(kGUIBLD_FILE_START);
1408 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1412 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1413 fMenuFile->EnableEntry(kGUIBLD_FILE_STOP);
1416 SwitchToolbarButton();
1423 Bool_t TRootGuiBuilder::IsSelectMode()
const
1426 btn = fToolBar->GetButton(kSelectAct);
1428 if (!btn)
return kFALSE;
1430 return btn->IsDown();
1436 Bool_t TRootGuiBuilder::IsGrabButtonDown()
const
1438 TGButton *btn = fToolBar->GetButton(kGrabAct);
1440 if (!btn)
return kFALSE;
1442 return btn->IsDown();
1446 class TGuiBldSaveFrame :
public TGMainFrame {
1449 TGuiBldSaveFrame(
const TGWindow *p, UInt_t w , UInt_t h) :
1450 TGMainFrame(p, w, h) {}
1451 void SetList(TList *li) { fList = li; }
1454 static const char *gSaveMacroTypes[] = {
1455 "Macro files",
"*.[C|c]*",
1463 Bool_t TRootGuiBuilder::HandleKey(Event_t *event)
1465 if (event->fType == kGKeyPress) {
1468 gVirtualX->LookupString(event, str,
sizeof(str), keysym);
1470 if (event->fState & kKeyControlMask) {
1472 if (fMain->GetCurrent()) {
1473 return SaveProject(event);
1477 }
else if (str[0] == 14) {
1478 return NewProject();
1479 }
else if (str[0] == 15) {
1480 return OpenProject(event);
1483 fManager->HandleKey(event);
1484 return TGMainFrame::HandleKey(event);
1492 Bool_t TRootGuiBuilder::NewProject(TString type)
1494 TGWindow *root = (TGWindow*)fClient->GetRoot();
1496 if (root) root->SetEditable(kFALSE);
1497 fEditable =
new TGMdiFrame(fMain, 500, 400, kOwnBackground);
1498 fEditable->DontCallClose();
1499 fEditable->SetMdiHints(kMdiDefaultHints);
1500 fEditable->SetWindowName(fEditable->GetName());
1501 fEditable->SetEditDisabled(0);
1502 fEditable->MapRaised();
1503 fEditable->AddInput(kKeyPressMask | kButtonPressMask);
1504 fEditable->SetEditable(kTRUE);
1506 if (type ==
"horizontal") {
1507 TGHorizontalFrame *hor =
new TGHorizontalFrame(fEditable, 100, 100);
1508 fEditable->AddFrame(hor,
new TGLayoutHints( kLHintsExpandX |
1509 kLHintsExpandY, 1, 1, 1, 1));
1510 hor->SetEditable(kTRUE);
1511 fClient->NeedRedraw(hor, kTRUE);
1512 fEditable->MapSubwindows();
1513 fEditable->MapWindow();
1514 fClient->NeedRedraw(fEditable, kTRUE);
1515 fEditable->SetLayoutBroken(kFALSE);
1516 fEditable->Layout();
1518 else if (type ==
"vertical") {
1519 TGVerticalFrame *vert =
new TGVerticalFrame(fEditable, 100, 100);
1520 fEditable->AddFrame(vert,
new TGLayoutHints( kLHintsExpandX |
1521 kLHintsExpandY,1,1,1,1));
1522 vert->SetEditable(kTRUE);
1523 fClient->NeedRedraw(vert, kTRUE);
1524 fEditable->MapSubwindows();
1525 fEditable->MapWindow();
1526 fClient->NeedRedraw(fEditable, kTRUE);
1527 fEditable->SetLayoutBroken(kFALSE);
1528 fEditable->Layout();
1531 fEditable->SetLayoutBroken(kTRUE);
1533 fManager->SetEditable(kTRUE);
1534 fMenuFile->EnableEntry(kGUIBLD_FILE_CLOSE);
1535 fMenuFile->EnableEntry(kGUIBLD_FILE_STOP);
1536 fEditable->SetCleanup(kDeepCleanup);
1539 SwitchToolbarButton();
1546 Bool_t TRootGuiBuilder::OpenProject(Event_t *event)
1549 TGButton *btn = fToolBar->GetButton(kOpenAct);
1551 btn->SetBackgroundColor(GetBgnd());
1552 fClient->NeedRedraw(btn, kTRUE);
1556 static TString dir(
".");
1557 static Bool_t overwr = kFALSE;
1560 fi.fFileTypes = gSaveMacroTypes;
1561 fi.fIniDir = StrDup(dir);
1562 fi.fOverwrite = overwr;
1563 TGWindow *root = (TGWindow*)fClient->GetRoot();
1564 root->SetEditable(kFALSE);
1566 new TGFileDialog(fClient->GetDefaultRoot(),
this, kFDOpen, &fi);
1568 if (!fi.fFilename) {
1569 root->SetEditable(kTRUE);
1574 overwr = fi.fOverwrite;
1575 fname = fi.fFilename;
1577 if (fname.EndsWith(
".C", TString::kIgnoreCase) || fname.EndsWith(
".cxx") ||
1578 fname.EndsWith(
".cpp") || fname.EndsWith(
".cc")) {
1580 gROOT->Macro(fname.Data());
1583 new TGMsgBox(fClient->GetDefaultRoot(),
this,
"Error...",
1584 TString::Format(
"file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1585 fname.Data()), kMBIconExclamation, kMBRetry | kMBCancel,
1588 if (retval == kMBRetry) {
1593 fMenuFile->EnableEntry(kGUIBLD_FILE_CLOSE);
1594 fMenuFile->EnableEntry(kGUIBLD_FILE_STOP);
1595 SwitchToolbarButton();
1603 Bool_t TRootGuiBuilder::SaveProject(Event_t *event)
1605 TGButton *btn = fToolBar->GetButton(kSaveAct);
1607 btn->SetBackgroundColor(GetBgnd());
1608 fClient->NeedRedraw(btn, kTRUE);
1611 TGMdiFrame *savfr = fMain->GetCurrent();
1612 if (!savfr)
return kFALSE;
1614 static TImage *img = 0;
1617 img = TImage::Create();
1619 img->FromWindow(savfr->GetParent()->GetId());
1621 TGWindow *root = (TGWindow*)fClient->GetRoot();
1623 static TString dir(
".");
1624 static Bool_t overwr = kFALSE;
1626 root->SetEditable(kFALSE);
1628 fi.fFileTypes = gSaveMacroTypes;
1629 fi.fIniDir = StrDup(dir);
1630 fi.fOverwrite = overwr;
1632 new TGFileDialog(fClient->GetDefaultRoot(),
this, kFDSave, &fi);
1634 if (!fi.fFilename) {
1635 root->SetEditable(kTRUE);
1641 overwr = fi.fOverwrite;
1642 fname = gSystem->UnixPathName(fi.fFilename);
1644 if (fname.EndsWith(
".C", TString::kIgnoreCase) || fname.EndsWith(
".cxx") ||
1645 fname.EndsWith(
".cpp") || fname.EndsWith(
".cc")) {
1646 TGuiBldSaveFrame *main =
new TGuiBldSaveFrame(fClient->GetDefaultRoot(),
1648 savfr->GetHeight());
1649 TList *list = main->GetList();
1650 TString name = savfr->GetName();
1651 savfr->SetName(main->GetName());
1652 main->SetList(savfr->GetList());
1653 main->SetLayoutBroken(savfr->IsLayoutBroken());
1654 main->SaveSource(fname.Data(),
"keep_names");
1655 savfr->SetWindowName(fname.Data());
1656 main->SetList(list);
1658 main->SetMWMHints(kMWMDecorAll, kMWMFuncAll,
1659 kMWMInputFullApplicationModal);
1660 main->SetWMSize(main->GetWidth(), main->GetHeight());
1661 main->SetWMSizeHints(main->GetDefaultWidth(), main->GetDefaultHeight(),
1662 10000, 10000, 0, 0);
1663 main->SetWindowName(fname.Data());
1664 main->SetIconName(fname.Data());
1665 main->SetClassHints(fname.Data(), fname.Data());
1667 if (gVirtualX->InheritsFrom(
"TGX11")) main->SetIconPixmap(
"bld_rgb.xpm");
1669 savfr->SetName(name.Data());
1671 AddMacro(fname.Data(), img);
1675 new TGMsgBox(fClient->GetDefaultRoot(),
this,
"Error...",
1676 TString::Format(
"file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1677 fname.Data()), kMBIconExclamation, kMBRetry | kMBCancel,
1679 if (retval == kMBRetry) {
1682 SwitchToolbarButton();
1684 SwitchToolbarButton();
1692 void TRootGuiBuilder::AddMacro(
const char *macro, TImage *img)
1694 if (!img || !img->GetWidth() || !img->GetHeight()) {
1699 Float_t ratio = Float_t(w)/img->GetWidth();
1700 Float_t rh = img->GetHeight()*ratio;
1701 UInt_t h = UInt_t(rh);
1703 img->Merge(img,
"overlay");
1706 const TGPicture *pic = fClient->GetPicturePool()->GetPicture(
1707 TString::Format(
"%s;%d", macro, i++),
1708 img->GetPixmap(),img->GetMask());
1709 const char *name = gSystem->BaseName(macro);
1711 TGButton *btn = FindActionButton(name,
"User's Macros");
1712 TGuiBldAction *act = 0;
1715 act =
new TGuiBldAction(name, macro, kGuiBldMacro);
1718 act->fPicture = pic;
1720 AddAction(act,
"User's Macros");
1722 act = (TGuiBldAction*)btn->GetUserData();
1725 act->fPicture = pic;
1727 if (btn->InheritsFrom(TGPictureButton::Class())) {
1729 fClient->FreePicture(((TGPictureButton*)btn)->GetPicture());
1730 ((TGPictureButton*)btn)->SetPicture(pic);
1733 fClient->NeedRedraw(fShutter);
1739 TGMdiFrame *TRootGuiBuilder::FindEditableMdiFrame(
const TGWindow *win)
1741 const TGWindow *parent = win;
1742 TGMdiFrame *ret = 0;
1744 while (parent && (parent != fClient->GetDefaultRoot())) {
1745 if (parent->InheritsFrom(TGMdiFrame::Class())) {
1746 ret = (TGMdiFrame*)parent;
1749 parent = parent->GetParent();
1757 void TRootGuiBuilder::SwitchToolbarButton()
1759 static const TGPicture *start = fClient->GetPicture(
"bld_edit.png");
1760 static const TGPicture *stop = fClient->GetPicture(
"bld_stop.png");
1762 if (fClient->IsEditable()) {
1763 fStartButton->SetEnabled(kTRUE);
1764 fStartButton->SetPicture(stop);
1765 fToolBar->SetId(fStartButton, kEndEditAct);
1766 fStartButton->SetToolTipText(
"Stop Edit (Ctrl-Dbl-Click)");
1768 if (fMain->GetNumberOfFrames() < 1) {
1769 fStartButton->SetEnabled(kFALSE);
1771 fStartButton->SetEnabled(kTRUE);
1772 fStartButton->SetPicture(start);
1773 fToolBar->SetId(fStartButton, kEditableAct);
1774 fStartButton->SetToolTipText(
"Start Edit (Ctrl-Dbl-Click)");
1778 fClient->NeedRedraw(fStartButton, kTRUE);
1784 void TRootGuiBuilder::HandleMenu(Int_t
id)
1786 TGWindow *root = (TGWindow*)fClient->GetRoot();
1787 TRootHelpDialog *hd;
1790 case kGUIBLD_FILE_START:
1791 if (fClient->IsEditable()) {
1794 fEditable = fMain->GetCurrent();
1796 fEditable->SetEditable(kTRUE);
1800 UpdateStatusBar(
"Start edit");
1801 fMenuFile->EnableEntry(kGUIBLD_FILE_STOP);
1802 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1803 SwitchToolbarButton();
1806 case kGUIBLD_FILE_STOP:
1807 if (!fClient->IsEditable()) {
1810 fEditable = FindEditableMdiFrame(root);
1813 root->SetEditable(kFALSE);
1815 UpdateStatusBar(
"Stop edit");
1816 fMenuFile->EnableEntry(kGUIBLD_FILE_START);
1817 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1819 SwitchToolbarButton();
1824 case kGUIBLD_FILE_NEW:
1826 SwitchToolbarButton();
1829 case kGUIBLD_FILE_CLOSE:
1830 fEditable = FindEditableMdiFrame(root);
1831 if (fEditable && (fEditable == fMain->GetCurrent())) {
1832 root->SetEditable(kFALSE);
1835 UpdateStatusBar(
"");
1836 fMain->Close(fMain->GetCurrent());
1838 if (fMain->GetNumberOfFrames() <= 1) {
1839 fMenuFile->DisableEntry(kGUIBLD_FILE_CLOSE);
1840 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1841 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1844 if (fClient->IsEditable()) {
1845 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1846 fMenuFile->EnableEntry(kGUIBLD_FILE_STOP);
1848 fMenuFile->EnableEntry(kGUIBLD_FILE_START);
1849 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1851 SwitchToolbarButton();
1854 case kGUIBLD_FILE_EXIT:
1858 case kGUIBLD_FILE_OPEN:
1860 SwitchToolbarButton();
1863 case kGUIBLD_FILE_SAVE:
1865 SwitchToolbarButton();
1868 case kGUIBLD_WINDOW_HOR:
1869 fMain->TileHorizontal();
1872 case kGUIBLD_WINDOW_VERT:
1873 fMain->TileVertical();
1876 case kGUIBLD_WINDOW_CASCADE:
1880 case kGUIBLD_WINDOW_ARRANGE:
1881 fMain->ArrangeMinimized();
1884 case kGUIBLD_WINDOW_OPAQUE:
1885 if (fMenuWindow->IsEntryChecked(kGUIBLD_WINDOW_OPAQUE)) {
1886 fMenuWindow->UnCheckEntry(kGUIBLD_WINDOW_OPAQUE);
1887 fMain->SetResizeMode(kMdiNonOpaque);
1889 fMenuWindow->CheckEntry(kGUIBLD_WINDOW_OPAQUE);
1890 fMain->SetResizeMode(kMdiOpaque);
1893 case kGUIBLD_HELP_CONTENTS:
1894 root->SetEditable(kFALSE);
1895 hd =
new TRootHelpDialog(
this,
"Help on Gui Builder...", 600, 400);
1896 hd->SetText(gHelpBuilder);
1897 hd->SetEditDisabled();
1899 root->SetEditable(kTRUE);
1902 case kGUIBLD_HELP_ABOUT:
1903 root->SetEditable(kFALSE);
1904 hd =
new TRootHelpDialog(
this,
"About Gui Builder...", 520, 160);
1905 hd->SetEditDisabled();
1906 hd->SetText(gHelpAboutBuilder);
1908 root->SetEditable(kTRUE);
1912 fMain->SetCurrent(
id);
1920 void TRootGuiBuilder::MaybeCloseWindow()
1925 TGMdiFrame *mdiframe = (TGMdiFrame *)gTQSender;
1926 fManager->SetEditable(kFALSE);
1927 new TGMsgBox(gClient->GetDefaultRoot(),
this,
1928 "Closing project",
"Do you want to save the project before closing?",
1929 kMBIconExclamation, kMBYes | kMBNo | kMBCancel, &retval);
1931 fManager->SetEditable(kTRUE);
1932 if (retval == kMBYes) {
1935 if (retval == kMBCancel) {
1937 if (!fClient->IsEditable())
1938 HandleMenu(kGUIBLD_FILE_START);
1941 fEditor->RemoveFrame(mdiframe);
1942 mdiframe->CloseWindow();
1948 void TRootGuiBuilder::HandleWindowClosed(Int_t )
1952 if (fClient->IsEditable()) {
1953 fManager->SetEditable(kFALSE);
1954 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1955 fMenuFile->EnableEntry(kGUIBLD_FILE_STOP);
1957 fMenuFile->EnableEntry(kGUIBLD_FILE_START);
1958 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1961 UpdateStatusBar(
"");
1963 if (fMain->GetNumberOfFrames() == 0) {
1964 fMenuFile->DisableEntry(kGUIBLD_FILE_CLOSE);
1965 fMenuFile->DisableEntry(kGUIBLD_FILE_STOP);
1966 fMenuFile->DisableEntry(kGUIBLD_FILE_START);
1967 SwitchToolbarButton();
1975 void TRootGuiBuilder::UpdateStatusBar(
const char *txt)
1977 if (!fStatusBar)
return;
1979 const char *text = 0;
1982 TObject *o = (TObject *)gTQSender;
1984 if (o && o->InheritsFrom(TGToolTip::Class())) {
1985 TGToolTip *tip = (TGToolTip*)o;
1986 text = tip->GetText()->Data();
1991 fStatusBar->SetText(text);
1997 void TRootGuiBuilder::EraseStatusBar()
1999 if (!fStatusBar)
return;
2001 fStatusBar->SetText(
"");
2007 void TRootGuiBuilder::BindKeys()
2009 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_a),
2010 kKeyControlMask, kTRUE);
2012 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_n),
2013 kKeyControlMask, kTRUE);
2015 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_o),
2016 kKeyControlMask, kTRUE);
2018 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2019 kKeyControlMask, kTRUE);
2021 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2024 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2025 kKeyControlMask, kTRUE);
2027 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2030 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_x),
2031 kKeyControlMask, kTRUE);
2033 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_c),
2034 kKeyControlMask, kTRUE);
2036 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_v),
2037 kKeyControlMask, kTRUE);
2039 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_r),
2040 kKeyControlMask, kTRUE);
2042 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2043 kKeyControlMask, kTRUE);
2045 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2046 kKeyControlMask | kKeyShiftMask, kTRUE);
2048 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_b),
2049 kKeyControlMask, kTRUE);
2051 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_l),
2052 kKeyControlMask, kTRUE);
2054 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_g),
2055 kKeyControlMask, kTRUE);
2057 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_h),
2058 kKeyControlMask, kTRUE);
2060 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2063 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2066 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Space),
2069 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2072 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2075 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2078 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2081 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2082 kKeyShiftMask, kTRUE);
2084 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2085 kKeyShiftMask, kTRUE);
2087 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2088 kKeyShiftMask, kTRUE);
2090 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2091 kKeyShiftMask, kTRUE);
2093 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2094 kKeyShiftMask, kTRUE);
2096 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2097 kKeyShiftMask, kTRUE);
2103 TGFrame *TRootGuiBuilder::VSplitter()
2105 TGHorizontalFrame *ret =
new TGHorizontalFrame();
2106 ret->SetCleanup(kDeepCleanup);
2107 TGVerticalFrame *v1 =
new TGVerticalFrame(ret, 40, 10, kSunkenFrame |
2109 ret->AddFrame(v1,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
2112 TGVSplitter *splitter =
new TGVSplitter(ret);
2113 splitter->SetFrame(v1, kTRUE);
2114 ret->AddFrame(splitter,
new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
2115 splitter->SetEditDisabled(kEditDisableBtnEnable);
2117 TGVerticalFrame *v2 =
new TGVerticalFrame(ret, 10, 10, kSunkenFrame);
2118 v2->ChangeOptions(kSunkenFrame);
2119 ret->AddFrame(v2,
new TGLayoutHints(kLHintsRight | kLHintsExpandX |
2122 ret->SetEditDisabled(kEditDisableLayout);
2124 ret->MapSubwindows();
2125 ret->SetLayoutBroken(kFALSE);
2132 TGFrame *TRootGuiBuilder::HSplitter()
2134 TGVerticalFrame *ret =
new TGVerticalFrame();
2135 ret->SetCleanup(kDeepCleanup);
2136 TGHorizontalFrame *v1 =
new TGHorizontalFrame(ret, 10, 40, kSunkenFrame |
2138 ret->AddFrame(v1,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
2141 TGHSplitter *splitter =
new TGHSplitter(ret);
2142 splitter->SetFrame(v1, kTRUE);
2143 ret->AddFrame(splitter,
new TGLayoutHints(kLHintsTop | kLHintsExpandX));
2144 splitter->SetEditDisabled(kEditDisable);
2146 TGHorizontalFrame *v2 =
new TGHorizontalFrame(ret, 10, 10);
2147 v2->ChangeOptions(kSunkenFrame);
2148 ret->AddFrame(v2,
new TGLayoutHints(kLHintsBottom | kLHintsExpandX |
2151 ret->SetEditDisabled(kEditDisableLayout);
2153 ret->MapSubwindows();
2154 ret->SetLayoutBroken(kFALSE);
2161 void TRootGuiBuilder::Hide()
2170 ULong_t TRootGuiBuilder::GetBgnd()
2172 return GetDefaultFrameBackground();
2174 static ULong_t gPixel = 0;
2176 if (gPixel)
return gPixel;
2184 gPixel = TColor::RGB2Pixel(r, g, b);
2191 TGGC *TRootGuiBuilder::GetBgndGC()
2193 if (fgBgnd)
return fgBgnd;
2195 fgBgnd =
new TGGC(TGFrame::GetBckgndGC());
2197 Pixel_t back = GetBgnd();
2198 fgBgnd->SetBackground(back);
2199 fgBgnd->SetForeground(back);
2207 void TRootGuiBuilder::PropagateBgndColor(TGFrame *frame, Pixel_t color)
2211 frame->SetBackgroundColor(color);
2212 if (!frame->InheritsFrom(TGCompositeFrame::Class()))
return;
2214 TIter next(((TGCompositeFrame*)frame)->GetList());
2217 while ((fe = (TGFrameElement*)next())) {
2218 if (fe->fFrame->GetBackground() == TGFrame::GetWhitePixel()) {
2221 PropagateBgndColor(fe->fFrame, color);
2228 ULong_t TRootGuiBuilder::GetPopupBgnd()
2230 return GetDefaultFrameBackground();
2232 static ULong_t gPixel = 0;
2234 if (gPixel)
return gPixel;
2242 gPixel = TColor::RGB2Pixel(r, g, b);
2250 TGGC *TRootGuiBuilder::GetPopupBgndGC()
2252 if (fgBgndPopup)
return fgBgndPopup;
2254 fgBgndPopup =
new TGGC(TGFrame::GetBckgndGC());
2256 Pixel_t back = GetPopupBgnd();
2257 fgBgndPopup->SetBackground(back);
2258 fgBgndPopup->SetForeground(back);
2266 ULong_t TRootGuiBuilder::GetPopupHlght()
2268 return GetDefaultSelectedBackground();
2270 static ULong_t gPixel = 0;
2272 if (gPixel)
return gPixel;
2280 gPixel = TColor::RGB2Pixel(r, g, b);
2288 TGGC *TRootGuiBuilder::GetPopupHlghtGC()
2290 if (fgBgndPopupHlght)
return fgBgndPopupHlght;
2292 fgBgndPopupHlght =
new TGGC(TGFrame::GetHilightGC());
2294 Pixel_t back = GetPopupHlght();
2295 fgBgndPopupHlght->SetBackground(back);
2296 fgBgndPopupHlght->SetForeground(back);
2298 return fgBgndPopupHlght;
2304 TGPopupMenu *TRootGuiBuilder::CreatePopup()
2306 return new TGuiBldPopupMenu();
2312 TGFrame *TRootGuiBuilder::BuildListTree()
2314 TGCanvas *canvas =
new TGCanvas(gClient->GetRoot(), 100, 100);
2315 TGListTree *lt =
new TGListTree(canvas, kHorizontalFrame);
2316 lt->AddItem(0,
"Entry 1");
2317 lt->AddItem(0,
"Entry 2");
2318 lt->AddItem(0,
"Entry 3");
2319 lt->AddItem(0,
"Entry 4");
2320 lt->AddItem(0,
"Entry 5");
2321 canvas->Resize(100, 60);
2322 canvas->MapSubwindows();
2330 TGFrame *TRootGuiBuilder::BuildCanvas()
2332 TGCanvas *canvas =
new TGCanvas(gClient->GetRoot(), 100, 100);
2333 TGCompositeFrame *cont =
new TGCompositeFrame(canvas->GetViewPort(),
2334 200, 200, kHorizontalFrame |
2337 cont->SetCleanup(kDeepCleanup);
2338 cont->SetLayoutManager(
new TGTileLayout(cont, 8));
2339 cont->AddFrame(
new TGTextButton(cont,
"Button1"));
2340 cont->AddFrame(
new TGTextButton(cont,
"Button2"));
2341 cont->AddFrame(
new TGTextButton(cont,
"Button3"));
2342 cont->AddFrame(
new TGTextButton(cont,
"Button4"));
2344 canvas->SetContainer(cont);
2351 TGFrame *TRootGuiBuilder::BuildShutter()
2353 TGShutterItem *item;
2354 TGCompositeFrame *container;
2355 const TGPicture *buttonpic;
2356 TGPictureButton *button;
2358 TGLayoutHints *l =
new TGLayoutHints(kLHintsTop | kLHintsCenterX,5,5,5,0);
2359 TGShutter *shut =
new TGShutter();
2361 item = shut->AddPage(
"Histograms");
2362 container = (TGCompositeFrame *)item->GetContainer();
2363 buttonpic = gClient->GetPicture(
"h1_s.xpm");
2366 button =
new TGPictureButton(container, buttonpic);
2367 button->SetToolTipText(
"TH1");
2368 container->AddFrame(button, l);
2370 buttonpic = gClient->GetPicture(
"h2_s.xpm");
2373 button =
new TGPictureButton(container, buttonpic);
2374 button->SetToolTipText(
"TH2");
2375 container->AddFrame(button, l);
2377 buttonpic = gClient->GetPicture(
"h3_s.xpm");
2380 button =
new TGPictureButton(container, buttonpic);
2381 button->SetToolTipText(
"TH3");
2382 container->AddFrame(button, l);
2384 buttonpic = gClient->GetPicture(
"profile_s.xpm");
2387 button =
new TGPictureButton(container, buttonpic);
2388 button->SetToolTipText(
"TProfile");
2389 container->AddFrame(button, l);
2393 item = shut->AddPage(
"Functions");
2394 container = (TGCompositeFrame *)item->GetContainer();
2395 buttonpic = gClient->GetPicture(
"f1_s.xpm");
2398 button =
new TGPictureButton(container, buttonpic);
2399 button->SetToolTipText(
"TF1");
2400 container->AddFrame(button, l);
2402 buttonpic = gClient->GetPicture(
"f2_s.xpm");
2405 button =
new TGPictureButton(container, buttonpic);
2406 button->SetToolTipText(
"TF2");
2407 container->AddFrame(button, l);
2411 item = shut->AddPage(
"Trees");
2412 container = (TGCompositeFrame *)item->GetContainer();
2413 buttonpic = gClient->GetPicture(
"ntuple_s.xpm");
2416 button =
new TGPictureButton(container, buttonpic);
2417 button->SetToolTipText(
"TNtuple");
2418 container->AddFrame(button, l);
2420 buttonpic = gClient->GetPicture(
"tree_s.xpm");
2423 button =
new TGPictureButton(container, buttonpic);
2424 button->SetToolTipText(
"TTree");
2425 container->AddFrame(button, l);
2427 buttonpic = gClient->GetPicture(
"chain_s.xpm");
2430 button =
new TGPictureButton(container, buttonpic);
2431 button->SetToolTipText(
"TChain");
2432 container->AddFrame(button, l);
2435 shut->MapSubwindows();
2442 TGFrame *TRootGuiBuilder::BuildTextEdit()
2444 TGTextEdit *te =
new TGTextEdit();
2446 te->AddLine(
"all work and no play makes jack a pretty");
2447 te->AddLine(
"dull boy. all work and no play makes jack");
2448 te->AddLine(
"a pretty dull boy. all work and no play ");
2449 te->AddLine(
"makes jack a pretty dull boy. all work");
2450 te->AddLine(
"and no play makes jack a pretty dull boy.");
2452 te->MapSubwindows();
2454 te->Resize(100, 60);
2462 TGFrame *TRootGuiBuilder::BuildTab()
2464 TGTab *tab =
new TGTab();
2466 tab->AddTab(
"Tab1");
2467 tab->AddTab(
"Tab2");
2468 tab->MapSubwindows();
2476 TGFrame *TRootGuiBuilder::BuildListBox()
2478 TGListBox *lb =
new TGListBox();
2480 lb->AddEntry(
"Entry 1", 0);
2481 lb->AddEntry(
"Entry 2", 1);
2482 lb->AddEntry(
"Entry 3", 2);
2483 lb->AddEntry(
"Entry 4", 3);
2484 lb->AddEntry(
"Entry 5", 4);
2485 lb->AddEntry(
"Entry 6", 5);
2486 lb->AddEntry(
"Entry 7", 6);
2487 lb->MapSubwindows();
2489 lb->Resize(100,100);
2497 TGFrame *TRootGuiBuilder::BuildComboBox()
2499 TGComboBox *cb =
new TGComboBox();
2501 cb->AddEntry(
"Entry 1 ", 0);
2502 cb->AddEntry(
"Entry 2 ", 1);
2503 cb->AddEntry(
"Entry 3 ", 2);
2504 cb->AddEntry(
"Entry 4 ", 3);
2505 cb->AddEntry(
"Entry 5 ", 4);
2506 cb->AddEntry(
"Entry 6 ", 5);
2507 cb->AddEntry(
"Entry 7 ", 6);
2508 cb->MapSubwindows();
2510 FontStruct_t fs = TGTextLBEntry::GetDefaultFontStruct();
2511 int max_ascent, max_descent;
2512 gVirtualX->GetFontProperties(fs, max_ascent, max_descent);
2514 cb->Resize(cb->GetListBox()->GetDefaultWidth(), max_ascent+max_descent+7);
2521 TGFrame *TRootGuiBuilder::BuildH3DLine()
2523 TGHorizontal3DLine *l =
new TGHorizontal3DLine(0, 100, 2);
2532 TGFrame *TRootGuiBuilder::BuildV3DLine()
2534 TGVertical3DLine *l =
new TGVertical3DLine();
2543 TGFrame *TRootGuiBuilder::BuildHScrollBar()
2545 TGHScrollBar *b =
new TGHScrollBar();
2547 b->Resize(100, b->GetDefaultHeight());
2548 b->SetRange(100, 20);
2557 TGFrame *TRootGuiBuilder::BuildVScrollBar()
2559 TGVScrollBar *b =
new TGVScrollBar();
2561 b->Resize(b->GetDefaultWidth(), 100);
2563 b->SetRange(100, 20);
2571 TGFrame *TRootGuiBuilder::BuildHProgressBar()
2573 TGHProgressBar *b =
new TGHProgressBar();
2575 b->Resize(100, b->GetDefaultHeight());
2578 b->SetFillType(TGProgressBar::kBlockFill);
2586 TGFrame *TRootGuiBuilder::BuildVProgressBar()
2588 TGVProgressBar *b =
new TGVProgressBar();
2590 b->Resize(b->GetDefaultWidth(), 100);
2592 b->SetFillType(TGProgressBar::kBlockFill);