Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGuiBuilder.h
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 #ifndef ROOT_TGuiBuilder
13 #define ROOT_TGuiBuilder
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGuiBuilder //
19 // //
20 //////////////////////////////////////////////////////////////////////////
21 
22 
23 #include "TNamed.h"
24 
25 enum EGuiBldAction { kGuiBldNone, kGuiBldCtor, kGuiBldProj,
26  kGuiBldMacro, kGuiBldFunc };
27 
28 class TGFrame;
29 class TGLayoutHints;
30 class TGPicture;
31 //////////////////////////////////////////////////////////////////////////
32 class TGuiBldAction : public TNamed {
33 
34 public:
35  Int_t fType; // type of action
36  TString fAct; // action, after action execution new frame is created
37  const char *fPic; // picture name
38  const TGPicture *fPicture; // picture
39  TGLayoutHints *fHints; // layout hints for frame created by action
40 
41  TGuiBldAction(const char *name = 0, const char *title = 0,
42  Int_t type = kGuiBldCtor, TGLayoutHints *hints = 0);
43  virtual ~TGuiBldAction();
44 
45  ClassDef(TGuiBldAction,0) // gui builder action
46 };
47 
48 
49 //////////////////////////////////////////////////////////////////////////
50 class TGuiBuilder {
51 
52 protected:
53  TGuiBldAction *fAction; // current action
54 
55 public:
56  TGuiBuilder();
57  virtual ~TGuiBuilder();
58 
59  virtual void AddAction(TGuiBldAction *, const char * /*section*/) {}
60  virtual void AddSection(const char * /*section*/) {}
61  virtual TGFrame *ExecuteAction() { return 0; }
62  virtual void SetAction(TGuiBldAction *act) { fAction = act; }
63  TGuiBldAction *GetAction() const { return fAction; }
64  virtual Bool_t IsExecutable() const { return fAction && !fAction->fAct.IsNull(); }
65  virtual void Show() {}
66  virtual void Hide() {}
67 
68  static TGuiBuilder *Instance();
69 
70  ClassDef(TGuiBuilder,0) // ABC for gui builder
71 };
72 
73 R__EXTERN TGuiBuilder *gGuiBuilder; // global gui builder
74 
75 #endif