Date: Tue, 15 May 2001 19:55:10 +0200 From: Benjamin Monate To: Jacques Garrigue Cc: labgtk , luther at dpt-info.u-strasbg.fr Subject: Re: Glade support Message-Id: <20010515195510.2dd27d22.Benjamin.Monate at lri.fr> In-Reply-To: <20010516002810A.garrigue at kurims.kyoto-u.ac.jp> References: <20010515113847.74211da1.Benjamin.Monate at lri.fr> <20010515184710E.garrigue@kurims.kyoto-u.ac.jp> <20010515124617.18099399.Benjamin.Monate@lri.fr> <20010516002810A.garrigue@kurims.kyoto-u.ac.jp> Organization: LRI Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Hi, I agree with you on many points. libglade and mlglade will be complementary. > For this to work, both libglade and mlglade stubs should be > compatible. A possible way to do that is making the basic interface a > simple class, where each method returns a widget in the > layout. Do you mean an object of a class like : class type my_app = object val window1 : GWindow.window val text1 : GEdit.text end I do not see how to plug the callbacks in this structure. I would prefer : class type virtual my_app = object val create_window1 : unit -> Gwindow.window method virtual gtk_main_quit : unit -> unit end Thus hiding away non toplevel widgets. They can always be accessed through callbacks using the object field. But maybe I misunderstood what you mean. Here is what mlglade produces on project1.glade in lablgtk examples (Menu are not yet supported): (*************************************************) (* glade_interface.ml *) (* THIS IS A GENERATED FILE : DO NOT EDIT ! *) let create_window1 () = let window1 = GWindow.window ~wm_name: "window1" ~position:`NONE ~kind:`TOPLEVEL ~modal:false ~allow_shrink:false ~allow_grow:true ~auto_shrink:false () in let vbox1 = GPack.vbox ~spacing:0 ~homogeneous:false ~packing:window1#add () in let scrolledwindow1 = GBin.scrolled_window ~hpolicy:`ALWAYS ~vpolicy:`ALWAYS ~packing:vbox1#pack () in let text1 = GEdit.text ~packing:scrolledwindow1#add ~editable:false () in let _ = text1#insert_text ~pos:0 "" in let _ = window1#coerce#misc#connect#destroy ~callback:(Glade_callbacks.gtk_main_quit ) in window1 (*****************************************************) (* glade_interface.mli *) (* THIS IS A GENERATED FILE : DO NOT EDIT ! *) val create_window1 : unit -> GWindow.window (*****************************************************) (* glade_callbacks.ml This file is partly autogenerated. You must change only between two BEGIN/END comments. ALL OTHER CHANGES WILL BE DISCARDED ! In case of problems you can use the .bak file.*) (* BEGIN prelude *) (*This is a default prelude*) (* END prelude *) let gtk_main_quit () = (* BEGIN gtk_main_quit *) prerr_endline "Event destroy";() (* END gtk_main_quit *) (* BEGIN postlude *) (*This is a default postlude.*) (* END postlude *) (*************************************************************) (* glade_main.ml *) open GMain let main () = let window1 = Glade_interface.create_window1 () in let _ = GtkBase.Widget.add_events window1#as_widget [`ALL_EVENTS] in let _ = window1#show() in Main.main () let _ = Printexc.print main () (************************************************************) and a standard makefile. This is very similar to the C code generated by glade. Do you have comments ? What class wuld you have as interface ? > > Anyway, if you have code ready, I would happily give you a CVS access, > so that you can add it to the distribution. This is possible but mlglade is still in a very preliminary stage. Isn't it too early ? Here is an approximation of what is implemented : windows : many properties are hanled and most of the messages. box handle_box status_bar separator button entry text tree label check_b scrolled_window viewport Some basic messages and a few properties of these widgets are implemented. I can open a CVS acces to this code if you are interested, but it is ugly an not ready for distribution right now. If you have some up to date code for lablgtk under CVS I would "gladly" have a look at it. As you say in the README glade support is "preliminary" in the distibution. Best Regards -- | Benjamin Monate | mailto:Benjamin.Monate@lri.fr | | LRI - Bât. 490 | http://www.lri.fr/~monate/ | | Université de Paris-Sud | phoneto: +33 1 69 15 42 32 | | F-91405 ORSAY Cedex | faxto: +33 1 69 15 65 86 |