wxFileDialog::SetWildcard() and case sensitivity
Vadim Zeitlin
vadim at wxwidgets.org
Wed Sep 5 05:29:55 PDT 2007
On Tue, 04 Sep 2007 17:11:18 -0300 Ian Britten <britten at caris.com> wrote:
IB> [ wxGTK, wxMSW v2.8.4 ]
IB>
IB> Is it possible (And portable!) to set some sort of case-insensitive
IB> behaviour for the wildcard handling of the wxFileDialog?
It isn't possible to do it currently but it could be implemented for
wxGTK. Currently our code uses gtk_file_chooser_add_filter() to construct
the filter which is used by GTK+ file chooser widget and this is supposed
to allow for shell-style patterns so using "[jJ][pP][gG]" should work (I
didn't test it though).
Of course, ideally we'd use gtk_file_filter_add_custom() instead which
would allow us to do case-insensitive (or maybe even regex) matching
ourselves. But this is a tad more difficult.
Also, some people may want to treat their extensions case-sensitively (.c
vs .C for example) so we should probably have an option for this, although
I'd be for treating them case-insensitively, for consistency with the other
platforms, by default.
IB> I was thinking along the lines of setting some sort of Regex pattern as
IB> the wildcard... (Maybe?)
This could be implemented for wxGTK too but not for wxMSW nor the other
ports AFAIK (at least not easily implemented, anyhow).
IB> I'd like to allow users to pick a file, but basically ignore the
IB> case of the extension, so that programatically setting a wildcard
IB> of *.jpg actually allows the user to pick files like *.JPG, *.jpg,
IB> *.Jpg, etc... (Maybe even handling the annoying *.JPEG variant too!)
This would be best handled by using gtk_file_filter_add_mime_type(), i.e.
allowing to specify MIME types of the files instead of extensions. I think
this would be the most useful extension to the wildcard mechanism as
ideally it should allow you passing "image/*" to open _any_ image type and
not just "image/jpeg". Again, this may be implemented relatively easily for
GTK but it will be much more difficult for MSW unfortunately.
Anyhow, I don't really have time to do anything of it myself now but if
you, or anyone else, has time and inclination to do it I'd do my best to
help. At least transforming patter "*.foo" into "*.[fF][oO][oO]" should be
pretty simple.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list