[gtk+/wip/baedert/drawing: 154/348] icon: Add _set_image
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/drawing: 154/348] icon: Add _set_image
- Date: Sat, 8 Jul 2017 10:43:45 +0000 (UTC)
commit e82bfc57c30318e1b0f0ff28b653e868fa9816e5
Author: Timm Bäder <mail baedert org>
Date: Thu May 11 07:48:00 2017 +0200
icon: Add _set_image
gtk/gtkicon.c | 11 ++++++++++-
gtk/gtkiconprivate.h | 7 ++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c
index 691f7ad..7b5327a 100644
--- a/gtk/gtkicon.c
+++ b/gtk/gtkicon.c
@@ -44,6 +44,7 @@ static void
gtk_icon_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
+ GtkIcon *self = GTK_ICON (widget);
GtkCssStyle *style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
GtkAllocation alloc;
@@ -52,7 +53,7 @@ gtk_icon_snapshot (GtkWidget *widget,
gtk_css_style_snapshot_icon (style,
snapshot,
alloc.width, alloc.height,
- GTK_CSS_IMAGE_BUILTIN_NONE);
+ self->image);
}
static void
@@ -68,6 +69,7 @@ static void
gtk_icon_init (GtkIcon *self)
{
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
+ self->image = GTK_CSS_IMAGE_BUILTIN_NONE;
}
GtkWidget *
@@ -77,3 +79,10 @@ gtk_icon_new (const char *css_name)
"css-name", css_name,
NULL);
}
+
+void
+gtk_icon_set_image (GtkIcon *self,
+ GtkCssImageBuiltinType image)
+{
+ self->image = image;
+}
diff --git a/gtk/gtkiconprivate.h b/gtk/gtkiconprivate.h
index 81ae9a2..dcbb6d7 100644
--- a/gtk/gtkiconprivate.h
+++ b/gtk/gtkiconprivate.h
@@ -20,7 +20,8 @@
#ifndef __GTK_ICON_PRIVATE_H__
#define __GTK_ICON_PRIVATE_H__
-#include "gtk/gtkwidget.h"
+#include "gtkwidget.h"
+#include "gtkcsstypesprivate.h"
G_BEGIN_DECLS
@@ -37,6 +38,7 @@ typedef struct _GtkIconClass GtkIconClass;
struct _GtkIcon
{
GtkWidget parent;
+ GtkCssImageBuiltinType image;
};
struct _GtkIconClass
@@ -48,6 +50,9 @@ GType gtk_icon_get_type (void) G_GNUC_CONST;
GtkWidget * gtk_icon_new (const char *css_name);
+void gtk_icon_set_image (GtkIcon *self,
+ GtkCssImageBuiltinType image);
+
G_END_DECLS
#endif /* __GTK_ICON_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]