;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.projectional-editor) ;;;;;;;; ;;;; Widget domain provides: ;;;; - checkbox ;;;; - button ;;;; - text field ;;;;;; ;;; Data structure (def class* widget/base () ()) (def class* widget/checkbox (widget/base) ()) (def class* widget/button (widget/base) ()) (def class* widget/text-field (widget/base) ()) (def computed-class* widget/scroll-pane (widget/base) ((content :type t) (scroll-position :type 2d :computed-in projectional-editor))) ;;;;;; ;;; Construction (def (function e) make-widget/scroll-pane (content) (make-instance 'widget/scroll-pane :content content :scroll-position (as (make-2d 0 0)))) ;;;;;; ;;; Construction (def (macro e) scroll-pane (&body content) `(make-widget/scroll-pane ,(first content))) ;;;;;; ;;; Operation (def class* operation/widget/scroll-pane/scroll (operation) ((scroll-delta :type 2d))) (def method redo-operation ((operation operation/widget/scroll-pane/scroll) document) (setf (scroll-position-of document) (+ (scroll-position-of document) (scroll-delta-of operation))))