borderimage: Add _gtk_border_image_new_for_context()

and use it.
This commit is contained in:
Benjamin Otte 2012-01-04 04:00:58 +01:00
parent cee05fbeb8
commit 84bc280440
3 changed files with 19 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "gtkborderimageprivate.h"
#include "gtkstylepropertiesprivate.h"
#include "gtkthemingengineprivate.h"
/* this is in case round() is not provided by the compiler,
* such as in the case of C89 compilers, like MSVC
@ -72,6 +73,21 @@ _gtk_border_image_new (GtkCssImage *source,
return image;
}
GtkBorderImage *
_gtk_border_image_new_for_engine (GtkThemingEngine *engine)
{
GtkCssImage *source;
source = g_value_get_object (_gtk_theming_engine_peek_property (engine, "border-image-source"));
if (source == NULL)
return NULL;
return _gtk_border_image_new (source,
g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-slice")),
g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-width")),
g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-repeat")));
}
GtkBorderImage *
_gtk_border_image_ref (GtkBorderImage *image)
{

View File

@ -43,6 +43,7 @@ GtkBorderImage * _gtk_border_image_new (GtkCssImage *sour
GtkBorder *slice,
GtkBorder *width,
GtkCssBorderImageRepeat *repeat);
GtkBorderImage * _gtk_border_image_new_for_engine (GtkThemingEngine *engine);
GtkBorderImage * _gtk_border_image_ref (GtkBorderImage *image);
void _gtk_border_image_unref (GtkBorderImage *image);

View File

@ -1552,8 +1552,8 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
junction = gtk_theming_engine_get_junction_sides (engine);
gtk_theming_engine_get_border (engine, flags, &border);
border_image = _gtk_border_image_new_for_engine (engine);
gtk_theming_engine_get (engine, flags,
"border-image", &border_image,
"border-style", &border_style,
NULL);
@ -1920,8 +1920,8 @@ gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine,
junction = gtk_theming_engine_get_junction_sides (engine);
gtk_theming_engine_get_border (engine, state, &border);
border_image = _gtk_border_image_new_for_engine (engine);
gtk_theming_engine_get (engine, state,
"border-image", &border_image,
"border-top-left-radius", &top_left_radius,
"border-top-right-radius", &top_right_radius,
"border-bottom-right-radius", &bottom_right_radius,