comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Re: GTK 3.8 Graphic programming
Date: Sun, 5 Jan 2014 17:45:32 +0100
Date: 2014-01-05T17:45:32+01:00	[thread overview]
Message-ID: <52c98c95$0$10508$703f8584@textnews.kpn.nl> (raw)
In-Reply-To: <z154dfja3q0m.17hbcu4i3o1u8.dlg@40tude.net>



"Dmitry A. Kazakov"  schreef in bericht 
news:z154dfja3q0m.17hbcu4i3o1u8.dlg@40tude.net...

On Sun, 5 Jan 2014 08:43:58 +0100, ldries46 wrote:

> First of all, where did you get GtkAda 3.8?

I probably get all different versions mixed up. Possibly a mix-up of 
versions  of GTK, GtkAda and Glade. I am sorry if this made it difficult for 
you.

I wanted a standard grid in the window at the moment of initialization. This 
meant that the first try was the drawing procedure using before I carried 
out Gtk.Main.Main . By inserting a breakpoint just before this point I found 
the grid was visible but it vanished when I executed the next step.
My next step was putting the routine in the callback procedure from 
File/New. Now also the grid became visible except for the part that was 
under the pull-down menu from File.
All this means that I am missing the part that fixes the grid in the 
Gtk_Drawing_Area.


> You could use Stroke once.

It is nice to find that only one Stroke is necessary. But in the Testcairo 
example in the  GTK distribution also more stroke routines are used.

> Yes, the drawing model is event-driven. You must draw from the signal
> handler.

Firstly the initial grid is never drawn from a event so there should be an 
event handler which is triggered by starting the program.

> 1. You should derive your widget from Gtk_Drawing_Area_Record

With glade3 I get the drawing area with

Object :=  Get_Object (Builder, "My_drawing_area");
My_Area := Gtk_Drawing_Area(Object);

> 2. In the implementation of Initialize (which you call from widget's
> Gtk_New) you connect to the signal "draw". The profile is:

>    function Draw
>             (  Widget  : access My_Custom_Drawn_Widget_Record'Class;
>                Context : Cairo.Cairo_Context
>            )  return Boolean;

I think initialization is also done in this case. The draw function I could 
not find but. Maybe I did not understand your meaning and maybe I am using 
the GtkAda version of 2013 with a somewhat newer version of Glade3 because 
of the visibility of a number of items.

> Caution! AdaCore changed the interface yet again since 2.24 and then 3.4.
> See Glib.Object for the procedure of registering the widget's class record
> and its type.

> 3. From Draw you perform whatever drawing you wanted on Context, which is
> already clipped. Use Get_Allocation to obtain actual widget sizes.

> P.S. The described method works fine with GtkAda 3.4 and used here:

>    http://www.dmitry-kazakov.de/ada/aicwl.htm

I will study your link and hopes that I can conclude my program soon

L. Dries 

  reply	other threads:[~2014-01-05 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 10:44 GTK 3.8 Graphic programming ldries46
2014-01-05  7:43 ` ldries46
2014-01-05  9:12   ` Dmitry A. Kazakov
2014-01-05 16:45     ` ldries46 [this message]
2014-01-05 18:10       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox