Images in list-panel question
I have a question about list-panel images that may turn into a feature request.I have a list-panel that I would like to use the :image-function with. However, the images that I'm displaying come from a website using my http-image package (see http://github.com/massung/http-image), and are not known until runtime.
For example, let's say I was displaying a list of URLs, and wanted to display the favicon for each site next to the URL.
;; each item is a list of (url image)
:items '(("http://www.google.com/favicon.ico" nil)
("http://www.cnn.com/favicon.ico" nil))
Now, what would be ideal is the :image-function allowing me to return the image once it's been downloaded, or to start the download and tell the panel to refresh when it downloaded successfully.
:image-function 'url-favicon-image
:print-function 'first
Something like this (edge conditions left out for simplicity of the example):
(defun url-favicon-image (item)
(flet ((download-complete (external-image &optional error)
(when external-image
(apply-in-pane-process pane #'update-with-image pane external-image))))
(if-let (image (second item))
image
(progn
(http-image-download (first item) #'download-complete)
nil)))
The problem, however, is that the image-function callback doesn't supply the pane as one of the arguments, so I can't create the image once it's downloaded or tell the pane to refresh. I could store the pane globally, but then if I wanted to use this pane in multiple places at the same time it would soon become unwieldy.
Has anyone tried doing something similar before? Any suggestions on how I might accomplish what I'd like to do?
Side question: is there a way to make a list-panel display each item with multiple lines or at least have a minimum height per line?
Thanks!
Jeff M.