#Include "wx-c 0.9.2/wx.bi"

Declare Function App_OnInit WXCALL ( ) As wxBool
Declare Function App_OnExit WXCALL ( ) As wxInt

Declare Sub checklistbox0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

Dim Shared As wxApp Ptr wx_app
Dim Shared As wxFrame Ptr wx_frame
Dim Shared As wxPanel Ptr wx_panel

Function App_OnInit WXCALL ( ) As wxBool
    
    wx_frame = wxFrame_ctor( )
    wxFrame_Create( wx_frame, WX_NULL, -1, wxString_ctorUTF8("CheckListBox"), 440, 312, 390, 390, wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER, WX_NULL )
    wx_panel = wxPanel_ctor2( wx_frame, -1, -1, -1, -1, -1, 0, WX_NULL )
    
    ''
    '' create widget checklistbox0
    ''
    Dim As wxArrayString Ptr checklistbox0_str
    checklistbox0_str = wxArrayString_ctor( )
    wxArrayString_Add( checklistbox0_str, wxString_ctorUTF8( "one" ) )
    wxArrayString_Add( checklistbox0_str, wxString_ctorUTF8( "two" ) )
    wxArrayString_Add( checklistbox0_str, wxString_ctorUTF8( "three" ) )
    wxArrayString_Add( checklistbox0_str, wxString_ctorUTF8( "four" ) )
    wxArrayString_Add( checklistbox0_str, wxString_ctorUTF8( "five" ) )
    Dim As wxListbox Ptr checklistbox0
    checklistbox0 = wxCheckListBox_ctor2( wx_panel, -1, wxPoint_ctor( 80, 40 ), wxSize_ctor( 100, 100 ), checklistbox0_str, 0, 0, 0 )
    wxListbox_SetSelection( checklistbox0, 0, WX_TRUE )
    wxEvtHandler_proxy(checklistbox0, @checklistbox0_event)
    wxEvtHandler_Connect(checklistbox0, wxEvent_EVT_COMMAND_CHECKLISTBOX_TOGGLED(), -1, -1, 0)
    
    
    
    wxWindow_Show( wx_frame, 1 )
    wxApp_OnInit( wx_app )
    Return 1
    
End Function

Function App_OnExit WXCALL ( ) As wxInt
    
    Return wxApp_OnExit( wx_app )
    
End Function

Sub checklistbox0_event WXCALL (event As wxEvent Ptr, iListener As wxInt )
	
	For i As Integer = 0 To wxControlWithItems_GetCount( wxEvent_GetEventObject( event ) ) - 1
		If wxCheckListBox_IsChecked( wxEvent_GetEventObject( event ), i ) Then
			Print "Listelement " + Str( i ) + " is checked."
		EndIf
	Next
End Sub


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