Re: changing icon image under LWW
Hello Paul,
| I want to change the image used in the upper left-hand corner of the
| window's title bar (and of the icon in iconified mode) under LWW4.4.6,
| but I don't see in the docs something that will do this. Does anybody
| know how to accomplish this and tell me where I should be looking?
Here is an excerpt from the Ystok-Widgets library
(http://lisp.ystok.ru/projects.html, file capi-hacks.lisp).
(defmacro define-icons (type &key icon-data icon-small-data)
;;; Args: type Symbol, an interface class name.
`(progn (setf (get ',type :icon-data) ,icon-data
(get ',type :icon-small-data) ,icon-small-data
*icon-interface-types* (adjoin ',type
*icon-interface-types*))
(defmethod CAPI::CAPI-INTERFACE-WINDOW-CLASS ((self ,type))
(symbol-name ',type))
(%register-icons ',type) ; (eval-when (:load-toplevel) ...) for
debugging
',type))
(defun %register-icons (&optional (list *icon-interface-types*))
(dolist (type (listify list))
#+win32 (WW::REGISTER-WINDOW-ATTRIBUTES (symbol-name type)
:icon-data (get type :icon-data)
:icon-small-data (get type :icon-small-data)))) ; does not
work in LW4.4.5?
;;; Usage example
(ywi:define-icons event-face
:icon-data #.(win32:read-icon-file-data
(lw:current-pathname "images/event-32x32.ico"))
:icon-small-data #.(win32:read-icon-file-data
(lw:current-pathname "images/event-16x16.ico")))
You can also find the second way of changing icons dynamically there.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru