Logo ROOT   6.08/07
Reference Guide
TGuiBuilder.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Valeriy Onuchin 12/08/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 //
14 // TGuiBuilder
15 //
16 //
17 // ************************************************
18 // ROOT GUI Builder principles
19 // ************************************************
20 //
21 // With the GUI builder, we try to make the next step from WYSIWYG
22 // to embedded editing concept - WYSIWYE ("what you see is what you edit").
23 // The ROOT GUI Builder allows modifying real GUI objects.
24 // For example, one can edit the existing GUI application created by
25 // $ROOTSYS/tutorials/gui/guitest.C.
26 // GUI components can be added to a design area from a widget palette,
27 // or can be borrowed from another application.
28 // One can drag and and drop TCanvas's menu bar into the application.
29 // GUI objects can be resized and dragged, copied and pasted.
30 // ROOT GUI Builder allows changing the layout, snap to grid, change object's
31 // layout order via the GUI Builder toolbar, or by options in the right-click
32 // context menus.
33 // A final design can be immediatly tested and used, or saved as a C++ macro.
34 // For example, it's possible to rearrange buttons in control bar,
35 // add separators etc. and continue to use a new fancy control bar in the
36 // application.
37 //
38 // ************************************************
39 //
40 // The following is a short description of the GUI Builder actions and key shortcuts:
41 //
42 // o Press Ctrl-Double-Click to start/stop edit mode
43 // o Press Double-Click to activate quick edit action (defined in root.mimes)
44 //
45 // Selection, grabbing, dropping
46 // ************************************************
47 // It is possible to select, drag any frame and drop it to any frame
48 //
49 // o Click left mouse button or Ctrl-Click to select an object to edit.
50 // o Press right mouse button to activate context menu
51 // o Multiple selection (grabbing):
52 // - draw lasso and press Return key
53 // - press Shift key and draw lasso
54 // o Dropping:
55 // - select frame and press Ctrl-Return key
56 // o Changing layout order:
57 // - select frame and use arrow keys to change layout order
58 // o Alignment:
59 // - draw lasso and press arrow keys (or Shift-Arrow key) to align frames
60 //
61 // Key shortcuts
62 // ************************************************
63 // o Return - grab selected frames
64 // o Ctrl-Return - drop frames
65 // o Del - delete selected frame
66 // o Shift-Del - crop action
67 // o Ctrl-X - cut action
68 // o Ctrl-C - copy action
69 // o Ctrl-V - paste action
70 // o Ctrl-R - replace action
71 // o Ctrl-L - compact layout
72 // o Ctrl-B - break layout
73 // o Ctrl-H - switch horizontal-vertical layout
74 // o Ctrl-G - switch on/off grid
75 // o Ctrl-S - save action
76 // o Ctrl-O - open and execute a ROOT macro file. GUI components created
77 // after macro execution will be emebedded to currently edited
78 // design area.
79 // o Ctrl-N - create new main frame
80 //
81 //Begin_Html
82 /*
83 <img src="gif/RootGuiBuilder.gif">
84 */
85 //End_Html
86 
87 
88 #include "TGuiBuilder.h"
89 #include "TVirtualDragManager.h"
90 #include "TPluginManager.h"
91 #include "TROOT.h"
92 #include "TApplication.h"
93 
96 
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// constructor
102 
103 TGuiBldAction::TGuiBldAction(const char *name, const char *title,
104  Int_t type, TGLayoutHints *hints) :
105  TNamed(name, title), fType(type), fHints(hints)
106 {
107  fPicture = 0;
108  fPic = 0;
109  fAct = "";
110 }
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 /// destructor
114 
116 {
117 }
118 
119 ////////////////////////////////////////////////////////////////////////////////
120 /// constructor
121 
123 {
124  fAction = 0;
125  // load plugin
126  if (!gGuiBuilder) {
127  gHandler = gROOT->GetPluginManager()->FindHandler("TGuiBuilder");
128 
129  if (!gHandler || (gHandler->LoadPlugin() == -1)) return;
130 
131  gGuiBuilder = this;
132  gHandler->ExecPlugin(0);
133  } else {
134  gGuiBuilder->Show();
135  }
136 }
137 
138 ////////////////////////////////////////////////////////////////////////////////
139 /// destructor
140 
142 {
143 }
144 
145 ////////////////////////////////////////////////////////////////////////////////
146 /// return an instance of TGuiBuilder object
147 
149 {
150  return (gGuiBuilder? gGuiBuilder : new TGuiBuilder());
151 }
virtual void Show()
Definition: TGuiBuilder.h:67
virtual ~TGuiBuilder()
destructor
#define gROOT
Definition: TROOT.h:364
Int_t LoadPlugin()
Load the plugin library for this handler.
int Int_t
Definition: RtypesCore.h:41
TGuiBuilder()
constructor
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
static TPluginHandler * gHandler
Definition: TGuiBuilder.cxx:98
TGuiBuilder * gGuiBuilder
Definition: TGuiBuilder.cxx:97
Long_t ExecPlugin(int nargs, const T &... params)
PyObject * fType
virtual ~TGuiBldAction()
destructor
#define ClassImp(name)
Definition: Rtypes.h:279
int type
Definition: TGX11.cxx:120
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
char name[80]
Definition: TGX11.cxx:109