#include Once "window9.bi"

Function Comboboximagegadget( iGadget As Long , x As Long, y As Long, width_ As Long, height_ As Long  , iSizeIcon As Long = 0, iStyle As Long = 0 ) As Hwnd Export
	
	Dim As HWND combo , vBox , mainBox
	
	Dim As GtkListStore Ptr liststore
	
	Dim As GtkCellRenderer Ptr renderer
	
	Dim As ListT Ptr pListTemp
	
	Freegadget(iGadget)
	
	pGlobalTypeWindow9->OptGroup = 0 ' reset Group OptionGadget
	
	pListTemp = Cast(ListT Ptr,pGlobalTypeWindow9->ListWinAndContainers->findNodeFunc(Cint(pGlobalTypeWindow9->CurentHwnd)))
	
	mainBox = Cast(hwnd , pListTemp->anyTwoData)	
	
	vbox = gtk_fixed_new()
	
	gtk_container_add (GTK_CONTAINER(mainBox), vbox)	
	
	liststore = gtk_list_store_new(2, GDK_TYPE_PIXBUF, G_TYPE_STRING)
	
	combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(liststore))
	
	g_object_unref(liststore)
	
	renderer = gtk_cell_renderer_pixbuf_new()
	
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, False)
	
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer ,"pixbuf", 0, NULL)		
		
	renderer = gtk_cell_renderer_text_new()
	
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, True)
	
	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer ,  "text", 1, NULL)	
	
	pGlobalTypeWindow9->ListGadgets->addNodeSub(iGadget , Cint(combo) ,  14)
	
	gtk_widget_set_size_request(combo, width_, height_)
	
	gtk_fixed_put(GTK_FIXED(vbox), combo, x , y)
	
	g_object_set_data (Cast(Any Ptr, combo), "X_SIZE" , Cast(Any Ptr,Cint(x)))
	
	g_object_set_data (Cast(Any Ptr, combo), "Y_SIZE" , Cast(Any Ptr,Cint(y)))
	
	g_object_set_data (Cast(Any Ptr, combo), "W_SIZE" , Cast(Any Ptr,Cint(width_)))
	
	g_object_set_data (Cast(Any Ptr, combo), "H_SIZE" , Cast(Any Ptr,Cint(height_)))	
	
	tree_add_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)
	
	Dim As Node Ptr fNode = tree_find_node(iGadget,pGlobalTypeWindow9->treeNumberGadgets)	
	
	g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK (@EventsComboBoxGadgetSub), @(fNode->x))
	
	g_signal_connect(G_OBJECT(combo), "size-allocate", G_CALLBACK (@size_allocate_signals), @(fNode->x))
	
	gtk_widget_show(vbox)
	
	gtk_widget_show(combo)
	
	Return combo
	
End Function