#!/usr/bin/env lisp
;;;
;;; generated by wxGlade
;;;

(asdf:operate 'asdf:load-op 'wxcl)
(use-package "FFI")
(ffi:default-foreign-language :stdc)


(use-package :wxButton)
(use-package :wxCL)
(use-package :wxColour)
(use-package :wxEvent)
(use-package :wxEvtHandler)
(use-package :wxFrame)
(use-package :wxPanel)
(use-package :wxSizer)
(use-package :wxTextCtrl)
(use-package :wxWindow)
(use-package :wx_main)
(use-package :wx_wrapper)



(defclass MyFrame()
        ((top-window :initform nil :accessor slot-top-window)
        (panel-1 :initform nil :accessor slot-panel-1)
        (sizer-1 :initform nil :accessor slot-sizer-1)
        (text-ctrl-1 :initform nil :accessor slot-text-ctrl-1)
        (button-1 :initform nil :accessor slot-button-1)))

(defun make-MyFrame ()
        (let ((obj (make-instance 'MyFrame)))
          (init obj)
          (set-properties obj)
          (do-layout obj)
          obj))

(defmethod init ((obj MyFrame))
"Method creates the objects contained in the class."
        (setf (slot-top-window obj) (wxFrame_create nil wxID_ANY "" -1 -1 -1 -1 wxDEFAULT_FRAME_STYLE))
        (slot-top-window obj).wxWindow_SetSize((400, 300))
        (wxFrame_SetTitle (slot-top-window obj) "frame")
        
        (setf (slot-panel-1 obj) (wxPanel_Create (slot-top-window obj) wxID_ANY -1 -1 -1 -1 wxTAB_TRAVERSAL))
        
        (setf (slot-sizer-1 obj) (wxBoxSizer_Create wxVERTICAL))
        
        (setf (slot-text-ctrl-1 obj) (wxTextCtrl_Create (slot-panel-1 obj) wxID_ANY "" -1 -1 -1 -1 0))
        (wxSizer_AddWindow (slot-sizer-1 obj) (slot-text-ctrl-1 obj) 0 0 0 nil)
        
        (setf (slot-button-1 obj) (wxButton_Create (slot-panel-1 obj) wxID_ANY "button_1" -1 -1 -1 -1 0))
        (wxSizer_AddWindow (slot-sizer-1 obj) (slot-button-1 obj) 0 0 0 nil)
        
        (wxWindow_SetSizer (slot-panel-1 obj) (slot-sizer-1 obj))
        
        (wxFrame_layout (slot-frame self))
        )




(defclass MyFrame()
        ((top-window :initform nil :accessor slot-top-window)
        (panel-1 :initform nil :accessor slot-panel-1)
        (sizer-1 :initform nil :accessor slot-sizer-1)
        (text-ctrl-1 :initform nil :accessor slot-text-ctrl-1)
        (button-1 :initform nil :accessor slot-button-1)
        (panel-1 :initform nil :accessor slot-panel-1)
        (sizer-1 :initform nil :accessor slot-sizer-1)
        (text-ctrl-1 :initform nil :accessor slot-text-ctrl-1)
        (button-1 :initform nil :accessor slot-button-1)))

(defun make-MyFrame ()
        (let ((obj (make-instance 'MyFrame)))
          (init obj)
          (set-properties obj)
          (do-layout obj)
          obj))

(defmethod init ((obj MyFrame))
"Method creates the objects contained in the class."
        (setf (slot-top-window obj) (wxFrame_create nil wxID_ANY "" -1 -1 -1 -1 wxDEFAULT_FRAME_STYLE))
        (wxFrame_SetTitle (slot-top-window obj) "frame")
        
        (setf (slot-panel-1 obj) (wxPanel_Create (slot-top-window obj) wxID_ANY -1 -1 -1 -1 wxTAB_TRAVERSAL))
        
        (setf (slot-sizer-1 obj) (wxBoxSizer_Create wxVERTICAL))
        
        (setf (slot-text-ctrl-1 obj) (wxTextCtrl_Create (slot-panel-1 obj) wxID_ANY "" -1 -1 -1 -1 0))
        (wxSizer_AddWindow (slot-sizer-1 obj) (slot-text-ctrl-1 obj) 0 0 0 nil)
        
        (setf (slot-button-1 obj) (wxButton_Create (slot-panel-1 obj) wxID_ANY "button_1" -1 -1 -1 -1 0))
        (wxSizer_AddWindow (slot-sizer-1 obj) (slot-button-1 obj) 0 0 0 nil)
        
        (wxWindow_SetSizer (slot-panel-1 obj) (slot-sizer-1 obj))
        
        (wxSizer_Fit (slot-sizer-1 obj) (slot-top-window obj))
        (wxFrame_layout (slot-frame-no-size self))
        )



(defun init-func (fun data evt)
        (let ((frame (make-MyFrame)))
        (ELJApp_SetTopWindow (slot-top-window frame))
        (wxWindow_Show (slot-top-window frame))))


(unwind-protect
    (Eljapp_initializeC (wxclosure_Create #'init-func nil) 0 nil)
    (ffi:close-foreign-library "../miscellaneous/wxc-msw2.6.2.dll"))
