;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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.
;;;
;;; Includes information derived from the GSL (Gnu Scientific Library)
;;;   header files which are copyrighted and distributed under the GPL
;;;   by their respective authors.
;;;
;;; 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/inventor-config")



#? *** events

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

#? * soevent
;;.TYPE CLASS
#? (new soevent <flag>>
#? (==> <soevent> -destructor)
#? (==> <soevent> isoftype <type>)
#? (==> <soevent> settime <s>)
#? (==> <soevent> gettime)
#? (==> <soevent> setposition <p>)
#? (==> <soevent> getposition)
#? (==> <soevent> getposition-vprgn <vprgn>)
#? (==> <soevent> getnormalizedposition <vprgn>)
#? (==> <soevent> setshiftdown <isdown>)
#? (==> <soevent> setctrldown <isdown>)
#? (==> <soevent> setaltdown <isdown>)
#? (==> <soevent> wasshiftdown)
#? (==> <soevent> wasctrldown)
#? (==> <soevent> wasaltdown)

#? * sobuttonevent
;;.TYPE CLASS
#? (new sobuttonevent <flag>>
#? (==> <sobuttonevent> -destructor)
#? (==> <sobuttonevent> setstate <s>)
#? (==> <sobuttonevent> getstate)

#? * sokeyboardevent
;;.TYPE CLASS
#? (new sokeyboardevent <flag>>
#? (==> <sokeyboardevent> -destructor)
#? (==> <sokeyboardevent> setkey <whichkey>)
#? (==> <sokeyboardevent> getkey)
#? (==> <sokeyboardevent> getprintablecharacter)

#? * solocation2event
;;.TYPE CLASS
#? (new solocation2event <flag>>
#? (==> <solocation2event> -destructor)

#? * somotion3event
;;.TYPE CLASS
#? (new somotion3event <flag>>
#? (==> <somotion3event> -destructor)
#? (==> <somotion3event> settranslation <s>)
#? (==> <somotion3event> gettranslation)
#? (==> <somotion3event> setrotation <r>)
#? (==> <somotion3event> getrotation)

#? * somousebuttonevent
;;.TYPE CLASS
#? (new somousebuttonevent <flag>>
#? (==> <somousebuttonevent> -destructor)
#? (==> <somousebuttonevent> setbutton <b>)
#? (==> <somousebuttonevent> getbutton)

#? * sospaceballbuttonevent
;;.TYPE CLASS
#? (new sospaceballbuttonevent <flag>>
#? (==> <sospaceballbuttonevent> -destructor)
#? (==> <sospaceballbuttonevent> setbutton <b>)
#? (==> <sospaceballbuttonevent> getbutton)

#? * (|dummy_events|)

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



;;************************************************************
;;**********   events
;;************************************************************
(libload "inventor/sotype")


;; class SoEvent : public InventorObject
(defclass SoEvent InventorObject)

(defmethod SoEvent  SoEvent ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoEvent;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoEvent -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoEvent *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())

(defmethod SoEvent  isOfType ( type)
  
  ((-gptr- "SoType *") type)    ;; object -> gptr
  (int #{ ((SoEvent *)$p)->isOfType(*$type)  #} ))

(defmethod SoEvent  setTime ( s)
  
  ((-gptr- "SbTime *") s)    ;; object -> gptr
  #{ ((SoEvent *)$p)->setTime(*$s);  #} 
  ())

(defmethod SoEvent  getTime (  )
  
  (let*  ((retobj (new SbTime ()))
	  (retobjp  :retobj:p))
    #{ *((SbTime *)$retobjp) = ((SoEvent *)$p)->getTime();  #} 
    retobj))

(defmethod SoEvent  setPosition ( p)
  
  ((-gptr- "const SbVec2s *") p)   ;; reference -> gptr
  #{ ((SoEvent *)$p)->setPosition(*$p);  #} 
  ())

(defmethod SoEvent  getPosition (  )
  
  (gptr #{ &(((SoEvent *)$p)->getPosition())  #} ))  ;; const SbVec2s & -> gptr

(defmethod SoEvent  getPosition_vpRgn ( vpRgn)
  
  ((-gptr- "const SbViewportRegion *") vpRgn)   ;; reference -> gptr
  (gptr #{ &(((SoEvent *)$p)->getPosition(*$vpRgn))  #} ))  ;; const SbVec2s & -> gptr

(defmethod SoEvent  getNormalizedPosition ( vpRgn)
  
  ((-gptr- "const SbViewportRegion *") vpRgn)   ;; reference -> gptr
  (gptr #{ &(((SoEvent *)$p)->getNormalizedPosition(*$vpRgn))  #} ))  ;; const SbVec2f & -> gptr

(defmethod SoEvent  setShiftDown ( isDown)
  
  ((-int-) isDown)                    ;; SbBool -> int
  #{ ((SoEvent *)$p)->setShiftDown($isDown);  #} 
  ())

(defmethod SoEvent  setCtrlDown ( isDown)
  
  ((-int-) isDown)                    ;; SbBool -> int
  #{ ((SoEvent *)$p)->setCtrlDown($isDown);  #} 
  ())

(defmethod SoEvent  setAltDown ( isDown)
  
  ((-int-) isDown)                    ;; SbBool -> int
  #{ ((SoEvent *)$p)->setAltDown($isDown);  #} 
  ())

(defmethod SoEvent  wasShiftDown (  )
  
  (int #{ ((SoEvent *)$p)->wasShiftDown()  #} ))

(defmethod SoEvent  wasCtrlDown (  )
  
  (int #{ ((SoEvent *)$p)->wasCtrlDown()  #} ))

(defmethod SoEvent  wasAltDown (  )
  
  (int #{ ((SoEvent *)$p)->wasAltDown()  #} ))




;; class SoButtonEvent : public SoEvent  
(defclass SoButtonEvent SoEvent)

(defmethod SoButtonEvent  SoButtonEvent ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoButtonEvent;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoButtonEvent -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoButtonEvent *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())

(defmethod SoButtonEvent  setState ( s)
  
  ((-int-) s)   ;; SoButtonEvent::State
  #{ ((SoButtonEvent *)$p)->setState((SoButtonEvent::State)$s);  #} 
  ())

(defmethod SoButtonEvent  getState (  )
  
  (int #{ ((SoButtonEvent *)$p)->getState()  #} ))   ;; SoButtonEvent::State




;; class SoKeyboardEvent : public SoButtonEvent
(defclass SoKeyboardEvent SoButtonEvent)

(defmethod SoKeyboardEvent  SoKeyboardEvent ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoKeyboardEvent;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoKeyboardEvent -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoKeyboardEvent *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())

(defmethod SoKeyboardEvent  setKey ( whichKey)
  
  ((-int-) whichKey)   ;; SoKeyboardEvent::Key
  #{ ((SoKeyboardEvent *)$p)->setKey((SoKeyboardEvent::Key)$whichKey);  #} 
  ())

(defmethod SoKeyboardEvent  getKey (  )
  
  (int #{ ((SoKeyboardEvent *)$p)->getKey()  #} ))   ;; SoKeyboardEvent::Key

(defmethod SoKeyboardEvent  getPrintableCharacter (  )
  
  (int #{ ((SoKeyboardEvent *)$p)->getPrintableCharacter()  #} ))



;; class SoLocation2Event : public SoEvent
(defclass SoLocation2Event SoEvent)

(defmethod SoLocation2Event  SoLocation2Event ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoLocation2Event;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoLocation2Event -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoLocation2Event *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())





;; class SoMotion3Event : public SoEvent
(defclass SoMotion3Event SoEvent)

(defmethod SoMotion3Event  SoMotion3Event ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoMotion3Event;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoMotion3Event -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoMotion3Event *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())

(defmethod SoMotion3Event  setTranslation ( s)
  
  ((-gptr- "const SbVec3f *") s)   ;; reference -> gptr
  #{ ((SoMotion3Event *)$p)->setTranslation(*$s);  #} 
  ())

(defmethod SoMotion3Event  getTranslation (  )
  
  (gptr #{ &(((SoMotion3Event *)$p)->getTranslation())  #} ))  ;; const SbVec3f & -> gptr

(defmethod SoMotion3Event  setRotation ( r)
  
  ((-gptr- "const SbRotation *") r)   ;; reference -> gptr
  #{ ((SoMotion3Event *)$p)->setRotation(*$r);  #} 
  ())

(defmethod SoMotion3Event  getRotation (  )
  
  (gptr #{ &(((SoMotion3Event *)$p)->getRotation())  #} ))  ;; const SbRotation & -> gptr





;; class SoMouseButtonEvent : public SoButtonEvent
(defclass SoMouseButtonEvent SoButtonEvent)

(defmethod SoMouseButtonEvent  SoMouseButtonEvent ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoMouseButtonEvent;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoMouseButtonEvent -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoMouseButtonEvent *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())

(defmethod SoMouseButtonEvent  setButton ( b)
  
  ((-int-) b)   ;; SoMouseButtonEvent::Button
  #{ ((SoMouseButtonEvent *)$p)->setButton((SoMouseButtonEvent::Button)$b);  #} 
  ())

(defmethod SoMouseButtonEvent  getButton (  )
  
  (int #{ ((SoMouseButtonEvent *)$p)->getButton()  #} ))   ;; SoMouseButtonEvent::Button





;; class SoSpaceballButtonEvent : public SoButtonEvent
(defclass SoSpaceballButtonEvent SoButtonEvent)

(defmethod SoSpaceballButtonEvent  SoSpaceballButtonEvent ( flag  )
  ((-bool-) flag)
  
  #{  if($flag == false ) {
            $p = new  SoSpaceballButtonEvent;
            $shell_flag = false;
      }
      else
            $shell_flag = true;
  #} 
  ())

(defmethod SoSpaceballButtonEvent -destructor (  )
  
  #{   if($shell_flag == false ) {
             delete  ((SoSpaceballButtonEvent *)$p);
             $p = NULL;
             $shell_flag = true;
       }
  #} 
  ())

(defmethod SoSpaceballButtonEvent  setButton ( b)
  
  ((-int-) b)   ;; SoSpaceballButtonEvent::Button
  #{ ((SoSpaceballButtonEvent *)$p)->setButton((SoSpaceballButtonEvent::Button)$b);  #} 
  ())

(defmethod SoSpaceballButtonEvent  getButton (  )
  
  (int #{ ((SoSpaceballButtonEvent *)$p)->getButton()  #} ))   ;; SoSpaceballButtonEvent::Button

()

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

(dhc-make-with-c++ () () 
  |dummy_events|
  (soevent  wasaltdown  wasctrldown  wasshiftdown  setaltdown  setctrldown  setshiftdown  getnormalizedposition  getposition-vprgn  getposition  setposition  gettime  settime  isoftype  -destructor  soevent)
  (sobuttonevent  getstate  setstate  -destructor  sobuttonevent)
  (sokeyboardevent  getprintablecharacter  getkey  setkey  -destructor  sokeyboardevent)
  (solocation2event  -destructor  solocation2event)
  (somotion3event  getrotation  setrotation  gettranslation  settranslation  -destructor  somotion3event)
  (somousebuttonevent  getbutton  setbutton  -destructor  somousebuttonevent)
  (sospaceballbuttonevent  getbutton  setbutton  -destructor  sospaceballbuttonevent)
)
