1/* Part of XPCE 2 3 Designed and implemented by Anjo Anjewierden and Jan Wielemaker 4 E-mail: J.Wielemaker@cs.vu.nl 5 6 This example program is in the public domain 7*/ 8 9colour(white). 10colour(red). 11colour(green). 12colour(blue). 13colour(black). 14 15append_colour(M, C) :- 16 new(Img, pixmap(width := 32, height := 16)), 17 send(Img, fill, colour(C)), 18 send(M, append, menu_item(C, label := Img)). 19 20edit_graphical(Gr) :- 21 new(D, dialog(string('Edit graphical %s', Gr?name))), 22 send(D, append, new(M, menu(colour, choice))), 23 send(M, layout, horizontal), 24 forall(colour(C), append_colour(M, C)), 25 send(M, default, Gr?colour), 26 send(M, message, message(Gr, colour, @arg1)), 27 send(D, append, 28 new(X, text_item(x, Gr?x, 29 message(Gr, x, @arg1)))), 30 send(D, append, 31 new(Y, text_item(y, Gr?y, 32 message(Gr, y, @arg1)))), 33 send(D, append, 34 new(W, text_item(width, Gr?width, 35 message(Gr, width, @arg1)))), 36 send(D, append, 37 new(H, text_item(height, Gr?height, 38 message(Gr, height, @arg1)))), 39 send_list([X, Y,W,H], length, 4), 40 send(D, append, button(apply)), 41 send(D, append, button(restore)), 42 send(D, append, button(quit, message(D, destroy))), 43 send(D, open). 44 45attributedemo :- 46 send(new(P, picture('Attribute Demo')), open), 47 send(P, display, new(B, box(100, 100)), point(20, 20)), 48 send(P, display, new(E, ellipse(100, 50)), point(150, 20)), 49 new(C, click_gesture(left, '', double, 50 message(@prolog, edit_graphical, @receiver))), 51 send(B, recogniser, C), 52 send(E, recogniser, C). 53