gtkmm 4.18.0
|
A filter for selecting a file subset. More...
#include <gtkmm/filefilter.h>
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
static Glib::RefPtr< FileFilter > | create () |
![]() | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
![]() | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gtk::FileFilter > | wrap (GtkFileFilter *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
![]() | |
Glib::RefPtr< Gtk::Filter > | wrap (GtkFilter *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
![]() | |
Glib::RefPtr< Gtk::Buildable > | wrap (GtkBuildable *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Additional Inherited Members | |
![]() | |
enum class | Match { Match::SOME , Match::NONE , Match::ALL } |
Describes the known strictness of a filter. More... | |
enum class | Change { Change::DIFFERENT , Change::LESS_STRICT , Change::MORE_STRICT } |
Describes changes in a filter in more detail and allows objects using the filter to optimize refiltering items. More... | |
![]() | |
typedef void(*)(gpointer data | DestroyNotify) |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
A filter for selecting a file subset.
A Gtk::FileFilter can be used to restrict the files being shown in a Gtk::FileChooser. Files can be filtered based on their name (with add_pattern()), on their MIME type (with add_mime_type()), or by a custom filter function (with add_custom()).
Filtering by MIME types handles aliasing and subclassing of MIME types; e.g. a filter for text/plain
also matches a file with MIME type application/rtf
, since application/rtf
is a subclass of text/plain
. Note that Gtk::FileFilter allows wildcards for the subtype of a MIME type, so you can e.g. filter for image/ *
.
Filters are used by adding them to a Gtk::FileChooser. See Gtk::FileChooser::add_filter().
|
noexcept |
|
overridenoexcept |
|
protected |
void Gtk::FileFilter::add_mime_type | ( | const Glib::ustring & | mime_type | ) |
Adds a rule allowing a given mime type.
mime_type | Name of a MIME type. |
void Gtk::FileFilter::add_pattern | ( | const Glib::ustring & | pattern | ) |
Adds a rule allowing a shell style glob pattern.
Note that it depends on the platform whether pattern matching ignores case or not. On Windows, it does, on other platforms, it doesn't.
pattern | A shell style glob pattern. |
void Gtk::FileFilter::add_pixbuf_formats | ( | ) |
Adds a rule allowing image files in the formats supported by Gdk::Pixbuf
.
This is equivalent to calling add_mime_type() for all the supported mime types.
void Gtk::FileFilter::add_suffix | ( | const std::string & | suffix | ) |
Adds a suffix match rule to a filter.
This is similar to adding a match for the pattern "*. @a suffix"
An exaple to filter files with the suffix ".sub":
[C example ellipted]
Filters with multiple dots are allowed.
In contrast to pattern matches, suffix matches are always case-insensitive.
suffix | Filename suffix to match. |
|
static |
Glib::ustring Gtk::FileFilter::get_name | ( | ) | const |
Gets the human-readable name for the filter.
See set_name().
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkFileFilter * Gtk::FileFilter::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
noexcept |
Glib::PropertyProxy< Glib::ustring > Gtk::FileFilter::property_name | ( | ) |
The human-readable name of the filter.
This is the string that will be displayed in the user interface if there is a selectable list of filters.
Default value: ""
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FileFilter::property_name | ( | ) | const |
The human-readable name of the filter.
This is the string that will be displayed in the user interface if there is a selectable list of filters.
Default value: ""
void Gtk::FileFilter::set_name | ( | const Glib::ustring & | name | ) |
Sets a human-readable name of the filter.
This is the string that will be displayed in the user interface if there is a selectable list of filters.
name | The human-readable name for the filter. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |