#include Once "window9.bi"

Function closeWindowFunc Cdecl(Gwindow As HWND, event_ As GdkEvent Ptr, data_ As gpointer) As gBoolean Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventclose
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Return True
	
End Function

Function focusWindowFunc Cdecl(Gwindow As HWND, event_ As GdkEvent Ptr, data_ As gpointer) As gBoolean Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventactivate
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Return False
	
End Function

Function mouseMoveWindowFunc Cdecl (Gwindow As GtkWidget Ptr, event_ As GdkEvent  Ptr,  user_data As gpointer ) As gboolean Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = Cast(GdkEventMotion Ptr, event_)->state
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = MAKELONG(Cast(GdkEventMotion Ptr, event_)->x , Cast(GdkEventMotion Ptr, event_)->y)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmousemove
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Return False
	
End Function

Sub resizeWindowSub Cdecl(Gwindow As GtkWidget Ptr, allocation As GdkRectangle Ptr, user_data As gpointer)
	
	Dim As gint x , y
	
	gtk_window_get_position (GTK_WINDOW(Gwindow) , @x, @y)
	
	Dim As gint iCaption , iBorder
	
	Getwindowscaptionbordersize( Gwindow , @iCaption , @iBorder)
	
	pGlobalTypeWindow9->Sizex = allocation->Width
	
	pGlobalTypeWindow9->Sizey = allocation->Height	
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "W_SIZE" , Cast(Any Ptr,Cint(allocation->Width + 2*iBorder)))
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "H_SIZE" , Cast(Any Ptr,Cint(allocation->Height + 2*iBorder + iCaption)))		
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventsize
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
End Sub

Function configureWindowSub Cdecl(Gwindow As GtkWidget Ptr, ev As GdkEventConfigure Ptr, user_data As gpointer) As gboolean
	
	Dim As gint x , y
	
	gtk_window_get_position (GTK_WINDOW(Gwindow) , @x, @y)
	
	Dim As gint iCaption , iBorder
	
	Getwindowscaptionbordersize( Gwindow , @iCaption , @iBorder)
	
	pGlobalTypeWindow9->Sizex = ev->Width
	
	pGlobalTypeWindow9->Sizey = ev->Height	
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "W_SIZE" , Cast(Any Ptr,Cint(ev->Width + 2*iBorder)))
	
	g_object_set_data (Cast(Any Ptr, Gwindow), "H_SIZE" , Cast(Any Ptr,Cint(ev->Height + 2*iBorder + iCaption)))	
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmove
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Sendnullevent()	
	
	Return False
	
End Function

Function mouseWheelWindowSub Cdecl (Gwindow As GtkWidget Ptr, event_ As GdkEventScroll  Ptr,  user_data As gpointer ) As gboolean Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmousewheel
	
	#ifdef __USE_GTK3__
		
		If event_->delta_x = -1 Or event_->delta_y = -1 Then
			
			pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = &h780000 Or event_->state
			
		Elseif event_->delta_x = 1 Or event_->delta_y = 1 Then
			
			pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = &hFF880000 Or event_->state
			
		Endif
		
	#else
		
		Select Case event_->direction 
				
			Case GDK_SCROLL_UP , GDK_SCROLL_RIGHT
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = &h780000 Or event_->state
				
			Case GDK_SCROLL_DOWN , GDK_SCROLL_LEFT
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = &hFF880000 Or event_->state				
				
		End Select 
		
	#endif	
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Return False
	
End Function

Function KeyPressWindowSub Cdecl (Gwindow As GtkWidget Ptr, event_ As GdkEventKey  Ptr,  user_data As gpointer ) As gboolean Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventkeydown
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = event_-> keyval
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = event_->hardware_keycode
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Return False
	
End Function


Function KeyReleaseWindowSub Cdecl (Gwindow As GtkWidget Ptr, event_ As GdkEventKey  Ptr,  user_data As gpointer ) As gboolean Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventkeyup
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = event_-> keyval
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = event_->hardware_keycode
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Return False
	
End Function

