QGUIBaseFrame.hh

Go to the documentation of this file.
00001 
00024 #ifndef _QGUI_BASE_FRAME_HH_
00025 #define _QGUI_BASE_FRAME_HH_
00026 
00027 
00028 
00029 // Apollo Includes
00030 
00031 
00032 // Root Includes
00033 #include "TGFrame.h"
00034 #include "TROOT.h"
00035 #include "Rtypes.h"
00036 #include "TGTextView.h"
00037 
00038 // C/C++ Includes
00039 #include <list>
00040 
00041 
00042 // Used class
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   // GUI Standard Buttons
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     * @brief constructor
00069     * @param p pointer to the parent window, i.e. the frame in which this frame
00070     *          will be contained. This is needed to delete correctly all
00071     *          subframes as soon as the parent frame is deleted
00072     * @param main tdb. this is the window this 'transient' frame refers to
00073     * @param w window width
00074     * @param h window height
00075     * @param Options same options that can be passed to TGTransientFrame
00076     */
00077      QGUIBaseFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t Options);
00078 
00079   // dtor
00080   virtual ~QGUIBaseFrame();
00081 
00082   // Close Window and Exit
00083   virtual void CloseWindow();
00084 
00085   // Signals
00086   void Closed() {Emit("Closed()");}  //*SIGNAL*
00087 
00088 
00089 protected:
00090   
00091   // Check if Is Colored
00092   inline const bool IsColored() const {return fIsColor; }
00093 
00094   // Set/Enable/Disable Frame Color Status
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   // Get ROOT version
00100 
00101   const std::string GetROOTVersion() const{return std::string(gROOT->GetVersion());}
00102 
00103   // Set/Get Window and Icon Names
00104   void SetMainFrameName(const std::string& qName);
00105   inline const std::string GetMainFrameName() const {return std::string(GetWindowName());}
00106 
00107   // Set/Get Short Name
00108   inline void SetWho(const std::string& qWho) {fWho=qWho;return;}
00109   inline const std::string& GetWho() const {return fWho;} 
00110 
00111 
00112   // Make the Frame Non-Resizable
00113   void NoResizable();
00114 
00115   // Add image to frame with defined border
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   // Add image to frame with standard border (1,1,1,1)
00121   bool AddImageToFrame(const std::string& qPathName, TGCompositeFrame* qFrame, size_t qWidth, size_t qHeight,
00122                        size_t qOptions);
00123 
00124   // Add a writing to frame
00125   void AddWritingToFrame(TGCompositeFrame* qFrame, const std::string& qWriting);
00126 
00127   
00128   // Add Logger
00129   void AddLogger(TGCompositeFrame* qParent, TGTextView* &qLog, TGGroupFrame* qGroup);
00130   
00131 
00132   // Add Horizontal Frame, Fitted Width and Fixed Height and with standard border (1,1,1,1)
00133   TGHorizontalFrame* CreateHFrame(TGCompositeFrame* qParent, 
00134                                   size_t qWidth, size_t qHeight);
00135 
00136   // Add Horizontal Frame, Fitted Width and Fixed Height and with defined border
00137   TGHorizontalFrame* CreateHFrame(TGCompositeFrame* qParent,
00138                                   int qLeft, int qRight, int qTop, int qBottom,
00139                                   size_t qWidth, size_t qHeight);
00140         
00141   
00142   // Add Vertival Frame, Fixed Width and Fitted Height and with standard border (1,1,1,1)
00143   TGVerticalFrame* CreateVFrame(TGCompositeFrame* qParent, 
00144                                 size_t qWidth, size_t qHeight);
00145   
00146   // Add Vertival Frame, Fixed Width and Fitted Height and with defined border
00147   TGVerticalFrame* CreateVFrame(TGCompositeFrame* qParent,
00148                                 int qLeft, int qRight, int qTop, int qBottom,
00149                                 size_t qWidth, size_t qHeight);
00150 
00151   // Get Current Time
00152   const std::string GetTime();
00153 
00154   // Send Message On Screen
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   // Set Message on Logger (if it exists) and on Screen
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   // Transform interger to std::string
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;    // Icon
00177   const TGPicture *fPicture; // Picture
00178 
00179   // Gui Short Name
00180   std::string fWho;
00181 
00182 
00183   // If fIsColor=true frame are colored (only for debugging)
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   // To integrate QGUIBaseFrame class into the ROOT system
00198   ClassDef(QGUIBaseFrame,0)
00199 
00200 };
00201 
00202 #endif // _QGUI_BASE_FRAME_HH_

Generated on Tue Nov 16 10:49:54 2010 for CUORE Software by  doxygen 1.5.6