Logo ROOT  
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 #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
TGMimeTypes::AddType
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.
Definition: TGMimeTypes.cxx:315
TGPicture
Definition: TGPicture.h:36
TGMimeTypes::fList
TOrdCollection * fList
Definition: TGMimeTypes.h:56
TGPicture.h
TOrdCollection
Definition: TOrdCollection.h:32
TGMimeTypes::Find
TGMime * Find(const char *filename)
Given a filename find the matching mime type object.
Definition: TGMimeTypes.cxx:185
TGMimeTypes::TGMimeTypes
TGMimeTypes(const TGMimeTypes &gmt)
Copy constructor.
Definition: TGMimeTypes.cxx:157
TGMimeTypes::fClient
TGClient * fClient
Definition: TGMimeTypes.h:53
TGMimeTypes::GetType
Bool_t GetType(const char *filename, char *type)
Return in type the mime type belonging to filename.
Definition: TGMimeTypes.cxx:240
TGMimeTypes::fFilename
TString fFilename
Definition: TGMimeTypes.h:54
TString
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGMimeTypes::operator=
TGMimeTypes & operator=(const TGMimeTypes &gmt)
Assignment operator.
Definition: TGMimeTypes.cxx:169
TGMime::fAction
TString fAction
Definition: TGMimeTypes.h:39
TGMime::fPattern
TString fPattern
Definition: TGMimeTypes.h:38
TGMimeTypes::Print
void Print(Option_t *option="") const
Print list of mime types.
Definition: TGMimeTypes.cxx:255
bool
TGMimeTypes::HasChanged
Bool_t HasChanged() const
Definition: TGMimeTypes.h:67
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGMime::fReg
TRegexp * fReg
Definition: TGMimeTypes.h:42
TGClient.h
TGMimeTypes
Definition: TGMimeTypes.h:50
TGMime::fIcon
TString fIcon
Definition: TGMimeTypes.h:40
TRegexp
Definition: TRegexp.h:31
TGMimeTypes::~TGMimeTypes
virtual ~TGMimeTypes()
Delete mime type pool.
Definition: TGMimeTypes.cxx:147
TGMimeTypes::fChanged
Bool_t fChanged
Definition: TGMimeTypes.h:55
TGMime::fSIcon
TString fSIcon
Definition: TGMimeTypes.h:41
file
Definition: file.py:1
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGMime::fType
TString fType
Definition: TGMimeTypes.h:37
TGMimeTypes::GetAction
Bool_t GetAction(const char *filename, char *action)
Return in action the mime action string belonging to filename.
Definition: TGMimeTypes.cxx:225
TGMime::TGMime
TGMime()
Definition: TGMimeTypes.h:45
type
int type
Definition: TGX11.cxx:121
TGClient
Definition: TGClient.h:46
TGMimeTypes::SaveMimes
void SaveMimes()
Save mime types in user's mime type file.
Definition: TGMimeTypes.cxx:275
TGMimeTypes::GetIcon
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
Definition: TGMimeTypes.cxx:203
TGMime::~TGMime
~TGMime()
Delete mime object.
Definition: TGMimeTypes.cxx:336
TGMime
Definition: TGMimeTypes.h:32