This is Tikiwiki v2.2 -Arcturus- © 2002–2008 by the Tiki community 2010/09/07 20:39 PDT

Menu [toggle]

Upcoming events

COBOL

Do you use COBOL?
OpenCOBOL 1.0
OpenCOBOL 1.1
OpenCOBOL Other
Other COBOL
Not Yet

View Results
(Votes: 112)

Forum: OpenCOBOL GTK+

Forums > OpenCOBOL GTK+ > How to proceed with a GTK+ layer
Print this page only Print all pages

How to proceed with a GTK+ layer


btiffin posts: 19 5 stars user offline Canada
For OpenCOBOL developers

How do we proceed with a binding/wrapper for GTK?

Comments, opinions, trials and tribulations. Everything is on the table and open for discussion.

For a small sample of proof of concept and a calendar widget call, please see:

opencobol.org (external link)

Cheers


btiffin posts: 19 5 stars user offline Canada
And now 'Vala'. The programming language Vala is going to accelerate this effort by orders of magnitude. A full webkit browser has already been embedded in OpenCOBOL. And that was simply using the Vala sample code. This is going to be fun.


btiffin posts: 19 5 stars user offline Canada
Added gtkhtml to the mix. Changes the higher level requirements quite a bit as there are lot of libraries required to run a browsing widget.

Initial screenshot generated from
      *> ***************************************************************
      *> Author:    Brian Tiffin 
      *> Date:      27-Dec-2008 
      *> Purpose:   Happy Birthday OpenCOBOL 
      *> Tectonics:
      *> gcc -c `pkg-config --cflags --libs libgnome-2.0 libgnomeui-2.0
      *>       gtk+-2.0 libgtkhtml-3.14` hellogtk.c
      *> cobc -lgtkhtml-3.14 -lgnomeui-2 -lSM -lICE -lglade-2.0
      *>      -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt
      *>      -lbonobo-2 -lbonobo-activation -lORBit-2 -lart_lgpl_2
      *>      -lgconf-2 -lgthread-2.0 -lrt -lgtk-x11-2.0 -lxml2
      *>      -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm
      *>      -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0
      *>      -lgmodule-2.0 -ldl -lglib-2.0 -x ocgtkhtml.cob hellogtk.o
      *> ***************************************************************
       identification division.
       program-id. ocgtkhtml.
 
       data division.
       working-storage section.
       01 result               usage binary-long.
       01 html-string          pic x(512) value
           "Happy Birthday 1.0 " &
           "OpenCOBOL 1.0!!" &
           "" & 
           "opencobol " &
           "Closebutton" &
           "" & x"00".
 
      *> ***************************************************************
       procedure division.
 
       call "CBL_OC_GTKHTML" using
           by reference html-string
           returning result
       end-call
 
       goback.
       end program ocgtkhtml.

produces

and the Happy Birthday part really only works on Dec 27th.

Cheers
Edit; All the HTML got stripped out of the listing.
it should look like
       01 html-string          pic x(512) value
           "<B><FONT COLOR=Blue>Happy Birthday 1.0</FONT> " &
           "<FONT COLOR=LimeGreen>OpenCOBOL 1.0!!</FONT></B><br />" &
           "<div align='center'><a href='http://opencobol.org'>" &
           "opencobol</a> <img src='file:smiley.png' />" &
           "<br /><br /><OBJECT CLASSID=close_button>Closebutton" &
           "</OBJECT></div>" & x"00".




btiffin posts: 19 5 stars user offline Canada
GTK+ progresses. Thin(ish) layer over the API. COBOL field accessor used where appropriate and fencing around the call arguments.

Windows, boxes for packing, callbacks, menus, buttons, text entry, file dialog ... so far

Cheers


btiffin posts: 19 5 stars user offline Canada
I think we have to choose (one or more) from the following options;

  • thin layer, creating a binding to as much low level API as feasible
    • Advantages
      • hides little of GTK+ from OpenCOBOL application writers
      • technically not difficult as it is mainly patterned wrapping
    • Disadvantages
      • burdens OpenCOBOL application writers with all of GTK+
      • quality control over the vast number of wrappers may be hard to manage
  • medium layering, intelligent exposure of thin and thick procedures
    • Advantages
      • removes some burden from application writers
    • Disadvantages
      • may take a few iterations to find a good balance
  • thick layering, an "easy win" toolkit
    • Advantages
      • little burden and rapid development potential for application designers
    • Disadvantages
      • little flexibility as options and decisions are hardcoded in the interface
  • expose widgets, simply expose the higher level pre-framed widgets

There are probably other paths that could be followed. I'll opine that a thick layer that uses a comprehensive thin layer might be a nice combination to offer.

Cheers

Show posts: