From 8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 10 Dec 2024 07:11:02 -0800 Subject: Replaced defclass-std with def --- gui/button.lisp | 23 +++++++++++++++-------- gui/menus.lisp | 24 ++++++++++++++---------- 2 files changed, 29 insertions(+), 18 deletions(-) (limited to 'gui') diff --git a/gui/button.lisp b/gui/button.lisp index b4a41e9..bebea08 100644 --- a/gui/button.lisp +++ b/gui/button.lisp @@ -2,14 +2,21 @@ (in-package #:wheelwork) -(defclass/std button (unit interactive) - ((up down :with - :std (error "UP and DOWN lots are required") - :doc "Any affine renderable unit") - (bg :with) - (on-press on-release :with :doc "Function accepting the button.")) - (:documentation "A basic button class. The UP and DOWN slots should - be filled with renderable objects having the same size.")) +(def:class button (unit interactive) + ((up "Image when button is up") + (down "Image when button is down") + :required :prefix :type unit) + ((bg "optional background image") + :prefix + :type (or null unit) + :initform nil) + (on-press + on-release + :prefix + :type function + :documentation "Function accepting the BUTTON instance.") + + :documentation "Basic button. UP and DOWN should be the same size.") (defhandler button-released (on-mouseup () diff --git a/gui/menus.lisp b/gui/menus.lisp index 25abd7b..a477dd9 100644 --- a/gui/menus.lisp +++ b/gui/menus.lisp @@ -2,12 +2,13 @@ (in-package :wheelwork) -(defclass/std menu (unit interactive) - ((items :with :std nil - :doc "A list of interactive units") - (focus :with :std nil - :doc "The item that is focused in this menu, if any.") - (region :std (error "Menus require an explicit region")))) +(def:class menu (unit interactive) + ((items "list of interactive units in the menu") + :prefix :type list :initform nil) + ((focus "Object of menu with current focus.") + :prefix :type (or null unit) :initform nil) + ((region "Region where menu is displayed.") + :required :type region)) (defmethod cleanup :after ((menu menu)) (loop for item in (menu-items menu) do (cleanup item))) @@ -85,10 +86,13 @@ (render o))) -(defclass/std vscroller (menu) - ((scroll-speed :std 1) - (vert-scroll :std 0 - :doc "Vertical distance items have been displaced."))) +(def:class vscroller (menu) + (scroll-speed :type fixnum :initform 1) + (vert-scroll + :type fixnum + :initform 0 + :documentation "Vertical distance items have been displaced.")) + (defmethod (setf vert-scroll) :after (val (vs vscroller)) (loop -- cgit v1.2.3