Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TRootGuiBuilder.h
Go to the documentation of this file.
1 // @(#)root/guibuilder:$Id$
2 // Author: Valeriy Onuchin 12/09/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 #ifndef ROOT_TRootGuiBuilder
13 #define ROOT_TRootGuiBuilder
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TRootGuiBuilder //
19 // //
20 //////////////////////////////////////////////////////////////////////////
21 
22 #include "TGFrame.h"
23 #include "TGuiBuilder.h"
24 
25 enum EGuiBuilderMenuIds {
26  kGUIBLD_FILE_NEW,
27  kGUIBLD_FILE_CLOSE,
28  kGUIBLD_FILE_EXIT,
29  kGUIBLD_FILE_START,
30  kGUIBLD_FILE_STOP,
31  kGUIBLD_FILE_SAVE,
32 
33  kGUIBLD_EDIT_PREF,
34 
35  kGUIBLD_WINDOW_HOR,
36  kGUIBLD_WINDOW_VERT,
37  kGUIBLD_WINDOW_CASCADE,
38  kGUIBLD_WINDOW_OPAQUE,
39  kGUIBLD_WINDOW_ARRANGE,
40 
41  kGUIBLD_HELP_CONTENTS,
42  kGUIBLD_HELP_ABOUT,
43  kGUIBLD_HELP_BUG,
44 
45  kGUIBLD_FILE_OPEN
46 };
47 
48 
49 class TGShutter;
50 class TGMdiMainFrame;
51 class TGDockableFrame;
52 class TGMdiMenuBar;
53 class TGPopupMenu;
54 class TGStatusBar;
55 class TGuiBldDragManager;
56 class TGToolBar;
57 class TGMdiFrame;
58 class TGuiBldEditor;
59 class TGButton;
60 class TGPictureButton;
61 class TImage;
62 class TTimer;
63 
64 //////////////////////////////////////////////////////////////////////////
65 class TRootGuiBuilder : public TGuiBuilder, public TGMainFrame {
66 
67 friend class TGuiBldDragManager;
68 
69 private:
70  TGuiBldDragManager *fManager; // drag and drop manager
71  TGButton *fActionButton;// action button
72  TGToolBar *fToolBar; // guibuider toolbar
73  TGShutter *fShutter; // widget palette
74  TGMdiMainFrame *fMain; // main mdi frame
75  TGDockableFrame *fToolDock; // dockable frame where toolbar is located
76  TGDockableFrame *fShutterDock; // dockable frame where widget palette is located
77  TGMdiMenuBar *fMenuBar; // guibuilder menu bar
78  TGPopupMenu *fMenuFile; // "File" popup menu
79  TGPopupMenu *fMenuWindow; // "Window" popup menu
80  TGPopupMenu *fMenuEdit; // "Edit" popup menu
81  TGPopupMenu *fMenuHelp; // "Help" popup menu
82  TGStatusBar *fStatusBar; // guibuilder status bar
83  TGFrame *fSelected; // selected frame
84  TGMdiFrame *fEditable; // mdi frame where editted frame is located
85  TGuiBldEditor *fEditor; // frame property editor
86  const TGPicture *fIconPic; // icon picture
87  TGPictureButton *fStartButton; // start button
88  Int_t fClosing;
89 
90  static TGGC *fgBgnd;
91  static TGGC *fgBgndPopup;
92  static TGGC *fgBgndPopupHlght;
93 
94  void InitMenu();
95  void EnableLassoButtons(Bool_t on = kTRUE);
96  void EnableSelectedButtons(Bool_t on = kTRUE);
97  void EnableEditButtons(Bool_t on = kTRUE);
98  void BindKeys();
99  TGButton *FindActionButton(const char *name, const char *section);
100 
101 public:
102  TRootGuiBuilder(const TGWindow *p = 0);
103  virtual ~TRootGuiBuilder();
104 
105  virtual void AddAction(TGuiBldAction *act, const char *sect);
106  virtual void AddMacro(const char *macro, TImage *img);
107  virtual void AddSection(const char *sect);
108  virtual TGFrame *ExecuteAction();
109  virtual void HandleButtons();
110  virtual void Show() { MapRaised(); }
111  virtual void Hide();
112  virtual void ChangeSelected(TGFrame *f);
113  virtual void Update();
114  virtual Bool_t IsSelectMode() const;
115  virtual Bool_t IsGrabButtonDown() const;
116  virtual Bool_t OpenProject(Event_t *event = 0);
117  virtual Bool_t SaveProject(Event_t *event = 0);
118  virtual Bool_t NewProject(TString type = "");
119  virtual Bool_t HandleKey(Event_t *event);
120  virtual void HandleMenu(Int_t id);
121  virtual void CloseWindow();
122  virtual void MaybeCloseWindow();
123  virtual void HandleWindowClosed(Int_t id);
124  virtual void UpdateStatusBar(const char *text = 0);
125  virtual void EraseStatusBar();
126  virtual void SwitchToolbarButton();
127 
128  TGMdiFrame *FindEditableMdiFrame(const TGWindow *win);
129  TGuiBldEditor *GetEditor() const { return fEditor; }
130  TGDockableFrame *GetToolDock() const { return fToolDock; }
131  TGMdiMainFrame *GetMdiMain() const { return fMain; }
132  TGMdiFrame *GetEditable() const { return fEditable; }
133  TGuiBldDragManager *GetManager() const { return fManager; }
134 
135  static ULong_t GetBgnd();
136  static TGGC *GetBgndGC();
137 
138  static ULong_t GetPopupBgnd();
139  static TGGC *GetPopupBgndGC();
140 
141  static ULong_t GetPopupHlght();
142  static TGGC *GetPopupHlghtGC();
143 
144  static void PropagateBgndColor(TGFrame *frame, Pixel_t color);
145 
146  static TGFrame *HSplitter();
147  static TGFrame *VSplitter();
148  static TGPopupMenu *CreatePopup();
149  static TGFrame *BuildListTree();
150  static TGFrame *BuildCanvas();
151  static TGFrame *BuildShutter();
152  static TGFrame *BuildTextEdit();
153  static TGFrame *BuildTab();
154  static TGFrame *BuildListBox();
155  static TGFrame *BuildComboBox();
156  static TGFrame *BuildH3DLine();
157  static TGFrame *BuildV3DLine();
158  static TGFrame *BuildHScrollBar();
159  static TGFrame *BuildVScrollBar();
160  static TGFrame *BuildHProgressBar();
161  static TGFrame *BuildVProgressBar();
162 
163 
164  ClassDef(TRootGuiBuilder,0) // ROOT GUI Builder
165 };
166 
167 
168 #endif