Class: Fox::FXFileDict
- Defined in:
- rdoc-sources/FXFileDict.rb
Overview
The File Association dictionary associates a file extension with a File Association record which contains command name, mime type, icons, and other information about the file type. The icons referenced by the file association are managed by the Icon Dictionary; this guarantees that each icon is loaded only once into memory. The associations are determined by the information by the FOX Registry settings; each entry under the FILETYPES registry section comprises the command line, extension name, large icon, small icon, and mime type:
command ';' extension ';' bigicon [ ':' bigiconopen ] ';' icon [ ':' iconopen ] ';' mime
For example, the binding for “jpg” could be:
xv %s &;JPEG Image;bigimage.xpm;miniimage.xpm;image/jpeg
The association for a file name is determined by first looking at the entire file name, then at the whole extension, and then at sub-extensions. For example, “name.tar.gz”, “tar.gz”, and “gz” can each be given a different file association. Directory names may also be given associations; there is no command-line association for a directory, however. The association for a directory is found by first checking the whole pathname, then checking the pathname less the first component, and so on. So, “/usr/local/include”, “/local/include”, and “/include” can each be given their own file associations. If the above lookup procedure has not found a file association, the system uses a fallback associations: for files, the fallback association is determined by the binding “defaultfilebinding”. For directories, the “defaultdirbinding” is used, and for executables the “defaultexecbinding” is used.
Instance Attribute Summary collapse
-
#iconDict ⇒ Object
Current icon search path FXIconDict.
-
#iconPath ⇒ Object
Current icon search path [String].
-
#settings ⇒ Object
Settings database FXSettings.
Attributes inherited from FXDict
Class Method Summary collapse
-
.defaultDirBinding ⇒ Object
Return the registry key used to find fallback directory icons.
-
.defaultExecBinding ⇒ Object
Return the registry key used to find fallback executable icons.
-
.defaultFileBinding ⇒ Object
Return the registry key used to find fallback document icons.
Instance Method Summary collapse
-
#find(ext) ⇒ Object
Find file association from registry for the specified key.
-
#findDirBinding(pathname) ⇒ Object
Returns a reference to the FXFileAssoc instance…
-
#findExecBinding(pathname) ⇒ Object
Returns a reference to the FXFileAssoc instance…
-
#findFileBinding(pathname) ⇒ Object
Returns a reference to the FXFileAssoc instance…
-
#initialize(app, db = nil) ⇒ FXFileDict
constructor
Construct a dictionary that maps file extensions to file associations.
-
#remove(ext) ⇒ Object
Remove file association for the specified extension and return a reference to it.
-
#replace(ext, str) ⇒ Object
Replace file association for the specified extension; returns a reference to the file association.
Methods inherited from FXDict
#clear, #each_key, #empty?, #has_key?, #key, #keys, #marked?, #next, #prev
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize(app, db = nil) ⇒ FXFileDict
Construct a dictionary that maps file extensions to file associations. If db is not nil
, the specified settings database is used as a source for the bindings. Otherwise, the application registry settings are used.
Parameters:
app
: Application Fox::FXApp
db
-
Settings database Fox::FXSettings
97 |
# File 'rdoc-sources/FXFileDict.rb', line 97 def initialize(app, db=nil); end |
Instance Attribute Details
#iconDict ⇒ Object
Current icon search path Fox::FXIconDict
72 73 74 |
# File 'rdoc-sources/FXFileDict.rb', line 72 def iconDict @iconDict end |
#iconPath ⇒ Object
Current icon search path [String]
75 76 77 |
# File 'rdoc-sources/FXFileDict.rb', line 75 def iconPath @iconPath end |
#settings ⇒ Object
Settings database Fox::FXSettings
69 70 71 |
# File 'rdoc-sources/FXFileDict.rb', line 69 def settings @settings end |
Class Method Details
.defaultDirBinding ⇒ Object
Return the registry key used to find fallback directory icons.
81 |
# File 'rdoc-sources/FXFileDict.rb', line 81 def FXFileDict.defaultDirBinding(); end |
.defaultExecBinding ⇒ Object
Return the registry key used to find fallback executable icons.
78 |
# File 'rdoc-sources/FXFileDict.rb', line 78 def FXFileDict.defaultExecBinding(); end |
.defaultFileBinding ⇒ Object
Return the registry key used to find fallback document icons.
84 |
# File 'rdoc-sources/FXFileDict.rb', line 84 def FXFileDict.defaultFileBinding(); end |
Instance Method Details
#find(ext) ⇒ Object
Find file association from registry for the specified key.
119 |
# File 'rdoc-sources/FXFileDict.rb', line 119 def find(ext); end |
#findDirBinding(pathname) ⇒ Object
Returns a reference to the FXFileAssoc instance…
125 |
# File 'rdoc-sources/FXFileDict.rb', line 125 def findDirBinding(pathname); end |
#findExecBinding(pathname) ⇒ Object
Returns a reference to the FXFileAssoc instance…
128 |
# File 'rdoc-sources/FXFileDict.rb', line 128 def findExecBinding(pathname); end |
#findFileBinding(pathname) ⇒ Object
Returns a reference to the FXFileAssoc instance…
122 |
# File 'rdoc-sources/FXFileDict.rb', line 122 def findFileBinding(pathname); end |
#remove(ext) ⇒ Object
Remove file association for the specified extension and return a reference to it.
114 |
# File 'rdoc-sources/FXFileDict.rb', line 114 def remove(ext); end |
#replace(ext, str) ⇒ Object
Replace file association for the specified extension; returns a reference to the file association.
Parameters:
ext
-
Extension [String]
str
-
String [String]
108 |
# File 'rdoc-sources/FXFileDict.rb', line 108 def replace(ext, str); end |