00001 00002 // 00003 // $Id: GuiBase.h,v 1.5 2005/08/18 20:12:02 bv Exp $ 00004 // 00005 // GuiBase 00006 // 00007 // Package: MIDAD 00008 // 00009 // Base class for all Gui* wrappers. Provides some support methods. 00010 // 00011 // Contact: bv@bnl.gov 00012 // 00013 // Created on: Thu Nov 8 10:17:21 2001 00014 // 00016 00017 #ifndef GUIBASE_H 00018 #define GUIBASE_H 00019 00020 #include <Midad/Util/Signals.h> 00021 #include <string> 00022 #include <list> 00023 00024 class TList; 00025 class TObject; 00026 class TGFrame; 00027 //class GuiCompositeFrameBase; 00028 class GuiMainWindow; 00029 00030 class GuiBase 00031 #ifndef __CINT__ 00032 : public SigC::Object 00033 #endif 00034 { 00035 //friend class GuiCompositeFrameBase; 00036 00037 public: 00038 00039 typedef std::list<SigC::Ptr<GuiBase> > ChildrenList; 00040 00041 00042 GuiBase(); 00043 virtual ~GuiBase(); 00044 00045 void SetLayoutHints(unsigned int loh) { fLayoutHints = loh; } 00046 virtual unsigned int GetLayoutHints() { return fLayoutHints; } 00047 00048 void SetName(const char* name) { fName = name; } 00049 const char* GetName() { return fName.c_str(); } 00050 00051 GuiMainWindow* GetMainWindow(); 00052 00053 00054 // override to return your frame if you are a proxy instead of a 00055 // subclass, default will dynamic_cast<TGFrame*>(this). 00056 virtual TGFrame* GetFrame(); 00057 00058 protected: 00059 00060 // Storage for cleanup: AddChild rejects (returns false, doesn't 00061 // store) anything not castable to SigC::Object 00062 bool AddChild(TGFrame& obj); 00063 // Unconditionally add obj to a TList and delete at dtor time 00064 void AddObject(TObject* obj); 00065 00066 void LayoutChildren(void); 00067 00068 ChildrenList fChildren; 00069 00070 private: 00071 00072 TList* fCleanup; 00073 unsigned int fLayoutHints; 00074 std::string fName; 00075 00076 }; // end of class GuiBase 00077 00078 class GuiCompositeFrameBase : public GuiBase 00079 { 00080 public: 00081 GuiCompositeFrameBase() {} 00082 virtual ~GuiCompositeFrameBase() {} 00083 virtual void Add(GuiBase& f); 00084 virtual void Remove(GuiBase& f); 00085 virtual void Show(GuiBase& f); 00086 virtual void Hide(GuiBase& f); 00087 GuiBase::ChildrenList GetChildrenList() { return fChildren; } 00088 }; 00089 00090 #endif // GUIBASE_H
1.3.9.1