summaryrefslogtreecommitdiff
path: root/obrender/render.h
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-01-08 17:48:07 -0500
committerDana Jansens <danakj@orodu.net>2010-01-08 17:55:19 -0500
commit8c9fb63baaf7d6245cccc584359bf09359663bea (patch)
tree796abec056fdf426edbab93126e4a15b24b95e3e /obrender/render.h
parentfc120a75308855b738a42b1fde9d6e0d276f3bf9 (diff)
Rework the code provided by Kadlcik Libor for loading/showing icons in Openbox menus.
This changes how the imagecache works, you can load an image into it directly, or you can load it by name (then it will load it from a file on disk). NOTE: The name part is incomplete, as it needs to use the freedesktop.org icon spec to search for the right file. Also to resize it should look for another icon on disk with the same name but different size (icon themes).
Diffstat (limited to 'obrender/render.h')
-rw-r--r--obrender/render.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/obrender/render.h b/obrender/render.h
index 7aa9d698..64c2f6a1 100644
--- a/obrender/render.h
+++ b/obrender/render.h
@@ -230,9 +230,13 @@ struct _RrImagePic {
/* The sum of all the pixels. This is used to compare pictures if their
hashes match. */
gint sum;
+ /* The name of the image. This is used to determine
+ if the named image already is loaded. May be NULL if the image
+ was not loaded from disk. */
+ gchar *name;
};
-typedef void (*RrImageDestroyFunc)(RrImage *image);
+typedef void (*RrImageDestroyFunc)(RrImage *image, gpointer data);
/*! An RrImage is a sort of meta-image. It can contain multiple versions of
an image at different sizes, which may or may not be completely different
@@ -252,10 +256,11 @@ struct _RrImage {
RrImage. */
RrImagePic **resized;
gint n_resized;
-
+
/* This function (if not NULL) will be called just before destroying
RrImage. */
RrImageDestroyFunc destroy_func;
+ gpointer destroy_data;
};
/* these are the same on all endian machines because it seems to be dependant
@@ -343,12 +348,19 @@ void RrImageCacheUnref(RrImageCache *self);
/*! Finds an image in the cache, if it is already in there */
RrImage* RrImageCacheFind(RrImageCache *self,
RrPixel32 *data, gint w, gint h);
+/*! Finds an image in the cache, by searching for the name of the image */
+RrImage* RrImageCacheFindName(RrImageCache *self,
+ const gchar *name);
RrImage* RrImageNew(RrImageCache *cache);
void RrImageRef(RrImage *im);
void RrImageUnref(RrImage *im);
-void RrImageAddPicture(RrImage *im, RrPixel32 *data, gint w, gint h);
+void RrImageAddPicture(RrImage *im, const RrPixel32 *data, gint w, gint h);
+/*! Adds a picture by name, from a file on disk.
+ @name Can be a full path to an image, or it can be a name as per the
+ freedesktop.org icon spec. */
+gboolean RrImageAddPictureName(RrImage *im, const gchar *name);
void RrImageRemovePicture(RrImage *im, gint w, gint h);
G_END_DECLS