Adding self-defined widgets to HUG
Jun 15, 2018 17:58:28 GMT 1
Post by bigbass on Jun 15, 2018 17:58:28 GMT 1
Wanted to make Peter's excellent old 2012 thread bumped up how to add to HUG
read page 1 of this thread for the inside story of how to add new widgets when not in the official HUG
Hey guys
Here is the new linkbutton widget for HUG!
Attachment Deleted
reference link HUG
REGISTER
reference link gtk3 source
gtk3 source
Joe
read page 1 of this thread for the inside story of how to add new widgets when not in the official HUG
Hey guys
Here is the new linkbutton widget for HUG!
Attachment Deleted
reference link HUG
REGISTER
reference link gtk3 source
gtk3 source
Joe
'--- link2hug.bac
'--- added the gtk linkbutton to HUG
'--- Ported from the gtk3 gnome offical demo to BaCon in (gtk2) by bigbass
'--- https://developer.gnome.org/gnome-devel-demos/unstable/linkbutton.c.html.es
INCLUDE "hug.bac"
CONST gtk$ = HUGLIB$("gtk")
OPTION PARSE FALSE
IMPORT "gtk_link_button_new(char*)" FROM gtk$ TYPE long
'--- gtk_link_button_set_uri not needed when used with HUG in this example
IMPORT "gtk_link_button_set_uri(long,char*)" FROM gtk$ TYPE void
' --------------------------------------------------------------
FUNCTION LINKBUTTON(int hug_xsize, int hug_ysize, STRING linkname$)
' --------------------------------------------------------------
LOCAL widget ,linkbutton
' create the linkbutton
widget = gtk_link_button_new (linkname$)
' register and determine size and signal
REGISTER(widget, hug_xsize, hug_ysize, "clicked",0, 0, 0, 0)
RETURN widget
END FUNCTION
window = WINDOW( "NEW HUG LinkButton", 400 ,300)
linkbutton = LINKBUTTON(300, 50 ,"http://www.basic-converter.org/doc_frame.html")
linkbutton2 = LINKBUTTON(300, 50 ,"http://www.basic-converter.proboards.com")
linkbutton3 = LINKBUTTON(300, 50 ,"http://www.basic-converter.org/")
'--- fix alignment problems so that you don't need to use negative numbers
SETPROPERTY(linkbutton, "xalign", 0)
SETPROPERTY(linkbutton2, "xalign", 0)
SETPROPERTY(linkbutton3, "xalign", 0)
ATTACH(window,linkbutton,0,10)
ATTACH(window,linkbutton2,0,60)
ATTACH(window,linkbutton3,0,110)
CALLBACK(window,LINKBUTTON)
DISPLAY