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 "TGTextEdit.h"
39#include "TGTab.h"
40#include "TGListBox.h"
41#include "TGComboBox.h"
42#include "TGProgressBar.h"
43#include "TVirtualX.h"
44
45/** \class TRootGuiBuilder
46 \ingroup guibuilder
47
48### %ROOT GUI Builder principles
49
50 With the GUI builder, we try to make the next step from WYSIWYG
51 to embedded editing concept - WYSIWYE ("what you see is what you edit").
52 The ROOT GUI Builder allows modifying real GUI objects.
53 For example, one can edit the existing GUI application created by
54 $ROOTSYS/tutorials/visualisation/gui/guitest.C.
55 GUI components can be added to a design area from a widget palette,
56 or can be borrowed from another application.
57 One can drag and and drop TCanvas's menu bar into the application.
58 GUI objects can be resized and dragged, copied and pasted.
59 ROOT GUI Builder allows changing the layout, snap to grid, change object's
60 layout order via the GUI Builder toolbar, or by options in the right-click
61 context menus.
62 A final design can be immediatly tested and used, or saved as a C++ macro.
63 For example, it's possible to rearrange buttons in control bar,
64 add separators etc. and continue to use a new fancy control bar in the
65 application.
66
67
68 The following is a short description of the GUI Builder actions and key shortcuts:
69
70 - Press Ctrl-Double-Click to start/stop edit mode
71 - Press Double-Click to activate quick edit action (defined in root.mimes)
72 - Warning: some shortcuts might not work if NumLock is enabled
73
74### Selection, grabbing, dropping
75
76 It is possible to select, drag any frame and drop it to any frame
77
78 - Click left mouse button or Ctrl-Click to select an object to edit.
79 - Press right mouse button to activate context menu
80 - Multiple selection (grabbing):
81 - draw lasso and press Return key
82 - press Shift key and draw lasso
83 - Dropping:
84 - select frame and press Ctrl-Return key
85 - Changing layout order:
86 - select frame and use arrow keys to change layout order
87 - Alignment:
88 - draw lasso and press arrow keys (or Shift-Arrow key) to align frames
89
90### Key shortcuts
91
92 - Return - grab selected frames
93 - Ctrl-Return - drop frames
94 - Del - delete selected frame
95 - Shift-Del - crop action
96 - Ctrl-X - cut action
97 - Ctrl-C - copy action
98 - Ctrl-V - paste frame into the last clicked position
99 - Ctrl-L - compact
100 - Ctrl-B - enable/disable layout
101 - Ctrl-H - switch horizontal-vertical layout
102 - Ctrl-G - switch on/off grid
103 - Ctrl-S - save action
104 - Ctrl-O - open and execute a ROOT macro file. GUI components created
105 after macro execution will be emebedded to currently edited
106 design area.
107 - Ctrl-N - create new main frame
108
109*/
110
111const char gHelpBuilder[] = "\
112 Start/Stop Edit Mode\n\
113 ************************************************\n\
114 o Select File menu / Edit\n\
115 o Select Start Edit button on the toolbar\n\
116 o Ctrl-Double-Click on the project frame\n\
117 o Double-Click to activate quick edit action (defined in root.mimes)\n\
118\n\
119 Select, Grab, Drop\n\
120 ************************************************\n\
121 It is possible to select & drag any frame and drop it to another frame\n\
122\n\
123 o Press left mouse button Click or Ctrl-Click to select an object.\n\
124 o Press right mouse button to activate context menu\n\
125 o Multiple selection can be done in two ways (grabbing):\n\
126 - draw lasso and press Return key\n\
127 - press Shift key and draw lasso\n\
128 o Dropping:\n\
129 - select frame and press Ctrl-Return key\n\
130 o Changing layout order of widgets:\n\
131 - set broken layout mode via toolbar button or check button\n\
132 \'Layout subframes\' in tab \'Layout\'\n\
133 - select a widget and use arrow keys to change the layout order\n\
134 o Alignment:\n\
135 - remove the selection (if any) by using the space bar\n\
136 - draw lasso and use the four toolbar buttons for widget alignment\n\
137 - arrow keys align the frames too, if you prefer the keyboard\n\
138\n\
139 Key shortcuts\n\
140 ************************************************\n\
141 o Return - grab selected frames\n\
142 o Ctrl-Return - drop frames\n\
143 o Del - delete selected frame\n\
144 o Shift-Del - crop\n\
145 o Ctrl-X - cut\n\
146 o Ctrl-C - copy\n\
147 o Ctrl-V - paste frame into the last clicked position\n\
148 o Ctrl-L - compact frame\n\
149 o Ctrl-B - enable/disable layout\n\
150 o Ctrl-H - switch Horizontal-Vertical layout\n\
151 o Ctrl-G - switch ON/OFF grid\n\
152 o Ctrl-S - save\n\
153 o Ctrl-O - open and execute ROOT macro file\n\
154 o Ctrl-N - create new main frame\n\
155 o Ctrl-Z - undo last action (not implemented)\n\
156 o Shift-Ctrl-Z - redo (not implemented)\n\
157\n\
158 More information\n\
159 ************************************************\n\
160\n\
161For more information, please see:\n\
162\n\
163 https://root.cern.ch/doc/master/group__guibuilder.html\n\
164\n\
165";
166
167const char gHelpAboutBuilder[] = "\
168 ROOT Gui Builder\n\
169\n\
170************************************************************\n\
171* Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *\n\
172* All rights reserved. *\n\
173* *\n\
174* For the licensing terms see $ROOTSYS/LICENSE. *\n\
175* For the list of contributors see $ROOTSYS/README/CREDITS.*\n\
176************************************************************\n\
177";
178
179//----- Toolbar stuff...
180
182 { "bld_edit.png", "Start Edit (Ctrl-Dbl-Click)", kFALSE, kEditableAct, 0 },
183 { "", "", kFALSE, -1, 0 },
184 { "bld_new.png", "New (Ctrl-N)", kFALSE, kNewAct, 0 },
185 { "bld_open.png", "Open (Ctrl-O)", kFALSE, kOpenAct, 0 },
186 { "bld_save.png", "Save As (Ctrl-S)", kFALSE, kSaveAct, 0 },
187 { "", "", kFALSE, -1, 0 },
188// { "bld_pointer.xpm", "Selector (Ctrl-Click)", kTRUE, kSelectAct, 0 },
189// { "bld_grab.xpm", "Grab Selected Frames (Return)", kTRUE, kGrabAct, 0 },
190 { "", "", kFALSE, -1, 0 },
191 { "bld_compact.png", "Compact selected frame (Ctrl-L)", kFALSE, kCompactAct, 0 },
192 { "bld_break.png", "Disable/Enable layout (Ctrl-B)", kFALSE, kBreakLayoutAct, 0 },
193 { "bld_hbox.png", "Layout selected frame horizontally (Ctrl-H)", kFALSE, kLayoutHAct, 0 },
194 { "bld_vbox.png", "Layout selected frame vertically (Ctrl-H)", kFALSE, kLayoutVAct, 0 },
195 { "bld_grid.png", "On/Off grid (Ctrl+G)", kFALSE, kGridAct, 0 },
196 { "", "", kFALSE, -1, 0 },
197 { "bld_AlignTop.png", "Align selected frames to the top line of lasso (Up Arrow)", kFALSE, kUpAct, 0 },
198 { "bld_AlignBtm.png", "Align selected frames to the down line of lasso (Down Arrow)", kFALSE, kDownAct, 0 },
199 { "bld_AlignLeft.png", "Align selected frames to the left line of lasso (Left Arrow)", kFALSE, kLeftAct, 0 },
200 { "bld_AlignRight.png", "Align selected frames to the right line of lasso (Right Arrow)", kFALSE, kRightAct, 0 },
201 { "", "", kFALSE, -1, 0 },
202 { "bld_cut.png", "Cut (Ctrl-X)", kFALSE, kCutAct, 0 },
203 { "bld_copy.png", "Copy (Ctrl-C)", kFALSE, kCopyAct, 0 },
204 { "bld_paste.png", "Paste frame into the last clicked position (Ctrl-V)", kFALSE, kPasteAct, 0 },
205// { "bld_paste_into.png", "Paste with replacing of selected frame (Ctrl-R)", kFALSE, kReplaceAct, 0 },
206 { "bld_delete.png", "Delete (Del/Backspace)", kFALSE, kDeleteAct, 0 },
207 { "bld_crop.png", "Crop (Shift-Del)", kFALSE, kCropAct, 0 },
208// { "", "", kFALSE, -1, 0 },
209// { "bld_undo.png", "Undo (Ctrl-Z)", kFALSE, kUndoAct, 0 },
210// { "bld_redo.png", "Redo (Shift-Ctrl-Z)", kFALSE, kRedoAct, 0 },
211 { 0, 0, kFALSE, 0, 0 }
212};
213
214
215
216
220
221
222////////////////////////////////////////////////////////////////////////////////
223//
224// Here are few experimental GUI classes which give a nice&fancy appearence
225// to GuiBuilder.
226//
227////////////////////////////////////////////////////////////////////////////////
228
229////////////////////////////////////////////////////////////////////////////////
231
232private:
234
235protected:
236 void DoRedraw() override;
237
238public:
239 ~TGuiBldMenuTitle() override {}
247
248 Bool_t HandleCrossing(Event_t *event) override;
249};
250
251////////////////////////////////////////////////////////////////////////////////
252/// Handle crossing events.
253
255{
256 if (event->fType == kEnterNotify) {
258 } else {
260 }
261 DoRedraw();
262 return kTRUE;
263}
264
265////////////////////////////////////////////////////////////////////////////////
266/// Redraw builder menu title.
267
269{
271
272 int x, y, max_ascent, max_descent;
273 x = y = 4;
274
275 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
276
277 if (fState) {
279 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
280 gVirtualX->SetForeground(fNormGC, GetForeground());
282 } else {
283 gVirtualX->SetForeground(fNormGC, fBgndColor);
284 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
285 gVirtualX->SetForeground(fNormGC, GetForeground());
287 }
289 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
290 0, 0, GetWidth()-1, GetHeight()-1);
291 }
292}
293
294
295////////////////////////////////////////////////////////////////////////////////
297
298public:
299 ~TGuiBldPopupMenu() override { }
306 void DrawEntry(TGMenuEntry *entry) override;
307};
308
309////////////////////////////////////////////////////////////////////////////////
310/// Draw popup menu entry.
311
313{
314 FontStruct_t font;
316
317 if (entry->GetStatus() & kMenuHideMask)
318 return;
319
320 if (entry->GetStatus() & kMenuDefaultMask) {
321 font = fHifontStruct;
322 gcval.fMask = kGCFont;
323 gcval.fFont = gVirtualX->GetFontHandle(font);
324 gVirtualX->ChangeGC(fNormGC, &gcval);
325 gVirtualX->ChangeGC(fSelGC, &gcval);
326 } else {
327 font = fFontStruct;
328 }
329
330 UInt_t tw = 0;
331 UInt_t sep = fEntrySep;
333 gVirtualX->GetFontProperties(font, max_ascent, max_descent);
334 if (entry->GetShortcut())
335 tw = 7 + gVirtualX->TextWidth(fFontStruct, entry->GetShortcutText(),
336 entry->GetShortcut()->Length());
337
338 Int_t tx = entry->GetEx() + fXl;
339 Int_t ty = entry->GetEy() + max_ascent + 2;
340 UInt_t h = max_ascent + max_descent + sep;
341 Int_t picposy = 0;
342 if (entry->GetPic() != 0) {
343 picposy = entry->GetEy() + h / 2;
344 picposy -= entry->GetPic()->GetHeight() / 2;
345 }
346
347 switch (entry->GetType()) {
348 case kMenuPopup:
349 case kMenuLabel:
350 case kMenuEntry:
351 if ((entry->GetStatus() & kMenuActiveMask) &&
352 entry->GetType() != kMenuLabel) {
353 if (entry->GetStatus() & kMenuEnableMask) {
354 gVirtualX->FillRectangle(fId,
356 entry->GetEx()+1, entry->GetEy(),
357 fMenuWidth-6, h - 1);
358 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
359 entry->GetEx()+ 1, entry->GetEy()-1,
360 fMenuWidth - entry->GetEx()- 6, h - 1);
361 }
362
363 if (entry->GetType() == kMenuPopup) {
364 DrawTrianglePattern(fSelGC, fMenuWidth-10, entry->GetEy() + 3,
365 fMenuWidth-6, entry->GetEy() + 11);
366 }
367
368 if (entry->GetStatus() & kMenuCheckedMask) {
369 DrawCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
370 entry->GetEy()+11);
371 }
372
373 if (entry->GetStatus() & kMenuRadioMask) {
374 DrawRCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
375 entry->GetEy()+11);
376 }
377
378 if (entry->GetPic() != 0) {
379 entry->GetPic()->Draw(fId, fSelGC, 8, picposy);
380 }
381
382 entry->GetLabel()->Draw(fId,
383 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
384 GetShadowGC()(), tx, ty);
385 if (entry->GetShortcut())
386 entry->GetShortcut()->Draw(fId,
387 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
388 GetShadowGC()(), fMenuWidth - tw, ty);
389 } else {
390 if ( entry->GetType() != kMenuLabel) {
391 gVirtualX->FillRectangle(fId,
393 entry->GetEx()+1, entry->GetEy()-1, tx-4, h);
394
395 gVirtualX->FillRectangle(fId,
397 tx-1, entry->GetEy()-1, fMenuWidth-tx-1, h);
398 } else { // we need some special background for labels
399 gVirtualX->FillRectangle(fId, TGFrame::GetBckgndGC()(),
400 entry->GetEx()+1, entry->GetEy()-1,
401 fMenuWidth - entry->GetEx()- 3, h);
402 }
403
404 if (entry->GetType() == kMenuPopup) {
406 fMenuWidth-6, entry->GetEy() + 11);
407 }
408
409 if (entry->GetStatus() & kMenuCheckedMask) {
410 DrawCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
411 entry->GetEy()+11);
412 }
413
414 if (entry->GetStatus() & kMenuRadioMask) {
415 DrawRCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
416 entry->GetEy()+11);
417 }
418
419 if (entry->GetPic() != 0) {
420 entry->GetPic()->Draw(fId, fNormGC, 8, picposy);
421 }
422
423 if (entry->GetStatus() & kMenuEnableMask) {
424 entry->GetLabel()->Draw(fId, fNormGC, tx, ty);
425 if (entry->GetShortcut())
426 entry->GetShortcut()->Draw(fId, fNormGC, fMenuWidth - tw, ty);
427 } else {
428 entry->GetLabel()->Draw(fId, GetHilightGC()(), tx+1, ty+1);
429 entry->GetLabel()->Draw(fId, GetShadowGC()(), tx, ty);
430 if (entry->GetShortcut()) {
431 entry->GetShortcut()->Draw(fId, GetHilightGC()(),
432 fMenuWidth - tw+1, ty+1);
433 entry->GetShortcut()->Draw(fId, GetShadowGC()(),
434 fMenuWidth - tw, ty);
435 }
436 }
437 }
438 break;
439
440 case kMenuSeparator:
441 gVirtualX->FillRectangle(fId, TRootGuiBuilder::GetBgndGC()->GetGC(),
442 entry->GetEx()+1, entry->GetEy()-1,
443 tx-4, 4);
444 gVirtualX->DrawLine(fId, TGFrame::GetBlackGC()(), tx+1,
445 entry->GetEy()+1, fMenuWidth-sep,
446 entry->GetEy()+1);
447 break;
448 }
449
450 // restore font
451 if (entry->GetStatus() & kMenuDefaultMask) {
452 gcval.fFont = gVirtualX->GetFontHandle(fFontStruct);
453 gVirtualX->ChangeGC(fNormGC, &gcval);
454 gVirtualX->ChangeGC(fSelGC, &gcval);
455 }
456}
457
458////////////////////////////////////////////////////////////////////////////////
460
461private:
463
464protected:
465 void DoRedraw() override;
466
467public:
468 ~TGuiBldToolButton() override { }
474
475 Bool_t IsDown() const override { return (fOptions & kSunkenFrame); }
476 void SetState(EButtonState state, Bool_t emit = kTRUE) override;
477 Bool_t HandleCrossing(Event_t *event) override;
479};
480
481////////////////////////////////////////////////////////////////////////////////
482/// Redraw tool button.
483
485{
486 int x = (fWidth - fTWidth) >> 1;
487 int y = (fHeight - fTHeight) >> 1;
488 UInt_t w = GetWidth() - 1;
489 UInt_t h = GetHeight()- 1;
490
492
495 ++x; ++y;
496 w--; h--;
497 }
498
499 const TGPicture *pic = fPic;
500 if (fState == kButtonDisabled) {
502 pic = fPicD ? fPicD : fPic;
503 }
505 x--; y--;
506 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(), 0, 0, w, h);
507 }
508 pic->Draw(fId, fNormGC, x, y);
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Handle crossing events.
513
515{
516 if (fTip) {
517 if (event->fType == kEnterNotify) {
518 fTip->Reset();
519 } else {
520 fTip->Hide();
521 }
522 }
523
524 if ((event->fType == kEnterNotify) && (fState != kButtonDisabled)) {
526 } else {
528 }
529 if (event->fType == kLeaveNotify) {
533 }
534 DoRedraw();
535
536 return kTRUE;
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Set state of tool bar button and emit a signal according
541/// to passed arguments.
542
544{
545 Bool_t was = !IsDown();
546
547 if (state != fState) {
548 switch (state) {
549 case kButtonEngaged:
550 case kButtonDown:
553 break;
554 case kButtonDisabled:
555 case kButtonUp:
558 break;
559 }
560 fState = state;
561 DoRedraw();
562 if (emit) EmitSignals(was);
563 }
564}
565
566////////////////////////////////////////////////////////////////////////////////
567////////////////////////////////////////////////////////////////////////////////
568/// Create GUI builder application.
569
571 TGMainFrame(p ? p : gClient->GetDefaultRoot(), 1, 1)
572{
574 gGuiBuilder = this;
575 fManager = 0;
576 fEditor = 0;
577 fActionButton = 0;
578 fClosing = 0;
579
580 if (gDragManager) {
582 } else {
584 }
585 fManager->SetBuilder(this);
586
587 fMenuBar = new TGMdiMenuBar(this, 10, 10);
589 InitMenu();
590
592 kLHintsExpandX, 0,0,2,2));
593
594 fToolDock = new TGDockableFrame(this);
596 fToolDock->SetWindowName("GuiBuilder ToolBar");
597
601
602 int spacing = 8;
603
604 for (int i = 0; gToolBarData[i].fPixmap; i++) {
605 if (strlen(gToolBarData[i].fPixmap) == 0) {
606 spacing = 8;
607 continue;
608 }
609
610 const TGPicture *pic = fClient->GetPicture(gToolBarData[i].fPixmap);
612 gToolBarData[i].fId);
613 pb->SetStyle(gClient->GetStyle());
614
615 pb->SetToolTipText(gToolBarData[i].fTipText);
616
617 TGToolTip *tip = pb->GetToolTip();
618 tip->SetDelay(200);
619
620 tip->Connect("Reset()", "TRootGuiBuilder", this, "UpdateStatusBar(=0)");
621 tip->Connect("Hide()", "TRootGuiBuilder", this, "EraseStatusBar()");
622
623 fToolBar->AddButton(this, pb, spacing);
624 spacing = 0;
625
626 if (gToolBarData[i].fId == kEditableAct) {
628 continue;
629 }
630
631 if ((gToolBarData[i].fId == kUndoAct) ||
632 (gToolBarData[i].fId == kRedoAct)) {
633 pb->SetState(kButtonDisabled);
634 }
635 }
636
637 fToolBar->Connect("Clicked(Int_t)", "TGuiBldDragManager", fManager,
638 "HandleAction(Int_t)");
639
641 kLHintsExpandX, 0,0,2,5));
642
643 TGCompositeFrame *cf = new TGHorizontalFrame(this, 1, 1);
645
646 //fShutterDock = new TGDockableFrame(cf);
647 //cf->AddFrame(fShutterDock, new TGLayoutHints(kLHintsNormal ));
648 //fShutterDock->SetWindowName("Widget Factory");
649 //fShutterDock->EnableUndock(kTRUE);
650 //fShutterDock->EnableHide(kTRUE);
651 //fShutterDock->DockContainer();
652
656
658 splitter->SetFrame(fShutter, kTRUE);
660
661 fMain = new TGMdiMainFrame(cf, fMenuBar, 1, 1);
662 fMain->Connect("FrameClosed(Int_t)", "TRootGuiBuilder", this,
663 "HandleWindowClosed(Int_t)");
664
665 TQObject::Connect("TGMdiFrame", "CloseWindow()", "TRootGuiBuilder", this,
666 "MaybeCloseWindow()");
667
669
671
672 const TGPicture *pbg = fClient->GetPicture("bld_bg.png");
673 if (pbg) {
674 fMain->GetContainer()->SetBackgroundPixmap(pbg->GetPicture());
675 }
676
677 if (fManager) {
678 fEditor = new TGuiBldEditor(cf);
682 }
683
684 AddSection("Projects");
685 AddSection("Buttons");
686 AddSection("Containers");
687 AddSection("Bars");
688 AddSection("Input");
689 AddSection("Complex Input");
690 AddSection("Display");
691 AddSection("Dialogs");
692
693 // create an empty section
694 AddSection("User's Macros");
695 TGShutterItem *item = fShutter->GetItem("User's Macros");
696 TGCompositeFrame *cont = (TGCompositeFrame *)item->GetContainer();
697 cont->SetBackgroundColor(TColor::Number2Pixel(18));
698
699 TGuiBldAction *act = new TGuiBldAction("TGMainFrame", "Empty Frame",
701 act->fAct = "empty";
702 act->fPic = "bld_mainframe.xpm";
703 AddAction(act, "Projects");
704
705 act = new TGuiBldAction("TGMainFrame", "Horizontal Frame", kGuiBldProj);
706 act->fAct = "horizontal";
707 act->fPic = "bld_mainframe.xpm";
708 AddAction(act, "Projects");
709
710 act = new TGuiBldAction("TGMainFrame", "Vertical Frame", kGuiBldProj);
711 act->fAct = "vertical";
712 act->fPic = "bld_mainframe.xpm";
713 AddAction(act, "Projects");
714
715 // Standard
716 act = new TGuiBldAction("TGTextButton", "Text Button", kGuiBldCtor);
717 act->fAct = "new TGTextButton()";
718 act->fPic = "bld_textbutton.xpm";
719 AddAction(act, "Buttons");
720
721 act = new TGuiBldAction("TGCheckButton", "Check Button", kGuiBldCtor);
722 act->fAct = "new TGCheckButton()";
723 act->fPic = "bld_checkbutton.xpm";
724 AddAction(act, "Buttons");
725
726 act = new TGuiBldAction("TGRadioButton", "Radio Button", kGuiBldCtor);
727 act->fAct = "new TGRadioButton()";
728 act->fPic = "bld_radiobutton.xpm";
729 AddAction(act, "Buttons");
730
731 act = new TGuiBldAction("TGPictureButton", "Picture Button", kGuiBldCtor);
732 act->fAct = "new TGPictureButton()";
733 act->fPic = "bld_image.xpm";
734 AddAction(act, "Buttons");
735
736 act = new TGuiBldAction("TGTextEntry", "Text Entry", kGuiBldCtor);
737 act->fAct = "new TGTextEntry()";
738 act->fPic = "bld_entry.xpm";
739 AddAction(act, "Input");
740
741 act = new TGuiBldAction("TGTextEdit", "Text Edit", kGuiBldCtor);
742 act->fAct = "TRootGuiBuilder::BuildTextEdit()";
743 act->fPic = "bld_text.xpm";
744 AddAction(act, "Input");
745
746 act = new TGuiBldAction("TGNumberEntry", "Number Entry", kGuiBldCtor);
747 act->fAct = "new TGNumberEntry()";
748 act->fPic = "bld_numberentry.xpm";
749 AddAction(act, "Input");
750
751 act = new TGuiBldAction("TGComboBox", "Combo Box", kGuiBldCtor);
752 act->fAct = "TRootGuiBuilder::BuildComboBox()";
753 act->fPic = "bld_combobox.xpm";
754 AddAction(act, "Input");
755
756 act = new TGuiBldAction("TGListBox", "List Box", kGuiBldCtor);
757 act->fAct = "TRootGuiBuilder::BuildListBox()";
758 act->fPic = "bld_listbox.xpm";
759 AddAction(act, "Input");
760
761 act = new TGuiBldAction("TGHSlider", "Horizontal Slider", kGuiBldCtor);
762 act->fAct = "new TGHSlider()";
763 act->fPic = "bld_hslider.xpm";
764 AddAction(act, "Input");
765
766 act = new TGuiBldAction("TGVSlider", "Vertical Slider", kGuiBldCtor);
767 act->fAct = "new TGVSlider()";
768 act->fPic = "bld_vslider.xpm";
769 AddAction(act, "Input");
770
771 act = new TGuiBldAction("TGHScrollBar", "HScrollbar", kGuiBldCtor);
772 act->fAct = "TRootGuiBuilder::BuildHScrollBar()";
773 act->fPic = "bld_hscrollbar.xpm";
774 AddAction(act, "Input");
775
776 act = new TGuiBldAction("TGVScrollBar", "VScrollbar", kGuiBldCtor);
777 act->fAct = "TRootGuiBuilder::BuildVScrollBar()";
778 act->fPic = "bld_vscrollbar.xpm";
779 AddAction(act, "Input");
780
781 act = new TGuiBldAction("TGListTree", "List Tree", kGuiBldCtor);
782 act->fAct = "TRootGuiBuilder::BuildListTree()";
783 act->fPic = "bld_listtree.xpm";
784 AddAction(act, "Complex Input");
785
786 act = new TGuiBldAction("TGLabel", "Text Label", kGuiBldCtor);
787 act->fAct = "new TGLabel()";
788 act->fPic = "bld_label.xpm";
789 AddAction(act, "Display");
790
791 act = new TGuiBldAction("TGIcon", "Icon", kGuiBldCtor);
792 act->fAct = "new TGIcon()";
793 act->fPic = "bld_image.xpm";
794 AddAction(act, "Display");
795
796 act = new TGuiBldAction("TGHorizontal3DLine", "Horizontal Line",
798 act->fAct = "TRootGuiBuilder::BuildH3DLine()";
799 act->fPic = "bld_hseparator.xpm";
800 AddAction(act, "Display");
801
802 act = new TGuiBldAction("TGVertical3DLine", "Vertical Line", kGuiBldCtor);
803 act->fAct = "TRootGuiBuilder::BuildV3DLine()";
804 act->fPic = "bld_vseparator.xpm";
805 AddAction(act, "Display");
806
807 act = new TGuiBldAction("TGStatusBar", "Status Bar", kGuiBldCtor);
808 act->fAct = "new TGStatusBar()";
809 act->fPic = "bld_statusbar.xpm";
811 AddAction(act, "Bars");
812
813 act = new TGuiBldAction("TGHProgressBar", "HProgress Bar", kGuiBldCtor);
814 act->fAct = "TRootGuiBuilder::BuildHProgressBar()";
815 act->fPic = "bld_hprogressbar.xpm";
816 AddAction(act, "Display");
817
818 act = new TGuiBldAction("TGVProgressBar", "VProgress Bar", kGuiBldCtor);
819 act->fAct = "TRootGuiBuilder::BuildVProgressBar()";
820 act->fPic = "bld_vprogressbar.xpm";
821 AddAction(act, "Display");
822
823 act = new TGuiBldAction("TRootEmbeddedCanvas", "Embed Canvas", kGuiBldCtor);
824 act->fAct = "new TRootEmbeddedCanvas()";
825 act->fPic = "bld_embedcanvas.xpm";
826 AddAction(act, "Display");
827
828 // Containers
829 act = new TGuiBldAction("TGHorizontalFrame", "Horizontal Frame",
831 act->fAct = "new TGHorizontalFrame(0,200,100)";
832 act->fPic = "bld_hbox.xpm";
833 AddAction(act, "Containers");
834
835 act = new TGuiBldAction("TGVerticalFrame", "Vertical Frame", kGuiBldCtor);
836 act->fAct = "new TGVerticalFrame(0,100,200)";
837 act->fPic = "bld_vbox.xpm";
838 AddAction(act, "Containers");
839
840 act = new TGuiBldAction("TGGroupFrame", "Group Frame", kGuiBldCtor);
841 act->fAct = "new TGGroupFrame()";
842 act->fPic = "bld_groupframe.xpm";
843 AddAction(act, "Containers");
844
845 act = new TGuiBldAction("TGTab", "Tabbed Frame", kGuiBldCtor);
846 act->fAct = "TRootGuiBuilder::BuildTab()";
847 act->fPic = "bld_tab.xpm";
848 AddAction(act, "Containers");
849
850 act = new TGuiBldAction("TGShutter", "Shutter", kGuiBldCtor);
851 act->fAct = "TRootGuiBuilder::BuildShutter()";
852 act->fPic = "bld_shutter.png";
853 AddAction(act, "Containers");
854
855
856 act = new TGuiBldAction("TGCanvas", "Scrolled Canvas", kGuiBldCtor);
857 act->fAct = "TRootGuiBuilder::BuildCanvas()";
858 act->fPic = "bld_canvas.xpm";
859 AddAction(act, "Containers");
860/*
861 act = new TGuiBldAction("TGVSplitter", "Horizontal Panes", kGuiBldFunc);
862 act->fAct = "TRootGuiBuilder::VSplitter()";
863 act->fPic = "bld_hpaned.xpm";
864 AddAction(act, "Containers");
865
866 act = new TGuiBldAction("TGHSplitter", "Vertical Panes", kGuiBldFunc);
867 act->fAct = "TRootGuiBuilder::HSplitter()";
868 act->fPic = "bld_vpaned.xpm";
869 AddAction(act, "Containers");
870*/
871 act = new TGuiBldAction("TGColorSelect", "Color Selector", kGuiBldFunc);
872 act->fAct = "new TGColorSelect()";
873 act->fPic = "bld_colorselect.xpm";
874 AddAction(act, "Dialogs");
875
877
878 fStatusBar = new TGStatusBar(this, 40, 10);
880 0, 0, 3, 0));
881
883 SetEditDisabled(kEditDisable); // disable editting to all subframes
884
886
887 Int_t qq;
888 UInt_t ww;
889 UInt_t hh;
890 gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);
891 MoveResize(100, 100, ww - 200, hh - 200);
892 SetWMPosition(100, 100);
893
894 SetWindowName("ROOT GuiBuilder");
895 SetIconName("ROOT GuiBuilder");
896 fIconPic = SetIconPixmap("bld_rgb.xpm");
897 SetClassHints("ROOT", "GuiBuilder");
898
899 fSelected = 0;
900 Update();
901
902 fMenuFile->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
903 "HandleMenu(Int_t)");
904 fMenuWindow->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
905 "HandleMenu(Int_t)");
906 fMenuHelp->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
907 "HandleMenu(Int_t)");
908
909 // doesn't work properly on Windows...
910 if (gVirtualX->InheritsFrom("TGX11"))
911 BindKeys();
912 UpdateStatusBar("Ready");
913 MapRaised();
914
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// Destructor.
920
922{
923 if (fIconPic) gClient->FreePicture(fIconPic);
924 delete fMenuFile;
925 delete fMenuWindow;
926 delete fMenuHelp;
927 gGuiBuilder = 0;
928}
929
930////////////////////////////////////////////////////////////////////////////////
931/// Close GUI builder via window manager "Close" button.
932
934{
935 TGWindow *root = (TGWindow*)fClient->GetRoot();
936 if (root) root->SetEditable(kFALSE);
937
938 fEditor->Reset();
939
940 if (fMain->GetNumberOfFrames() == 0) {
944 } else {
948 }
949
951 if (btn) {
953 }
954 fClosing = 1;
955 fMain->CloseAll();
956 if (fClosing == -1) {
957 fClosing = 0;
958 return;
959 }
961 Hide();
962}
963
964////////////////////////////////////////////////////////////////////////////////
965/// Find action by name
966
968{
969 if (!name || !sect) return 0;
970
972 if (!item) return 0;
973
974 TGCompositeFrame *cont = (TGCompositeFrame *)item->GetContainer();
977
978 TIter next(cont->GetList());
979 TGLabel *lb;
980 TGButton *btn;
981
982 while ((fe = (TGFrameElement*)next())) {
983 hf = (TGHorizontalFrame*)fe->fFrame;
984 btn = (TGButton*)((TGFrameElement*)hf->GetList()->First())->fFrame;
985 lb = (TGLabel*)((TGFrameElement*)hf->GetList()->Last())->fFrame;
986 if (*(lb->GetText()) == name) {
987 return (TGButton*)btn;
988 }
989 }
990 return 0;
991}
992
993////////////////////////////////////////////////////////////////////////////////
994/// Add new action to widget palette.
995
997{
998 if (!act || !sect) return;
999
1001 TGButton *btn = 0;
1002
1003 if (!item) return;
1004 TGCompositeFrame *cont = (TGCompositeFrame *)item->GetContainer();
1005 cont->SetBackgroundColor(TColor::Number2Pixel(18));
1006
1007 const TGPicture *pic = 0;
1008 if (!act->fPicture) {
1009 act->fPicture = fClient->GetPicture(act->fPic);
1010 }
1011 pic = act->fPicture;
1012
1014
1015 if (pic) {
1016 btn = new TGPictureButton(hf, pic);
1017 } else {
1018 btn = new TGTextButton(hf, act->GetName());
1019 }
1020
1021 btn->SetToolTipText(act->GetTitle(), 200);
1022 btn->SetUserData((void*)act);
1023 btn->Connect("Clicked()", "TRootGuiBuilder", this, "HandleButtons()");
1024
1025 hf->AddFrame(btn, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1026
1027 TGLabel *lb = new TGLabel(hf, act->fType != kGuiBldMacro ? act->GetTitle() :
1028 act->GetName());
1029 lb->SetBackgroundColor(cont->GetBackground());
1030 hf->AddFrame(lb, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1031 hf->SetBackgroundColor(cont->GetBackground());
1032
1033 // disable edit
1034 cont->SetEditDisabled(kEditDisable);
1035 hf->SetEditDisabled(kEditDisable);
1036
1037 cont->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 2, 2, 2, 0));
1038 cont->MapSubwindows();
1039 cont->Resize(); // invoke Layout()
1040}
1041
1042////////////////////////////////////////////////////////////////////////////////
1043/// Add new shutter item.
1044
1046{
1047 static int id = 10000;
1049 id++);
1051 item->Connect("Selected()", "TRootGuiBuilder", this, "HandleMenu(=3)");
1052}
1053
1054////////////////////////////////////////////////////////////////////////////////
1055/// Handle buttons in the GUI builder's widget palette.
1056
1058{
1059 TGFrame *parent;
1060
1061 if (fActionButton) {
1062 parent = (TGFrame*)fActionButton->GetParent();
1063 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1064 fClient->NeedRedraw(parent, kTRUE);
1065 }
1066
1067 if (!fClient->IsEditable()) {
1069 }
1070
1073 parent = (TGFrame*)fActionButton->GetParent();
1074
1075 parent->ChangeOptions(parent->GetOptions() | kSunkenFrame);
1076 fClient->NeedRedraw(parent, kTRUE);
1077
1078 if (act) {
1079 fAction = act;
1082 }
1083}
1084
1085////////////////////////////////////////////////////////////////////////////////
1086/// Execute an action.
1087
1089{
1090 if (!fAction || fAction->fAct.IsNull()) return 0;
1091
1092 TGFrame *ret = 0;
1093
1094 if (!fClient->IsEditable() && (fAction->fType != kGuiBldMacro)) {
1095 TGMdiFrame *current = fMain->GetCurrent();
1096 if (current) current->SetEditable(kTRUE);
1097 }
1098
1099 TString s = "";
1100
1101 switch (fAction->fType) {
1102 case kGuiBldProj:
1103 s = fAction->fAct.Data();
1104 NewProject(s);
1105 fAction = 0;
1106 break;
1107 case kGuiBldMacro:
1108 {
1109 TGWindow *root = (TGWindow*)fClient->GetRoot();
1110 if (root) root->SetEditable(kFALSE);
1111 gROOT->Macro(fAction->fAct.Data());
1112 if (root) root->SetEditable(kTRUE);
1113 fAction = 0;
1114 break;
1115 }
1116 default:
1117 ret = (TGFrame *)gROOT->ProcessLineFast(fAction->fAct.Data());
1118 break;
1119 }
1120
1121 Update();
1122
1123 return ret;
1124}
1125
1126////////////////////////////////////////////////////////////////////////////////
1127/// Inititiate GUI Builder menus.
1128
1130{
1132 fMenuFile->AddEntry(new TGHotString("&Edit (Ctrl+double-click)"),
1134 fClient->GetPicture("bld_edit.png"));
1135 fMenuFile->AddEntry(new TGHotString("&Stop (Ctrl+double-click)"),
1137 fClient->GetPicture("bld_stop.png"));
1141 fMenuFile->AddEntry(new TGHotString("&New Project"), kGUIBLD_FILE_NEW,
1142 0, fClient->GetPicture("bld_new.png"));
1144 0, fClient->GetPicture("bld_open.png"));
1146 0, fClient->GetPicture("bld_delete.png"));
1147 fMenuFile->AddEntry(new TGHotString("&Save project as"), kGUIBLD_FILE_SAVE,
1148 0, fClient->GetPicture("bld_save.png"));
1152 0, fClient->GetPicture("bld_exit.png"));
1153/*
1154 fMenuEdit = new TGuiBldPopupMenu();
1155 fMenuEdit->AddSeparator();
1156 fMenuEdit->AddEntry(new TGHotString("&Preferences ..."), kGUIBLD_EDIT_PREF);
1157*/
1159 fMenuWindow->AddEntry(new TGHotString("Tile &Horizontally"),
1161 fMenuWindow->AddEntry(new TGHotString("Tile &Vertically"),
1163 fMenuWindow->AddEntry(new TGHotString("&Cascade"),
1166 //fMenuWindow->AddPopup(new TGHotString("&Windows"), fMain->GetWinListMenu());
1167 fMenuWindow->AddEntry(new TGHotString("&Arrange icons"),
1170 fMenuWindow->AddEntry(new TGHotString("&Opaque resize"),
1173
1178 //fMenuHelp->AddSeparator();
1179 //fMenuHelp->AddEntry(new TGHotString("&Send Bug Report"),kGUIBLD_HELP_BUG);
1180
1181 TGMenuBar *bar = fMenuBar->GetMenuBar();
1182
1183 TGuiBldMenuTitle *title;
1184 title = new TGuiBldMenuTitle(bar, new TGHotString("&File"), fMenuFile);
1185 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1186
1187 //title = new TGuiBldMenuTitle(bar, new TGHotString("&Edit"), fMenuEdit);
1188 //bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1189
1190 title = new TGuiBldMenuTitle(bar, new TGHotString("&Windows"), fMenuWindow);
1191 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1192
1193 title = new TGuiBldMenuTitle(bar, new TGHotString("&Help"), fMenuHelp);
1194 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsRight,4,4,0,0));
1195
1198}
1199
1200////////////////////////////////////////////////////////////////////////////////
1201/// Set selected frame.
1202
1204{
1205 fSelected = f;
1206 Update();
1207}
1208
1209////////////////////////////////////////////////////////////////////////////////
1210/// Enable toolbar buttons for alignment.
1211
1213{
1214 TGButton *btn = 0;
1215
1217 if (btn) {
1218 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1219 }
1220
1222 if (btn) {
1223 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1224 }
1225
1227 if (btn) {
1228 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1229 }
1230
1232 if (btn) {
1233 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1234 }
1235
1237 if (btn) {
1238 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1239 }
1240
1242 if (btn) {
1243 btn->SetState(kButtonUp);
1244 }
1245
1247 if (btn) {
1248 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1249 }
1250
1251}
1252
1253////////////////////////////////////////////////////////////////////////////////
1254/// Enable/disable toolbar buttons according to the selected frame.
1255
1257{
1259
1260 TGButton *btn = 0;
1261
1262 if (!fSelected) {
1264 if (btn) btn->SetState(kButtonDisabled);
1265
1267 if (btn) btn->SetState(kButtonDisabled);
1268
1270 if (btn) btn->SetState(kButtonDisabled);
1271
1273 if (btn) btn->SetState(kButtonDisabled);
1274 return;
1275 }
1276
1277 Bool_t comp = kFALSE;
1278 TGLayoutManager *lm = 0;
1279 Bool_t hor = kFALSE;
1280 Bool_t fixed = kFALSE;
1281 Bool_t enable = on;
1283
1285 lm = ((TGCompositeFrame*)fSelected)->GetLayoutManager();
1286 comp = kTRUE;
1287 hor = lm && lm->InheritsFrom(TGHorizontalLayout::Class());
1290 } else {
1291 enable = kFALSE;
1292 }
1293
1295 if (btn) btn->SetState(enable && comp && !fixed && !compact_disable ?
1297
1299 if (btn) {
1300 btn->SetState(enable && comp && !hor && !fixed ? kButtonUp :
1302 }
1303
1305 if (btn) {
1306 btn->SetState(enable && comp && hor && !fixed ? kButtonUp :
1308 }
1309
1311 if (btn) {
1312 btn->SetState(enable && comp && !fixed ? kButtonUp : kButtonDisabled);
1313 }
1314/*
1315 btn = fToolBar->GetButton(kGrabAct);
1316 if (btn) {
1317 btn->SetState(enable && comp ? kButtonDown : kButtonUp);
1318 TGToolTip *tt = btn->GetToolTip();
1319 tt->SetText(btn->IsDown() ? "Drop Frames (Ctrl-Return)" :
1320 "Grab Selected Frames (Return)");
1321 }
1322*/
1323}
1324
1325////////////////////////////////////////////////////////////////////////////////
1326/// Enable/disable toolbar buttons according to the selected frame.
1327
1329{
1330 TGButton *btn = 0;
1331
1333
1335 if (btn) {
1336 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1337 }
1338
1340 if (btn) {
1341 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1342 }
1343
1345 if (btn) {
1346 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1347 }
1348
1350 if (btn) {
1351 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1352 }
1353
1355 if (btn) {
1356 btn->SetState(!on || !fManager->IsPasteFrameExist() ?
1358 }
1359
1361 if (btn) {
1362 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1363 }
1364
1366 if (btn) {
1367 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1368 }
1369}
1370
1371////////////////////////////////////////////////////////////////////////////////
1372/// Update gui builder.
1373
1375{
1376 if (!fManager) {
1377 return;
1378 }
1379
1384 fManager->GetSelected() ||
1386
1387 if (fActionButton) {
1388 TGFrame *parent = (TGFrame*)fActionButton->GetParent();
1389 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1390 fClient->NeedRedraw(parent, kTRUE);
1391 }
1392
1393 if (!fClient->IsEditable()) {
1394 UpdateStatusBar("");
1397 fEditable = 0;
1398 //fShutter->SetSelectedItem(fShutter->GetItem("Projects"));
1399 } else {
1402 }
1403
1405 fActionButton = 0;
1406}
1407
1408////////////////////////////////////////////////////////////////////////////////
1409/// Return the status of the selected mode.
1410
1412{
1413 TGButton *btn = 0;
1415
1416 if (!btn) return kFALSE;
1417
1418 return btn->IsDown();
1419}
1420
1421////////////////////////////////////////////////////////////////////////////////
1422/// Return the status of the grab mode.
1423
1425{
1427
1428 if (!btn) return kFALSE;
1429
1430 return btn->IsDown();
1431}
1432
1433////////////////////////////////////////////////////////////////////////////////
1435
1436public:
1439 void SetList(TList *li) { fList = li; }
1440};
1441
1442static const char *gSaveMacroTypes[] = {
1443 "Macro files", "*.[C|c]*",
1444 "All files", "*",
1445 0, 0
1446};
1447
1448////////////////////////////////////////////////////////////////////////////////
1449/// Handle keys.
1450
1452{
1453 if (event->fType == kGKeyPress) {
1454 UInt_t keysym;
1455 char str[2];
1456 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1457
1458 if (event->fState & kKeyControlMask) {
1459 if (str[0] == 19) { // ctrl-s
1460 if (fMain->GetCurrent()) {
1461 return SaveProject(event);
1462 } else {
1463 return kFALSE; //TGMainFrame::HandleKey(event);
1464 }
1465 } else if (str[0] == 14) { //ctrl-n
1466 return NewProject(); //event not needed
1467 } else if (str[0] == 15) { // ctrl-o
1468 return OpenProject(event);
1469 }
1470 }
1471 fManager->HandleKey(event);
1472 return TGMainFrame::HandleKey(event);
1473 }
1474 return kTRUE;
1475}
1476
1477////////////////////////////////////////////////////////////////////////////////
1478/// Create a new project.
1479
1481{
1482 TGWindow *root = (TGWindow*)fClient->GetRoot();
1483
1484 if (root) root->SetEditable(kFALSE);
1485 fEditable = new TGMdiFrame(fMain, 500, 400, kOwnBackground);
1489 fEditable->SetEditDisabled(0); // enable editting
1493
1494 if (type == "horizontal") {
1497 kLHintsExpandY, 1, 1, 1, 1));
1498 hor->SetEditable(kTRUE);
1504 fEditable->Layout();
1505 }
1506 else if (type == "vertical") {
1509 kLHintsExpandY,1,1,1,1));
1510 vert->SetEditable(kTRUE);
1516 fEditable->Layout();
1517
1518 } else {
1520 }
1525
1526
1528 return kTRUE;
1529}
1530
1531////////////////////////////////////////////////////////////////////////////////
1532/// Open new gui builder project.
1533
1535{
1536
1538 if (btn) {
1539 btn->SetBackgroundColor(GetBgnd());
1541 }
1542
1543 TGFileInfo fi;
1544 static TString dir(".");
1545 static Bool_t overwr = kFALSE;
1546 TString fname;
1547
1548 fi.fFileTypes = gSaveMacroTypes;
1549 fi.SetIniDir(dir);
1550 fi.fOverwrite = overwr;
1551 TGWindow *root = (TGWindow*)fClient->GetRoot();
1552 root->SetEditable(kFALSE);
1553
1554 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
1555
1556 if (!fi.fFilename) {
1557 root->SetEditable(kTRUE);
1558 return kFALSE;
1559 }
1560
1561 dir = fi.fIniDir;
1562 overwr = fi.fOverwrite;
1563 fname = fi.fFilename;
1564
1565 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1566 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1567 NewProject(); // create new project
1568 gROOT->Macro(fname.Data()); // put content of the macro as child frame
1569 } else {
1570 Int_t retval;
1571 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1572 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1574 &retval);
1575
1576 if (retval == kMBRetry) {
1577 OpenProject(event);
1578 }
1579 }
1580
1584
1585 return kTRUE;
1586}
1587
1588////////////////////////////////////////////////////////////////////////////////
1589/// Save selected project.
1590
1592{
1594 if (btn) {
1595 btn->SetBackgroundColor(GetBgnd());
1597 }
1598
1600 if (!savfr) return kFALSE;
1601
1602 static TImage *img = 0;
1603
1604 if (!img) {
1605 img = TImage::Create();
1606 }
1607 img->FromWindow(savfr->GetParent()->GetId());
1608
1609 TGWindow *root = (TGWindow*)fClient->GetRoot();
1610 TGFileInfo fi;
1611 static TString dir(".");
1612 static Bool_t overwr = kFALSE;
1613 TString fname;
1614 root->SetEditable(kFALSE);
1615
1616 fi.fFileTypes = gSaveMacroTypes;
1617 fi.SetIniDir(dir);
1618 fi.fOverwrite = overwr;
1619
1620 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
1621
1622 if (!fi.fFilename) {
1623 root->SetEditable(kTRUE);
1625 return kFALSE;
1626 }
1627
1628 dir = fi.fIniDir;
1629 overwr = fi.fOverwrite;
1630 fname = gSystem->UnixPathName(fi.fFilename);
1631
1632 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1633 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1635 savfr->GetWidth(),
1636 savfr->GetHeight());
1637 TList *list = main->GetList();
1638 TString name = savfr->GetName();
1639 savfr->SetName(main->GetName());
1640 main->SetList(savfr->GetList());
1641 main->SetLayoutBroken(savfr->IsLayoutBroken());
1642 main->SaveSource(fname.Data(), "keep_names");
1643 savfr->SetWindowName(fname.Data());
1644 main->SetList(list);
1645
1646 main->SetMWMHints(kMWMDecorAll, kMWMFuncAll,
1648 main->SetWMSize(main->GetWidth(), main->GetHeight());
1649 main->SetWMSizeHints(main->GetDefaultWidth(), main->GetDefaultHeight(),
1650 10000, 10000, 0, 0);
1651 main->SetWindowName(fname.Data());
1652 main->SetIconName(fname.Data());
1653 main->SetClassHints(fname.Data(), fname.Data());
1654 // some problems here under win32
1655 if (gVirtualX->InheritsFrom("TGX11")) main->SetIconPixmap("bld_rgb.xpm");
1656
1657 savfr->SetName(name.Data());
1658
1659 AddMacro(fname.Data(), img);
1660 delete main;
1661 } else {
1662 Int_t retval;
1663 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1664 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1666 &retval);
1667 if (retval == kMBRetry) {
1668 SaveProject(event);
1669 }
1671 }
1673 return kTRUE;
1674}
1675
1676////////////////////////////////////////////////////////////////////////////////
1677/// Add macro to "User's Macros" section
1678/// Input img must be static - do not delete it.
1679
1681{
1682 if (!img || !img->GetWidth() || !img->GetHeight()) {
1683 return;
1684 }
1685
1686 UInt_t w = 100;
1687 Float_t ratio = Float_t(w)/img->GetWidth();
1688 Float_t rh = img->GetHeight()*ratio;
1689 UInt_t h = UInt_t(rh);
1690 img->Scale(w, h);
1691 img->Merge(img, "overlay");
1692
1693 static int i = 0;
1695 TString::Format("%s;%d", macro, i++),
1696 img->GetPixmap(),img->GetMask());
1697 const char *name = gSystem->BaseName(macro);
1698
1699 TGButton *btn = FindActionButton(name, "User's Macros");
1700 TGuiBldAction *act = 0;
1701
1702 if (!btn) {
1704 act->fAct = macro;
1705 act->fPic = macro;
1706 act->fPicture = pic;
1707
1708 AddAction(act, "User's Macros");
1709 } else {
1710 act = (TGuiBldAction*)btn->GetUserData();
1711 act->fAct = macro;
1712 act->fPic = macro;
1713 act->fPicture = pic;
1714
1715 if (btn->InheritsFrom(TGPictureButton::Class())) {
1716 btn->Resize(w, h);
1717 fClient->FreePicture(((TGPictureButton*)btn)->GetPicture());
1718 ((TGPictureButton*)btn)->SetPicture(pic);
1719 }
1720 }
1722}
1723
1724////////////////////////////////////////////////////////////////////////////////
1725/// Find the editable frame.
1726
1728{
1729 const TGWindow *parent = win;
1730 TGMdiFrame *ret = 0;
1731
1732 while (parent && (parent != fClient->GetDefaultRoot())) {
1733 if (parent->InheritsFrom(TGMdiFrame::Class())) {
1734 ret = (TGMdiFrame*)parent;
1735 return ret;
1736 }
1737 parent = parent->GetParent();
1738 }
1739 return 0;
1740}
1741
1742////////////////////////////////////////////////////////////////////////////////
1743/// Switch image of toolbar edit button according to the current state.
1744
1746{
1747 static const TGPicture *start = fClient->GetPicture("bld_edit.png");
1748 static const TGPicture *stop = fClient->GetPicture("bld_stop.png");
1749
1750 if (fClient->IsEditable()) {
1752 fStartButton->SetPicture(stop);
1754 fStartButton->SetToolTipText("Stop Edit (Ctrl-Dbl-Click)");
1755 } else {
1756 if (fMain->GetNumberOfFrames() < 1) {
1758 } else {
1760 fStartButton->SetPicture(start);
1762 fStartButton->SetToolTipText("Start Edit (Ctrl-Dbl-Click)");
1763 }
1764 }
1765
1767}
1768
1769////////////////////////////////////////////////////////////////////////////////
1770/// Handle menu items.
1771
1773{
1774 TGWindow *root = (TGWindow*)fClient->GetRoot();
1776
1777 switch (id) {
1778 case kGUIBLD_FILE_START:
1779 if (fClient->IsEditable()) {
1780 break;
1781 }
1783 if (fEditable) {
1785 } //else if (!fMain->GetCurrent()) {
1786 //NewProject();
1787 //}
1788 UpdateStatusBar("Start edit");
1792 break;
1793
1794 case kGUIBLD_FILE_STOP:
1795 if (!fClient->IsEditable()) {
1796 break;
1797 }
1799
1800 if (fEditable) {
1801 root->SetEditable(kFALSE);
1802
1803 UpdateStatusBar("Stop edit");
1806 fEditable = 0;
1808 }
1809 fEditor->Reset();
1810 break;
1811
1812 case kGUIBLD_FILE_NEW:
1813 NewProject();
1815 break;
1816
1817 case kGUIBLD_FILE_CLOSE:
1819 if (fEditable && (fEditable == fMain->GetCurrent())) {
1820 root->SetEditable(kFALSE);
1821 }
1822 fEditor->Reset();
1823 UpdateStatusBar("");
1825
1826 if (fMain->GetNumberOfFrames() <= 1) {
1830 }
1831
1832 if (fClient->IsEditable()) {
1835 } else {
1838 }
1840 break;
1841
1842 case kGUIBLD_FILE_EXIT:
1843 CloseWindow();
1844 break;
1845
1846 case kGUIBLD_FILE_OPEN:
1847 OpenProject();
1849 break;
1850
1851 case kGUIBLD_FILE_SAVE:
1852 SaveProject();
1854 break;
1855
1856 case kGUIBLD_WINDOW_HOR:
1858 break;
1859
1862 break;
1863
1865 fMain->Cascade();
1866 break;
1867
1870 break;
1871
1876 } else {
1879 }
1880 break;
1882 root->SetEditable(kFALSE);
1883 hd = new TRootHelpDialog(this, "Help on Gui Builder...", 600, 400);
1884 hd->SetText(gHelpBuilder);
1885 hd->SetEditDisabled();
1886 hd->Popup();
1887 root->SetEditable(kTRUE);
1888 break;
1889
1890 case kGUIBLD_HELP_ABOUT:
1891 root->SetEditable(kFALSE);
1892 hd = new TRootHelpDialog(this, "About Gui Builder...", 520, 160);
1893 hd->SetEditDisabled();
1894 hd->SetText(gHelpAboutBuilder);
1895 hd->Popup();
1896 root->SetEditable(kTRUE);
1897 break;
1898
1899 default:
1900 fMain->SetCurrent(id);
1901 break;
1902 }
1903}
1904
1905////////////////////////////////////////////////////////////////////////////////
1906/// Handler before closing MDI frame.
1907
1909{
1910 int retval;
1911 if (fClosing == -1)
1912 return;
1915 new TGMsgBox(gClient->GetDefaultRoot(), this,
1916 "Closing project", "Do you want to save the project before closing?",
1918
1920 if (retval == kMBYes) {
1921 SaveProject();
1922 }
1923 if (retval == kMBCancel) {
1924 fClosing = -1;
1925 if (!fClient->IsEditable())
1927 return;
1928 }
1930 mdiframe->CloseWindow();
1931}
1932
1933////////////////////////////////////////////////////////////////////////////////
1934/// Handler for closed MDI frame.
1935
1959
1960////////////////////////////////////////////////////////////////////////////////
1961/// Update information shown on the status bar.
1962
1964{
1965 if (!fStatusBar) return;
1966
1967 const char *text = 0;
1968
1969 if (!txt) {
1970 TObject *o = (TObject *)gTQSender;
1971
1972 if (o && o->InheritsFrom(TGToolTip::Class())) {
1973 TGToolTip *tip = (TGToolTip*)o;
1974 text = tip->GetText()->Data();
1975 }
1976 } else {
1977 text = txt;
1978 }
1980}
1981
1982////////////////////////////////////////////////////////////////////////////////
1983/// Clear information shown in the status bar.
1984
1986{
1987 if (!fStatusBar) return;
1988
1989 fStatusBar->SetText("");
1990}
1991
1992////////////////////////////////////////////////////////////////////////////////
1993/// Keyboard key binding.
1994
1996{
1997 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_a),
1999
2000 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_n),
2002
2003 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_o),
2005
2006 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2008
2009 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2010 0, kTRUE);
2011
2012 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2014
2015 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2016 0, kTRUE);
2017
2018 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_x),
2020
2021 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_c),
2023
2024 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_v),
2026
2027 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_r),
2029
2030 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2032
2033 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2035
2036 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_b),
2038
2039 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_l),
2041
2042 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_g),
2044
2045 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_h),
2047
2048 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2049 0, kTRUE);
2050
2051 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2052 0, kTRUE);
2053
2054 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Space),
2055 0, kTRUE);
2056
2057 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2058 0, kTRUE);
2059
2060 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2061 0, kTRUE);
2062
2063 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2064 0, kTRUE);
2065
2066 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2067 0, kTRUE);
2068
2069 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2071
2072 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2074
2075 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2077
2078 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2080
2081 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2083
2084 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2086}
2087
2088////////////////////////////////////////////////////////////////////////////////
2089/// Create new vertical splitter (TGVSplitter).
2090
2092{
2094 ret->SetCleanup(kDeepCleanup);
2096 kFixedWidth);
2097 ret->AddFrame(v1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
2098 //v1->SetEditDisabled(kEditDisableGrab);
2099
2101 splitter->SetFrame(v1, kTRUE);
2103 splitter->SetEditDisabled(kEditDisableBtnEnable);
2104
2106 v2->ChangeOptions(kSunkenFrame);
2109 //v2->SetEditDisabled(kEditDisableGrab);
2110 ret->SetEditDisabled(kEditDisableLayout);
2111
2112 ret->MapSubwindows();
2113 ret->SetLayoutBroken(kFALSE);
2114 return ret;
2115}
2116
2117////////////////////////////////////////////////////////////////////////////////
2118/// Creates new horizontal splitter (TGHSplitter).
2119
2121{
2123 ret->SetCleanup(kDeepCleanup);
2125 kFixedHeight);
2126 ret->AddFrame(v1, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
2127 //v1->SetEditDisabled(kEditDisableGrab);
2128
2130 splitter->SetFrame(v1, kTRUE);
2132 splitter->SetEditDisabled(kEditDisable);
2133
2134 TGHorizontalFrame *v2 = new TGHorizontalFrame(ret, 10, 10);
2135 v2->ChangeOptions(kSunkenFrame);
2138 //v2->SetEditDisabled(kEditDisableGrab);
2139 ret->SetEditDisabled(kEditDisableLayout);
2140
2141 ret->MapSubwindows();
2142 ret->SetLayoutBroken(kFALSE);
2143 return ret;
2144}
2145
2146////////////////////////////////////////////////////////////////////////////////
2147/// Hide builder.
2148
2150{
2151 //fMain->CloseAll();
2152 UnmapWindow();
2153}
2154
2155////////////////////////////////////////////////////////////////////////////////
2156/// Return default background color.
2157
2159{
2161
2162 static ULong_t gPixel = 0;
2163
2164 if (gPixel) return gPixel;
2165
2166 Float_t r, g, b;
2167
2168 r = 232./255;
2169 g = 232./255;
2170 b = 222./255;
2171
2173 return gPixel;
2174}
2175
2176////////////////////////////////////////////////////////////////////////////////
2177/// Return background GC.
2178
2180{
2181 if (fgBgnd) return fgBgnd;
2182
2184
2185 Pixel_t back = GetBgnd();
2186 fgBgnd->SetBackground(back);
2187 fgBgnd->SetForeground(back);
2188
2189 return fgBgnd;
2190}
2191
2192////////////////////////////////////////////////////////////////////////////////
2193/// Set a background color to frame and all its subframes.
2194
2196{
2197 if (!frame) return;
2198
2199 frame->SetBackgroundColor(color);
2200 if (!frame->InheritsFrom(TGCompositeFrame::Class())) return;
2201
2202 TIter next(((TGCompositeFrame*)frame)->GetList());
2204
2205 while ((fe = (TGFrameElement*)next())) {
2206 if (fe->fFrame->GetBackground() == TGFrame::GetWhitePixel()) {
2207 continue;
2208 }
2209 PropagateBgndColor(fe->fFrame, color);
2210 }
2211}
2212
2213////////////////////////////////////////////////////////////////////////////////
2214/// Return background color for popup menus.
2215
2217{
2219
2220 static ULong_t gPixel = 0;
2221
2222 if (gPixel) return gPixel;
2223
2224 Float_t r, g, b;
2225
2226 r = 250./255;
2227 g = 250./255;
2228 b = 250./255;
2229
2231
2232 return gPixel;
2233}
2234
2235////////////////////////////////////////////////////////////////////////////////
2236/// Return background GC for popup menus.
2237
2239{
2240 if (fgBgndPopup) return fgBgndPopup;
2241
2243
2244 Pixel_t back = GetPopupBgnd();
2245 fgBgndPopup->SetBackground(back);
2246 fgBgndPopup->SetForeground(back);
2247
2248 return fgBgndPopup;
2249}
2250
2251////////////////////////////////////////////////////////////////////////////////
2252/// Return highlighted color for popup menu entry.
2253
2255{
2257
2258 static ULong_t gPixel = 0;
2259
2260 if (gPixel) return gPixel;
2261
2262 Float_t r, g, b;
2263
2264 r = 120./255;
2265 g = 120./255;
2266 b = 222./255;
2267
2269
2270 return gPixel;
2271}
2272
2273////////////////////////////////////////////////////////////////////////////////
2274/// Return background GC for highlighted popup menu entry.
2275
2277{
2279
2281
2282 Pixel_t back = GetPopupHlght();
2283 fgBgndPopupHlght->SetBackground(back);
2284 fgBgndPopupHlght->SetForeground(back);
2285
2286 return fgBgndPopupHlght;
2287}
2288
2289////////////////////////////////////////////////////////////////////////////////
2290/// Return style popup menu.
2291
2296
2297////////////////////////////////////////////////////////////////////////////////
2298/// Helper method used in guibuilding
2299
2301{
2302 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2303 TGListTree *lt = new TGListTree(canvas, kHorizontalFrame);
2304 lt->AddItem(0, "Entry 1");
2305 lt->AddItem(0, "Entry 2");
2306 lt->AddItem(0, "Entry 3");
2307 lt->AddItem(0, "Entry 4");
2308 lt->AddItem(0, "Entry 5");
2309 canvas->Resize(100, 60);
2310 canvas->MapSubwindows();
2311
2312 return canvas;
2313}
2314
2315////////////////////////////////////////////////////////////////////////////////
2316/// Helper method used in guibuilding to create TGCanvas widget
2317
2319{
2320 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2322 200, 200, kHorizontalFrame |
2324
2325 cont->SetCleanup(kDeepCleanup);
2326 cont->SetLayoutManager(new TGTileLayout(cont, 8));
2327 cont->AddFrame(new TGTextButton(cont, "Button1"));
2328 cont->AddFrame(new TGTextButton(cont, "Button2"));
2329 cont->AddFrame(new TGTextButton(cont, "Button3"));
2330 cont->AddFrame(new TGTextButton(cont, "Button4"));
2331
2332 canvas->SetContainer(cont);
2333 return canvas;
2334}
2335
2336////////////////////////////////////////////////////////////////////////////////
2337/// Helper method used in guibuilding to create TGShutter widget
2338
2340{
2343 const TGPicture *buttonpic;
2345
2347 TGShutter *shut = new TGShutter();
2348
2349 item = shut->AddPage("Histograms");
2350 container = (TGCompositeFrame *)item->GetContainer();
2351 buttonpic = gClient->GetPicture("h1_s.xpm");
2352
2353 if (buttonpic) {
2355 button->SetToolTipText("TH1");
2356 container->AddFrame(button, l);
2357 }
2358 buttonpic = gClient->GetPicture("h2_s.xpm");
2359
2360 if (buttonpic) {
2362 button->SetToolTipText("TH2");
2363 container->AddFrame(button, l);
2364 }
2365 buttonpic = gClient->GetPicture("h3_s.xpm");
2366
2367 if (buttonpic) {
2369 button->SetToolTipText("TH3");
2370 container->AddFrame(button, l);
2371 }
2372 buttonpic = gClient->GetPicture("profile_s.xpm");
2373
2374 if (buttonpic) {
2376 button->SetToolTipText("TProfile");
2377 container->AddFrame(button, l);
2378 }
2379
2380 // new page
2381 item = shut->AddPage("Functions");
2382 container = (TGCompositeFrame *)item->GetContainer();
2383 buttonpic = gClient->GetPicture("f1_s.xpm");
2384
2385 if (buttonpic) {
2387 button->SetToolTipText("TF1");
2388 container->AddFrame(button, l);
2389 }
2390 buttonpic = gClient->GetPicture("f2_s.xpm");
2391
2392 if (buttonpic) {
2394 button->SetToolTipText("TF2");
2395 container->AddFrame(button, l);
2396 }
2397
2398 // new page
2399 item = shut->AddPage("Trees");
2400 container = (TGCompositeFrame *)item->GetContainer();
2401 buttonpic = gClient->GetPicture("ntuple_s.xpm");
2402
2403 if (buttonpic) {
2405 button->SetToolTipText("TNtuple");
2406 container->AddFrame(button, l);
2407 }
2408 buttonpic = gClient->GetPicture("tree_s.xpm");
2409
2410 if (buttonpic) {
2412 button->SetToolTipText("TTree");
2413 container->AddFrame(button, l);
2414 }
2415 buttonpic = gClient->GetPicture("chain_s.xpm");
2416
2417 if (buttonpic) {
2419 button->SetToolTipText("TChain");
2420 container->AddFrame(button, l);
2421 }
2422
2423 shut->MapSubwindows();
2424 return shut;
2425}
2426
2427////////////////////////////////////////////////////////////////////////////////
2428/// Helper method to create TGTextEdit widget
2429
2431{
2432 TGTextEdit *te = new TGTextEdit();
2433
2434 te->AddLine("all work and no play makes jack a pretty");
2435 te->AddLine("dull boy. all work and no play makes jack");
2436 te->AddLine("a pretty dull boy. all work and no play ");
2437 te->AddLine("makes jack a pretty dull boy. all work");
2438 te->AddLine("and no play makes jack a pretty dull boy.");
2439
2440 te->MapSubwindows();
2441 te->Layout();
2442 te->Resize(100, 60);
2443
2444 return te;
2445}
2446
2447////////////////////////////////////////////////////////////////////////////////
2448/// Helper method to create TGTab widget
2449
2451{
2452 TGTab *tab = new TGTab();
2453
2454 tab->AddTab("Tab1");
2455 tab->AddTab("Tab2");
2456 tab->MapSubwindows();
2457
2458 return tab;
2459}
2460
2461////////////////////////////////////////////////////////////////////////////////
2462/// Helper method to create TGListBox widget
2463
2465{
2466 TGListBox *lb = new TGListBox();
2467
2468 lb->AddEntry("Entry 1", 0);
2469 lb->AddEntry("Entry 2", 1);
2470 lb->AddEntry("Entry 3", 2);
2471 lb->AddEntry("Entry 4", 3);
2472 lb->AddEntry("Entry 5", 4);
2473 lb->AddEntry("Entry 6", 5);
2474 lb->AddEntry("Entry 7", 6);
2475 lb->MapSubwindows();
2476
2477 lb->Resize(100,100);
2478
2479 return lb;
2480}
2481
2482////////////////////////////////////////////////////////////////////////////////
2483/// Helper method to create TGComboBox widget
2484
2486{
2487 TGComboBox *cb = new TGComboBox();
2488
2489 cb->AddEntry("Entry 1 ", 0);
2490 cb->AddEntry("Entry 2 ", 1);
2491 cb->AddEntry("Entry 3 ", 2);
2492 cb->AddEntry("Entry 4 ", 3);
2493 cb->AddEntry("Entry 5 ", 4);
2494 cb->AddEntry("Entry 6 ", 5);
2495 cb->AddEntry("Entry 7 ", 6);
2496 cb->MapSubwindows();
2497
2500 gVirtualX->GetFontProperties(fs, max_ascent, max_descent);
2501
2502 cb->Resize(cb->GetListBox()->GetDefaultWidth(), max_ascent+max_descent+7);
2503 return cb;
2504}
2505
2506////////////////////////////////////////////////////////////////////////////////
2507/// Helper method to create TGHorizontal3DLine widget.
2508
2510{
2511 TGHorizontal3DLine *l = new TGHorizontal3DLine(0, 100, 2);
2512 l->Resize(100, 2);
2513
2514 return l;
2515}
2516
2517////////////////////////////////////////////////////////////////////////////////
2518/// Helper method to create TGVertical3DLine widget.
2519
2521{
2523 l->Resize(2, 100);
2524
2525 return l;
2526}
2527
2528////////////////////////////////////////////////////////////////////////////////
2529/// Helper method to create TGHScrollBar
2530
2532{
2533 TGHScrollBar *b = new TGHScrollBar();
2534
2535 b->Resize(100, b->GetDefaultHeight());
2536 b->SetRange(100, 20);
2537 b->MapSubwindows();
2538
2539 return b;
2540}
2541
2542////////////////////////////////////////////////////////////////////////////////
2543/// Helper method to create TGVScrollBar
2544
2546{
2547 TGVScrollBar *b = new TGVScrollBar();
2548
2549 b->Resize(b->GetDefaultWidth(), 100);
2550 b->MapSubwindows();
2551 b->SetRange(100, 20);
2552
2553 return b;
2554}
2555
2556////////////////////////////////////////////////////////////////////////////////
2557/// Helper method to create TGHProgressBar
2558
2560{
2562
2563 b->Resize(100, b->GetDefaultHeight());
2564 b->SetPosition(25);
2565 b->Format("%.2f");
2566 b->SetFillType(TGProgressBar::kBlockFill);
2567
2568 return b;
2569}
2570
2571////////////////////////////////////////////////////////////////////////////////
2572/// Helper method to create TGVProgressBar
2573
2575{
2577
2578 b->Resize(b->GetDefaultWidth(), 100);
2579 b->SetPosition(25);
2580 b->SetFillType(TGProgressBar::kBlockFill);
2581
2582 return b;
2583}
2584
2585
@ kGKeyPress
Definition GuiTypes.h:60
@ kEnterNotify
Definition GuiTypes.h:61
@ kLeaveNotify
Definition GuiTypes.h:61
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kKeyPressMask
Definition GuiTypes.h:159
const Mask_t kGCFont
Definition GuiTypes.h:300
const Mask_t kKeyShiftMask
Definition GuiTypes.h:195
@ kRaisedFrame
Definition GuiTypes.h:384
@ kSunkenFrame
Definition GuiTypes.h:383
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
@ kFixedHeight
Definition GuiTypes.h:389
@ kOwnBackground
Definition GuiTypes.h:391
const Mask_t kKeyControlMask
Definition GuiTypes.h:197
const Mask_t kLeaveWindowMask
Definition GuiTypes.h:168
const Mask_t kEnterWindowMask
Definition GuiTypes.h:167
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
@ kKey_Right
Definition KeySymbols.h:42
@ kKey_Down
Definition KeySymbols.h:43
@ kKey_o
Definition KeySymbols.h:172
@ kKey_Space
Definition KeySymbols.h:93
@ kKey_Up
Definition KeySymbols.h:41
@ kKey_Return
Definition KeySymbols.h:30
@ kKey_r
Definition KeySymbols.h:175
@ kKey_v
Definition KeySymbols.h:179
@ kKey_l
Definition KeySymbols.h:169
@ kKey_Delete
Definition KeySymbols.h:33
@ kKey_x
Definition KeySymbols.h:181
@ kKey_Left
Definition KeySymbols.h:40
@ kKey_Backspace
Definition KeySymbols.h:29
@ kKey_z
Definition KeySymbols.h:183
@ kKey_g
Definition KeySymbols.h:164
@ kKey_Enter
Definition KeySymbols.h:31
@ kKey_c
Definition KeySymbols.h:160
@ kKey_a
Definition KeySymbols.h:158
@ kKey_h
Definition KeySymbols.h:165
@ kKey_b
Definition KeySymbols.h:159
@ kKey_n
Definition KeySymbols.h:171
int main()
Definition Prototype.cxx:12
#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
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:134
@ 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:110
@ 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:411
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:572
R__EXTERN TVirtualDragManager * gDragManager
#define gVirtualX
Definition TVirtualX.h:337
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:2483
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2445
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:439
virtual void * GetUserData() const
Definition TGButton.h:108
virtual void EmitSignals(Bool_t wasUp)
Emit button signals.
Definition TGButton.cxx:379
UInt_t fTWidth
button width
Definition TGButton.h:73
UInt_t fTHeight
button height
Definition TGButton.h:74
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:453
TGToolTip * fTip
tool tip associated with button
Definition TGButton.h:79
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:233
Bool_t IsEditable() const
Definition TGClient.h:89
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:223
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:288
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:380
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:316
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 AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
virtual TList * GetList() const
Definition TGFrame.h:312
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1156
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1249
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:1064
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:940
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1014
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1035
static TClass * Class()
void SetLayoutBroken(Bool_t on=kTRUE) override
Set broken layout. No Layout method is called.
Definition TGFrame.cxx:1004
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.
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:313
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition TGFrame.cxx:688
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:331
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:621
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:727
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:597
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:701
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:304
void DoRedraw() override
Redraw the frame.
Definition TGFrame.cxx:422
void MapWindow() override
map window
Definition TGFrame.h:206
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition TGFrame.cxx:295
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:747
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:675
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:757
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:227
UInt_t GetWidth() const
Definition TGFrame.h:226
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:767
void MapRaised() override
map raised
Definition TGFrame.h:207
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
The TGHScrollBar will generate the following event messages: kC_HSCROLL, kSB_SLIDERPOS,...
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
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
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:197
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:1850
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1793
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1780
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1598
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).
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
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 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:80
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
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:1841
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:1778
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:1720
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1701
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:1803
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1056
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:1666
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:1647
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:986
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:1627
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)
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.
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
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.
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 Hide()
Hide tool tip window.
static TClass * Class()
void Reset()
Reset tool tip popup delay timer.
The TGVScrollBar will generate the following event messages: kC_VSCROLL, kSB_SLIDERPOS,...
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:246
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition TGWindow.h:113
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:334
UInt_t fEditDisabled
flags used for "guibuilding"
Definition TGWindow.h:32
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:29
static TImage * Create()
Create an image.
Definition TImage.cxx:34
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
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).
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
@ kIgnoreCase
Definition TString.h:285
Bool_t IsNull() const
Definition TString.h:422
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:2384
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1073
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:944
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
UInt_t fState
key or button mask
Definition GuiTypes.h:181
Graphics context structure.
Definition GuiTypes.h:224
TLine l
Definition textangle.C:4