Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / rc.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/rc.h>
4 #include <gtkmm/private/rc_p.h>
5
6 #include <gtk/gtktypebuiltins.h>
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /* Copyright 1998-2002 The gtkmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Library General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with this library; if not, write to the Free
24  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  */
26
27 #include <glibmm/utility.h>
28 #include <gtkmm/settings.h>
29 #include <gtkmm/widget.h>
30 #include <gtkmm/style.h>
31 #include <gtk/gtkrc.h>
32
33
34 namespace Gtk
35 {
36
37 void RcStyle::set_name(const Glib::ustring& name)
38 {
39   const Glib::ScopedPtr<char> old_name (gobj()->name);
40   gobj()->name = g_strdup(name.c_str());
41 }
42
43 void RcStyle::set_bg_pixmap_name(StateType state, const Glib::ustring& name)
44 {
45   const Glib::ScopedPtr<char> old_name (gobj()->bg_pixmap_name[state]);
46   gobj()->bg_pixmap_name[state] = g_strdup(name.c_str());
47 }
48
49 Glib::ustring RcStyle::get_bg_pixmap_name(StateType state) const
50 {
51   if(const char *const name = gobj()->bg_pixmap_name[state])
52     return Glib::ustring(name);
53   else
54     return Glib::ustring();
55 }
56
57 void RcStyle::set_font(const Pango::FontDescription& font_desc)
58 {
59   g_return_if_fail(font_desc.gobj() != 0);
60
61   const Pango::FontDescription old_font_desc (gobj()->font_desc, false);
62   gobj()->font_desc = font_desc.gobj_copy();
63 }
64
65 Pango::FontDescription RcStyle::get_font() const
66 {
67   return Pango::FontDescription(gobj()->font_desc, true);
68 }
69
70 void RcStyle::set_color_flags(StateType state, RcFlags flags)
71 {
72   gobj()->color_flags[state] = static_cast<GtkRcFlags>(gobj()->color_flags[state] | flags);
73 }
74
75 void RcStyle::unset_color_flags(StateType state, RcFlags flags)
76 {
77   gobj()->color_flags[state] = static_cast<GtkRcFlags>(gobj()->color_flags[state] & ~flags);
78 }
79
80 RcFlags RcStyle::get_color_flags(StateType state) const
81 {
82   return static_cast<RcFlags>(unsigned(gobj()->color_flags[state]));
83 }
84
85 void RcStyle::set_xthickness(int xthickness)
86 {
87   gobj()->xthickness = xthickness;
88 }
89
90 void RcStyle::set_ythickness(int ythickness)
91 {
92   gobj()->ythickness = ythickness;
93 }
94
95
96 RC::RC(const Glib::ustring& filename)
97 {
98   //gtk_rc_init();
99   gtk_rc_parse(filename.c_str());
100 }
101
102 Glib::RefPtr<Style>
103 RC::get_style(const Widget &widget)
104 {
105   return Glib::wrap(gtk_rc_get_style(const_cast<GtkWidget*>(widget.gobj())));
106 }
107
108 void
109 RC::parse_string(const Glib::ustring& rc_string)
110 {
111   gtk_rc_parse_string(const_cast<char*>(rc_string.c_str()));
112 }
113
114
115 void
116 RC::add_default_file(const Glib::ustring& filename)
117 {
118   gtk_rc_add_default_file(const_cast<char*>(filename.c_str()));
119 }
120
121 void
122 RC::set_default_files(const Glib::ArrayHandle<Glib::ustring>& filenames)
123 {
124   gtk_rc_set_default_files(const_cast<char**>(filenames.data()));
125 }
126
127 Glib::ArrayHandle<Glib::ustring>
128 RC::get_default_files()
129 {
130   return Glib::ArrayHandle<Glib::ustring>(
131       const_cast<const char**>(gtk_rc_get_default_files()), Glib::OWNERSHIP_NONE);
132 }
133
134 bool RC::reparse_all()
135 {
136   return gtk_rc_reparse_all();
137 }
138
139 bool RC::reparse_all(const Glib::RefPtr<Settings>& settings, bool force_load)
140 {
141   return gtk_rc_reparse_all_for_settings(settings->gobj(), force_load);
142 }
143
144 void RC::reset_styles(const Glib::RefPtr<Settings>& settings)
145 {
146   gtk_rc_reset_styles(settings->gobj());        
147 }
148
149 Glib::ustring
150 RC::find_pixmap_in_path(const Glib::RefPtr<Settings>& context, GScanner *scanner, const Glib::ustring& pixmap_file)
151 {
152   return Glib::convert_return_gchar_ptr_to_ustring(
153       gtk_rc_find_pixmap_in_path(context->gobj(), scanner, const_cast<char*>(pixmap_file.c_str())));
154 }
155
156 Glib::ustring
157 RC::find_pixmap_in_path(const Glib::RefPtr<Settings>& context, const Glib::ustring& pixmap_file)
158 {
159   return Glib::convert_return_gchar_ptr_to_ustring(
160       gtk_rc_find_pixmap_in_path(context->gobj(), 0 /* see C docs */, const_cast<char*>(pixmap_file.c_str())));
161 }
162
163 Glib::ustring
164 RC::find_module_in_path(const Glib::ustring& module_file)
165 {
166   return Glib::convert_return_gchar_ptr_to_ustring(
167       gtk_rc_find_module_in_path(const_cast<char*>(module_file.c_str())));
168 }
169
170 Glib::ustring
171 RC::get_theme_dir()
172 {
173   return Glib::convert_return_gchar_ptr_to_ustring(gtk_rc_get_theme_dir());
174 }
175
176 Glib::ustring
177 RC::get_module_dir()
178 {
179   return Glib::convert_return_gchar_ptr_to_ustring(gtk_rc_get_module_dir());
180 }
181
182 }
183
184
185 namespace
186 {
187 } // anonymous namespace
188
189 // static
190 GType Glib::Value<Gtk::RcFlags>::value_type()
191 {
192   return gtk_rc_flags_get_type();
193 }
194
195
196 namespace Glib
197 {
198
199 Glib::RefPtr<Gtk::RcStyle> wrap(GtkRcStyle* object, bool take_copy)
200 {
201   return Glib::RefPtr<Gtk::RcStyle>( dynamic_cast<Gtk::RcStyle*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
202   //We use dynamic_cast<> in case of multiple inheritance.
203 }
204
205 } /* namespace Glib */
206
207
208 namespace Gtk
209 {
210
211
212 /* The *_Class implementation: */
213
214 const Glib::Class& RcStyle_Class::init()
215 {
216   if(!gtype_) // create the GType if necessary
217   {
218     // Glib::Class has to know the class init function to clone custom types.
219     class_init_func_ = &RcStyle_Class::class_init_function;
220
221     // This is actually just optimized away, apparently with no harm.
222     // Make sure that the parent type has been created.
223     //CppClassParent::CppObjectType::get_type();
224
225     // Create the wrapper type, with the same class/instance size as the base type.
226     register_derived_type(gtk_rc_style_get_type());
227
228     // Add derived versions of interfaces, if the C type implements any interfaces:
229   }
230
231   return *this;
232 }
233
234 void RcStyle_Class::class_init_function(void* g_class, void* class_data)
235 {
236   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
237   CppClassParent::class_init_function(klass, class_data);
238
239 }
240
241
242 Glib::ObjectBase* RcStyle_Class::wrap_new(GObject* object)
243 {
244   return new RcStyle((GtkRcStyle*)object);
245 }
246
247
248 /* The implementation: */
249
250 GtkRcStyle* RcStyle::gobj_copy()
251 {
252   reference();
253   return gobj();
254 }
255
256 RcStyle::RcStyle(const Glib::ConstructParams& construct_params)
257 :
258   Glib::Object(construct_params)
259 {}
260
261 RcStyle::RcStyle(GtkRcStyle* castitem)
262 :
263   Glib::Object((GObject*)(castitem))
264 {}
265
266 RcStyle::~RcStyle()
267 {}
268
269
270 RcStyle::CppClassType RcStyle::rcstyle_class_; // initialize static member
271
272 GType RcStyle::get_type()
273 {
274   return rcstyle_class_.init().get_type();
275 }
276
277 GType RcStyle::get_base_type()
278 {
279   return gtk_rc_style_get_type();
280 }
281
282
283 RcStyle::RcStyle()
284 :
285   Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
286   Glib::Object(Glib::ConstructParams(rcstyle_class_.init()))
287 {
288   }
289
290 Glib::RefPtr<RcStyle> RcStyle::create()
291 {
292   return Glib::RefPtr<RcStyle>( new RcStyle() );
293 }
294 Glib::RefPtr<RcStyle> RcStyle::copy() const
295 {
296   return Glib::wrap(gtk_rc_style_copy(const_cast<GtkRcStyle*>(gobj())));
297 }
298
299 Glib::ustring RcStyle::get_name() const
300 {
301   return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name);
302 }
303
304 void RcStyle::set_fg(StateType state, const Gdk::Color& color)
305 {
306   gobj()->fg[state] = *color.gobj();
307 }
308
309 Gdk::Color RcStyle::get_fg(StateType state) const
310 {
311   return Gdk::Color(const_cast<GdkColor*>(&gobj()->fg[state]), true);
312 }
313
314 void RcStyle::set_bg(StateType state, const Gdk::Color& color)
315 {
316   gobj()->bg[state] = *color.gobj();
317 }
318
319 Gdk::Color RcStyle::get_bg(StateType state) const
320 {
321   return Gdk::Color(const_cast<GdkColor*>(&gobj()->bg[state]), true);
322 }
323
324 void RcStyle::set_text(StateType state, const Gdk::Color& color)
325 {
326   gobj()->text[state] = *color.gobj();
327 }
328
329 Gdk::Color RcStyle::get_text(StateType state) const
330 {
331   return Gdk::Color(const_cast<GdkColor*>(&gobj()->text[state]), true);
332 }
333
334 void RcStyle::set_base(StateType state, const Gdk::Color& color)
335 {
336   gobj()->base[state] = *color.gobj();
337 }
338
339 Gdk::Color RcStyle::get_base(StateType state) const
340 {
341   return Gdk::Color(const_cast<GdkColor*>(&gobj()->base[state]), true);
342 }
343
344 int RcStyle::get_xthickness() const
345 {
346   return gobj()->xthickness;
347 }
348
349 int RcStyle::get_ythickness() const
350 {
351   return gobj()->ythickness;
352 }
353
354
355 } // namespace Gtk
356
357