[Glade-users] Drawing Area
- From: bje apnic net (Byron Ellacott)
- Subject: [Glade-users] Drawing Area
- Date: 09 Apr 2001 11:21:31 +1000
On 05 Apr 2001 20:30:24 +0200, Val�ry Avaux wrote:
I would like to divise this drawing area into small squares of 4*4 and
each square will have one of these two colors: red or blue. To see, wich
square must be blue or must be red, I read into a variable called
matrice[i][j][k] where 1<i,j,k<100. This variable take two values +1
wich would appears in blue and -1 wich would appears in red. So if I
choose myself a value for k, I can go through the value of i and j to
see wich square is red or blue.
See http://users.bigpond.net.au/mlm/libglade/ and
http://users.bigpond.net.au/mlm/planner/ for some sample code. The
basic way to deal with it is (as the documentation says) write an expose
event handler. This is called every time all or part of your drawing
area needs redrawing.
So, for your case, probably the simplest way would be:
on_expose_event() {
find range of matrix that needs redrawing;
use gdk draw routines to draw filled rectangles in that range;
}
The libglade/ link above has an expose event you can use as a template.
I don't remember the structures and prototypes offhand at the moment, so
I can't give you more than very rough pseudocode.
--
bje
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]