1 // Generated by gtkmmproc -- DO NOT MODIFY!
5 #include <gtkmm/private/rc_p.h>
7 #include <gtk/gtktypebuiltins.h>
11 /* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
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>
38 void RcStyle::set_name(const Glib::ustring& name)
40 const Glib::ScopedPtr<char> old_name (gobj()->name);
41 gobj()->name = g_strdup(name.c_str());
44 void RcStyle::set_bg_pixmap_name(StateType state, const Glib::ustring& name)
46 const Glib::ScopedPtr<char> old_name (gobj()->bg_pixmap_name[state]);
47 gobj()->bg_pixmap_name[state] = g_strdup(name.c_str());
50 Glib::ustring RcStyle::get_bg_pixmap_name(StateType state) const
52 if(const char *const name = gobj()->bg_pixmap_name[state])
53 return Glib::ustring(name);
55 return Glib::ustring();
58 void RcStyle::set_font(const Pango::FontDescription& font_desc)
60 g_return_if_fail(font_desc.gobj() != 0);
62 const Pango::FontDescription old_font_desc (gobj()->font_desc, false);
63 gobj()->font_desc = font_desc.gobj_copy();
66 Pango::FontDescription RcStyle::get_font() const
68 return Pango::FontDescription(gobj()->font_desc, true);
71 void RcStyle::set_color_flags(StateType state, RcFlags flags)
73 gobj()->color_flags[state] = static_cast<GtkRcFlags>(gobj()->color_flags[state] | flags);
76 void RcStyle::unset_color_flags(StateType state, RcFlags flags)
78 gobj()->color_flags[state] = static_cast<GtkRcFlags>(gobj()->color_flags[state] & ~flags);
81 RcFlags RcStyle::get_color_flags(StateType state) const
83 return static_cast<RcFlags>(unsigned(gobj()->color_flags[state]));
86 void RcStyle::set_xthickness(int xthickness)
88 gobj()->xthickness = xthickness;
91 void RcStyle::set_ythickness(int ythickness)
93 gobj()->ythickness = ythickness;
97 RC::RC(const Glib::ustring& filename)
100 gtk_rc_parse(filename.c_str());
104 RC::get_style(const Widget &widget)
106 return Glib::wrap(gtk_rc_get_style(const_cast<GtkWidget*>(widget.gobj())));
110 RC::parse_string(const Glib::ustring& rc_string)
112 gtk_rc_parse_string(const_cast<char*>(rc_string.c_str()));
117 RC::add_default_file(const Glib::ustring& filename)
119 gtk_rc_add_default_file(const_cast<char*>(filename.c_str()));
123 RC::set_default_files(const Glib::ArrayHandle<Glib::ustring>& filenames)
125 gtk_rc_set_default_files(const_cast<char**>(filenames.data()));
128 Glib::ArrayHandle<Glib::ustring>
129 RC::get_default_files()
131 return Glib::ArrayHandle<Glib::ustring>(
132 const_cast<const char**>(gtk_rc_get_default_files()), Glib::OWNERSHIP_NONE);
135 bool RC::reparse_all()
137 return gtk_rc_reparse_all();
140 bool RC::reparse_all(const Glib::RefPtr<Settings>& settings, bool force_load)
142 return gtk_rc_reparse_all_for_settings(settings->gobj(), force_load);
145 void RC::reset_styles(const Glib::RefPtr<Settings>& settings)
147 gtk_rc_reset_styles(settings->gobj());
151 RC::find_pixmap_in_path(const Glib::RefPtr<Settings>& context, GScanner *scanner, const Glib::ustring& pixmap_file)
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())));
158 RC::find_pixmap_in_path(const Glib::RefPtr<Settings>& context, const Glib::ustring& pixmap_file)
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())));
165 RC::find_module_in_path(const Glib::ustring& module_file)
167 return Glib::convert_return_gchar_ptr_to_ustring(
168 gtk_rc_find_module_in_path(const_cast<char*>(module_file.c_str())));
174 return Glib::convert_return_gchar_ptr_to_ustring(gtk_rc_get_theme_dir());
180 return Glib::convert_return_gchar_ptr_to_ustring(gtk_rc_get_module_dir());
188 } // anonymous namespace
191 GType Glib::Value<Gtk::RcFlags>::value_type()
193 return gtk_rc_flags_get_type();
200 Glib::RefPtr<Gtk::RcStyle> wrap(GtkRcStyle* object, bool take_copy)
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.
206 } /* namespace Glib */
213 /* The *_Class implementation: */
215 const Glib::Class& RcStyle_Class::init()
217 if(!gtype_) // create the GType if necessary
219 // Glib::Class has to know the class init function to clone custom types.
220 class_init_func_ = &RcStyle_Class::class_init_function;
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();
226 // Create the wrapper type, with the same class/instance size as the base type.
227 register_derived_type(gtk_rc_style_get_type());
229 // Add derived versions of interfaces, if the C type implements any interfaces:
235 void RcStyle_Class::class_init_function(void* g_class, void* class_data)
237 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
238 CppClassParent::class_init_function(klass, class_data);
240 #ifdef GLIBMM_VFUNCS_ENABLED
241 #endif //GLIBMM_VFUNCS_ENABLED
243 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
244 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
247 #ifdef GLIBMM_VFUNCS_ENABLED
248 #endif //GLIBMM_VFUNCS_ENABLED
250 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
251 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
254 Glib::ObjectBase* RcStyle_Class::wrap_new(GObject* object)
256 return new RcStyle((GtkRcStyle*)object);
260 /* The implementation: */
262 GtkRcStyle* RcStyle::gobj_copy()
268 RcStyle::RcStyle(const Glib::ConstructParams& construct_params)
270 Glib::Object(construct_params)
273 RcStyle::RcStyle(GtkRcStyle* castitem)
275 Glib::Object((GObject*)(castitem))
282 RcStyle::CppClassType RcStyle::rcstyle_class_; // initialize static member
284 GType RcStyle::get_type()
286 return rcstyle_class_.init().get_type();
289 GType RcStyle::get_base_type()
291 return gtk_rc_style_get_type();
297 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
299 Glib::Object(Glib::ConstructParams(rcstyle_class_.init()))
303 Glib::RefPtr<RcStyle> RcStyle::create()
305 return Glib::RefPtr<RcStyle>( new RcStyle() );
307 Glib::RefPtr<RcStyle> RcStyle::copy() const
309 return Glib::wrap(gtk_rc_style_copy(const_cast<GtkRcStyle*>(gobj())));
312 Glib::ustring RcStyle::get_name() const
314 return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name);
317 void RcStyle::set_fg(StateType state, const Gdk::Color& color)
319 gobj()->fg[state] = *color.gobj();
322 Gdk::Color RcStyle::get_fg(StateType state) const
324 return Gdk::Color(const_cast<GdkColor*>(&gobj()->fg[state]), true);
327 void RcStyle::set_bg(StateType state, const Gdk::Color& color)
329 gobj()->bg[state] = *color.gobj();
332 Gdk::Color RcStyle::get_bg(StateType state) const
334 return Gdk::Color(const_cast<GdkColor*>(&gobj()->bg[state]), true);
337 void RcStyle::set_text(StateType state, const Gdk::Color& color)
339 gobj()->text[state] = *color.gobj();
342 Gdk::Color RcStyle::get_text(StateType state) const
344 return Gdk::Color(const_cast<GdkColor*>(&gobj()->text[state]), true);
347 void RcStyle::set_base(StateType state, const Gdk::Color& color)
349 gobj()->base[state] = *color.gobj();
352 Gdk::Color RcStyle::get_base(StateType state) const
354 return Gdk::Color(const_cast<GdkColor*>(&gobj()->base[state]), true);
357 int RcStyle::get_xthickness() const
359 return gobj()->xthickness;
362 int RcStyle::get_ythickness() const
364 return gobj()->ythickness;
368 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
369 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
371 #ifdef GLIBMM_VFUNCS_ENABLED
372 #endif //GLIBMM_VFUNCS_ENABLED