Delivered-To: lablgtk at yquem.inria.fr Date: Thu, 30 Aug 2007 22:56:05 +0900 (JST) Message-Id: <20070830.225605.141243453.garrigue at math.nagoya-u.ac.jp> To: d0 at wp.pl Subject: Re: [Lablgtk] *.prop and *.var files (and a problem with mailing list) From: Jacques Garrigue In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: lablgtk at math.nagoya-u.ac.jp Content-Type: Text/Plain; charset=us-ascii Content-Length: 2720 From: Dawid Toton > Is there any explanation of *.prop files? What does propcc.ml4 do? (It's > really not easy for me to dig into it.) It is a way to generate automatically wrappers for properties and signals. For properties, you just have to copy the specification as given in the Gtk documentation, adding quotes around the property name. For signals, you have to use an intermediate syntax for the type, using ocaml types for base values and Gtk types for Gtk values. It should be enough to look at some examples to understand. The description of a Gkt object starts with class Button set wrap wrapsig : Bin { Bin is the superclass in the hierarchy. set indicates that by default all properties in this class can be set. wrap and wrapsig indicates which oo wrappers should be created: wrap creates a wrapper class for properties, wrapsig a wrapper class for signals. All these generated functions, in gtkButtonProps.ml and ogtkButtonProps.ml can then be used to write manually the GtkButton.ml file and the GButton.ml class file. The wrappers for Gtk methods are not automated, and you have to write them by hand: stub the C side, external declaration on the ml side, and a wrapper in the class file. Actually, the best example to look at is probably gtkAction.props, as GtkAction, like GtkPrintAction, is not a widget, so that the way to wrap it is a bit different. Note that in that case there is not even a gtkAction.ml file: all the low-level stuff is in the generated gtkActionProps.ml, and high-level code is in gAction.ml. > In gdkEvent.ml there is type timed defined this way: > type timed = [ `MOTION_NOTIFY | `BUTTON_PRESS ... > > But there are some GTK+ enums that have got special translation: > e. g. in pango_tags.var > type style = "PANGO_STYLE_" [ `NORMAL | `OBLIQUE | `ITALIC ] > > Why it is done so? When an enum should go into *.var files? > (Honestly, I don't understand why there are strings before variants - > what a language construct it is?) The constructor names in ML are those in the list, but the prefix is automatically added when translating to C. This lets you use shorter names, knowing that name conflicts do not occur with variants. > I'm currently preparing to compile LablGTK in order to add > GtkPrintOperation bindings. Could anyone briefly check ( > http://www.toton.2-0.pl/OCaml/GtkPrintOperation.xhtml ) whether am I > heading right direction? Thanks. Your conclusions seem mostly correct. Note however that you don't need to wrap gtk_print_operation_new, as propcc does it by default. Jacques _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk