;;;;
;;;;
;;;; canvtext.stk         -- Canvas::Text
;;;;
;;;; Copyright © 2021 Erick Gallesio - I3S-CNRS/Polytech Nice-Sophia <eg@unice.fr>
;;;;
;;;;
;;;; 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 14:09
;;;;

;;;
;;; GTk Bindings
;;;
(define-gtk goo-canvas-text-new (#:pointer #:string #:double
                                 #:double #:double #:int #:pointer) #:pointer
  "goo_canvas_text_new" canvas)

;;;; ======================================================================
;;;;
;;;;    < c a n v a s - t e x t  >   c l a s s
;;;;
;;;; ======================================================================
(define-class <canvas-text> (<gtk-canvas-item-simple>)
  ((alignment   #:accessor       alignment
                #:init-keyword   #:alignment
                #:allocation     #:gtk-property-enum
                #:gtk-enum       (left center right))
   (anchor      #:accessor       anchor
                #:init-keyword   #:anchor
                #:allocation     #:gtk-property-enum
                #:gtk-enum       (center north north-west north-east
                                  south south-west south-east west east))
   (ellipsize   #:accessor       ellipsize
                #:init-keyword   #:ellipsize
                #:allocation     #:gtk-property-enum
                #:gtk-enum       (none start middle end))
   (value       #:accessor       value
                #:init-keyword   #:value
                #:allocation     #:gtk-property
                #:gtk-name       "text")
   (use-markup  #:accessor       use-markup
                #:init-keyword   #:use-markup
                #:allocation     #:gtk-property)
   (wrap        #:accessor       wrap
                #:init-keyword   #:wrap
                #:allocation     #:gtk-property-enum
                #:gtk-enum      (word char word-char))))

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



;;;
;;; Exports
;;;
(export <canvas-text> alignment anchor ellipsize value use-markup wrap)
