Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGMimeTypes.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 18/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGMimeTypes
13 #define ROOT_TGMimeTypes
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGMimeTypes and TGMime //
19 // //
20 // This class handles mime types, used by browsers to map file types //
21 // to applications and icons. TGMime is internally used by TGMimeTypes. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TGClient.h"
26 #include "TGPicture.h"
27 
28 class TOrdCollection;
29 class TRegexp;
30 
31 
32 class TGMime : public TObject {
33 
34 friend class TGMimeTypes;
35 
36 private:
37  TString fType; // mime type
38  TString fPattern; // filename pattern
39  TString fAction; // associated action
40  TString fIcon; // associated icon (32x32)
41  TString fSIcon; // associated small icon (16x16)
42  TRegexp *fReg; // pattern regular expression
43 
44 public:
45  TGMime() : fReg(0) {}
46  ~TGMime();
47 };
48 
49 
50 class TGMimeTypes : public TObject {
51 
52 protected:
53  TGClient *fClient; // client to which mime types belong (display server)
54  TString fFilename; // file name of mime type file
55  Bool_t fChanged; // true if file has changed
56  TOrdCollection *fList; // list of mime types
57 
58  TGMimeTypes(const TGMimeTypes& gmt);
59  TGMimeTypes& operator=(const TGMimeTypes& gmt);
60  TGMime *Find(const char *filename);
61 
62 public:
63  TGMimeTypes(TGClient *client, const char *file);
64  virtual ~TGMimeTypes();
65 
66  void SaveMimes();
67  Bool_t HasChanged() const { return fChanged; }
68  void AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action);
69  void Print(Option_t *option="") const;
70  Bool_t GetAction(const char *filename, char *action);
71  Bool_t GetType(const char *filename, char *type);
72  const TGPicture *GetIcon(const char *filename, Bool_t small_icon);
73 
74  ClassDef(TGMimeTypes,0) // Pool of mime type objects
75 };
76 
77 #endif