diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2011-11-29 22:26:19 -0500 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2011-11-30 16:39:59 -0500 |
commit | b5d8d2c4a8cf2255cd16ba4e33365cc61c39a164 (patch) | |
tree | 7bb4ac8ac78cfd2ebfe5761e99ce8356cb4ba8a5 /gtk/gtkiconhelperprivate.h | |
parent | d462f86aad94a3c5fbd9377a6ea57f731f4d0c0b (diff) | |
download | gtk+-b5d8d2c4a8cf2255cd16ba4e33365cc61c39a164.tar.gz |
icon-helper: add GtkIconHelper private object
GtkIconHelper is a helper object to easily obtain a pixbuf from
different icon sources (e.g. a GIcon, an icon name, a stock id, ...).
Code is ported from GtkImage, which will be adapted in the next commit.
Diffstat (limited to 'gtk/gtkiconhelperprivate.h')
-rw-r--r-- | gtk/gtkiconhelperprivate.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/gtk/gtkiconhelperprivate.h b/gtk/gtkiconhelperprivate.h new file mode 100644 index 0000000000..ad2b5f2a54 --- /dev/null +++ b/gtk/gtkiconhelperprivate.h @@ -0,0 +1,131 @@ +/* GTK - The GIMP Toolkit + * Copyright (C) 2011 Red Hat, Inc. + * + * Authors: Cosimo Cecchi <cosimoc@gnome.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GTK_ICON_HELPER_H__ +#define __GTK_ICON_HELPER_H__ + +#include <glib-object.h> + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define GTK_TYPE_ICON_HELPER _gtk_icon_helper_get_type() + +#define GTK_ICON_HELPER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GTK_TYPE_ICON_HELPER, GtkIconHelper)) + +#define GTK_ICON_HELPER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + GTK_TYPE_ICON_HELPER, GtkIconHelperClass)) + +#define GTK_IS_ICON_HELPER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + GTK_TYPE_ICON_HELPER)) + +#define GTK_IS_ICON_HELPER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + GTK_TYPE_ICON_HELPER)) + +#define GTK_ICON_HELPER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + GTK_TYPE_ICON_HELPER, GtkIconHelperClass)) + +typedef struct _GtkIconHelper GtkIconHelper; +typedef struct _GtkIconHelperClass GtkIconHelperClass; +typedef struct _GtkIconHelperPrivate GtkIconHelperPrivate; + +struct _GtkIconHelper +{ + GObject parent; + + GtkIconHelperPrivate *priv; +}; + +struct _GtkIconHelperClass +{ + GObjectClass parent_class; +}; + +GType _gtk_icon_helper_get_type (void) G_GNUC_CONST; + +GtkIconHelper *_gtk_icon_helper_new (void); + +void _gtk_icon_helper_clear (GtkIconHelper *self); +void _gtk_icon_helper_invalidate (GtkIconHelper *self); + +gboolean _gtk_icon_helper_get_is_empty (GtkIconHelper *self); + +void _gtk_icon_helper_set_gicon (GtkIconHelper *self, + GIcon *gicon, + GtkIconSize icon_size); +void _gtk_icon_helper_set_pixbuf (GtkIconHelper *self, + GdkPixbuf *pixbuf); +void _gtk_icon_helper_set_animation (GtkIconHelper *self, + GdkPixbufAnimation *animation); +void _gtk_icon_helper_set_icon_set (GtkIconHelper *self, + GtkIconSet *icon_set, + GtkIconSize icon_size); + +void _gtk_icon_helper_set_icon_name (GtkIconHelper *self, + const gchar *icon_name, + GtkIconSize icon_size); +void _gtk_icon_helper_set_stock_id (GtkIconHelper *self, + const gchar *stock_id, + GtkIconSize icon_size); + +void _gtk_icon_helper_set_icon_size (GtkIconHelper *self, + GtkIconSize icon_size); +void _gtk_icon_helper_set_pixel_size (GtkIconHelper *self, + gint pixel_size); +void _gtk_icon_helper_set_use_fallback (GtkIconHelper *self, + gboolean use_fallback); + +GtkImageType _gtk_icon_helper_get_storage_type (GtkIconHelper *self); +GtkIconSize _gtk_icon_helper_get_icon_size (GtkIconHelper *self); +gint _gtk_icon_helper_get_pixel_size (GtkIconHelper *self); +gboolean _gtk_icon_helper_get_use_fallback (GtkIconHelper *self); + +GdkPixbuf *_gtk_icon_helper_peek_pixbuf (GtkIconHelper *self); +GIcon *_gtk_icon_helper_peek_gicon (GtkIconHelper *self); +GtkIconSet *_gtk_icon_helper_peek_icon_set (GtkIconHelper *self); +GdkPixbufAnimation *_gtk_icon_helper_peek_animation (GtkIconHelper *self); + +const gchar *_gtk_icon_helper_get_stock_id (GtkIconHelper *self); +const gchar *_gtk_icon_helper_get_icon_name (GtkIconHelper *self); + +GdkPixbuf *_gtk_icon_helper_ensure_pixbuf (GtkIconHelper *self, + GtkStyleContext *context); +void _gtk_icon_helper_get_size (GtkIconHelper *self, + GtkStyleContext *context, + gint *width_out, + gint *height_out); + +void _gtk_icon_helper_draw (GtkIconHelper *self, + GtkStyleContext *context, + cairo_t *cr, + gdouble x, + gdouble y); + +G_END_DECLS + +#endif /* __GTK_ICON_HELPER_H__ */ |