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