Logo ROOT  
Reference Guide
TRootGuiBuilder.cxx
Go to the documentation of this file.
1// @(#)root/guibuilder:$Id: d2f0a1966f9911570cafe9d356f2158a2773edd1 $
2// Author: Valeriy Onuchin 12/09/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13#include "TRootGuiBuilder.h"
14#include "TGuiBldDragManager.h"
15#include "TGuiBldEditor.h"
16
17#include "TGShutter.h"
18#include "TGSplitter.h"
19#include "TGLayout.h"
20#include "TGResourcePool.h"
21#include "TGButton.h"
22#include "TROOT.h"
23#include "TGDockableFrame.h"
24#include "TGMdi.h"
25#include "TGStatusBar.h"
26#include "TG3DLine.h"
27#include "TGLabel.h"
28#include "TColor.h"
29#include "TGToolBar.h"
30#include "TGToolTip.h"
31#include "KeySymbols.h"
32#include "TGFileDialog.h"
33#include "TGMsgBox.h"
34#include "TSystem.h"
35#include "TRootHelpDialog.h"
36#include "TGListTree.h"
37#include "TImage.h"
38#include "TGTextEdit.h"
39#include "TGTab.h"
40#include "TGListBox.h"
41#include "TGComboBox.h"
42#include "TGProgressBar.h"
43#include "TVirtualX.h"
44
45
46/** \class TRootGuiBuilder
47 \ingroup guibuilder
48
49### %ROOT GUI Builder principles
50
51 With the GUI builder, we try to make the next step from WYSIWYG
52 to embedded editing concept - WYSIWYE ("what you see is what you edit").
53 The ROOT GUI Builder allows modifying real GUI objects.
54 For example, one can edit the existing GUI application created by
55 $ROOTSYS/tutorials/gui/guitest.C.
56 GUI components can be added to a design area from a widget palette,
57 or can be borrowed from another application.
58 One can drag and and drop TCanvas's menu bar into the application.
59 GUI objects can be resized and dragged, copied and pasted.
60 ROOT GUI Builder allows changing the layout, snap to grid, change object's
61 layout order via the GUI Builder toolbar, or by options in the right-click
62 context menus.
63 A final design can be immediatly tested and used, or saved as a C++ macro.
64 For example, it's possible to rearrange buttons in control bar,
65 add separators etc. and continue to use a new fancy control bar in the
66 application.
67
68
69 The following is a short description of the GUI Builder actions and key shortcuts:
70
71 - Press Ctrl-Double-Click to start/stop edit mode
72 - Press Double-Click to activate quick edit action (defined in root.mimes)
73 - Warning: some shortcuts might not work if NumLock is enabled
74
75### Selection, grabbing, dropping
76
77 It is possible to select, drag any frame and drop it to any frame
78
79 - Click left mouse button or Ctrl-Click to select an object to edit.
80 - Press right mouse button to activate context menu
81 - Multiple selection (grabbing):
82 - draw lasso and press Return key
83 - press Shift key and draw lasso
84 - Dropping:
85 - select frame and press Ctrl-Return key
86 - Changing layout order:
87 - select frame and use arrow keys to change layout order
88 - Alignment:
89 - draw lasso and press arrow keys (or Shift-Arrow key) to align frames
90
91### Key shortcuts
92
93 - Return - grab selected frames
94 - Ctrl-Return - drop frames
95 - Del - delete selected frame
96 - Shift-Del - crop action
97 - Ctrl-X - cut action
98 - Ctrl-C - copy action
99 - Ctrl-V - paste frame into the last clicked position
100 - Ctrl-L - compact
101 - Ctrl-B - enable/disable layout
102 - Ctrl-H - switch horizontal-vertical layout
103 - Ctrl-G - switch on/off grid
104 - Ctrl-S - save action
105 - Ctrl-O - open and execute a ROOT macro file. GUI components created
106 after macro execution will be emebedded to currently edited
107 design area.
108 - Ctrl-N - create new main frame
109
110*/
111
112
113const char gHelpBuilder[] = "\
114 Start/Stop Edit Mode\n\
115 ************************************************\n\
116 o Select File menu / Edit\n\
117 o Select Start Edit button on the toolbar\n\
118 o Ctrl-Double-Click on the project frame\n\
119 o Double-Click to activate quick edit action (defined in root.mimes)\n\
120\n\
121 Select, Grab, Drop\n\
122 ************************************************\n\
123 It is possible to select & drag any frame and drop it to another frame\n\
124\n\
125 o Press left mouse button Click or Ctrl-Click to select an object.\n\
126 o Press right mouse button to activate context menu\n\
127 o Multiple selection can be done in two ways (grabbing):\n\
128 - draw lasso and press Return key\n\
129 - press Shift key and draw lasso\n\
130 o Dropping:\n\
131 - select frame and press Ctrl-Return key\n\
132 o Changing layout order of widgets:\n\
133 - set broken layout mode via toolbar button or check button\n\
134 \'Layout subframes\' in tab \'Layout\'\n\
135 - select a widget and use arrow keys to change the layout order\n\
136 o Alignment:\n\
137 - remove the selection (if any) by using the space bar\n\
138 - draw lasso and use the four toolbar buttons for widget alignment\n\
139 - arrow keys align the frames too, if you prefer the keyboard\n\
140\n\
141 Key shortcuts\n\
142 ************************************************\n\
143 o Return - grab selected frames\n\
144 o Ctrl-Return - drop frames\n\
145 o Del - delete selected frame\n\
146 o Shift-Del - crop\n\
147 o Ctrl-X - cut\n\
148 o Ctrl-C - copy\n\
149 o Ctrl-V - paste frame into the last clicked position\n\
150 o Ctrl-L - compact frame\n\
151 o Ctrl-B - enable/disable layout\n\
152 o Ctrl-H - switch Horizontal-Vertical layout\n\
153 o Ctrl-G - switch ON/OFF grid\n\
154 o Ctrl-S - save\n\
155 o Ctrl-O - open and execute ROOT macro file\n\
156 o Ctrl-N - create new main frame\n\
157 o Ctrl-Z - undo last action (not implemented)\n\
158 o Shift-Ctrl-Z - redo (not implemented)\n\
159\n\
160 More information\n\
161 ************************************************\n\
162\n\
163For more information, please see the GuiBuilder Howto page at:\n\
164\n\
165 http://root.cern.ch/root/HowtoGuiBuilder.html\n\
166\n\
167";
168
169const char gHelpAboutBuilder[] = "\
170 ROOT Gui Builder\n\
171\n\
172************************************************************\n\
173* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *\n\
174* All rights reserved. *\n\
175* *\n\
176* For the licensing terms see $ROOTSYS/LICENSE. *\n\
177* For the list of contributors see $ROOTSYS/README/CREDITS.*\n\
178************************************************************\n\
179";
180
181//----- Toolbar stuff...
182
184 { "bld_edit.png", "Start Edit (Ctrl-Dbl-Click)", kFALSE, kEditableAct, 0 },
185 { "", "", kFALSE, -1, 0 },
186 { "bld_new.png", "New (Ctrl-N)", kFALSE, kNewAct, 0 },
187 { "bld_open.png", "Open (Ctrl-O)", kFALSE, kOpenAct, 0 },
188 { "bld_save.png", "Save As (Ctrl-S)", kFALSE, kSaveAct, 0 },
189 { "", "", kFALSE, -1, 0 },
190// { "bld_pointer.xpm", "Selector (Ctrl-Click)", kTRUE, kSelectAct, 0 },
191// { "bld_grab.xpm", "Grab Selected Frames (Return)", kTRUE, kGrabAct, 0 },
192 { "", "", kFALSE, -1, 0 },
193 { "bld_compact.png", "Compact selected frame (Ctrl-L)", kFALSE, kCompactAct, 0 },
194 { "bld_break.png", "Disable/Enable layout (Ctrl-B)", kFALSE, kBreakLayoutAct, 0 },
195 { "bld_hbox.png", "Layout selected frame horizontally (Ctrl-H)", kFALSE, kLayoutHAct, 0 },
196 { "bld_vbox.png", "Layout selected frame vertically (Ctrl-H)", kFALSE, kLayoutVAct, 0 },
197 { "bld_grid.png", "On/Off grid (Ctrl+G)", kFALSE, kGridAct, 0 },
198 { "", "", kFALSE, -1, 0 },
199 { "bld_AlignTop.png", "Align selected frames to the top line of lasso (Up Arrow)", kFALSE, kUpAct, 0 },
200 { "bld_AlignBtm.png", "Align selected frames to the down line of lasso (Down Arrow)", kFALSE, kDownAct, 0 },
201 { "bld_AlignLeft.png", "Align selected frames to the left line of lasso (Left Arrow)", kFALSE, kLeftAct, 0 },
202 { "bld_AlignRight.png", "Align selected frames to the right line of lasso (Right Arrow)", kFALSE, kRightAct, 0 },
203 { "", "", kFALSE, -1, 0 },
204 { "bld_cut.png", "Cut (Ctrl-X)", kFALSE, kCutAct, 0 },
205 { "bld_copy.png", "Copy (Ctrl-C)", kFALSE, kCopyAct, 0 },
206 { "bld_paste.png", "Paste frame into the last clicked position (Ctrl-V)", kFALSE, kPasteAct, 0 },
207// { "bld_paste_into.png", "Paste with replacing of selected frame (Ctrl-R)", kFALSE, kReplaceAct, 0 },
208 { "bld_delete.png", "Delete (Del/Backspace)", kFALSE, kDeleteAct, 0 },
209 { "bld_crop.png", "Crop (Shift-Del)", kFALSE, kCropAct, 0 },
210// { "", "", kFALSE, -1, 0 },
211// { "bld_undo.png", "Undo (Ctrl-Z)", kFALSE, kUndoAct, 0 },
212// { "bld_redo.png", "Redo (Shift-Ctrl-Z)", kFALSE, kRedoAct, 0 },
213 { 0, 0, kFALSE, 0, 0 }
214};
215
216
218
219
223
224
225////////////////////////////////////////////////////////////////////////////////
226//
227// Here are few experimental GUI classes which give a nice&fancy appearence
228// to GuiBuilder.
229//
230////////////////////////////////////////////////////////////////////////////////
231
232////////////////////////////////////////////////////////////////////////////////
234
235private:
237
238protected:
239 void DoRedraw();
240
241public:
242 virtual ~TGuiBldMenuTitle() {}
244 TGMenuTitle(p, s, menu) {
249 }
250
252};
253
254////////////////////////////////////////////////////////////////////////////////
255/// Handle crossing events.
256
258{
259 if (event->fType == kEnterNotify) {
261 } else {
263 }
264 DoRedraw();
265 return kTRUE;
266}
267
268////////////////////////////////////////////////////////////////////////////////
269/// Redraw builder menu title.
270
272{
274
275 int x, y, max_ascent, max_descent;
276 x = y = 4;
277
278 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
279
280 if (fState) {
282 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
283 gVirtualX->SetForeground(fNormGC, GetForeground());
284 fLabel->Draw(fId, fSelGC, x, y + max_ascent);
285 } else {
286 gVirtualX->SetForeground(fNormGC, fBgndColor);
287 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
288 gVirtualX->SetForeground(fNormGC, GetForeground());
289 fLabel->Draw(fId, fNormGC, x, y + max_ascent);
290 }
292 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
293 0, 0, GetWidth()-1, GetHeight()-1);
294 }
295}
296
297
298////////////////////////////////////////////////////////////////////////////////
300
301public:
302 virtual ~TGuiBldPopupMenu() { }
304 TGPopupMenu(gClient->GetDefaultRoot()) {
307 fEntrySep = 8;
308 }
309 void DrawEntry(TGMenuEntry *entry);
310};
311
312////////////////////////////////////////////////////////////////////////////////
313/// Draw popup menu entry.
314
316{
317 FontStruct_t font;
318 GCValues_t gcval;
319
320 if (entry->GetStatus() & kMenuHideMask)
321 return;
322
323 if (entry->GetStatus() & kMenuDefaultMask) {
324 font = fHifontStruct;
325 gcval.fMask = kGCFont;
326 gcval.fFont = gVirtualX->GetFontHandle(font);
327 gVirtualX->ChangeGC(fNormGC, &gcval);
328 gVirtualX->ChangeGC(fSelGC, &gcval);
329 } else {
330 font = fFontStruct;
331 }
332
333 UInt_t tw = 0;
335 Int_t max_ascent, max_descent;
336 gVirtualX->GetFontProperties(font, max_ascent, max_descent);
337 if (entry->GetShortcut())
338 tw = 7 + gVirtualX->TextWidth(fFontStruct, entry->GetShortcutText(),
339 entry->GetShortcut()->Length());
340
341 Int_t tx = entry->GetEx() + fXl;
342 Int_t ty = entry->GetEy() + max_ascent + 2;
343 UInt_t h = max_ascent + max_descent + sep;
344 Int_t picposy = 0;
345 if (entry->GetPic() != 0) {
346 picposy = entry->GetEy() + h / 2;
347 picposy -= entry->GetPic()->GetHeight() / 2;
348 }
349
350 switch (entry->GetType()) {
351 case kMenuPopup:
352 case kMenuLabel:
353 case kMenuEntry:
354 if ((entry->GetStatus() & kMenuActiveMask) &&
355 entry->GetType() != kMenuLabel) {
356 if (entry->GetStatus() & kMenuEnableMask) {
357 gVirtualX->FillRectangle(fId,
359 entry->GetEx()+1, entry->GetEy(),
360 fMenuWidth-6, h - 1);
361 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
362 entry->GetEx()+ 1, entry->GetEy()-1,
363 fMenuWidth - entry->GetEx()- 6, h - 1);
364 }
365
366 if (entry->GetType() == kMenuPopup) {
367 DrawTrianglePattern(fSelGC, fMenuWidth-10, entry->GetEy() + 3,
368 fMenuWidth-6, entry->GetEy() + 11);
369 }
370
371 if (entry->GetStatus() & kMenuCheckedMask) {
372 DrawCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
373 entry->GetEy()+11);
374 }
375
376 if (entry->GetStatus() & kMenuRadioMask) {
377 DrawRCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
378 entry->GetEy()+11);
379 }
380
381 if (entry->GetPic() != 0) {
382 entry->GetPic()->Draw(fId, fSelGC, 8, picposy);
383 }
384
385 entry->GetLabel()->Draw(fId,
386 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
387 GetShadowGC()(), tx, ty);
388 if (entry->GetShortcut())
389 entry->GetShortcut()->Draw(fId,
390 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
391 GetShadowGC()(), fMenuWidth - tw, ty);
392 } else {
393 if ( entry->GetType() != kMenuLabel) {
394 gVirtualX->FillRectangle(fId,
396 entry->GetEx()+1, entry->GetEy()-1, tx-4, h);
397
398 gVirtualX->FillRectangle(fId,
400 tx-1, entry->GetEy()-1, fMenuWidth-tx-1, h);
401 } else { // we need some special background for labels
402 gVirtualX->FillRectangle(fId, TGFrame::GetBckgndGC()(),
403 entry->GetEx()+1, entry->GetEy()-1,
404 fMenuWidth - entry->GetEx()- 3, h);
405 }
406
407 if (entry->GetType() == kMenuPopup) {
409 fMenuWidth-6, entry->GetEy() + 11);
410 }
411
412 if (entry->GetStatus() & kMenuCheckedMask) {
413 DrawCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
414 entry->GetEy()+11);
415 }
416
417 if (entry->GetStatus() & kMenuRadioMask) {
418 DrawRCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
419 entry->GetEy()+11);
420 }
421
422 if (entry->GetPic() != 0) {
423 entry->GetPic()->Draw(fId, fNormGC, 8, picposy);
424 }
425
426 if (entry->GetStatus() & kMenuEnableMask) {
427 entry->GetLabel()->Draw(fId, fNormGC, tx, ty);
428 if (entry->GetShortcut())
429 entry->GetShortcut()->Draw(fId, fNormGC, fMenuWidth - tw, ty);
430 } else {
431 entry->GetLabel()->Draw(fId, GetHilightGC()(), tx+1, ty+1);
432 entry->GetLabel()->Draw(fId, GetShadowGC()(), tx, ty);
433 if (entry->GetShortcut()) {
434 entry->GetShortcut()->Draw(fId, GetHilightGC()(),
435 fMenuWidth - tw+1, ty+1);
436 entry->GetShortcut()->Draw(fId, GetShadowGC()(),
437 fMenuWidth - tw, ty);
438 }
439 }
440 }
441 break;
442
443 case kMenuSeparator:
444 gVirtualX->FillRectangle(fId, TRootGuiBuilder::GetBgndGC()->GetGC(),
445 entry->GetEx()+1, entry->GetEy()-1,
446 tx-4, 4);
447 gVirtualX->DrawLine(fId, TGFrame::GetBlackGC()(), tx+1,
448 entry->GetEy()+1, fMenuWidth-sep,
449 entry->GetEy()+1);
450 break;
451 }
452
453 // restore font
454 if (entry->GetStatus() & kMenuDefaultMask) {
455 gcval.fFont = gVirtualX->GetFontHandle(fFontStruct);
456 gVirtualX->ChangeGC(fNormGC, &gcval);
457 gVirtualX->ChangeGC(fSelGC, &gcval);
458 }
459}
460
461////////////////////////////////////////////////////////////////////////////////
463
464private:
466
467protected:
468 void DoRedraw();
469
470public:
471 virtual ~TGuiBldToolButton() { }
472 TGuiBldToolButton(const TGWindow *p, const TGPicture *pic, Int_t id = -1) :
473 TGPictureButton(p, pic, id) {
476 }
477
478 Bool_t IsDown() const { return (fOptions & kSunkenFrame); }
479 void SetState(EButtonState state, Bool_t emit = kTRUE);
482};
483
484////////////////////////////////////////////////////////////////////////////////
485/// Redraw tool button.
486
488{
489 int x = (fWidth - fTWidth) >> 1;
490 int y = (fHeight - fTHeight) >> 1;
491 UInt_t w = GetWidth() - 1;
492 UInt_t h = GetHeight()- 1;
493
495
498 ++x; ++y;
499 w--; h--;
500 }
501
502 const TGPicture *pic = fPic;
503 if (fState == kButtonDisabled) {
505 pic = fPicD ? fPicD : fPic;
506 }
508 x--; y--;
509 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(), 0, 0, w, h);
510 }
511 pic->Draw(fId, fNormGC, x, y);
512}
513
514////////////////////////////////////////////////////////////////////////////////
515/// Handle crossing events.
516
518{
519 if (fTip) {
520 if (event->fType == kEnterNotify) {
521 fTip->Reset();
522 } else {
523 fTip->Hide();
524 }
525 }
526
527 if ((event->fType == kEnterNotify) && (fState != kButtonDisabled)) {
529 } else {
531 }
532 if (event->fType == kLeaveNotify) {
536 }
537 DoRedraw();
538
539 return kTRUE;
540}
541
542////////////////////////////////////////////////////////////////////////////////
543/// Set state of tool bar button and emit a signal according
544/// to passed arguments.
545
547{
548 Bool_t was = !IsDown();
549
550 if (state != fState) {
551 switch (state) {
552 case kButtonEngaged:
553 case kButtonDown:
554 fOptions &= ~kRaisedFrame;
556 break;
557 case kButtonDisabled:
558 case kButtonUp:
559 fOptions &= ~kRaisedFrame;
560 fOptions &= ~kSunkenFrame;
561 break;
562 }
563 fState = state;
564 DoRedraw();
565 if (emit) EmitSignals(was);
566 }
567}
568
569////////////////////////////////////////////////////////////////////////////////
570////////////////////////////////////////////////////////////////////////////////
571/// Create GUI builder application.
572
574 TGMainFrame(p ? p : gClient->GetDefaultRoot(), 1, 1)
575{
577 gGuiBuilder = this;
578 fManager = 0;
579 fEditor = 0;
580 fActionButton = 0;
581 fClosing = 0;
582
583 if (gDragManager) {
585 } else {
587 }
588 fManager->SetBuilder(this);
589
590 fMenuBar = new TGMdiMenuBar(this, 10, 10);
592 InitMenu();
593
595 kLHintsExpandX, 0,0,2,2));
596
597 fToolDock = new TGDockableFrame(this);
599 fToolDock->SetWindowName("GuiBuilder ToolBar");
600
604
605 int spacing = 8;
606
607 for (int i = 0; gToolBarData[i].fPixmap; i++) {
608 if (strlen(gToolBarData[i].fPixmap) == 0) {
609 spacing = 8;
610 continue;
611 }
612
613 const TGPicture *pic = fClient->GetPicture(gToolBarData[i].fPixmap);
615 gToolBarData[i].fId);
616 pb->SetStyle(gClient->GetStyle());
617
618 pb->SetToolTipText(gToolBarData[i].fTipText);
619
620 TGToolTip *tip = pb->GetToolTip();
621 tip->SetDelay(200);
622
623 tip->Connect("Reset()", "TRootGuiBuilder", this, "UpdateStatusBar(=0)");
624 tip->Connect("Hide()", "TRootGuiBuilder", this, "EraseStatusBar()");
625
626 fToolBar->AddButton(this, pb, spacing);
627 spacing = 0;
628
629 if (gToolBarData[i].fId == kEditableAct) {
630 fStartButton = pb;
631 continue;
632 }
633
634 if ((gToolBarData[i].fId == kUndoAct) ||
635 (gToolBarData[i].fId == kRedoAct)) {
637 }
638 }
639
640 fToolBar->Connect("Clicked(Int_t)", "TGuiBldDragManager", fManager,
641 "HandleAction(Int_t)");
642
644 kLHintsExpandX, 0,0,2,5));
645
646 TGCompositeFrame *cf = new TGHorizontalFrame(this, 1, 1);
648
649 //fShutterDock = new TGDockableFrame(cf);
650 //cf->AddFrame(fShutterDock, new TGLayoutHints(kLHintsNormal ));
651 //fShutterDock->SetWindowName("Widget Factory");
652 //fShutterDock->EnableUndock(kTRUE);
653 //fShutterDock->EnableHide(kTRUE);
654 //fShutterDock->DockContainer();
655
659
661 splitter->SetFrame(fShutter, kTRUE);
663
664 fMain = new TGMdiMainFrame(cf, fMenuBar, 1, 1);
665 fMain->Connect("FrameClosed(Int_t)", "TRootGuiBuilder", this,
666 "HandleWindowClosed(Int_t)");
667
668 TQObject::Connect("TGMdiFrame", "CloseWindow()", "TRootGuiBuilder", this,
669 "MaybeCloseWindow()");
670
672
674
675 const TGPicture *pbg = fClient->GetPicture("bld_bg.png");
676 if (pbg) {
678 }
679
680 if (fManager) {
681 fEditor = new TGuiBldEditor(cf);
685 }
686
687 AddSection("Projects");
688 AddSection("Buttons");
689 AddSection("Containers");
690 AddSection("Bars");
691 AddSection("Input");
692 AddSection("Complex Input");
693 AddSection("Display");
694 AddSection("Dialogs");
695
696 // create an empty section
697 AddSection("User's Macros");
698 TGShutterItem *item = fShutter->GetItem("User's Macros");
701
702 TGuiBldAction *act = new TGuiBldAction("TGMainFrame", "Empty Frame",
704 act->fAct = "empty";
705 act->fPic = "bld_mainframe.xpm";
706 AddAction(act, "Projects");
707
708 act = new TGuiBldAction("TGMainFrame", "Horizontal Frame", kGuiBldProj);
709 act->fAct = "horizontal";
710 act->fPic = "bld_mainframe.xpm";
711 AddAction(act, "Projects");
712
713 act = new TGuiBldAction("TGMainFrame", "Vertical Frame", kGuiBldProj);
714 act->fAct = "vertical";
715 act->fPic = "bld_mainframe.xpm";
716 AddAction(act, "Projects");
717
718 // Standard
719 act = new TGuiBldAction("TGTextButton", "Text Button", kGuiBldCtor);
720 act->fAct = "new TGTextButton()";
721 act->fPic = "bld_textbutton.xpm";
722 AddAction(act, "Buttons");
723
724 act = new TGuiBldAction("TGCheckButton", "Check Button", kGuiBldCtor);
725 act->fAct = "new TGCheckButton()";
726 act->fPic = "bld_checkbutton.xpm";
727 AddAction(act, "Buttons");
728
729 act = new TGuiBldAction("TGRadioButton", "Radio Button", kGuiBldCtor);
730 act->fAct = "new TGRadioButton()";
731 act->fPic = "bld_radiobutton.xpm";
732 AddAction(act, "Buttons");
733
734 act = new TGuiBldAction("TGPictureButton", "Picture Button", kGuiBldCtor);
735 act->fAct = "new TGPictureButton()";
736 act->fPic = "bld_image.xpm";
737 AddAction(act, "Buttons");
738
739 act = new TGuiBldAction("TGTextEntry", "Text Entry", kGuiBldCtor);
740 act->fAct = "new TGTextEntry()";
741 act->fPic = "bld_entry.xpm";
742 AddAction(act, "Input");
743
744 act = new TGuiBldAction("TGTextEdit", "Text Edit", kGuiBldCtor);
745 act->fAct = "TRootGuiBuilder::BuildTextEdit()";
746 act->fPic = "bld_text.xpm";
747 AddAction(act, "Input");
748
749 act = new TGuiBldAction("TGNumberEntry", "Number Entry", kGuiBldCtor);
750 act->fAct = "new TGNumberEntry()";
751 act->fPic = "bld_numberentry.xpm";
752 AddAction(act, "Input");
753
754 act = new TGuiBldAction("TGComboBox", "Combo Box", kGuiBldCtor);
755 act->fAct = "TRootGuiBuilder::BuildComboBox()";
756 act->fPic = "bld_combobox.xpm";
757 AddAction(act, "Input");
758
759 act = new TGuiBldAction("TGListBox", "List Box", kGuiBldCtor);
760 act->fAct = "TRootGuiBuilder::BuildListBox()";
761 act->fPic = "bld_listbox.xpm";
762 AddAction(act, "Input");
763
764 act = new TGuiBldAction("TGHSlider", "Horizontal Slider", kGuiBldCtor);
765 act->fAct = "new TGHSlider()";
766 act->fPic = "bld_hslider.xpm";
767 AddAction(act, "Input");
768
769 act = new TGuiBldAction("TGVSlider", "Vertical Slider", kGuiBldCtor);
770 act->fAct = "new TGVSlider()";
771 act->fPic = "bld_vslider.xpm";
772 AddAction(act, "Input");
773
774 act = new TGuiBldAction("TGHScrollBar", "HScrollbar", kGuiBldCtor);
775 act->fAct = "TRootGuiBuilder::BuildHScrollBar()";
776 act->fPic = "bld_hscrollbar.xpm";
777 AddAction(act, "Input");
778
779 act = new TGuiBldAction("TGVScrollBar", "VScrollbar", kGuiBldCtor);
780 act->fAct = "TRootGuiBuilder::BuildVScrollBar()";
781 act->fPic = "bld_vscrollbar.xpm";
782 AddAction(act, "Input");
783
784 act = new TGuiBldAction("TGListTree", "List Tree", kGuiBldCtor);
785 act->fAct = "TRootGuiBuilder::BuildListTree()";
786 act->fPic = "bld_listtree.xpm";
787 AddAction(act, "Complex Input");
788
789 act = new TGuiBldAction("TGLabel", "Text Label", kGuiBldCtor);
790 act->fAct = "new TGLabel()";
791 act->fPic = "bld_label.xpm";
792 AddAction(act, "Display");
793
794 act = new TGuiBldAction("TGIcon", "Icon", kGuiBldCtor);
795 act->fAct = "new TGIcon()";
796 act->fPic = "bld_image.xpm";
797 AddAction(act, "Display");
798
799 act = new TGuiBldAction("TGHorizontal3DLine", "Horizontal Line",
801 act->fAct = "TRootGuiBuilder::BuildH3DLine()";
802 act->fPic = "bld_hseparator.xpm";
803 AddAction(act, "Display");
804
805 act = new TGuiBldAction("TGVertical3DLine", "Vertical Line", kGuiBldCtor);
806 act->fAct = "TRootGuiBuilder::BuildV3DLine()";
807 act->fPic = "bld_vseparator.xpm";
808 AddAction(act, "Display");
809
810 act = new TGuiBldAction("TGStatusBar", "Status Bar", kGuiBldCtor);
811 act->fAct = "new TGStatusBar()";
812 act->fPic = "bld_statusbar.xpm";
814 AddAction(act, "Bars");
815
816 act = new TGuiBldAction("TGHProgressBar", "HProgress Bar", kGuiBldCtor);
817 act->fAct = "TRootGuiBuilder::BuildHProgressBar()";
818 act->fPic = "bld_hprogressbar.xpm";
819 AddAction(act, "Display");
820
821 act = new TGuiBldAction("TGVProgressBar", "VProgress Bar", kGuiBldCtor);
822 act->fAct = "TRootGuiBuilder::BuildVProgressBar()";
823 act->fPic = "bld_vprogressbar.xpm";
824 AddAction(act, "Display");
825
826 act = new TGuiBldAction("TRootEmbeddedCanvas", "Embed Canvas", kGuiBldCtor);
827 act->fAct = "new TRootEmbeddedCanvas()";
828 act->fPic = "bld_embedcanvas.xpm";
829 AddAction(act, "Display");
830
831 // Containers
832 act = new TGuiBldAction("TGHorizontalFrame", "Horizontal Frame",
834 act->fAct = "new TGHorizontalFrame(0,200,100)";
835 act->fPic = "bld_hbox.xpm";
836 AddAction(act, "Containers");
837
838 act = new TGuiBldAction("TGVerticalFrame", "Vertical Frame", kGuiBldCtor);
839 act->fAct = "new TGVerticalFrame(0,100,200)";
840 act->fPic = "bld_vbox.xpm";
841 AddAction(act, "Containers");
842
843 act = new TGuiBldAction("TGGroupFrame", "Group Frame", kGuiBldCtor);
844 act->fAct = "new TGGroupFrame()";
845 act->fPic = "bld_groupframe.xpm";
846 AddAction(act, "Containers");
847
848 act = new TGuiBldAction("TGTab", "Tabbed Frame", kGuiBldCtor);
849 act->fAct = "TRootGuiBuilder::BuildTab()";
850 act->fPic = "bld_tab.xpm";
851 AddAction(act, "Containers");
852
853 act = new TGuiBldAction("TGShutter", "Shutter", kGuiBldCtor);
854 act->fAct = "TRootGuiBuilder::BuildShutter()";
855 act->fPic = "bld_shutter.png";
856 AddAction(act, "Containers");
857
858
859 act = new TGuiBldAction("TGCanvas", "Scrolled Canvas", kGuiBldCtor);
860 act->fAct = "TRootGuiBuilder::BuildCanvas()";
861 act->fPic = "bld_canvas.xpm";
862 AddAction(act, "Containers");
863/*
864 act = new TGuiBldAction("TGVSplitter", "Horizontal Panes", kGuiBldFunc);
865 act->fAct = "TRootGuiBuilder::VSplitter()";
866 act->fPic = "bld_hpaned.xpm";
867 AddAction(act, "Containers");
868
869 act = new TGuiBldAction("TGHSplitter", "Vertical Panes", kGuiBldFunc);
870 act->fAct = "TRootGuiBuilder::HSplitter()";
871 act->fPic = "bld_vpaned.xpm";
872 AddAction(act, "Containers");
873*/
874 act = new TGuiBldAction("TGColorSelect", "Color Selector", kGuiBldFunc);
875 act->fAct = "new TGColorSelect()";
876 act->fPic = "bld_colorselect.xpm";
877 AddAction(act, "Dialogs");
878
880
881 fStatusBar = new TGStatusBar(this, 40, 10);
883 0, 0, 3, 0));
884
886 SetEditDisabled(kEditDisable); // disable editting to all subframes
887
889
890 Int_t qq;
891 UInt_t ww;
892 UInt_t hh;
893 gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);
894 MoveResize(100, 100, ww - 200, hh - 200);
895 SetWMPosition(100, 100);
896
897 SetWindowName("ROOT GuiBuilder");
898 SetIconName("ROOT GuiBuilder");
899 fIconPic = SetIconPixmap("bld_rgb.xpm");
900 SetClassHints("ROOT", "GuiBuilder");
901
902 fSelected = 0;
903 Update();
904
905 fMenuFile->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
906 "HandleMenu(Int_t)");
907 fMenuWindow->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
908 "HandleMenu(Int_t)");
909 fMenuHelp->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
910 "HandleMenu(Int_t)");
911
912 // doesn't work properly on Windows...
913 if (gVirtualX->InheritsFrom("TGX11"))
914 BindKeys();
915 UpdateStatusBar("Ready");
916 MapRaised();
917
919}
920
921////////////////////////////////////////////////////////////////////////////////
922/// Destructor.
923
925{
926 if (fIconPic) gClient->FreePicture(fIconPic);
927 delete fMenuFile;
928 delete fMenuWindow;
929 delete fMenuHelp;
930 gGuiBuilder = 0;
931}
932
933////////////////////////////////////////////////////////////////////////////////
934/// Close GUI builder via window manager "Close" button.
935
937{
938 TGWindow *root = (TGWindow*)fClient->GetRoot();
939 if (root) root->SetEditable(kFALSE);
940
941 fEditor->Reset();
942
943 if (fMain->GetNumberOfFrames() == 0) {
947 } else {
951 }
952
954 if (btn) {
956 }
957 fClosing = 1;
958 fMain->CloseAll();
959 if (fClosing == -1) {
960 fClosing = 0;
961 return;
962 }
964 Hide();
965}
966
967////////////////////////////////////////////////////////////////////////////////
968/// Find action by name
969
970TGButton *TRootGuiBuilder::FindActionButton(const char *name, const char *sect)
971{
972 if (!name || !sect) return 0;
973
974 TGShutterItem *item = fShutter->GetItem(sect);
975 if (!item) return 0;
976
979 TGFrameElement *fe;
980
981 TIter next(cont->GetList());
982 TGLabel *lb;
983 TGButton *btn;
984
985 while ((fe = (TGFrameElement*)next())) {
986 hf = (TGHorizontalFrame*)fe->fFrame;
987 btn = (TGButton*)((TGFrameElement*)hf->GetList()->First())->fFrame;
988 lb = (TGLabel*)((TGFrameElement*)hf->GetList()->Last())->fFrame;
989 if (*(lb->GetText()) == name) {
990 return (TGButton*)btn;
991 }
992 }
993 return 0;
994}
995
996////////////////////////////////////////////////////////////////////////////////
997/// Add new action to widget palette.
998
999void TRootGuiBuilder::AddAction(TGuiBldAction *act, const char *sect)
1000{
1001 if (!act || !sect) return;
1002
1003 TGShutterItem *item = fShutter->GetItem(sect);
1004 TGButton *btn = 0;
1005
1006 if (!item) return;
1009
1010 const TGPicture *pic = 0;
1011 if (!act->fPicture) {
1012 act->fPicture = fClient->GetPicture(act->fPic);
1013 }
1014 pic = act->fPicture;
1015
1016 TGHorizontalFrame *hf = new TGHorizontalFrame(cont);
1017
1018 if (pic) {
1019 btn = new TGPictureButton(hf, pic);
1020 } else {
1021 btn = new TGTextButton(hf, act->GetName());
1022 }
1023
1024 btn->SetToolTipText(act->GetTitle(), 200);
1025 btn->SetUserData((void*)act);
1026 btn->Connect("Clicked()", "TRootGuiBuilder", this, "HandleButtons()");
1027
1028 hf->AddFrame(btn, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1029
1030 TGLabel *lb = new TGLabel(hf, act->fType != kGuiBldMacro ? act->GetTitle() :
1031 act->GetName());
1032 lb->SetBackgroundColor(cont->GetBackground());
1033 hf->AddFrame(lb, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1034 hf->SetBackgroundColor(cont->GetBackground());
1035
1036 // disable edit
1039
1040 cont->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 2, 2, 2, 0));
1041 cont->MapSubwindows();
1042 cont->Resize(); // invoke Layout()
1043}
1044
1045////////////////////////////////////////////////////////////////////////////////
1046/// Add new shutter item.
1047
1048void TRootGuiBuilder::AddSection(const char *sect)
1049{
1050 static int id = 10000;
1051 TGShutterItem *item = new TGShutterItem(fShutter, new TGHotString(sect),
1052 id++);
1053 fShutter->AddItem(item);
1054 item->Connect("Selected()", "TRootGuiBuilder", this, "HandleMenu(=3)");
1055}
1056
1057////////////////////////////////////////////////////////////////////////////////
1058/// Handle buttons in the GUI builder's widget palette.
1059
1061{
1062 TGFrame *parent;
1063
1064 if (fActionButton) {
1065 parent = (TGFrame*)fActionButton->GetParent();
1066 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1067 fClient->NeedRedraw(parent, kTRUE);
1068 }
1069
1070 if (!fClient->IsEditable()) {
1072 }
1073
1076 parent = (TGFrame*)fActionButton->GetParent();
1077
1078 parent->ChangeOptions(parent->GetOptions() | kSunkenFrame);
1079 fClient->NeedRedraw(parent, kTRUE);
1080
1081 if (act) {
1082 fAction = act;
1085 }
1086}
1087
1088////////////////////////////////////////////////////////////////////////////////
1089/// Execute an action.
1090
1092{
1093 if (!fAction || fAction->fAct.IsNull()) return 0;
1094
1095 TGFrame *ret = 0;
1096
1097 if (!fClient->IsEditable() && (fAction->fType != kGuiBldMacro)) {
1098 TGMdiFrame *current = fMain->GetCurrent();
1099 if (current) current->SetEditable(kTRUE);
1100 }
1101
1102 TString s = "";
1103
1104 switch (fAction->fType) {
1105 case kGuiBldProj:
1106 s = fAction->fAct.Data();
1107 NewProject(s);
1108 fAction = 0;
1109 break;
1110 case kGuiBldMacro:
1111 {
1112 TGWindow *root = (TGWindow*)fClient->GetRoot();
1113 if (root) root->SetEditable(kFALSE);
1114 gROOT->Macro(fAction->fAct.Data());
1115 if (root) root->SetEditable(kTRUE);
1116 fAction = 0;
1117 break;
1118 }
1119 default:
1120 ret = (TGFrame *)gROOT->ProcessLineFast(fAction->fAct.Data());
1121 break;
1122 }
1123
1124 Update();
1125
1126 return ret;
1127}
1128
1129////////////////////////////////////////////////////////////////////////////////
1130/// Inititiate GUI Builder menus.
1131
1133{
1135 fMenuFile->AddEntry(new TGHotString("&Edit (Ctrl+double-click)"),
1137 fClient->GetPicture("bld_edit.png"));
1138 fMenuFile->AddEntry(new TGHotString("&Stop (Ctrl+double-click)"),
1140 fClient->GetPicture("bld_stop.png"));
1144 fMenuFile->AddEntry(new TGHotString("&New Project"), kGUIBLD_FILE_NEW,
1145 0, fClient->GetPicture("bld_new.png"));
1147 0, fClient->GetPicture("bld_open.png"));
1149 0, fClient->GetPicture("bld_delete.png"));
1150 fMenuFile->AddEntry(new TGHotString("&Save project as"), kGUIBLD_FILE_SAVE,
1151 0, fClient->GetPicture("bld_save.png"));
1155 0, fClient->GetPicture("bld_exit.png"));
1156/*
1157 fMenuEdit = new TGuiBldPopupMenu();
1158 fMenuEdit->AddSeparator();
1159 fMenuEdit->AddEntry(new TGHotString("&Preferences ..."), kGUIBLD_EDIT_PREF);
1160*/
1162 fMenuWindow->AddEntry(new TGHotString("Tile &Horizontally"),
1164 fMenuWindow->AddEntry(new TGHotString("Tile &Vertically"),
1166 fMenuWindow->AddEntry(new TGHotString("&Cascade"),
1169 //fMenuWindow->AddPopup(new TGHotString("&Windows"), fMain->GetWinListMenu());
1170 fMenuWindow->AddEntry(new TGHotString("&Arrange icons"),
1173 fMenuWindow->AddEntry(new TGHotString("&Opaque resize"),
1176
1181 //fMenuHelp->AddSeparator();
1182 //fMenuHelp->AddEntry(new TGHotString("&Send Bug Report"),kGUIBLD_HELP_BUG);
1183
1185
1186 TGuiBldMenuTitle *title;
1187 title = new TGuiBldMenuTitle(bar, new TGHotString("&File"), fMenuFile);
1188 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1189
1190 //title = new TGuiBldMenuTitle(bar, new TGHotString("&Edit"), fMenuEdit);
1191 //bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1192
1193 title = new TGuiBldMenuTitle(bar, new TGHotString("&Windows"), fMenuWindow);
1194 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1195
1196 title = new TGuiBldMenuTitle(bar, new TGHotString("&Help"), fMenuHelp);
1197 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsRight,4,4,0,0));
1198
1201}
1202
1203////////////////////////////////////////////////////////////////////////////////
1204/// Set selected frame.
1205
1207{
1208 fSelected = f;
1209 Update();
1210}
1211
1212////////////////////////////////////////////////////////////////////////////////
1213/// Enable toolbar buttons for alignment.
1214
1216{
1217 TGButton *btn = 0;
1218
1219 btn = fToolBar->GetButton(kUpAct);
1220 if (btn) {
1222 }
1223
1224 btn = fToolBar->GetButton(kDownAct);
1225 if (btn) {
1227 }
1228
1230 if (btn) {
1232 }
1233
1234 btn = fToolBar->GetButton(kLeftAct);
1235 if (btn) {
1237 }
1238
1240 if (btn) {
1242 }
1243
1244 btn = fToolBar->GetButton(kGrabAct);
1245 if (btn) {
1246 btn->SetState(kButtonUp);
1247 }
1248
1249 btn = fToolBar->GetButton(kCropAct);
1250 if (btn) {
1252 }
1253
1254}
1255
1256////////////////////////////////////////////////////////////////////////////////
1257/// Enable/disable toolbar buttons according to the selected frame.
1258
1260{
1262
1263 TGButton *btn = 0;
1264
1265 if (!fSelected) {
1267 if (btn) btn->SetState(kButtonDisabled);
1268
1270 if (btn) btn->SetState(kButtonDisabled);
1271
1273 if (btn) btn->SetState(kButtonDisabled);
1274
1276 if (btn) btn->SetState(kButtonDisabled);
1277 return;
1278 }
1279
1280 Bool_t comp = kFALSE;
1281 TGLayoutManager *lm = 0;
1282 Bool_t hor = kFALSE;
1283 Bool_t fixed = kFALSE;
1284 Bool_t enable = on;
1285 Bool_t compact_disable = kTRUE;
1286
1288 lm = ((TGCompositeFrame*)fSelected)->GetLayoutManager();
1289 comp = kTRUE;
1290 hor = lm && lm->InheritsFrom(TGHorizontalLayout::Class());
1292 compact_disable = !fManager->CanCompact(fSelected);
1293 } else {
1294 enable = kFALSE;
1295 }
1296
1298 if (btn) btn->SetState(enable && comp && !fixed && !compact_disable ?
1300
1302 if (btn) {
1303 btn->SetState(enable && comp && !hor && !fixed ? kButtonUp :
1305 }
1306
1308 if (btn) {
1309 btn->SetState(enable && comp && hor && !fixed ? kButtonUp :
1311 }
1312
1314 if (btn) {
1315 btn->SetState(enable && comp && !fixed ? kButtonUp : kButtonDisabled);
1316 }
1317/*
1318 btn = fToolBar->GetButton(kGrabAct);
1319 if (btn) {
1320 btn->SetState(enable && comp ? kButtonDown : kButtonUp);
1321 TGToolTip *tt = btn->GetToolTip();
1322 tt->SetText(btn->IsDown() ? "Drop Frames (Ctrl-Return)" :
1323 "Grab Selected Frames (Return)");
1324 }
1325*/
1326}
1327
1328////////////////////////////////////////////////////////////////////////////////
1329/// Enable/disable toolbar buttons according to the selected frame.
1330
1332{
1333 TGButton *btn = 0;
1334
1335 Bool_t lasso = fManager->IsLassoDrawn() && on;
1336
1338 if (btn) {
1340 }
1341
1342 btn = fToolBar->GetButton(kCutAct);
1343 if (btn) {
1344 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1345 }
1346
1347 btn = fToolBar->GetButton(kDropAct);
1348 if (btn) {
1349 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1350 }
1351
1352 btn = fToolBar->GetButton(kCopyAct);
1353 if (btn) {
1354 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1355 }
1356
1358 if (btn) {
1359 btn->SetState(!on || !fManager->IsPasteFrameExist() ?
1361 }
1362
1363 btn = fToolBar->GetButton(kCropAct);
1364 if (btn) {
1365 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1366 }
1367
1369 if (btn) {
1370 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1371 }
1372}
1373
1374////////////////////////////////////////////////////////////////////////////////
1375/// Update gui builder.
1376
1378{
1379 if (!fManager) {
1380 return;
1381 }
1382
1387 fManager->GetSelected() ||
1389
1390 if (fActionButton) {
1391 TGFrame *parent = (TGFrame*)fActionButton->GetParent();
1392 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1393 fClient->NeedRedraw(parent, kTRUE);
1394 }
1395
1396 if (!fClient->IsEditable()) {
1397 UpdateStatusBar("");
1400 fEditable = 0;
1401 //fShutter->SetSelectedItem(fShutter->GetItem("Projects"));
1402 } else {
1405 }
1406
1408 fActionButton = 0;
1409}
1410
1411////////////////////////////////////////////////////////////////////////////////
1412/// Return the status of the selected mode.
1413
1415{
1416 TGButton *btn = 0;
1418
1419 if (!btn) return kFALSE;
1420
1421 return btn->IsDown();
1422}
1423
1424////////////////////////////////////////////////////////////////////////////////
1425/// Return the status of the grab mode.
1426
1428{
1430
1431 if (!btn) return kFALSE;
1432
1433 return btn->IsDown();
1434}
1435
1436////////////////////////////////////////////////////////////////////////////////
1438
1439public:
1441 TGMainFrame(p, w, h) {}
1442 void SetList(TList *li) { fList = li; }
1443};
1444
1445static const char *gSaveMacroTypes[] = {
1446 "Macro files", "*.[C|c]*",
1447 "All files", "*",
1448 0, 0
1449};
1450
1451////////////////////////////////////////////////////////////////////////////////
1452/// Handle keys.
1453
1455{
1456 if (event->fType == kGKeyPress) {
1457 UInt_t keysym;
1458 char str[2];
1459 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1460
1461 if (event->fState & kKeyControlMask) {
1462 if (str[0] == 19) { // ctrl-s
1463 if (fMain->GetCurrent()) {
1464 return SaveProject(event);
1465 } else {
1466 return kFALSE; //TGMainFrame::HandleKey(event);
1467 }
1468 } else if (str[0] == 14) { //ctrl-n
1469 return NewProject(); //event not needed
1470 } else if (str[0] == 15) { // ctrl-o
1471 return OpenProject(event);
1472 }
1473 }
1476 }
1477 return kTRUE;
1478}
1479
1480////////////////////////////////////////////////////////////////////////////////
1481/// Create a new project.
1482
1484{
1485 TGWindow *root = (TGWindow*)fClient->GetRoot();
1486
1487 if (root) root->SetEditable(kFALSE);
1488 fEditable = new TGMdiFrame(fMain, 500, 400, kOwnBackground);
1492 fEditable->SetEditDisabled(0); // enable editting
1496
1497 if (type == "horizontal") {
1498 TGHorizontalFrame *hor = new TGHorizontalFrame(fEditable, 100, 100);
1500 kLHintsExpandY, 1, 1, 1, 1));
1501 hor->SetEditable(kTRUE);
1502 fClient->NeedRedraw(hor, kTRUE);
1507 fEditable->Layout();
1508 }
1509 else if (type == "vertical") {
1510 TGVerticalFrame *vert = new TGVerticalFrame(fEditable, 100, 100);
1512 kLHintsExpandY,1,1,1,1));
1513 vert->SetEditable(kTRUE);
1514 fClient->NeedRedraw(vert, kTRUE);
1519 fEditable->Layout();
1520
1521 } else {
1523 }
1528
1529
1531 return kTRUE;
1532}
1533
1534////////////////////////////////////////////////////////////////////////////////
1535/// Open new gui builder project.
1536
1538{
1539
1541 if (btn) {
1543 fClient->NeedRedraw(btn, kTRUE);
1544 }
1545
1546 TGFileInfo fi;
1547 static TString dir(".");
1548 static Bool_t overwr = kFALSE;
1549 TString fname;
1550
1552 fi.SetIniDir(dir);
1553 fi.fOverwrite = overwr;
1554 TGWindow *root = (TGWindow*)fClient->GetRoot();
1555 root->SetEditable(kFALSE);
1556
1557 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
1558
1559 if (!fi.fFilename) {
1560 root->SetEditable(kTRUE);
1561 return kFALSE;
1562 }
1563
1564 dir = fi.fIniDir;
1565 overwr = fi.fOverwrite;
1566 fname = fi.fFilename;
1567
1568 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1569 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1570 NewProject(); // create new project
1571 gROOT->Macro(fname.Data()); // put content of the macro as child frame
1572 } else {
1573 Int_t retval;
1574 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1575 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1577 &retval);
1578
1579 if (retval == kMBRetry) {
1581 }
1582 }
1583
1587
1588 return kTRUE;
1589}
1590
1591////////////////////////////////////////////////////////////////////////////////
1592/// Save selected project.
1593
1595{
1597 if (btn) {
1599 fClient->NeedRedraw(btn, kTRUE);
1600 }
1601
1602 TGMdiFrame *savfr = fMain->GetCurrent();
1603 if (!savfr) return kFALSE;
1604
1605 static TImage *img = 0;
1606
1607 if (!img) {
1608 img = TImage::Create();
1609 }
1610 img->FromWindow(savfr->GetParent()->GetId());
1611
1612 TGWindow *root = (TGWindow*)fClient->GetRoot();
1613 TGFileInfo fi;
1614 static TString dir(".");
1615 static Bool_t overwr = kFALSE;
1616 TString fname;
1617 root->SetEditable(kFALSE);
1618
1620 fi.SetIniDir(dir);
1621 fi.fOverwrite = overwr;
1622
1623 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
1624
1625 if (!fi.fFilename) {
1626 root->SetEditable(kTRUE);
1628 return kFALSE;
1629 }
1630
1631 dir = fi.fIniDir;
1632 overwr = fi.fOverwrite;
1633 fname = gSystem->UnixPathName(fi.fFilename);
1634
1635 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1636 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1638 savfr->GetWidth(),
1639 savfr->GetHeight());
1640 TList *list = main->GetList();
1641 TString name = savfr->GetName();
1642 savfr->SetName(main->GetName());
1643 main->SetList(savfr->GetList());
1644 main->SetLayoutBroken(savfr->IsLayoutBroken());
1645 main->SaveSource(fname.Data(), "keep_names");
1646 savfr->SetWindowName(fname.Data());
1647 main->SetList(list);
1648
1649 main->SetMWMHints(kMWMDecorAll, kMWMFuncAll,
1651 main->SetWMSize(main->GetWidth(), main->GetHeight());
1652 main->SetWMSizeHints(main->GetDefaultWidth(), main->GetDefaultHeight(),
1653 10000, 10000, 0, 0);
1654 main->SetWindowName(fname.Data());
1655 main->SetIconName(fname.Data());
1656 main->SetClassHints(fname.Data(), fname.Data());
1657 // some problems here under win32
1658 if (gVirtualX->InheritsFrom("TGX11")) main->SetIconPixmap("bld_rgb.xpm");
1659
1660 savfr->SetName(name.Data());
1661
1662 AddMacro(fname.Data(), img);
1663 delete main;
1664 } else {
1665 Int_t retval;
1666 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1667 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1669 &retval);
1670 if (retval == kMBRetry) {
1672 }
1674 }
1676 return kTRUE;
1677}
1678
1679////////////////////////////////////////////////////////////////////////////////
1680/// Add macro to "User's Macros" section
1681/// Input img must be static - do not delete it.
1682
1683void TRootGuiBuilder::AddMacro(const char *macro, TImage *img)
1684{
1685 if (!img || !img->GetWidth() || !img->GetHeight()) {
1686 return;
1687 }
1688
1689 UInt_t w = 100;
1690 Float_t ratio = Float_t(w)/img->GetWidth();
1691 Float_t rh = img->GetHeight()*ratio;
1692 UInt_t h = UInt_t(rh);
1693 img->Scale(w, h);
1694 img->Merge(img, "overlay");
1695
1696 static int i = 0;
1697 const TGPicture *pic = fClient->GetPicturePool()->GetPicture(
1698 TString::Format("%s;%d", macro, i++),
1699 img->GetPixmap(),img->GetMask());
1700 const char *name = gSystem->BaseName(macro);
1701
1702 TGButton *btn = FindActionButton(name, "User's Macros");
1703 TGuiBldAction *act = 0;
1704
1705 if (!btn) {
1706 act = new TGuiBldAction(name, macro, kGuiBldMacro);
1707 act->fAct = macro;
1708 act->fPic = macro;
1709 act->fPicture = pic;
1710
1711 AddAction(act, "User's Macros");
1712 } else {
1713 act = (TGuiBldAction*)btn->GetUserData();
1714 act->fAct = macro;
1715 act->fPic = macro;
1716 act->fPicture = pic;
1717
1719 btn->Resize(w, h);
1720 fClient->FreePicture(((TGPictureButton*)btn)->GetPicture());
1721 ((TGPictureButton*)btn)->SetPicture(pic);
1722 }
1723 }
1725}
1726
1727////////////////////////////////////////////////////////////////////////////////
1728/// Find the editable frame.
1729
1731{
1732 const TGWindow *parent = win;
1733 TGMdiFrame *ret = 0;
1734
1735 while (parent && (parent != fClient->GetDefaultRoot())) {
1736 if (parent->InheritsFrom(TGMdiFrame::Class())) {
1737 ret = (TGMdiFrame*)parent;
1738 return ret;
1739 }
1740 parent = parent->GetParent();
1741 }
1742 return 0;
1743}
1744
1745////////////////////////////////////////////////////////////////////////////////
1746/// Switch image of toolbar edit button according to the current state.
1747
1749{
1750 static const TGPicture *start = fClient->GetPicture("bld_edit.png");
1751 static const TGPicture *stop = fClient->GetPicture("bld_stop.png");
1752
1753 if (fClient->IsEditable()) {
1755 fStartButton->SetPicture(stop);
1757 fStartButton->SetToolTipText("Stop Edit (Ctrl-Dbl-Click)");
1758 } else {
1759 if (fMain->GetNumberOfFrames() < 1) {
1761 } else {
1763 fStartButton->SetPicture(start);
1765 fStartButton->SetToolTipText("Start Edit (Ctrl-Dbl-Click)");
1766 }
1767 }
1768
1770}
1771
1772////////////////////////////////////////////////////////////////////////////////
1773/// Handle menu items.
1774
1776{
1777 TGWindow *root = (TGWindow*)fClient->GetRoot();
1778 TRootHelpDialog *hd;
1779
1780 switch (id) {
1781 case kGUIBLD_FILE_START:
1782 if (fClient->IsEditable()) {
1783 break;
1784 }
1786 if (fEditable) {
1788 } //else if (!fMain->GetCurrent()) {
1789 //NewProject();
1790 //}
1791 UpdateStatusBar("Start edit");
1795 break;
1796
1797 case kGUIBLD_FILE_STOP:
1798 if (!fClient->IsEditable()) {
1799 break;
1800 }
1802
1803 if (fEditable) {
1804 root->SetEditable(kFALSE);
1805
1806 UpdateStatusBar("Stop edit");
1809 fEditable = 0;
1811 }
1812 fEditor->Reset();
1813 break;
1814
1815 case kGUIBLD_FILE_NEW:
1816 NewProject();
1818 break;
1819
1820 case kGUIBLD_FILE_CLOSE:
1822 if (fEditable && (fEditable == fMain->GetCurrent())) {
1823 root->SetEditable(kFALSE);
1824 }
1825 fEditor->Reset();
1826 UpdateStatusBar("");
1828
1829 if (fMain->GetNumberOfFrames() <= 1) {
1833 }
1834
1835 if (fClient->IsEditable()) {
1838 } else {
1841 }
1843 break;
1844
1845 case kGUIBLD_FILE_EXIT:
1846 CloseWindow();
1847 break;
1848
1849 case kGUIBLD_FILE_OPEN:
1850 OpenProject();
1852 break;
1853
1854 case kGUIBLD_FILE_SAVE:
1855 SaveProject();
1857 break;
1858
1859 case kGUIBLD_WINDOW_HOR:
1861 break;
1862
1865 break;
1866
1868 fMain->Cascade();
1869 break;
1870
1873 break;
1874
1879 } else {
1882 }
1883 break;
1885 root->SetEditable(kFALSE);
1886 hd = new TRootHelpDialog(this, "Help on Gui Builder...", 600, 400);
1887 hd->SetText(gHelpBuilder);
1888 hd->SetEditDisabled();
1889 hd->Popup();
1890 root->SetEditable(kTRUE);
1891 break;
1892
1893 case kGUIBLD_HELP_ABOUT:
1894 root->SetEditable(kFALSE);
1895 hd = new TRootHelpDialog(this, "About Gui Builder...", 520, 160);
1896 hd->SetEditDisabled();
1898 hd->Popup();
1899 root->SetEditable(kTRUE);
1900 break;
1901
1902 default:
1903 fMain->SetCurrent(id);
1904 break;
1905 }
1906}
1907
1908////////////////////////////////////////////////////////////////////////////////
1909/// Handler before closing MDI frame.
1910
1912{
1913 int retval;
1914 if (fClosing == -1)
1915 return;
1916 TGMdiFrame *mdiframe = (TGMdiFrame *)gTQSender;
1918 new TGMsgBox(gClient->GetDefaultRoot(), this,
1919 "Closing project", "Do you want to save the project before closing?",
1921
1923 if (retval == kMBYes) {
1924 SaveProject();
1925 }
1926 if (retval == kMBCancel) {
1927 fClosing = -1;
1928 if (!fClient->IsEditable())
1930 return;
1931 }
1932 fEditor->RemoveFrame(mdiframe);
1933 mdiframe->CloseWindow();
1934}
1935
1936////////////////////////////////////////////////////////////////////////////////
1937/// Handler for closed MDI frame.
1938
1940{
1941 fEditable = 0;
1942
1943 if (fClient->IsEditable()) {
1947 } else {
1950 }
1951 fEditor->Reset();
1952 UpdateStatusBar("");
1953
1954 if (fMain->GetNumberOfFrames() == 0) {
1959 return;
1960 }
1961}
1962
1963////////////////////////////////////////////////////////////////////////////////
1964/// Update information shown on the status bar.
1965
1967{
1968 if (!fStatusBar) return;
1969
1970 const char *text = 0;
1971
1972 if (!txt) {
1973 TObject *o = (TObject *)gTQSender;
1974
1975 if (o && o->InheritsFrom(TGToolTip::Class())) {
1976 TGToolTip *tip = (TGToolTip*)o;
1977 text = tip->GetText()->Data();
1978 }
1979 } else {
1980 text = txt;
1981 }
1983}
1984
1985////////////////////////////////////////////////////////////////////////////////
1986/// Clear information shown in the status bar.
1987
1989{
1990 if (!fStatusBar) return;
1991
1992 fStatusBar->SetText("");
1993}
1994
1995////////////////////////////////////////////////////////////////////////////////
1996/// Keyboard key binding.
1997
1999{
2000 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_a),
2002
2003 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_n),
2005
2006 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_o),
2008
2009 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2011
2012 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2013 0, kTRUE);
2014
2015 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2017
2018 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2019 0, kTRUE);
2020
2021 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_x),
2023
2024 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_c),
2026
2027 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_v),
2029
2030 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_r),
2032
2033 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2035
2036 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2038
2039 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_b),
2041
2042 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_l),
2044
2045 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_g),
2047
2048 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_h),
2050
2051 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2052 0, kTRUE);
2053
2054 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2055 0, kTRUE);
2056
2057 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Space),
2058 0, kTRUE);
2059
2060 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2061 0, kTRUE);
2062
2063 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2064 0, kTRUE);
2065
2066 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2067 0, kTRUE);
2068
2069 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2070 0, kTRUE);
2071
2072 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2074
2075 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2077
2078 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2080
2081 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2083
2084 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2086
2087 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2089}
2090
2091////////////////////////////////////////////////////////////////////////////////
2092/// Create new vertical splitter (TGVSplitter).
2093
2095{
2098 TGVerticalFrame *v1 = new TGVerticalFrame(ret, 40, 10, kSunkenFrame |
2099 kFixedWidth);
2101 //v1->SetEditDisabled(kEditDisableGrab);
2102
2103 TGVSplitter *splitter = new TGVSplitter(ret);
2104 splitter->SetFrame(v1, kTRUE);
2106 splitter->SetEditDisabled(kEditDisableBtnEnable);
2107
2108 TGVerticalFrame *v2 = new TGVerticalFrame(ret, 10, 10, kSunkenFrame);
2109 v2->ChangeOptions(kSunkenFrame);
2112 //v2->SetEditDisabled(kEditDisableGrab);
2114
2115 ret->MapSubwindows();
2116 ret->SetLayoutBroken(kFALSE);
2117 return ret;
2118}
2119
2120////////////////////////////////////////////////////////////////////////////////
2121/// Creates new horizontal splitter (TGHSplitter).
2122
2124{
2125 TGVerticalFrame *ret = new TGVerticalFrame();
2128 kFixedHeight);
2130 //v1->SetEditDisabled(kEditDisableGrab);
2131
2132 TGHSplitter *splitter = new TGHSplitter(ret);
2133 splitter->SetFrame(v1, kTRUE);
2135 splitter->SetEditDisabled(kEditDisable);
2136
2137 TGHorizontalFrame *v2 = new TGHorizontalFrame(ret, 10, 10);
2138 v2->ChangeOptions(kSunkenFrame);
2141 //v2->SetEditDisabled(kEditDisableGrab);
2143
2144 ret->MapSubwindows();
2145 ret->SetLayoutBroken(kFALSE);
2146 return ret;
2147}
2148
2149////////////////////////////////////////////////////////////////////////////////
2150/// Hide builder.
2151
2153{
2154 //fMain->CloseAll();
2155 UnmapWindow();
2156}
2157
2158////////////////////////////////////////////////////////////////////////////////
2159/// Return default background color.
2160
2162{
2164
2165 static ULong_t gPixel = 0;
2166
2167 if (gPixel) return gPixel;
2168
2169 Float_t r, g, b;
2170
2171 r = 232./255;
2172 g = 232./255;
2173 b = 222./255;
2174
2175 gPixel = TColor::RGB2Pixel(r, g, b);
2176 return gPixel;
2177}
2178
2179////////////////////////////////////////////////////////////////////////////////
2180/// Return background GC.
2181
2183{
2184 if (fgBgnd) return fgBgnd;
2185
2187
2188 Pixel_t back = GetBgnd();
2189 fgBgnd->SetBackground(back);
2190 fgBgnd->SetForeground(back);
2191
2192 return fgBgnd;
2193}
2194
2195////////////////////////////////////////////////////////////////////////////////
2196/// Set a background color to frame and all its subframes.
2197
2199{
2200 if (!frame) return;
2201
2202 frame->SetBackgroundColor(color);
2203 if (!frame->InheritsFrom(TGCompositeFrame::Class())) return;
2204
2205 TIter next(((TGCompositeFrame*)frame)->GetList());
2206 TGFrameElement *fe;
2207
2208 while ((fe = (TGFrameElement*)next())) {
2210 continue;
2211 }
2212 PropagateBgndColor(fe->fFrame, color);
2213 }
2214}
2215
2216////////////////////////////////////////////////////////////////////////////////
2217/// Return background color for popup menus.
2218
2220{
2222
2223 static ULong_t gPixel = 0;
2224
2225 if (gPixel) return gPixel;
2226
2227 Float_t r, g, b;
2228
2229 r = 250./255;
2230 g = 250./255;
2231 b = 250./255;
2232
2233 gPixel = TColor::RGB2Pixel(r, g, b);
2234
2235 return gPixel;
2236}
2237
2238////////////////////////////////////////////////////////////////////////////////
2239/// Return background GC for popup menus.
2240
2242{
2243 if (fgBgndPopup) return fgBgndPopup;
2244
2246
2247 Pixel_t back = GetPopupBgnd();
2250
2251 return fgBgndPopup;
2252}
2253
2254////////////////////////////////////////////////////////////////////////////////
2255/// Return highlighted color for popup menu entry.
2256
2258{
2260
2261 static ULong_t gPixel = 0;
2262
2263 if (gPixel) return gPixel;
2264
2265 Float_t r, g, b;
2266
2267 r = 120./255;
2268 g = 120./255;
2269 b = 222./255;
2270
2271 gPixel = TColor::RGB2Pixel(r, g, b);
2272
2273 return gPixel;
2274}
2275
2276////////////////////////////////////////////////////////////////////////////////
2277/// Return background GC for highlighted popup menu entry.
2278
2280{
2282
2284
2285 Pixel_t back = GetPopupHlght();
2288
2289 return fgBgndPopupHlght;
2290}
2291
2292////////////////////////////////////////////////////////////////////////////////
2293/// Return style popup menu.
2294
2296{
2297 return new TGuiBldPopupMenu();
2298}
2299
2300////////////////////////////////////////////////////////////////////////////////
2301/// Helper method used in guibuilding
2302
2304{
2305 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2306 TGListTree *lt = new TGListTree(canvas, kHorizontalFrame);
2307 lt->AddItem(0, "Entry 1");
2308 lt->AddItem(0, "Entry 2");
2309 lt->AddItem(0, "Entry 3");
2310 lt->AddItem(0, "Entry 4");
2311 lt->AddItem(0, "Entry 5");
2312 canvas->Resize(100, 60);
2313 canvas->MapSubwindows();
2314
2315 return canvas;
2316}
2317
2318////////////////////////////////////////////////////////////////////////////////
2319/// Helper method used in guibuilding to create TGCanvas widget
2320
2322{
2323 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2324 TGCompositeFrame *cont = new TGCompositeFrame(canvas->GetViewPort(),
2325 200, 200, kHorizontalFrame |
2327
2328 cont->SetCleanup(kDeepCleanup);
2329 cont->SetLayoutManager(new TGTileLayout(cont, 8));
2330 cont->AddFrame(new TGTextButton(cont, "Button1"));
2331 cont->AddFrame(new TGTextButton(cont, "Button2"));
2332 cont->AddFrame(new TGTextButton(cont, "Button3"));
2333 cont->AddFrame(new TGTextButton(cont, "Button4"));
2334
2335 canvas->SetContainer(cont);
2336 return canvas;
2337}
2338
2339////////////////////////////////////////////////////////////////////////////////
2340/// Helper method used in guibuilding to create TGShutter widget
2341
2343{
2344 TGShutterItem *item;
2345 TGCompositeFrame *container;
2346 const TGPicture *buttonpic;
2348
2350 TGShutter *shut = new TGShutter();
2351
2352 item = shut->AddPage("Histograms");
2353 container = (TGCompositeFrame *)item->GetContainer();
2354 buttonpic = gClient->GetPicture("h1_s.xpm");
2355
2356 if (buttonpic) {
2357 button = new TGPictureButton(container, buttonpic);
2358 button->SetToolTipText("TH1");
2359 container->AddFrame(button, l);
2360 }
2361 buttonpic = gClient->GetPicture("h2_s.xpm");
2362
2363 if (buttonpic) {
2364 button = new TGPictureButton(container, buttonpic);
2365 button->SetToolTipText("TH2");
2366 container->AddFrame(button, l);
2367 }
2368 buttonpic = gClient->GetPicture("h3_s.xpm");
2369
2370 if (buttonpic) {
2371 button = new TGPictureButton(container, buttonpic);
2372 button->SetToolTipText("TH3");
2373 container->AddFrame(button, l);
2374 }
2375 buttonpic = gClient->GetPicture("profile_s.xpm");
2376
2377 if (buttonpic) {
2378 button = new TGPictureButton(container, buttonpic);
2379 button->SetToolTipText("TProfile");
2380 container->AddFrame(button, l);
2381 }
2382
2383 // new page
2384 item = shut->AddPage("Functions");
2385 container = (TGCompositeFrame *)item->GetContainer();
2386 buttonpic = gClient->GetPicture("f1_s.xpm");
2387
2388 if (buttonpic) {
2389 button = new TGPictureButton(container, buttonpic);
2390 button->SetToolTipText("TF1");
2391 container->AddFrame(button, l);
2392 }
2393 buttonpic = gClient->GetPicture("f2_s.xpm");
2394
2395 if (buttonpic) {
2396 button = new TGPictureButton(container, buttonpic);
2397 button->SetToolTipText("TF2");
2398 container->AddFrame(button, l);
2399 }
2400
2401 // new page
2402 item = shut->AddPage("Trees");
2403 container = (TGCompositeFrame *)item->GetContainer();
2404 buttonpic = gClient->GetPicture("ntuple_s.xpm");
2405
2406 if (buttonpic) {
2407 button = new TGPictureButton(container, buttonpic);
2408 button->SetToolTipText("TNtuple");
2409 container->AddFrame(button, l);
2410 }
2411 buttonpic = gClient->GetPicture("tree_s.xpm");
2412
2413 if (buttonpic) {
2414 button = new TGPictureButton(container, buttonpic);
2415 button->SetToolTipText("TTree");
2416 container->AddFrame(button, l);
2417 }
2418 buttonpic = gClient->GetPicture("chain_s.xpm");
2419
2420 if (buttonpic) {
2421 button = new TGPictureButton(container, buttonpic);
2422 button->SetToolTipText("TChain");
2423 container->AddFrame(button, l);
2424 }
2425
2426 shut->MapSubwindows();
2427 return shut;
2428}
2429
2430////////////////////////////////////////////////////////////////////////////////
2431/// Helper method to create TGTextEdit widget
2432
2434{
2435 TGTextEdit *te = new TGTextEdit();
2436
2437 te->AddLine("all work and no play makes jack a pretty");
2438 te->AddLine("dull boy. all work and no play makes jack");
2439 te->AddLine("a pretty dull boy. all work and no play ");
2440 te->AddLine("makes jack a pretty dull boy. all work");
2441 te->AddLine("and no play makes jack a pretty dull boy.");
2442
2443 te->MapSubwindows();
2444 te->Layout();
2445 te->Resize(100, 60);
2446
2447 return te;
2448}
2449
2450////////////////////////////////////////////////////////////////////////////////
2451/// Helper method to create TGTab widget
2452
2454{
2455 TGTab *tab = new TGTab();
2456
2457 tab->AddTab("Tab1");
2458 tab->AddTab("Tab2");
2459 tab->MapSubwindows();
2460
2461 return tab;
2462}
2463
2464////////////////////////////////////////////////////////////////////////////////
2465/// Helper method to create TGListBox widget
2466
2468{
2469 TGListBox *lb = new TGListBox();
2470
2471 lb->AddEntry("Entry 1", 0);
2472 lb->AddEntry("Entry 2", 1);
2473 lb->AddEntry("Entry 3", 2);
2474 lb->AddEntry("Entry 4", 3);
2475 lb->AddEntry("Entry 5", 4);
2476 lb->AddEntry("Entry 6", 5);
2477 lb->AddEntry("Entry 7", 6);
2478 lb->MapSubwindows();
2479
2480 lb->Resize(100,100);
2481
2482 return lb;
2483}
2484
2485////////////////////////////////////////////////////////////////////////////////
2486/// Helper method to create TGComboBox widget
2487
2489{
2490 TGComboBox *cb = new TGComboBox();
2491
2492 cb->AddEntry("Entry 1 ", 0);
2493 cb->AddEntry("Entry 2 ", 1);
2494 cb->AddEntry("Entry 3 ", 2);
2495 cb->AddEntry("Entry 4 ", 3);
2496 cb->AddEntry("Entry 5 ", 4);
2497 cb->AddEntry("Entry 6 ", 5);
2498 cb->AddEntry("Entry 7 ", 6);
2499 cb->MapSubwindows();
2500
2502 int max_ascent, max_descent;
2503 gVirtualX->GetFontProperties(fs, max_ascent, max_descent);
2504
2505 cb->Resize(cb->GetListBox()->GetDefaultWidth(), max_ascent+max_descent+7);
2506 return cb;
2507}
2508
2509////////////////////////////////////////////////////////////////////////////////
2510/// Helper method to create TGHorizontal3DLine widget.
2511
2513{
2514 TGHorizontal3DLine *l = new TGHorizontal3DLine(0, 100, 2);
2515 l->Resize(100, 2);
2516
2517 return l;
2518}
2519
2520////////////////////////////////////////////////////////////////////////////////
2521/// Helper method to create TGVertical3DLine widget.
2522
2524{
2526 l->Resize(2, 100);
2527
2528 return l;
2529}
2530
2531////////////////////////////////////////////////////////////////////////////////
2532/// Helper method to create TGHScrollBar
2533
2535{
2536 TGHScrollBar *b = new TGHScrollBar();
2537
2538 b->Resize(100, b->GetDefaultHeight());
2539 b->SetRange(100, 20);
2540 b->MapSubwindows();
2541
2542 return b;
2543}
2544
2545////////////////////////////////////////////////////////////////////////////////
2546/// Helper method to create TGVScrollBar
2547
2549{
2550 TGVScrollBar *b = new TGVScrollBar();
2551
2552 b->Resize(b->GetDefaultWidth(), 100);
2553 b->MapSubwindows();
2554 b->SetRange(100, 20);
2555
2556 return b;
2557}
2558
2559////////////////////////////////////////////////////////////////////////////////
2560/// Helper method to create TGHProgressBar
2561
2563{
2565
2566 b->Resize(100, b->GetDefaultHeight());
2567 b->SetPosition(25);
2568 b->Format("%.2f");
2569 b->SetFillType(TGProgressBar::kBlockFill);
2570
2571 return b;
2572}
2573
2574////////////////////////////////////////////////////////////////////////////////
2575/// Helper method to create TGVProgressBar
2576
2578{
2580
2581 b->Resize(b->GetDefaultWidth(), 100);
2582 b->SetPosition(25);
2583 b->SetFillType(TGProgressBar::kBlockFill);
2584
2585 return b;
2586}
2587
2588
@ kGKeyPress
Definition: GuiTypes.h:60
@ kEnterNotify
Definition: GuiTypes.h:61
@ kLeaveNotify
Definition: GuiTypes.h:61
const Mask_t kButtonPressMask
Definition: GuiTypes.h:161
const Mask_t kKeyPressMask
Definition: GuiTypes.h:159
const Mask_t kGCFont
Definition: GuiTypes.h:300
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:195
@ kRaisedFrame
Definition: GuiTypes.h:384
@ kSunkenFrame
Definition: GuiTypes.h:383
@ kFixedWidth
Definition: GuiTypes.h:387
@ kHorizontalFrame
Definition: GuiTypes.h:382
@ kFixedHeight
Definition: GuiTypes.h:389
@ kOwnBackground
Definition: GuiTypes.h:391
const Mask_t kKeyControlMask
Definition: GuiTypes.h:197
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:168
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:167
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
@ kKey_Right
Definition: KeySymbols.h:42
@ kKey_Down
Definition: KeySymbols.h:43
@ kKey_o
Definition: KeySymbols.h:172
@ kKey_Space
Definition: KeySymbols.h:93
@ kKey_Up
Definition: KeySymbols.h:41
@ kKey_Return
Definition: KeySymbols.h:30
@ kKey_r
Definition: KeySymbols.h:175
@ kKey_v
Definition: KeySymbols.h:179
@ kKey_l
Definition: KeySymbols.h:169
@ kKey_Delete
Definition: KeySymbols.h:33
@ kKey_x
Definition: KeySymbols.h:181
@ kKey_Left
Definition: KeySymbols.h:40
@ kKey_Backspace
Definition: KeySymbols.h:29
@ kKey_z
Definition: KeySymbols.h:183
@ kKey_g
Definition: KeySymbols.h:164
@ kKey_Enter
Definition: KeySymbols.h:31
@ kKey_c
Definition: KeySymbols.h:160
@ kKey_a
Definition: KeySymbols.h:158
@ kKey_h
Definition: KeySymbols.h:165
@ kKey_b
Definition: KeySymbols.h:159
@ kKey_n
Definition: KeySymbols.h:171
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kFALSE
Definition: RtypesCore.h:101
unsigned int UInt_t
Definition: RtypesCore.h:46
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
unsigned long ULong_t
Definition: RtypesCore.h:55
#define ClassImp(name)
Definition: Rtypes.h:375
EButtonState
Definition: TGButton.h:52
@ kButtonDown
Definition: TGButton.h:54
@ kButtonDisabled
Definition: TGButton.h:56
@ kButtonUp
Definition: TGButton.h:53
@ kButtonEngaged
Definition: TGButton.h:55
#define gClient
Definition: TGClient.h:157
@ kFDOpen
Definition: TGFileDialog.h:21
@ kFDSave
Definition: TGFileDialog.h:22
@ kMWMFuncAll
Definition: TGFrame.h:49
@ kMWMDecorAll
Definition: TGFrame.h:63
@ kMWMInputFullApplicationModal
Definition: TGFrame.h:60
@ kDeepCleanup
Definition: TGFrame.h:42
@ kLHintsRight
Definition: TGLayout.h:26
@ kLHintsExpandY
Definition: TGLayout.h:31
@ kLHintsLeft
Definition: TGLayout.h:24
@ kLHintsCenterY
Definition: TGLayout.h:28
@ kLHintsNormal
Definition: TGLayout.h:32
@ kLHintsCenterX
Definition: TGLayout.h:25
@ kLHintsBottom
Definition: TGLayout.h:29
@ kLHintsTop
Definition: TGLayout.h:27
@ kLHintsExpandX
Definition: TGLayout.h:30
@ kMdiNonOpaque
@ kMdiOpaque
@ kMdiDefaultHints
@ kMenuRadioMask
Definition: TGMenu.h:28
@ kMenuHideMask
Definition: TGMenu.h:29
@ kMenuCheckedMask
Definition: TGMenu.h:27
@ kMenuActiveMask
Definition: TGMenu.h:24
@ kMenuDefaultMask
Definition: TGMenu.h:26
@ kMenuEnableMask
Definition: TGMenu.h:25
@ kMenuEntry
Definition: TGMenu.h:38
@ kMenuSeparator
Definition: TGMenu.h:36
@ kMenuPopup
Definition: TGMenu.h:39
@ kMenuLabel
Definition: TGMenu.h:37
@ kMBNo
Definition: TGMsgBox.h:32
@ kMBYes
Definition: TGMsgBox.h:31
@ kMBRetry
Definition: TGMsgBox.h:35
@ kMBCancel
Definition: TGMsgBox.h:37
@ kMBIconExclamation
Definition: TGMsgBox.h:24
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t g
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition: TGX11.cxx:110
@ kEditableAct
@ kDropAct
@ kSelectAct
@ kEndEditAct
@ kLayoutHAct
@ kCompactAct
@ kReplaceAct
@ kBreakLayoutAct
@ kCutAct
@ kRedoAct
@ kLeftAct
@ kLayoutVAct
@ kDownAct
@ kUndoAct
@ kSaveAct
@ kGrabAct
@ kPasteAct
@ kNewAct
@ kDeleteAct
@ kCopyAct
@ kGridAct
@ kUpAct
@ kRightAct
@ kOpenAct
@ kCropAct
R__EXTERN TGuiBuilder * gGuiBuilder
Definition: TGuiBuilder.h:66
@ kGuiBldCtor
Definition: TGuiBuilder.h:18
@ kGuiBldProj
Definition: TGuiBuilder.h:18
@ kGuiBldMacro
Definition: TGuiBuilder.h:19
@ kGuiBldFunc
Definition: TGuiBuilder.h:19
R__EXTERN void * gTQSender
Definition: TQObject.h:46
#define gROOT
Definition: TROOT.h:404
const char gHelpAboutBuilder[]
static const char * gSaveMacroTypes[]
static ToolBarData_t gToolBarData[]
const char gHelpBuilder[]
@ kGUIBLD_FILE_EXIT
@ kGUIBLD_HELP_ABOUT
@ kGUIBLD_FILE_OPEN
@ kGUIBLD_WINDOW_CASCADE
@ kGUIBLD_WINDOW_OPAQUE
@ kGUIBLD_WINDOW_ARRANGE
@ kGUIBLD_HELP_CONTENTS
@ kGUIBLD_FILE_STOP
@ kGUIBLD_FILE_SAVE
@ kGUIBLD_FILE_START
@ kGUIBLD_FILE_NEW
@ kGUIBLD_FILE_CLOSE
@ kGUIBLD_WINDOW_HOR
@ kGUIBLD_WINDOW_VERT
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
R__EXTERN TVirtualDragManager * gDragManager
#define gVirtualX
Definition: TVirtualX.h:338
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
Definition: TColor.cxx:2119
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition: TColor.cxx:2081
A button abstract base class.
Definition: TGButton.h:68
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:445
virtual void SetUserData(void *userData)
Definition: TGButton.h:107
virtual void * GetUserData() const
Definition: TGButton.h:108
virtual void EmitSignals(Bool_t wasUp)
Emit button signals.
Definition: TGButton.cxx:385
UInt_t fTWidth
button width
Definition: TGButton.h:73
UInt_t fTHeight
button height
Definition: TGButton.h:74
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition: TGButton.cxx:271
virtual TGToolTip * GetToolTip() const
Definition: TGButton.h:110
EButtonState fState
button state
Definition: TGButton.h:75
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:459
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:235
TGToolTip * fTip
tool tip associated with button
Definition: TGButton.h:79
virtual Bool_t IsDown() const
Definition: TGButton.cxx:301
GContext_t fNormGC
graphics context used for drawing button
Definition: TGButton.h:77
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
virtual void SetContainer(TGFrame *f)
Definition: TGCanvas.h:222
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:217
void MapSubwindows() override
Map all canvas sub windows.
Definition: TGCanvas.cxx:2165
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:234
Bool_t IsEditable() const
Definition: TGClient.h:89
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:224
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition: TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
TGPicturePool * GetPicturePool() const
Definition: TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition: TGClient.cxx:308
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:86
virtual TGListBox * GetListBox() const
Definition: TGComboBox.h:110
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:1000
virtual TList * GetList() const
Definition: TGFrame.h:310
UInt_t GetDefaultWidth() const override
Definition: TGFrame.h:312
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1164
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1257
TList * fList
container of frame elements
Definition: TGFrame.h:292
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1072
Bool_t IsLayoutBroken() const override
Definition: TGFrame.h:357
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition: TGFrame.cxx:948
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition: TGFrame.cxx:1022
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1043
static TClass * Class()
void SetLayoutBroken(Bool_t on=kTRUE) override
Set broken layout. No Layout method is called.
Definition: TGFrame.cxx:1012
A frame with handles that allow it to be undocked (i.e.
void AddFrame(TGFrame *f, TGLayoutHints *hints) override
Add frame to dockable frame container. Frame and hints are NOT adopted.
void SetWindowName(const char *name) override
Set window name so it appear as title of the undock window.
This class creates a file selection dialog.
Definition: TGFileDialog.h:65
char * fFilename
selected file name
Definition: TGFileDialog.h:46
const char ** fFileTypes
file types used to filter selectable files
Definition: TGFileDialog.h:48
char * fIniDir
on input: initial directory, on output: new directory
Definition: TGFileDialog.h:47
Bool_t fOverwrite
if true overwrite the file with existing name on save
Definition: TGFileDialog.h:50
void SetIniDir(const char *inidir)
Set directory name.
TGFrame * fFrame
Definition: TGLayout.h:112
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:321
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition: TGFrame.cxx:696
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:339
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition: TGFrame.cxx:629
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:735
UInt_t fOptions
frame options
Definition: TGFrame.h:94
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition: TGFrame.cxx:605
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
UInt_t fHeight
frame height
Definition: TGFrame.h:88
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:312
void DoRedraw() override
Redraw the frame.
Definition: TGFrame.cxx:430
void MapWindow() override
map window
Definition: TGFrame.h:204
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition: TGFrame.cxx:303
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:755
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
virtual UInt_t GetOptions() const
Definition: TGFrame.h:197
void UnmapWindow() override
unmap window
Definition: TGFrame.h:206
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:765
UInt_t fWidth
frame width
Definition: TGFrame.h:87
UInt_t GetHeight() const
Definition: TGFrame.h:225
virtual Pixel_t GetBackground() const
Definition: TGFrame.h:192
UInt_t GetWidth() const
Definition: TGFrame.h:224
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:775
void MapRaised() override
map raised
Definition: TGFrame.h:205
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:278
void SetBackground(Pixel_t v)
Set background color.
Definition: TGGC.cxx:289
The TGHScrollBar will generate the following event messages: kC_HSCROLL, kSB_SLIDERPOS,...
Definition: TGScrollBar.h:142
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition: TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:385
static TClass * Class()
TGHotString is a string with a "hot" character underlined.
Definition: TGString.h:42
void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y) override
Draw a hot string and underline the hot character.
Definition: TGString.cxx:175
This class handles GUI labels.
Definition: TGLabel.h:24
const TGString * GetText() const
Definition: TGLabel.h:74
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
Frame layout manager.
Definition: TGLayout.h:135
A listbox is a box, possibly with scrollbar, containing entries.
Definition: TGListBox.h:221
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
Definition: TGListBox.cxx:1412
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
Definition: TGListBox.cxx:1204
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition: TGListTree.h:195
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:397
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition: TGFrame.cxx:1858
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition: TGFrame.cxx:1801
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition: TGFrame.cxx:1881
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1788
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition: TGFrame.cxx:1606
const TGPicture * SetIconPixmap(const char *iconName)
Set window icon pixmap by name.
Definition: TGFrame.cxx:1816
This file contains the TGMdiFrame class.
Definition: TGMdiFrame.h:42
static TClass * Class()
virtual void SetMdiHints(ULong_t mdihints)
Set MDI hints, also used to identify titlebar buttons.
Definition: TGMdiFrame.cxx:94
void SetWindowName(const char *name) override
Set MDI window name (set titlebar title).
Definition: TGMdiFrame.cxx:103
virtual Bool_t CloseWindow()
Close MDI frame window.
Definition: TGMdiFrame.cxx:75
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
Definition: TGMdiFrame.cxx:86
This file contains the TGMdiMainFrame class.
Bool_t SetCurrent(TGMdiFrameList *newcurrent)
Set current (active) MDI child window (by frame list).
void SetResizeMode(Int_t mode=kMdiDefaultResizeMode)
Set MDI windows resize mode (opaque or transparent).
Long_t GetNumberOfFrames() const
virtual void CloseAll()
Close all MDI child windows.
TGMdiFrame * GetCurrent() const
Return pointer on current (active) MDI child window.
virtual void ArrangeMinimized()
This is an attempt to an "smart" minimized window re-arrangement.
virtual void TileHorizontal()
virtual void TileVertical()
virtual void Cascade()
virtual Int_t Close(TGMdiFrame *frame)
Close MDI child window mdiframe.
TGFrame * GetContainer() const
TGMenuBar * GetMenuBar() const
Definition: TGMdiMenu.h:66
The TGMenu.h header contains all different menu classes.
Definition: TGMenu.h:282
This class contains all information about a menu entry.
Definition: TGMenu.h:57
const char * GetShortcutText() const
Definition: TGMenu.h:85
const TGPicture * GetPic() const
Definition: TGMenu.h:95
TGString * GetShortcut() const
Definition: TGMenu.h:90
TGHotString * GetLabel() const
Definition: TGMenu.h:89
Int_t GetEx() const
Definition: TGMenu.h:91
Int_t GetEy() const
Definition: TGMenu.h:92
virtual Int_t GetStatus() const
Definition: TGMenu.h:86
EMenuEntryType GetType() const
Definition: TGMenu.h:87
This class creates a menu title.
Definition: TGMenu.h:234
TGHotString * fLabel
menu title
Definition: TGMenu.h:238
GContext_t fNormGC
Definition: TGMenu.h:245
GContext_t fSelGC
normal and selection graphics contexts
Definition: TGMenu.h:245
Bool_t fState
menu title state (active/not active)
Definition: TGMenu.h:241
FontStruct_t fFontStruct
font
Definition: TGMenu.h:243
TGClient * fClient
Connection to display server.
Definition: TGObject.h:25
Handle_t GetId() const
Definition: TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:24
Yield an action as soon as it is clicked.
Definition: TGButton.h:228
virtual void SetPicture(const TGPicture *new_pic)
Change a picture in a picture button.
Definition: TGButton.cxx:1040
virtual void CreateDisabledPicture()
Creates disabled picture.
Definition: TGButton.cxx:1108
const TGPicture * fPicD
picture shown when button disabled
Definition: TGButton.h:232
const TGPicture * fPic
picture to be put in button
Definition: TGButton.h:231
static TClass * Class()
const TGPicture * GetPicture(const char *name)
Get a picture from the picture pool.
Definition: TGPicture.cxx:82
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
void Draw(Option_t *="") override
Default Draw method for all objects.
Definition: TGPicture.h:46
UInt_t GetHeight() const
Definition: TGPicture.h:53
Pixmap_t GetPicture() const
Definition: TGPicture.h:54
This class creates a popup menu object.
Definition: TGMenu.h:110
virtual Bool_t IsEntryChecked(Int_t id)
Return true if menu item is checked.
Definition: TGMenu.cxx:1845
GContext_t fNormGC
normal drawing graphics context
Definition: TGMenu.h:126
GContext_t fSelGC
graphics context for drawing selections
Definition: TGMenu.h:127
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition: TGMenu.cxx:1782
UInt_t fEntrySep
separation distance between entries
Definition: TGMenu.h:135
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition: TGMenu.cxx:1724
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition: TGMenu.cxx:1705
UInt_t fXl
Max width of all menu entries.
Definition: TGMenu.h:122
FontStruct_t fFontStruct
font to draw menu entries
Definition: TGMenu.h:129
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition: TGMenu.cxx:1807
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1060
FontStruct_t fHifontStruct
font to draw highlighted entries
Definition: TGMenu.h:130
void DrawRCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw radio check mark. Used for radio button type menu entries.
Definition: TGMenu.cxx:1670
void DrawCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw check mark. Used for checked button type menu entries.
Definition: TGMenu.cxx:1651
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition: TGMenu.cxx:990
UInt_t fMenuWidth
width of popup menu
Definition: TGMenu.h:123
void DrawTrianglePattern(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw triangle pattern.
Definition: TGMenu.cxx:1631
TGFrame * GetContainer() const
Definition: TGShutter.h:45
A shutter widget contains a set of shutter items that can be open and closed like a shutter.
Definition: TGShutter.h:55
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition: TGShutter.cxx:73
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
Definition: TGShutter.cxx:302
virtual TGShutterItem * AddPage(const char *item="Page")
Add new page (shutter item)
Definition: TGShutter.cxx:145
Provides a StatusBar widget.
Definition: TGStatusBar.h:21
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition: TGString.cxx:56
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition: TGTab.h:46
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition: TGTab.cxx:376
Yield an action as soon as it is clicked.
Definition: TGButton.h:142
A TGTextEdit is a specialization of TGTextView.
Definition: TGTextEdit.h:22
static FontStruct_t GetDefaultFontStruct()
Return default font structure in use for a text listbox entry.
Definition: TGListBox.cxx:215
void Layout() override
Layout the components of view.
virtual void AddLine(const char *string)
Add a line of text to the view widget.
Definition: TGTextView.cxx:229
This is a layout manager for the TGListView widget.
Definition: TGLayout.h:303
A toolbar is a composite frame that contains TGPictureButtons.
Definition: TGToolBar.h:33
virtual TGButton * AddButton(const TGWindow *w, ToolBarData_t *button, Int_t spacing=0)
Add button to toolbar.
Definition: TGToolBar.cxx:92
virtual void SetId(TGButton *button, Longptr_t id)
changes id for button.
Definition: TGToolBar.cxx:172
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
Definition: TGToolBar.cxx:157
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition: TGToolTip.h:24
void SetDelay(Long_t delayms)
Set delay in milliseconds.
Definition: TGToolTip.cxx:399
void Hide()
Hide tool tip window.
Definition: TGToolTip.cxx:250
static TClass * Class()
const TGString * GetText() const
Get the tool tip text.
Definition: TGToolTip.cxx:430
void Reset()
Reset tool tip popup delay timer.
Definition: TGToolTip.cxx:263
The TGVScrollBar will generate the following event messages: kC_VSCROLL, kSB_SLIDERPOS,...
Definition: TGScrollBar.h:165
A vertical 3D line is a line that can be used to separate groups of widgets.
Definition: TG3DLine.h:33
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:374
ROOT GUI Window base class.
Definition: TGWindow.h:23
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Definition: TGWindow.cxx:248
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition: TGWindow.h:106
virtual void SetName(const char *name)
Definition: TGWindow.h:114
virtual void SetEditable(Bool_t on=kTRUE)
Definition: TGWindow.h:107
@ kEditDisableLayout
window layout cannot be edited
Definition: TGWindow.h:53
@ kEditDisableBtnEnable
window can handle mouse button events
Definition: TGWindow.h:57
@ kEditDisable
disable edit of this window
Definition: TGWindow.h:50
const TGWindow * GetParent() const
Definition: TGWindow.h:76
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
UInt_t fEditDisabled
flags used for "guibuilding"
Definition: TGWindow.h:32
TGLayoutHints * fHints
Definition: TGuiBuilder.h:32
const TGPicture * fPicture
Definition: TGuiBuilder.h:31
const char * fPic
Definition: TGuiBuilder.h:30
TString fAct
Definition: TGuiBuilder.h:29
Drag and drop manager used by the ROOT GUI Builder.
Bool_t IsLassoDrawn() const
void SetBuilder(TRootGuiBuilder *b)
Bool_t HandleKey(Event_t *)
Handle key event.
Bool_t CanCompact(TGWindow *w) const
kTRUE is frame could be compacted/"laid out"
void SetPropertyEditor(TGuiBldEditor *e)
Helper method.
void SetEditable(Bool_t on=kTRUE)
Grab server.
Bool_t CanChangeLayout(TGWindow *w) const
kTRUE - if it's possible to switch disable/enable layout
Bool_t IsPasteFrameExist()
Return kTRUE if paste frame exist.
void UngrabFrame()
Ungrab/Unselect selected/grabbed frame.
TGFrame * GetSelected() const
Return the current grabbed/selected frame.
The property editor.
Definition: TGuiBldEditor.h:32
void RemoveFrame(TGFrame *)
Remove a frame.
void Reset()
Reset the editor.
void SetEmbedded(Bool_t e=kTRUE)
Definition: TGuiBldEditor.h:64
void SwitchLayout()
Popup dialog to set layout of edited frame off.
void DoRedraw()
Redraw builder menu title.
virtual ~TGuiBldMenuTitle()
TGuiBldMenuTitle(const TGWindow *p, TGHotString *s, TGPopupMenu *menu)
Bool_t HandleCrossing(Event_t *event)
Handle crossing events.
virtual ~TGuiBldPopupMenu()
void DrawEntry(TGMenuEntry *entry)
Draw popup menu entry.
TGuiBldSaveFrame(const TGWindow *p, UInt_t w, UInt_t h)
void SetList(TList *li)
Bool_t HandleCrossing(Event_t *event)
Handle crossing events.
virtual ~TGuiBldToolButton()
void SetState(EButtonState state, Bool_t emit=kTRUE)
Set state of tool bar button and emit a signal according to passed arguments.
void DoRedraw()
Redraw tool button.
TGuiBldToolButton(const TGWindow *p, const TGPicture *pic, Int_t id=-1)
void SetBackgroundColor(Pixel_t bgnd)
Set background color (override from TGWindow base class).
Bool_t IsDown() const
TGuiBldAction * fAction
Definition: TGuiBuilder.h:46
An abstract interface to image processing library.
Definition: TImage.h:29
virtual UInt_t GetWidth() const
Definition: TImage.h:228
static TImage * Create()
Create an image.
Definition: TImage.cxx:35
virtual void FromWindow(Drawable_t, Int_t=0, Int_t=0, UInt_t=0, UInt_t=0)
Definition: TImage.h:244
virtual void Scale(UInt_t, UInt_t)
Definition: TImage.h:141
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
Definition: TImage.h:172
virtual Pixmap_t GetPixmap()
Definition: TImage.h:235
virtual Pixmap_t GetMask()
Definition: TImage.h:236
virtual UInt_t GetHeight() const
Definition: TImage.h:229
A doubly linked list.
Definition: TList.h:38
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:693
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:659
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition: TNamed.h:48
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:869
TGPopupMenu * fMenuHelp
static TGGC * GetBgndGC()
Return background GC.
virtual void AddMacro(const char *macro, TImage *img)
Add macro to "User's Macros" section Input img must be static - do not delete it.
virtual Bool_t IsGrabButtonDown() const
Return the status of the grab mode.
virtual void AddAction(TGuiBldAction *act, const char *sect)
Add new action to widget palette.
TRootGuiBuilder(const TGWindow *p=0)
Create GUI builder application.
virtual Bool_t IsSelectMode() const
Return the status of the selected mode.
static TGGC * fgBgndPopup
static TGFrame * BuildTextEdit()
Helper method to create TGTextEdit widget.
void BindKeys()
Keyboard key binding.
TGMdiMainFrame * fMain
virtual void HandleButtons()
Handle buttons in the GUI builder's widget palette.
virtual void AddSection(const char *sect)
Add new shutter item.
TGButton * FindActionButton(const char *name, const char *section)
Find action by name.
static TGGC * fgBgndPopupHlght
TGMdiFrame * FindEditableMdiFrame(const TGWindow *win)
Find the editable frame.
TGStatusBar * fStatusBar
TGMdiMenuBar * fMenuBar
static ULong_t GetBgnd()
Return default background color.
static TGGC * GetPopupBgndGC()
Return background GC for popup menus.
void EnableSelectedButtons(Bool_t on=kTRUE)
Enable/disable toolbar buttons according to the selected frame.
static TGFrame * BuildHProgressBar()
Helper method to create TGHProgressBar.
virtual void SwitchToolbarButton()
Switch image of toolbar edit button according to the current state.
static TGFrame * BuildTab()
Helper method to create TGTab widget.
virtual void UpdateStatusBar(const char *text=0)
Update information shown on the status bar.
friend class TGuiBldDragManager
virtual void Hide()
Hide builder.
static TGFrame * VSplitter()
Create new vertical splitter (TGVSplitter).
TGDockableFrame * fToolDock
static TGGC * GetPopupHlghtGC()
Return background GC for highlighted popup menu entry.
void EnableEditButtons(Bool_t on=kTRUE)
Enable/disable toolbar buttons according to the selected frame.
static ULong_t GetPopupHlght()
Return highlighted color for popup menu entry.
static TGPopupMenu * CreatePopup()
Return style popup menu.
virtual void ChangeSelected(TGFrame *f)
Set selected frame.
static TGFrame * BuildVProgressBar()
Helper method to create TGVProgressBar.
static TGFrame * BuildShutter()
Helper method used in guibuilding to create TGShutter widget.
static TGFrame * BuildVScrollBar()
Helper method to create TGVScrollBar.
static TGFrame * BuildH3DLine()
Helper method to create TGHorizontal3DLine widget.
static ULong_t GetPopupBgnd()
Return background color for popup menus.
virtual void CloseWindow()
Close GUI builder via window manager "Close" button.
TGFrame * fSelected
virtual Bool_t HandleKey(Event_t *event)
Handle keys.
TGuiBldEditor * fEditor
void EnableLassoButtons(Bool_t on=kTRUE)
Enable toolbar buttons for alignment.
TGuiBldDragManager * fManager
virtual void EraseStatusBar()
Clear information shown in the status bar.
static TGFrame * BuildHScrollBar()
Helper method to create TGHScrollBar.
static TGGC * fgBgnd
TGPictureButton * fStartButton
void InitMenu()
Inititiate GUI Builder menus.
static TGFrame * BuildListTree()
Helper method used in guibuilding.
static TGFrame * BuildV3DLine()
Helper method to create TGVertical3DLine widget.
virtual void HandleMenu(Int_t id)
Handle menu items.
static TGFrame * BuildCanvas()
Helper method used in guibuilding to create TGCanvas widget.
const TGPicture * fIconPic
TGPopupMenu * fMenuFile
static TGFrame * BuildListBox()
Helper method to create TGListBox widget.
static void PropagateBgndColor(TGFrame *frame, Pixel_t color)
Set a background color to frame and all its subframes.
static TGFrame * BuildComboBox()
Helper method to create TGComboBox widget.
TGToolBar * fToolBar
virtual Bool_t OpenProject(Event_t *event=0)
Open new gui builder project.
virtual void Update()
Update gui builder.
virtual Bool_t SaveProject(Event_t *event=0)
Save selected project.
TGMdiFrame * fEditable
virtual TGFrame * ExecuteAction()
Execute an action.
virtual Bool_t NewProject(TString type="")
Create a new project.
virtual void HandleWindowClosed(Int_t id)
Handler for closed MDI frame.
virtual ~TRootGuiBuilder()
Destructor.
TGShutter * fShutter
TGButton * fActionButton
virtual void MaybeCloseWindow()
Handler before closing MDI frame.
static TGFrame * HSplitter()
Creates new horizontal splitter (TGHSplitter).
TGPopupMenu * fMenuWindow
A TRootHelpDialog is used to display help text (or any text in a dialog window).
void SetText(const char *helpText)
Set help text from helpText buffer in TGTextView.
void Popup()
Show help dialog.
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition: TString.cxx:2202
const char * Data() const
Definition: TString.h:369
@ kIgnoreCase
Definition: TString.h:268
Bool_t IsNull() const
Definition: TString.h:407
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2336
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition: TSystem.cxx:1063
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:935
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
static constexpr double bar
static constexpr double s
Event structure.
Definition: GuiTypes.h:174
Graphics context structure.
Definition: GuiTypes.h:224
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:251
FontH_t fFont
default text font for text operations
Definition: GuiTypes.h:242
const char * fPixmap
Definition: TGToolBar.h:24
auto * l
Definition: textangle.C:4
double splitter
Definition: triangle.c:617