2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: PixmapGraphic.hh /main/5 1996/09/06 15:32:15 cde-hal $
26 * Copyright (c) 1992 HaL Computer Systems, Inc. All rights reserved.
27 * UNPUBLISHED -- rights reserved under the Copyright Laws of the United
28 * States. Use of a copyright notice is precautionary only and does not
29 * imply publication or disclosure.
31 * This software contains confidential information and trade secrets of HaL
32 * Computer Systems, Inc. Use, disclosure, or reproduction is prohibited
33 * without the prior express written permission of HaL Computer Systems, Inc.
35 * RESTRICTED RIGHTS LEGEND
36 * Use, duplication, or disclosure by the Government is subject to
37 * restrictions as set forth in subparagraph (c)(l)(ii) of the Rights in
38 * Technical Data and Computer Software clause at DFARS 252.227-7013.
39 * HaL Computer Systems, Inc.
40 * 1315 Dell Avenue, Campbell, CA 95008
45 // #include "Managers/GraphicsMgr.hh"
49 class GraphicsHandler ;
53 #include <X11/Intrinsic.h>
55 #include <DtI/GraphicsP.h>
58 // Message Classed for informing ViewportAgents about attaching and detaching
63 GraphicsMessage( UAS_Pointer<Graphic> &gr )
67 UAS_Pointer<Graphic> &graphic()
68 { return f_graphic ; }
71 UAS_Pointer<Graphic> f_graphic ;
74 class DetachGraphic : public GraphicsMessage
77 DetachGraphic(UAS_Pointer<Graphic> &gr,
79 : GraphicsMessage(gr),
83 GraphicAgent *agent() { return f_graphic_agent ; }
86 GraphicAgent *f_graphic_agent ;
89 class ReAttachGraphic : public GraphicsMessage
93 ReAttachGraphic( UAS_Pointer<Graphic> &gr)
101 DisplayGraphic( UAS_Pointer<Graphic> &g)
104 UAS_Pointer<Graphic> &graphic() { return f_graphic ;}
106 UAS_Pointer<Graphic> f_graphic ;
109 class PixmapGraphic : public UAS_Sender<DetachGraphic>,
110 public UAS_Sender<ReAttachGraphic>
113 enum PixmapFlag { NORMAL, DETACHED_PIXMAP, DEFAULT_PIXMAP, PRESERVE } ;
115 PixmapGraphic (Pixmap pixmap,
116 Dimension width, Dimension height,
119 virtual ~PixmapGraphic();
121 void set_colormap( Colormap, int, Pixel *, _DtGrContext * );
123 virtual bool isPostScriptGraphic() const { return FALSE ; }
125 // member access functions
126 Pixmap pixmap() const
129 Dimension width() const
132 Dimension height() const
137 bool is_detached() const { return f_flag == DETACHED_PIXMAP ; }
139 void set_type(PixmapFlag f) { f_flag = f ; }
141 void register_handler(GraphicsHandler *);
143 GraphicAgent *agent() { return f_agent; }
144 GraphicAgent *agent(GraphicAgent *agent)
145 { f_agent = agent ; return agent; }
149 PixmapGraphic(const PixmapGraphic *);
151 protected: // variables
156 GraphicAgent *f_agent ;
158 // colormap info allocated for the above f_pixmap:
159 Colormap f_colormap; // containing colormap
160 int f_num_colors; // num colors allocated
161 Pixel *f_colors; // colors allocated
162 _DtGrContext *f_tiff_context; // colors if tiff type graphic