mirror of https://codeberg.org/cage/tinmop/
20 lines
818 B
Common Lisp
20 lines
818 B
Common Lisp
(in-package :icons)
|
|
|
|
(a:define-constant +icon-dir+ "/icons/" :test #'string=)
|
|
|
|
(a:define-constant +icon-search+ "search" :test #'string=)
|
|
|
|
(defparameter *icon-search* nil)
|
|
|
|
(defun load-icon (filename)
|
|
(let ((path (if (not (re:scan "(?i)png$" filename))
|
|
(res:get-config-file (fs:cat-parent-dir +icon-dir+
|
|
(strcat filename ".png")))
|
|
(res:get-config-file (fs:cat-parent-dir +icon-dir+ filename)))))
|
|
(with-open-file (stream path :element-type '(unsigned-byte 8))
|
|
(let ((data (gui-utils:read-into-array stream (file-length stream))))
|
|
(gui:make-image data)))))
|
|
|
|
(defun load-icons ()
|
|
(setf *icon-search* (load-icon +icon-search+)))
|