caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Help on a port of GtkDatabox with lablgtk
@ 2006-10-05 21:14 j.romildo
  2006-10-06  5:53 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 2+ messages in thread
From: j.romildo @ 2006-10-05 21:14 UTC (permalink / raw)
  To: lablgtk, caml-list

Hello.

The GtkDatabox library (http://www.eudoxos.net/gtk/gtkdatabox/) defines
the folowing class hierarchy:

   GObject
      GtkDataboxGraph
         GtkDataboxXYCGraph
	     GtkDataboxPoints
            GtkDataboxLines
            GtkDataboxMarker
               GtkDataboxCrossSimple
            GtkDataboxBars
	     GtkDataboxGrid

   GtdDrawingArea
      GtkDatabox

The class GtkDatabox has the method add, whose C prototype is

   gboolean 
   gtk_databox_graph_add (GtkDatabox *box, GtkDataboxGraph *graph)

I am attempting to port the library to ocaml using lablgtk (the latest
snapshot: lablgtk2-20060908).

Therefore I have the following definitions in ocaml:

   module T = struct
     type databox = [Gtk.drawing_area|`databox]
     type graph = [`graph]
     type xyc = [graph|`xyc]
     type points = [xyc|`points]
   end

   external graph_add
     : [> T.databox] Gtk.obj -> [> T.graph] Gobject.obj -> bool
     = "ml_gtk_databox_graph_add"

   class virtual graph (obj : [> T.graph] Gobject.obj) = object
     method as_graph : T.graph Gobject.obj = obj
   end

   class xyc (obj : [> T.xyc] Gobject.obj) = object
     inherit graph obj
   end

   class databox (obj : [> T.databox] Gtk.obj) = object
     inherit [_] GObj.widget_impl obj
     method as_databox : T.databox Gtk.obj = obj
     method add g = graph_add obj g#as_graph
   end

The code is simplified, as at the moment I am not interesting in the
properties and signals of GtkDatabox, as well as the functions to create
the objects of the relevant classes.

Unfortunatly I was not clever enough to write correct ocaml code, hence
it is not accepted by the compiler, which says:

  $ ocamlopt -I . -c -i databox.ml
  File "databox.ml", line 19, characters 16-19:
  This expression has type ([> T.xyc ] as 'a) Gobject.obj
  but is here used with type T.graph Gobject.obj
  Type 'a = [> `graph | `xyc ] is not compatible with type T.graph = [ `graph ]

And finally I coming to these mailing lists to ask for help on how to
solve this problem.

I am willing also get advices on how to conduct this port.

Regards,

Romildo

PS: Unfortunatly I am short of time, and would like to get answers as
    soon as possible. But I do not want to make pressure on you. Anyway
    it is still better to get delayed answers, that no answer at all.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-06  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-05 21:14 Help on a port of GtkDatabox with lablgtk j.romildo
2006-10-06  5:53 ` [Caml-list] " Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).