QGUIBaseFrame.hh

Go to the documentation of this file.
00001 
00022 #ifndef _QGUI_BASE_FRAME_HH_
00023 #define _QGUI_BASE_FRAME_HH_
00024 
00025 
00026 
00027 // Apollo Includes
00028 
00029 
00030 // Root Includes
00031 #include "TGFrame.h"
00032 #include "TROOT.h"
00033 #include "Rtypes.h"
00034 #include "TGTextView.h"
00035 
00036 // C/C++ Includes
00037 #include <list>
00038 
00039 
00040 // Used class
00041 class TGIcon;
00042 class TGPictures;
00043 class TGTextView;
00044 class TGLayoutHints;
00045 
00046 class QGUIBaseFrame: public TGTransientFrame
00047 {
00048 
00049 public:
00050 
00051 
00052   // GUI Standard Buttons
00053   enum QGUIButtons_t
00054   {
00055     QGUI_CANCEL =0,
00056     QGUI_YES    =1,
00057     QGUI_OK     =3,
00058     QGUI_NO     =4,
00059     QGUI_RETRY  =5,
00060     QGUI_CLOSE  =6,
00061     QGUI_IGNORE =7
00062   };
00063 
00064   
00065    /*
00066     * @brief constructor
00067     * @param p pointer to the parent window, i.e. the frame in which this frame
00068     *          will be contained. This is needed to delete correctly all
00069     *          subframes as soon as the parent frame is deleted
00070     * @param main tdb. this is the window this 'transient' frame refers to
00071     * @param w window width
00072     * @param h window height
00073     * @param Options same options that can be passed to TGTransientFrame
00074     */
00075      QGUIBaseFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t Options);
00076 
00077   // dtor
00078   virtual ~QGUIBaseFrame();
00079 
00080   // Close Window and Exit
00081   virtual void CloseWindow();
00082 
00083   // Signals
00084   void Closed() {Emit("Closed()");}  //*SIGNAL*
00085 
00086 
00087 protected:
00088   
00089   // Check if Is Colored
00090   inline const bool IsColored() const {return fIsColor; }
00091 
00092   // Set/Enable/Disable Frame Color Status
00093   inline void SetDebugColor(bool isColored) {fIsColor=isColored;return;}
00094   inline void EnableColor()                 {SetDebugColor(true) ;return;}
00095   inline void DisableColor()                {SetDebugColor(false);return;}
00096 
00097   // Get ROOT version
00098 
00099   const std::string GetROOTVersion() const{return std::string(gROOT->GetVersion());}
00100 
00101   // Set/Get Window and Icon Names
00102   void SetMainFrameName(const std::string& qName);
00103   inline const std::string GetMainFrameName() const {return std::string(GetWindowName());}
00104 
00105   // Set/Get Short Name
00106   inline void SetWho(const std::string& qWho) {fWho=qWho;return;}
00107   inline const std::string& GetWho() const {return fWho;} 
00108 
00109 
00110   // Make the Frame Non-Resizable
00111   void NoResizable();
00112 
00113   // Add image to frame with defined border
00114   bool AddImageToFrame(const std::string& qPathName, TGCompositeFrame* qFrame, size_t qWidth, size_t qHeight,
00115                        int qLeft, int qRight, int qTop, int qBottom,
00116                        size_t qOptions);
00117   
00118   // Add image to frame with standard border (1,1,1,1)
00119   bool AddImageToFrame(const std::string& qPathName, TGCompositeFrame* qFrame, size_t qWidth, size_t qHeight,
00120                        size_t qOptions);
00121 
00122   // Add a writing to frame
00123   void AddWritingToFrame(TGCompositeFrame* qFrame, const std::string& qWriting);
00124 
00125   
00126   // Add Logger
00127   void AddLogger(TGCompositeFrame* qParent, TGTextView* &qLog, TGGroupFrame* qGroup);
00128   
00129 
00130   // Add Horizontal Frame, Fitted Width and Fixed Height and with standard border (1,1,1,1)
00131   TGHorizontalFrame* CreateHFrame(TGCompositeFrame* qParent, 
00132                                   size_t qWidth, size_t qHeight);
00133 
00134   // Add Horizontal Frame, Fitted Width and Fixed Height and with defined border
00135   TGHorizontalFrame* CreateHFrame(TGCompositeFrame* qParent,
00136                                   int qLeft, int qRight, int qTop, int qBottom,
00137                                   size_t qWidth, size_t qHeight);
00138         
00139   
00140   // Add Vertival Frame, Fixed Width and Fitted Height and with standard border (1,1,1,1)
00141   TGVerticalFrame* CreateVFrame(TGCompositeFrame* qParent, 
00142                                 size_t qWidth, size_t qHeight);
00143   
00144   // Add Vertival Frame, Fixed Width and Fitted Height and with defined border
00145   TGVerticalFrame* CreateVFrame(TGCompositeFrame* qParent,
00146                                 int qLeft, int qRight, int qTop, int qBottom,
00147                                 size_t qWidth, size_t qHeight);
00148 
00149   // Get Current Time
00150   const std::string GetTime();
00151 
00152   // Send Message On Screen
00153   void SendMsgOnScreen(const std::string& qWho, const std::string& qMsg, bool without);
00154   void SendMsgOnScreen(const std::string& qMsg, bool without) {return SendMsgOnScreen(GetWho(),qMsg,without);}
00155   void SendMsgOnScreen(const std::string& qMsg) {return SendMsgOnScreen(GetWho(),qMsg,false);}
00156 
00157   // Set Message on Logger (if it exists) and on Screen
00158   void SetMessage(TGTextView* qLog, const std::string& qMsg, bool without);
00159   void SetMessage(TGTextView* qLog, const std::string& qMsg) {return SetMessage(qLog,qMsg,false);}
00160   
00161   // Transform interger to std::string
00162   std::string ToString(int Value, size_t nDigit);
00163   std::string ToString(int Value) {return ToString(Value,4);}
00164 
00165    TGLayoutHints* AddHints(const ULong_t& hints   = kLHintsNormal,
00166                            const Int_t& padLeft   = 0,
00167                            const Int_t& padRight  = 0,
00168                            const Int_t& padTop    = 0,
00169                            const Int_t& padBottom = 0);
00170 
00171 
00172 private:
00173   
00174   TGIcon          *fIcon;    // Icon
00175   const TGPicture *fPicture; // Picture
00176 
00177   // Gui Short Name
00178   std::string fWho;
00179 
00180 
00181   // If fIsColor=true frame are colored (only for debugging)
00182   bool     fIsColor;    
00183 
00184    TGLayoutHints* FindHints(const ULong_t& hints   = kLHintsNormal,
00185                             const Int_t& padLeft   = 0,
00186                             const Int_t& padRight  = 0,
00187                             const Int_t& padTop    = 0,
00188                             const Int_t& padBottom = 0) const;
00189    
00190    void CleanHints();
00191 
00192    std::list<TGLayoutHints*> fHints;
00193 
00194 
00195   // To integrate QGUIBaseFrame class into the ROOT system
00196   ClassDef(QGUIBaseFrame,0)
00197 
00198 };
00199 
00200 #endif // _QGUI_BASE_FRAME_HH_

Generated on Fri Mar 6 13:40:39 2009 for CUORE Software by  doxygen 1.5.1