Newer
Older
/***********************************************************************
* FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
* Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For further information please contact the author by e-mail
* at "lyle@lylejohnson.name".
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
***********************************************************************/
/// Registers stuff to know about the extension
struct FXFileAssoc {
FXFileAssoc();
FXString command; /// Command to execute
FXString extension; /// Full extension name
FXString mimetype; /// Mime type name
FXIcon *bigicon; /// Big normal icon
FXIcon *bigiconopen; /// Big open icon
FXIcon *miniicon; /// Mini normal icon
FXIcon *miniiconopen; /// Mini open icon
FXDragType dragtype; /// Registered drag type
FXuint flags; /// Flags
~FXFileAssoc();
};
/// File Association dictionary
class FXFileDict : public FXDict {
protected:
FXFileDict(){}
virtual void *createData(const void*);
virtual void deleteData(void*);
public:
%extend {
/// Registry key used to find fallback executable icons
static VALUE defaultExecBinding(){
return to_ruby(FXFileDict::defaultExecBinding);
}
/// Registry key used to find fallback directory icons
static VALUE defaultDirBinding(){
return to_ruby(FXFileDict::defaultDirBinding);
}
/// Registry key used to find fallback document icons
static VALUE defaultFileBinding(){
return to_ruby(FXFileDict::defaultFileBinding);
}
}
public:
%extend {
/**
* Construct a dictionary mapping file-extension to file associations,
* using the application registry settings as a source for the bindings.
*/
FXFileDict(FXApp* a){
return new FXRbFileDict(a);
}
/**
* Construct a dictionary mapping file-extension to file associations,
* using the specified settings database as a source for the bindings.
*/
FXFileDict(FXApp* a,FXSettings* db){
return new FXRbFileDict(a,db);
}
}
/// Change settings database
void setSettings(FXSettings* s);
/// Return settings database
FXSettings* getSettings() const;
/// Change icon dictionary
void setIconDict(FXIconDict *icns);
/// Return icon dictionary
FXIconDict* getIconDict() const;
/**
* Set icon search path; the initial search path is determined by the
* "iconpath" registry setting in the SETTINGS section.
*/
void setIconPath(const FXString& path);
/// Return current icon search path
const FXString& getIconPath() const;
/// Replace file association
FXFileAssoc* replace(const FXchar* ext,const FXchar* str);
/// Remove file association
FXFileAssoc* remove(const FXchar* ext);
/// Find file association from registry
FXFileAssoc* find(const FXchar* ext);
/// Destructor
virtual ~FXFileDict();
};
DECLARE_FXOBJECT_VIRTUALS(FXFileDict)
DECLARE_FXFILEDICT_VIRTUALS(FXFileDict)