PB for Windows binding to GTK?

Everything else that doesn't fall into one of the other PB categories.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

:D
@}--`--,-- A rose by any other name ..
BasicGuy
User
User
Posts: 70
Joined: Sat Apr 26, 2003 4:37 am
Location: US

Post by BasicGuy »

It's planned to add support for GTK framework for Windows as it's done for Linux and MacOS. It will be of course optional, and not the default tooltik. It will allow 1:1 port trough all plateforms. The compiler subsystem system is already implemented in the linux compiler, as the next linux version will support GTK1.2 and GTK2 trough a compiler switch (easy, easy...), so it's only a matter of time to have the same on Windows.
Oh yeah! Thx Fred! Man, PB is just getting better and better! :D
Leo
User
User
Posts: 21
Joined: Sat Aug 02, 2003 8:48 pm
Location: Netherlands, Wijk bij Duurstede

Post by Leo »

It is possible to run GTK+ 2 and libglade under windows. I installed Win GTK 2.4.14 and Win Gimp 2.2.0 and checked if Win Gimp was running correctly.

Then I made with Win Glade the following simple xml file

Code: Select all

<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkWindow" id="window1">
  <property name="visible">True</property>
  <property name="title" translatable="yes">GTK Test</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>

  <child>
    <widget class="GtkButton" id="button1">
      <property name="visible">True</property>
      <property name="can_focus">True</property>
      <property name="label" translatable="yes">MessageRequester</property>
      <property name="use_underline">True</property>
      <property name="relief">GTK_RELIEF_NORMAL</property>
      <property name="focus_on_click">True</property>
    </widget>
  </child>
</widget>

</glade-interface>
and ran the next simple program

Code: Select all

#GTK_WINDOW_TOPLEVEL      = 0
Procedure hello(widget, wdata)
  MessageRequester ("MessageRequester","clicked",0)
EndProcedure

If OpenLibrary(10,"libgtk-win32-2.0-0.dll") And OpenLibrary(11,"libglade-2.0-0.dll") And OpenLibrary(12,"libgobject-2.0-0.dll") 
  CallFunction(10,"gtk_init",0,0)
  CallFunction(11,"glade_init")
  xml=CallFunction(11,"glade_xml_new","GTKTest.glade",0)
  *window1=CallFunction(11,"glade_xml_get_widget",xml,@"window1")
  *button1=CallFunction(11,"glade_xml_get_widget",xml,@"button1")
  CallFunction(12,"g_signal_connect_data",*button1,@"clicked",@hello(),0,0,0) 
  CallFunction(10,"gtk_widget_show_all",*window1)
  CallFunction(10,"gtk_main")
EndIf
 
It was working.

I tried to import the Dll's with the DLL Importer but that goes wrong due to more than 1 dot in the dll name (See my bug report on the issue). GTK+ was written for C and they use sometimes #define statements for functions, e.g. the g_signal_connect function is defined as a special case of the g_signal_connect_data function. So if you can not find a function in the dll then grep the *.h files to see if there is a (re)define.

Greetings and the best for 2005,

Leo
FloHimself
Enthusiast
Enthusiast
Posts: 229
Joined: Wed May 14, 2003 3:38 pm
Location: Lüneburg - Germany

Post by FloHimself »

very nice!

as this is a interesting topic, maybe someone can use this one.
with xchat (http://www.xchat.org/windows/) comes a dll called
minigtk.dll with a size around 512kb. sources can be
found here at http://www.xchat.org/files/binary/win32/libs/
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Num3 wrote:I've asked for this API a long time ago, Windows, Unux, Mac, PalmOs....

http://www.wxwindows.org/
No, please not, the OpenGL examples look horrible.
bye,
Daniel
Post Reply