#Ifndef __VWXCDES_BI__
#Define __VWXCDES_BI__

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

#Ifndef FALSE
	Const FALSE = 0
	Const TRUE  = (Not FALSE)
#EndIf

#Ifndef NULL
	Const NULL  = 0
#EndIf

#If Defined(__FB_WIN32__)
	#Define NEWLINE !"\r\n"
	#Define SEPARATOR "\"
#ElseIf Defined(__FB_LINUX__)
	#Define NEWLINE !"\n"
	#Define SEPARATOR "/"
#Else
	#Print Your OS is not supported
#EndIf

#Include Once "list.bi"

#Ifndef wxLIST_FORMAT_LEFT

#Define wxLIST_FORMAT_LEFT		0

#Define wxCLOSE_BOX 			&h1000

#Define wxLC_VRULES		  		&h0001
#Define wxLC_HRULES		  		&h0002

#Define wxLC_ICON				&h0004
#Define wxLC_SMALL_ICON	  		&h0008
#Define wxLC_LIST				&h0010
#Define wxLC_REPORT		  		&h0020

#Define wxLC_ALIGN_TOP	   		&h0040
#Define wxLC_ALIGN_LEFT	  		&h0080
#Define wxLC_AUTOARRANGE	 	&h0100
#Define wxLC_VIRTUAL		 	&h0200
#Define wxLC_EDIT_LABELS	 	&h0400
#Define wxLC_NO_HEADER	   		&h0800
#Define wxLC_NO_SORT_HEADER  	&h1000
#Define wxLC_SINGLE_SEL	  		&h2000
#Define wxLC_SORT_ASCENDING  	&h4000
#Define wxLC_SORT_DESCENDING 	&h8000

#Define wxLC_MASK_TYPE	   	(wxLC_ICON Or wxLC_SMALL_ICON Or wxLC_LIST Or wxLC_REPORT)
#Define wxLC_MASK_ALIGN	  	(wxLC_ALIGN_TOP Or wxLC_ALIGN_LEFT)
#Define wxLC_MASK_SORT	   	(wxLC_SORT_ASCENDING Or wxLC_SORT_DESCENDING)

' for compatibility only
#Define wxLC_USER_TEXT	   wxLC_VIRTUAL

#EndIf

Type AppProperties
	As wxTextCtrl Ptr savePathCtrl, iconCtrl, relativePathTextCtrl
	As wxCheckBox Ptr relativePathCtrl
	
	As String title 'windowtitle
	As String fileName 'filename for codeoutput
	As String savePath 'savepath for codeoutput
	As String icon 'path to icon for window
	As String relativePath 'selected relative path for all resources
	As Integer additionalOutput 'holds whether a manifest/batchfile should be created
	As Integer relativePathInt 'holds if relative paths are activated
End Type

Const VWX_WIDGETLIST_INITNODES = 15 'do we need this?

'Enum container
'	VWX_CONTAINER_panel
'	VWX_CONTAINER_notebook 'it needs panel too
'End Enum
'
'Type VWX_Container
'	
'End Type

Enum widgets
	VWX_WIDGET_stattext
	VWX_WIDGET_button
	VWX_WIDGET_togglebutton
	VWX_WIDGET_bmpbutton
	VWX_WIDGET_image
	VWX_WIDGET_checkbox
	VWX_WIDGET_choice
	VWX_WIDGET_combo
	VWX_WIDGET_textctrl
	VWX_WIDGET_spinctrl
	VWX_WIDGET_richtext
	VWX_WIDGET_gauge
	VWX_WIDGET_radio
	VWX_WIDGET_list
	VWX_WIDGET_staticbox
	VWX_WIDGET_slider
	VWX_WIDGET_staticline
	VWX_WIDGET_spinbutton
	VWX_WIDGET_calendar
	VWX_WIDGET_checklistbox
End Enum

Type VWX_Widget
	ll_prev			 	As VWX_Widget Ptr
	ll_next			 	As VWX_Widget Ptr
	
	parent				As Any Ptr
	self				As Any Ptr
	kind				As widgets
	position			As wxSize Ptr
	size				As wxSize Ptr
	label				As String
	name				As String
	style				As Integer
	events(198)			As UByte
	'idindex				As Uinteger
End Type

Type VWX_Menu
	ll_prev	 	As VWX_Widget Ptr
	ll_next	 	As VWX_Widget Ptr
	
	self		As wxMenu Ptr
	kind		As Integer
	position	As Integer
	items		As TLIST
	parent		As Any Ptr
	name		As String
End Type

