#include Once "window9.bi"

Function Addpanelgadgetitem (iGadget As Long , iItem As Long , sText As String , IDImage As HBITMAP = 0 , iFlag As Long = 0 ) As HWND  Export
	
	Dim As HWND LayoutContainer , label
	
	Dim As Long iWidth , iHeight
	
	Dim As Any Ptr panel = Gadgetid(iGadget) , hBox
	
	iWidth = Gadgetwidth(iGadget)
	
	iHeight = Gadgetheight(iGadget)
	
	LayoutContainer = gtk_layout_new (0,0)	
	
	label = gtk_label_new (Strptr(sText))

    hbox = gtk_hbox_new (0, 0)
    
    If IDImage Then
	
    	gtk_box_pack_start (GTK_BOX(hbox),gtk_image_new_from_pixbuf(IDImage), True, True,0)

    Endif
    
    gtk_box_pack_start (GTK_BOX(hbox),label, True, True, 0)

	gtk_widget_show (hbox)
	
	gtk_widget_show (label)
	
	gtk_widget_show (LayoutContainer)
	
	gtk_notebook_insert_page (GTK_NOTEBOOK (panel), LayoutContainer , hbox , iItem)	
	
	gtk_notebook_set_tab_reorderable(panel , LayoutContainer , 1)
	
	gtk_widget_set_size_request(LayoutContainer, iWidth, iHeight)
	
	pGlobalTypeWindow9->ListWinAndContainers->addNodeSub( Cint(LayoutContainer) , Cint(LayoutContainer) )
	
	g_object_set_data (Cast(Any Ptr,LayoutContainer), "widget"  , Cast(Any Ptr ,@"layout"))
	
	#ifdef __USE_GTK3__
		
		g_signal_connect(LayoutContainer, "draw", G_CALLBACK(@DrawColorLayoutFunc), NULL)
		
	#endif
	
	If iFlag = 1 Then
		
		Usegadgetlist(LayoutContainer)
		
	Endif
	
	gtk_widget_modify_font ( label , pGlobalTypeWindow9->fontCurent)	
	
	Return LayoutContainer
	
End Function