caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: j.romildo@gmail.com
To: lablgtk@math.nagoya-u.ac.jp, caml-list@inria.fr
Cc: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Subject: GtkHRuler and GtkVRuler properties on new widgets
Date: Fri, 6 Oct 2006 08:49:32 -0300	[thread overview]
Message-ID: <20061006114932.GA22803@malaquias.gwiceb1> (raw)

Hi.

I am still working on the port of GtkDatabox to lablgtk. This time I am
having difficults with two properties of the GtkDatabox widget: "hruler"
and "vruler". Probably the difficults come from the fact that lablgtk
does not have one class for each of GtkRuler, GtkHRuler and GtkVRuler,
but only a single class: GRange.ruler.

So far I have the following definitions. Please, look where I have
annoted with the comment (* is this correct? *), and see if I am doing it
right.


(* gtkDatabox.props *)

   prefix "Gtk"

   header {
     type databox_t = [Gtk.drawing_area|`databox]
   }

   classes {
     GtkAdjustment "Gtk.adjustment obj"
     GtkHRuler "Gtk.ruler Gtk.obj"         (* is this correct? *)
     GtkVRuler "Gtk.ruler Gtk.obj"         (* is this correct? *)
   }

   class Databox type "databox_t Gtk.obj" set wrap wrapsig : DrawingArea {
     "enable-selection"   gboolean        : Read / Write
     "enable-zoom"        gboolean        : Read / Write
     "hadjustment"        GtkAdjustment   : Read / Write
     "vadjustment"        GtkAdjustment   : Read / Write
     "hruler"             GtkHRuler       : Read / Write     (* is this correct? *)
     "vruler"             GtkVRuler       : Read / Write     (* is this correct? *)

     signal selection_changed
   }


(* gDatabox.mli *)

   class databox_signals : 'a Gtk.obj ->
   object
     inherit GObj.widget_signals
     constraint 'a = [> GtkDatabox.databox]
     val obj : 'a Gtk.obj
     method selection_changed : callback:(unit -> unit) -> GtkSignal.id
   end
     
   class databox : 'a Gtk.obj ->
   object
     inherit GObj.widget
     constraint 'a = [> GtkDatabox.databox]
     val obj : 'a Gtk.obj
     method as_databox : GtkDatabox.databox Gtk.obj
     method enable_selection : bool
     method set_enable_selection : bool -> unit
     method enable_zoom : bool
     method set_enable_zoom : bool -> unit
     method hadjustment : GData.adjustment
     method set_hadjustment : GData.adjustment -> unit
     method vadjustment : GData.adjustment
     method set_vadjustment : GData.adjustment -> unit
     method hruler : GRange.ruler                          (* is this correct? *)
     method set_hruler : GRange.ruler -> unit              (* is this correct? *)
     method vruler : GRange.ruler                          (* is this correct? *)
     method set_vruler : GRange.ruler -> unit              (* is this correct? *)
     method event : GObj.event_ops
     method connect : databox_signals
   end

   val databox :
     ?packing:(GObj.widget -> unit) ->
     ?show:bool ->
     unit ->
     databox
      
(* gDatabox.ml *)

   open GObj

   open GtkDatabox
   open OgtkDataboxProps

   class databox_signals  (obj : [> GtkDatabox.databox] Gtk.obj) = object
     inherit GObj.widget_signals_impl obj
     inherit databox_sigs
   end

   class databox (obj : [> GtkDatabox.databox] Gtk.obj) = object
     inherit [_] GObj.widget_impl obj
     method as_databox : GtkDatabox.databox Gtk.obj =
        (obj :> GtkDatabox.databox Gobject.obj)
     inherit databox_props
     method event = new GObj.event_ops obj
     method connect = new databox_signals obj
   end

   let databox ?packing ?show () =
     let w = Databox.create [] in
       pack_return (new databox w) ~packing ~show

Compilation fails with the message:

   $ make opt
   [...]
   ocamlc.opt -I +lablGL  -w s -c gDatabox.ml
   The implementation gDatabox.ml does not match the interface gDatabox.cmi:
   Class declarations do not match:
     class databox :
       ([> GtkDataboxProps.databox_t ] as 'a) Gtk.obj ->
       object
         val obj : 'a Gtk.obj
         method add : graph -> bool
         method as_databox : GtkDatabox.databox Gtk.obj
         method as_widget : Gtk.widget Gtk.obj
         method coerce : GObj.widget
         method connect : databox_signals
         method destroy : unit -> unit
         method drag : GObj.drag_ops
         method enable_selection : bool
         method enable_zoom : bool
         method event : GObj.event_ops
         method get_oid : int
         method hadjustment : GData.adjustment
         method hruler : Gtk.ruler Gtk.obj
         method misc : GObj.misc_ops
         method private obj : 'a Gtk.obj
         method set_enable_selection : bool -> unit
         method set_enable_zoom : bool -> unit
         method set_hadjustment : GData.adjustment -> unit
         method set_hruler : Gtk.ruler Gtk.obj -> unit
         method set_vadjustment : GData.adjustment -> unit
         method set_vruler : Gtk.ruler Gtk.obj -> unit
         method vadjustment : GData.adjustment
         method vruler : Gtk.ruler Gtk.obj
       end
   does not match
     class databox :
       ([> GtkDatabox.databox ] as 'a) Gtk.obj ->
       object
         val obj : 'a Gtk.obj
         method add : graph -> bool
         method as_databox : GtkDatabox.databox Gtk.obj
         method as_widget : Gtk.widget Gtk.obj
         method coerce : GObj.widget
         method connect : databox_signals
         method destroy : unit -> unit
         method drag : GObj.drag_ops
         method enable_selection : bool
         method enable_zoom : bool
         method event : GObj.event_ops
         method get_oid : int
         method hadjustment : GData.adjustment
         method hruler : GRange.ruler
         method misc : GObj.misc_ops
         method set_enable_selection : bool -> unit
         method set_enable_zoom : bool -> unit
         method set_hadjustment : GData.adjustment -> unit
         method set_hruler : GRange.ruler -> unit
         method set_vadjustment : GData.adjustment -> unit
         method set_vruler : GRange.ruler -> unit
         method vadjustment : GData.adjustment
         method vruler : GRange.ruler
       end
   The method hruler has type Gtk.ruler Gtk.obj but is expected to have type
     GRange.ruler
   Type Gtk.ruler Gtk.obj = Gtk.ruler Gobject.obj is not compatible with type
     GRange.ruler =
       < as_widget : Gtk.widget Gtk.obj; coerce : GObj.widget;
         connect : GObj.widget_signals; destroy : unit -> unit;
         drag : GObj.drag_ops; event : GObj.event_ops; get_oid : int;
         lower : float; max_size : float; misc : GObj.misc_ops;
         position : float; set_lower : float -> unit;
         set_max_size : float -> unit;
         set_metric : Gtk.Tags.metric_type -> unit;
         set_position : float -> unit; set_upper : float -> unit;
         upper : float > 
   make: *** [gDatabox.cmo] Error 2
      
I will be grateful for any help on this problem.

Regards,

Romildo


                 reply	other threads:[~2006-10-06 11:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061006114932.GA22803@malaquias.gwiceb1 \
    --to=j.romildo@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    --cc=lablgtk@math.nagoya-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).