Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
28class TOrdCollection;
29class TRegexp;
30
31
32class TGMime : public TObject {
33
34friend class TGMimeTypes;
35
36private:
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
44public:
45 TGMime() : fReg(0) {}
46 ~TGMime();
47};
48
49
50class TGMimeTypes : public TObject {
51
52protected:
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);
60 TGMime *Find(const char *filename);
61
62public:
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
bool Bool_t
Definition RtypesCore.h:63
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
int type
Definition TGX11.cxx:121
TGMimeTypes & operator=(const TGMimeTypes &gmt)
Assignment operator.
void Print(Option_t *option="") const
Print list of mime types.
Bool_t fChanged
Definition TGMimeTypes.h:55
void SaveMimes()
Save mime types in user's mime type file.
virtual ~TGMimeTypes()
Delete mime type pool.
TGMime * Find(const char *filename)
Given a filename find the matching mime type object.
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.
TOrdCollection * fList
Definition TGMimeTypes.h:56
TGClient * fClient
Definition TGMimeTypes.h:53
Bool_t HasChanged() const
Definition TGMimeTypes.h:67
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
Bool_t GetAction(const char *filename, char *action)
Return in action the mime action string belonging to filename.
Bool_t GetType(const char *filename, char *type)
Return in type the mime type belonging to filename.
TString fFilename
Definition TGMimeTypes.h:54
~TGMime()
Delete mime object.
TString fType
Definition TGMimeTypes.h:37
TString fPattern
Definition TGMimeTypes.h:38
TRegexp * fReg
Definition TGMimeTypes.h:42
TString fIcon
Definition TGMimeTypes.h:40
TString fAction
Definition TGMimeTypes.h:39
TString fSIcon
Definition TGMimeTypes.h:41
Mother of all ROOT objects.
Definition TObject.h:37
Ordered collection.
Regular expression class.
Definition TRegexp.h:31
Basic string class.
Definition TString.h:136
Definition file.py:1