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