Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:03

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   18/01/98
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGMimeTypes
0013 #define ROOT_TGMimeTypes
0014 
0015 
0016 #include "TGClient.h"
0017 #include "TGPicture.h"
0018 
0019 class TOrdCollection;
0020 class TRegexp;
0021 
0022 /** \class TGMime
0023     \ingroup guiwidgets
0024 
0025 TGMime is internally used by TGMimeTypes.
0026 
0027 */
0028 
0029 class TGMime : public TObject {
0030 
0031 friend class TGMimeTypes;
0032 
0033 private:
0034    TString   fType;       ///< mime type
0035    TString   fPattern;    ///< filename pattern
0036    TString   fAction;     ///< associated action
0037    TString   fIcon;       ///< associated icon (32x32)
0038    TString   fSIcon;      ///< associated small icon (16x16)
0039    TRegexp  *fReg;        ///< pattern regular expression
0040 
0041 public:
0042    TGMime() : fReg(nullptr) {}
0043    ~TGMime() override;
0044 };
0045 
0046 
0047 class TGMimeTypes : public TObject {
0048 
0049 protected:
0050    TGClient        *fClient;     ///< client to which mime types belong (display server)
0051    TString          fFilename;   ///< file name of mime type file
0052    Bool_t           fChanged;    ///< true if file has changed
0053    TOrdCollection  *fList;       ///< list of mime types
0054 
0055    TGMimeTypes(const TGMimeTypes& gmt);
0056    TGMimeTypes& operator=(const TGMimeTypes& gmt);
0057    TGMime    *Find(const char *filename);
0058 
0059 public:
0060    TGMimeTypes(TGClient *client, const char *file);
0061    ~TGMimeTypes() override;
0062 
0063    void   SaveMimes();
0064    Bool_t HasChanged() const { return fChanged; }
0065    void   AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action);
0066    void   Print(Option_t *option="") const override;
0067    Bool_t GetAction(const char *filename, char *action);
0068    Bool_t GetType(const char *filename, char *type);
0069    const TGPicture *GetIcon(const char *filename, Bool_t small_icon);
0070 
0071    ClassDefOverride(TGMimeTypes,0)  // Pool of mime type objects
0072 };
0073 
0074 #endif