ROOT logo
// @(#)root/gui:$Id: TGuiBuilder.cxx 31685 2009-12-08 16:33:13Z bellenot $
// Author: Valeriy Onuchin   12/08/04

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//
// TGuiBuilder
//
//
//  ************************************************
//                ROOT GUI Builder principles
//  ************************************************
//
//  With the GUI builder, we try to make the next step from WYSIWYG
//  to embedded editing concept - WYSIWYE ("what you see is what you edit").
//  The ROOT GUI Builder allows modifying real GUI objects.
//  For example, one can edit the existing GUI application created by
//  $ROOTSYS/tutorials/gui/guitest.C.
//  GUI components can be added to a design area from a widget palette,
//  or can be borrowed from another application.
//  One can drag and and drop TCanvas's menu bar into the application.
//  GUI objects can be resized and dragged, copied and pasted.
//  ROOT GUI Builder allows changing the layout, snap to grid, change object's
//  layout order via the GUI Builder toolbar, or by options in the right-click
//  context menus.
//  A final design can be immediatly tested and used, or saved as a C++ macro.
//  For example, it's possible to rearrange buttons in control bar,
//  add separators etc. and continue to use a new fancy control bar in the
//  application.
//
//  ************************************************
//
//  The following is a short description of the GUI Builder actions and key shortcuts:
//
//   o Press Ctrl-Double-Click to start/stop edit mode
//   o Press Double-Click to activate quick edit action (defined in root.mimes)
//
//                 Selection, grabbing, dropping
//       ************************************************
//    It is possible to select, drag any frame and drop it to any frame
//
//   o Click left mouse button or Ctrl-Click to select an object to edit.
//   o Press right mouse button to activate context menu
//   o Mutiple selection (grabbing):
//      - draw lasso and press Return key
//      - press Shift key and draw lasso
//   o Dropping:
//      - select frame and press Ctrl-Return key
//   o Changing layout order:
//      - select frame and use arrow keys to change layout order
//   o Alignment:
//      - draw lasso and press arrow keys (or Shift-Arrow key) to align frames
//
//                    Key shortcuts
//       ************************************************
//   o Return      - grab selected frames
//   o Ctrl-Return - drop frames
//   o Del         - delete selected frame
//   o Shift-Del   - crop action
//   o Ctrl-X      - cut action
//   o Ctrl-C      - copy action
//   o Ctrl-V      - paste action
//   o Ctrl-R      - replace action
//   o Ctrl-L      - compact layout
//   o Ctrl-B      - break layout
//   o Ctrl-H      - switch horizontal-vertical layout
//   o Ctrl-G      - switch on/off grid
//   o Ctrl-S      - save action
//   o Ctrl-O      - open and execute a ROOT macro file. GUI components created
//                   after macro execution will be emebedded to currently edited
//                   design area.
//   o Ctrl-N      - create new main frame
//
//Begin_Html
/*
<img src="gif/RootGuiBuilder.gif">
*/
//End_Html


#include "TGuiBuilder.h"
#include "TVirtualDragManager.h"
#include "TPluginManager.h"
#include "TROOT.h"
#include "TApplication.h"

ClassImp(TGuiBuilder)
ClassImp(TGuiBldAction)

TGuiBuilder *gGuiBuilder = 0;
static TPluginHandler *gHandler = 0;

//______________________________________________________________________________
TGuiBldAction::TGuiBldAction(const char *name, const char *title,
               Int_t type,  TGLayoutHints *hints) :
   TNamed(name, title), fType(type), fHints(hints)
{
   // constructor

   fPicture = 0;
   fPic = 0;  
   fAct = "";
}

//______________________________________________________________________________
TGuiBldAction::~TGuiBldAction()
{
   // destructor
}

//______________________________________________________________________________
TGuiBuilder::TGuiBuilder()
{
   // constructor

   fAction = 0;
   // load plugin
   if (!gGuiBuilder) {
      gHandler = gROOT->GetPluginManager()->FindHandler("TGuiBuilder");

      if (!gHandler || (gHandler->LoadPlugin() == -1)) return;

      gGuiBuilder = this;
      gHandler->ExecPlugin(0);
   } else {
      gGuiBuilder->Show();
   }
}

//______________________________________________________________________________
TGuiBuilder::~TGuiBuilder()
{
   // destructor
}

