1 /**************************************************************************
2 ** (c) Copyright 2002, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : doodle2.cpp
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.1 $
10 ** DESCRIPTION : Doodle is an exmaple application to demonstrate
11 ** the functions in AXE as a tutorial.
12 ** The second phase shows how to draw graphics in a
13 ** window and the event handling mechanism.
18 ***************************************************************************
19 ** ADMINISTRATIVE INFORMATION *
20 ********************************
21 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 ** CREATION DATE : Mar 01, 2002
23 **************************************************************************/
25 /*****************************
27 Revision 1.1 2002-07-25 08:01:18 arjen
28 First checkin, AXE release 0.2
30 *****************************/
32 static const char *RCSID = "$Id: doodle3.cpp,v 1.1 2002-07-25 08:01:18 arjen Exp $";
34 #include <AXE/xappl.h>
36 class doodle_view : public window
40 doodle_view(window *parent) : window (*parent, 10, 30, 300, 220)
42 SelectInput(ExposureMask, 1);
43 SelectInput(KeyPressMask, 1);
44 Background(color("lightyellow"));
47 virtual int EV_Expose(XExposeEvent);
48 virtual int EV_KeyPress(XKeyEvent ev);
51 class doodle: public xapplication
53 managed_window *main_frame;
54 doodle_view *draw_frame;
56 virtual void SetupResources(void);
61 void doodle::SetupResources()
63 main_frame = new managed_window("Doodling with AXE");
66 draw_frame = new doodle_view(main_frame);
70 int doodle_view::EV_Expose(XExposeEvent ev)
74 DrawRectangle(graphic, 50, 70, 200, 100);
79 int doodle_view::EV_KeyPress(XKeyEvent ev)
83 key = XLookupKeysym(&ev, ev.state & 1);