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
216
217
221
222
223////////////////////////////////////////////////////////////////////////////////
224//
225// Here are few experimental GUI classes which give a nice&fancy appearence
226// to GuiBuilder.
227//
228////////////////////////////////////////////////////////////////////////////////
229
230////////////////////////////////////////////////////////////////////////////////
232
233private:
235
236protected:
237 void DoRedraw() override;
238
239public:
240 ~TGuiBldMenuTitle() override {}
248
249 Bool_t HandleCrossing(Event_t *event) override;
250};
251
252////////////////////////////////////////////////////////////////////////////////
253/// Handle crossing events.
254
256{
257 if (event->fType == kEnterNotify) {
259 } else {
261 }
262 DoRedraw();
263 return kTRUE;
264}
265
266////////////////////////////////////////////////////////////////////////////////
267/// Redraw builder menu title.
268
270{
272
273 int x, y, max_ascent, max_descent;
274 x = y = 4;
275
276 gVirtualX->GetFontProperties(fFontStruct, max_ascent, max_descent);
277
278 if (fState) {
280 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
281 gVirtualX->SetForeground(fNormGC, GetForeground());
283 } else {
284 gVirtualX->SetForeground(fNormGC, fBgndColor);
285 gVirtualX->FillRectangle(fId,fNormGC, 0, 0, fWidth, fHeight);
286 gVirtualX->SetForeground(fNormGC, GetForeground());
288 }
290 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
291 0, 0, GetWidth()-1, GetHeight()-1);
292 }
293}
294
295
296////////////////////////////////////////////////////////////////////////////////
298
299public:
300 ~TGuiBldPopupMenu() override { }
307 void DrawEntry(TGMenuEntry *entry) override;
308};
309
310////////////////////////////////////////////////////////////////////////////////
311/// Draw popup menu entry.
312
314{
315 FontStruct_t font;
317
318 if (entry->GetStatus() & kMenuHideMask)
319 return;
320
321 if (entry->GetStatus() & kMenuDefaultMask) {
322 font = fHifontStruct;
323 gcval.fMask = kGCFont;
324 gcval.fFont = gVirtualX->GetFontHandle(font);
325 gVirtualX->ChangeGC(fNormGC, &gcval);
326 gVirtualX->ChangeGC(fSelGC, &gcval);
327 } else {
328 font = fFontStruct;
329 }
330
331 UInt_t tw = 0;
332 UInt_t sep = fEntrySep;
334 gVirtualX->GetFontProperties(font, max_ascent, max_descent);
335 if (entry->GetShortcut())
336 tw = 7 + gVirtualX->TextWidth(fFontStruct, entry->GetShortcutText(),
337 entry->GetShortcut()->Length());
338
339 Int_t tx = entry->GetEx() + fXl;
340 Int_t ty = entry->GetEy() + max_ascent + 2;
341 UInt_t h = max_ascent + max_descent + sep;
342 Int_t picposy = 0;
343 if (entry->GetPic() != 0) {
344 picposy = entry->GetEy() + h / 2;
345 picposy -= entry->GetPic()->GetHeight() / 2;
346 }
347
348 switch (entry->GetType()) {
349 case kMenuPopup:
350 case kMenuLabel:
351 case kMenuEntry:
352 if ((entry->GetStatus() & kMenuActiveMask) &&
353 entry->GetType() != kMenuLabel) {
354 if (entry->GetStatus() & kMenuEnableMask) {
355 gVirtualX->FillRectangle(fId,
357 entry->GetEx()+1, entry->GetEy(),
358 fMenuWidth-6, h - 1);
359 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(),
360 entry->GetEx()+ 1, entry->GetEy()-1,
361 fMenuWidth - entry->GetEx()- 6, h - 1);
362 }
363
364 if (entry->GetType() == kMenuPopup) {
365 DrawTrianglePattern(fSelGC, fMenuWidth-10, entry->GetEy() + 3,
366 fMenuWidth-6, entry->GetEy() + 11);
367 }
368
369 if (entry->GetStatus() & kMenuCheckedMask) {
370 DrawCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
371 entry->GetEy()+11);
372 }
373
374 if (entry->GetStatus() & kMenuRadioMask) {
375 DrawRCheckMark(fSelGC, 6, entry->GetEy()+sep, 14,
376 entry->GetEy()+11);
377 }
378
379 if (entry->GetPic() != 0) {
380 entry->GetPic()->Draw(fId, fSelGC, 8, picposy);
381 }
382
383 entry->GetLabel()->Draw(fId,
384 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
385 GetShadowGC()(), tx, ty);
386 if (entry->GetShortcut())
387 entry->GetShortcut()->Draw(fId,
388 (entry->GetStatus() & kMenuEnableMask) ? fSelGC :
389 GetShadowGC()(), fMenuWidth - tw, ty);
390 } else {
391 if ( entry->GetType() != kMenuLabel) {
392 gVirtualX->FillRectangle(fId,
394 entry->GetEx()+1, entry->GetEy()-1, tx-4, h);
395
396 gVirtualX->FillRectangle(fId,
398 tx-1, entry->GetEy()-1, fMenuWidth-tx-1, h);
399 } else { // we need some special background for labels
400 gVirtualX->FillRectangle(fId, TGFrame::GetBckgndGC()(),
401 entry->GetEx()+1, entry->GetEy()-1,
402 fMenuWidth - entry->GetEx()- 3, h);
403 }
404
405 if (entry->GetType() == kMenuPopup) {
407 fMenuWidth-6, entry->GetEy() + 11);
408 }
409
410 if (entry->GetStatus() & kMenuCheckedMask) {
411 DrawCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
412 entry->GetEy()+11);
413 }
414
415 if (entry->GetStatus() & kMenuRadioMask) {
416 DrawRCheckMark(fNormGC, 6, entry->GetEy()+sep, 14,
417 entry->GetEy()+11);
418 }
419
420 if (entry->GetPic() != 0) {
421 entry->GetPic()->Draw(fId, fNormGC, 8, picposy);
422 }
423
424 if (entry->GetStatus() & kMenuEnableMask) {
425 entry->GetLabel()->Draw(fId, fNormGC, tx, ty);
426 if (entry->GetShortcut())
427 entry->GetShortcut()->Draw(fId, fNormGC, fMenuWidth - tw, ty);
428 } else {
429 entry->GetLabel()->Draw(fId, GetHilightGC()(), tx+1, ty+1);
430 entry->GetLabel()->Draw(fId, GetShadowGC()(), tx, ty);
431 if (entry->GetShortcut()) {
432 entry->GetShortcut()->Draw(fId, GetHilightGC()(),
433 fMenuWidth - tw+1, ty+1);
434 entry->GetShortcut()->Draw(fId, GetShadowGC()(),
435 fMenuWidth - tw, ty);
436 }
437 }
438 }
439 break;
440
441 case kMenuSeparator:
442 gVirtualX->FillRectangle(fId, TRootGuiBuilder::GetBgndGC()->GetGC(),
443 entry->GetEx()+1, entry->GetEy()-1,
444 tx-4, 4);
445 gVirtualX->DrawLine(fId, TGFrame::GetBlackGC()(), tx+1,
446 entry->GetEy()+1, fMenuWidth-sep,
447 entry->GetEy()+1);
448 break;
449 }
450
451 // restore font
452 if (entry->GetStatus() & kMenuDefaultMask) {
453 gcval.fFont = gVirtualX->GetFontHandle(fFontStruct);
454 gVirtualX->ChangeGC(fNormGC, &gcval);
455 gVirtualX->ChangeGC(fSelGC, &gcval);
456 }
457}
458
459////////////////////////////////////////////////////////////////////////////////
461
462private:
464
465protected:
466 void DoRedraw() override;
467
468public:
469 ~TGuiBldToolButton() override { }
475
476 Bool_t IsDown() const override { return (fOptions & kSunkenFrame); }
477 void SetState(EButtonState state, Bool_t emit = kTRUE) override;
478 Bool_t HandleCrossing(Event_t *event) override;
480};
481
482////////////////////////////////////////////////////////////////////////////////
483/// Redraw tool button.
484
486{
487 int x = (fWidth - fTWidth) >> 1;
488 int y = (fHeight - fTHeight) >> 1;
489 UInt_t w = GetWidth() - 1;
490 UInt_t h = GetHeight()- 1;
491
493
496 ++x; ++y;
497 w--; h--;
498 }
499
500 const TGPicture *pic = fPic;
501 if (fState == kButtonDisabled) {
503 pic = fPicD ? fPicD : fPic;
504 }
506 x--; y--;
507 gVirtualX->DrawRectangle(fId, TGFrame::GetBlackGC()(), 0, 0, w, h);
508 }
509 pic->Draw(fId, fNormGC, x, y);
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Handle crossing events.
514
516{
517 if (fTip) {
518 if (event->fType == kEnterNotify) {
519 fTip->Reset();
520 } else {
521 fTip->Hide();
522 }
523 }
524
525 if ((event->fType == kEnterNotify) && (fState != kButtonDisabled)) {
527 } else {
529 }
530 if (event->fType == kLeaveNotify) {
534 }
535 DoRedraw();
536
537 return kTRUE;
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Set state of tool bar button and emit a signal according
542/// to passed arguments.
543
545{
546 Bool_t was = !IsDown();
547
548 if (state != fState) {
549 switch (state) {
550 case kButtonEngaged:
551 case kButtonDown:
554 break;
555 case kButtonDisabled:
556 case kButtonUp:
559 break;
560 }
561 fState = state;
562 DoRedraw();
563 if (emit) EmitSignals(was);
564 }
565}
566
567////////////////////////////////////////////////////////////////////////////////
568////////////////////////////////////////////////////////////////////////////////
569/// Create GUI builder application.
570
572 TGMainFrame(p ? p : gClient->GetDefaultRoot(), 1, 1)
573{
575 gGuiBuilder = this;
576 fManager = 0;
577 fEditor = 0;
578 fActionButton = 0;
579 fClosing = 0;
580
581 if (gDragManager) {
583 } else {
585 }
586 fManager->SetBuilder(this);
587
588 fMenuBar = new TGMdiMenuBar(this, 10, 10);
590 InitMenu();
591
593 kLHintsExpandX, 0,0,2,2));
594
595 fToolDock = new TGDockableFrame(this);
597 fToolDock->SetWindowName("GuiBuilder ToolBar");
598
602
603 int spacing = 8;
604
605 for (int i = 0; gToolBarData[i].fPixmap; i++) {
606 if (strlen(gToolBarData[i].fPixmap) == 0) {
607 spacing = 8;
608 continue;
609 }
610
611 const TGPicture *pic = fClient->GetPicture(gToolBarData[i].fPixmap);
613 gToolBarData[i].fId);
614 pb->SetStyle(gClient->GetStyle());
615
616 pb->SetToolTipText(gToolBarData[i].fTipText);
617
618 TGToolTip *tip = pb->GetToolTip();
619 tip->SetDelay(200);
620
621 tip->Connect("Reset()", "TRootGuiBuilder", this, "UpdateStatusBar(=0)");
622 tip->Connect("Hide()", "TRootGuiBuilder", this, "EraseStatusBar()");
623
624 fToolBar->AddButton(this, pb, spacing);
625 spacing = 0;
626
627 if (gToolBarData[i].fId == kEditableAct) {
629 continue;
630 }
631
632 if ((gToolBarData[i].fId == kUndoAct) ||
633 (gToolBarData[i].fId == kRedoAct)) {
634 pb->SetState(kButtonDisabled);
635 }
636 }
637
638 fToolBar->Connect("Clicked(Int_t)", "TGuiBldDragManager", fManager,
639 "HandleAction(Int_t)");
640
642 kLHintsExpandX, 0,0,2,5));
643
644 TGCompositeFrame *cf = new TGHorizontalFrame(this, 1, 1);
646
647 //fShutterDock = new TGDockableFrame(cf);
648 //cf->AddFrame(fShutterDock, new TGLayoutHints(kLHintsNormal ));
649 //fShutterDock->SetWindowName("Widget Factory");
650 //fShutterDock->EnableUndock(kTRUE);
651 //fShutterDock->EnableHide(kTRUE);
652 //fShutterDock->DockContainer();
653
657
659 splitter->SetFrame(fShutter, kTRUE);
661
662 fMain = new TGMdiMainFrame(cf, fMenuBar, 1, 1);
663 fMain->Connect("FrameClosed(Int_t)", "TRootGuiBuilder", this,
664 "HandleWindowClosed(Int_t)");
665
666 TQObject::Connect("TGMdiFrame", "CloseWindow()", "TRootGuiBuilder", this,
667 "MaybeCloseWindow()");
668
670
672
673 const TGPicture *pbg = fClient->GetPicture("bld_bg.png");
674 if (pbg) {
675 fMain->GetContainer()->SetBackgroundPixmap(pbg->GetPicture());
676 }
677
678 if (fManager) {
679 fEditor = new TGuiBldEditor(cf);
683 }
684
685 AddSection("Projects");
686 AddSection("Buttons");
687 AddSection("Containers");
688 AddSection("Bars");
689 AddSection("Input");
690 AddSection("Complex Input");
691 AddSection("Display");
692 AddSection("Dialogs");
693
694 // create an empty section
695 AddSection("User's Macros");
696 TGShutterItem *item = fShutter->GetItem("User's Macros");
698 cont->SetBackgroundColor(TColor::Number2Pixel(18));
699
700 TGuiBldAction *act = new TGuiBldAction("TGMainFrame", "Empty Frame",
702 act->fAct = "empty";
703 act->fPic = "bld_mainframe.xpm";
704 AddAction(act, "Projects");
705
706 act = new TGuiBldAction("TGMainFrame", "Horizontal Frame", kGuiBldProj);
707 act->fAct = "horizontal";
708 act->fPic = "bld_mainframe.xpm";
709 AddAction(act, "Projects");
710
711 act = new TGuiBldAction("TGMainFrame", "Vertical Frame", kGuiBldProj);
712 act->fAct = "vertical";
713 act->fPic = "bld_mainframe.xpm";
714 AddAction(act, "Projects");
715
716 // Standard
717 act = new TGuiBldAction("TGTextButton", "Text Button", kGuiBldCtor);
718 act->fAct = "new TGTextButton()";
719 act->fPic = "bld_textbutton.xpm";
720 AddAction(act, "Buttons");
721
722 act = new TGuiBldAction("TGCheckButton", "Check Button", kGuiBldCtor);
723 act->fAct = "new TGCheckButton()";
724 act->fPic = "bld_checkbutton.xpm";
725 AddAction(act, "Buttons");
726
727 act = new TGuiBldAction("TGRadioButton", "Radio Button", kGuiBldCtor);
728 act->fAct = "new TGRadioButton()";
729 act->fPic = "bld_radiobutton.xpm";
730 AddAction(act, "Buttons");
731
732 act = new TGuiBldAction("TGPictureButton", "Picture Button", kGuiBldCtor);
733 act->fAct = "new TGPictureButton()";
734 act->fPic = "bld_image.xpm";
735 AddAction(act, "Buttons");
736
737 act = new TGuiBldAction("TGTextEntry", "Text Entry", kGuiBldCtor);
738 act->fAct = "new TGTextEntry()";
739 act->fPic = "bld_entry.xpm";
740 AddAction(act, "Input");
741
742 act = new TGuiBldAction("TGTextEdit", "Text Edit", kGuiBldCtor);
743 act->fAct = "TRootGuiBuilder::BuildTextEdit()";
744 act->fPic = "bld_text.xpm";
745 AddAction(act, "Input");
746
747 act = new TGuiBldAction("TGNumberEntry", "Number Entry", kGuiBldCtor);
748 act->fAct = "new TGNumberEntry()";
749 act->fPic = "bld_numberentry.xpm";
750 AddAction(act, "Input");
751
752 act = new TGuiBldAction("TGComboBox", "Combo Box", kGuiBldCtor);
753 act->fAct = "TRootGuiBuilder::BuildComboBox()";
754 act->fPic = "bld_combobox.xpm";
755 AddAction(act, "Input");
756
757 act = new TGuiBldAction("TGListBox", "List Box", kGuiBldCtor);
758 act->fAct = "TRootGuiBuilder::BuildListBox()";
759 act->fPic = "bld_listbox.xpm";
760 AddAction(act, "Input");
761
762 act = new TGuiBldAction("TGHSlider", "Horizontal Slider", kGuiBldCtor);
763 act->fAct = "new TGHSlider()";
764 act->fPic = "bld_hslider.xpm";
765 AddAction(act, "Input");
766
767 act = new TGuiBldAction("TGVSlider", "Vertical Slider", kGuiBldCtor);
768 act->fAct = "new TGVSlider()";
769 act->fPic = "bld_vslider.xpm";
770 AddAction(act, "Input");
771
772 act = new TGuiBldAction("TGHScrollBar", "HScrollbar", kGuiBldCtor);
773 act->fAct = "TRootGuiBuilder::BuildHScrollBar()";
774 act->fPic = "bld_hscrollbar.xpm";
775 AddAction(act, "Input");
776
777 act = new TGuiBldAction("TGVScrollBar", "VScrollbar", kGuiBldCtor);
778 act->fAct = "TRootGuiBuilder::BuildVScrollBar()";
779 act->fPic = "bld_vscrollbar.xpm";
780 AddAction(act, "Input");
781
782 act = new TGuiBldAction("TGListTree", "List Tree", kGuiBldCtor);
783 act->fAct = "TRootGuiBuilder::BuildListTree()";
784 act->fPic = "bld_listtree.xpm";
785 AddAction(act, "Complex Input");
786
787 act = new TGuiBldAction("TGLabel", "Text Label", kGuiBldCtor);
788 act->fAct = "new TGLabel()";
789 act->fPic = "bld_label.xpm";
790 AddAction(act, "Display");
791
792 act = new TGuiBldAction("TGIcon", "Icon", kGuiBldCtor);
793 act->fAct = "new TGIcon()";
794 act->fPic = "bld_image.xpm";
795 AddAction(act, "Display");
796
797 act = new TGuiBldAction("TGHorizontal3DLine", "Horizontal Line",
799 act->fAct = "TRootGuiBuilder::BuildH3DLine()";
800 act->fPic = "bld_hseparator.xpm";
801 AddAction(act, "Display");
802
803 act = new TGuiBldAction("TGVertical3DLine", "Vertical Line", kGuiBldCtor);
804 act->fAct = "TRootGuiBuilder::BuildV3DLine()";
805 act->fPic = "bld_vseparator.xpm";
806 AddAction(act, "Display");
807
808 act = new TGuiBldAction("TGStatusBar", "Status Bar", kGuiBldCtor);
809 act->fAct = "new TGStatusBar()";
810 act->fPic = "bld_statusbar.xpm";
812 AddAction(act, "Bars");
813
814 act = new TGuiBldAction("TGHProgressBar", "HProgress Bar", kGuiBldCtor);
815 act->fAct = "TRootGuiBuilder::BuildHProgressBar()";
816 act->fPic = "bld_hprogressbar.xpm";
817 AddAction(act, "Display");
818
819 act = new TGuiBldAction("TGVProgressBar", "VProgress Bar", kGuiBldCtor);
820 act->fAct = "TRootGuiBuilder::BuildVProgressBar()";
821 act->fPic = "bld_vprogressbar.xpm";
822 AddAction(act, "Display");
823
824 act = new TGuiBldAction("TRootEmbeddedCanvas", "Embed Canvas", kGuiBldCtor);
825 act->fAct = "new TRootEmbeddedCanvas()";
826 act->fPic = "bld_embedcanvas.xpm";
827 AddAction(act, "Display");
828
829 // Containers
830 act = new TGuiBldAction("TGHorizontalFrame", "Horizontal Frame",
832 act->fAct = "new TGHorizontalFrame(0,200,100)";
833 act->fPic = "bld_hbox.xpm";
834 AddAction(act, "Containers");
835
836 act = new TGuiBldAction("TGVerticalFrame", "Vertical Frame", kGuiBldCtor);
837 act->fAct = "new TGVerticalFrame(0,100,200)";
838 act->fPic = "bld_vbox.xpm";
839 AddAction(act, "Containers");
840
841 act = new TGuiBldAction("TGGroupFrame", "Group Frame", kGuiBldCtor);
842 act->fAct = "new TGGroupFrame()";
843 act->fPic = "bld_groupframe.xpm";
844 AddAction(act, "Containers");
845
846 act = new TGuiBldAction("TGTab", "Tabbed Frame", kGuiBldCtor);
847 act->fAct = "TRootGuiBuilder::BuildTab()";
848 act->fPic = "bld_tab.xpm";
849 AddAction(act, "Containers");
850
851 act = new TGuiBldAction("TGShutter", "Shutter", kGuiBldCtor);
852 act->fAct = "TRootGuiBuilder::BuildShutter()";
853 act->fPic = "bld_shutter.png";
854 AddAction(act, "Containers");
855
856
857 act = new TGuiBldAction("TGCanvas", "Scrolled Canvas", kGuiBldCtor);
858 act->fAct = "TRootGuiBuilder::BuildCanvas()";
859 act->fPic = "bld_canvas.xpm";
860 AddAction(act, "Containers");
861/*
862 act = new TGuiBldAction("TGVSplitter", "Horizontal Panes", kGuiBldFunc);
863 act->fAct = "TRootGuiBuilder::VSplitter()";
864 act->fPic = "bld_hpaned.xpm";
865 AddAction(act, "Containers");
866
867 act = new TGuiBldAction("TGHSplitter", "Vertical Panes", kGuiBldFunc);
868 act->fAct = "TRootGuiBuilder::HSplitter()";
869 act->fPic = "bld_vpaned.xpm";
870 AddAction(act, "Containers");
871*/
872 act = new TGuiBldAction("TGColorSelect", "Color Selector", kGuiBldFunc);
873 act->fAct = "new TGColorSelect()";
874 act->fPic = "bld_colorselect.xpm";
875 AddAction(act, "Dialogs");
876
878
879 fStatusBar = new TGStatusBar(this, 40, 10);
881 0, 0, 3, 0));
882
884 SetEditDisabled(kEditDisable); // disable editting to all subframes
885
887
888 Int_t qq;
889 UInt_t ww;
890 UInt_t hh;
891 gVirtualX->GetWindowSize(gVirtualX->GetDefaultRootWindow(), qq, qq, ww, hh);
892 MoveResize(100, 100, ww - 200, hh - 200);
893 SetWMPosition(100, 100);
894
895 SetWindowName("ROOT GuiBuilder");
896 SetIconName("ROOT GuiBuilder");
897 fIconPic = SetIconPixmap("bld_rgb.xpm");
898 SetClassHints("ROOT", "GuiBuilder");
899
900 fSelected = 0;
901 Update();
902
903 fMenuFile->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
904 "HandleMenu(Int_t)");
905 fMenuWindow->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
906 "HandleMenu(Int_t)");
907 fMenuHelp->Connect("Activated(Int_t)", "TRootGuiBuilder", this,
908 "HandleMenu(Int_t)");
909
910 // doesn't work properly on Windows...
911 if (gVirtualX->InheritsFrom("TGX11"))
912 BindKeys();
913 UpdateStatusBar("Ready");
914 MapRaised();
915
917}
918
919////////////////////////////////////////////////////////////////////////////////
920/// Destructor.
921
923{
924 if (fIconPic) gClient->FreePicture(fIconPic);
925 delete fMenuFile;
926 delete fMenuWindow;
927 delete fMenuHelp;
928 gGuiBuilder = 0;
929}
930
931////////////////////////////////////////////////////////////////////////////////
932/// Close GUI builder via window manager "Close" button.
933
935{
936 TGWindow *root = (TGWindow*)fClient->GetRoot();
937 if (root) root->SetEditable(kFALSE);
938
939 fEditor->Reset();
940
941 if (fMain->GetNumberOfFrames() == 0) {
945 } else {
949 }
950
952 if (btn) {
954 }
955 fClosing = 1;
956 fMain->CloseAll();
957 if (fClosing == -1) {
958 fClosing = 0;
959 return;
960 }
962 Hide();
963}
964
965////////////////////////////////////////////////////////////////////////////////
966/// Find action by name
967
969{
970 if (!name || !sect) return 0;
971
973 if (!item) return 0;
974
978
979 TIter next(cont->GetList());
980 TGLabel *lb;
981 TGButton *btn;
982
983 while ((fe = (TGFrameElement*)next())) {
984 hf = (TGHorizontalFrame*)fe->fFrame;
985 btn = (TGButton*)((TGFrameElement*)hf->GetList()->First())->fFrame;
986 lb = (TGLabel*)((TGFrameElement*)hf->GetList()->Last())->fFrame;
987 if (*(lb->GetText()) == name) {
988 return (TGButton*)btn;
989 }
990 }
991 return 0;
992}
993
994////////////////////////////////////////////////////////////////////////////////
995/// Add new action to widget palette.
996
998{
999 if (!act || !sect) return;
1000
1002 TGButton *btn = 0;
1003
1004 if (!item) return;
1006 cont->SetBackgroundColor(TColor::Number2Pixel(18));
1007
1008 const TGPicture *pic = 0;
1009 if (!act->fPicture) {
1010 act->fPicture = fClient->GetPicture(act->fPic);
1011 }
1012 pic = act->fPicture;
1013
1015
1016 if (pic) {
1017 btn = new TGPictureButton(hf, pic);
1018 } else {
1019 btn = new TGTextButton(hf, act->GetName());
1020 }
1021
1022 btn->SetToolTipText(act->GetTitle(), 200);
1023 btn->SetUserData((void*)act);
1024 btn->Connect("Clicked()", "TRootGuiBuilder", this, "HandleButtons()");
1025
1026 hf->AddFrame(btn, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1027
1028 TGLabel *lb = new TGLabel(hf, act->fType != kGuiBldMacro ? act->GetTitle() :
1029 act->GetName());
1030 lb->SetBackgroundColor(cont->GetBackground());
1031 hf->AddFrame(lb, new TGLayoutHints(kLHintsTop | kLHintsCenterY,3,3,3,3));
1032 hf->SetBackgroundColor(cont->GetBackground());
1033
1034 // disable edit
1035 cont->SetEditDisabled(kEditDisable);
1036 hf->SetEditDisabled(kEditDisable);
1037
1038 cont->AddFrame(hf, new TGLayoutHints(kLHintsExpandX | kLHintsTop, 2, 2, 2, 0));
1039 cont->MapSubwindows();
1040 cont->Resize(); // invoke Layout()
1041}
1042
1043////////////////////////////////////////////////////////////////////////////////
1044/// Add new shutter item.
1045
1047{
1048 static int id = 10000;
1050 id++);
1051 fShutter->AddItem(item);
1052 item->Connect("Selected()", "TRootGuiBuilder", this, "HandleMenu(=3)");
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Handle buttons in the GUI builder's widget palette.
1057
1059{
1060 TGFrame *parent;
1061
1062 if (fActionButton) {
1063 parent = (TGFrame*)fActionButton->GetParent();
1064 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1065 fClient->NeedRedraw(parent, kTRUE);
1066 }
1067
1068 if (!fClient->IsEditable()) {
1070 }
1071
1074 parent = (TGFrame*)fActionButton->GetParent();
1075
1076 parent->ChangeOptions(parent->GetOptions() | kSunkenFrame);
1077 fClient->NeedRedraw(parent, kTRUE);
1078
1079 if (act) {
1080 fAction = act;
1083 }
1084}
1085
1086////////////////////////////////////////////////////////////////////////////////
1087/// Execute an action.
1088
1090{
1091 if (!fAction || fAction->fAct.IsNull()) return 0;
1092
1093 TGFrame *ret = 0;
1094
1095 if (!fClient->IsEditable() && (fAction->fType != kGuiBldMacro)) {
1096 TGMdiFrame *current = fMain->GetCurrent();
1097 if (current) current->SetEditable(kTRUE);
1098 }
1099
1100 TString s = "";
1101
1102 switch (fAction->fType) {
1103 case kGuiBldProj:
1104 s = fAction->fAct.Data();
1105 NewProject(s);
1106 fAction = 0;
1107 break;
1108 case kGuiBldMacro:
1109 {
1110 TGWindow *root = (TGWindow*)fClient->GetRoot();
1111 if (root) root->SetEditable(kFALSE);
1112 gROOT->Macro(fAction->fAct.Data());
1113 if (root) root->SetEditable(kTRUE);
1114 fAction = 0;
1115 break;
1116 }
1117 default:
1118 ret = (TGFrame *)gROOT->ProcessLineFast(fAction->fAct.Data());
1119 break;
1120 }
1121
1122 Update();
1123
1124 return ret;
1125}
1126
1127////////////////////////////////////////////////////////////////////////////////
1128/// Inititiate GUI Builder menus.
1129
1131{
1133 fMenuFile->AddEntry(new TGHotString("&Edit (Ctrl+double-click)"),
1135 fClient->GetPicture("bld_edit.png"));
1136 fMenuFile->AddEntry(new TGHotString("&Stop (Ctrl+double-click)"),
1138 fClient->GetPicture("bld_stop.png"));
1142 fMenuFile->AddEntry(new TGHotString("&New Project"), kGUIBLD_FILE_NEW,
1143 0, fClient->GetPicture("bld_new.png"));
1145 0, fClient->GetPicture("bld_open.png"));
1147 0, fClient->GetPicture("bld_delete.png"));
1148 fMenuFile->AddEntry(new TGHotString("&Save project as"), kGUIBLD_FILE_SAVE,
1149 0, fClient->GetPicture("bld_save.png"));
1153 0, fClient->GetPicture("bld_exit.png"));
1154/*
1155 fMenuEdit = new TGuiBldPopupMenu();
1156 fMenuEdit->AddSeparator();
1157 fMenuEdit->AddEntry(new TGHotString("&Preferences ..."), kGUIBLD_EDIT_PREF);
1158*/
1160 fMenuWindow->AddEntry(new TGHotString("Tile &Horizontally"),
1162 fMenuWindow->AddEntry(new TGHotString("Tile &Vertically"),
1164 fMenuWindow->AddEntry(new TGHotString("&Cascade"),
1167 //fMenuWindow->AddPopup(new TGHotString("&Windows"), fMain->GetWinListMenu());
1168 fMenuWindow->AddEntry(new TGHotString("&Arrange icons"),
1171 fMenuWindow->AddEntry(new TGHotString("&Opaque resize"),
1174
1179 //fMenuHelp->AddSeparator();
1180 //fMenuHelp->AddEntry(new TGHotString("&Send Bug Report"),kGUIBLD_HELP_BUG);
1181
1182 TGMenuBar *bar = fMenuBar->GetMenuBar();
1183
1184 TGuiBldMenuTitle *title;
1185 title = new TGuiBldMenuTitle(bar, new TGHotString("&File"), fMenuFile);
1186 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1187
1188 //title = new TGuiBldMenuTitle(bar, new TGHotString("&Edit"), fMenuEdit);
1189 //bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1190
1191 title = new TGuiBldMenuTitle(bar, new TGHotString("&Windows"), fMenuWindow);
1192 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsLeft,0,4,0,0));
1193
1194 title = new TGuiBldMenuTitle(bar, new TGHotString("&Help"), fMenuHelp);
1195 bar->AddTitle(title, new TGLayoutHints(kLHintsTop | kLHintsRight,4,4,0,0));
1196
1199}
1200
1201////////////////////////////////////////////////////////////////////////////////
1202/// Set selected frame.
1203
1205{
1206 fSelected = f;
1207 Update();
1208}
1209
1210////////////////////////////////////////////////////////////////////////////////
1211/// Enable toolbar buttons for alignment.
1212
1214{
1215 TGButton *btn = 0;
1216
1218 if (btn) {
1219 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1220 }
1221
1223 if (btn) {
1224 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1225 }
1226
1228 if (btn) {
1229 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1230 }
1231
1233 if (btn) {
1234 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1235 }
1236
1238 if (btn) {
1239 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1240 }
1241
1243 if (btn) {
1244 btn->SetState(kButtonUp);
1245 }
1246
1248 if (btn) {
1249 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1250 }
1251
1252}
1253
1254////////////////////////////////////////////////////////////////////////////////
1255/// Enable/disable toolbar buttons according to the selected frame.
1256
1258{
1260
1261 TGButton *btn = 0;
1262
1263 if (!fSelected) {
1265 if (btn) btn->SetState(kButtonDisabled);
1266
1268 if (btn) btn->SetState(kButtonDisabled);
1269
1271 if (btn) btn->SetState(kButtonDisabled);
1272
1274 if (btn) btn->SetState(kButtonDisabled);
1275 return;
1276 }
1277
1278 Bool_t comp = kFALSE;
1279 TGLayoutManager *lm = 0;
1280 Bool_t hor = kFALSE;
1281 Bool_t fixed = kFALSE;
1282 Bool_t enable = on;
1284
1286 lm = ((TGCompositeFrame*)fSelected)->GetLayoutManager();
1287 comp = kTRUE;
1288 hor = lm && lm->InheritsFrom(TGHorizontalLayout::Class());
1291 } else {
1292 enable = kFALSE;
1293 }
1294
1296 if (btn) btn->SetState(enable && comp && !fixed && !compact_disable ?
1298
1300 if (btn) {
1301 btn->SetState(enable && comp && !hor && !fixed ? kButtonUp :
1303 }
1304
1306 if (btn) {
1307 btn->SetState(enable && comp && hor && !fixed ? kButtonUp :
1309 }
1310
1312 if (btn) {
1313 btn->SetState(enable && comp && !fixed ? kButtonUp : kButtonDisabled);
1314 }
1315/*
1316 btn = fToolBar->GetButton(kGrabAct);
1317 if (btn) {
1318 btn->SetState(enable && comp ? kButtonDown : kButtonUp);
1319 TGToolTip *tt = btn->GetToolTip();
1320 tt->SetText(btn->IsDown() ? "Drop Frames (Ctrl-Return)" :
1321 "Grab Selected Frames (Return)");
1322 }
1323*/
1324}
1325
1326////////////////////////////////////////////////////////////////////////////////
1327/// Enable/disable toolbar buttons according to the selected frame.
1328
1330{
1331 TGButton *btn = 0;
1332
1334
1336 if (btn) {
1337 btn->SetState(!on ? kButtonDisabled : kButtonUp);
1338 }
1339
1341 if (btn) {
1342 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1343 }
1344
1346 if (btn) {
1347 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1348 }
1349
1351 if (btn) {
1352 btn->SetState(!on || lasso ? kButtonDisabled : kButtonUp);
1353 }
1354
1356 if (btn) {
1357 btn->SetState(!on || !fManager->IsPasteFrameExist() ?
1359 }
1360
1362 if (btn) {
1363 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1364 }
1365
1367 if (btn) {
1368 btn->SetState(!on && !lasso ? kButtonDisabled : kButtonUp);
1369 }
1370}
1371
1372////////////////////////////////////////////////////////////////////////////////
1373/// Update gui builder.
1374
1376{
1377 if (!fManager) {
1378 return;
1379 }
1380
1385 fManager->GetSelected() ||
1387
1388 if (fActionButton) {
1389 TGFrame *parent = (TGFrame*)fActionButton->GetParent();
1390 parent->ChangeOptions(parent->GetOptions() & ~kSunkenFrame);
1391 fClient->NeedRedraw(parent, kTRUE);
1392 }
1393
1394 if (!fClient->IsEditable()) {
1395 UpdateStatusBar("");
1398 fEditable = 0;
1399 //fShutter->SetSelectedItem(fShutter->GetItem("Projects"));
1400 } else {
1403 }
1404
1406 fActionButton = 0;
1407}
1408
1409////////////////////////////////////////////////////////////////////////////////
1410/// Return the status of the selected mode.
1411
1413{
1414 TGButton *btn = 0;
1416
1417 if (!btn) return kFALSE;
1418
1419 return btn->IsDown();
1420}
1421
1422////////////////////////////////////////////////////////////////////////////////
1423/// Return the status of the grab mode.
1424
1426{
1428
1429 if (!btn) return kFALSE;
1430
1431 return btn->IsDown();
1432}
1433
1434////////////////////////////////////////////////////////////////////////////////
1436
1437public:
1440 void SetList(TList *li) { fList = li; }
1441};
1442
1443static const char *gSaveMacroTypes[] = {
1444 "Macro files", "*.[C|c]*",
1445 "All files", "*",
1446 0, 0
1447};
1448
1449////////////////////////////////////////////////////////////////////////////////
1450/// Handle keys.
1451
1453{
1454 if (event->fType == kGKeyPress) {
1455 UInt_t keysym;
1456 char str[2];
1457 gVirtualX->LookupString(event, str, sizeof(str), keysym);
1458
1459 if (event->fState & kKeyControlMask) {
1460 if (str[0] == 19) { // ctrl-s
1461 if (fMain->GetCurrent()) {
1462 return SaveProject(event);
1463 } else {
1464 return kFALSE; //TGMainFrame::HandleKey(event);
1465 }
1466 } else if (str[0] == 14) { //ctrl-n
1467 return NewProject(); //event not needed
1468 } else if (str[0] == 15) { // ctrl-o
1469 return OpenProject(event);
1470 }
1471 }
1472 fManager->HandleKey(event);
1473 return TGMainFrame::HandleKey(event);
1474 }
1475 return kTRUE;
1476}
1477
1478////////////////////////////////////////////////////////////////////////////////
1479/// Create a new project.
1480
1482{
1483 TGWindow *root = (TGWindow*)fClient->GetRoot();
1484
1485 if (root) root->SetEditable(kFALSE);
1486 fEditable = new TGMdiFrame(fMain, 500, 400, kOwnBackground);
1490 fEditable->SetEditDisabled(0); // enable editting
1494
1495 if (type == "horizontal") {
1498 kLHintsExpandY, 1, 1, 1, 1));
1499 hor->SetEditable(kTRUE);
1505 fEditable->Layout();
1506 }
1507 else if (type == "vertical") {
1510 kLHintsExpandY,1,1,1,1));
1511 vert->SetEditable(kTRUE);
1517 fEditable->Layout();
1518
1519 } else {
1521 }
1526
1527
1529 return kTRUE;
1530}
1531
1532////////////////////////////////////////////////////////////////////////////////
1533/// Open new gui builder project.
1534
1536{
1537
1539 if (btn) {
1540 btn->SetBackgroundColor(GetBgnd());
1542 }
1543
1544 TGFileInfo fi;
1545 static TString dir(".");
1546 static Bool_t overwr = kFALSE;
1547 TString fname;
1548
1549 fi.fFileTypes = gSaveMacroTypes;
1550 fi.SetIniDir(dir);
1551 fi.fOverwrite = overwr;
1552 TGWindow *root = (TGWindow*)fClient->GetRoot();
1553 root->SetEditable(kFALSE);
1554
1555 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDOpen, &fi);
1556
1557 if (!fi.fFilename) {
1558 root->SetEditable(kTRUE);
1559 return kFALSE;
1560 }
1561
1562 dir = fi.fIniDir;
1563 overwr = fi.fOverwrite;
1564 fname = fi.fFilename;
1565
1566 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1567 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1568 NewProject(); // create new project
1569 gROOT->Macro(fname.Data()); // put content of the macro as child frame
1570 } else {
1571 Int_t retval;
1572 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1573 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1575 &retval);
1576
1577 if (retval == kMBRetry) {
1578 OpenProject(event);
1579 }
1580 }
1581
1585
1586 return kTRUE;
1587}
1588
1589////////////////////////////////////////////////////////////////////////////////
1590/// Save selected project.
1591
1593{
1595 if (btn) {
1596 btn->SetBackgroundColor(GetBgnd());
1598 }
1599
1601 if (!savfr) return kFALSE;
1602
1603 static TImage *img = 0;
1604
1605 if (!img) {
1606 img = TImage::Create();
1607 }
1608 img->FromWindow(savfr->GetParent()->GetId());
1609
1610 TGWindow *root = (TGWindow*)fClient->GetRoot();
1611 TGFileInfo fi;
1612 static TString dir(".");
1613 static Bool_t overwr = kFALSE;
1614 TString fname;
1615 root->SetEditable(kFALSE);
1616
1617 fi.fFileTypes = gSaveMacroTypes;
1618 fi.SetIniDir(dir);
1619 fi.fOverwrite = overwr;
1620
1621 new TGFileDialog(fClient->GetDefaultRoot(), this, kFDSave, &fi);
1622
1623 if (!fi.fFilename) {
1624 root->SetEditable(kTRUE);
1626 return kFALSE;
1627 }
1628
1629 dir = fi.fIniDir;
1630 overwr = fi.fOverwrite;
1631 fname = gSystem->UnixPathName(fi.fFilename);
1632
1633 if (fname.EndsWith(".C", TString::kIgnoreCase) || fname.EndsWith(".cxx") ||
1634 fname.EndsWith(".cpp") || fname.EndsWith(".cc")) {
1636 savfr->GetWidth(),
1637 savfr->GetHeight());
1638 TList *list = main->GetList();
1639 TString name = savfr->GetName();
1640 savfr->SetName(main->GetName());
1641 main->SetList(savfr->GetList());
1642 main->SetLayoutBroken(savfr->IsLayoutBroken());
1643 main->SaveSource(fname.Data(), "keep_names");
1644 savfr->SetWindowName(fname.Data());
1645 main->SetList(list);
1646
1647 main->SetMWMHints(kMWMDecorAll, kMWMFuncAll,
1649 main->SetWMSize(main->GetWidth(), main->GetHeight());
1650 main->SetWMSizeHints(main->GetDefaultWidth(), main->GetDefaultHeight(),
1651 10000, 10000, 0, 0);
1652 main->SetWindowName(fname.Data());
1653 main->SetIconName(fname.Data());
1654 main->SetClassHints(fname.Data(), fname.Data());
1655 // some problems here under win32
1656 if (gVirtualX->InheritsFrom("TGX11")) main->SetIconPixmap("bld_rgb.xpm");
1657
1658 savfr->SetName(name.Data());
1659
1660 AddMacro(fname.Data(), img);
1661 delete main;
1662 } else {
1663 Int_t retval;
1664 new TGMsgBox(fClient->GetDefaultRoot(), this, "Error...",
1665 TString::Format("file (%s) must have source extension (.C, .c, .cxx, .cpp, .cc)",
1667 &retval);
1668 if (retval == kMBRetry) {
1669 SaveProject(event);
1670 }
1672 }
1674 return kTRUE;
1675}
1676
1677////////////////////////////////////////////////////////////////////////////////
1678/// Add macro to "User's Macros" section
1679/// Input img must be static - do not delete it.
1680
1682{
1683 if (!img || !img->GetWidth() || !img->GetHeight()) {
1684 return;
1685 }
1686
1687 UInt_t w = 100;
1688 Float_t ratio = Float_t(w)/img->GetWidth();
1689 Float_t rh = img->GetHeight()*ratio;
1690 UInt_t h = UInt_t(rh);
1691 img->Scale(w, h);
1692 img->Merge(img, "overlay");
1693
1694 static int i = 0;
1696 TString::Format("%s;%d", macro, i++),
1697 img->GetPixmap(),img->GetMask());
1698 const char *name = gSystem->BaseName(macro);
1699
1700 TGButton *btn = FindActionButton(name, "User's Macros");
1701 TGuiBldAction *act = 0;
1702
1703 if (!btn) {
1705 act->fAct = macro;
1706 act->fPic = macro;
1707 act->fPicture = pic;
1708
1709 AddAction(act, "User's Macros");
1710 } else {
1711 act = (TGuiBldAction*)btn->GetUserData();
1712 act->fAct = macro;
1713 act->fPic = macro;
1714 act->fPicture = pic;
1715
1716 if (btn->InheritsFrom(TGPictureButton::Class())) {
1717 btn->Resize(w, h);
1718 fClient->FreePicture(((TGPictureButton*)btn)->GetPicture());
1719 ((TGPictureButton*)btn)->SetPicture(pic);
1720 }
1721 }
1723}
1724
1725////////////////////////////////////////////////////////////////////////////////
1726/// Find the editable frame.
1727
1729{
1730 const TGWindow *parent = win;
1731 TGMdiFrame *ret = 0;
1732
1733 while (parent && (parent != fClient->GetDefaultRoot())) {
1734 if (parent->InheritsFrom(TGMdiFrame::Class())) {
1735 ret = (TGMdiFrame*)parent;
1736 return ret;
1737 }
1738 parent = parent->GetParent();
1739 }
1740 return 0;
1741}
1742
1743////////////////////////////////////////////////////////////////////////////////
1744/// Switch image of toolbar edit button according to the current state.
1745
1747{
1748 static const TGPicture *start = fClient->GetPicture("bld_edit.png");
1749 static const TGPicture *stop = fClient->GetPicture("bld_stop.png");
1750
1751 if (fClient->IsEditable()) {
1753 fStartButton->SetPicture(stop);
1755 fStartButton->SetToolTipText("Stop Edit (Ctrl-Dbl-Click)");
1756 } else {
1757 if (fMain->GetNumberOfFrames() < 1) {
1759 } else {
1761 fStartButton->SetPicture(start);
1763 fStartButton->SetToolTipText("Start Edit (Ctrl-Dbl-Click)");
1764 }
1765 }
1766
1768}
1769
1770////////////////////////////////////////////////////////////////////////////////
1771/// Handle menu items.
1772
1774{
1775 TGWindow *root = (TGWindow*)fClient->GetRoot();
1777
1778 switch (id) {
1779 case kGUIBLD_FILE_START:
1780 if (fClient->IsEditable()) {
1781 break;
1782 }
1784 if (fEditable) {
1786 } //else if (!fMain->GetCurrent()) {
1787 //NewProject();
1788 //}
1789 UpdateStatusBar("Start edit");
1793 break;
1794
1795 case kGUIBLD_FILE_STOP:
1796 if (!fClient->IsEditable()) {
1797 break;
1798 }
1800
1801 if (fEditable) {
1802 root->SetEditable(kFALSE);
1803
1804 UpdateStatusBar("Stop edit");
1807 fEditable = 0;
1809 }
1810 fEditor->Reset();
1811 break;
1812
1813 case kGUIBLD_FILE_NEW:
1814 NewProject();
1816 break;
1817
1818 case kGUIBLD_FILE_CLOSE:
1820 if (fEditable && (fEditable == fMain->GetCurrent())) {
1821 root->SetEditable(kFALSE);
1822 }
1823 fEditor->Reset();
1824 UpdateStatusBar("");
1826
1827 if (fMain->GetNumberOfFrames() <= 1) {
1831 }
1832
1833 if (fClient->IsEditable()) {
1836 } else {
1839 }
1841 break;
1842
1843 case kGUIBLD_FILE_EXIT:
1844 CloseWindow();
1845 break;
1846
1847 case kGUIBLD_FILE_OPEN:
1848 OpenProject();
1850 break;
1851
1852 case kGUIBLD_FILE_SAVE:
1853 SaveProject();
1855 break;
1856
1857 case kGUIBLD_WINDOW_HOR:
1859 break;
1860
1863 break;
1864
1866 fMain->Cascade();
1867 break;
1868
1871 break;
1872
1877 } else {
1880 }
1881 break;
1883 root->SetEditable(kFALSE);
1884 hd = new TRootHelpDialog(this, "Help on Gui Builder...", 600, 400);
1885 hd->SetText(gHelpBuilder);
1886 hd->SetEditDisabled();
1887 hd->Popup();
1888 root->SetEditable(kTRUE);
1889 break;
1890
1891 case kGUIBLD_HELP_ABOUT:
1892 root->SetEditable(kFALSE);
1893 hd = new TRootHelpDialog(this, "About Gui Builder...", 520, 160);
1894 hd->SetEditDisabled();
1895 hd->SetText(gHelpAboutBuilder);
1896 hd->Popup();
1897 root->SetEditable(kTRUE);
1898 break;
1899
1900 default:
1901 fMain->SetCurrent(id);
1902 break;
1903 }
1904}
1905
1906////////////////////////////////////////////////////////////////////////////////
1907/// Handler before closing MDI frame.
1908
1910{
1911 int retval;
1912 if (fClosing == -1)
1913 return;
1916 new TGMsgBox(gClient->GetDefaultRoot(), this,
1917 "Closing project", "Do you want to save the project before closing?",
1919
1921 if (retval == kMBYes) {
1922 SaveProject();
1923 }
1924 if (retval == kMBCancel) {
1925 fClosing = -1;
1926 if (!fClient->IsEditable())
1928 return;
1929 }
1931 mdiframe->CloseWindow();
1932}
1933
1934////////////////////////////////////////////////////////////////////////////////
1935/// Handler for closed MDI frame.
1936
1960
1961////////////////////////////////////////////////////////////////////////////////
1962/// Update information shown on the status bar.
1963
1965{
1966 if (!fStatusBar) return;
1967
1968 const char *text = 0;
1969
1970 if (!txt) {
1971 TObject *o = (TObject *)gTQSender;
1972
1973 if (o && o->InheritsFrom(TGToolTip::Class())) {
1974 TGToolTip *tip = (TGToolTip*)o;
1975 text = tip->GetText()->Data();
1976 }
1977 } else {
1978 text = txt;
1979 }
1981}
1982
1983////////////////////////////////////////////////////////////////////////////////
1984/// Clear information shown in the status bar.
1985
1987{
1988 if (!fStatusBar) return;
1989
1990 fStatusBar->SetText("");
1991}
1992
1993////////////////////////////////////////////////////////////////////////////////
1994/// Keyboard key binding.
1995
1997{
1998 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_a),
2000
2001 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_n),
2003
2004 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_o),
2006
2007 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2009
2010 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Return),
2011 0, kTRUE);
2012
2013 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2015
2016 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Enter),
2017 0, kTRUE);
2018
2019 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_x),
2021
2022 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_c),
2024
2025 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_v),
2027
2028 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_r),
2030
2031 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2033
2034 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_z),
2036
2037 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_b),
2039
2040 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_l),
2042
2043 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_g),
2045
2046 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_h),
2048
2049 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2050 0, kTRUE);
2051
2052 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2053 0, kTRUE);
2054
2055 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Space),
2056 0, kTRUE);
2057
2058 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2059 0, kTRUE);
2060
2061 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2062 0, kTRUE);
2063
2064 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2065 0, kTRUE);
2066
2067 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2068 0, kTRUE);
2069
2070 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Left),
2072
2073 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Right),
2075
2076 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Up),
2078
2079 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Down),
2081
2082 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Delete),
2084
2085 gVirtualX->GrabKey(fId, gVirtualX->KeysymToKeycode(kKey_Backspace),
2087}
2088
2089////////////////////////////////////////////////////////////////////////////////
2090/// Create new vertical splitter (TGVSplitter).
2091
2093{
2095 ret->SetCleanup(kDeepCleanup);
2097 kFixedWidth);
2098 ret->AddFrame(v1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
2099 //v1->SetEditDisabled(kEditDisableGrab);
2100
2102 splitter->SetFrame(v1, kTRUE);
2104 splitter->SetEditDisabled(kEditDisableBtnEnable);
2105
2107 v2->ChangeOptions(kSunkenFrame);
2110 //v2->SetEditDisabled(kEditDisableGrab);
2111 ret->SetEditDisabled(kEditDisableLayout);
2112
2113 ret->MapSubwindows();
2114 ret->SetLayoutBroken(kFALSE);
2115 return ret;
2116}
2117
2118////////////////////////////////////////////////////////////////////////////////
2119/// Creates new horizontal splitter (TGHSplitter).
2120
2122{
2124 ret->SetCleanup(kDeepCleanup);
2126 kFixedHeight);
2127 ret->AddFrame(v1, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
2128 //v1->SetEditDisabled(kEditDisableGrab);
2129
2131 splitter->SetFrame(v1, kTRUE);
2133 splitter->SetEditDisabled(kEditDisable);
2134
2135 TGHorizontalFrame *v2 = new TGHorizontalFrame(ret, 10, 10);
2136 v2->ChangeOptions(kSunkenFrame);
2139 //v2->SetEditDisabled(kEditDisableGrab);
2140 ret->SetEditDisabled(kEditDisableLayout);
2141
2142 ret->MapSubwindows();
2143 ret->SetLayoutBroken(kFALSE);
2144 return ret;
2145}
2146
2147////////////////////////////////////////////////////////////////////////////////
2148/// Hide builder.
2149
2151{
2152 //fMain->CloseAll();
2153 UnmapWindow();
2154}
2155
2156////////////////////////////////////////////////////////////////////////////////
2157/// Return default background color.
2158
2160{
2162
2163 static ULong_t gPixel = 0;
2164
2165 if (gPixel) return gPixel;
2166
2167 Float_t r, g, b;
2168
2169 r = 232./255;
2170 g = 232./255;
2171 b = 222./255;
2172
2174 return gPixel;
2175}
2176
2177////////////////////////////////////////////////////////////////////////////////
2178/// Return background GC.
2179
2181{
2182 if (fgBgnd) return fgBgnd;
2183
2185
2186 Pixel_t back = GetBgnd();
2187 fgBgnd->SetBackground(back);
2188 fgBgnd->SetForeground(back);
2189
2190 return fgBgnd;
2191}
2192
2193////////////////////////////////////////////////////////////////////////////////
2194/// Set a background color to frame and all its subframes.
2195
2197{
2198 if (!frame) return;
2199
2200 frame->SetBackgroundColor(color);
2201 if (!frame->InheritsFrom(TGCompositeFrame::Class())) return;
2202
2203 TIter next(((TGCompositeFrame*)frame)->GetList());
2205
2206 while ((fe = (TGFrameElement*)next())) {
2207 if (fe->fFrame->GetBackground() == TGFrame::GetWhitePixel()) {
2208 continue;
2209 }
2210 PropagateBgndColor(fe->fFrame, color);
2211 }
2212}
2213
2214////////////////////////////////////////////////////////////////////////////////
2215/// Return background color for popup menus.
2216
2218{
2220
2221 static ULong_t gPixel = 0;
2222
2223 if (gPixel) return gPixel;
2224
2225 Float_t r, g, b;
2226
2227 r = 250./255;
2228 g = 250./255;
2229 b = 250./255;
2230
2232
2233 return gPixel;
2234}
2235
2236////////////////////////////////////////////////////////////////////////////////
2237/// Return background GC for popup menus.
2238
2240{
2241 if (fgBgndPopup) return fgBgndPopup;
2242
2244
2245 Pixel_t back = GetPopupBgnd();
2246 fgBgndPopup->SetBackground(back);
2247 fgBgndPopup->SetForeground(back);
2248
2249 return fgBgndPopup;
2250}
2251
2252////////////////////////////////////////////////////////////////////////////////
2253/// Return highlighted color for popup menu entry.
2254
2256{
2258
2259 static ULong_t gPixel = 0;
2260
2261 if (gPixel) return gPixel;
2262
2263 Float_t r, g, b;
2264
2265 r = 120./255;
2266 g = 120./255;
2267 b = 222./255;
2268
2270
2271 return gPixel;
2272}
2273
2274////////////////////////////////////////////////////////////////////////////////
2275/// Return background GC for highlighted popup menu entry.
2276
2278{
2280
2282
2283 Pixel_t back = GetPopupHlght();
2284 fgBgndPopupHlght->SetBackground(back);
2285 fgBgndPopupHlght->SetForeground(back);
2286
2287 return fgBgndPopupHlght;
2288}
2289
2290////////////////////////////////////////////////////////////////////////////////
2291/// Return style popup menu.
2292
2297
2298////////////////////////////////////////////////////////////////////////////////
2299/// Helper method used in guibuilding
2300
2302{
2303 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2304 TGListTree *lt = new TGListTree(canvas, kHorizontalFrame);
2305 lt->AddItem(0, "Entry 1");
2306 lt->AddItem(0, "Entry 2");
2307 lt->AddItem(0, "Entry 3");
2308 lt->AddItem(0, "Entry 4");
2309 lt->AddItem(0, "Entry 5");
2310 canvas->Resize(100, 60);
2311 canvas->MapSubwindows();
2312
2313 return canvas;
2314}
2315
2316////////////////////////////////////////////////////////////////////////////////
2317/// Helper method used in guibuilding to create TGCanvas widget
2318
2320{
2321 TGCanvas *canvas = new TGCanvas(gClient->GetRoot(), 100, 100);
2323 200, 200, kHorizontalFrame |
2325
2326 cont->SetCleanup(kDeepCleanup);
2327 cont->SetLayoutManager(new TGTileLayout(cont, 8));
2328 cont->AddFrame(new TGTextButton(cont, "Button1"));
2329 cont->AddFrame(new TGTextButton(cont, "Button2"));
2330 cont->AddFrame(new TGTextButton(cont, "Button3"));
2331 cont->AddFrame(new TGTextButton(cont, "Button4"));
2332
2333 canvas->SetContainer(cont);
2334 return canvas;
2335}
2336
2337////////////////////////////////////////////////////////////////////////////////
2338/// Helper method used in guibuilding to create TGShutter widget
2339
2341{
2342 TGShutterItem *item;
2344 const TGPicture *buttonpic;
2346
2348 TGShutter *shut = new TGShutter();
2349
2350 item = shut->AddPage("Histograms");
2352 buttonpic = gClient->GetPicture("h1_s.xpm");
2353
2354 if (buttonpic) {
2356 button->SetToolTipText("TH1");
2357 container->AddFrame(button, l);
2358 }
2359 buttonpic = gClient->GetPicture("h2_s.xpm");
2360
2361 if (buttonpic) {
2363 button->SetToolTipText("TH2");
2364 container->AddFrame(button, l);
2365 }
2366 buttonpic = gClient->GetPicture("h3_s.xpm");
2367
2368 if (buttonpic) {
2370 button->SetToolTipText("TH3");
2371 container->AddFrame(button, l);
2372 }
2373 buttonpic = gClient->GetPicture("profile_s.xpm");
2374
2375 if (buttonpic) {
2377 button->SetToolTipText("TProfile");
2378 container->AddFrame(button, l);
2379 }
2380
2381 // new page
2382 item = shut->AddPage("Functions");
2384 buttonpic = gClient->GetPicture("f1_s.xpm");
2385
2386 if (buttonpic) {
2388 button->SetToolTipText("TF1");
2389 container->AddFrame(button, l);
2390 }
2391 buttonpic = gClient->GetPicture("f2_s.xpm");
2392
2393 if (buttonpic) {
2395 button->SetToolTipText("TF2");
2396 container->AddFrame(button, l);
2397 }
2398
2399 // new page
2400 item = shut->AddPage("Trees");
2402 buttonpic = gClient->GetPicture("ntuple_s.xpm");
2403
2404 if (buttonpic) {
2406 button->SetToolTipText("TNtuple");
2407 container->AddFrame(button, l);
2408 }
2409 buttonpic = gClient->GetPicture("tree_s.xpm");
2410
2411 if (buttonpic) {
2413 button->SetToolTipText("TTree");
2414 container->AddFrame(button, l);
2415 }
2416 buttonpic = gClient->GetPicture("chain_s.xpm");
2417
2418 if (buttonpic) {
2420 button->SetToolTipText("TChain");
2421 container->AddFrame(button, l);
2422 }
2423
2424 shut->MapSubwindows();
2425 return shut;
2426}
2427
2428////////////////////////////////////////////////////////////////////////////////
2429/// Helper method to create TGTextEdit widget
2430
2432{
2433 TGTextEdit *te = new TGTextEdit();
2434
2435 te->AddLine("all work and no play makes jack a pretty");
2436 te->AddLine("dull boy. all work and no play makes jack");
2437 te->AddLine("a pretty dull boy. all work and no play ");
2438 te->AddLine("makes jack a pretty dull boy. all work");
2439 te->AddLine("and no play makes jack a pretty dull boy.");
2440
2441 te->MapSubwindows();
2442 te->Layout();
2443 te->Resize(100, 60);
2444
2445 return te;
2446}
2447
2448////////////////////////////////////////////////////////////////////////////////
2449/// Helper method to create TGTab widget
2450
2452{
2453 TGTab *tab = new TGTab();
2454
2455 tab->AddTab("Tab1");
2456 tab->AddTab("Tab2");
2457 tab->MapSubwindows();
2458
2459 return tab;
2460}
2461
2462////////////////////////////////////////////////////////////////////////////////
2463/// Helper method to create TGListBox widget
2464
2466{
2467 TGListBox *lb = new TGListBox();
2468
2469 lb->AddEntry("Entry 1", 0);
2470 lb->AddEntry("Entry 2", 1);
2471 lb->AddEntry("Entry 3", 2);
2472 lb->AddEntry("Entry 4", 3);
2473 lb->AddEntry("Entry 5", 4);
2474 lb->AddEntry("Entry 6", 5);
2475 lb->AddEntry("Entry 7", 6);
2476 lb->MapSubwindows();
2477
2478 lb->Resize(100,100);
2479
2480 return lb;
2481}
2482
2483////////////////////////////////////////////////////////////////////////////////
2484/// Helper method to create TGComboBox widget
2485
2487{
2488 TGComboBox *cb = new TGComboBox();
2489
2490 cb->AddEntry("Entry 1 ", 0);
2491 cb->AddEntry("Entry 2 ", 1);
2492 cb->AddEntry("Entry 3 ", 2);
2493 cb->AddEntry("Entry 4 ", 3);
2494 cb->AddEntry("Entry 5 ", 4);
2495 cb->AddEntry("Entry 6 ", 5);
2496 cb->AddEntry("Entry 7 ", 6);
2497 cb->MapSubwindows();
2498
2501 gVirtualX->GetFontProperties(fs, max_ascent, max_descent);
2502
2503 cb->Resize(cb->GetListBox()->GetDefaultWidth(), max_ascent+max_descent+7);
2504 return cb;
2505}
2506
2507////////////////////////////////////////////////////////////////////////////////
2508/// Helper method to create TGHorizontal3DLine widget.
2509
2511{
2512 TGHorizontal3DLine *l = new TGHorizontal3DLine(0, 100, 2);
2513 l->Resize(100, 2);
2514
2515 return l;
2516}
2517
2518////////////////////////////////////////////////////////////////////////////////
2519/// Helper method to create TGVertical3DLine widget.
2520
2522{
2524 l->Resize(2, 100);
2525
2526 return l;
2527}
2528
2529////////////////////////////////////////////////////////////////////////////////
2530/// Helper method to create TGHScrollBar
2531
2533{
2534 TGHScrollBar *b = new TGHScrollBar();
2535
2536 b->Resize(100, b->GetDefaultHeight());
2537 b->SetRange(100, 20);
2538 b->MapSubwindows();
2539
2540 return b;
2541}
2542
2543////////////////////////////////////////////////////////////////////////////////
2544/// Helper method to create TGVScrollBar
2545
2547{
2548 TGVScrollBar *b = new TGVScrollBar();
2549
2550 b->Resize(b->GetDefaultWidth(), 100);
2551 b->MapSubwindows();
2552 b->SetRange(100, 20);
2553
2554 return b;
2555}
2556
2557////////////////////////////////////////////////////////////////////////////////
2558/// Helper method to create TGHProgressBar
2559
2561{
2563
2564 b->Resize(100, b->GetDefaultHeight());
2565 b->SetPosition(25);
2566 b->Format("%.2f");
2567 b->SetFillType(TGProgressBar::kBlockFill);
2568
2569 return b;
2570}
2571
2572////////////////////////////////////////////////////////////////////////////////
2573/// Helper method to create TGVProgressBar
2574
2576{
2578
2579 b->Resize(b->GetDefaultWidth(), 100);
2580 b->SetPosition(25);
2581 b->SetFillType(TGProgressBar::kBlockFill);
2582
2583 return b;
2584}
2585
2586
@ 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
Definition RtypesCore.h:63
unsigned long ULong_t
Definition RtypesCore.h:55
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:374
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:406
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:2479
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
Definition TColor.cxx:2441
A button abstract base class.
Definition TGButton.h:68
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual void * GetUserData() const
Definition TGButton.h:108
virtual void EmitSignals(Bool_t wasUp)
Emit button signals.
Definition TGButton.cxx:385
UInt_t fTWidth
button width
Definition TGButton.h:73
UInt_t fTHeight
button height
Definition TGButton.h:74
EButtonState fState
button state
Definition TGButton.h:75
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition TGButton.cxx:459
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:234
Bool_t IsEditable() const
Definition TGClient.h:89
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition TGClient.cxx:224
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
Definition TGClient.cxx:289
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition TGClient.cxx:381
TGPicturePool * GetPicturePool() const
Definition TGClient.h:126
void FreePicture(const TGPicture *pic)
Free picture resource.
Definition TGClient.cxx:317
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual TGListBox * GetListBox() const
Definition TGComboBox.h:110
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
virtual TList * GetList() const
Definition TGFrame.h:310
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
TGCompositeFrame(const TGCompositeFrame &)=delete
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
TList * fList
container of frame elements
Definition TGFrame.h:292
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
Definition TGFrame.cxx:1072
void SetEditable(Bool_t on=kTRUE) override
Switch ON/OFF edit mode.
Definition TGFrame.cxx:948
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
Definition TGFrame.cxx:1022
void ChangeOptions(UInt_t options) override
Change composite frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:1043
static TClass * Class()
void SetLayoutBroken(Bool_t on=kTRUE) override
Set broken layout. No Layout method is called.
Definition TGFrame.cxx:1012
A frame with handles that allow it to be undocked (i.e.
void AddFrame(TGFrame *f, TGLayoutHints *hints) override
Add frame to dockable frame container. Frame and hints are NOT adopted.
void SetWindowName(const char *name) override
Set window name so it appear as title of the undock window.
This class creates a file selection dialog.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition TGFrame.cxx:321
static Pixel_t GetDefaultSelectedBackground()
Get default selected frame background.
Definition TGFrame.cxx:696
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition TGFrame.cxx:629
static const TGGC & GetBlackGC()
Get black graphics context.
Definition TGFrame.cxx:735
UInt_t fOptions
frame options
Definition TGFrame.h:94
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
UInt_t fHeight
frame height
Definition TGFrame.h:88
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition TGFrame.cxx:312
void DoRedraw() override
Redraw the frame.
Definition TGFrame.cxx:430
void MapWindow() override
map window
Definition TGFrame.h:204
virtual Pixel_t GetForeground() const
Return frame foreground color.
Definition TGFrame.cxx:303
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition TGFrame.cxx:755
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition TGFrame.cxx:683
virtual UInt_t GetOptions() const
Definition TGFrame.h:197
void UnmapWindow() override
unmap window
Definition TGFrame.h:206
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition TGFrame.cxx:765
UInt_t fWidth
frame width
Definition TGFrame.h:87
UInt_t GetHeight() const
Definition TGFrame.h:225
UInt_t GetWidth() const
Definition TGFrame.h:224
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition TGFrame.cxx:775
void MapRaised() override
map raised
Definition TGFrame.h:205
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
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:385
static TClass * Class()
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y) override
Draw a hot string and underline the hot character.
Definition TGString.cxx:175
This class handles GUI labels.
Definition TGLabel.h:24
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:195
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
Definition TGFrame.cxx:1858
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
Definition TGFrame.cxx:1801
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
Definition TGFrame.cxx:1788
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
Definition TGFrame.cxx:1606
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:435
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:83
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:1845
GContext_t fNormGC
normal drawing graphics context
Definition TGMenu.h:126
GContext_t fSelGC
graphics context for drawing selections
Definition TGMenu.h:127
virtual void CheckEntry(Int_t id)
Check a menu entry (i.e. add a check mark in front of it).
Definition TGMenu.cxx:1782
UInt_t fEntrySep
separation distance between entries
Definition TGMenu.h:135
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1724
virtual void EnableEntry(Int_t id)
Enable entry. By default entries are enabled.
Definition TGMenu.cxx:1705
UInt_t fXl
Max width of all menu entries.
Definition TGMenu.h:122
FontStruct_t fFontStruct
font to draw menu entries
Definition TGMenu.h:129
virtual void UnCheckEntry(Int_t id)
Uncheck menu entry (i.e. remove check mark).
Definition TGMenu.cxx:1807
virtual void AddSeparator(TGMenuEntry *before=nullptr)
Add a menu separator to the menu.
Definition TGMenu.cxx:1060
FontStruct_t fHifontStruct
font to draw highlighted entries
Definition TGMenu.h:130
void DrawRCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw radio check mark. Used for radio button type menu entries.
Definition TGMenu.cxx:1670
void DrawCheckMark(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw check mark. Used for checked button type menu entries.
Definition TGMenu.cxx:1651
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:990
UInt_t fMenuWidth
width of popup menu
Definition TGMenu.h:123
void DrawTrianglePattern(GContext_t gc, Int_t l, Int_t t, Int_t r, Int_t b)
Draw triangle pattern.
Definition TGMenu.cxx:1631
TGFrame * GetContainer() const
Definition TGShutter.h:45
A shutter widget contains a set of shutter items that can be open and closed like a shutter.
Definition TGShutter.h:55
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition TGShutter.cxx:73
TGShutterItem * GetItem(const char *name)
returns a shutter item by name (name is hot string of shutter item)
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:92
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:374
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Definition TGWindow.cxx:248
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition TGWindow.h: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:336
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:35
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:542
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
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:139
const char * Data() const
Definition TString.h:376
@ kIgnoreCase
Definition TString.h:277
Bool_t IsNull() const
Definition TString.h:414
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:2378
virtual const char * UnixPathName(const char *unixpathname)
Convert from a local pathname to a Unix pathname.
Definition TSystem.cxx:1063
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition TSystem.cxx:934
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