mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 15:01:23 +00:00
icon: Add _set_image
This commit is contained in:
parent
7c77fd9e62
commit
8b1b0f4efd
@ -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;
|
||||
}
|
||||
|
@ -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__ */
|
||||
|
Loading…
Reference in New Issue
Block a user