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.1 $
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.1 2002-07-25 08:01:26 arjen
27 First checkin, AXE release 0.2
29 *****************************/
31 /* static const char *RCSID = "$Id: display.h,v 1.1 2002-07-25 08:01:26 arjen Exp $"; */
40 ///////////////////////////////////////////////////////////////////////////
43 // MEMBERS : dpy : Pointer to the Xlib Display
44 // OPERATORS : >> XEvent - Read next event from the queue
45 // METHODS : display() - Connect the default display
46 // display(char *) - Connect a specific display.
47 // ~display() - Close the display connection
49 // Root() - The root window.
50 // Black() - Black pixel value.
51 // White() - White pixel value.
52 // DESCRIPTION : A display object maintains the connection to the X
53 // workstation. The library contains one such object, stddpy
54 // which is connected to the default display.
59 ///////////////////////////////////////////////////////////////////////////
74 dpy = XOpenDisplay("");
75 default_gc = XCreateGC(dpy, DefaultRootWindow(dpy), 0, 0);
78 // contructor with char* argument opens named display.
79 display(char *display_name)
81 dpy = XOpenDisplay(display_name);
82 default_gc = XCreateGC(dpy, DefaultRootWindow(dpy), 0, 0);
87 XFreeGC(dpy, default_gc);
91 display & operator>> (XEvent &ev)
97 // return display pointer.
110 return DefaultRootWindow(dpy);
113 // Obtain the color index value for a white pixel.
114 unsigned long White()
116 return WhitePixel(dpy, DefaultScreen(dpy));
119 // Obtain the color index value for a black pixel.
120 unsigned long Black()
122 return BlackPixel(dpy, DefaultScreen(dpy));
132 return DefaultColormap(dpy, DefaultScreen(dpy));
136 extern display stddpy;
138 #endif /* _DISPLAY_H */