Debian Codegraph @

gtk/src/icontheme.hg

raw
1 /* Copyright (C) 2003 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <vector>
18
19 #include <gdkmm/pixbuf.h>
20 #include <gdkmm/screen.h>
21
22 #include <gtkmm/iconinfo.h>
23 #include <giomm/icon.h>
24
25 _DEFS(gtkmm,gtk)
26 _PINCLUDE(glibmm/private/object_p.h)
27
28 namespace Gtk
29 {
30
31 _WRAP_ENUM(IconLookupFlags, GtkIconLookupFlags, NO_GTYPE, decl_prefix GTKMM_API)
32
33 /** Exception class for Gtk::IconTheme errors.
34 */
35 _WRAP_GERROR(IconThemeError,GtkIconThemeError,GTK_ICON_THEME_ERROR, decl_prefix GTKMM_API)
36
37 class GTKMM_API IconTheme : public Glib::Object
38 {
39 _CLASS_GOBJECT(IconTheme, GtkIconTheme, GTK_ICON_THEME, Glib::Object, GObject, , , GTKMM_API)
40 _IGNORE(gtk_icon_theme_set_search_path, gtk_icon_theme_get_search_path)
41
42 protected:
43 _CTOR_DEFAULT()
44 public:
45 _WRAP_CREATE()
46
47 _WRAP_METHOD(static Glib::RefPtr<IconTheme> get_default(), gtk_icon_theme_get_default, refreturn)
48 _WRAP_METHOD(static Glib::RefPtr<IconTheme> get_for_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_icon_theme_get_for_screen, refreturn)
49 _WRAP_METHOD(void set_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_icon_theme_set_screen)
50 void set_search_path(const std::vector<Glib::ustring>& path);
51 std::vector<Glib::ustring> get_search_path() const;
52 _WRAP_METHOD(void append_search_path(const Glib::ustring& path), gtk_icon_theme_append_search_path)
53 _WRAP_METHOD(void prepend_search_path(const Glib::ustring& path), gtk_icon_theme_prepend_search_path)
54
55 _WRAP_METHOD(void add_resource_path(const std::string& path), gtk_icon_theme_add_resource_path)
56
57 _WRAP_METHOD(void set_custom_theme(const Glib::ustring& theme_name), gtk_icon_theme_set_custom_theme)
58 _WRAP_METHOD(bool has_icon(const Glib::ustring& icon_name) const, gtk_icon_theme_has_icon)
59
60 std::vector<int> get_icon_sizes(const Glib::ustring& icon_name) const;
61 _IGNORE(gtk_icon_theme_get_icon_sizes)
62
63 _WRAP_METHOD(IconInfo lookup_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_icon)
64 _WRAP_METHOD(IconInfo lookup_icon(const Glib::ustring& icon_name, int size, int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_icon_for_scale)
65 _WRAP_METHOD(IconInfo lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon)
66 _WRAP_METHOD(IconInfo lookup_icon(const Glib::RefPtr<const Gio::Icon>& icon, int size, int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon_for_scale)
67
68 #m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar*[]',`const_cast<const gchar**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data ())')
69 _WRAP_METHOD(IconInfo choose_icon(const std::vector<Glib::ustring>& icon_names, int size, IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_choose_icon)
70 _WRAP_METHOD(IconInfo choose_icon(const std::vector<Glib::ustring>& icon_names, int size, int scale, IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_choose_icon_for_scale)
71
72 _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
73 _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, int scale, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon_for_scale, errthrow)
74
75 #m4 _CONVERSION(`cairo_surface_t*',`::Cairo::RefPtr< ::Cairo::Surface>',`::Cairo::RefPtr< ::Cairo::Surface>(new Cairo::Surface($3, true /* do not take reference */))')
76 _WRAP_METHOD(::Cairo::RefPtr< ::Cairo::Surface> load_surface(const Glib::ustring& icon_name, int size, int scale, const Glib::RefPtr<Gdk::Window>& for_window, IconLookupFlags flags = (IconLookupFlags)0), gtk_icon_theme_load_surface, errthrow)
77
78 #m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandler<Glib::ustring>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
79 _WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context) const, gtk_icon_theme_list_icons)
80
81 /** Lists the icons in the current icon theme.
82 *
83 * @return A list holding the names of all the
84 * icons in the theme.
85 *
86 * @newin{2,10}
87 */
88 std::vector<Glib::ustring> list_icons() const;
89
90 _WRAP_METHOD(std::vector<Glib::ustring> list_contexts() const, gtk_icon_theme_list_contexts)
91
92 _WRAP_METHOD(Glib::ustring get_example_icon_name() const, gtk_icon_theme_get_example_icon_name)
93 _WRAP_METHOD(bool rescan_if_needed(), gtk_icon_theme_rescan_if_needed)
94 _WRAP_METHOD(static void add_builtin_icon(const Glib::ustring& icon_name, int size, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_icon_theme_add_builtin_icon, deprecated "Use add_resource_path() to add application-specific icons to the icon theme.")
95
96 _WRAP_SIGNAL(void changed(), "changed")
97 };
98
99 } // namespace Gtk