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

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

Declare Sub menuhandler 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("ToolBar-Exit"), 440, 312, 209, 121, 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 )
	
	'' Application Icon
	Dim As wxIcon Ptr wx_icon
	Dim As wxBitmap Ptr iconImage
	wx_icon = wxIcon_ctor( )
	iconImage = wxBitmap_ctor( )
	wxBitmap_LoadFile( iconImage, wxString_ctorUTF8("media\close.bmp"), wxBITMAP_TYPE_BMP )
	wxIcon_CopyFromBitmap( wx_icon, iconImage )
	wxFrame_SetIcon( wx_frame, wx_icon )
	
	
	wxFrame_CreateToolbar( wx_frame, wxHORIZONTAL Or wxTB_TEXT Or wxTB_FLAT, -1, 0 )
	Dim As wxBitmap Ptr toolBarBitmap1 = wxBitmap_ctor( )
	wxBitmap_LoadFile( toolBarBitmap1, wxString_ctorUTF8("media\close.bmp"), wxBITMAP_TYPE_BMP )
	wxToolBar_AddTool2( wxFrame_GetToolbar( wx_frame ), 1, _
						wxString_ctorUTF8(""), _
						toolBarBitmap1, _
						wxString_ctorUTF8(""), _
						0 )
	wxToolBar_Realize( wxFrame_GetToolbar( wx_frame ) )
	
	wxEvtHandler_Proxy( wx_frame, Cast(EventListener, @menuhandler) )
	wxEvtHandler_Connect( wx_frame, wxEvent_EVT_COMMAND_MENU_SELECTED( ), -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 menuhandler WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
	
	Select Case wxEvent_GetId( event )
		Case 1
			'' stuff for toolbar button #1
			End
	End Select
	
End Sub


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