Type VWX_Menuitem
	ll_prev	 As VWX_Widget Ptr
	ll_next	 As VWX_Widget Ptr
	
	self	 As wxMenuItem Ptr
	submenu	 As VWX_Menu Ptr
End Type

Type xmlWidget
	parent As String 		'parents variable name
	parentkind As String 	'parents class
	self As String 			'variable name
	kind As String 			'class
	
	position As wxSize Ptr
	size As wxSize Ptr
	
	label As String
	value As String
	style As String
	title As String
	
	checked As Integer
	bitmap As String
	min As Integer
	max As Integer
	range As Integer
	item As String
	checked_item As String
	selection As Integer
	
	checkable As Integer
	radio As Integer
	longhelp As String
End Type

Enum ids
	mainframe = 1
	projframe
	
	box1
	box2
	box3
	box4
	
	menu_save
	menu_grid1x1
	menu_grid5x5
	menu_grid10x10
	menu_gridoff
	menu_exit
	menu_create
	menu_toolbar
	menu_addtotoolbar
	menu_septoolbar
	menu_import
	menu_export
	''''''''''''''''''''''''
	propertyDialog
	''''''''''''''''''''''''
	tool_FIRSTID
	tool_notool
	tool_stattext
	tool_button
	tool_togglebutton
	tool_bmpbutton
	tool_image
	tool_checkbox
	tool_choice
	tool_combo
	tool_textctrl
	tool_spinctrl
	tool_richtext
	tool_gauge
	tool_radio
	tool_list
	tool_staticbox
	tool_slider
	tool_staticline
	tool_spinbutton
	tool_calendar
	tool_checklistbox
	tool_LASTID
	''''''''''''''''''''''''
	
End Enum

Const VXW_TOOLS = tool_LASTID - tool_FIRSTID - 1

''
'' prototypes
''
Declare Sub		 	init				( )

