Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXFileAssociations.h
1 /********************************************************************************
2 * *
3 * F i l e A s s o c i a t i o n s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2018 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXFILEASSOCIATIONS_H
22 #define FXFILEASSOCIATIONS_H
23 
24 #ifndef FXOBJECT_H
25 #include "FXObject.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXIcon;
32 class FXIconSource;
33 
34 
36 struct FXFileAssoc {
37  FXString command;
44  FXDragType dragtype;
45  FXuint flags;
46  };
47 
48 
49 // Dictionary of file associations
51 
52 
101 class FXAPI FXFileAssociations : public FXObject {
102  FXDECLARE(FXFileAssociations)
103 protected:
104  FXFileAssocDictionary bindings; // File bindings dictionary
105  FXIconCache cache; // Cache icons for rapid access
106  FXSettings *settings; // Settings database for looking up extensions
107 protected:
109 private:
111  FXFileAssociations &operator=(const FXFileAssociations&);
112 public:
113 
115  static const FXchar defaultExecBinding[];
116 
118  static const FXchar defaultDirBinding[];
119 
121  static const FXchar defaultFileBinding[];
122 
123 public:
124 
132 
140 
144  void setSettings(FXSettings* sdb){ settings=sdb; }
145 
149  FXSettings* getSettings() const { return settings; }
150 
154  void setIconSource(FXIconSource* src){ cache.setIconSource(src); }
155 
159  FXIconSource* getIconSource() const { return cache.getIconSource(); }
160 
164  void setIconPath(const FXString& path){ cache.setIconPath(path); }
165 
169  const FXString& getIconPath() const { return cache.getIconPath(); }
170 
174  virtual FXFileAssoc* parse(const FXString& assoc);
175 
183  virtual FXFileAssoc* fetch(const FXString& ext);
184 
199  virtual FXFileAssoc* findFileBinding(const FXString& pathname);
200 
215  virtual FXFileAssoc* findDirBinding(const FXString& pathname);
216 
223  virtual FXFileAssoc* findExecBinding(const FXString& pathname);
224 
228  void clear();
229 
233  virtual void save(FXStream& store) const;
234 
238  virtual void load(FXStream& store);
239 
243  virtual ~FXFileAssociations();
244  };
245 
246 }
247 
248 #endif
Registers stuff to know about the extension.
Definition: FXFileAssociations.h:36
FXString mimetype
Full extension name.
Definition: FXFileAssociations.h:39
FXIcon * bigiconopen
Big normal icon.
Definition: FXFileAssociations.h:41
An icon source is a class that loads an icon of any type.
Definition: FXIconSource.h:47
The Application object is the central point of a FOX user-interface.
Definition: FXApp.h:134
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:78
void setSettings(FXSettings *sdb)
Change settings database being used to determine extension mappings.
Definition: FXFileAssociations.h:144
The Settings class manages a key-value database.
Definition: FXSettings.h:34
FXString extension
Command to execute.
Definition: FXFileAssociations.h:38
FXIconSource * getIconSource() const
Return the current IconSource object.
Definition: FXFileAssociations.h:159
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
const FXString & getIconPath() const
Return the current icon search paths.
Definition: FXIconCache.h:91
void setIconPath(const FXString &path)
Set the icon search paths for the icon cache.
Definition: FXFileAssociations.h:164
void setIconPath(const FXString &p)
Set the icon search paths.
Definition: FXIconCache.h:88
FXIcon * miniicon
Big open icon.
Definition: FXFileAssociations.h:42
void setIconSource(FXIconSource *src)
Change the IconSource object used by the icon cache to load icons.
Definition: FXFileAssociations.h:154
void setIconSource(FXIconSource *src)
Change icon source.
Definition: FXIconCache.h:82
FXDragType dragtype
Mini open icon.
Definition: FXFileAssociations.h:44
The FileAssociations object manages file associations between a file extension and a FileAssoc record...
Definition: FXFileAssociations.h:101
FXSettings * getSettings() const
Return settings database.
Definition: FXFileAssociations.h:149
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:104
The Icon Cache manages a collection of icons.
Definition: FXIconCache.h:53
FXIcon * bigicon
Mime type name.
Definition: FXFileAssociations.h:40
FXIcon * miniiconopen
Mini normal icon.
Definition: FXFileAssociations.h:43
const FXString & getIconPath() const
Return the current icon search paths from the icon cache.
Definition: FXFileAssociations.h:169
FXIconSource * getIconSource() const
Return icon source.
Definition: FXIconCache.h:85
FXuint flags
Registered drag type.
Definition: FXFileAssociations.h:45
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2018 Jeroen van der Zijp