Re: GUI Guidance for Linux

new topic     » goto parent     » topic index » view thread      » older message » newer message

EuGTK does that quite easily. Here's a snippet from test38.ex (included with EuGTK) which draws the primitives:

switch whichbutton do 
  case CLEAR then clear(canvas) 
  case BKGND then set(drawable,"modify bg",0,rcolor)  
  case LINES then draw_line(canvas,gc,x1,y1,x2,y2)  
  case RECTS then draw_rectangle(canvas,gc,TRUE,x1,y1,w,h) 
  case ARCS  then draw_arc(canvas,gc,TRUE,x1,y1,w,h,a1,a2)  
  case PIX   then draw_pixbuf(canvas,gc,img,0,0,w,h,dim[1],dim[2]) 
  case STR then draw_string(canvas, 
       pangofont("Courier 18"),gc,0,0,"Hello World!") 
end switch 

Setting up a 'canvas' to draw upon is just 4 lines of code:

constant drawable = create(GtkDrawingArea) 
 
constant style = get(drawable,"style"), 
canvas = peek4u(drawable + 52), 
gc = peek4u(style + 540) 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu