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

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


;;; begin wxGlade: dependencies
(use-package :wxBitmapButton)
(use-package :wxButton)
(use-package :wxCL)
(use-package :wxColour)
(use-package :wxEvent)
(use-package :wxEvtHandler)
(use-package :wxFrame)
(use-package :wxSizer)
(use-package :wxSpinCtrl)
(use-package :wxWindow)
(use-package :wx_main)
(use-package :wx_wrapper)
;;; end wxGlade

;;; begin wxGlade: extracode
;;; end wxGlade


(defclass MyDialog()
        ((top-window :initform nil :accessor slot-top-window)
        (colour-settings-sizer :initform nil :accessor slot-colour-settings-sizer)
        (inner-sizer :initform nil :accessor slot-inner-sizer)
        (bitmap-button-1 :initform nil :accessor slot-bitmap-button-1)
        (inner-grid-sizer :initform nil :accessor slot-inner-grid-sizer)
        (inner-red-spin-ctrl :initform nil :accessor slot-inner-red-spin-ctrl)))

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

(defmethod init ((obj MyDialog))
"Method creates the objects contained in the class."
        ;;; begin wxGlade: MyDialog.__init__
        (setf (slot-top-window obj) (wxDialog_create nil wxID_ANY "" -1 -1 -1 -1 (logior wxDEFAULT_DIALOG_STYLE wxRESIZE_BORDER)))
        (slot-top-window obj).wxWindow_SetSize((600, 320))
        (wxWindow_SetTitle (slot-dialog self) "dialog")
        
        (setf (slot-colour-settings-sizer obj) (StaticBoxSizer_Create (wxStaticBox:wxStaticBox_Create (slot-frame obj) "Colour Settings") wxHORIZONTAL))
        
        (setf (slot-inner-sizer obj) (StaticBoxSizer_Create (wxStaticBox:wxStaticBox_Create (slot-frame obj) "Inner") wxVERTICAL))
        (wxSizer_AddSizer (slot-colour-settings-sizer obj) (slot-inner-sizer obj) 0 wxALL 36 nil)
        
        (setf (slot-bitmap-button-1 obj) (wxBitmapButton_Create (slot-top-window obj) wxID_ANY (wxBitmap_CreateLoad "preferences-color-icon.png" wxBITMAP_TYPE_ANY) -1 -1 -1 -1 wxBORDER_NONE))
        (slot-bitmap-button-1 obj).wxWindow_SetSize((slot-bitmap-button-1 obj).wxWindow_GetBestSize())
        (wxSizer_AddWindow (slot-inner-sizer obj) (slot-bitmap-button-1 obj) 0 wxALIGN_CENTER_HORIZONTAL 0 nil)
        
        (setf (slot-inner-grid-sizer obj) (wxGridSizer_Create 1 2 2 2))
        (wxSizer_AddSizer (slot-inner-sizer obj) (slot-inner-grid-sizer obj) 1 0 0 nil)
        
        (setf (slot-inner-red-spin-ctrl obj) (wxSpinCtrl_Create (slot-top-window obj) wxID_ANY  -1 -1 -1 -1 0 0 255 ))
        (slot-inner-red-spin-ctrl obj).SetMinSize((110, 27))
        (wxSizer_AddWindow (slot-inner-grid-sizer obj) (slot-inner-red-spin-ctrl obj) 0 0 0 nil)
        
        (wxWindow_SetSizer (slot-frame obj) (slot-colour-settings-sizer obj))
        
        (wxWindow_layout (slot-dialog self))
        ;;; end wxGlade
        )

;;; end of class MyDialog


(defun init-func (fun data evt)
        (let ((dialog (make-MyDialog)))
        (ELJApp_SetTopWindow (slot-top-window dialog))
        (wxWindow_Show (slot-top-window dialog))))
;;; end of class MyApp


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