Thanks.  The GTK port is officially off the ground, i.e. I've now at least got a
basic plot window up.  Now, to decipher gtkD's font API.

== Quote from "Jérôme M. Berger" (jeber...@free.fr)'s article
> This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
> --------------enigEB95B6E017DCC321C6AC57B2
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> dsimcha wrote:
> > =3D=3D Quote from dsimcha (dsim...@yahoo.com)'s article
> >> 1.  Doesn't Window mean that the plot would have to exist in its own w=
> indow?  I'd
> >> like to be able to make a plot go to one section of a larger window.
> >> 2.  When I do:
> >> drawable =3D (new DrawingArea(800, 600)).getWindow();
> >> drawable somehow ends up null.
> >=20
> > Never mind, I figured this stuff out, though the documentation is rathe=
> r obtuse
> > and in serious need of examples of how to accomplish simple things.  Ho=
> wever, I
> > can't get the DrawingArea to actually show up on the screen.  I just ge=
> t a blank
> > window.  Here's a reduced test case.  Can someone tell me what's wrong =
> w/ it
> > and/or provide minimal example code to get stuff drawn via DrawingArea =
> to show up
> > on screen?
> >=20
> > import gtk.DrawingArea, gtk.Main, gtk.MainWindow, gdk.GC, gdk.Drawable,=
> >     gdk.Color;
> >=20
> > void main(string[] args) {
> >     Main.init(args);
> >=20
> >     auto win =3D new MainWindow("Hello, world");
> >     win.setDefaultSize(800, 600);
> >     auto drawingArea =3D new DrawingArea(800, 600);
> >     win.add(drawingArea);
> >     drawingArea.realize();
> >=20
> >     auto drawable =3D drawingArea.getWindow();
> >     auto gc =3D new GC(drawable);
> >     gc.setForeground(new Color(255, 0, 0));
> >     gc.setBackground(new Color(255, 255, 255));
> >     drawable.drawLine(gc, 0, 0, 100, 100);
> >=20
> >     drawingArea.showAll();
> >     drawingArea.queueDraw();
> >     win.showAll();
> >=20
> >     Main.run();
> > }
>       The problem is that gtk.DrawingArea is stateless. This means that
> it won't remember what you draw on it. There are two solutions to this:
> - Use a Canvas widget. There isn't one in gtk, but there are some
> options out there. I don't know if any of them have a D wrapper;
> - Define a callback for the "expose_event" signal on your
> drawingArea and put your drawing code in there.
>       Try the following (untested) code:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D8<--------------------------=
> --------------
> import gtk.DrawingArea, gtk.Main, gtk.MainWindow, gdk.GC,
>     gdk.Drawable, gdk.Color;
> bool onExposeEvent (GdkEventExpose*, Widget drawingArea) {
>     auto drawable =3D drawingArea.getWindow();
>     auto gc =3D new GC(drawable);
>     gc.setForeground(new Color(255, 0, 0));
>     gc.setBackground(new Color(255, 255, 255));
>     drawable.drawLine(gc, 0, 0, 100, 100);
> }
> void main(string[] args) {
>     Main.init(args);
>     auto win =3D new MainWindow("Hello, world");
>     win.setDefaultSize(800, 600);
>     auto drawingArea =3D new DrawingArea(800, 600);
>     win.add(drawingArea);
>     drawingArea.realize();
>     drawingArea.addOnExpose ((GdkEventExpose* event,
>                               Widget drawingArea) {
>         auto drawable =3D drawingArea.getWindow();
>         auto gc =3D new GC(drawable);
>         gc.setForeground(new Color(255, 0, 0));
>         gc.setBackground(new Color(255, 255, 255));
>         drawable.drawLine(gc, 0, 0, 100, 100);
>       return true;
>     });
>     drawingArea.showAll();
>     drawingArea.queueDraw();
>     win.showAll();
>     Main.run();
> }
> ---------------------------------------->8=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D
>               Jerome
> --=20
> mailto:jeber...@free.fr
> http://jeberger.free.fr
> Jabber: jeber...@jabber.fr
> --------------enigEB95B6E017DCC321C6AC57B2
> Content-Type: application/pgp-signature; name="signature.asc"
> Content-Description: OpenPGP digital signature
> Content-Disposition: attachment; filename="signature.asc"
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> iEYEARECAAYFAkxBRmkACgkQd0kWM4JG3k9XSQCcC3JbX8BbPAhKP10SCVnWkEaM
> ELYAnjxrivlSDZC54vcx5wJtIqOYXVTF
> =RscJ
> -----END PGP SIGNATURE-----
> --------------enigEB95B6E017DCC321C6AC57B2--

Reply via email to