;;;;
;;;;
;;;; canvline.stk         -- Canvas::Line
;;;;
;;;; Copyright © 2021-2024 Erick Gallesio <eg@stklos.net>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;;; USA.
;;;;
;;;;           Author: Erick Gallesio [eg@unice.fr]
;;;;    Creation date:  2-Jul-2021 15:47
;;;;

;;;
;;; GTK Bindings
;;;
(define-gtk goo-canvas-path-new (#:pointer #:string)
  #:pointer "goo_canvas_path_new" canvas)


;;;; ======================================================================
;;;;
;;;;    < c a n v a s - p a t h >   c l a s s
;;;;
;;;; ======================================================================
(define-class <canvas-path> (<gtk-canvas-item-simple>)
  ((value       #:accessor       value
                #:init-keyword   #:value
                #:allocation     #:virtual
                #:slot-ref       (lambda (o)
                                   ;; This slot is RO in GTK!!!
                                   (%widget-data-get o #:value ""))
                #:slot-set!      (lambda (o v)
                                   (%widget-data-set! o #:value v)
                                   (%gtk-set-property! (slot-ref o 'wid)
                                                       "data" v)))))

 
(define-method make-canvas-item ((self <canvas-path>) parent)
  (let ((x (goo-canvas-path-new  parent "")))
    (cpointer-type-set! x 'canvas-path)
    x))


;;;
;;; Exports
;;;
(export <canvas-path> value)
