G_ICON's for HUG
Dec 11, 2022 0:48:11 GMT 1
Post by alexfish on Dec 11, 2022 0:48:11 GMT 1
Hi All
Re: HUG buttn STOCK
From where I sit STOCK buttons do not display the icons
Also would like to have small (icon)buttons if real estate is limited
these throw a size warning but do work:: Updated fixed
bit of code
Have Fun
+
BR
Alex
list of icon name in archive, its a text file but has .bac ,hence BaCon gui open file will see it
Re: HUG buttn STOCK
From where I sit STOCK buttons do not display the icons
Also would like to have small (icon)buttons if real estate is limited
these throw a size warning but do work:: Updated fixed
gtk_image_new_from_icon_name
bit of code
INCLUDE "hug.bac",INIT,WINDOW,DISPLAY,STOCK,ATTACH,HUGLIB$,CALLBACK,QUIT
INIT
GTK$= HUGLIB$("gtk")
IMPORT "gtk_image_new_from_icon_name (char*,int)" FROM GTK$ TYPE long
IMPORT "gtk_icon_size_lookup(int,long,long)" FROM GTK$ TYPE int
'------------------------------
FUNCTION G_ICON(STRING hug_text$,int icon_size,int hug_size)
LOCAL image,ebox
image = gtk_image_new_from_icon_name(hug_text$,icon_size)
ebox = gtk_event_box_new()
' add image to event box
gtk_container_add(ebox, image)
IF HUG_WIDGET_SHOW THEN
gtk_widget_show_all(ebox)
END IF
hug_widget_xsize(STR$(ebox)) = hug_size
hug_widget_ysize(STR$(ebox)) = hug_size
hug_widget_s_widget(STR$(ebox)) = ebox
hug_widget_signal(STR$(ebox)) = 4
hug_widget_focus(STR$(ebox)) = image
RETURN ebox
END FUNCTION
'------------------------------
SUB OpenFile()
PRINT "open"
'rest of code here
END SUB
'------------------------------
win = WINDOW("test",600,400)
quit = G_ICON("window-close",4,16)
ATTACH(win,quit,600-20,400-20)
CALLBACK(quit,QUIT)
openf= G_ICON("document-open",4,16)
ATTACH(win,openf,3,3)
CALLBACK(openf,OpenFile)
DISPLAY
'------------------------------
Have Fun
+
BR
Alex
list of icon name in archive, its a text file but has .bac ,hence BaCon gui open file will see it