diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2010-03-07 19:57:53 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2010-12-04 15:36:50 +0100 |
commit | 28b7782d7801bded393094052b61fa62a20c4d2b (patch) | |
tree | 5eab794f164e9c9ab8c7ced24941ddb38d51d943 | |
parent | 16484f845901137a7102833128fb02e10acbbde6 (diff) | |
download | gtk+-28b7782d7801bded393094052b61fa62a20c4d2b.tar.gz |
GtkStyleSet: Add method to register border property.
-rw-r--r-- | gtk/gtkstyleset.c | 20 | ||||
-rw-r--r-- | gtk/gtkstyleset.h | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gtk/gtkstyleset.c b/gtk/gtkstyleset.c index 6ac544294d..c26eb3cdbd 100644 --- a/gtk/gtkstyleset.c +++ b/gtk/gtkstyleset.c @@ -69,6 +69,7 @@ gtk_style_set_class_init (GtkStyleSetClass *klass) GdkColor black = { 0, 0, 0, 0 }; GdkColor white = { 0, 65535, 65535, 65535 }; PangoFontDescription *font_desc; + GtkBorder padding = { 0 }; object_class->finalize = gtk_style_set_finalize; @@ -82,6 +83,8 @@ gtk_style_set_class_init (GtkStyleSetClass *klass) gtk_style_set_register_property_font ("font", font_desc); pango_font_description_free (font_desc); + gtk_style_set_register_property_border ("padding", &padding); + g_type_class_add_private (object_class, sizeof (GtkStyleSetPrivate)); } @@ -250,6 +253,23 @@ gtk_style_set_register_property_font (const gchar *property_name, } void +gtk_style_set_register_property_border (const gchar *property_name, + GtkBorder *initial_value) +{ + GValue value = { 0 }; + + g_return_if_fail (property_name != NULL); + g_return_if_fail (initial_value != NULL); + + g_value_init (&value, GTK_TYPE_BORDER); + g_value_set_boxed (&value, initial_value); + + gtk_style_set_register_property (property_name, GTK_TYPE_BORDER, &value); + + g_value_unset (&value); +} + +void gtk_style_set_register_property_int (const gchar *property_name, gint initial_value) { diff --git a/gtk/gtkstyleset.h b/gtk/gtkstyleset.h index 986fdb0dbd..ff1b859a60 100644 --- a/gtk/gtkstyleset.h +++ b/gtk/gtkstyleset.h @@ -24,6 +24,9 @@ #include <gdk/gdk.h> #include "gtkenums.h" +/* GtkBorder is defined there */ +#include "gtkstyle.h" + G_BEGIN_DECLS #define GTK_TYPE_STYLE_SET (gtk_style_set_get_type ()) @@ -57,6 +60,8 @@ void gtk_style_set_register_property_color (const gchar *property_name, GdkColor *default_value); void gtk_style_set_register_property_font (const gchar *property_name, PangoFontDescription *initial_value); +void gtk_style_set_register_property_border (const gchar *property_name, + GtkBorder *initial_value); void gtk_style_set_register_property_int (const gchar *property_name, gint default_value); void gtk_style_set_register_property_uint (const gchar *property_name, |