//______________________________________________________________________________
TGuiBuilder *TGuiBuilder::Instance()
{
   // return an instance of TGuiBuilder object

   return (gGuiBuilder? gGuiBuilder : new TGuiBuilder());
}
 TGuiBuilder.cxx:1
 TGuiBuilder.cxx:2
 TGuiBuilder.cxx:3
 TGuiBuilder.cxx:4
 TGuiBuilder.cxx:5
 TGuiBuilder.cxx:6
 TGuiBuilder.cxx:7
 TGuiBuilder.cxx:8
 TGuiBuilder.cxx:9
 TGuiBuilder.cxx:10
 TGuiBuilder.cxx:11
 TGuiBuilder.cxx:12
 TGuiBuilder.cxx:13
 TGuiBuilder.cxx:14
 TGuiBuilder.cxx:15
 TGuiBuilder.cxx:16
 TGuiBuilder.cxx:17
 TGuiBuilder.cxx:18
 TGuiBuilder.cxx:19
 TGuiBuilder.cxx:20
 TGuiBuilder.cxx:21
 TGuiBuilder.cxx:22
 TGuiBuilder.cxx:23
 TGuiBuilder.cxx:24
 TGuiBuilder.cxx:25
 TGuiBuilder.cxx:26
 TGuiBuilder.cxx:27
 TGuiBuilder.cxx:28
 TGuiBuilder.cxx:29
 TGuiBuilder.cxx:30
 TGuiBuilder.cxx:31
 TGuiBuilder.cxx:32
 TGuiBuilder.cxx:33
 TGuiBuilder.cxx:34
 TGuiBuilder.cxx:35
 TGuiBuilder.cxx:36
 TGuiBuilder.cxx:37
 TGuiBuilder.cxx:38
 TGuiBuilder.cxx:39
 TGuiBuilder.cxx:40
 TGuiBuilder.cxx:41
 TGuiBuilder.cxx:42
 TGuiBuilder.cxx:43
 TGuiBuilder.cxx:44
 TGuiBuilder.cxx:45
 TGuiBuilder.cxx:46
 TGuiBuilder.cxx:47
 TGuiBuilder.cxx:48
 TGuiBuilder.cxx:49
 TGuiBuilder.cxx:50
 TGuiBuilder.cxx:51
 TGuiBuilder.cxx:52
 TGuiBuilder.cxx:53
 TGuiBuilder.cxx:54
 TGuiBuilder.cxx:55
 TGuiBuilder.cxx:56
 TGuiBuilder.cxx:57
 TGuiBuilder.cxx:58
 TGuiBuilder.cxx:59
 TGuiBuilder.cxx:60
 TGuiBuilder.cxx:61
 TGuiBuilder.cxx:62
 TGuiBuilder.cxx:63
 TGuiBuilder.cxx:64
 TGuiBuilder.cxx:65
 TGuiBuilder.cxx:66
 TGuiBuilder.cxx:67
 TGuiBuilder.cxx:68
 TGuiBuilder.cxx:69
 TGuiBuilder.cxx:70
 TGuiBuilder.cxx:71
 TGuiBuilder.cxx:72
 TGuiBuilder.cxx:73
 TGuiBuilder.cxx:74
 TGuiBuilder.cxx:75
 TGuiBuilder.cxx:76
 TGuiBuilder.cxx:77
 TGuiBuilder.cxx:78
 TGuiBuilder.cxx:79
 TGuiBuilder.cxx:80
 TGuiBuilder.cxx:81
 TGuiBuilder.cxx:82
 TGuiBuilder.cxx:83
 TGuiBuilder.cxx:84
 TGuiBuilder.cxx:85
 TGuiBuilder.cxx:86
 TGuiBuilder.cxx:87
 TGuiBuilder.cxx:88
 TGuiBuilder.cxx:89
 TGuiBuilder.cxx:90
 TGuiBuilder.cxx:91
 TGuiBuilder.cxx:92
 TGuiBuilder.cxx:93
 TGuiBuilder.cxx:94
 TGuiBuilder.cxx:95
 TGuiBuilder.cxx:96
 TGuiBuilder.cxx:97
 TGuiBuilder.cxx:98
 TGuiBuilder.cxx:99
 TGuiBuilder.cxx:100
 TGuiBuilder.cxx:101
 TGuiBuilder.cxx:102
 TGuiBuilder.cxx:103
 TGuiBuilder.cxx:104
 TGuiBuilder.cxx:105
 TGuiBuilder.cxx:106
 TGuiBuilder.cxx:107
 TGuiBuilder.cxx:108
 TGuiBuilder.cxx:109
 TGuiBuilder.cxx:110
 TGuiBuilder.cxx:111
 TGuiBuilder.cxx:112
 TGuiBuilder.cxx:113
 TGuiBuilder.cxx:114
 TGuiBuilder.cxx:115
 TGuiBuilder.cxx:116
 TGuiBuilder.cxx:117
 TGuiBuilder.cxx:118
 TGuiBuilder.cxx:119
 TGuiBuilder.cxx:120
 TGuiBuilder.cxx:121
 TGuiBuilder.cxx:122
 TGuiBuilder.cxx:123
 TGuiBuilder.cxx:124
 TGuiBuilder.cxx:125
 TGuiBuilder.cxx:126
 TGuiBuilder.cxx:127
 TGuiBuilder.cxx:128
 TGuiBuilder.cxx:129
 TGuiBuilder.cxx:130
 TGuiBuilder.cxx:131
 TGuiBuilder.cxx:132
 TGuiBuilder.cxx:133
 TGuiBuilder.cxx:134
 TGuiBuilder.cxx:135
 TGuiBuilder.cxx:136
 TGuiBuilder.cxx:137
 TGuiBuilder.cxx:138
 TGuiBuilder.cxx:139
 TGuiBuilder.cxx:140
 TGuiBuilder.cxx:141
 TGuiBuilder.cxx:142
 TGuiBuilder.cxx:143
 TGuiBuilder.cxx:144
 TGuiBuilder.cxx:145
 TGuiBuilder.cxx:146
 TGuiBuilder.cxx:147
 TGuiBuilder.cxx:148
 TGuiBuilder.cxx:149