ROOT  6.06/09
Reference Guide
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 #ifndef ROOT_TGClient
26 #include "TGClient.h"
27 #endif
28 #ifndef ROOT_TGPicture
29 #include "TGPicture.h"
30 #endif
31 
32 class TOrdCollection;
33 class TRegexp;
34 
35 
36 class TGMime : public TObject {
37 
38 friend class TGMimeTypes;
39 
40 private:
41  TString fType; // mime type
42  TString fPattern; // filename pattern
43  TString fAction; // associated action
44  TString fIcon; // associated icon (32x32)
45  TString fSIcon; // associated small icon (16x16)
46  TRegexp *fReg; // pattern regular expression
47 
48 public:
49  TGMime() : fReg(0) {}
50  ~TGMime();
51 };
52 
53 
54 class TGMimeTypes : public TObject {
55 
56 protected:
57  TGClient *fClient; // client to which mime types belong (display server)
58  TString fFilename; // file name of mime type file
59  Bool_t fChanged; // true if file has changed
60  TOrdCollection *fList; // list of mime types
61 
62  TGMimeTypes(const TGMimeTypes& gmt);
63  TGMimeTypes& operator=(const TGMimeTypes& gmt);
64  TGMime *Find(const char *filename);
65 
66 public:
67  TGMimeTypes(TGClient *client, const char *file);
68  virtual ~TGMimeTypes();
69 
70  void SaveMimes();
71  Bool_t HasChanged() const { return fChanged; }
72  void AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action);
73  void Print(Option_t *option="") const;
74  Bool_t GetAction(const char *filename, char *action);
75  Bool_t GetType(const char *filename, char *type);
76  const TGPicture *GetIcon(const char *filename, Bool_t small_icon);
77 
78  ClassDef(TGMimeTypes,0) // Pool of mime type objects
79 };
80 
81 #endif
void AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action)
Add a mime type to the list of mime types.
TString fType
Definition: TGMimeTypes.h:41
void Print(Option_t *option="") const
Print list of mime types.
const char Option_t
Definition: RtypesCore.h:62
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
void SaveMimes()
Save mime types in user's mime type file.
~TGMime()
Delete mime object.
Regular expression class.
Definition: TRegexp.h:35
TGMimeTypes & operator=(const TGMimeTypes &gmt)
Assignment operator.
static const char * filename()
TOrdCollection * fList
Definition: TGMimeTypes.h:60
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
TGMimeTypes(const TGMimeTypes &gmt)
Copy constructor.
TGClient * fClient
Definition: TGMimeTypes.h:57
Bool_t HasChanged() const
Definition: TGMimeTypes.h:71
Bool_t GetType(const char *filename, char *type)
Return in type the mime type belonging to filename.
TString fSIcon
Definition: TGMimeTypes.h:45
TGMime * Find(const char *filename)
Given a filename find the matching mime type object.
#define ClassDef(name, id)
Definition: Rtypes.h:254
TRegexp * fReg
Definition: TGMimeTypes.h:46
TString fFilename
Definition: TGMimeTypes.h:58
TString fPattern
Definition: TGMimeTypes.h:42
Bool_t fChanged
Definition: TGMimeTypes.h:59
virtual ~TGMimeTypes()
Delete mime type pool.
Bool_t GetAction(const char *filename, char *action)
Return in action the mime action string belonging to filename.
TGMime()
Definition: TGMimeTypes.h:49
int type
Definition: TGX11.cxx:120
Mother of all ROOT objects.
Definition: TObject.h:58
TString fIcon
Definition: TGMimeTypes.h:44
TString fAction
Definition: TGMimeTypes.h:43
Ordered collection.