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.2 $
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.2 2002-11-04 07:44:45 arjen
28 Use proper namespace for iostream classes
29 Use local header files and not the installed ones.
31 Revision 1.1 2002/07/25 08:01:18 arjen
32 First checkin, AXE release 0.2
34 *****************************/
36 static const char *RCSID = "$Id: doodle3.cpp,v 1.2 2002-11-04 07:44:45 arjen Exp $";
40 class doodle_view : public window
44 doodle_view(window *parent) : window (*parent, 10, 30, 300, 220)
46 SelectInput(ExposureMask, 1);
47 SelectInput(KeyPressMask, 1);
48 Background(color("lightyellow"));
51 virtual int EV_Expose(XExposeEvent);
52 virtual int EV_KeyPress(XKeyEvent ev);
55 class doodle: public xapplication
57 managed_window *main_frame;
58 doodle_view *draw_frame;
60 virtual void SetupResources(void);
65 void doodle::SetupResources()
67 main_frame = new managed_window("Doodling with AXE");
70 draw_frame = new doodle_view(main_frame);
74 int doodle_view::EV_Expose(XExposeEvent ev)
78 DrawRectangle(graphic, 50, 70, 200, 100);
83 int doodle_view::EV_KeyPress(XKeyEvent ev)
87 key = XLookupKeysym(&ev, ev.state & 1);