add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / iconsource.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_ICONSOURCE_H
4 #define _GTKMM_ICONSOURCE_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* iconsource.h
12  *
13  * Copyright(C) 1998-2002 The gtkmm Development Team
14  *
15  * This library is free software, ) you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation, ) either
18  * version 2 of the License, or(at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY, ) without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library, ) if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 #include <gdkmm/pixbuf.h>
31 #include <gtkmm/enums.h>
32
33
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 extern "C" { typedef struct _GtkIconSource GtkIconSource; }
36 #endif
37
38 namespace Gtk
39 {
40
41 class IconSource
42 {
43   public:
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45   typedef IconSource CppObjectType;
46   typedef GtkIconSource BaseObjectType;
47
48   static GType get_type() G_GNUC_CONST;
49 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
50
51   IconSource();
52
53   explicit IconSource(GtkIconSource* gobject, bool make_a_copy = true);
54
55   IconSource(const IconSource& other);
56   IconSource& operator=(const IconSource& other);
57
58   ~IconSource();
59
60   void swap(IconSource& other);
61
62   ///Provides access to the underlying C instance.
63   GtkIconSource*       gobj()       { return gobject_; }
64
65   ///Provides access to the underlying C instance.
66   const GtkIconSource* gobj() const { return gobject_; }
67
68   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
69   GtkIconSource* gobj_copy() const;
70
71 protected:
72   GtkIconSource* gobject_;
73
74 private:
75
76   
77 public:
78
79   
80   /** Sets the name of an image file to use as a base image when creating
81    * icon variants for Gtk::IconSet. The filename must be absolute.
82    * @param filename Image file to use.
83    */
84   void set_filename(const Glib::ustring& filename);
85   
86   /** Sets a pixbuf to use as a base image when creating icon variants
87    * for Gtk::IconSet.
88    * @param pixbuf Pixbuf to use as a source.
89    */
90   void set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>&pixbuf);
91
92   
93   /** Retrieves the source filename, or <tt>0</tt> if none is set. The
94    * filename is not a copy, and should not be modified or expected to
95    * persist beyond the lifetime of the icon source.
96    * @return Image filename. This string must not be modified
97    * or freed.
98    */
99   Glib::ustring get_filename() const;
100   
101   /** Retrieves the source pixbuf, or <tt>0</tt> if none is set.
102    * In addition, if a filename source is in use, this
103    * function in some cases will return the pixbuf from
104    * loaded from the filename. This is, for example, true
105    * for the GtkIconSource passed to the GtkStyle::render_icon()
106    * virtual function. The reference count on the pixbuf is
107    * not incremented.
108    * @return Source pixbuf.
109    */
110   Glib::RefPtr<Gdk::Pixbuf> get_pixbuf();
111   
112   /** Retrieves the source pixbuf, or <tt>0</tt> if none is set.
113    * In addition, if a filename source is in use, this
114    * function in some cases will return the pixbuf from
115    * loaded from the filename. This is, for example, true
116    * for the GtkIconSource passed to the GtkStyle::render_icon()
117    * virtual function. The reference count on the pixbuf is
118    * not incremented.
119    * @return Source pixbuf.
120    */
121   Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const;
122   
123   
124   /** If the text direction is wildcarded, this source can be used
125    * as the base image for an icon in any Gtk::TextDirection.
126    * If the text direction is not wildcarded, then the
127    * text direction the icon source applies to should be set
128    * with gtk_icon_source_set_direction(), and the icon source
129    * will only be used with that text direction.
130    * 
131    * Gtk::IconSet prefers non-wildcarded sources (exact matches) over
132    * wildcarded sources, and will use an exact match when possible.
133    * @param setting <tt>true</tt> to wildcard the text direction.
134    */
135   void set_direction_wildcarded(bool setting = true);
136   
137   /** If the widget state is wildcarded, this source can be used as the
138    * base image for an icon in any Gtk::StateType.  If the widget state
139    * is not wildcarded, then the state the source applies to should be
140    * set with gtk_icon_source_set_state() and the icon source will
141    * only be used with that specific state.
142    * 
143    * Gtk::IconSet prefers non-wildcarded sources (exact matches) over
144    * wildcarded sources, and will use an exact match when possible.
145    * 
146    * Gtk::IconSet will normally transform wildcarded source images to
147    * produce an appropriate icon for a given state, for example
148    * lightening an image on prelight, but will not modify source images
149    * that match exactly.
150    * @param setting <tt>true</tt> to wildcard the widget state.
151    */
152   void set_state_wildcarded(bool setting = true);
153   
154   /** If the icon size is wildcarded, this source can be used as the base
155    * image for an icon of any size.  If the size is not wildcarded, then
156    * the size the source applies to should be set with
157    * gtk_icon_source_set_size() and the icon source will only be used
158    * with that specific size.
159    * 
160    * Gtk::IconSet prefers non-wildcarded sources (exact matches) over
161    * wildcarded sources, and will use an exact match when possible.
162    * 
163    * Gtk::IconSet will normally scale wildcarded source images to produce
164    * an appropriate icon at a given size, but will not change the size
165    * of source images that match exactly.
166    * @param setting <tt>true</tt> to wildcard the widget state.
167    */
168   void set_size_wildcarded (bool setting = true);
169   
170   /** Gets the value set by gtk_icon_source_set_size_wildcarded().
171    * @return <tt>true</tt> if this icon source is a base for any icon size variant.
172    */
173   bool get_size_wildcarded() const;
174   
175   /** Gets the value set by gtk_icon_source_set_state_wildcarded().
176    * @return <tt>true</tt> if this icon source is a base for any widget state variant.
177    */
178   bool get_state_wildcarded() const;
179   
180   /** Gets the value set by gtk_icon_source_set_direction_wildcarded().
181    * @return <tt>true</tt> if this icon source is a base for any text direction variant.
182    */
183   bool get_direction_wildcarded() const;
184   
185   /** Sets the text direction this icon source is intended to be used
186    * with.
187    * 
188    * Setting the text direction on an icon source makes no difference
189    * if the text direction is wildcarded. Therefore, you should usually
190    * call gtk_icon_source_set_direction_wildcarded() to un-wildcard it
191    * in addition to calling this function.
192    * @param direction Text direction this source applies to.
193    */
194   void set_direction(TextDirection direction);
195   
196   /** Sets the widget state this icon source is intended to be used
197    * with.
198    * 
199    * Setting the widget state on an icon source makes no difference
200    * if the state is wildcarded. Therefore, you should usually
201    * call gtk_icon_source_set_state_wildcarded() to un-wildcard it
202    * in addition to calling this function.
203    * @param state Widget state this source applies to.
204    */
205   void set_state(Gtk::StateType state);
206   
207   /** Sets the icon size this icon source is intended to be used
208    * with.
209    * 
210    * Setting the icon size on an icon source makes no difference
211    * if the size is wildcarded. Therefore, you should usually
212    * call gtk_icon_source_set_size_wildcarded() to un-wildcard it
213    * in addition to calling this function.
214    * @param size Icon size this source applies to.
215    */
216   void set_size(IconSize size);
217   
218   /** Obtains the text direction this icon source applies to. The return
219    * value is only useful/meaningful if the text direction is <em>not</em> 
220    * wildcarded.
221    * @return Text direction this source matches.
222    */
223   TextDirection get_direction() const;
224   
225   /** Obtains the widget state this icon source applies to. The return
226    * value is only useful/meaningful if the widget state is <em>not</em>
227    * wildcarded.
228    * @return Widget state this source matches.
229    */
230   Gtk::StateType get_state() const;
231   
232   /** Obtains the icon size this source applies to. The return value
233    * is only useful/meaningful if the icon size is <em>not</em> wildcarded.
234    * @return Icon size this source matches.
235    */
236   IconSize get_size() const;
237
238   
239   /** Sets the name of an icon to look up in the current icon theme
240    * to use as a base image when creating icon variants for Gtk::IconSet.
241    * @param icon_name Name of icon to use.
242    */
243   void set_icon_name(const Glib::ustring& icon_name);
244   
245   /** Retrieves the source icon name, or <tt>0</tt> if none is set. The
246    * icon_name is not a copy, and should not be modified or expected to
247    * persist beyond the lifetime of the icon source.
248    * @return Icon name. This string must not be modified or freed.
249    */
250   Glib::ustring get_icon_name() const;
251
252
253 };
254
255 } /* namespace Gtk */
256
257
258 namespace Gtk
259 {
260
261 /** @relates Gtk::IconSource
262  * @param lhs The left-hand side
263  * @param rhs The right-hand side
264  */
265 inline void swap(IconSource& lhs, IconSource& rhs)
266   { lhs.swap(rhs); }
267
268 } // namespace Gtk
269
270 namespace Glib
271 {
272
273 /** A Glib::wrap() method for this object.
274  * 
275  * @param object The C instance.
276  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
277  * @result A C++ instance that wraps this C instance.
278  *
279  * @relates Gtk::IconSource
280  */
281 Gtk::IconSource wrap(GtkIconSource* object, bool take_copy = false);
282
283 #ifndef DOXYGEN_SHOULD_SKIP_THIS
284 template <>
285 class Value<Gtk::IconSource> : public Glib::Value_Boxed<Gtk::IconSource>
286 {};
287 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
288
289 } // namespace Glib
290
291
292 #endif /* _GTKMM_ICONSOURCE_H */
293