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#include "TGClient.h"
17#include "TGPicture.h"
18
19class TOrdCollection;
20class TRegexp;
21
22/** \class TGMime
23 \ingroup guiwidgets
24
25TGMime is internally used by TGMimeTypes.
26
27*/
28
29class TGMime : public TObject {
30
31friend class TGMimeTypes;
32
33private:
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
41public:
42 TGMime() : fReg(0) {}
43 ~TGMime();
44};
45
46
47class TGMimeTypes : public TObject {
48
49protected:
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);
57 TGMime *Find(const char *filename);
58
59public:
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
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
Window client.
Definition TGClient.h:37
This class handles mime types, used by browsers to map file types to applications and icons.
Definition TGMimeTypes.h:47
TGMimeTypes & operator=(const TGMimeTypes &gmt)
Assignment operator.
void Print(Option_t *option="") const
Print list of mime types.
Bool_t fChanged
true if file has changed
Definition TGMimeTypes.h:52
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
list of mime types
Definition TGMimeTypes.h:53
TGClient * fClient
client to which mime types belong (display server)
Definition TGMimeTypes.h:50
Bool_t HasChanged() const
Definition TGMimeTypes.h:64
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
file name of mime type file
Definition TGMimeTypes.h:51
TGMime is internally used by TGMimeTypes.
Definition TGMimeTypes.h:29
~TGMime()
Delete mime object.
TString fType
mime type
Definition TGMimeTypes.h:34
TString fPattern
filename pattern
Definition TGMimeTypes.h:35
TRegexp * fReg
pattern regular expression
Definition TGMimeTypes.h:39
TString fIcon
associated icon (32x32)
Definition TGMimeTypes.h:37
TString fAction
associated action
Definition TGMimeTypes.h:36
TString fSIcon
associated small icon (16x16)
Definition TGMimeTypes.h:38
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Mother of all ROOT objects.
Definition TObject.h:41
Ordered collection.
Regular expression class.
Definition TRegexp.h:31
Basic string class.
Definition TString.h:136
Definition file.py:1