Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Adrien <camaradetux@gmail.com>
To: OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Desktop GUI toolkits - current state of the art?
Date: Sun, 28 Nov 2010 23:20:22 +0100	[thread overview]
Message-ID: <AANLkTimW3UWYVL3-Bs-siHBtk1qbosKaY6wPEW47sEty@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinF9og-1rpLz1jwCFwxqyRiOmLaLZRJTiFL2ycK@mail.gmail.com>

Hi,

As Jacques said, lablgtk's api is close to gtk's one. I also believe
that was the best solution/approach. Binding that many C functions to
ocaml is already hard enough (not that it could be made easier, the
difficulty lies in the number of functions).

The drawback is of course that writing code using lablgtk is almost as
verbose as writing it directly in C with gtk.

Something nice would probably be to share more extensions and wrappers
around lablgtk. I've noticed Maxence Guesdon had made some available as
stand-alone libraries but I'm not aware of others. Or maybe they're
scattered around and it's hard to find them.


As far as I'm concerned I've started experimenting with the concept of
"tiling" (as used by tiling window managers) and zippers of horizontal
and vertical boxes. That's pretty much what xmonad (window manager
written in haskell) does. The zipper allows to nicely track the
"current" widget.


Next in my plans is a wrapper around treeviews/listviews and gtknotebook
to map a set of widgets to a list or tabs.


And, a last (long) point, a few months ago, I asked on this list about
lablgtk and FRP; I ended up doing something myself. It turned out that
my "lablgtk-react" is something like 50 lines of code. It's really
small and there wasn't much work, once you knew the guts of lablgtk and
gtk that is.

GTK defines properties and signals. Signals are regular "something
happened"-messages and properties are values stored inside objets. Each
property also defines a "${prop_name}::notify" signal that is emitted
each time the property is modified. This is unfortunately not exposed
through lablgtk but the connect_by_name function is enough.

Now, you may wonder whether FRP is *that* nice to use. One of the nicest
thing imho is the ability to use "fold":
  let zipper = React.E.fold (zipper x config t) Zipper.empty tabs in
This means it's possible to move away from imperative data structures
with all their disadvantages.

There is currently one issue however: the API is quite bad.
  install_sgn_event Entry.S.activate address_bar.as_e Signal.apply1
address_bar.activate
  (* Entry.S.activate is emitted by a text entry upon pressing Return
   * address_bar.as_e(ntry) returns the 'Gtk.entry Gtk.obj' because
   * its's not possible (yet) to use the object layer here
   * address_bar.activate is a potential previous signal handler for
   * active, we'd uninstall it before install another one *)

Ideally, it'll become something like:
  address_bar#react#activate#event

If you want to have a look at the module, I've put it on vpaste.net[1].
It's a bit old and several things have been changed but it still shows
how things are done.


[1] http://vpaste.net/Vrukn?


--

Adrien Nader


  reply	other threads:[~2010-11-28 22:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 14:19 Martin DeMello
2010-11-23 23:06 ` [Caml-list] " Jacques Garrigue
2010-11-24  9:33   ` Martin DeMello
2010-11-24 14:06     ` Michael Ekstrand
2010-11-24 15:56       ` Andrei Formiga
2010-11-23 23:28 ` Yoann Padioleau
2010-11-24  9:38   ` Martin DeMello
2010-11-26 19:09     ` Yoann Padioleau
2010-11-28  6:38       ` Martin DeMello
2010-11-28  7:40         ` Yoann Padioleau
2010-11-29 14:21           ` Martin DeMello
2010-11-23 23:32 ` Alain Frisch
2010-11-24  9:47   ` Martin DeMello
2010-11-24 15:57     ` Hezekiah M. Carty
2010-11-28  8:28       ` bluestorm
2010-11-28 22:20         ` Adrien [this message]
2010-11-29 13:20           ` Adrien
2010-11-29 14:02           ` Martin DeMello
2010-12-10  6:04             ` Maxence Guesdon
2010-11-29 16:47         ` Hezekiah M. Carty
2010-11-24 21:37     ` Alain Frisch
2010-11-24 22:32       ` Jeremy Yallop
2010-12-01 11:43     ` Alain Frisch
2010-11-24 10:21 ` Mihamina Rakotomandimby
2010-11-26 18:59 ` Richard Jones
2010-11-28  6:40   ` Martin DeMello

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=AANLkTimW3UWYVL3-Bs-siHBtk1qbosKaY6wPEW47sEty@mail.gmail.com \
    --to=camaradetux@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /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