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

FX::FXFileDict Class Reference

The File Association dictionary associates a file extension with a FXFileAssoc record which contains command name, mime type, icons, and other information about the file type. More...

#include <FXFileDict.h>

Inheritance diagram for FX::FXFileDict:

FX::FXDict FX::FXObject List of all members.

Public Member Functions

 FXFileDict (FXApp *a)
 FXFileDict (FXApp *a, FXSettings *db)
FXApp * getApp () const
void setIconPath (const FXString &path)
FXString getIconPath () const
FXFileAssoc * replace (const FXchar *ext, const FXchar *str)
FXFileAssoc * remove (const FXchar *ext)
FXFileAssoc * find (const FXchar *ext)
FXFileAssoc * associate (const FXchar *key)
virtual FXFileAssoc * findFileBinding (const FXchar *pathname)
virtual FXFileAssoc * findDirBinding (const FXchar *pathname)
virtual FXFileAssoc * findExecBinding (const FXchar *pathname)
virtual void save (FXStream &store) const
virtual void load (FXStream &store)
virtual ~FXFileDict ()

Static Public Attributes

const FXchar defaultExecBinding []
const FXchar defaultDirBinding []
const FXchar defaultFileBinding []

Detailed Description

The File Association dictionary associates a file extension with a FXFileAssoc record which contains command name, mime type, icons, and other information about the file type.

The Registry is used as source of the file bindings; an alternative Settings database may be specified however.


Constructor & Destructor Documentation

FX::FXFileDict::FXFileDict (  FXApp *  a  ) 
 

Construct a dictionary mapping file-extension to file associations, using the application registry settings as a source for the bindings.

FX::FXFileDict::FXFileDict (  FXApp *  a,
FXSettings *  db
) 
 

Construct a dictionary mapping file-extension to file associations, using the specified settings database as a source for the bindings.

virtual FX::FXFileDict::~FXFileDict (   )  [virtual]
 

Destructor.


Member Function Documentation

FXApp* FX::FXFileDict::getApp (   )  const [inline]
 

Get application.

void FX::FXFileDict::setIconPath (  const FXString &  path  ) 
 

Set icon search path.

FXString FX::FXFileDict::getIconPath (   )  const
 

Return current icon search path.

FXFileAssoc* FX::FXFileDict::replace (  const FXchar *  ext,
const FXchar *  str
) 
 

Replace file association.

The new association is written into the settings database under the FILETYPES section; the format of the association is as follows:

= "<command> ; <type> ; <bigicon> [ : <bigopenicon> ] ; <smallicon> [ : <smalliconopen> ] ; <mimetype>"

Where is the command used to launch the application (e.g. "xv %s &"), and is the file type string (e.g. "GIF Image"), and are the large icons shown in "Icons" mode, and are the small icons shown in "Details" mode, and is the RFC2045 mime type of the file.

For example:

[FILETYPES] gif="xv s &;GIF Image;big.xpm:bigopen.xpm;mini.xpm:miniopen.xpm;image/gif" /home/jeroen=";Home;home.xpm;minihome.xpm;application/x-folder"

FXFileAssoc* FX::FXFileDict::remove (  const FXchar *  ext  ) 
 

Remove file association.

Reimplemented from FX::FXDict.

FXFileAssoc* FX::FXFileDict::find (  const FXchar *  ext  )  [inline]
 

Find file association already in dictionary.

FXFileAssoc* FX::FXFileDict::associate (  const FXchar *  key  ) 
 

Find file association from registry.

virtual FXFileAssoc* FX::FXFileDict::findFileBinding (  const FXchar *  pathname  )  [virtual]
 

Determine binding for the given file.

The default implementation tries the whole filename first, then tries the extensions. For example, for a file "source.tar.gz":

"source.tar.gz", "tar.gz", "gz"

are tried in succession. If no association is found the key "defaultfilebinding" is tried as a fallback association. A NULL is returned if no association of any kind is found.

virtual FXFileAssoc* FX::FXFileDict::findDirBinding (  const FXchar *  pathname  )  [virtual]
 

Find directory binding from registry.

The default implementation tries the whole pathname first, then tries successively smaller parts of the path. For example, a pathname "/usr/people/jeroen":

"/usr/people/jeroen" "/people/jeroen" "/jeroen"

are tried in succession. If no bindings are found, the key "defaultdirbinding" is tried as a fallback association. A NULL is returned if no association of any kind is found.

virtual FXFileAssoc* FX::FXFileDict::findExecBinding (  const FXchar *  pathname  )  [virtual]
 

Determine binding for the given executable.

The default implementation returns the fallback binding associated with the key "defaultexecbinding". A NULL is returned if no association of any kind is found.

virtual void FX::FXFileDict::save (  FXStream &  store  )  const [virtual]
 

Save to stream.

Reimplemented from FX::FXObject.

virtual void FX::FXFileDict::load (  FXStream &  store  )  [virtual]
 

Load from stream.

Reimplemented from FX::FXObject.


Member Data Documentation

const FXchar FX::FXFileDict::defaultExecBinding[] [static]
 

Registry key used to find fallback executable icons.

const FXchar FX::FXFileDict::defaultDirBinding[] [static]
 

Registry key used to find fallback directory icons.

const FXchar FX::FXFileDict::defaultFileBinding[] [static]
 

Registry key used to find fallback document icons.

Copyright © 1997-2004 Jeroen van der Zijp