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