00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TBranchBrowsable
00013 #define ROOT_TBranchBrowsable
00014
00015 #ifndef ROOT_TNamed
00016 #include "TNamed.h"
00017 #endif
00018
00019 #ifndef ROOT_TList
00020 #include "TList.h"
00021 #endif
00022
00023 #include <list>
00024
00025 class TMethod;
00026 class TBowser;
00027 class TClass;
00028 class TBranch;
00029 class TBranchElement;
00030 class TString;
00031 class TStreamerElement;
00032
00033 class TVirtualBranchBrowsable: public TNamed {
00034 public:
00035
00036
00037
00038
00039 typedef Int_t (*MethodCreateListOfBrowsables_t)
00040 (TList&, const TBranch* branch, const TVirtualBranchBrowsable* parent);
00041
00042 ~TVirtualBranchBrowsable();
00043
00044 void Browse(TBrowser *b);
00045 const char *GetIconName() const {
00046
00047 if (IsFolder()) return "TBranchElement-folder";
00048 else return "TBranchElement-leaf";
00049 }
00050 void GetScope(TString & scope) const;
00051 Bool_t IsFolder() const {
00052
00053 return (GetLeaves() && GetLeaves()->GetSize()); }
00054
00055 static Int_t FillListOfBrowsables(TList& list, const TBranch* branch,
00056 const TVirtualBranchBrowsable* parent=0);
00057
00058 const TBranch* GetBranch() const {
00059
00060 return fBranch; }
00061 const TVirtualBranchBrowsable* GetParent() const {
00062
00063 return fParent; }
00064 TClass* GetClassType() const {
00065
00066 return fClass; }
00067 Bool_t TypeIsPointer() const {
00068
00069 return fTypeIsPointer; }
00070 TList* GetLeaves() const;
00071
00072
00073
00074
00075 protected:
00076 TVirtualBranchBrowsable(const TBranch* b, TClass* type, Bool_t typeIsPointer,
00077 const TVirtualBranchBrowsable* parent=0);
00078 static TClass* GetCollectionContainedType(const TBranch* b,
00079 const TVirtualBranchBrowsable* parent, TClass* &contained);
00080 static std::list<MethodCreateListOfBrowsables_t>& GetRegisteredGenerators();
00081 static void RegisterGenerator(MethodCreateListOfBrowsables_t generator);
00082 static void UnregisterGenerator(MethodCreateListOfBrowsables_t generator);
00083 void SetType(TClass* type) {
00084
00085 fClass=type; }
00086 void SetTypeIsPointer(Bool_t set=kTRUE) {
00087
00088 fTypeIsPointer=set; }
00089
00090 private:
00091 static void RegisterDefaultGenerators();
00092 const TBranch *fBranch;
00093 const TVirtualBranchBrowsable *fParent;
00094 TList *fLeaves;
00095 TClass *fClass;
00096 Bool_t fTypeIsPointer;
00097 static std::list<MethodCreateListOfBrowsables_t> fgGenerators;
00098 static Bool_t fgGeneratorsSet;
00099 ClassDef(TVirtualBranchBrowsable, 0);
00100 };
00101
00102
00103 class TMethodBrowsable: public TVirtualBranchBrowsable {
00104 public:
00105 ~TMethodBrowsable() {};
00106
00107 static Int_t GetBrowsables(TList& list, const TBranch* branch,
00108 const TVirtualBranchBrowsable* parent=0);
00109 const char *GetIconName() const {
00110
00111 if (IsFolder()) return "TMethodBrowsable-branch";
00112 return "TMethodBrowsable-leaf";}
00113 static Bool_t IsMethodBrowsable(const TMethod* m);
00114 static void Register();
00115 static void Unregister();
00116
00117 protected:
00118 static void GetBrowsableMethodsForClass(TClass* cl, TList& list);
00119 TMethodBrowsable(const TBranch* branch, TMethod* m,
00120 const TVirtualBranchBrowsable* parent=0);
00121
00122 private:
00123 TMethod *fMethod;
00124 ClassDef(TMethodBrowsable,0);
00125 };
00126
00127
00128 class TNonSplitBrowsable: public TVirtualBranchBrowsable {
00129 public:
00130 ~TNonSplitBrowsable() {}
00131
00132 static Int_t GetBrowsables(TList& list, const TBranch* branch,
00133 const TVirtualBranchBrowsable* parent=0);
00134 static void Register();
00135 static void Unregister();
00136
00137 protected:
00138 TNonSplitBrowsable(const TStreamerElement* element, const TBranch* branch,
00139 const TVirtualBranchBrowsable* parent=0);
00140
00141 private:
00142 ClassDef(TNonSplitBrowsable, 0);
00143 };
00144
00145
00146 class TCollectionPropertyBrowsable: public TVirtualBranchBrowsable {
00147 public:
00148 ~TCollectionPropertyBrowsable() {}
00149
00150 void Browse(TBrowser *b);
00151 static Int_t GetBrowsables(TList& list, const TBranch* branch,
00152 const TVirtualBranchBrowsable* parent=0);
00153 const char* GetDraw() const {
00154
00155 return fDraw.Data(); }
00156 static void Register();
00157 static void Unregister();
00158
00159 protected:
00160 TCollectionPropertyBrowsable(const char* name, const char* title,
00161 const char* draw, const TBranch* branch, const TVirtualBranchBrowsable* parent=0):
00162 TVirtualBranchBrowsable(branch, 0, kFALSE, parent), fDraw(draw) {
00163
00164
00165 SetNameTitle(name, title);
00166 }
00167
00168 private:
00169 TString fDraw;
00170 ClassDef(TCollectionPropertyBrowsable, 0);
00171 };
00172
00173 class TCollectionMethodBrowsable: public TMethodBrowsable {
00174 public:
00175 ~TCollectionMethodBrowsable() {};
00176
00177 static Int_t GetBrowsables(TList& list, const TBranch* branch,
00178 const TVirtualBranchBrowsable* parent=0);
00179 static void Register();
00180 static void Unregister();
00181
00182 protected:
00183 TCollectionMethodBrowsable(const TBranch* branch, TMethod* m,
00184 const TVirtualBranchBrowsable* parent=0);
00185
00186 ClassDef(TCollectionMethodBrowsable,0);
00187 };
00188
00189 #endif // defined ROOT_TBranchBrowsable