casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
X11Util.h
Go to the documentation of this file.
1 //# X11Util.h: X utilities to assist the X11 classes
2 //# Copyright (C) 1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef GRAPHICS_X11UTIL_H
29 #define GRAPHICS_X11UTIL_H
30 
31 
32 #include <casa/aips.h>
33 #include <casa/iosfwd.h>
34 
35 #include <graphics/X11/X_enter.h>
36 #include <X11/Xlib.h>
37 #include <X11/Xatom.h>
38 #include <X11/Xutil.h>
39 #include <X11/Intrinsic.h>
40 #include <X11/Xmu/Xmu.h>
41 #include <X11/Xmu/StdCmap.h>
42 #include <graphics/X11/X_exit.h>
43 
44 namespace casa { //# NAMESPACE CASA - BEGIN
45 
46 // <summary>
47 // X Utilities to assist the X11 classes
48 // </summary>
49 //
50 // <use visibility=export>
51 //
52 // <reviewed>
53 // nope
54 // </reviewed>
55 //
56 // <prerequisite>
57 // <li> Knowledge of X internals
58 // </prerequisite>
59 //
60 // <etymology>
61 // Name subject to change
62 // </etymology>
63 //
64 // <synopsis>
65 //
66 //
67 //
68 // </synopsis>
69 //
70 // <motivation>
71 // Offload some complex functions to utility library, making it a
72 // bit easier to manage the X11 code.
73 // </motivation>
74 //
75 // <group name="X11 Utility Functions">
76 
77 // returns true if nColors can be allocated
78 // on the colormap of the display using or not using
79 // a contiguous color method.
80 Bool X11TestColormapAlloc(::XDisplay * display,
81  XColormap colormap,
82  casacore::Bool contig,
83  casacore::uInt nColors);
84 
85 // returns the number of colors presently
86 // available on the passed colormap, and display,
87 // possibly using contiguous mapping.
88 uInt X11QueryColorsAvailable(::XDisplay * display,
89  XColormap colormap,
90  casacore::Bool contig);
91 
92 // returns a default display name
93 // First, search for the DISPLAY environment
94 // Else it returns ":0"
95 const char * X11DefaultDisplayName();
96 
97 // returns an opened display on the default name as above
98 ::XDisplay * X11DefaultDisplay();
99 
100 // returns a default screen opened on the default display
101 Screen * X11DefaultScreen();
102 
103 // function returns best visual in given class. Best is determined
104 // by largest depth
105 Visual * X11BestVisual(Screen * screen, casacore::uInt c_class);
106 
107 // returns depth of given visual. The safest way to get the right
108 // depth is to match it with XGetVisualInfo and return its depth
109 uInt X11DepthOfVisual(::XDisplay * display, Visual * visual);
110 
111 // maps a visualId to a visual
112 Visual * X11VisualIdToVisual(::XDisplay * display, casacore::uInt visualId);
113 
114 // gets XVisualInfo for the given Visual
115 XVisualInfo X11VisualInfoFromVisual(::XDisplay *display, Visual *visual);
116 
117 // print info on a standard colormap
118 ostream & operator << (ostream & os, const XStandardColormap & mapInfo);
119 
120 // print visual information
121 ostream & operator << (ostream & os, Visual * visual);
122 
123 // print screen information
124 ostream & operator << (ostream & os, Screen * screen);
125 
126 // Initialize a Standard Colormap. If the function succeeds,
127 // The passed mapInfo structure will be filled with information
128 // about the color cube.
129 Bool X11InitializeStandardColormap(Screen * screen,
130  Visual * visual,
131  Atom property,
132  XStandardColormap ** mapInfo);
133 
134 // Return the widget that is the top-level widget of this widget
135 Widget X11TopLevelWidget(Widget w);
136 
137 // Return the shell widget that contains this widget
138 Widget X11ContainingShell(Widget w);
139 // </group>
140 // function to print colormap information
141 // ostream & operator << (ostream & os, Colormap cmap)
142 
143 } //# NAMESPACE CASA - END
144 
145 #ifndef AIPS_NO_TEMPLATE_SRC
146 #include <graphics/X11/X11Util.tcc>
147 #endif //# AIPS_NO_TEMPLATE_SRC
148 #endif
ostream & operator<<(ostream &os, const PageHeaderCache &cache)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
unsigned int uInt
Definition: aipstype.h:51