gtkmm 3.6.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Gtk::FileFilter Class Reference

A filter for selecting a file subset. More...

Inheritance diagram for Gtk::FileFilter:
[legend]

List of all members.

## Classes
class | Info

## Public Types
typedef sigc::slot< bool, const Info& > | SlotCustom
| For instance, bool on_custom(const Gtk::FileFilter::Info& filter_info);.
Public Types inherited from Glib::Object
typedef void(* | DestroyNotify )(gpointer data)

## Public Member Functions
virtual | ~FileFilter ()
GtkFileFilter* | gobj ()
| Provides access to the underlying C GObject.
const GtkFileFilter* | gobj () const
| Provides access to the underlying C GObject.
GtkFileFilter* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_name (const Glib::ustring& name)
| Sets the human-readable name of the filter; this is the string that will be displayed in the file selector user interface if there is a selectable list of filters.
Glib::ustring | get_name () const
| Gets the human-readable name for the filter.
void | add_mime_type (const Glib::ustring& mime_type)
| Adds a rule allowing a given mime type to filter.
void | add_pattern (const Glib::ustring& pattern)
| Adds a rule allowing a shell style glob to a filter.
void | add_pixbuf_formats ()
| Adds a rule allowing image files in the formats supported by GdkPixbuf.
void | add_custom (FileFilterFlags needed, const SlotCustom& slot)
FileFilterFlags | get_needed () const
| Gets the fields that need to be filled in for the structure passed to filter()
Public Member Functions inherited from Glib::Object
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj_copy () const
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)

## 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 ()

## Protected Member Functions
| FileFilter ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
virtual | ~Object ()
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
virtual | ~ObjectBase ()=0
void | initialize (GObject *castitem)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::FileFilter > | wrap (GtkFileFilter* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

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/*.

Normally, filters are used by adding them to a Gtk::FileChooser. See Gtk::FileChooser::add_filter(). But it is also possible to manually use a filter on a file with filter().

## Member Typedef Documentation

typedef sigc::slot<bool, const Info&> Gtk::FileFilter::SlotCustom

For instance, bool on_custom(const Gtk::FileFilter::Info& filter_info);.

## Constructor & Destructor Documentation

virtual Gtk::FileFilter::~FileFilter | ( |  | ) |
| virtual

Gtk::FileFilter::FileFilter | ( |  | ) |
| protected

## Member Function Documentation

void Gtk::FileFilter::add_custom | ( | FileFilterFlags | needed,
|  | const SlotCustom& | slot
| ) |  |

void Gtk::FileFilter::add_mime_type | ( | const Glib::ustring & | mime_type | ) |

Adds a rule allowing a given mime type to filter.

Since gtkmm 2.4:

Parameters:

  mime_type | Name of a MIME type.

void Gtk::FileFilter::add_pattern | ( | const Glib::ustring & | pattern | ) |

Adds a rule allowing a shell style glob to a filter.

Since gtkmm 2.4:

Parameters:

  pattern | A shell style glob.

void Gtk::FileFilter::add_pixbuf_formats | ( |  | ) |

Adds a rule allowing image files in the formats supported by GdkPixbuf.

Since gtkmm 2.6:

static Glib::RefPtr<FileFilter> Gtk::FileFilter::create | ( |  | ) |
| static

Glib::ustring Gtk::FileFilter::get_name | ( |  | ) | const

Gets the human-readable name for the filter.

See set_name().

    \xrefitem since_2_4 174. @return The human-readable name of the filter,
    or <tt>0</tt>. This value is owned by GTK+ and must not
    be modified or freed.

FileFilterFlags Gtk::FileFilter::get_needed | ( |  | ) | const

Gets the fields that need to be filled in for the structure passed to filter()

This function will not typically be used by applications; it is intended principally for use in the implementation of Gtk::FileChooser.

Since gtkmm 2.4:

Returns:
  Bitfield of flags indicating needed fields when calling filter().

static GType Gtk::FileFilter::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

GtkFileFilter* Gtk::FileFilter::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

Reimplemented from Glib::Object.

const GtkFileFilter* Gtk::FileFilter::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

Reimplemented from Glib::Object.

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.

void Gtk::FileFilter::set_name | ( | const Glib::ustring & | name | ) |

Sets the human-readable name of the filter; this is the string that will be displayed in the file selector user interface if there is a selectable list of filters.

Since gtkmm 2.4:

Parameters:

  name | The human-readable-name for the filter, or `0` to remove any existing name.

## Friends And Related Function Documentation

Glib::RefPtr< Gtk::FileFilter > wrap | ( | GtkFileFilter * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters:

  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.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/filefilter.h