00001 
00024 #ifndef _QGUI_BASE_FRAME_HH_
00025 #define _QGUI_BASE_FRAME_HH_
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 #include "TGFrame.h"
00034 #include "TROOT.h"
00035 #include "Rtypes.h"
00036 #include "TGTextView.h"
00037 
00038 
00039 #include <list>
00040 
00041 
00042 
00043 class TGIcon;
00044 class TGPictures;
00045 class TGTextView;
00046 class TGLayoutHints;
00047 
00048 class QGUIBaseFrame: public TGTransientFrame
00049 {
00050 
00051 public:
00052 
00053 
00054   
00055   enum QGUIButtons_t
00056   {
00057     QGUI_CANCEL =0,
00058     QGUI_YES    =1,
00059     QGUI_OK     =3,
00060     QGUI_NO     =4,
00061     QGUI_RETRY  =5,
00062     QGUI_CLOSE  =6,
00063     QGUI_IGNORE =7
00064   };
00065 
00066   
00067    
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077      QGUIBaseFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t Options);
00078 
00079   
00080   virtual ~QGUIBaseFrame();
00081 
00082   
00083   virtual void CloseWindow();
00084 
00085   
00086   void Closed() {Emit("Closed()");}  
00087 
00088 
00089 protected:
00090   
00091   
00092   inline const bool IsColored() const {return fIsColor; }
00093 
00094   
00095   inline void SetDebugColor(bool isColored) {fIsColor=isColored;return;}
00096   inline void EnableColor()                 {SetDebugColor(true) ;return;}
00097   inline void DisableColor()                {SetDebugColor(false);return;}
00098 
00099   
00100 
00101   const std::string GetROOTVersion() const{return std::string(gROOT->GetVersion());}
00102 
00103   
00104   void SetMainFrameName(const std::string& qName);
00105   inline const std::string GetMainFrameName() const {return std::string(GetWindowName());}
00106 
00107   
00108   inline void SetWho(const std::string& qWho) {fWho=qWho;return;}
00109   inline const std::string& GetWho() const {return fWho;} 
00110 
00111 
00112   
00113   void NoResizable();
00114 
00115   
00116   bool AddImageToFrame(const std::string& qPathName, TGCompositeFrame* qFrame, size_t qWidth, size_t qHeight,
00117                        int qLeft, int qRight, int qTop, int qBottom,
00118                        size_t qOptions);
00119   
00120   
00121   bool AddImageToFrame(const std::string& qPathName, TGCompositeFrame* qFrame, size_t qWidth, size_t qHeight,
00122                        size_t qOptions);
00123 
00124   
00125   void AddWritingToFrame(TGCompositeFrame* qFrame, const std::string& qWriting);
00126 
00127   
00128   
00129   void AddLogger(TGCompositeFrame* qParent, TGTextView* &qLog, TGGroupFrame* qGroup);
00130   
00131 
00132   
00133   TGHorizontalFrame* CreateHFrame(TGCompositeFrame* qParent, 
00134                                   size_t qWidth, size_t qHeight);
00135 
00136   
00137   TGHorizontalFrame* CreateHFrame(TGCompositeFrame* qParent,
00138                                   int qLeft, int qRight, int qTop, int qBottom,
00139                                   size_t qWidth, size_t qHeight);
00140         
00141   
00142   
00143   TGVerticalFrame* CreateVFrame(TGCompositeFrame* qParent, 
00144                                 size_t qWidth, size_t qHeight);
00145   
00146   
00147   TGVerticalFrame* CreateVFrame(TGCompositeFrame* qParent,
00148                                 int qLeft, int qRight, int qTop, int qBottom,
00149                                 size_t qWidth, size_t qHeight);
00150 
00151   
00152   const std::string GetTime();
00153 
00154   
00155   void SendMsgOnScreen(const std::string& qWho, const std::string& qMsg, bool without);
00156   void SendMsgOnScreen(const std::string& qMsg, bool without) {return SendMsgOnScreen(GetWho(),qMsg,without);}
00157   void SendMsgOnScreen(const std::string& qMsg) {return SendMsgOnScreen(GetWho(),qMsg,false);}
00158 
00159   
00160   void SetMessage(TGTextView* qLog, const std::string& qMsg, bool without);
00161   void SetMessage(TGTextView* qLog, const std::string& qMsg) {return SetMessage(qLog,qMsg,false);}
00162   
00163   
00164   std::string ToString(int Value, size_t nDigit);
00165   std::string ToString(int Value) {return ToString(Value,4);}
00166 
00167    TGLayoutHints* AddHints(const ULong_t& hints   = kLHintsNormal,
00168                            const Int_t& padLeft   = 2,
00169                            const Int_t& padRight  = 2,
00170                            const Int_t& padTop    = 2,
00171                            const Int_t& padBottom = 2);
00172 
00173 
00174 private:
00175   
00176   TGIcon          *fIcon;    
00177   const TGPicture *fPicture; 
00178 
00179   
00180   std::string fWho;
00181 
00182 
00183   
00184   bool     fIsColor;    
00185 
00186    TGLayoutHints* FindHints(const ULong_t& hints   = kLHintsNormal,
00187                             const Int_t& padLeft   = 0,
00188                             const Int_t& padRight  = 0,
00189                             const Int_t& padTop    = 0,
00190                             const Int_t& padBottom = 0) const;
00191    
00192    void CleanHints();
00193 
00194    std::list<TGLayoutHints*> fHints;
00195 
00196 
00197   
00198   ClassDef(QGUIBaseFrame,0)
00199 
00200 };
00201 
00202 #endif // _QGUI_BASE_FRAME_HH_