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 #include "TGClient.h"
17 #include "TGPicture.h"
18 
19 class TOrdCollection;
20 class TRegexp;
21 
22 /** \class TGMime
23  \ingroup guiwidgets
24 
25 TGMime is internally used by TGMimeTypes.
26 
27 */
28 
29 class TGMime : public TObject {
30 
31 friend class TGMimeTypes;
32 
33 private:
34  TString fType; ///< mime type
35  TString fPattern; ///< filename pattern
36  TString fAction; ///< associated action
37  TString fIcon; ///< associated icon (32x32)
38  TString fSIcon; ///< associated small icon (16x16)
39  TRegexp *fReg; ///< pattern regular expression
40 
41 public:
42  TGMime() : fReg(0) {}
43  ~TGMime();
44 };
45 
46 
47 class TGMimeTypes : public TObject {
48 
49 protected:
50  TGClient *fClient; ///< client to which mime types belong (display server)
51  TString fFilename; ///< file name of mime type file
52  Bool_t fChanged; ///< true if file has changed
53  TOrdCollection *fList; ///< list of mime types
54 
55  TGMimeTypes(const TGMimeTypes& gmt);
56  TGMimeTypes& operator=(const TGMimeTypes& gmt);
57  TGMime *Find(const char *filename);
58 
59 public:
60  TGMimeTypes(TGClient *client, const char *file);
61  virtual ~TGMimeTypes();
62 
63  void SaveMimes();
64  Bool_t HasChanged() const { return fChanged; }
65  void AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action);
66  void Print(Option_t *option="") const;
67  Bool_t GetAction(const char *filename, char *action);
68  Bool_t GetType(const char *filename, char *type);
69  const TGPicture *GetIcon(const char *filename, Bool_t small_icon);
70 
71  ClassDef(TGMimeTypes,0) // Pool of mime type objects
72 };
73 
74 #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
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGMimeTypes::fList
TOrdCollection * fList
list of mime types
Definition: TGMimeTypes.h:53
TGPicture.h
TOrdCollection
Ordered collection.
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
client to which mime types belong (display server)
Definition: TGMimeTypes.h:50
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
file name of mime type file
Definition: TGMimeTypes.h:51
TString
Basic string class.
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
associated action
Definition: TGMimeTypes.h:36
TGMime::fPattern
TString fPattern
filename pattern
Definition: TGMimeTypes.h:35
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:64
TGMime::fReg
TRegexp * fReg
pattern regular expression
Definition: TGMimeTypes.h:39
TGClient.h
TGMimeTypes
This class handles mime types, used by browsers to map file types to applications and icons.
Definition: TGMimeTypes.h:47
TGMime::fIcon
TString fIcon
associated icon (32x32)
Definition: TGMimeTypes.h:37
TRegexp
Regular expression class.
Definition: TRegexp.h:31
TGMimeTypes::~TGMimeTypes
virtual ~TGMimeTypes()
Delete mime type pool.
Definition: TGMimeTypes.cxx:147
TGMimeTypes::fChanged
Bool_t fChanged
true if file has changed
Definition: TGMimeTypes.h:52
TGMime::fSIcon
TString fSIcon
associated small icon (16x16)
Definition: TGMimeTypes.h:38
file
Definition: file.py:1
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGMime::fType
TString fType
mime type
Definition: TGMimeTypes.h:34
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:42
type
int type
Definition: TGX11.cxx:121
TGClient
Window client.
Definition: TGClient.h:37
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
TGMime is internally used by TGMimeTypes.
Definition: TGMimeTypes.h:29