Function MousePressWindowSub Cdecl(Gwindow As HWND, event_ As GdkEventButton Ptr, data_ As gpointer) As gBoolean Export
	
	Static As Long iTime
	
	Dim As Long iFlag	
	
	If event_->Type = GDK_BUTTON_PRESS Andalso iTime <>  event_->Time Then
		
		Select Case event_->button
				
			Case 1
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventlbdown
				
			Case 2
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmbdown
				
			Case 3
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventrbdown
				
		End Select
		
		iTime =  event_->Time
		
		iFlag = 1
		
	Elseif 	event_->Type = GDK_BUTTON_RELEASE Andalso iTime <>  event_->Time Then
		
		Select Case event_->button
				
			Case 1
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventlbup
				
			Case 2
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmbup
				
			Case 3
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventrbup
				
		End Select	
		
		iTime =  event_->Time	
		
		iFlag = 1	
		
	Elseif event_->Type = GDK_2BUTTON_PRESS Then			
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventdblclick
		
		iFlag = 1
		
	Endif
	
	If iFlag = 1 Then
		
		Dim As Short x , y
		
		x = event_->x 
		
		y = event_->y
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = MAKELONG(x , y)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = event_->state
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif
		
	Endif	
	
	Sendnullevent
	
	Return False
	
End Function

Function timersfunc Cdecl(pData As gpointer) As Gboolean 
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, pData)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventtimer
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Return True
	
End Function

Function TimerSizeWinAfterCreatingSub Cdecl(pData As gpointer) As Gboolean 
	
	Static iCounter As Byte
	
	Dim As TWinSizeAfterCreating Ptr Twsac = Cast(TWinSizeAfterCreating Ptr , pData)
	
	Dim As gint iCaption , iBorder
	
	Dim As Long iWidth = Twsac->iWidth
	
	Dim As Long iHeight = Twsac->iHeight
	
	Dim As Hwnd hw = Twsac->hw
	
	Getwindowscaptionbordersize(hw  , @iCaption , @iBorder )
	
	iWidth = iWidth - 2*iBorder
	
	iHeight = iHeight - (2*iBorder + iCaption)
	
	If iWidth > 0  Andalso iHeight > 0 Then
		
		gtk_window_resize(GTK_WINDOW(hw), iWidth, iHeight)
		
	Endif
	
	If iCounter > 10 Then
		
		Delete Twsac
		
		Return False
		
	Else
		
		iCounter +=1
		
		Return True
		
	Endif
	
End Function

Sub size_allocate_signals Cdecl(Gwindow As GtkWidget Ptr, allocation As GdkRectangle Ptr, user_data As gpointer)
	
	Dim As Any Ptr pWidget = Gadgetid(*Cast(Long Ptr, user_data))
	
	g_object_set_data (Cast(Any Ptr, pWidget), "X_SIZE" , Cast(Any Ptr,Cint(allocation->x)))
	
	g_object_set_data (Cast(Any Ptr, pWidget), "Y_SIZE" , Cast(Any Ptr,Cint(allocation->y)))
	
	g_object_set_data (Cast(Any Ptr, pWidget), "W_SIZE" , Cast(Any Ptr,Cint(allocation->Width)))
	
	g_object_set_data (Cast(Any Ptr, pWidget), "H_SIZE" , Cast(Any Ptr,Cint(allocation->height)))
	
End Sub

Sub EventsButtonClickSub Cdecl(Gwindow As HWND,  data_ As gpointer) Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, data_)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Sendnullevent()
	
End Sub

