1 /*   ncbiport.h
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *            National Center for Biotechnology Information (NCBI)
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government do not place any restriction on its use or reproduction.
13 *  We would, however, appreciate having the NCBI and the author cited in
14 *  any work or product based on this material
15 *
16 *  Although all reasonable efforts have been taken to ensure the accuracy
17 *  and reliability of the software and data, the NLM and the U.S.
18 *  Government do not and cannot warrant the performance or results that
19 *  may be obtained by using this software or data. The NLM and the U.S.
20 *  Government disclaim all warranties, express or implied, including
21 *  warranties of performance, merchantability or fitness for any particular
22 *  purpose.
23 *
24 * ===========================================================================
25 *
26 * File Name:  ncbiport.h
27 *
28 * Author:  Jonathan Kans
29 *
30 * Version Creation Date:   1/1/91
31 *
32 * $Revision: 6.2 $
33 *
34 * File Description:
35 *       Vibrant drawing port specification definitions
36 *
37 * Modifications:
38 * --------------------------------------------------------------------------
39 * Date     Name        Description of modification
40 * -------  ----------  -----------------------------------------------------
41 *
42 * ==========================================================================
43 */
44 
45 #ifndef _NCBIPORT_
46 #define _NCBIPORT_
47 
48 #ifndef _NCBI_
49 #include <ncbi.h>
50 #endif
51 #ifndef _NCBIDRAW_
52 #include <ncbidraw.h>
53 #endif
54 #ifndef _NCBIWIN_
55 #include <ncbiwin.h>
56 #endif
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* Quartz requires ATSUI, so ensure that the dependency is filled */
63 #if defined(WIN_MAC_QUARTZ) && !defined(WIN_MAC_ATSUI)
64 #define WIN_MAC_ATSUI
65 #endif
66 
67 #ifdef WIN_MAC
68 #define Nlm_PointTool Point
69 #define Nlm_RectTool Rect
70 
71 #ifdef WIN_MAC_QUARTZ
72 #define Nlm_RgnTool HIMutableShapeRef
73 #else
74 #define Nlm_RgnTool RgnHandle
75 #endif
76 
77 #ifdef WIN_MAC_ATSUI
78 #define Nlm_FontTool ATSUStyle
79 #else
80 #define Nlm_FontTool Nlm_Handle
81 #endif
82 
83 #endif
84 
85 #ifdef WIN_MSWIN
86 #define Nlm_PointTool POINT
87 #define Nlm_RectTool RECT
88 #define Nlm_RgnTool HRGN
89 #define Nlm_FontTool HFONT
90 #endif
91 
92 #ifdef WIN_X
93 #define Nlm_PointTool XPoint
94 #define Nlm_RectTool XRectangle
95 #define Nlm_RgnTool Region
96 #define Nlm_FontTool XFontStruct*
97 #endif
98 
99 /* The font structure is created using a handle.  The FntPtr is
100 *  returned by a call to Nlm_HandLock (font).  Be sure to call
101 *  Nlm_HandUnlock (font) after obtaining the font handle.
102 */
103 
104 /* esl: includes refcnt and fontspec instead of name/size/bld... */
105 typedef  struct  Nlm_fontrec {
106   Nlm_FonT      next;
107   Nlm_Int4      refcnt;
108   Nlm_FontSpec  fontspec;
109 #ifndef WIN_GIF
110 #if defined(WIN_MAC) && ! defined(WIN_MAC_ATSUI)
111   Nlm_Int2      number;
112   Nlm_Int2      size;
113   Nlm_Int2      style;
114 #elif defined(WIN_MSWIN) || defined(WIN_X) || defined(WIN_MAC_ATSUI)
115   Nlm_FontTool  handle;
116 #endif
117 #endif
118   Nlm_FonT      print;
119 } Nlm_FontRec, Nlm_FontData, PNTR Nlm_FntPtr;
120 
121 extern Nlm_Boolean  Nlm_nowPrinting;
122 
123 #ifdef WIN_MAC
124 #ifdef WIN_MAC_QUARTZ
125 
126 typedef struct {
127   float r, g, b;
128 } Nlm_QuartzColor;
129 extern Nlm_QuartzColor Nlm_QuartzForeColor;
130 extern Nlm_QuartzColor Nlm_QuartzBackColor;
131 extern Nlm_Boolean  Nlm_hasColorQD;
132 #else
133 extern RGBColor     Nlm_RGBforeColor;
134 extern RGBColor     Nlm_RGBbackColor;
135 extern Nlm_Boolean  Nlm_hasColorQD;
136 #endif
137 #endif
138 
139 #ifdef WIN_MSWIN
140 extern  HWND  Nlm_currentHWnd;
141 extern  HDC   Nlm_currentHDC;
142 #endif
143 
144 #ifdef WIN_X
145 extern  Display      *Nlm_currentXDisplay;
146 extern  int          Nlm_currentXScreen;
147 extern  Window       Nlm_currentXWindow;
148 extern  GC           Nlm_currentXGC;
149 extern  Nlm_Uint4    Nlm_XbackColor;
150 extern  Nlm_Uint4    Nlm_XforeColor;
151 extern  Nlm_Int2     Nlm_XOffset;
152 extern  Nlm_Int2     Nlm_YOffset;
153 extern  Nlm_RegioN   Nlm_clpRgn;
154 extern  Nlm_Boolean  Nlm_hasColor;
155 #endif
156 
157 #ifdef WIN_MAC
158 #ifdef WIN_MAC_QUARTZ
159 void  Nlm_SetPort PROTO((CGContextRef ctx));
160 void  Nlm_PushPort PROTO((CGContextRef ctx));
161 CGContextRef Nlm_PopPort PROTO((void));
162 CGContextRef Nlm_GetQuartzWindowPort PROTO((WindowRef wptr));
163 WindowRef Nlm_GetQuartzCurrentWindow PROTO((void));
164 void Nlm_SetGraphicNeedsDisplay PROTO((Nlm_GraphiC graphic));
165 #else
166 void  Nlm_SetPort PROTO((GrafPtr grafptr));
167 #endif
168 void Nlm_SetPortWindowPort PROTO((WindowPtr wptr));
169 
170 
171 #endif
172 
173 #ifdef WIN_MSWIN
174 void  Nlm_SetPort PROTO((HWND hwnd, HDC hdc));
175 extern void Nlm_FontSpecToLOGFONT PROTO((Nlm_FontSpecPtr fsp, LOGFONT *lfp)); /* esl */
176 #endif
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif
183