ROOT logo
// @(#)root/gui:$Id: TGMimeTypes.h 23115 2008-04-10 13:35:37Z rdm $
// Author: Fons Rademakers   18/01/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGMimeTypes
#define ROOT_TGMimeTypes


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGMimeTypes and TGMime                                               //
//                                                                      //
// This class handles mime types, used by browsers to map file types    //
// to applications and icons. TGMime is internally used by TGMimeTypes. //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGClient
#include "TGClient.h"
#endif
#ifndef ROOT_TGPicture
#include "TGPicture.h"
#endif

class TOrdCollection;
class TRegexp;


class TGMime : public TObject {

friend class TGMimeTypes;

private:
   TString   fType;       // mime type
   TString   fPattern;    // filename pattern
   TString   fAction;     // associated action
   TString   fIcon;       // associated icon (32x32)
   TString   fSIcon;      // associated small icon (16x16)
   TRegexp  *fReg;        // pattern regular expression

public:
   ~TGMime();
};


class TGMimeTypes : public TObject {

protected:
   TGClient        *fClient;     // client to which mime types belong (display server)
   TString          fFilename;   // file name of mime type file
   Bool_t           fChanged;    // true if file has changed
   TOrdCollection  *fList;       // list of mime types

   TGMimeTypes(const TGMimeTypes& gmt);
   TGMimeTypes& operator=(const TGMimeTypes& gmt);
   TGMime    *Find(const char *filename);

public:
   TGMimeTypes(TGClient *client, const char *file);
   virtual ~TGMimeTypes();

   void   SaveMimes();
   Bool_t HasChanged() const { return fChanged; }
   void   AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action);
   void   Print(Option_t *option="") const;
   Bool_t GetAction(const char *filename, char *action);
   Bool_t GetType(const char *filename, char *type);
   const TGPicture *GetIcon(const char *filename, Bool_t small_icon);

   ClassDef(TGMimeTypes,0)  // Pool of mime type objects
};

#endif
 TGMimeTypes.h:1
 TGMimeTypes.h:2
 TGMimeTypes.h:3
 TGMimeTypes.h:4
 TGMimeTypes.h:5
 TGMimeTypes.h:6
 TGMimeTypes.h:7
 TGMimeTypes.h:8
 TGMimeTypes.h:9
 TGMimeTypes.h:10
 TGMimeTypes.h:11
 TGMimeTypes.h:12
 TGMimeTypes.h:13
 TGMimeTypes.h:14
 TGMimeTypes.h:15
 TGMimeTypes.h:16
 TGMimeTypes.h:17
 TGMimeTypes.h:18
 TGMimeTypes.h:19
 TGMimeTypes.h:20
 TGMimeTypes.h:21
 TGMimeTypes.h:22
 TGMimeTypes.h:23
 TGMimeTypes.h:24
 TGMimeTypes.h:25
 TGMimeTypes.h:26
 TGMimeTypes.h:27
 TGMimeTypes.h:28
 TGMimeTypes.h:29
 TGMimeTypes.h:30
 TGMimeTypes.h:31
 TGMimeTypes.h:32
 TGMimeTypes.h:33
 TGMimeTypes.h:34
 TGMimeTypes.h:35
 TGMimeTypes.h:36
 TGMimeTypes.h:37
 TGMimeTypes.h:38
 TGMimeTypes.h:39
 TGMimeTypes.h:40
 TGMimeTypes.h:41
 TGMimeTypes.h:42
 TGMimeTypes.h:43
 TGMimeTypes.h:44
 TGMimeTypes.h:45
 TGMimeTypes.h:46
 TGMimeTypes.h:47
 TGMimeTypes.h:48
 TGMimeTypes.h:49
 TGMimeTypes.h:50
 TGMimeTypes.h:51
 TGMimeTypes.h:52
 TGMimeTypes.h:53
 TGMimeTypes.h:54
 TGMimeTypes.h:55
 TGMimeTypes.h:56
 TGMimeTypes.h:57
 TGMimeTypes.h:58
 TGMimeTypes.h:59
 TGMimeTypes.h:60
 TGMimeTypes.h:61
 TGMimeTypes.h:62
 TGMimeTypes.h:63
 TGMimeTypes.h:64
 TGMimeTypes.h:65
 TGMimeTypes.h:66
 TGMimeTypes.h:67
 TGMimeTypes.h:68
 TGMimeTypes.h:69
 TGMimeTypes.h:70
 TGMimeTypes.h:71
 TGMimeTypes.h:72
 TGMimeTypes.h:73
 TGMimeTypes.h:74
 TGMimeTypes.h:75
 TGMimeTypes.h:76
 TGMimeTypes.h:77
 TGMimeTypes.h:78
 TGMimeTypes.h:79
 TGMimeTypes.h:80