TGuiBuilder.cxx

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGuiBuilder.cxx 31685 2009-12-08 16:33:13Z bellenot $
00002 // Author: Valeriy Onuchin   12/08/04
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //
00014 // TGuiBuilder
00015 //
00016 //
00017 //  ************************************************
00018 //                ROOT GUI Builder principles
00019 //  ************************************************
00020 //
00021 //  With the GUI builder, we try to make the next step from WYSIWYG
00022 //  to embedded editing concept - WYSIWYE ("what you see is what you edit").
00023 //  The ROOT GUI Builder allows modifying real GUI objects.
00024 //  For example, one can edit the existing GUI application created by
00025 //  $ROOTSYS/tutorials/gui/guitest.C.
00026 //  GUI components can be added to a design area from a widget palette,
00027 //  or can be borrowed from another application.
00028 //  One can drag and and drop TCanvas's menu bar into the application.
00029 //  GUI objects can be resized and dragged, copied and pasted.
00030 //  ROOT GUI Builder allows changing the layout, snap to grid, change object's
00031 //  layout order via the GUI Builder toolbar, or by options in the right-click
00032 //  context menus.
00033 //  A final design can be immediatly tested and used, or saved as a C++ macro.
00034 //  For example, it's possible to rearrange buttons in control bar,
00035 //  add separators etc. and continue to use a new fancy control bar in the
00036 //  application.
00037 //
00038 //  ************************************************
00039 //
00040 //  The following is a short description of the GUI Builder actions and key shortcuts:
00041 //
00042 //   o Press Ctrl-Double-Click to start/stop edit mode
00043 //   o Press Double-Click to activate quick edit action (defined in root.mimes)
00044 //
00045 //                 Selection, grabbing, dropping
00046 //       ************************************************
00047 //    It is possible to select, drag any frame and drop it to any frame
00048 //
00049 //   o Click left mouse button or Ctrl-Click to select an object to edit.
00050 //   o Press right mouse button to activate context menu
00051 //   o Mutiple selection (grabbing):
00052 //      - draw lasso and press Return key
00053 //      - press Shift key and draw lasso
00054 //   o Dropping:
00055 //      - select frame and press Ctrl-Return key
00056 //   o Changing layout order:
00057 //      - select frame and use arrow keys to change layout order
00058 //   o Alignment:
00059 //      - draw lasso and press arrow keys (or Shift-Arrow key) to align frames
00060 //
00061 //                    Key shortcuts
00062 //       ************************************************
00063 //   o Return      - grab selected frames
00064 //   o Ctrl-Return - drop frames
00065 //   o Del         - delete selected frame
00066 //   o Shift-Del   - crop action
00067 //   o Ctrl-X      - cut action
00068 //   o Ctrl-C      - copy action
00069 //   o Ctrl-V      - paste action
00070 //   o Ctrl-R      - replace action
00071 //   o Ctrl-L      - compact layout
00072 //   o Ctrl-B      - break layout
00073 //   o Ctrl-H      - switch horizontal-vertical layout
00074 //   o Ctrl-G      - switch on/off grid
00075 //   o Ctrl-S      - save action
00076 //   o Ctrl-O      - open and execute a ROOT macro file. GUI components created
00077 //                   after macro execution will be emebedded to currently edited
00078 //                   design area.
00079 //   o Ctrl-N      - create new main frame
00080 //
00081 //Begin_Html
00082 /*
00083 <img src="gif/RootGuiBuilder.gif">
00084 */
00085 //End_Html
00086 
00087 
00088 #include "TGuiBuilder.h"
00089 #include "TVirtualDragManager.h"
00090 #include "TPluginManager.h"
00091 #include "TROOT.h"
00092 #include "TApplication.h"
00093 
00094 ClassImp(TGuiBuilder)
00095 ClassImp(TGuiBldAction)
00096 
00097 TGuiBuilder *gGuiBuilder = 0;
00098 static TPluginHandler *gHandler = 0;
00099 
00100 //______________________________________________________________________________
00101 TGuiBldAction::TGuiBldAction(const char *name, const char *title,
00102                Int_t type,  TGLayoutHints *hints) :
00103    TNamed(name, title), fType(type), fHints(hints)
00104 {
00105    // constructor
00106 
00107    fPicture = 0;
00108    fPic = 0;  
00109    fAct = "";
00110 }
00111 
00112 //______________________________________________________________________________
00113 TGuiBldAction::~TGuiBldAction()
00114 {
00115    // destructor
00116 }
00117 
00118 //______________________________________________________________________________
00119 TGuiBuilder::TGuiBuilder()
00120 {
00121    // constructor
00122 
00123    fAction = 0;
00124    // load plugin
00125    if (!gGuiBuilder) {
00126       gHandler = gROOT->GetPluginManager()->FindHandler("TGuiBuilder");
00127 
00128       if (!gHandler || (gHandler->LoadPlugin() == -1)) return;
00129 
00130       gGuiBuilder = this;
00131       gHandler->ExecPlugin(0);
00132    } else {
00133       gGuiBuilder->Show();
00134    }
00135 }
00136 
00137 //______________________________________________________________________________
00138 TGuiBuilder::~TGuiBuilder()
00139 {
00140    // destructor
00141 }
00142 
00143 //______________________________________________________________________________
00144 TGuiBuilder *TGuiBuilder::Instance()
00145 {
00146    // return an instance of TGuiBuilder object
00147 
00148    return (gGuiBuilder? gGuiBuilder : new TGuiBuilder());
00149 }

Generated on Tue Jul 5 14:22:06 2011 for ROOT_528-00b_version by  doxygen 1.5.1