Page 1 of 1
Missing GTK+2 API
Posted: Mon Sep 10, 2012 12:33 pm
by grabiller
Hi,
As I'm working on an application that will be cross-platform (Windows/Linux/MacOSX), I'm starting to port my Windows GUI code to Linux in wich I'm using a lot of controls subclassing.
Having then started to learn the GTK+2 API, I've discovered that some functions are not recognized by PureBasic.
For instance, for a StringGadget (entry/editable under gtk), I've been able to use gtk_entry_get_layout_() to retrieve the PangoLayout but I've been unable to use gtk_entry_layout_index_to_text_index_() or gtk_entry_text_index_to_layout_index_() as those are not recognized by PureBasic.
What should I do to use/add to the list of recognized GTK+2 function by PureBasic ?
Thanks in advance,
Cheers,
Guy.
ps: I'm using PB 4.61 (x64) on Ubuntu 12.04.1
Re: Missing GTK+2 API
Posted: Mon Sep 10, 2012 12:49 pm
by Guimauve
Hello grabiller,
When you discover a
GTK API are not recognized by PureBasic you have to do something like this :
Code: Select all
ImportC "-gtk"
gdk_event_handler_set(*func, *mdata, *notify)
g_signal_connect(instance, signal.p-utf8, *fn, *vdata, destroy = 0, flags = 0) As "g_signal_connect_data"
g_object_set_data_(*Widget.GtkWidget, strData.p-utf8, *userdata) As "g_object_set_data"
g_object_get_data_(*Widget.GtkWidget, strData.p-utf8) As "g_object_get_data"
g_object_set_property_(*widget, Property.p-utf8, *val) As "g_object_set_property"
EndImport
Best regards
Guimauve
Re: Missing GTK+2 API
Posted: Mon Sep 10, 2012 1:18 pm
by grabiller
Ah, thanks a lot.
Is there a way to permanently add the functions into some PureBasic config/db files or something so we dont have to add the code or use additionnel includes files ?
Cheers,
Guy.
Re: Missing GTK+2 API
Posted: Mon Sep 10, 2012 1:24 pm
by Shardik
grabiller wrote:What should I do to use/add to the list of recognized GTK+2 function by PureBasic ?
You have to add these ImportC statements to your programs.
Code: Select all
ImportC ""
gtk_entry_layout_index_to_text_index(*Entry.GtkEntry, LayoutIndex.I)
gtk_entry_text_index_to_layout_index(*Entry.GtkEntry, TextIndex.I)
EndImport
grabiller wrote:Is there a way to permanently add the functions into some PureBasic config/db files or something so we dont have to add the code or use additionnel includes files ?
You should put these lines into an include file.
Re: Missing GTK+2 API
Posted: Mon Sep 10, 2012 7:16 pm
by grabiller
Yes, thanks.
I thought there was some way to include the missing apis into some config files for PureBasic to be permanently 'aware' of the new apis entries without ressorting to include files.
Cheers,
Guy.
Re: Missing GTK+2 API
Posted: Tue Sep 11, 2012 8:16 am
by Shardik
grabiller wrote:I thought there was some way to include the missing apis into some config files for PureBasic to be permanently 'aware' of the new apis entries without ressorting to include files.
One possibility would be to automatically add the ImportC statements by a special IDE tool to each new source file opened in the PB IDE. You will need PB 5.00 Beta 2 for this. Take a look into freak's posting:
http://www.purebasic.fr/english/viewtop ... 24&start=7
Re: Missing GTK+2 API
Posted: Tue Sep 11, 2012 3:51 pm
by grabiller
Hi,
Thanks for the info, indeed this will be very practical.
That said I've found the pbsoimporter tool wich seems to be the answer to my needs, I'll investigate further.
Cheers,
Guy.