1 /**************************************************************************
2 ** (c) Copyright 1998, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : display.h
7 ** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
8 ** VERSION NUMBER : $Revision: 1.2 $
10 ** DESCRIPTION : Definition of display class
12 ** EXPORTED OBJECTS : class display
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Feb 06, 1998
20 ** LAST UPDATE : Feb 07, 1998
22 **************************************************************************/
24 /*****************************
26 Revision 1.2 2002-11-04 07:24:31 arjen
27 Use proper namespace for iostream classes
29 Revision 1.1 2002/07/25 08:01:26 arjen
30 First checkin, AXE release 0.2
32 *****************************/
34 /* static const char *RCSID = "$Id: display.h,v 1.2 2002-11-04 07:24:31 arjen Exp $"; */
43 ///////////////////////////////////////////////////////////////////////////
46 // MEMBERS : dpy : Pointer to the Xlib Display
47 // OPERATORS : >> XEvent - Read next event from the queue
48 // METHODS : display() - Connect the default display
49 // display(char *) - Connect a specific display.
50 // ~display() - Close the display connection
52 // Root() - The root window.
53 // Black() - Black pixel value.
54 // White() - White pixel value.
55 // DESCRIPTION : A display object maintains the connection to the X
56 // workstation. The library contains one such object, stddpy
57 // which is connected to the default display.
62 ///////////////////////////////////////////////////////////////////////////
77 dpy = XOpenDisplay("");
78 default_gc = XCreateGC(dpy, DefaultRootWindow(dpy), 0, 0);
81 // contructor with char* argument opens named display.
82 display(char *display_name)
84 dpy = XOpenDisplay(display_name);
85 default_gc = XCreateGC(dpy, DefaultRootWindow(dpy), 0, 0);
90 XFreeGC(dpy, default_gc);
94 display & operator>> (XEvent &ev)
100 // return display pointer.
113 return DefaultRootWindow(dpy);
116 // Obtain the color index value for a white pixel.
117 unsigned long White()
119 return WhitePixel(dpy, DefaultScreen(dpy));
122 // Obtain the color index value for a black pixel.
123 unsigned long Black()
125 return BlackPixel(dpy, DefaultScreen(dpy));
135 return DefaultColormap(dpy, DefaultScreen(dpy));
139 extern display stddpy;
141 #endif /* _DISPLAY_H */