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