#include Once "window9.bi"

Function Addsystrayicon(iNumberSysTray As Integer, hwnd As hwnd, hIcon As HBITMAP , sTooltip As String) As Integer Export
	
	Dim As GtkStatusIcon Ptr tray
	
	tray = gtk_status_icon_new_from_pixbuf(hIcon)
	
	#ifndef __USE_GTK3__ 
	
	gtk_status_icon_set_tooltip (tray, Strptr(sTooltip))
	
	#else
	
	gtk_status_icon_set_tooltip_text (tray, Strptr(sTooltip))
	
	#endif
	
	gtk_status_icon_set_visible(GTK_STATUS_ICON(tray), True)
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iNumberSysTray , Cint(tray) ,  25)
	
	tree_add_node(iNumberSysTray,pGlobalTypeWindow9->treeNumberGadgets)
	
	Setwindowproperty(Cast(Any Ptr ,tray) , "SYS_TRAY_INIT" ,  Cast(Any Ptr ,Cint(1)))
	
	g_signal_connect (tray, "button-press-event", G_CALLBACK(@MousePressWindowSub), 0)
	
	g_signal_connect (tray, "button-release-event", G_CALLBACK(@MousePressWindowSub), 0)
	
	Return Cint(tray)

End Function