Declare Sub		 	sizersub			( ByVal event As Long, ByVal iListener As Long )
Declare Sub 		event_mainframe	 	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub 		listevent			( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub 		event_projframe	 	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub		 	emitcode			( ByVal filename As String )
Declare Sub		 	xmlexport		   	( ByVal filename As String )
Declare Sub		 	xmlimport		   	( ByVal filename As String )

Declare Function	str_replace			( search As String, replacement As String, subject As String ) As String
Declare Function	str_getline			( subject As String, num As Integer ) As String
Declare Function	str_count		   	( search As String, subject As String ) As Integer

Declare Sub		 	closewin			( ByVal event As wxevent Ptr, ByVal iListener As Long )
'Declare Function	labeldiag		   	( ByVal label As String ) As wxTextCtrl Ptr
Declare Sub		 	propevent		   	( ByVal event As wxevent Ptr, ByVal iListener As Long )
Declare Sub		 	updatelist		  	( ByVal widget As VWX_Widget Ptr )
Declare Sub 		updateframelist		( )
Declare Sub 		resizewidget		( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub 		newXmlTool 			( ByVal tool As xmlWidget )

Declare Function	bmpbuttoncounter	( ByVal kind As Integer ) As Integer
Declare Function	get_filename		( extension As String ) As String
Declare Sub		 	check_filename	  	( )
Declare Function	get_xml				( ) As String
Declare Function	get_picture		 	( ) As String
Declare Function	get_pictureType	 	( picture As String ) As Integer
Declare Function	get_pictureTypeString ( ByVal pictureType As Integer ) As String

Declare Function	get_strfromlist		( ByVal list As wxListCtrl Ptr, _
										  ByVal item As Integer ) As String

Declare Function	get_intfromlist		( ByVal list As wxListCtrl Ptr, _
										  ByVal item As Integer ) As Integer

Declare Function	create_bmpbutton	( ByVal id As Integer, _
										  ByVal filename As String, _
										  ByVal parent As Any Ptr, _
										  ByVal x As Integer = -1, _
										  ByVal y As Integer = -1, _
										  ByVal w As Integer = -1, _
										  ByVal h As Integer = -1, _
										  ByVal style As Integer = -1 ) As wxBitmapButton Ptr

Declare Sub		 	boxes_draw		  	( ByVal widget As Any Ptr )
Declare Sub		 	boxes_tofront	   	( )
Declare Sub		 	boxes_hide		  	( )

Declare Sub		 	widget_redraw	   	( ByVal widget As VWX_Widget Ptr )
Declare Sub		 	widget_tofront	  	( ByVal widget As VWX_Widget Ptr )
Declare Sub		 	widget_delete	   	( ByVal widget As VWX_Widget Ptr )
Declare Sub		 	delbut_clicked	  	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub		 	evntbut_clicked	 	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub		 	redrawgrid		  	( ByVal redraw As Byte = FALSE )
Declare Sub		 	init_grid		   	( )
Declare Sub		 	redrawwidgets	   	( )

Declare Sub		 	menu_makemenu	   	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub		 	menu_change		 	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
'Declare Sub			properties_changed	( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub			pathSearch 			( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub			relPathSearch 		( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Sub		 	iconSearch 			( ByVal event As wxEvent Ptr, ByVal iListener As Long )
Declare Function 	getRelPath 			( path As String ) As String
Declare Sub		 	regenmenu		   	( ByVal menu As VWX_Menu Ptr, ByVal index As Integer )
Declare Sub		 	delsubmenu		  	( ByVal submenu As VWX_Menuitem Ptr )
Declare Function	menunode			( ByVal menu As wxMenu Ptr ) As VWX_Menu Ptr
Declare Sub		 	bitmapbutton_cb1	( )
'Declare Sub		 	bitmapbutton_cb2	( )
'Declare Sub		 	bitmapbutton_cb3	( )
'Declare Sub		 	bitmapbutton_cb4	( )
'Declare Sub		 	bitmapbutton_cb5	( )
'Declare Sub		 	bitmapbutton_cb6	( )
'Declare Sub		 	bitmapbutton_cb7	( )
'Declare Sub		 	bitmapbutton_cb8	( )
'Declare Sub		 	bitmapbutton_cb9	( )
'Declare Sub		 	bitmapbutton_cb10   ( )
'Declare Sub		 	bitmapbutton_cb11   ( )
'Declare Sub		 	bitmapbutton_cb12   ( )
'Declare Sub		 	bitmapbutton_cb13   ( )
'Declare Sub		 	bitmapbutton_cb14   ( )
'Declare Sub		 	bitmapbutton_cb15   ( )
'Declare Sub		 	bitmapbutton_cb16   ( )
'Declare Sub		 	bitmapbutton_cb17   ( )
'Declare Sub		 	bitmapbutton_cb18   ( )
'Declare Sub		 	bitmapbutton_cb19   ( )
'Declare Sub		 	bitmapbutton_cb20   ( )
'Declare Sub		 	bitmapbutton_cb21   ( )
'Declare Sub		 	bitmapbutton_cb22   ( )
'Declare Sub		 	bitmapbutton_cb23   ( )
'Declare Sub		 	bitmapbutton_cb24   ( )
Declare Sub		 	make_toolbar		( ByVal parent As Any Ptr, ByVal xml As xmlWidget Ptr = 0 )
Declare Sub		 	add_to_toolbar	  	( ByVal parent As Any Ptr, ByVal xml As xmlWidget Ptr = 0 )
Declare Sub		 	add_separator	   	( ByVal parent As Any Ptr )
Declare Function	get_toolbardata	 	( ByVal firstidx As Integer, ByVal secondidx As Integer ) As String
Declare Function	wxString_to_fbstring( ByVal wxstr As wxString Ptr ) As String
Declare Function	wxString_to_zstring ( ByVal wxstr As wxString Ptr ) As ZString Ptr

''
'' inter-module globals
''
	Extern As VWX_Widget Ptr selected
	'Extern As VWX_Menuitem Ptr selecteditem
	'Extern As VWX_Menu Ptr selectedmenu
	Extern As wxApp Ptr wx_app
	Extern As wxFrame Ptr wx_frame, proj
	Extern As wxFileDialog Ptr dlg
	Extern As Integer curtool, gridsize, boxsize, boxsel
	Extern As Any Ptr mylist
	Extern As wxBitmapButton Ptr grid, offgrid
	Extern As wxImage Ptr gridparts( 0 To 3 )
	Extern As wxButton Ptr delbut, updbut, evntbut
	Extern As wxTextCtrl Ptr toolText
	
	Extern As AppProperties app
	
	Extern As TLIST widgetlist, menulist
	Extern As ZString Ptr events( 197 )
	
	Extern As Byte gridon
	Extern As wxPanel Ptr projpn
	Extern As wxMenu Ptr gridmenu, menu2, menu3
	'Extern As wxCheckbox Ptr menu_on, toolbar_on
	Extern As wxMenuBar Ptr menub
	'Extern As wxBitmapButton Ptr bitbuttons( /'1 To 24'/ )
	Const VXW_BOXES = 4	
	Extern As wxBitmapButton Ptr boxes(0 To VXW_BOXES - 1)
	
	
#EndIf '' __VWXCDES_BI__
