00001 /******************************************************************************** 00002 * * 00003 * F i l e - A s s o c i a t i o n T a b l e * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXFileDict.h,v 1.31 2006/01/22 17:58:01 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXFILEDICT_H 00025 #define FXFILEDICT_H 00026 00027 #ifndef FXDICT_H 00028 #include "FXDict.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXIconDict; 00035 00036 00038 struct FXFileAssoc { 00039 FXString command; 00040 FXString extension; 00041 FXString mimetype; 00042 FXIcon *bigicon; 00043 FXIcon *bigiconopen; 00044 FXIcon *miniicon; 00045 FXIcon *miniiconopen; 00046 FXDragType dragtype; 00047 FXuint flags; 00048 }; 00049 00050 00051 00085 class FXAPI FXFileDict : public FXDict { 00086 FXDECLARE(FXFileDict) 00087 private: 00088 FXSettings *settings; // Settings database where to get bindings 00089 FXIconDict *icons; // Icon dictionary which keeps track of loaded icons 00090 protected: 00091 FXFileDict(){} 00092 virtual void *createData(const void*); 00093 virtual void deleteData(void*); 00094 private: 00095 FXFileDict(const FXFileDict&); 00096 FXFileDict &operator=(const FXFileDict&); 00097 public: 00098 00100 static const FXchar *defaultExecBinding; 00101 00103 static const FXchar *defaultDirBinding; 00104 00106 static const FXchar *defaultFileBinding; 00107 00108 public: 00109 00116 FXFileDict(FXApp* app); 00117 00124 FXFileDict(FXApp* app,FXSettings* db); 00125 00127 void setSettings(FXSettings* s){ settings=s; } 00128 00130 FXSettings* getSettings() const { return settings; } 00131 00133 void setIconDict(FXIconDict *icns){ icons=icns; } 00134 00136 FXIconDict* getIconDict() const { return icons; } 00137 00142 void setIconPath(const FXString& path); 00143 00145 const FXString& getIconPath() const; 00146 00167 FXFileAssoc* replace(const FXchar* ext,const FXchar* str); 00168 00170 FXFileAssoc* remove(const FXchar* ext); 00171 00173 FXFileAssoc* find(const FXchar* ext); 00174 00189 virtual FXFileAssoc* findFileBinding(const FXchar* pathname); 00190 00205 virtual FXFileAssoc* findDirBinding(const FXchar* pathname); 00206 00213 virtual FXFileAssoc* findExecBinding(const FXchar* pathname); 00214 00216 virtual void save(FXStream& store) const; 00217 00219 virtual void load(FXStream& store); 00220 00222 virtual ~FXFileDict(); 00223 }; 00224 00225 } 00226 00227 #endif