Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/** \class TGuiBuilder
14 \ingroup guibuilder
15
16### %ROOT GUI Builder principles
17
18With the GUI builder, we try to make the next step from WYSIWYG
19to embedded editing concept - WYSIWYE ("what you see is what you edit").
20The ROOT GUI Builder allows modifying real GUI objects.
21For example, one can edit the existing GUI application created by
22guitest.C.
23GUI components can be added to a design area from a widget palette,
24or can be borrowed from another application.
25One can drag and and drop TCanvas's menu bar into the application.
26GUI objects can be resized and dragged, copied and pasted.
27ROOT GUI Builder allows changing the layout, snap to grid, change object's
28layout order via the GUI Builder toolbar, or by options in the right-click
29context menus.
30A final design can be immediately tested and used, or saved as a C++ macro.
31For example, it's possible to rearrange buttons in control bar,
32add separators etc. and continue to use a new fancy control bar in the
33application.
34
35
36The following is a short description of the GUI Builder actions and key shortcuts:
37
38 - Press Ctrl-Double-Click to start/stop edit mode
39 - Press Double-Click to activate quick edit action (defined in root.mimes)
40
41### Selection, grabbing, dropping
42
43It is possible to select, drag any frame and drop it to any frame
44
45 - Click left mouse button or Ctrl-Click to select an object to edit.
46 - Press right mouse button to activate context menu
47 - Multiple selection (grabbing):
48 - draw lasso and press Return key
49 - press Shift key and draw lasso
50 - Dropping:
51 - select frame and press Ctrl-Return key
52 - Changing layout order:
53 - select frame and use arrow keys to change layout order
54 - Alignment:
55 - draw lasso and press arrow keys (or Shift-Arrow key) to align frames
56
57### Key shortcuts
58
59 - Return - grab selected frames
60 - Ctrl-Return - drop frames
61 - Del - delete selected frame
62 - Shift-Del - crop action
63 - Ctrl-X - cut action
64 - Ctrl-C - copy action
65 - Ctrl-V - paste action
66 - Ctrl-R - replace action
67 - Ctrl-L - compact layout
68 - Ctrl-B - break layout
69 - Ctrl-H - switch horizontal-vertical layout
70 - Ctrl-G - switch on/off grid
71 - Ctrl-S - save action
72 - Ctrl-O - open and execute a ROOT macro file. GUI components created
73 after macro execution will be embedded to currently edited
74 design area.
75 - Ctrl-N - create new main frame
76
77*/
78
79
80#include "TGuiBuilder.h"
81#include "TVirtualDragManager.h"
82#include "TPluginManager.h"
83#include "TROOT.h"
84
87
90
91////////////////////////////////////////////////////////////////////////////////
92/// constructor
93
94TGuiBldAction::TGuiBldAction(const char *name, const char *title,
95 Int_t type, TGLayoutHints *hints) :
96 TNamed(name, title), fType(type), fHints(hints)
97{
98 fPicture = 0;
99 fPic = 0;
100 fAct = "";
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// destructor
105
107{
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// constructor
112
114{
115 fAction = 0;
116 // load plugin
117 if (!gGuiBuilder) {
118 gHandler = gROOT->GetPluginManager()->FindHandler("TGuiBuilder");
119
120 if (!gHandler || (gHandler->LoadPlugin() == -1)) return;
121
122 gGuiBuilder = this;
124 } else {
125 gGuiBuilder->Show();
126 }
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// destructor
131
133{
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// return an instance of TGuiBuilder object
138
140{
141 return (gGuiBuilder? gGuiBuilder : new TGuiBuilder());
142}
#define ClassImp(name)
Definition Rtypes.h:382
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
TGuiBuilder * gGuiBuilder
static TPluginHandler * gHandler
R__EXTERN TGuiBuilder * gGuiBuilder
Definition TGuiBuilder.h:66
#define gROOT
Definition TROOT.h:406
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
~TGuiBldAction() override
destructor
TGuiBldAction(const char *name=nullptr, const char *title=nullptr, Int_t type=kGuiBldCtor, TGLayoutHints *hints=nullptr)
constructor
const TGPicture * fPicture
Definition TGuiBuilder.h:31
const char * fPic
Definition TGuiBuilder.h:30
virtual void Show()
Definition TGuiBuilder.h:58
TGuiBldAction * fAction
Definition TGuiBuilder.h:46
virtual ~TGuiBuilder()
destructor
static TGuiBuilder * Instance()
return an instance of TGuiBuilder object
TGuiBuilder()
constructor
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Longptr_t ExecPlugin(int nargs)
Int_t LoadPlugin()
Load the plugin library for this handler.