Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 "TASUtils.h"
39#include "TGTextEdit.h"
40#include "TGTab.h"
41#include "TGListBox.h"
42#include "TGComboBox.h"
43#include "TGProgressBar.h"
44#include "TVirtualX.h"
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/visualisation/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
112const char gHelpBuilder[] = "\
113 Start/Stop Edit Mode\n\
114 ************************************************\n\
115 o Select File menu / Edit\n\
116 o Select Start Edit button on the toolbar\n\
117 o Ctrl-Double-Click on the project frame\n\
118 o Double-Click to activate quick edit action (defined in root.mimes)\n\
119\n\
120 Select, Grab, Drop\n\
121 ************************************************\n\
122 It is possible to select & drag any frame and drop it to another frame\n\
123\n\
124 o Press left mouse button Click or Ctrl-Click to select an object.\n\
125 o Press right mouse button to activate context menu\n\
126 o Multiple selection can be done in two ways (grabbing):\n\
127 - draw lasso and press Return key\n\
128 - press Shift key and draw lasso\n\
129 o Dropping:\n\
130 - select frame and press Ctrl-Return key\n\
131 o Changing layout order of widgets:\n\
132 - set broken layout mode via toolbar button or check button\n\
133 \'Layout subframes\' in tab \'Layout\'\n\
134 - select a widget and use arrow keys to change the layout order\n\
135 o Alignment:\n\
136 - remove the selection (if any) by using the space bar\n\
137 - draw lasso and use the four toolbar buttons for widget alignment\n\
138 - arrow keys align the frames too, if you prefer the keyboard\n\
139\n\
140 Key shortcuts\n\
141 ************************************************\n\
142 o Return - grab selected frames\n\
143 o Ctrl-Return - drop frames\n\
144 o Del - delete selected frame\n\
145 o Shift-Del - crop\n\
146 o Ctrl-X - cut\n\
147 o Ctrl-C - copy\n\
148 o Ctrl-V - paste frame into the last clicked position\n\
149 o Ctrl-L - compact frame\n\
150 o Ctrl-B - enable/disable layout\n\
151 o Ctrl-H - switch Horizontal-Vertical layout\n\
152 o Ctrl-G - switch ON/OFF grid\n\
153 o Ctrl-S - save\n\
154 o Ctrl-O - open and execute ROOT macro file\n\
155 o Ctrl-N - create new main frame\n\
156 o Ctrl-Z - undo last action (not implemented)\n\
157 o Shift-Ctrl-Z - redo (not implemented)\n\
158\n\
159 More information\n\
160 ************************************************\n\
161\n\
162For more information, please see:\n\
163\n\
164 https://root.cern.ch/doc/master/group__guibuilder.html\n\
165\n\
166";
167
168const char gHelpAboutBuilder[] = "\
169 ROOT Gui Builder\n\
170\n\
171************************************************************\n\
172* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *\n\
173* All rights reserved. *\n\
174* *\n\
175* For the licensing terms see $ROOTSYS/LICENSE. *\n\
176* For the list of contributors see $ROOTSYS/README/CREDITS.*\n\
177************************************************************\n\
178";
179
180//----- Toolbar stuff...
181
183 { "bld_edit.png", "Start Edit (Ctrl-Dbl-Click)", kFALSE, kEditableAct, 0 },
184 { "", "", kFALSE, -1, 0 },
185 { "bld_new.png", "New (Ctrl-N)", kFALSE, kNewAct, 0 },
186 { "bld_open.png", "Open (Ctrl-O)", kFALSE, kOpenAct, 0 },
187 { "bld_save.png", "Save As (Ctrl-S)", kFALSE, kSaveAct, 0 },
188 { "", "", kFALSE, -1, 0 },
189// { "bld_pointer.xpm", "Selector (Ctrl-Click)", kTRUE, kSelectAct, 0 },
190// { "bld_grab.xpm", "Grab Selected Frames (Return)", kTRUE, kGrabAct, 0 },
191 { "", "", kFALSE, -1, 0 },
192 { "bld_compact.png", "Compact selected frame (Ctrl-L)", kFALSE, kCompactAct, 0 },
193 { "bld_break.png", "Disable/Enable layout (Ctrl-B)", kFALSE, kBreakLayoutAct, 0 },
194 { "bld_hbox.png", "Layout selected frame horizontally (Ctrl-H)", kFALSE, kLayoutHAct, 0 },
195 { "bld_vbox.png", "Layout selected frame vertically (Ctrl-H)", kFALSE, kLayoutVAct, 0 },
196 { "bld_grid.png", "On/Off grid (Ctrl+G)", kFALSE, kGridAct, 0 },
197 { "", "", kFALSE, -1, 0 },
198 { "bld_AlignTop.png", "Align selected frames to the top line of lasso (Up Arrow)", kFALSE, kUpAct, 0 },
199 { "bld_AlignBtm.png", "Align selected frames to the down line of lasso (Down Arrow)", kFALSE, kDownAct, 0 },
200 { "bld_AlignLeft.png", "Align selected frames to the left line of lasso (Left Arrow)", kFALSE, kLeftAct, 0 },
201 { "bld_AlignRight.png", "Align selected frames to the right line of lasso (Right Arrow)", kFALSE, kRightAct, 0 },
202 { "", "", kFALSE, -1, 0 },
203 { "bld_cut.png", "Cut (Ctrl-X)", kFALSE, kCutAct, 0 },
204 { "bld_copy.png", "Copy (Ctrl-C)", kFALSE, kCopyAct, 0 },
205 { "bld_paste.png", "Paste frame into the last clicked position (Ctrl-V)", kFALSE, kPasteAct, 0 },
206// { "bld_paste_into.png", "Paste with replacing of selected frame (Ctrl-R)", kFALSE, kReplaceAct, 0 },
207 { "bld_delete.png", "Delete (Del/Backspace)", kFALSE, kDeleteAct, 0 },
208 { "bld_crop.png", "Crop (Shift-Del)", kFALSE, kCropAct, 0 },
209// { "", "", kFALSE, -1, 0 },
210// { "bld_undo.png", "Undo (Ctrl-Z)", kFALSE, kUndoAct, 0 },
211// { "bld_redo.png", "Redo (Shift-Ctrl-Z)", kFALSE, kRedoAct, 0 },
212 { 0, 0, kFALSE, 0, 0 }
213};
214
215
216
217
221
222
223////////////////////////////////////////////////////////////////////////////////
224//
225// Here are few experimental GUI classes which give a nice&fancy appearence
226// to GuiBuilder.
227//
228////////////////////////////////////////////////////////////////////////////////
229
230////////////////////////////////////////////////////////////////////////////////
232
233private:
235
236protected:
237 void DoRedraw() override;
238
239public:
240 ~TGuiBldMenuTitle() override {}
248
250};
251
252////////////////////////////////////////////////////////////////////////////////
253/// Handle crossing events.
254
265
266////////////////////////////////////////////////////////////////////////////////
267/// Redraw builder menu title.
268
270{
272
273 int x, y, max_ascent, max_descent;
274 x = y = 4;
275
276 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
277
278 if (fState) {
280 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
281 gVirtualX->SetForeground(fNormGC, GetForeground());
282 fLabel->Draw(fId, fSelGC, x, y + max_ascent);
283 } else {
284 gVirtualX->SetForeground(fNormGC, fBgndColor);
285 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
286 gVirtualX->SetForeground(fNormGC, GetForeground());
287 fLabel->Draw(fId, fNormGC, x, y + max_ascent);
288 }
290 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
291 0, 0, GetWidth()-1, GetHeight()-1);
292 }
293}
294
295
296////////////////////////////////////////////////////////////////////////////////
298
299public:
300 ~TGuiBldPopupMenu() override { }
307 void DrawEntry(TGMenuEntry *entry) override;
308};
309
310////////////////////////////////////////////////////////////////////////////////
311/// Draw popup menu entry.
312
314{
315 FontStruct_t font;
316 GCValues_t gcval;
317
318 if (entry->GetStatus() & kMenuHideMask)
319 return;
320
321 if (entry->GetStatus() & kMenuDefaultMask) {
322 font = fHifontStruct;
323 gcval.fMask = kGCFont;
324 gcval.fFont = gVirtualX->GetFontHandle(font);
325 gVirtualX->ChangeGC(fNormGC, &gcval);
326 gVirtualX->ChangeGC(fSelGC, &gcval);
327 } else {
328 font = fFontStruct;
329 }
330
331 UInt_t tw = 0;
332 UInt_t sep = fEntrySep;
333 Int_t max_ascent, max_descent;
334 gVirtualX->GetFontProperties(font, max_ascent, max_descent);
335 if (entry->GetShortcut())
336 tw = 7 + gVirtualX->TextWidth(fFontStruct, entry->GetShortcutText(),
337 entry->GetShortcut()->Length());
338
339 Int_t tx = entry->GetEx() + fXl;
340 Int_t ty = entry->GetEy() + max_ascent + 2;
341 UInt_t h = max_ascent + max_descent + sep;
342 Int_t picposy = 0;
343 if (entry->GetPic() != 0) {
344 picposy = entry->GetEy() + h / 2;
345 picposy -= entry->GetPic()->GetHeight() / 2;
346 }
347
348 switch (entry->GetType()) {
349 case kMenuPopup:
350 case kMenuLabel:
351 case kMenuEntry:
352 if ((entry->GetStatus() & kMenuActiveMask) &&
353 entry->GetType() != kMenuLabel) {
354 if (entry->GetStatus() & kMenuEnableMask) {
355 gVirtualX->FillRectangle(fId,
357 entry->GetEx()+1, entry->GetEy(),
358 fMenuWidth-6, h - 1);
359 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
360 entry->GetEx()+ 1, entry->GetEy()-1,
361 fMenuWidth - entry->GetEx()- 6, h - 1);
362 }
363
364 if (entry->GetType() == kMenuPopup) {
365 DrawTrianglePattern(fSelGC, fMenuWidth-10, entry->GetEy() + 3,
366 fMenuWidth-6, entry->GetEy() + 11);
367 }
368
369 if (entry->GetStatus() & kMenuCheckedMask) {
370 DrawCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
371 entry->GetEy()+11);
372 }
373
374 if (entry->GetStatus() & kMenuRadioMask) {
375 DrawRCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
376 entry->GetEy()+11);
377 }
378
379 if (entry->GetPic() != 0) {
380 entry->GetPic()->Draw(fId, fSelGC, 8, picposy);
381 }
382
383 entry->GetLabel()->Draw(fId,
384 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
385 GetShadowGC()(), tx, ty);
386 if (entry->GetShortcut())
387 entry->GetShortcut()->Draw(fId,
388 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
389 GetShadowGC()(), fMenuWidth - tw, ty);
390 } else {
391 if ( entry->GetType() != kMenuLabel) {
392 gVirtualX->FillRectangle(fId,
394 entry->GetEx()+1, entry->GetEy()-1, tx-4, h);
395
396 gVirtualX->FillRectangle(fId,
398 tx-1, entry->GetEy()-1, fMenuWidth-tx-1, h);
399 } else { // we need some special background for labels
400 gVirtualX->FillRectangle(fId, TGFrame::GetBckgndGC()(),
401 entry->GetEx()+1, entry->GetEy()-1,
402 fMenuWidth - entry->GetEx()- 3, h);
403 }
404
405 if (entry->GetType() == kMenuPopup) {
407 fMenuWidth-6, entry->GetEy() + 11);
408 }
409
410 if (entry->GetStatus() & kMenuCheckedMask) {
411 DrawCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
412 entry->GetEy()+11);
413 }
414
415 if (entry->GetStatus() & kMenuRadioMask) {
416 DrawRCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
417 entry->GetEy()+11);
418 }
419
420 if (entry->GetPic() != 0) {
421 entry->GetPic()->Draw(fId, fNormGC, 8, picposy);
422 }
423
424 if (entry->GetStatus() & kMenuEnableMask) {
425 entry->GetLabel()->Draw(fId, fNormGC, tx, ty);
426 if (entry->GetShortcut())
427 entry->GetShortcut()->Draw(fId, fNormGC, fMenuWidth - tw, ty);
428 } else {
429 entry->GetLabel()->Draw(fId, GetHilightGC()(), tx+1, ty+1);
430 entry->GetLabel()->Draw(fId, GetShadowGC()(), tx, ty);
431 if (entry->GetShortcut()) {
432 entry->GetShortcut()->Draw(fId, GetHilightGC()(),
433 fMenuWidth - tw+1, ty+1);
434 entry->GetShortcut()->Draw(fId, GetShadowGC()(),
435 fMenuWidth - tw, ty);
436 }
437 }
438 }
439 break;
440
441 case kMenuSeparator:
442 gVirtualX->FillRectangle(fId, TRootGuiBuilder::GetBgndGC()->GetGC(),
443 entry->GetEx()+1, entry->GetEy()-1,
444 tx-4, 4);
445 gVirtualX->DrawLine(fId, TGFrame::GetBlackGC()(), tx+1,
446 entry->GetEy()+1, fMenuWidth-sep,
447 entry->GetEy()+1);
448 break;
449 }
450
451 // restore font
452 if (entry->GetStatus() & kMenuDefaultMask) {
453 gcval.fFont = gVirtualX->GetFontHandle(fFontStruct);
454 gVirtualX->ChangeGC(fNormGC, &gcval);
455 gVirtualX->ChangeGC(fSelGC, &gcval);
456 }
457}
458
459////////////////////////////////////////////////////////////////////////////////
461
462private:
464
465protected:
466 void DoRedraw() override;
467
468public:
469 ~TGuiBldToolButton() override { }
470 TGuiBldToolButton(const TGWindow *p, const TGPicture *pic, Int_t id = -1) :
471 TGPictureButton(p, pic, id) {
474 }
475
476 Bool_t IsDown() const override { return (fOptions & kSunkenFrame); }
477 void SetState(EButtonState state, Bool_t emit = kTRUE) override;
480};
481
482////////////////////////////////////////////////////////////////////////////////
483/// Redraw tool button.
484
486{
487 int x = (fWidth - fTWidth) >> 1;
488 int y = (fHeight - fTHeight) >> 1;
489 UInt_t w = GetWidth() - 1;
490 UInt_t h = GetHeight()- 1;
491
493
496 ++x; ++y;
497 w--; h--;
498 }
499
500 const TGPicture *pic = fPic;
501 if (fState == kButtonDisabled) {
503 pic = fPicD ? fPicD : fPic;
504 }
506 x--; y--;
507 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(), 0, 0, w, h);
508 }
509 pic->Draw(fId, fNormGC, x, y);
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Handle crossing events.
514
516{
517 if (fTip) {
518 if (event->fType == kEnterNotify) {
519 fTip->Reset();
520 } else {
521 fTip->Hide();
522 }
523 }
524
525 if ((event->fType == kEnterNotify) && (fState != kButtonDisabled)) {
527 } else {
529 }
530 if (event->fType == kLeaveNotify) {
534 }
535 DoRedraw();
536
537 return kTRUE;
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Set state of tool bar button and emit a signal according
542/// to passed arguments.
543
545{
546 Bool_t was = !IsDown();
547
548 if (state != fState) {
549 switch (state) {
550 case kButtonEngaged:
551 case kButtonDown:
552 fOptions &= ~kRaisedFrame;
554 break;
555 case kButtonDisabled:
556 case kButtonUp:
557 fOptions &= ~kRaisedFrame;
558 fOptions &= ~kSunkenFrame;
559 break;
560 }
561 fState = state;
562 DoRedraw();
563 if (emit) EmitSignals(was);
564 }
565}
566
567////////////////////////////////////////////////////////////////////////////////
568////////////////////////////////////////////////////////////////////////////////
569/// Create GUI builder application.
570
572 TGMainFrame(p ? p : gClient->GetDefaultRoot(), 1, 1)
573{
575 gGuiBuilder = this;
576 fManager = 0;
577 fEditor = 0;
578 fActionButton = 0;
579 fClosing = 0;
580
581 if (gDragManager) {
583 } else {
585 }
586 fManager->SetBuilder(this);
587
588 fMenuBar = new TGMdiMenuBar(this, 10, 10);
590 InitMenu();
591
593 kLHintsExpandX, 0,0,2,2));
594
595 fToolDock = new TGDockableFrame(this);
597 fToolDock->SetWindowName("GuiBuilder ToolBar");
598
602
603 int spacing = 8;
604
605 for (int i = 0; gToolBarData[i].fPixmap; i++) {
606 if (strlen(gToolBarData[i].fPixmap) == 0) {
607 spacing = 8;
608 continue;
609 }
610
611 const TGPicture *pic = fClient->GetPicture(gToolBarData[i].fPixmap);
613 gToolBarData[i].fId);
614 pb->SetStyle(gClient->GetStyle());
615
616 pb->SetToolTipText(gToolBarData[i].fTipText);
617
618 TGToolTip *tip = pb->GetToolTip();
619 tip->SetDelay(200);
620
621 tip->Connect("Reset()", "TRootGuiBuilder", this, "UpdateStatusBar(=0)");
622 tip->Connect("Hide()", "TRootGuiBuilder", this, "EraseStatusBar()");
623
624 fToolBar->AddButton(this, pb, spacing);
625 spacing = 0;
626
627 if (gToolBarData[i].fId == kEditableAct) {
628 fStartButton = pb;
629 continue;
630 }
631
632 if ((gToolBarData[i].fId == kUndoAct) ||
633 (gToolBarData[i].fId == kRedoAct)) {
635 }
636 }
637
638 fToolBar->Connect("Clicked(Int_t)", "TGuiBldDragManager", fManager,
639 "HandleAction(Int_t)");
640
642 kLHintsExpandX, 0,0,2,5));
643
644 TGCompositeFrame *cf = new TGHorizontalFrame(this, 1, 1);
646
647 //fShutterDock = new TGDockableFrame(cf);
648 //cf->AddFrame(fShutterDock, new TGLayoutHints(kLHintsNormal ));
649 //fShutterDock->SetWindowName("Widget Factory");
650 //fShutterDock->EnableUndock(kTRUE);
651 //fShutterDock->EnableHide(kTRUE);
652 //fShutterDock->DockContainer();
653
657
658 TGVSplitter *splitter = new TGVSplitter(cf);
659 splitter->SetFrame(fShutter, kTRUE);
660 cf->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
661
662 fMain = new TGMdiMainFrame(cf, fMenuBar, 1, 1);
663 fMain->Connect("FrameClosed(Int_t)", "TRootGuiBuilder", this,
664 "HandleWindowClosed(Int_t)");
665
666 TQObject::Connect("TGMdiFrame", "CloseWindow()", "TRootGuiBuilder", this,
667 "MaybeCloseWindow()");
668
670
672
673 const TGPicture *pbg = fClient->GetPicture("bld_bg.png");
674 if (pbg) {
676 }
677
678 if (fManager) {
679 fEditor = new TGuiBldEditor(cf);
683 }
684
685 AddSection("Projects");
686 AddSection("Buttons");
687 AddSection("Containers");
688 AddSection("Bars");
689 AddSection("Input");
690 AddSection("Complex Input");
691 AddSection("Display");
692 AddSection("Dialogs");
693
694 // create an empty section
695 AddSection("User's Macros");
696 TGShutterItem *item = fShutter->GetItem("User's Macros");
699
700 TGuiBldAction *act = new TGuiBldAction("TGMainFrame", "Empty Frame",
702 act->fAct = "empty";
703 act->fPic = "bld_mainframe.xpm";
704 AddAction(act, "Projects");
705
706 act = new TGuiBldAction("TGMainFrame", "Horizontal Frame", kGuiBldProj);
707 act->fAct = "horizontal";
708 act->fPic = "bld_mainframe.xpm";
709 AddAction(act, "Projects");
710
711 act = new TGuiBldAction("TGMainFrame", "Vertical Frame", kGuiBldProj);
712 act->fAct = "vertical";
713 act->fPic = "bld_mainframe.xpm";
714 AddAction(act, "Projects");
715
716 // Standard
717 act = new TGuiBldAction("TGTextButton", "Text Button", kGuiBldCtor);
718 act->fAct = "new TGTextButton()";
719 act->fPic = "bld_textbutton.xpm";
720 AddAction(act, "Buttons");
721
722 act = new TGuiBldAction("TGCheckButton", "Check Button", kGuiBldCtor);
723 act->fAct = "new TGCheckButton()";
724 act->fPic = "bld_checkbutton.xpm";
725 AddAction(act, "Buttons");
726
727 act = new TGuiBldAction("TGRadioButton", "Radio Button", kGuiBldCtor);
728 act->fAct = "new TGRadioButton()";
729 act->fPic = "bld_radiobutton.xpm";
730 AddAction(act, "Buttons");
731
732 act = new TGuiBldAction("TGPictureButton", "Picture Button", kGuiBldCtor);
733 act->fAct = "new TGPictureButton()";
734 act->fPic = "bld_image.xpm";
735 AddAction(act, "Buttons");
736
737 act = new TGuiBldAction("TGTextEntry", "Text Entry", kGuiBldCtor);
738 act->fAct = "new TGTextEntry()";
739 act->fPic = "bld_entry.xpm";
740 AddAction(act, "Input");
741
742 act = new TGuiBldAction("TGTextEdit", "Text Edit", kGuiBldCtor);
743 act->fAct = "TRootGuiBuilder::BuildTextEdit()";
744 act->fPic = "bld_text.xpm";
745 AddAction(act, "Input");
746
747 act = new TGuiBldAction("TGNumberEntry", "Number Entry", kGuiBldCtor);
748 act->fAct = "new TGNumberEntry()";
749 act->fPic = "bld_numberentry.xpm";
750 AddAction(act, "Input");
751
752 act = new TGuiBldAction("TGComboBox", "Combo Box", kGuiBldCtor);
753 act->fAct = "TRootGuiBuilder::BuildComboBox()";
754 act->fPic = "bld_combobox.xpm";
755 AddAction(act, "Input");
756
757 act = new TGuiBldAction("TGListBox", "List Box", kGuiBldCtor);
758 act->fAct = "TRootGuiBuilder::BuildListBox()";
759 act->fPic = "bld_listbox.xpm";
760 AddAction(act, "Input");
761
762 act = new TGuiBldAction("TGHSlider", "Horizontal Slider", kGuiBldCtor);
763 act->fAct = "new TGHSlider()";
764 act->fPic = "bld_hslider.xpm";
765 AddAction(act, "Input");
766
767 act = new TGuiBldAction("TGVSlider", "Vertical Slider", kGuiBldCtor);
768 act->fAct = "new TGVSlider()";
769 act->fPic = "bld_vslider.xpm";
770 AddAction(act, "Input");
771
772 act = new TGuiBldAction("TGHScrollBar", "HScrollbar", kGuiBldCtor);
773 act->fAct = "TRootGuiBuilder::BuildHScrollBar()";
774 act->fPic = "bld_hscrollbar.xpm";
775 AddAction(act, "Input");
776
777 act = new TGuiBldAction("TGVScrollBar", "VScrollbar", kGuiBldCtor);
778 act->fAct = "TRootGuiBuilder::BuildVScrollBar()";
779 act->fPic = "bld_vscrollbar.xpm";
780 AddAction(act, "Input");
781
782 act = new TGuiBldAction("TGListTree", "List Tree", kGuiBldCtor);
783 act->fAct = "TRootGuiBuilder::BuildListTree()";
784 act->fPic = "bld_listtree.xpm";
785 AddAction(act, "Complex Input");
786
787 act = new TGuiBldAction("TGLabel", "Text Label", kGuiBldCtor);
788 act->fAct = "new TGLabel()";
789 act->fPic = "bld_label.xpm";
790 AddAction(act, "Display");
791
792 act = new TGuiBldAction("TGIcon", "Icon", kGuiBldCtor);
793 act->fAct = "new TGIcon()";
794 act->fPic = "bld_image.xpm";
795 AddAction(act, "Display");
796
797 act = new TGuiBldAction("TGHorizontal3DLine", "Horizontal Line",
799 act->fAct = "TRootGuiBuilder::BuildH3DLine()";
800 act->fPic = "bld_hseparator.xpm";
801 AddAction(act, "Display");
802
803 act = new TGuiBldAction("TGVertical3DLine", "Vertical Line", kGuiBldCtor);
804 act->fAct = "TRootGuiBuilder::BuildV3DLine()";
805 act->fPic = "bld_vseparator.xpm";
806 AddAction(act, "Display");
807
808 act = new TGuiBldAction("TGStatusBar", "Status Bar", kGuiBldCtor);
809 act->fAct = "new TGStatusBar()";
810 act->fPic = "bld_statusbar.xpm";
812 AddAction(act, "Bars");
813
814 act = new TGuiBldAction("TGHProgressBar", "HProgress Bar", kGuiBldCtor);
815 act->fAct = "TRootGuiBuilder::BuildHProgressBar()";
816 act->fPic = "bld_hprogressbar.xpm";
817 AddAction(act, "Display");
818
819 act = new TGuiBldAction("TGVProgressBar", "VProgress Bar", kGuiBldCtor);
820 act->fAct = "TRootGuiBuilder::BuildVProgressBar()";
821 act->fPic = "bld_vprogressbar.xpm";
822 AddAction(act, "Display");
823
824 act = new TGuiBldAction("TRootEmbeddedCanvas", "Embed Canvas", kGuiBldCtor);
825 act->fAct = "new TRootEmbeddedCanvas()";
826 act->fPic = "bld_embedcanvas.xpm";
827 AddAction(act, "Display");
828
829 // Containers
830 act = new TGuiBldAction("TGHorizontalFrame", "Horizontal Frame",
832 act->fAct = "new TGHorizontalFrame(0,200,100)";
833 act->fPic = "bld_hbox.xpm";
834 AddAction(act, "Containers");
835
836 act = new TGuiBldAction("TGVerticalFrame", "Vertical Frame", kGuiBldCtor);
837 act->fAct = "new TGVerticalFrame(0,100,200)";
838 act->fPic = "bld_vbox.xpm";
839 AddAction(act, "Containers");
840
841 act = new TGuiBldAction("TGGroupFrame", "Group Frame", kGuiBldCtor);
842 act->fAct = "new TGGroupFrame()";
843 act->fPic = "bld_groupframe.xpm";
844 AddAction(act, "Containers");
845
846 act = new TGuiBldAction("TGTab", "Tabbed Frame", kGuiBldCtor);
847 act->fAct = "TRootGuiBuilder::BuildTab()";
848 act->fPic = "bld_tab.xpm";
849 AddAction(act, "Containers");
850
851 act = new TGuiBldAction("TGShutter", "Shutter", kGuiBldCtor);
852 act->fAct = "TRootGuiBuilder::BuildShutter()";
853 act->fPic = "bld_shutter.png";
854 AddAction(act, "Containers");
855
856
857 act = new TGuiBldAction("TGCanvas", "Scrolled Canvas", kGuiBldCtor);
858 act->fAct = "TRootGuiBuilder::BuildCanvas()";
859 act->fPic = "bld_canvas.xpm";
860 AddAction(act, "Containers");
861/*
862 act = new TGuiBldAction("TGVSplitter", "Horizontal Panes", kGuiBldFunc);
863 act->fAct = "TRootGuiBuilder::VSplitter()";
864 act->fPic = "bld_hpaned.xpm";
865 AddAction(act, "Containers");
866
867 act = new TGuiBldAction("TGHSplitter", "Vertical Panes", kGuiBldFunc);
868 act->fAct = "TRootGuiBuilder::HSplitter()";
869 act->fPic = "bld_vpaned.xpm";
870 AddAction(act, "Containers");
871*/
872 act = new TGuiBldAction("TGColorSelect", "Color Selector", kGuiBldFunc);
873 act->fAct = "new TGColorSelect()";
874 act->fPic = "bld_colorselect.xpm";
875 AddAction(act, "Dialogs");
876
878
879 fStatusBar = new TGStatusBar(this, 40, 10);
881 0, 0, 3, 0));
882
884 SetEditDisabled(kEditDisable); // disable editting to all subframes
885
887
888 Int_t qq;
889 UInt_t ww;
890 UInt_t hh;
891 gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);
892 MoveResize(100, 100, ww - 200, hh - 200);
893 SetWMPosition(100, 100);
894
895 SetWindowName("ROOT GuiBuilder");
896 SetIconName("ROOT GuiBuilder");
897 fIconPic = SetIconPixmap("bld_rgb.xpm");
898 SetClassHints("ROOT", "GuiBuilder");
899
900 fSelected = 0;
901 Update();
902
903 fMenuFile->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
904 "HandleMenu(Int_t)");
905 fMenuWindow->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
906 "HandleMenu(Int_t)");
907 fMenuHelp->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
908 "HandleMenu(Int_t)");
909
910 // doesn't work properly on Windows...
911 if (gVirtualX->InheritsFrom("TGX11"))
912 BindKeys();
913 UpdateStatusBar("Ready");
914 MapRaised();
915
917}
918
919////////////////////////////////////////////////////////////////////////////////
920/// Destructor.
921
923{
924 if (fIconPic) gClient->FreePicture(fIconPic);
925 delete fMenuFile;
926 delete fMenuWindow;
927 delete fMenuHelp;
928 gGuiBuilder = 0;
929}
930
931////////////////////////////////////////////////////////////////////////////////
932/// Close GUI builder via window manager "Close" button.
933
935{
936 TGWindow *root = (TGWindow*)fClient->GetRoot();
937 if (root) root->SetEditable(kFALSE);
938
939 fEditor->Reset();
940
941 if (fMain->GetNumberOfFrames() == 0) {
945 } else {
949 }
950
952 if (btn) {
954 }
955 fClosing = 1;
956 fMain->CloseAll();
957 if (fClosing == -1) {
958 fClosing = 0;
959 return;
960 }
962 Hide();
963}
964
965////////////////////////////////////////////////////////////////////////////////
966/// Find action by name
967
968TGButton *TRootGuiBuilder::FindActionButton(const char *name, const char *sect)
969{
970 if (!name || !sect) return 0;
971
972 TGShutterItem *item = fShutter->GetItem(sect);
973 if (!item) return 0;
974
977 TGFrameElement *fe;
978
979 TIter next(cont->GetList());
980 TGLabel *lb;
981 TGButton *btn;
982
983 while ((fe = (TGFrameElement*)next())) {
984 hf = (TGHorizontalFrame*)fe->fFrame;
985 btn = (TGButton*)((TGFrameElement*)hf->GetList()->First())->fFrame;
986 lb = (TGLabel*)((TGFrameElement*)hf->GetList()->Last())->fFrame;
987 if (*(lb->GetText()) == name) {
988 return (TGButton*)btn;
989 }
990 }
991 return 0;
992}
993
994////////////////////////////////////////////////////////////////////////////////
995/// Add new action to widget palette.
996
997void TRootGuiBuilder::AddAction(TGuiBldAction *act, const char *sect)
998{
999 if (!act || !sect) return;
1000
1001 TGShutterItem *item = fShutter->GetItem(sect);
1002 TGButton *btn = 0;
1003
1004 if (!item) return;
1007
1008 const TGPicture *pic = 0;
1009 if (!act->fPicture) {
1010 act->fPicture = fClient->GetPicture(act->fPic);
1011 }
1012 pic = act->fPicture;
1013
1014 TGHorizontalFrame *hf = new TGHorizontalFrame(cont);
1015
1016 if (pic) {
1017 btn = new TGPictureButton(hf, pic);
1018 } else {
1019 btn = new TGTextButton(hf, act->GetName());
1020 }
1021
1022 btn->SetToolTipText(act->GetTitle(), 200);
1023 btn->SetUserData((void*)act);
1024 btn->Connect("Clicked()", "TRootGuiBuilder", this, "HandleButtons()");
1025
1026 hf->AddFrame(btn, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1027
1028 TGLabel *lb = new TGLabel(hf, act->fType != kGuiBldMacro ? act->GetTitle() :
1029 act->GetName());
1030 lb->SetBackgroundColor(cont->GetBackground());
1031 hf->AddFrame(lb, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1032 hf->SetBackgroundColor(cont->GetBackground());
1033
1034 // disable edit
1037
1038 cont->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 2, 2, 2, 0));
1039 cont->MapSubwindows();
1040 cont->Resize(); // invoke Layout()
1041}
1042
1043////////////////////////////////////////////////////////////////////////////////
1044/// Add new shutter item.
1045
1046void TRootGuiBuilder::AddSection(const char *sect)
1047{
1048 static int id = 10000;
1049 TGShutterItem *item = new TGShutterItem(fShutter, new TGHotString(sect),
1050 id++);
1051 fShutter->AddItem(item);
1052 item->Connect("Selected()", "TRootGuiBuilder", this, "HandleMenu(=3)");
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Handle buttons in the GUI builder's widget palette.
1057
1059{
1060 TGFrame *parent;
1061
1062 if (fActionButton) {
1063 parent = (TGFrame*)fActionButton->GetParent();
1064 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1065 fClient->NeedRedraw(parent, kTRUE);
1066 }
1067
1068 if (!fClient->IsEditable()) {
1070 }
1071
1074 parent = (TGFrame*)fActionButton->GetParent();
1075
1076 parent->ChangeOptions(parent->GetOptions() | kSunkenFrame);
1077 fClient->NeedRedraw(parent, kTRUE);
1078
1079 if (act) {
1080 fAction = act;
1083 }
1084}
1085
1086////////////////////////////////////////////////////////////////////////////////
1087/// Execute an action.
1088
1090{
1091 if (!fAction || fAction->fAct.IsNull()) return 0;
1092
1093 TGFrame *ret = 0;
1094
1095 if (!fClient->IsEditable() && (fAction->fType != kGuiBldMacro)) {
1096 TGMdiFrame *current = fMain->GetCurrent();
1097 if (current) current->SetEditable(kTRUE);
1098 }
1099
1100 TString s = "";
1101
1102 switch (fAction->fType) {
1103 case kGuiBldProj:
1104 s = fAction->fAct.Data();
1105 NewProject(s);
1106 fAction = 0;
1107 break;
1108 case kGuiBldMacro:
1109 {
1110 TGWindow *root = (TGWindow*)fClient->GetRoot();
1111 if (root) root->SetEditable(kFALSE);
1112 gROOT->Macro(fAction->fAct.Data());
1113 if (root) root->SetEditable(kTRUE);
1114 fAction = 0;
1115 break;
1116 }
1117 default:
1118 ret = (TGFrame *)gROOT->ProcessLineFast(fAction->fAct.Data());
1119 break;
1120 }
1121
1122 Update();
1123
1124 return ret;
1125}
1126
1127////////////////////////////////////////////////////////////////////////////////
1128/// Inititiate GUI Builder menus.
1129
1131{
1133 fMenuFile->AddEntry(new TGHotString("&Edit (Ctrl+double-click)"),
1135 fClient->GetPicture("bld_edit.png"));
1136 fMenuFile->AddEntry(new TGHotString("&Stop (Ctrl+double-click)"),
1138 fClient->GetPicture("bld_stop.png"));
1142 fMenuFile->AddEntry(new TGHotString("&New Project"), kGUIBLD_FILE_NEW,
1143 0, fClient->GetPicture("bld_new.png"));
1145 0, fClient->GetPicture("bld_open.png"));
1147 0, fClient->GetPicture("bld_delete.png"));
1148 fMenuFile->AddEntry(new TGHotString("&Save project as"), kGUIBLD_FILE_SAVE,
1149 0, fClient->GetPicture("bld_save.png"));
1153 0, fClient->GetPicture("bld_exit.png"));
1154/*
1155 fMenuEdit = new TGuiBldPopupMenu();
1156 fMenuEdit->AddSeparator();
1157 fMenuEdit->AddEntry(new TGHotString("&Preferences ..."), kGUIBLD_EDIT_PREF);
1158*/
1160 fMenuWindow->AddEntry(new TGHotString("Tile &Horizontally"),
1162 fMenuWindow->AddEntry(new TGHotString("Tile &Vertically"),
1164 fMenuWindow->AddEntry(new TGHotString("&Cascade"),
1167 //fMenuWindow->AddPopup(new TGHotString("&Windows"), fMain->GetWinListMenu());
1168 fMenuWindow->AddEntry(new TGHotString("&Arrange icons"),
1171 fMenuWindow->AddEntry(new TGHotString("&Opaque resize"),
1174
1179 //fMenuHelp->AddSeparator();
1180 //fMenuHelp->AddEntry(new TGHotString("&Send Bug Report"),kGUIBLD_HELP_BUG);
1181
1182 TGMenuBar *bar = fMenuBar->GetMenuBar();
1183
1184 TGuiBldMenuTitle *title;
1185 title = new TGuiBldMenuTitle(bar, new TGHotString("&File"), fMenuFile);
1186 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1187
1188 //title = new TGuiBldMenuTitle(bar, new TGHotString("&Edit"), fMenuEdit);
1189 //bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1190
1191 title = new TGuiBldMenuTitle(bar, new TGHotString("&Windows"), fMenuWindow);
1192 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1193
1194 title = new TGuiBldMenuTitle(bar, new TGHotString("&Help"), fMenuHelp);
1195 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsRight,4,4,0,0));
1196
1199}
1200
1201////////////////////////////////////////////////////////////////////////////////
1202/// Set selected frame.
1203
1205{
1206 fSelected = f;
1207 Update();
1208}
1209
1210////////////////////////////////////////////////////////////////////////////////
1211/// Enable toolbar buttons for alignment.
1212
1214{
1215 TGButton *btn = 0;
1216
1217 btn = fToolBar->GetButton(kUpAct);
1218 if (btn) {
1220 }
1221
1222 btn = fToolBar->GetButton(kDownAct);
1223 if (btn) {
1225 }
1226
1228 if (btn) {
1230 }
1231
1232 btn = fToolBar->GetButton(kLeftAct);
1233 if (btn) {
1235 }
1236
1238 if (btn) {
1240 }
1241
1242 btn = fToolBar->GetButton(kGrabAct);
1243 if (btn) {
1244 btn->SetState(kButtonUp);
1245 }
1246
1247 btn = fToolBar->GetButton(kCropAct);
1248 if (btn) {
1250 }
1251
1252}
1253
1254////////////////////////////////////////////////////////////////////////////////
1255/// Enable/disable toolbar buttons according to the selected frame.
1256
1258{
1260
1261 TGButton *btn = 0;
1262
1263 if (!fSelected) {
1265 if (btn) btn->SetState(kButtonDisabled);
1266
1268 if (btn) btn->SetState(kButtonDisabled);
1269
1271 if (btn) btn->SetState(kButtonDisabled);
1272
1274 if (btn) btn->SetState(kButtonDisabled);
1275 return;
1276 }
1277
1278 Bool_t comp = kFALSE;
1279 TGLayoutManager *lm = 0;
1280 Bool_t hor = kFALSE;
1281 Bool_t fixed = kFALSE;
1282 Bool_t enable = on;
1283 Bool_t compact_disable = kTRUE;
1284
1286 lm = ((TGCompositeFrame*)fSelected)->GetLayoutManager();
1287 comp = kTRUE;
1288 hor = lm && lm->InheritsFrom(TGHorizontalLayout::Class());
1290 compact_disable = !fManager->CanCompact(fSelected);
1291 } else {
1292 enable = kFALSE;
1293 }
1294
1296 if (btn) btn->SetState(enable && comp && !fixed && !compact_disable ?
1298
1300 if (btn) {
1301 btn->SetState(enable && comp && !hor && !fixed ? kButtonUp :
1303 }
1304
1306 if (btn) {
1307 btn->SetState(enable && comp && hor && !fixed ? kButtonUp :
1309 }
1310
1312 if (btn) {
1313 btn->SetState(enable && comp && !fixed ? kButtonUp : kButtonDisabled);
1314 }
1315/*
1316 btn = fToolBar->GetButton(kGrabAct);
1317 if (btn) {
1318 btn->SetState(enable && comp ? kButtonDown : kButtonUp);
1319 TGToolTip *tt = btn->GetToolTip();
1320 tt->SetText(btn->IsDown() ? "Drop Frames (Ctrl-Return)" :
1321 "Grab Selected Frames (Return)");
1322 }
1323*/
1324}
1325
1326////////////////////////////////////////////////////////////////////////////////
1327/// Enable/disable toolbar buttons according to the selected frame.
1328
1330{
1331 TGButton *btn = 0;
1332
1333 Bool_t lasso = fManager->IsLassoDrawn() && on;
1334
1336 if (btn) {
1338 }
1339
1340 btn = fToolBar->GetButton(kCutAct);
1341 if (btn) {
1342 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1343 }
1344
1345 btn = fToolBar->GetButton(kDropAct);
1346 if (btn) {
1347 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1348 }
1349
1350 btn = fToolBar->GetButton(kCopyAct);
1351 if (btn) {
1352 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1353 }
1354
1356 if (btn) {
1357 btn->SetState(!on || !fManager->IsPasteFrameExist() ?
1359 }
1360
1361 btn = fToolBar->GetButton(kCropAct);
1362 if (btn) {
1363 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1364 }
1365
1367 if (btn) {
1368 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1369 }
1370}
1371
1372////////////////////////////////////////////////////////////////////////////////
1373/// Update gui builder.
1374
1376{
1377 if (!fManager) {
1378 return;
1379 }
1380
1385 fManager->GetSelected() ||
1387
1388 if (fActionButton) {
1389 TGFrame *parent = (TGFrame*)fActionButton->GetParent();
1390 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1391 fClient->NeedRedraw(parent, kTRUE);
1392 }
1393
1394 if (!fClient->IsEditable()) {
1395 UpdateStatusBar("");
1398 fEditable = 0;
1399 //fShutter->SetSelectedItem(fShutter->GetItem("Projects"));
1400 } else {
1403 }
1404
1406 fActionButton = 0;
1407}
1408
1409////////////////////////////////////////////////////////////////////////////////
1410/// Return the status of the selected mode.
1411
1413{
1414 TGButton *btn = 0;
1416
1417 if (!btn) return kFALSE;
1418
1419 return btn->IsDown();
1420}
1421
1422////////////////////////////////////////////////////////////////////////////////
1423/// Return the status of the grab mode.
1424
1426{
1428
1429 if (!btn) return kFALSE;
1430
1431 return btn->IsDown();
1432}
1433
1434////////////////////////////////////////////////////////////////////////////////
1436
1437public:
1440 void SetList(TList *li) { fList = li; }
1441};
1442
1443static const char *gSaveMacroTypes[] = {
1444 "Macro files", "*.[C|c]*",
1445 "All files", "*",
1446 0, 0
1447};
1448
1449////////////////////////////////////////////////////////////////////////////////
1450/// Handle keys.
1451
1453{
1454 if (event->fType == kGKeyPress) {
1455 UInt_t keysym;
1456 char str[2];
1457 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1458
1459 if (event->fState & kKeyControlMask) {
1460 if (str[0] == 19) { // ctrl-s
1461 if (fMain->GetCurrent()) {
1462 return SaveProject(event);
1463 } else {
1464 return kFALSE; //TGMainFrame::HandleKey(event);
1465 }
1466 } else if (str[0] == 14) { //ctrl-n
1467 return NewProject(); //event not needed
1468 } else if (str[0] == 15) { // ctrl-o
1469 return OpenProject(event);
1470 }
1471 }
1474 }
1475 return kTRUE;
1476}
1477
1478////////////////////////////////////////////////////////////////////////////////
1479/// Create a new project.
1480
1482{
1483 TGWindow *root = (TGWindow*)fClient->GetRoot();
1484
1485 if (root) root->SetEditable(kFALSE);
1486 fEditable = new TGMdiFrame(fMain, 500, 400, kOwnBackground);
1490 fEditable->SetEditDisabled(0); // enable editting
1494
1495 if (type == "horizontal") {
1496 TGHorizontalFrame *hor = new TGHorizontalFrame(fEditable, 100, 100);
1498 kLHintsExpandY, 1, 1, 1, 1));
1499 hor->SetEditable(kTRUE);
1500 fClient->NeedRedraw(hor, kTRUE);
1505 fEditable->Layout();
1506 }
1507 else if (type == "vertical") {
1508 TGVerticalFrame *vert = new TGVerticalFrame(fEditable, 100, 100);
1510 kLHintsExpandY,1,1,1,1));
1511 vert->SetEditable(kTRUE);
1512 fClient->NeedRedraw(vert, kTRUE);
1517 fEditable->Layout();
1518
1519 } else {
1521 }
1526
1527
1529 return kTRUE;
1530}
1531
1532////////////////////////////////////////////////////////////////////////////////
1533/// Open new gui builder project.
1534
1536{
1537
1539 if (btn) {
1541 fClient->NeedRedraw(btn, kTRUE);
1542 }
1543
1544 TGFileInfo fi;
1545 static TString dir(".");
1546 static Bool_t overwr = kFALSE;
1547 TString fname;
1548
1550 fi.SetIniDir(dir);
1551 fi.fOverwrite = overwr;
1552 TGWindow *root = (TGWindow*)fClient->GetRoot();
1553 root->SetEditable(kFALSE);
1554
1555 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
1556
1557 if (!fi.fFilename) {
1558 root->SetEditable(kTRUE);
1559 return kFALSE;
1560 }
1561
1562 dir = fi.fIniDir;
1563 overwr = fi.fOverwrite;
1564 fname = fi.fFilename;
1565
1566 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1567 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1568 NewProject(); // create new project
1569 gROOT->Macro(fname.Data()); // put content of the macro as child frame
1570 } else {
1571 Int_t retval;
1572 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1573 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1575 &retval);
1576
1577 if (retval == kMBRetry) {
1579 }
1580 }
1581
1585
1586 return kTRUE;
1587}
1588
1589////////////////////////////////////////////////////////////////////////////////
1590/// Save selected project.
1591
1593{
1595 if (btn) {
1597 fClient->NeedRedraw(btn, kTRUE);
1598 }
1599
1600 TGMdiFrame *savfr = fMain->GetCurrent();
1601 if (!savfr) return kFALSE;
1602
1603 static std::unique_ptr<TImage> img;
1604
1605 img = TASUtils::FromWindow(savfr->GetParent()->GetId());
1606
1607 TGWindow *root = (TGWindow*)fClient->GetRoot();
1608 TGFileInfo fi;
1609 static TString dir(".");
1610 static Bool_t overwr = kFALSE;
1611 TString fname;
1612 root->SetEditable(kFALSE);
1613
1615 fi.SetIniDir(dir);
1616 fi.fOverwrite = overwr;
1617
1618 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
1619
1620 if (!fi.fFilename) {
1621 root->SetEditable(kTRUE);
1623 return kFALSE;
1624 }
1625
1626 dir = fi.fIniDir;
1627 overwr = fi.fOverwrite;
1628 fname = gSystem->UnixPathName(fi.fFilename);
1629
1630 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1631 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1633 savfr->GetWidth(),
1634 savfr->GetHeight());
1635 TList *list = main->GetList();
1636 TString name = savfr->GetName();
1637 savfr->SetName(main->GetName());
1638 main->SetList(savfr->GetList());
1639 main->SetLayoutBroken(savfr->IsLayoutBroken());
1640 main->SaveSource(fname.Data(), "keep_names");
1641 savfr->SetWindowName(fname.Data());
1642 main->SetList(list);
1643
1644 main->SetMWMHints(kMWMDecorAll, kMWMFuncAll,
1646 main->SetWMSize(main->GetWidth(), main->GetHeight());
1647 main->SetWMSizeHints(main->GetDefaultWidth(), main->GetDefaultHeight(),
1648 10000, 10000, 0, 0);
1649 main->SetWindowName(fname.Data());
1650 main->SetIconName(fname.Data());
1651 main->SetClassHints(fname.Data(), fname.Data());
1652 // some problems here under win32
1653 if (gVirtualX->InheritsFrom("TGX11")) main->SetIconPixmap("bld_rgb.xpm");
1654
1655 savfr->SetName(name.Data());
1656
1657 AddMacro(fname.Data(), img.get());
1658 delete main;
1659 } else {
1660 Int_t retval;
1661 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1662 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1664 &retval);
1665 if (retval == kMBRetry) {
1667 }
1669 }
1671 return kTRUE;
1672}
1673
1674////////////////////////////////////////////////////////////////////////////////
1675/// Add macro to "User's Macros" section
1676/// Input img must be static - do not delete it.
1677
1678void TRootGuiBuilder::AddMacro(const char *macro, TImage *img)
1679{
1680 if (!img || !img->GetWidth() || !img->GetHeight()) {
1681 return;
1682 }
1683
1684 UInt_t w = 100;
1685 Float_t ratio = Float_t(w)/img->GetWidth();
1686 Float_t rh = img->GetHeight()*ratio;
1687 UInt_t h = UInt_t(rh);
1688 img->Scale(w, h);
1689 img->Merge(img, "overlay");
1690
1691 static int i = 0;
1692 const TGPicture *pic = fClient->GetPicturePool()->GetPicture(
1693 TString::Format("%s;%d", macro, i++),
1695 const char *name = gSystem->BaseName(macro);
1696
1697 TGButton *btn = FindActionButton(name, "User's Macros");
1698 TGuiBldAction *act = 0;
1699
1700 if (!btn) {
1701 act = new TGuiBldAction(name, macro, kGuiBldMacro);
1702 act->fAct = macro;
1703 act->fPic = macro;
1704 act->fPicture = pic;
1705
1706 AddAction(act, "User's Macros");
1707 } else {
1708 act = (TGuiBldAction*)btn->GetUserData();
1709 act->fAct = macro;
1710 act->fPic = macro;
1711 act->fPicture = pic;
1712
1714 btn->Resize(w, h);
1715 fClient->FreePicture(((TGPictureButton*)btn)->GetPicture());
1716 ((TGPictureButton*)btn)->SetPicture(pic);
1717 }
1718 }
1720}
1721
1722////////////////////////////////////////////////////////////////////////////////
1723/// Find the editable frame.
1724
1726{
1727 const TGWindow *parent = win;
1728 TGMdiFrame *ret = 0;
1729
1730 while (parent && (parent != fClient->GetDefaultRoot())) {
1731 if (parent->InheritsFrom(TGMdiFrame::Class())) {
1732 ret = (TGMdiFrame*)parent;
1733 return ret;
1734 }
1735 parent = parent->GetParent();
1736 }
1737 return 0;
1738}
1739
1740////////////////////////////////////////////////////////////////////////////////
1741/// Switch image of toolbar edit button according to the current state.
1742
1744{
1745 static const TGPicture *start = fClient->GetPicture("bld_edit.png");
1746 static const TGPicture *stop = fClient->GetPicture("bld_stop.png");
1747
1748 if (fClient->IsEditable()) {
1750 fStartButton->SetPicture(stop);
1752 fStartButton->SetToolTipText("Stop Edit (Ctrl-Dbl-Click)");
1753 } else {
1754 if (fMain->GetNumberOfFrames() < 1) {
1756 } else {
1758 fStartButton->SetPicture(start);
1760 fStartButton->SetToolTipText("Start Edit (Ctrl-Dbl-Click)");
1761 }
1762 }
1763
1765}
1766
1767////////////////////////////////////////////////////////////////////////////////
1768/// Handle menu items.
1769
1771{
1772 TGWindow *root = (TGWindow*)fClient->GetRoot();
1773 TRootHelpDialog *hd;
1774
1775 switch (id) {
1776 case kGUIBLD_FILE_START:
1777 if (fClient->IsEditable()) {
1778 break;
1779 }
1781 if (fEditable) {
1783 } //else if (!fMain->GetCurrent()) {
1784 //NewProject();
1785 //}
1786 UpdateStatusBar("Start edit");
1790 break;
1791
1792 case kGUIBLD_FILE_STOP:
1793 if (!fClient->IsEditable()) {
1794 break;
1795 }
1797
1798 if (fEditable) {
1799 root->SetEditable(kFALSE);
1800
1801 UpdateStatusBar("Stop edit");
1804 fEditable = 0;
1806 }
1807 fEditor->Reset();
1808 break;
1809
1810 case kGUIBLD_FILE_NEW:
1811 NewProject();
1813 break;
1814
1815 case kGUIBLD_FILE_CLOSE:
1817 if (fEditable && (fEditable == fMain->GetCurrent())) {
1818 root->SetEditable(kFALSE);
1819 }
1820 fEditor->Reset();
1821 UpdateStatusBar("");
1823
1824 if (fMain->GetNumberOfFrames() <= 1) {
1828 }
1829
1830 if (fClient->IsEditable()) {
1833 } else {
1836 }
1838 break;
1839
1840 case kGUIBLD_FILE_EXIT:
1841 CloseWindow();
1842 break;
1843
1844 case kGUIBLD_FILE_OPEN:
1845 OpenProject();
1847 break;
1848
1849 case kGUIBLD_FILE_SAVE:
1850 SaveProject();
1852 break;
1853
1854 case kGUIBLD_WINDOW_HOR:
1856 break;
1857
1860 break;
1861
1863 fMain->Cascade();
1864 break;
1865
1868 break;
1869
1874 } else {
1877 }
1878 break;
1880 root->SetEditable(kFALSE);
1881 hd = new TRootHelpDialog(this, "Help on Gui Builder...", 600, 400);
1882 hd->SetText(gHelpBuilder);
1883 hd->SetEditDisabled();
1884 hd->Popup();
1885 root->SetEditable(kTRUE);
1886 break;
1887
1888 case kGUIBLD_HELP_ABOUT:
1889 root->SetEditable(kFALSE);
1890 hd = new TRootHelpDialog(this, "About Gui Builder...", 520, 160);
1891 hd->SetEditDisabled();
1893 hd->Popup();
1894 root->SetEditable(kTRUE);
1895 break;
1896
1897 default:
1898 fMain->SetCurrent(id);
1899 break;
1900 }
1901}
1902
1903////////////////////////////////////////////////////////////////////////////////
1904/// Handler before closing MDI frame.
1905
1907{
1908 int retval;
1909 if (fClosing == -1)
1910 return;
1911 TGMdiFrame *mdiframe = (TGMdiFrame *)gTQSender;
1913 new TGMsgBox(gClient->GetDefaultRoot(), this,
1914 "Closing project", "Do you want to save the project before closing?",
1916
1918 if (retval == kMBYes) {
1919 SaveProject();
1920 }
1921 if (retval == kMBCancel) {
1922 fClosing = -1;
1923 if (!fClient->IsEditable())
1925 return;
1926 }
1927 fEditor->RemoveFrame(mdiframe);
1928 mdiframe->CloseWindow();
1929}
1930
1931////////////////////////////////////////////////////////////////////////////////
1932/// Handler for closed MDI frame.
1933
1957
1958////////////////////////////////////////////////////////////////////////////////
1959/// Update information shown on the status bar.
1960
1962{
1963 if (!fStatusBar) return;
1964
1965 const char *text = 0;
1966
1967 if (!txt) {
1968 TObject *o = (TObject *)gTQSender;
1969
1970 if (o && o->InheritsFrom(TGToolTip::Class())) {
1971 TGToolTip *tip = (TGToolTip*)o;
1972 text = tip->GetText()->Data();
1973 }
1974 } else {
1975 text = txt;
1976 }
1978}
1979
1980////////////////////////////////////////////////////////////////////////////////
1981/// Clear information shown in the status bar.
1982
1984{
1985 if (!fStatusBar) return;
1986
1987 fStatusBar->SetText("");
1988}
1989
1990////////////////////////////////////////////////////////////////////////////////
1991/// Keyboard key binding.
1992
1994{
1995 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_a),
1997
1998 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_n),
2000
2001 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_o),
2003
2004 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2006
2007 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2008 0, kTRUE);
2009
2010 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2012
2013 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2014 0, kTRUE);
2015
2016 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_x),
2018
2019 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_c),
2021
2022 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_v),
2024
2025 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_r),
2027
2028 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2030
2031 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2033
2034 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_b),
2036
2037 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_l),
2039
2040 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_g),
2042
2043 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_h),
2045
2046 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2047 0, kTRUE);
2048
2049 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2050 0, kTRUE);
2051
2052 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Space),
2053 0, kTRUE);
2054
2055 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2056 0, kTRUE);
2057
2058 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2059 0, kTRUE);
2060
2061 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2062 0, kTRUE);
2063
2064 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2065 0, kTRUE);
2066
2067 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2069
2070 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2072
2073 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2075
2076 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2078
2079 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2081
2082 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2084}
2085
2086////////////////////////////////////////////////////////////////////////////////
2087/// Create new vertical splitter (TGVSplitter).
2088
2090{
2093 TGVerticalFrame *v1 = new TGVerticalFrame(ret, 40, 10, kSunkenFrame |
2094 kFixedWidth);
2096 //v1->SetEditDisabled(kEditDisableGrab);
2097
2098 TGVSplitter *splitter = new TGVSplitter(ret);
2099 splitter->SetFrame(v1, kTRUE);
2100 ret->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
2102
2103 TGVerticalFrame *v2 = new TGVerticalFrame(ret, 10, 10, kSunkenFrame);
2104 v2->ChangeOptions(kSunkenFrame);
2107 //v2->SetEditDisabled(kEditDisableGrab);
2109
2110 ret->MapSubwindows();
2111 ret->SetLayoutBroken(kFALSE);
2112 return ret;
2113}
2114
2115////////////////////////////////////////////////////////////////////////////////
2116/// Creates new horizontal splitter (TGHSplitter).
2117
2119{
2120 TGVerticalFrame *ret = new TGVerticalFrame();
2123 kFixedHeight);
2125 //v1->SetEditDisabled(kEditDisableGrab);
2126
2127 TGHSplitter *splitter = new TGHSplitter(ret);
2128 splitter->SetFrame(v1, kTRUE);
2129 ret->AddFrame(splitter, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
2130 splitter->SetEditDisabled(kEditDisable);
2131
2132 TGHorizontalFrame *v2 = new TGHorizontalFrame(ret, 10, 10);
2133 v2->ChangeOptions(kSunkenFrame);
2136 //v2->SetEditDisabled(kEditDisableGrab);
2138
2139 ret->MapSubwindows();
2140 ret->SetLayoutBroken(kFALSE);
2141 return ret;
2142}
2143
2144////////////////////////////////////////////////////////////////////////////////
2145/// Hide builder.
2146
2148{
2149 //fMain->CloseAll();
2150 UnmapWindow();
2151}
2152
2153////////////////////////////////////////////////////////////////////////////////
2154/// Return default background color.
2155
2157{
2159
2160 static ULong_t gPixel = 0;
2161
2162 if (gPixel) return gPixel;
2163
2164 Float_t r, g, b;
2165
2166 r = 232./255;
2167 g = 232./255;
2168 b = 222./255;
2169
2170 gPixel = TColor::RGB2Pixel(r, g, b);
2171 return gPixel;
2172}
2173
2174////////////////////////////////////////////////////////////////////////////////
2175/// Return background GC.
2176
2178{
2179 if (fgBgnd) return fgBgnd;
2180
2182
2183 Pixel_t back = GetBgnd();
2184 fgBgnd->SetBackground(back);
2185 fgBgnd->SetForeground(back);
2186
2187 return fgBgnd;
2188}
2189
2190////////////////////////////////////////////////////////////////////////////////
2191/// Set a background color to frame and all its subframes.
2192
2194{
2195 if (!frame) return;
2196
2197 frame->SetBackgroundColor(color);
2198 if (!frame->InheritsFrom(TGCompositeFrame::Class())) return;
2199
2200 TIter next(((TGCompositeFrame*)frame)->GetList());
2201 TGFrameElement *fe;
2202
2203 while ((fe = (TGFrameElement*)next())) {
2205 continue;
2206 }
2207 PropagateBgndColor(fe->fFrame, color);
2208 }
2209}
2210
2211////////////////////////////////////////////////////////////////////////////////
2212/// Return background color for popup menus.
2213
2215{
2217
2218 static ULong_t gPixel = 0;
2219
2220 if (gPixel) return gPixel;
2221
2222 Float_t r, g, b;
2223
2224 r = 250./255;
2225 g = 250./255;
2226 b = 250./255;
2227
2228 gPixel = TColor::RGB2Pixel(r, g, b);
2229
2230 return gPixel;
2231}
2232
2233////////////////////////////////////////////////////////////////////////////////
2234/// Return background GC for popup menus.
2235
2237{
2238 if (fgBgndPopup) return fgBgndPopup;
2239
2241
2242 Pixel_t back = GetPopupBgnd();
2245
2246 return fgBgndPopup;
2247}
2248
2249////////////////////////////////////////////////////////////////////////////////
2250/// Return highlighted color for popup menu entry.
2251
2253{
2255
2256 static ULong_t gPixel = 0;
2257
2258 if (gPixel) return gPixel;
2259
2260 Float_t r, g, b;
2261
2262 r = 120./255;
2263 g = 120./255;
2264 b = 222./255;
2265
2266 gPixel = TColor::RGB2Pixel(r, g, b);
2267
2268 return gPixel;
2269}
2270
2271////////////////////////////////////////////////////////////////////////////////
2272/// Return background GC for highlighted popup menu entry.
2273
2286
2287////////////////////////////////////////////////////////////////////////////////
2288/// Return style popup menu.
2289
2294
2295////////////////////////////////////////////////////////////////////////////////
2296/// Helper method used in guibuilding
2297
2299{
2300 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2301 TGListTree *lt = new TGListTree(canvas, kHorizontalFrame);
2302 lt->AddItem(0, "Entry 1");
2303 lt->AddItem(0, "Entry 2");
2304 lt->AddItem(0, "Entry 3");
2305 lt->AddItem(0, "Entry 4");
2306 lt->AddItem(0, "Entry 5");
2307 canvas->Resize(100, 60);
2308 canvas->MapSubwindows();
2309
2310 return canvas;
2311}
2312
2313////////////////////////////////////////////////////////////////////////////////
2314/// Helper method used in guibuilding to create TGCanvas widget
2315
2317{
2318 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2319 TGCompositeFrame *cont = new TGCompositeFrame(canvas->GetViewPort(),
2320 200, 200, kHorizontalFrame |
2322
2323 cont->SetCleanup(kDeepCleanup);
2324 cont->SetLayoutManager(new TGTileLayout(cont, 8));
2325 cont->AddFrame(new TGTextButton(cont, "Button1"));
2326 cont->AddFrame(new TGTextButton(cont, "Button2"));
2327 cont->AddFrame(new TGTextButton(cont, "Button3"));
2328 cont->AddFrame(new TGTextButton(cont, "Button4"));
2329
2330 canvas->SetContainer(cont);
2331 return canvas;
2332}
2333
2334////////////////////////////////////////////////////////////////////////////////
2335/// Helper method used in guibuilding to create TGShutter widget
2336
2338{
2339 TGShutterItem *item;
2340 TGCompositeFrame *container;
2341 const TGPicture *buttonpic;
2343
2345 TGShutter *shut = new TGShutter();
2346
2347 item = shut->AddPage("Histograms");
2348 container = (TGCompositeFrame *)item->GetContainer();
2349 buttonpic = gClient->GetPicture("h1_s.xpm");
2350
2351 if (buttonpic) {
2352 button = new TGPictureButton(container, buttonpic);
2353 button->SetToolTipText("TH1");
2354 container->AddFrame(button, l);
2355 }
2356 buttonpic = gClient->GetPicture("h2_s.xpm");
2357
2358 if (buttonpic) {
2359 button = new TGPictureButton(container, buttonpic);
2360 button->SetToolTipText("TH2");
2361 container->AddFrame(button, l);
2362 }
2363 buttonpic = gClient->GetPicture("h3_s.xpm");
2364
2365 if (buttonpic) {
2366 button = new TGPictureButton(container, buttonpic);
2367 button->SetToolTipText("TH3");
2368 container->AddFrame(button, l);
2369 }
2370 buttonpic = gClient->GetPicture("profile_s.xpm");
2371
2372 if (buttonpic) {
2373 button = new TGPictureButton(container, buttonpic);
2374 button->SetToolTipText("TProfile");
2375 container->AddFrame(button, l);
2376 }
2377
2378 // new page
2379 item = shut->AddPage("Functions");
2380 container = (TGCompositeFrame *)item->GetContainer();
2381 buttonpic = gClient->GetPicture("f1_s.xpm");
2382
2383 if (buttonpic) {
2384 button = new TGPictureButton(container, buttonpic);
2385 button->SetToolTipText("TF1");
2386 container->AddFrame(button, l);
2387 }
2388 buttonpic = gClient->GetPicture("f2_s.xpm");
2389
2390 if (buttonpic) {
2391 button = new TGPictureButton(container, buttonpic);
2392 button->SetToolTipText("TF2");
2393 container->AddFrame(button, l);
2394 }
2395
2396 // new page
2397 item = shut->AddPage("Trees");
2398 container = (TGCompositeFrame *)item->GetContainer();
2399 buttonpic = gClient->GetPicture("ntuple_s.xpm");
2400
2401 if (buttonpic) {
2402 button = new TGPictureButton(container, buttonpic);
2403 button->SetToolTipText("TNtuple");
2404 container->AddFrame(button, l);
2405 }
2406 buttonpic = gClient->GetPicture("tree_s.xpm");
2407
2408 if (buttonpic) {
2409 button = new TGPictureButton(container, buttonpic);
2410 button->SetToolTipText("TTree");
2411 container->AddFrame(button, l);
2412 }
2413 buttonpic = gClient->GetPicture("chain_s.xpm");
2414
2415 if (buttonpic) {
2416 button = new TGPictureButton(container, buttonpic);
2417 button->SetToolTipText("TChain");
2418 container->AddFrame(button, l);
2419 }
2420
2421 shut->MapSubwindows();
2422 return shut;
2423}
2424
2425////////////////////////////////////////////////////////////////////////////////
2426/// Helper method to create TGTextEdit widget
2427
2429{
2430 TGTextEdit *te = new TGTextEdit();
2431
2432 te->AddLine("all work and no play makes jack a pretty");
2433 te->AddLine("dull boy. all work and no play makes jack");
2434 te->AddLine("a pretty dull boy. all work and no play ");
2435 te->AddLine("makes jack a pretty dull boy. all work");
2436 te->AddLine("and no play makes jack a pretty dull boy.");
2437
2438 te->MapSubwindows();
2439 te->Layout();
2440 te->Resize(100, 60);
2441
2442 return te;
2443}
2444
2445////////////////////////////////////////////////////////////////////////////////
2446/// Helper method to create TGTab widget
2447
2449{
2450 TGTab *tab = new TGTab();
2451
2452 tab->AddTab("Tab1");
2453 tab->AddTab("Tab2");
2454 tab->MapSubwindows();
2455
2456 return tab;
2457}
2458
2459////////////////////////////////////////////////////////////////////////////////
2460/// Helper method to create TGListBox widget
2461
2463{
2464 TGListBox *lb = new TGListBox();
2465
2466 lb->AddEntry("Entry 1", 0);
2467 lb->AddEntry("Entry 2", 1);
2468 lb->AddEntry("Entry 3", 2);
2469 lb->AddEntry("Entry 4", 3);
2470 lb->AddEntry("Entry 5", 4);
2471 lb->AddEntry("Entry 6", 5);
2472 lb->AddEntry("Entry 7", 6);
2473 lb->MapSubwindows();
2474
2475 lb->Resize(100,100);
2476
2477 return lb;
2478}
2479
2480////////////////////////////////////////////////////////////////////////////////
2481/// Helper method to create TGComboBox widget
2482
2484{
2485 TGComboBox *cb = new TGComboBox();
2486
2487 cb->AddEntry("Entry 1 ", 0);
2488 cb->AddEntry("Entry 2 ", 1);
2489 cb->AddEntry("Entry 3 ", 2);
2490 cb->AddEntry("Entry 4 ", 3);
2491 cb->AddEntry("Entry 5 ", 4);
2492 cb->AddEntry("Entry 6 ", 5);
2493 cb->AddEntry("Entry 7 ", 6);
2494 cb->MapSubwindows();
2495
2497 int max_ascent, max_descent;
2498 gVirtualX->GetFontProperties(fs, max_ascent, max_descent);
2499
2500 cb->Resize(cb->GetListBox()->GetDefaultWidth(), max_ascent+max_descent+7);
2501 return cb;
2502}
2503
2504////////////////////////////////////////////////////////////////////////////////
2505/// Helper method to create TGHorizontal3DLine widget.
2506
2508{
2509 TGHorizontal3DLine *l = new TGHorizontal3DLine(0, 100, 2);
2510 l->Resize(100, 2);
2511
2512 return l;
2513}
2514
2515////////////////////////////////////////////////////////////////////////////////
2516/// Helper method to create TGVertical3DLine widget.
2517
2519{
2521 l->Resize(2, 100);
2522
2523 return l;
2524}
2525
2526////////////////////////////////////////////////////////////////////////////////
2527/// Helper method to create TGHScrollBar
2528
2530{
2531 TGHScrollBar *b = new TGHScrollBar();
2532
2533 b->Resize(100, b->GetDefaultHeight());
2534 b->SetRange(100, 20);
2535 b->MapSubwindows();
2536
2537 return b;
2538}
2539
2540////////////////////////////////////////////////////////////////////////////////
2541/// Helper method to create TGVScrollBar
2542
2544{
2545 TGVScrollBar *b = new TGVScrollBar();
2546
2547 b->Resize(b->GetDefaultWidth(), 100);
2548 b->MapSubwindows();
2549 b->SetRange(100, 20);
2550
2551 return b;
2552}
2553
2554////////////////////////////////////////////////////////////////////////////////
2555/// Helper method to create TGHProgressBar
2556
2558{
2560
2561 b->Resize(100, b->GetDefaultHeight());
2562 b->SetPosition(25);
2563 b->Format("%.2f");
2564 b->SetFillType(TGProgressBar::kBlockFill);
2565
2566 return b;
2567}
2568
2569////////////////////////////////////////////////////////////////////////////////
2570/// Helper method to create TGVProgressBar
2571
2573{
2575
2576 b->Resize(b->GetDefaultWidth(), 100);
2577 b->SetPosition(25);
2578 b->SetFillType(TGProgressBar::kBlockFill);
2579
2580 return b;
2581}
2582
2583
@ kGKeyPress
Definition GuiTypes.h:61
@ kEnterNotify
Definition GuiTypes.h:62
@ kLeaveNotify
Definition GuiTypes.h:62
const Mask_t kButtonPressMask
Definition GuiTypes.h:162
const Mask_t kKeyPressMask
Definition GuiTypes.h:160
const Mask_t kGCFont
Definition GuiTypes.h:301
const Mask_t kKeyShiftMask
Definition GuiTypes.h:196
@ kRaisedFrame
Definition GuiTypes.h:385
@ kSunkenFrame
Definition GuiTypes.h:384
@ kFixedWidth
Definition GuiTypes.h:388
@ kHorizontalFrame
Definition GuiTypes.h:383
@ kFixedHeight
Definition GuiTypes.h:390
@ kOwnBackground
Definition GuiTypes.h:392
const Mask_t kKeyControlMask
Definition GuiTypes.h:198
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:169
const Mask_t kEnterWindowMask
Definition GuiTypes.h:168
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:40
@ 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 b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
cudaEvent_t event
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:70
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:61
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
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
@ kFDSave
static const char * gSaveMacroTypes[]
Definition TGFrame.cxx:135
@ 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 SetIconPixmap
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 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 SetWMPosition
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:142
@ kEditableAct
@ kDropAct
@ kSelectAct
@ kEndEditAct
@ kLayoutHAct
@ kCompactAct
@ kReplaceAct
@ kBreakLayoutAct
@ kCutAct
@ kRedoAct
@ kLeftAct
@ kLayoutVAct
@ kDownAct
@ kUndoAct
@ kSaveAct
@ kGrabAct
@ kPasteAct
@ kNewAct
@ kDeleteAct
@ kCopyAct
@ kGridAct
@ 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:417
static ToolBarData_t gToolBarData[]
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:582
R__EXTERN TVirtualDragManager * gDragManager
#define gVirtualX
Definition TVirtualX.h:379
static Pixmap_t GetPixmap(TImage *timg)
Returns image pixmap.
Definition TASUtils.cxx:135
static std::unique_ptr< TImage > FromWindow(Window_t wid)
Create an image from the given window.
Definition TASUtils.cxx:250
static Pixmap_t GetMask(TImage *timg)
Returns image mask pixmap (alpha channel).
Definition TASUtils.cxx:181
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:2496
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2458
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:440
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:380
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:266
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:454
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:230
TGToolTip * fTip
tool tip associated with button
Definition TGButton.h:79
virtual Bool_t IsDown() const
Definition TGButton.cxx:296
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.
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:381
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:317
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:289
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:994
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1111
virtual TList * GetList() const
Definition TGFrame.h:312
UInt_t GetDefaultWidth() const override
Definition TGFrame.h:314
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1158
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1251
TList * fList
container of frame elements
Definition TGFrame.h:294
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1066
Bool_t IsLayoutBroken() const override
Definition TGFrame.h:359
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:942
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1016
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1037
static TClass * Class()
void SetLayoutBroken(Bool_t on=kTRUE) override
Set broken layout. No Layout method is called.
Definition TGFrame.cxx:1006
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.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
Bool_t fOverwrite
if true overwrite the file with existing name on save
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:315
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition TGFrame.cxx:690
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:333
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:623
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:729
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:599
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:703
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:306
void DoRedraw() override
Redraw the frame.
Definition TGFrame.cxx:424
void MapWindow() override
map window
Definition TGFrame.h:206
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition TGFrame.cxx:297
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:749
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:677
virtual UInt_t GetOptions() const
Definition TGFrame.h:199
void UnmapWindow() override
unmap window
Definition TGFrame.h:208
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:759
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:227
virtual Pixel_t GetBackground() const
Definition TGFrame.h:194
UInt_t GetWidth() const
Definition TGFrame.h:226
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:769
void MapRaised() override
map raised
Definition TGFrame.h:207
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
GContext_t GetGC() const
Definition TGGC.h:41
void SetForeground(Pixel_t v)
Set foreground color.
Definition TGGC.cxx:270
void SetBackground(Pixel_t v)
Set background color.
Definition TGGC.cxx:281
The TGHScrollBar will generate the following event messages: kC_HSCROLL, kSB_SLIDERPOS,...
void SetFrame(TGFrame *frame, Bool_t above) override
Set frame to be resized.
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:387
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:173
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.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:197
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:399
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1851
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1794
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1781
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1599
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.
void SetWindowName(const char *name) override
Set MDI window name (set titlebar title).
virtual Bool_t CloseWindow()
Close MDI frame window.
void DontCallClose()
Typically call this method in the slot connected to the CloseWindow() signal to prevent the calling o...
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
virtual void AddTitle(TGMenuTitle *title, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup via created before menu title.
Definition TGMenu.cxx:431
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.
virtual void CreateDisabledPicture()
Creates disabled picture.
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:81
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:1842
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:1779
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:1721
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1702
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:1804
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1057
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:1667
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:1648
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:987
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:1628
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:71
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
virtual TGShutterItem * AddPage(const char *item="Page")
Add new page (shutter item)
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:54
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:373
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.
void Layout() override
Layout the components of view.
virtual void AddLine(const char *string)
Add a line of text to the view widget.
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:91
virtual void SetId(TGButton *button, Longptr_t id)
changes id for button.
virtual TGButton * GetButton(Int_t id) const
Finds and returns a pointer to the button with the specified identifier id.
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.
void Hide()
Hide tool tip window.
static TClass * Class()
const TGString * GetText() const
Get the tool tip text.
void Reset()
Reset tool tip popup delay timer.
The TGVScrollBar will generate the following event messages: kC_VSCROLL, kSB_SLIDERPOS,...
void SetFrame(TGFrame *frame, Bool_t left) override
Set frame to be resized.
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:376
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Definition TGWindow.cxx:249
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition TGWindow.h:113
virtual void SetName(const char *name)
Definition TGWindow.h:121
virtual void SetEditable(Bool_t on=kTRUE)
Definition TGWindow.h:114
@ kEditDisableLayout
window layout cannot be edited
Definition TGWindow.h:60
@ kEditDisableBtnEnable
window can handle mouse button events
Definition TGWindow.h:64
@ kEditDisable
disable edit of this window
Definition TGWindow.h:57
const TGWindow * GetParent() const
Definition TGWindow.h:83
const char * GetName() const override
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:337
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
Drag and drop manager used by the ROOT GUI Builder.
Bool_t IsLassoDrawn() const
void SetBuilder(TRootGuiBuilder *b)
void SetEditable(Bool_t on=kTRUE) override
Grab server.
Bool_t CanCompact(TGWindow *w) const
kTRUE is frame could be compacted/"laid out"
void SetPropertyEditor(TGuiBldEditor *e)
Helper method.
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.
Bool_t HandleKey(Event_t *) override
Handle key event.
TGFrame * GetSelected() const
Return the current grabbed/selected frame.
The property editor.
void Reset()
Reset the editor.
void RemoveFrame(TGFrame *) override
Remove a frame.
void SetEmbedded(Bool_t e=kTRUE)
void SwitchLayout()
Popup dialog to set layout of edited frame off.
void DoRedraw() override
Redraw builder menu title.
TGuiBldMenuTitle(const TGWindow *p, TGHotString *s, TGPopupMenu *menu)
Bool_t HandleCrossing(Event_t *event) override
Handle crossing events.
~TGuiBldMenuTitle() override
void DrawEntry(TGMenuEntry *entry) override
Draw popup menu entry.
~TGuiBldPopupMenu() override
TGuiBldSaveFrame(const TGWindow *p, UInt_t w, UInt_t h)
void SetList(TList *li)
Bool_t HandleCrossing(Event_t *event) override
Handle crossing events.
void DoRedraw() override
Redraw tool button.
Bool_t IsDown() const override
void SetState(EButtonState state, Bool_t emit=kTRUE) override
Set state of tool bar button and emit a signal according to passed arguments.
TGuiBldToolButton(const TGWindow *p, const TGPicture *pic, Int_t id=-1)
void SetBackgroundColor(Pixel_t bgnd) override
Set background color (override from TGWindow base class).
~TGuiBldToolButton() override
TGuiBldAction * fAction
Definition TGuiBuilder.h:46
An abstract interface to image processing library.
Definition TImage.h:30
virtual UInt_t GetWidth() const
Definition TImage.h:243
virtual UInt_t GetHeight() const
Definition TImage.h:244
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:823
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
Definition TList.cxx:789
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
Mother of all ROOT objects.
Definition TObject.h:42
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:548
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:865
void Hide() override
Hide builder.
virtual Bool_t SaveProject(Event_t *event=nullptr)
Save selected project.
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.
Bool_t HandleKey(Event_t *event) override
Handle keys.
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.
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=nullptr)
Update information shown on the status bar.
friend class TGuiBldDragManager
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.
TGuiBldEditor * fEditor
void EnableLassoButtons(Bool_t on=kTRUE)
Enable toolbar buttons for alignment.
TGuiBldDragManager * fManager
TGFrame * ExecuteAction() override
Execute an action.
virtual void EraseStatusBar()
Clear information shown in the status bar.
static TGFrame * BuildHScrollBar()
Helper method to create TGHScrollBar.
static TGGC * fgBgnd
void CloseWindow() override
Close GUI builder via window manager "Close" button.
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.
~TRootGuiBuilder() override
Destructor.
TRootGuiBuilder(const TGWindow *p=nullptr)
Create GUI builder application.
TGToolBar * fToolBar
virtual void Update()
Update gui builder.
TGMdiFrame * fEditable
virtual Bool_t NewProject(TString type="")
Create a new project.
void AddAction(TGuiBldAction *act, const char *sect) override
Add new action to widget palette.
virtual void HandleWindowClosed(Int_t id)
Handler for closed MDI frame.
TGShutter * fShutter
TGButton * fActionButton
virtual Bool_t OpenProject(Event_t *event=nullptr)
Open new gui builder project.
virtual void MaybeCloseWindow()
Handler before closing MDI frame.
static TGFrame * HSplitter()
Creates new horizontal splitter (TGHSplitter).
TGPopupMenu * fMenuWindow
void AddSection(const char *sect) override
Add new shutter item.
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:137
Ssiz_t Length() const
Definition TString.h:426
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2325
const char * Data() const
Definition TString.h:385
@ kIgnoreCase
Definition TString.h:284
Bool_t IsNull() const
Definition TString.h:423
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:2460
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1078
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:949
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
int main()
Definition main.cpp:18
Event structure.
Definition GuiTypes.h:175
Graphics context structure.
Definition GuiTypes.h:225
Mask_t fMask
bit mask specifying which fields are valid
Definition GuiTypes.h:252
FontH_t fFont
default text font for text operations
Definition GuiTypes.h:243
const char * fPixmap
Definition TGToolBar.h:24
TLine l
Definition textangle.C:4