diff options
Diffstat (limited to 'base/gfx/gtk_util.cc')
-rwxr-xr-x | base/gfx/gtk_util.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/base/gfx/gtk_util.cc b/base/gfx/gtk_util.cc index e12bb6e..0808193 100755 --- a/base/gfx/gtk_util.cc +++ b/base/gfx/gtk_util.cc @@ -5,6 +5,7 @@ #include "base/gfx/gtk_util.h" #include <gdk/gdk.h> +#include <gtk/gtk.h> #include "base/gfx/rect.h" #include "skia/include/SkBitmap.h" @@ -60,4 +61,18 @@ GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap) { return pixbuf; } +GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, + int top, int bottom, int left, int right) { + // Use a GtkEventBox to get the background painted. However, we can't just + // use a container border, since it won't paint there. Use an alignment + // inside to get the sizes exactly of how we want the border painted. + GtkWidget* ebox = gtk_event_box_new(); + gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, color); + GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1); + gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right); + gtk_container_add(GTK_CONTAINER(alignment), child); + gtk_container_add(GTK_CONTAINER(ebox), alignment); + return ebox; +} + } // namespace gfx |