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