Function EventsImageGadgetAllFunc Cdecl( ImageWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1 Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = ImageWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif
		
		Sendnullevent()	
		
	Endif
	
	Return False
	
End Function

Function EventsTextGadgetAllFunc Cdecl( TextWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1 Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = TextWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif
		
		Sendnullevent()
		
	Endif	
	
	Return False
	
End Function

Function EventsStringGadgetAllFunc Cdecl( StringWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If (gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1) Orelse gEvent->Type = GDK_KEY_PRESS Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = StringWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif	
		
		Sendnullevent()
		
	Endif
	
	Return False
	
End Function

Sub EventsSpinGadgetSub Cdecl( spin As GtkSpinButton Ptr, user_data As gpointer) Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Cast(Any Ptr,spin)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Sendnullevent()
	
End Sub

Function EventsCalendarGadgetAllFunc Cdecl( CalendarWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1 Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = CalendarWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif	
		
		Sendnullevent()		
		
	Endif
	
	Return False
	
End Function

Function EventsCheckBoxGadgetAllFunc Cdecl( CheckBoxWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1 Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = CheckBoxWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif	
		
		Sendnullevent()	
		
	Endif
	
	Return False
	
End Function

Function EventsOptionGadgetAllFunc Cdecl( OptionWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1 Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = OptionWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif
		
		Sendnullevent()		
		
	Endif
	
	Return False
	
End Function

Function EventsHyperLinkGadgetAllFunc Cdecl( HyperWidget As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1 Then 
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = HyperWidget
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif
		
		Sendnullevent()	
		
	Elseif gEvent->Type = GDK_ENTER_NOTIFY Then
		
		Static As GdkCursor Ptr hand_cursor = 0
		
		If hand_cursor = 0 Then	      
			
			hand_cursor = gdk_cursor_new (GDK_HAND2)		
			
		Endif
		
		gdk_window_set_cursor(gtk_widget_get_window(HyperWidget),hand_cursor)
		
	Elseif gEvent->Type = GDK_LEAVE_NOTIFY Then	
		
		Static As GdkCursor Ptr  arrowcursor = 0
		
		If 	arrowcursor	 = 0 Then
			
			arrowcursor = 	gdk_cursor_new (GDK_ARROW)	
			
		Endif
		
		gdk_window_set_cursor(gtk_widget_get_window(HyperWidget),arrowcursor)		
		
	Endif
	
	Return False
	
End Function

Sub EventsTrackBarGadgetSub Cdecl( range As GtkRange Ptr, user_data As gpointer) Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Sendnullevent()
	
End Sub

Sub EventsComboBoxGadgetSub Cdecl( ComboWidget As hwnd, user_data As gpointer) Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = ComboWidget
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Sendnullevent()
	
End Sub

Sub EventsListBoxGadgetSub Cdecl( ListWidget As hwnd, user_data As gpointer) Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = ListWidget
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Sendnullevent()
	
End Sub

Function EventsEditorAllFunc Cdecl( text_view As hwnd, gEvent As GdkEvent Ptr, user_data As gpointer) As gboolean Export
	
	If gEvent->Type = GDK_BUTTON_PRESS Andalso (Cast(GdkEventButton Ptr,gEvent))->button = 1  Orelse gEvent->Type = GDK_KEY_PRESS Then 
		
		Dim As GtkTextIter  iterstart , iterend
		
		Dim As gint char_offset1 , char_offset2
		
		Dim As GtkTextBuffer Ptr  buffer
		
		buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( text_view ))
		
		char_offset1 = 0
		
		char_offset2 = -1   
		
		gtk_text_buffer_get_iter_at_offset (buffer,_
		@iterstart,_
		char_offset1)
		
		gtk_text_buffer_get_iter_at_offset (buffer,_
		@iterend,_
		char_offset2) 		
		
		gtk_text_buffer_remove_tag_by_name (buffer,"gui_tag_bg_fg",@iterstart,@iterend)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = text_view
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif	
		
		Sendnullevent()	
		
	Elseif gEvent->Type = GDK_MOTION_NOTIFY Orelse 	gEvent->Type = GDK_LEAVE_NOTIFY Then
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = text_view
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif	
		
		Sendnullevent()			
		
	Endif
	
	Return False
	
End Function

Sub EventActivateMenuSub Cdecl(itemMenu As GtkMenuItem Ptr, user_data As gpointer ) 
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Cast(Any Ptr,itemMenu)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = Cast(Integer,g_object_get_data (Cast(Any Ptr, user_data), "IDmenu"))
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmenu
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Sendnullevent()
	
End Sub

Sub EventbuttonInputBoxSub Cdecl(Gwindow As HWND,  data_ As gpointer) Export
	
	Dim As TinputBox Ptr tib = data_
	
	tib->sText = *gtk_entry_get_text(Cast(Any Ptr,tib->entry))
	
	gtk_dialog_response(Cast(Any Ptr, tib->dialog) , GTK_RESPONSE_OK)
	
End Sub

Function EventEntryInputBoxFunc Cdecl( Gwindow As hwnd, gEvent As GdkEvent Ptr, data_ As gpointer) As gboolean Export
	
	Dim As TinputBox Ptr tib = data_
	
	If tib->iFlag = 0 Andalso Cast(GdkEventButton Ptr,gEvent)->Type = GDK_BUTTON_PRESS Then
		
		gtk_entry_set_text(Cast(Any Ptr,tib->entry) , "")
		
		tib->iFlag = 1
		
	Endif
	
	Return False
	
End Function

Sub EventCursorChangesListViewGadgetSub Cdecl( ListWidget As hwnd, user_data As gpointer) Export
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = ListWidget
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = -1
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
	
	Sendnullevent()
	
End Sub

Sub EventColumnClickListViewGadgetSub Cdecl(column As GtkTreeViewColumn Ptr, data_ As gpointer) Export
	
	Dim As Integer iIndex = Cast ( Integer , g_object_get_data (Cast(Any Ptr,column), "IndexColumn"))
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, data_)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = iIndex
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Sendnullevent()
	
End Sub


Function MousePressListViewSub Cdecl(Gwindow As HWND, event_ As GdkEventButton Ptr, user_data As gpointer) As gBoolean Export
	
	Static As Long iTime
	
	Dim As Long iFlag	
	
	If event_->Type = GDK_BUTTON_PRESS Andalso iTime <>  event_->Time Then
		
		Select Case event_->button
				
			Case 1
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventlbdown
				
			Case 2
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmbdown
				
			Case 3
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventrbdown
				
		End Select
		
		iTime =  event_->Time
		
		iFlag = 1
		
	Elseif 	event_->Type = GDK_BUTTON_RELEASE Andalso iTime <>  event_->Time Then
		
		Select Case event_->button
				
			Case 1
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventlbup
				
			Case 2
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmbup
				
			Case 3
				
				pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventrbup
				
		End Select	
		
		iTime =  event_->Time	
		
		iFlag = 1	
		
	Elseif event_->Type = GDK_2BUTTON_PRESS Then			
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventdblclick
		
		iFlag = 1
		
	Endif
	
	If iFlag = 1 Then
		
		Dim As Short x , y
		
		x = event_->x 
		
		y = event_->y
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).param1 = MAKELONG(x , y)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = event_->state
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumberlistview = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumbertreeview = *Cast(Long Ptr, user_data)
		
		pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = Gwindow
		
		If pGlobalTypeWindow9->indexEvent < 1000 Then
			
			pGlobalTypeWindow9->indexEvent+=1
			
		Endif
		
	Endif	
	
	Sendnullevent()
	
	Return False	
	
End Function

Sub RowCollapsedTreeViewSub Cdecl (tree_view As GtkTreeView Ptr, iter As GtkTreeIter Ptr , path As GtkTreePath Ptr , user_data As gpointer) ' закрытие
	
	Dim As Any Ptr model = gtk_tree_view_get_model(tree_view)
	
	Dim As ListT Ptr pListTemp
	
	Dim As LinList Ptr imglist = Cast(Any Ptr, g_object_get_data (Cast(Any Ptr,model), "tree_img_list"))
	
	If iter->user_data Andalso imglist <> 0 Then
		
		pListTemp = Cast(ListT Ptr,imglist->findNodeFunc(Cint(iter->user_data)))
		
	Endif	
	
	If pListTemp <> 0 Andalso pListTemp->anyTwoData = iter->stamp Then
		
		gtk_tree_store_set(model, iter, 0 , pListTemp->anyThreeData ,  -1)
		
	Endif
	
End Sub

Sub RowExpandedTreeViewSub Cdecl (tree_view As GtkTreeView Ptr, iter As GtkTreeIter Ptr , path As GtkTreePath Ptr , user_data As gpointer)  ' открытие
	
	Dim As Any Ptr model = gtk_tree_view_get_model(tree_view)
	
	Dim As ListT Ptr pListTemp
	
	Dim As LinList Ptr imglist = Cast(Any Ptr, g_object_get_data (Cast(Any Ptr,model), "tree_img_list"))
	
	If iter->user_data Andalso imglist <> 0 Then
		
		pListTemp = Cast(ListT Ptr,imglist->findNodeFunc(Cint(iter->user_data)))
		
	Endif
	
	If pListTemp <> 0 Andalso pListTemp->anyTwoData = iter->stamp Then
		
		gtk_tree_store_set(model, iter, 0 , pListTemp->anyFourData ,  -1)
		
	Endif	
	
End Sub

Function AcceleratorPressedFunc Cdecl (accel_group As GtkAccelGroup Ptr, acceleratable As GObject Ptr,  keyval As guint,  modifier As GdkModifierType , iUserData As Integer Ptr) As Gboolean
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = 0
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = Cint(iUserData)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventmenu
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif
	
	Sendnullevent()
	
	Return True
	
End Function

Sub StatusBarSizeSub Cdecl (win As GtkWidget Ptr, allocation As GdkRectangle Ptr, user_data As gpointer)
	
	Static As Long w ,h
	
	Dim As Byte bFlag
	
	Dim As GdkRectangle rect
	
	Dim As Long iHeightStatusbar = Cint(g_object_get_data (Cast(Any Ptr, user_data), "H_SIZE"))
	
	If w <> allocation->Width Then
		
		w = allocation->Width
		
		bFlag = 1
		
	Endif
	
	If h <> allocation->Height Then
		
		h = allocation->Height
		
		bFlag = 1
		
	Endif	
	
	If bFlag Then
		
		gtk_fixed_move(GTK_FIXED(gtk_widget_get_parent(user_data)), user_data, 0 , h-iHeightStatusbar)
		
		gtk_widget_set_size_request(user_data, w ,	iHeightStatusbar)
		
		g_object_set_data (Cast(Any Ptr, user_data), "W_SIZE" , Cast(Any Ptr,Cint(w)))
		
		g_object_set_data (Cast(Any Ptr, user_data), "H_SIZE" , Cast(Any Ptr,Cint(iHeightStatusbar)))	
		
	Endif
	
End Sub

Function TabsChangePageFunc Cdecl(notebook As Any Ptr, arg1 As gpointer , arg2 As guint , user_data As gpointer) As gboolean
		
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).w = notebook
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).Eventnumber = *Cast(Long Ptr, user_data)
	
	pGlobalTypeWindow9->DIMSTOREEVENT(pGlobalTypeWindow9->indexEvent).event_ = Eventgadget
	
	If pGlobalTypeWindow9->indexEvent < 1000 Then
		
		pGlobalTypeWindow9->indexEvent+=1
		
	Endif	
		
	Sendnullevent()
	
	Return False
	
End Function

Function DrawColorLayoutFunc(pwidget As GtkWidget Ptr, cr As cairo_t Ptr,  p As gpointer) As gboolean
	
	Dim As GdkColor TcolorBg
	
	Dim As Double x, y, w, h
	
	Dim As Long iColor , iFlagColor
	
	iFlagColor = Cast(Integer, g_object_get_data (Cast(Any Ptr,pWidget), "fcol"))
	
	If iFlagColor Then
		
		iColor = Cast(Integer, g_object_get_data (Cast(Any Ptr,pWidget), "color"))
		
		TcolorBg.red = Cast(Short,((iColor And &h000000FF)Shl 8) Or (iColor And &h000000FF))
		
		TcolorBg.blue = Cast(Short,((iColor And &h00FF0000) Shr 8) Or (iColor And &h00FF0000) Shr 16)
		
		TcolorBg.green = Cast(Short,(iColor And &h0000FF00) Or (iColor And &h0000FF00) Shr 8)
		
		cairo_clip_extents(cr, @x, @y, @w, @h)
		
		cairo_set_source_rgba (cr, TcolorBg.red/&hFFFF, TcolorBg.green/&hFFFF ,  TcolorBg.blue/&hFFFF, 1)
		
		cairo_rectangle(cr, x, y, w, h)
		
		cairo_fill(cr)
		
	Endif
	
	Return False	
	
End Function