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