#include once "inc/wx.bi"


Declare Sub EventHandler APICALL(event As _wxEvent Ptr)

Dim Shared As _wxApp Ptr wx_app
Dim Shared As _wxFrame Ptr wx_frame
Dim Shared As _wxPanel Ptr wx_panel
Dim Shared As _wxTextCtrl Ptr textctrl0

Sub EventListener APICALL(event As _wxEvent Ptr, iListener as wxInt)
  Select Case wxEvent_GetEventType( event )
    Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
         wxTextCtrl_SetValue(textctrl0, wxString("Blabla"))
  End Select
End Sub

function App_OnInit APICALL( ) as wxBool
   
    wx_frame = wxFrame_ctor( )
    wxFrame_Create(wx_frame, WX_NULL, -1, wxString("My WX-C Project"), _
                    -1, -1, 390, 390, wxFRAME_DEFAULT_STYLE _
                                        Or  wxCLOSE_BOX _
                                        Xor wxMAXIMIZE_BOX _
                                        Xor wxRESIZE_BORDER, WX_NULL)
    wx_panel = wxPanel_ctor2(wx_frame)
  
    ''
    '' create widget button0
    ''
    Dim As _wxButton Ptr button0
    button0 = wxButton_ctor()
    wxButton_Create( button0, wx_panel, -1, wxString("button0"), _
                     70, 270, 250, 60)
    wxEvtHandler_proxy(Button0, @EventListener)
    wxEvtHandler_Connect(Button0, wxEvent_EVT_COMMAND_BUTTON_CLICKED())
   
    ''
    '' create widget staticline0
    ''
    Dim As _wxStaticLine Ptr staticline0
    staticline0 = wxStaticLine_ctor( )
    wxStaticLine_Create(staticline0, wx_panel,-1, 30, 250 ,330, 10)
   
    ''
    '' create widget staticbox0
    ''
    Dim As _wxStaticBox Ptr staticbox0
    staticbox0 = wxStaticBox_ctor( )
    wxStaticBox_Create( staticbox0, wx_panel, -1, wxString("staticbox0"), _
                       10, 10 ,  120, 90 , 0, WX_NULL)

    ''
    '' create widget checkbox0
    ''
    Dim As _wxCheckBox Ptr checkbox0
    checkbox0 = wxCheckBox_ctor( )
    wxCheckBox_Create(checkbox0, wx_panel, -1, wxString("checkbox0"),  _
                      20, 30 , -1, -1 , 0, 0, WX_NULL)
    wxCheckBox_SetValue( checkbox0, 0 )
    ''
    '' create widget checkbox1
    ''
    Dim As _wxCheckBox Ptr checkbox1
    checkbox1 = wxCheckBox_ctor( )
    wxCheckBox_Create( checkbox1, wx_panel, -1, wxString("checkbox1"), _
                      20, 50 ,-1, -1 , 0, 0, WX_NULL)
    wxCheckBox_SetValue( checkbox1, 0 )
    ''
    '' create widget checkbox2
    ''
    Dim As _wxCheckBox Ptr checkbox2
    checkbox2 = wxCheckBox_ctor( )
    wxCheckBox_Create( checkbox2, wx_panel, -1, wxString("checkbox2"),  _
                       20, 70 ,  -1, -1 , 0, 0, WX_NULL)
    wxCheckBox_SetValue( checkbox2, 0 )
    ''
    '' create widget textctrl0
    ''
    'Dim As _wxTextCtrl Ptr textctrl0
    textctrl0 = wxTextCtrl_ctor( )
    wxTextCtrl_Create( textctrl0, wx_panel, -1,  wxString("textctrl0"), _
                       40, 220 ,  310, 21 , 0, 0, WX_NULL)
                       
  wxWindow_Show( wx_frame)
  return wxApp_OnInit( wx_app )

End function

function App_OnExit APICALL as wxInt
  return wxApp_OnExit( wx_app )
End function




''main
wx_app = wxApp_ctor()
wxApp_RegisterVirtual wx_app, @App_OnInit, @App_OnExit
wxApp_Run()
 
