;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;;
;;; 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, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(libload "inventor/xt-config")



#? *** xt_devices

;; dummy function that adds Inventor header files in C file
(eval `(de |dummy_xt_devices| () ,inventorxt-cpheader-cmd ()))

#? * soxtdevice
;;.TYPE CLASS
#? (==> <soxtdevice> setwindowsize <s>)
#? (==> <soxtdevice> getwindowsize)

#? * soxtinputfocus
;;.TYPE CLASS
#? (new soxtinputfocus <mask> <shellflag>>
#? (==> <soxtinputfocus> enable <w> <f> <data> <win>)
#? (==> <soxtinputfocus> disable <w> <f> <data>)
#? (==> <soxtinputfocus> translateevent <xevent>)

#? * soxtkeyboard
;;.TYPE CLASS
#? (new soxtkeyboard <mask> <shellflag>>
#? (==> <soxtkeyboard> enable <w> <f> <data> <win>)
#? (==> <soxtkeyboard> disable <w> <f> <data>)
#? (==> <soxtkeyboard> translateevent <xevent>)

#? * soxtmouse
;;.TYPE CLASS
#? (new soxtmouse <mask> <shellflag>>
#? (==> <soxtmouse> enable <w> <f> <data> <win>)
#? (==> <soxtmouse> disable <w> <f> <data>)
#? (==> <soxtmouse> translateevent <xevent>)

#? * soxtspaceball
;;.TYPE CLASS
#? (new soxtspaceball <mask> <shellflag>>
#? (==> <soxtspaceball> enable <w> <f> <data> <win>)
#? (==> <soxtspaceball> disable <w> <f> <data>)
#? (==> <soxtspaceball> translateevent <xevent>)
#? (==> <soxtspaceball> setrotationscalefactor <f>)
#? (==> <soxtspaceball> getrotationscalefactor)
#? (==> <soxtspaceball> settranslationscalefactor <f>)
#? (==> <soxtspaceball> gettranslationscalefactor)

#? * (|dummy_xt_devices|)

;; ********************************************************


(libload "inventor/xt-config")
(libload "inventor/inventorobject")

;;***********************************************************************
;;class SoXtDevice 
(defclass SoXtDevice InventorObject)

(defmethod  SoXtDevice  setWindowSize (  s )
  
  ((-gptr- "const SbVec2s *") s)        ;; reference -> gptr
  #{  ((SoXtDevice *)$p)->setWindowSize( *$s);  #} 
  ())

(defmethod  SoXtDevice  getWindowSize (  )
  
  (gptr #{  &(((SoXtDevice *)$p)->getWindowSize())  #} ))      ;; reference -> gptr



;;***********************************************************************
;;class SoXtInputFocus : public SoXtDevice 
(defclass SoXtInputFocus  SoXtDevice)
 
(defmethod  SoXtInputFocus  SoXtInputFocus ( mask  shellflag)
  
  ((-bool-) shellflag)
  ((-int-) mask)           ;; EventMask -> int
  #{  if($shellflag == false ) {
            $p = new SoXtInputFocus( $mask );
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())



(defmethod  SoXtInputFocus  enable ( w f data win )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f)       
  ((-gptr- "XtPointer") data) 
  ((-int-) win)            ;; Window -> int
  #{  ((SoXtInputFocus *)$p)->enable( $w  ,$f  ,$data  ,$win );  #} 
  ())

(defmethod  SoXtInputFocus  disable ( w f data )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  #{  ((SoXtInputFocus *)$p)->disable( $w  ,$f  ,$data );  #} 
  ())

(defmethod  SoXtInputFocus  translateEvent ( xevent )
  
  ((-gptr- "XAnyEvent *") xevent) 
  (gptr #{  ((SoXtInputFocus *)$p)->translateEvent( $xevent )  #} ))  ;; const SoEvent *  -> gptr



;;***********************************************************************
;;class SoXtKeyboard : public SoXtDevice 
(defclass SoXtKeyboard  SoXtDevice)
 
(defmethod  SoXtKeyboard  SoXtKeyboard ( mask  shellflag)
  
  ((-bool-) shellflag)
  ((-int-) mask)              ;; EventMask -> int
  #{  if($shellflag == false ) {
            $p = new SoXtKeyboard( $mask );
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())



(defmethod  SoXtKeyboard  enable ( w f data win )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  ((-int-) win)  ;; Window -> int
  #{  ((SoXtKeyboard *)$p)->enable( $w  ,$f  ,$data  ,$win );  #} 
  ())

(defmethod  SoXtKeyboard  disable ( w f data )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  #{  ((SoXtKeyboard *)$p)->disable( $w  ,$f  ,$data );  #} 
  ())

(defmethod  SoXtKeyboard  translateEvent ( xevent )
  
  ((-gptr- "XAnyEvent *") xevent) 
  (gptr #{  ((SoXtKeyboard *)$p)->translateEvent( $xevent )  #} ))  ;; const SoEvent *  -> gptr



;;***********************************************************************
;;class SoXtMouse : public SoXtDevice 
(defclass SoXtMouse  SoXtDevice)
 
(defmethod  SoXtMouse  SoXtMouse ( mask  shellflag)
  
  ((-bool-) shellflag)
  ((-int-) mask)     ;; EventMask -> int
  #{  if($shellflag == false ) {
            $p = new SoXtMouse( $mask );
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())



(defmethod  SoXtMouse  enable ( w f data win )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  ((-int-) win)       ;; Window -> int
  #{  ((SoXtMouse *)$p)->enable( $w  ,$f  ,$data  ,$win );  #} 
  ())

(defmethod  SoXtMouse  disable ( w f data )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  #{  ((SoXtMouse *)$p)->disable( $w  ,$f  ,$data );  #} 
  ())

(defmethod  SoXtMouse  translateEvent ( xevent )
  
  ((-gptr- "XAnyEvent *") xevent) 
  (gptr #{  ((SoXtMouse *)$p)->translateEvent( $xevent )  #} ))  ;; const SoEvent *  -> gptr



;;***********************************************************************
;;class SoXtSpaceball : public SoXtDevice 
(defclass SoXtSpaceball  SoXtDevice)
 
(defmethod  SoXtSpaceball  SoXtSpaceball ( mask  shellflag)
  
  ((-bool-) shellflag)
  ((-int-) mask)            ;; SoXtSpaceball::Mask -> int
  #{  if($shellflag == false ) {
            $p = new SoXtSpaceball( (SoXtSpaceball::Mask)$mask );
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod  SoXtSpaceball  enable ( w f data win )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  ((-int-) win)                ;; Window -> int 
  #{  ((SoXtSpaceball *)$p)->enable( $w  ,$f  ,$data  ,$win );  #} 
  ())

(defmethod  SoXtSpaceball  disable ( w f data )
  
  ((-gptr- "Widget") w) 
  ((-gptr- "XtEventHandler") f) 
  ((-gptr- "XtPointer") data) 
  #{  ((SoXtSpaceball *)$p)->disable( $w  ,$f  ,$data );  #} 
  ())

(defmethod  SoXtSpaceball  translateEvent ( xevent )
  
  ((-gptr- "XAnyEvent *") xevent) 
  (gptr #{  ((SoXtSpaceball *)$p)->translateEvent( $xevent )  #} ))  ;; const SoEvent *  -> gptr

(defmethod  SoXtSpaceball  setRotationScaleFactor ( f )
  
  ((-float-) f) 
  #{  ((SoXtSpaceball *)$p)->setRotationScaleFactor( $f );  #} 
  ())

(defmethod  SoXtSpaceball  getRotationScaleFactor (  )
  
  (float #{  ((SoXtSpaceball *)$p)->getRotationScaleFactor()  #} ))

(defmethod  SoXtSpaceball  setTranslationScaleFactor ( f )
  
  ((-float-) f) 
  #{  ((SoXtSpaceball *)$p)->setTranslationScaleFactor( $f );  #} 
  ())

(defmethod  SoXtSpaceball  getTranslationScaleFactor (  )
  
  (float #{  ((SoXtSpaceball *)$p)->getTranslationScaleFactor()  #} ))


;; ********************************************************

(let ((dhc-make-lushflags inventorxt-lushflags))
(dhc-make-with-c++ () ()
  |dummy_xt_devices|
  (soxtdevice  getwindowsize  setwindowsize)
  (soxtinputfocus  translateevent  disable  enable  soxtinputfocus)
  (soxtkeyboard  translateevent  disable  enable  soxtkeyboard)
  (soxtmouse  translateevent  disable  enable  soxtmouse)
  (soxtspaceball  gettranslationscalefactor  settranslationscalefactor  getrotationscalefactor  setrotationscalefactor  translateevent  disable  enable  soxtspaceball)
))
