CAPI: Pushbuttons ... Own "style" ?
Hi all:I am currently doing my first steps in CAPI. I am about to define a GUI for an amateur radio transmitter (http://www.adat.ch/img/adt200a_big.jpg). In doing so I want to create a user-configurable touch interface. The interface is intended to enable the user to configure buttons with functions the device executes upon being pushed.
(hopefully the embedded image is displayed here ....)
These buttons are made from images - which is not what I want to do. I see no way of creating a "theme" for all my elements without resorting to images - I'd need to be able to define the shape of a button (from a structure of visual elements - in the button example this is the green background, the text "VFO", the white area, the labels "A" etc).
Is there a way thatI just don't see ? I can see a way using OpenGL panes - maybe?
The code I used to create this is quite simple:
(in-package :cl-user)
(defpackage #:de.consequor.scratch.capi
(:nicknames #:ccag.capi)
(:use #:cl
#:capi))
(in-package #:de.consequor.scratch.capi)
(defmacro mk-image-push-button (image-filepath data selection-fn)
`(make-instance 'capi:push-button
:data ,data
:image (merge-pathnames
,image-filepath
*gui-elements-pathname*)
:callback ,selection-fn))
(eval-when (:compile-toplevel :execute :load-toplevel)
(defparameter *gui-elements-pathname* #p "~/scratch/")
(defparameter *vfo-a-btn* (mk-image-push-button
"vfo_a.png"
"VFO_A"
nil))
(defparameter *vfo-b-btn* (mk-image-push-button
"vfo_b.png"
"VFO_B"
nil))
(defparameter *vfo-c-btn* (mk-image-push-button
"vfo_c.png"
"VFO_C"
nil)))
(defun test-buttons ()
(capi:contain
(make-instance 'push-button-panel
:items (list *vfo-a-btn* *vfo-b-btn* *vfo-c-btn*))))
(defpackage #:de.consequor.scratch.capi
(:nicknames #:ccag.capi)
(:use #:cl
#:capi))
(in-package #:de.consequor.scratch.capi)
(defmacro mk-image-push-button (image-filepath data selection-fn)
`(make-instance 'capi:push-button
:data ,data
:image (merge-pathnames
,image-filepath
*gui-elements-pathname*)
:callback ,selection-fn))
(eval-when (:compile-toplevel :execute :load-toplevel)
(defparameter *gui-elements-pathname* #p "~/scratch/")
(defparameter *vfo-a-btn* (mk-image-push-button
"vfo_a.png"
"VFO_A"
nil))
(defparameter *vfo-b-btn* (mk-image-push-button
"vfo_b.png"
"VFO_B"
nil))
(defparameter *vfo-c-btn* (mk-image-push-button
"vfo_c.png"
"VFO_C"
nil)))
(defun test-buttons ()
(capi:contain
(make-instance 'push-button-panel
:items (list *vfo-a-btn* *vfo-b-btn* *vfo-c-btn*))))
Thanks in advance for any hints ...
Best regards
Frank