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(nullptr) {}
43 ~TGMime() override;
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 ~TGMimeTypes() override;
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 override;
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 ClassDefOverride(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 ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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.
Bool_t fChanged
true if file has changed
Definition TGMimeTypes.h:52
void SaveMimes()
Save mime types in user's mime type file.
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
~TGMimeTypes() override
Delete mime type pool.
TGClient * fClient
client to which mime types belong (display server)
Definition TGMimeTypes.h:50
Bool_t HasChanged() const
Definition TGMimeTypes.h:64
void Print(Option_t *option="") const override
Print list of mime types.
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
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
~TGMime() override
Delete mime object.
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:139