1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <gtkmm/private/rc_p.h>
6 #include <gtk/gtktypebuiltins.h>
10 /* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
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>
37 void RcStyle::set_name(const Glib::ustring& name)
39 const Glib::ScopedPtr<char> old_name (gobj()->name);
40 gobj()->name = g_strdup(name.c_str());
43 void RcStyle::set_bg_pixmap_name(StateType state, const Glib::ustring& name)
45 const Glib::ScopedPtr<char> old_name (gobj()->bg_pixmap_name[state]);
46 gobj()->bg_pixmap_name[state] = g_strdup(name.c_str());
49 Glib::ustring RcStyle::get_bg_pixmap_name(StateType state) const
51 if(const char *const name = gobj()->bg_pixmap_name[state])
52 return Glib::ustring(name);
54 return Glib::ustring();
57 void RcStyle::set_font(const Pango::FontDescription& font_desc)
59 g_return_if_fail(font_desc.gobj() != 0);
61 const Pango::FontDescription old_font_desc (gobj()->font_desc, false);
62 gobj()->font_desc = font_desc.gobj_copy();
65 Pango::FontDescription RcStyle::get_font() const
67 return Pango::FontDescription(gobj()->font_desc, true);
70 void RcStyle::set_color_flags(StateType state, RcFlags flags)
72 gobj()->color_flags[state] = static_cast<GtkRcFlags>(gobj()->color_flags[state] | flags);
75 void RcStyle::unset_color_flags(StateType state, RcFlags flags)
77 gobj()->color_flags[state] = static_cast<GtkRcFlags>(gobj()->color_flags[state] & ~flags);
80 RcFlags RcStyle::get_color_flags(StateType state) const
82 return static_cast<RcFlags>(unsigned(gobj()->color_flags[state]));
85 void RcStyle::set_xthickness(int xthickness)
87 gobj()->xthickness = xthickness;
90 void RcStyle::set_ythickness(int ythickness)
92 gobj()->ythickness = ythickness;
96 RC::RC(const Glib::ustring& filename)
99 gtk_rc_parse(filename.c_str());
103 RC::get_style(const Widget &widget)
105 return Glib::wrap(gtk_rc_get_style(const_cast<GtkWidget*>(widget.gobj())));
109 RC::parse_string(const Glib::ustring& rc_string)
111 gtk_rc_parse_string(const_cast<char*>(rc_string.c_str()));
116 RC::add_default_file(const Glib::ustring& filename)
118 gtk_rc_add_default_file(const_cast<char*>(filename.c_str()));
122 RC::set_default_files(const Glib::ArrayHandle<Glib::ustring>& filenames)
124 gtk_rc_set_default_files(const_cast<char**>(filenames.data()));
127 Glib::ArrayHandle<Glib::ustring>
128 RC::get_default_files()
130 return Glib::ArrayHandle<Glib::ustring>(
131 const_cast<const char**>(gtk_rc_get_default_files()), Glib::OWNERSHIP_NONE);
134 bool RC::reparse_all()
136 return gtk_rc_reparse_all();
139 bool RC::reparse_all(const Glib::RefPtr<Settings>& settings, bool force_load)
141 return gtk_rc_reparse_all_for_settings(settings->gobj(), force_load);
144 void RC::reset_styles(const Glib::RefPtr<Settings>& settings)
146 gtk_rc_reset_styles(settings->gobj());
150 RC::find_pixmap_in_path(const Glib::RefPtr<Settings>& context, GScanner *scanner, const Glib::ustring& pixmap_file)
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())));
157 RC::find_pixmap_in_path(const Glib::RefPtr<Settings>& context, const Glib::ustring& pixmap_file)
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())));
164 RC::find_module_in_path(const Glib::ustring& module_file)
166 return Glib::convert_return_gchar_ptr_to_ustring(
167 gtk_rc_find_module_in_path(const_cast<char*>(module_file.c_str())));
173 return Glib::convert_return_gchar_ptr_to_ustring(gtk_rc_get_theme_dir());
179 return Glib::convert_return_gchar_ptr_to_ustring(gtk_rc_get_module_dir());
187 } // anonymous namespace
190 GType Glib::Value<Gtk::RcFlags>::value_type()
192 return gtk_rc_flags_get_type();
199 Glib::RefPtr<Gtk::RcStyle> wrap(GtkRcStyle* object, bool take_copy)
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.
205 } /* namespace Glib */
212 /* The *_Class implementation: */
214 const Glib::Class& RcStyle_Class::init()
216 if(!gtype_) // create the GType if necessary
218 // Glib::Class has to know the class init function to clone custom types.
219 class_init_func_ = &RcStyle_Class::class_init_function;
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();
225 // Create the wrapper type, with the same class/instance size as the base type.
226 register_derived_type(gtk_rc_style_get_type());
228 // Add derived versions of interfaces, if the C type implements any interfaces:
234 void RcStyle_Class::class_init_function(void* g_class, void* class_data)
236 BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
237 CppClassParent::class_init_function(klass, class_data);
242 Glib::ObjectBase* RcStyle_Class::wrap_new(GObject* object)
244 return new RcStyle((GtkRcStyle*)object);
248 /* The implementation: */
250 GtkRcStyle* RcStyle::gobj_copy()
256 RcStyle::RcStyle(const Glib::ConstructParams& construct_params)
258 Glib::Object(construct_params)
261 RcStyle::RcStyle(GtkRcStyle* castitem)
263 Glib::Object((GObject*)(castitem))
270 RcStyle::CppClassType RcStyle::rcstyle_class_; // initialize static member
272 GType RcStyle::get_type()
274 return rcstyle_class_.init().get_type();
277 GType RcStyle::get_base_type()
279 return gtk_rc_style_get_type();
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()))
290 Glib::RefPtr<RcStyle> RcStyle::create()
292 return Glib::RefPtr<RcStyle>( new RcStyle() );
294 Glib::RefPtr<RcStyle> RcStyle::copy() const
296 return Glib::wrap(gtk_rc_style_copy(const_cast<GtkRcStyle*>(gobj())));
299 Glib::ustring RcStyle::get_name() const
301 return Glib::convert_const_gchar_ptr_to_ustring(gobj()->name);
304 void RcStyle::set_fg(StateType state, const Gdk::Color& color)
306 gobj()->fg[state] = *color.gobj();
309 Gdk::Color RcStyle::get_fg(StateType state) const
311 return Gdk::Color(const_cast<GdkColor*>(&gobj()->fg[state]), true);
314 void RcStyle::set_bg(StateType state, const Gdk::Color& color)
316 gobj()->bg[state] = *color.gobj();
319 Gdk::Color RcStyle::get_bg(StateType state) const
321 return Gdk::Color(const_cast<GdkColor*>(&gobj()->bg[state]), true);
324 void RcStyle::set_text(StateType state, const Gdk::Color& color)
326 gobj()->text[state] = *color.gobj();
329 Gdk::Color RcStyle::get_text(StateType state) const
331 return Gdk::Color(const_cast<GdkColor*>(&gobj()->text[state]), true);
334 void RcStyle::set_base(StateType state, const Gdk::Color& color)
336 gobj()->base[state] = *color.gobj();
339 Gdk::Color RcStyle::get_base(StateType state) const
341 return Gdk::Color(const_cast<GdkColor*>(&gobj()->base[state]), true);
344 int RcStyle::get_xthickness() const
346 return gobj()->xthickness;
349 int RcStyle::get_ythickness() const
351 return gobj()->ythickness;