Logo ROOT   6.12/07
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
TString fType
Definition: TGMimeTypes.h:37
const char Option_t
Definition: RtypesCore.h:62
~TGMime()
Delete mime object.
Regular expression class.
Definition: TRegexp.h:31
TOrdCollection * fList
Definition: TGMimeTypes.h:56
Basic string class.
Definition: TString.h:125
bool Bool_t
Definition: RtypesCore.h:59
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
TGClient * fClient
Definition: TGMimeTypes.h:53
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:550
TString fSIcon
Definition: TGMimeTypes.h:41
#define ClassDef(name, id)
Definition: Rtypes.h:320
TRegexp * fReg
Definition: TGMimeTypes.h:42
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.h:271
TString fFilename
Definition: TGMimeTypes.h:54
TString fPattern
Definition: TGMimeTypes.h:38
Bool_t fChanged
Definition: TGMimeTypes.h:55
Bool_t HasChanged() const
Definition: TGMimeTypes.h:67
TGMime()
Definition: TGMimeTypes.h:45
int type
Definition: TGX11.cxx:120
UInt_t Find(std::list< std::pair< const Node< T > *, Float_t > > &nlist, const Node< T > *node, const T &event, UInt_t nfind)
Mother of all ROOT objects.
Definition: TObject.h:37
TString fIcon
Definition: TGMimeTypes.h:40
Definition: file.py:1
friend class TGMimeTypes
Definition: TGMimeTypes.h:34
TString fAction
Definition: TGMimeTypes.h:39
Ordered collection.