Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / iconset.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ICONSET_H
4 #define _GTKMM_ICONSET_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* iconset.h
11  *
12  * Copyright(C) 1998-2002 The gtkmm Development Team
13  *
14  * This library is free software, ) you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation, ) either
17  * version 2 of the License, or(at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY, ) without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library, ) if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 //#include <gtkmm/style.h>
30 #include <gdkmm/pixbuf.h>
31 #include <gtkmm/iconsource.h>
32 //#include <gtkmm/widget.h>
33 #include <gtkmm/stockid.h>
34 #include <glibmm/arrayhandle.h>
35
36
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 extern "C" { typedef struct _GtkIconSet GtkIconSet; }
39 #endif
40
41 namespace Gtk
42 {
43
44 class Style;
45 class Widget;
46
47 class IconSet
48 {
49   public:
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51   typedef IconSet CppObjectType;
52   typedef GtkIconSet BaseObjectType;
53
54   static GType get_type() G_GNUC_CONST;
55 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
56
57   IconSet();
58
59   explicit IconSet(GtkIconSet* gobject, bool make_a_copy = true);
60
61   IconSet(const IconSet& other);
62   IconSet& operator=(const IconSet& other);
63
64   ~IconSet();
65
66   void swap(IconSet& other);
67
68   ///Provides access to the underlying C instance.
69   GtkIconSet*       gobj()       { return gobject_; }
70
71   ///Provides access to the underlying C instance.
72   const GtkIconSet* gobj() const { return gobject_; }
73
74   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
75   GtkIconSet* gobj_copy() const;
76
77 protected:
78   GtkIconSet* gobject_;
79
80 private:
81
82   
83 public:
84   explicit IconSet(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
85
86   
87   /** Copies @a icon_set  by value.
88    * @return A new Gtk::IconSet identical to the first.
89    */
90   IconSet copy() const;
91
92   //Note that we use Gtk::StateType here instead of StateType, because there is an Atk::StateType too, and doxygen gets confused.
93   
94   /** Renders an icon using Gtk::Style::render_icon(). In most cases,
95    * Gtk::Widget::render_icon() is better, since it automatically provides
96    * most of the arguments from the current widget settings.  This
97    * function never returns <tt>0</tt>; if the icon can't be rendered
98    * (perhaps because an image file fails to load), a default "missing
99    * image" icon will be returned instead.
100    * @param style A Gtk::Style associated with @a widget , or <tt>0</tt>.
101    * @param direction Text direction.
102    * @param state Widget state.
103    * @param size Icon size. A size of (GtkIconSize)-1
104    * means render at the size of the source and don't scale.
105    * @param widget Widget that will display the icon, or <tt>0</tt>.
106    * The only use that is typically made of this
107    * is to determine the appropriate Gdk::Screen.
108    * @param detail Detail to pass to the theme engine, or <tt>0</tt>.
109    * Note that passing a detail of anything but <tt>0</tt>
110    * will disable caching.
111    * @return A Gdk::Pixbuf to be displayed.
112    */
113   Glib::RefPtr<Gdk::Pixbuf> render_icon(const Glib::RefPtr<Style>& style, TextDirection direction,
114                                           Gtk::StateType state, IconSize size,
115                                           Widget& widget, const Glib::ustring& detail);
116
117   
118   /** Icon sets have a list of Gtk::IconSource, which they use as base
119    * icons for rendering icons in different states and sizes. Icons are
120    * scaled, made to look insensitive, etc. in
121    * gtk_icon_set_render_icon(), but Gtk::IconSet needs base images to
122    * work with. The base images and when to use them are described by
123    * a Gtk::IconSource.
124    * 
125    * This function copies @a source , so you can reuse the same source immediately
126    * without affecting the icon set.
127    * 
128    * An example of when you'd use this function: a web browser's "Back
129    * to Previous Page" icon might point in a different direction in
130    * Hebrew and in English; it might look different when insensitive;
131    * and it might change size depending on toolbar mode (small/large
132    * icons). So a single icon set would contain all those variants of
133    * the icon, and you might add a separate source for each one.
134    * 
135    * You should nearly always add a "default" icon source with all
136    * fields wildcarded, which will be used as a fallback if no more
137    * specific source matches. Gtk::IconSet always prefers more specific
138    * icon sources to more generic icon sources. The order in which you
139    * add the sources to the icon set does not matter.
140    * 
141    * gtk_icon_set_new_from_pixbuf() creates a new icon set with a
142    * default icon source based on the given pixbuf.
143    * @param source A Gtk::IconSource.
144    */
145   void add_source(const IconSource& source);
146
147   Glib::ArrayHandle<IconSize> get_sizes() const;
148
149   static IconSet lookup_default(const Gtk::StockID& stock_id);
150
151
152 };
153
154 } /* namespace Gtk */
155
156
157 namespace Gtk
158 {
159
160 /** @relates Gtk::IconSet
161  * @param lhs The left-hand side
162  * @param rhs The right-hand side
163  */
164 inline void swap(IconSet& lhs, IconSet& rhs)
165   { lhs.swap(rhs); }
166
167 } // namespace Gtk
168
169 namespace Glib
170 {
171
172 /** @relates Gtk::IconSet
173  * @param object The C instance
174  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
175  * @result A C++ instance that wraps this C instance.
176  */
177 Gtk::IconSet wrap(GtkIconSet* object, bool take_copy = false);
178
179 #ifndef DOXYGEN_SHOULD_SKIP_THIS
180 template <>
181 class Value<Gtk::IconSet> : public Glib::Value_Boxed<Gtk::IconSet>
182 {};
183 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
184
185 } // namespace Glib
186
187 #endif /* _GTKMM_ICONSET_H */
188