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//
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
95
98
99////////////////////////////////////////////////////////////////////////////////
100/// constructor
101
102TGuiBldAction::TGuiBldAction(const char *name, const char *title,
103 Int_t type, TGLayoutHints *hints) :
104 TNamed(name, title), fType(type), fHints(hints)
105{
106 fPicture = 0;
107 fPic = 0;
108 fAct = "";
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// destructor
113
115{
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// constructor
120
122{
123 fAction = 0;
124 // load plugin
125 if (!gGuiBuilder) {
126 gHandler = gROOT->GetPluginManager()->FindHandler("TGuiBuilder");
127
128 if (!gHandler || (gHandler->LoadPlugin() == -1)) return;
129
130 gGuiBuilder = this;
132 } else {
133 gGuiBuilder->Show();
134 }
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// destructor
139
141{
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// return an instance of TGuiBuilder object
146
148{
149 return (gGuiBuilder? gGuiBuilder : new TGuiBuilder());
150}
#define ClassImp(name)
Definition Rtypes.h:364
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
TGuiBuilder * gGuiBuilder
static TPluginHandler * gHandler
R__EXTERN TGuiBuilder * gGuiBuilder
Definition TGuiBuilder.h:73
#define gROOT
Definition TROOT.h:406
virtual ~TGuiBldAction()
destructor
TGuiBldAction(const char *name=0, const char *title=0, Int_t type=kGuiBldCtor, TGLayoutHints *hints=0)
constructor
const TGPicture * fPicture
Definition TGuiBuilder.h:38
const char * fPic
Definition TGuiBuilder.h:37
virtual void Show()
Definition TGuiBuilder.h:65
TGuiBldAction * fAction
Definition TGuiBuilder.h:53
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
Long_t ExecPlugin(int nargs, const T &... params)
Int_t LoadPlugin()
Load the plugin library for this handler.