casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
X11Util.h
Go to the documentation of this file.
00001 //# X11Util.h: X utilities to assist the X11 classes
00002 //# Copyright (C) 1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef GRAPHICS_X11UTIL_H
00029 #define GRAPHICS_X11UTIL_H
00030 
00031 
00032 #include <casa/aips.h>
00033 #include <casa/iosfwd.h>
00034 
00035 #include <graphics/X11/X_enter.h>
00036 #include <X11/Xlib.h>
00037 #include <X11/Xatom.h>
00038 #include <X11/Xutil.h>
00039 #include <X11/Intrinsic.h>
00040 #include <X11/Xmu/Xmu.h>
00041 #include <X11/Xmu/StdCmap.h>
00042 #include <graphics/X11/X_exit.h>
00043 
00044 namespace casa { //# NAMESPACE CASA - BEGIN
00045 
00046 // <summary>
00047 // X Utilities to assist the X11 classes
00048 // </summary>
00049 //
00050 // <use visibility=export>
00051 //
00052 // <reviewed>
00053 // nope
00054 // </reviewed>
00055 //  
00056 // <prerequisite>
00057 // <li> Knowledge of X internals
00058 // </prerequisite>
00059 //
00060 // <etymology>
00061 // Name subject to change
00062 // </etymology>
00063 //
00064 // <synopsis>
00065 //
00066 //
00067 //
00068 // </synopsis>
00069 //
00070 // <motivation>
00071 // Offload some complex functions to utility library, making it a
00072 // bit easier to manage the X11 code.
00073 // </motivation>
00074 //
00075 // <group name="X11 Utility Functions">
00076 
00077 // returns true if nColors can be allocated
00078 // on the colormap of the display using or not using
00079 // a contiguous color method.
00080 Bool X11TestColormapAlloc(::XDisplay * display,
00081                           XColormap colormap,
00082                           Bool contig,
00083                           uInt nColors);
00084 
00085 // returns the number of colors presently
00086 // available on the passed colormap, and display,
00087 // possibly using contiguous mapping.
00088 uInt X11QueryColorsAvailable(::XDisplay * display,
00089                              XColormap colormap,
00090                              Bool contig);
00091 
00092 // returns a default display name
00093 // First, search for the DISPLAY environment
00094 // Else it returns ":0"
00095 const char * X11DefaultDisplayName();
00096 
00097 // returns an opened display on the default name as above
00098 ::XDisplay * X11DefaultDisplay();
00099 
00100 // returns a default screen opened on the default display
00101 Screen * X11DefaultScreen();
00102 
00103 // function returns best visual in given class.  Best is determined
00104 // by largest depth
00105 Visual * X11BestVisual(Screen * screen, uInt c_class);
00106 
00107 // returns depth of given visual.  The safest way to get the right
00108 // depth is to match it with XGetVisualInfo and return its depth
00109 uInt X11DepthOfVisual(::XDisplay * display, Visual * visual);
00110 
00111 // maps a visualId to a visual
00112 Visual * X11VisualIdToVisual(::XDisplay * display, uInt visualId);
00113 
00114 // gets XVisualInfo for the given Visual
00115 XVisualInfo X11VisualInfoFromVisual(::XDisplay *display, Visual *visual);
00116 
00117 // print info on a standard colormap
00118 ostream & operator << (ostream & os, const XStandardColormap & mapInfo);
00119       
00120 // print visual information
00121 ostream & operator << (ostream & os, Visual * visual);
00122 
00123 // print screen information
00124 ostream & operator << (ostream & os, Screen * screen);
00125 
00126 // Initialize a Standard Colormap.  If the function succeeds,
00127 // The passed mapInfo structure will be filled with information
00128 // about the color cube.
00129 Bool X11InitializeStandardColormap(Screen * screen,
00130                                    Visual * visual,
00131                                    Atom property,
00132                                    XStandardColormap ** mapInfo);
00133 
00134 // Return the widget that is the top-level widget of this widget
00135 Widget X11TopLevelWidget(Widget w);
00136 
00137 // Return the shell widget that contains this widget
00138 Widget X11ContainingShell(Widget w);
00139 // </group>
00140 // function to print colormap information
00141 // ostream & operator << (ostream & os, Colormap cmap)
00142 
00143 } //# NAMESPACE CASA - END
00144 
00145 #ifndef AIPS_NO_TEMPLATE_SRC
00146 #include <graphics/X11/X11Util.tcc>
00147 #endif //# AIPS_NO_TEMPLATE_SRC
00148 #endif