Logo ROOT   6.08/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 #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
TString fType
Definition: TGMimeTypes.h:41
const char Option_t
Definition: RtypesCore.h:62
~TGMime()
Delete mime object.
Regular expression class.
Definition: TRegexp.h:35
TOrdCollection * fList
Definition: TGMimeTypes.h:60
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
TGClient * fClient
Definition: TGMimeTypes.h:57
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:595
TString fSIcon
Definition: TGMimeTypes.h:45
#define ClassDef(name, id)
Definition: Rtypes.h:254
TRegexp * fReg
Definition: TGMimeTypes.h:46
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.cxx:103
TString fFilename
Definition: TGMimeTypes.h:58
TString fPattern
Definition: TGMimeTypes.h:42
Bool_t fChanged
Definition: TGMimeTypes.h:59
Bool_t HasChanged() const
Definition: TGMimeTypes.h:71
TGMime()
Definition: TGMimeTypes.h:49
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:44
Definition: file.py:1
friend class TGMimeTypes
Definition: TGMimeTypes.h:38
TString fAction
Definition: TGMimeTypes.h:43
Ordered collection.