add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / iconinfo.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ICONINFO_H
4 #define _GTKMM_ICONINFO_H
5
6
7 #include <glibmm.h>
8
9 /* Copyright (C) 2003 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <gdkmm/rectangle.h>
27 #include <gdkmm/pixbuf.h>
28 #include <gdkmm/types.h>
29
30 //#include <gtk/gtkicontheme.h>
31  
32
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 extern "C" { typedef struct _GtkIconInfo GtkIconInfo; }
35 #endif
36
37 namespace Gtk
38 {
39
40 class IconInfo
41 {
42   public:
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44   typedef IconInfo CppObjectType;
45   typedef GtkIconInfo BaseObjectType;
46
47   static GType get_type() G_GNUC_CONST;
48 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
49
50   IconInfo();
51
52   explicit IconInfo(GtkIconInfo* gobject, bool make_a_copy = true);
53
54   IconInfo(const IconInfo& other);
55   IconInfo& operator=(const IconInfo& other);
56
57   ~IconInfo();
58
59   void swap(IconInfo& other);
60
61   ///Provides access to the underlying C instance.
62   GtkIconInfo*       gobj()       { return gobject_; }
63
64   ///Provides access to the underlying C instance.
65   const GtkIconInfo* gobj() const { return gobject_; }
66
67   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
68   GtkIconInfo* gobj_copy() const;
69
70 protected:
71   GtkIconInfo* gobject_;
72
73 private:
74
75   
76 public:
77
78   ///Tests whether the IconInfo is valid.
79   operator bool();
80
81   
82   /** Gets the base size for the icon. The base size
83    * is a size for the icon that was specified by
84    * the icon theme creator. This may be different
85    * than the actual size of image; an example of
86    * this is small emblem icons that can be attached
87    * to a larger icon. These icons will be given
88    * the same base size as the larger icons to which
89    * they are attached.
90    * @return The base size, or 0, if no base
91    * size is known for the icon.
92    * 
93    * @newin2p4.
94    */
95   int get_base_size() const;
96   
97   /** Gets the filename for the icon. If the
98    * Gtk::ICON_LOOKUP_USE_BUILTIN flag was passed
99    * to Gtk::IconTheme::lookup_icon(), there may be
100    * no filename if a builtin icon is returned; in this
101    * case, you should use gtk_icon_info_get_builtin_pixbuf().
102    * @return The filename for the icon, or <tt>0</tt>
103    * if gtk_icon_info_get_builtin_pixbuf() should
104    * be used instead.
105    */
106   Glib::ustring get_filename() const;
107   
108   /** Gets the built-in image for this icon, if any. To allow
109    * GTK+ to use built in icon images, you must pass the
110    * Gtk::ICON_LOOKUP_USE_BUILTIN to
111    * Gtk::IconTheme::lookup_icon().
112    * @return The built-in image pixbuf, or <tt>0</tt>.
113    * The returned image must not be modified.
114    */
115   Glib::RefPtr<Gdk::Pixbuf> get_builtin_pixbuf();
116   
117   /** Gets the built-in image for this icon, if any. To allow
118    * GTK+ to use built in icon images, you must pass the
119    * Gtk::ICON_LOOKUP_USE_BUILTIN to
120    * Gtk::IconTheme::lookup_icon().
121    * @return The built-in image pixbuf, or <tt>0</tt>.
122    * The returned image must not be modified.
123    */
124   Glib::RefPtr<const Gdk::Pixbuf> get_builtin_pixbuf() const;
125   
126   /** Renders an icon previously looked up in an icon theme using
127    * Gtk::IconTheme::lookup_icon(); the size will be based on the size
128    * passed to Gtk::IconTheme::lookup_icon(). Note that the resulting
129    * pixbuf may not be exactly this size; an icon theme may have icons
130    * that differ slightly from their nominal sizes, and in addition GTK+
131    * will avoid scaling icons that it considers sufficiently close to the
132    * requested size or for which the source image would have to be scaled
133    * up too far. (This maintains sharpness.)
134    * @param error Location to store error information on failure, or <tt>0</tt>.
135    * @return The rendered icon; this may be a newly created icon
136    * or a new reference to an internal icon, so you must not modify
137    * the icon. Use Glib::object_unref() to release your reference to the
138    * icon.
139    * 
140    * @newin2p4.
141    */
142 #ifdef GLIBMM_EXCEPTIONS_ENABLED
143   Glib::RefPtr<Gdk::Pixbuf> load_icon() const;
144 #else
145   Glib::RefPtr<Gdk::Pixbuf> load_icon(std::auto_ptr<Glib::Error>& error) const;
146 #endif //GLIBMM_EXCEPTIONS_ENABLED
147
148   
149   /** Sets whether the coordinates returned by gtk_icon_info_get_embedded_rect()
150    * and gtk_icon_info_get_attach_points() should be returned in their
151    * original form as specified in the icon theme, instead of scaled
152    * appropriately for the pixbuf returned by gtk_icon_info_load_icon().
153    * 
154    * Raw coordinates are somewhat strange; they are specified to be with
155    * respect to the unscaled pixmap for PNG and XPM icons, but for SVG
156    * icons, they are in a 1000x1000 coordinate space that is scaled
157    * to the final size of the icon.  You can determine if the icon is an SVG
158    * icon by using gtk_icon_info_get_filename(), and seeing if it is non-<tt>0</tt>
159    * and ends in '.svg'.
160    * 
161    * This function is provided primarily to allow compatibility wrappers
162    * for older API's, and is not expected to be useful for applications.
163    * 
164    * @newin2p4
165    * @param raw_coordinates Whether the coordinates of embedded rectangles
166    * and attached points should be returned in their original
167    * (unscaled) form.
168    */
169   void set_raw_coordinates(bool raw_coordinates = true);
170   
171   /** Gets the coordinates of a rectangle within the icon
172    * that can be used for display of information such
173    * as a preview of the contents of a text file.
174    * See gtk_icon_info_set_raw_coordinates() for further
175    * information about the coordinate system.
176    * @param rectangle Gdk::Rectangle in which to store embedded
177    * rectangle coordinates; coordinates are only stored
178    * when this function returns <tt>true</tt>.
179    * @return <tt>true</tt> if the icon has an embedded rectangle
180    * 
181    * @newin2p4.
182    */
183   bool get_embedded_rect(Gdk::Rectangle& rectangle) const;
184   bool get_attach_points(Glib::ArrayHandle<Gdk::Point>& points) const;
185   
186   /** Gets the display name for an icon. A display name is a
187    * string to be used in place of the icon name in a user
188    * visible context like a list of icons.
189    * @return The display name for the icon or <tt>0</tt>, if
190    * the icon doesn't have a specified display name. This value
191    * is owned @a icon_info  and must not be modified or free.
192    * 
193    * @newin2p4.
194    */
195   Glib::ustring get_display_name() const;
196
197
198 };
199
200 } // namespace Gtk
201
202
203 namespace Gtk
204 {
205
206 /** @relates Gtk::IconInfo
207  * @param lhs The left-hand side
208  * @param rhs The right-hand side
209  */
210 inline void swap(IconInfo& lhs, IconInfo& rhs)
211   { lhs.swap(rhs); }
212
213 } // namespace Gtk
214
215 namespace Glib
216 {
217
218 /** A Glib::wrap() method for this object.
219  * 
220  * @param object The C instance.
221  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
222  * @result A C++ instance that wraps this C instance.
223  *
224  * @relates Gtk::IconInfo
225  */
226 Gtk::IconInfo wrap(GtkIconInfo* object, bool take_copy = false);
227
228 #ifndef DOXYGEN_SHOULD_SKIP_THIS
229 template <>
230 class Value<Gtk::IconInfo> : public Glib::Value_Boxed<Gtk::IconInfo>
231 {};
232 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
233
234 } // namespace Glib
235
236
237 #endif /* _GTKMM_ICONINFO_H */
238