0022627: Change OCCT memory management defaults
[occt.git] / src / Xw / Xw_isdefine_color.cxx
CommitLineData
7fd59977 1
2#include <Xw_Extension.h>
3
4 /* ifdef then trace on */
5#ifdef TRACE
6#define TRACE_ISDEFINE_COLOR
7#endif
8
9/*
10 XW_STATUS Xw_isdefine_color(acolormap,index):
11 XW_EXT_COLORMAP *acolormap Colormap extension structure
12 int index ; Color index 0 >= x < MAXCOLOR
13
14 Returns XW_ERROR if BadColor index or Color is not define
15 Returns XW_SUCCESS if Color is defined
16
17*/
18#ifdef XW_PROTOTYPE
19XW_STATUS Xw_isdefine_color (void* acolormap, int index)
20#else
21XW_STATUS Xw_isdefine_color (acolormap,index)
22void *acolormap;
23int index ;
24#endif /*XW_PROTOTYPE*/
25{
26XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
27XW_STATUS status = XW_ERROR ;
28//int i ;
29
30 if( pcolormap && ((index < 0) ||
31 ((index >= 0) && (index < pcolormap->maxcolor) &&
32 (pcolormap->define[index]))) ) {
33 status = XW_SUCCESS ;
34 }
35
36#ifdef TRACE_ISDEFINE_COLOR
37if( Xw_get_trace() > 2 ) {
38 printf(" %d = Xw_isdefine_color(%lx,%d)\n",status,(long ) pcolormap,index) ;
39}
40#endif
41
42 return (status);
43}
44
45#ifdef XW_PROTOTYPE
46XW_STATUS Xw_isdefine_colorindex (XW_EXT_COLORMAP* acolormap, int index)
47#else
48XW_STATUS Xw_isdefine_colorindex (acolormap,index)
49XW_EXT_COLORMAP *acolormap;
50int index ;
51#endif /*XW_PROTOTYPE*/
52/*
53 Verify Index range Only
54*/
55{
56XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
57XW_STATUS status = XW_ERROR ;
58
59 if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) ) {
60 status = XW_SUCCESS ;
61 }
62
63#ifdef TRACE_ISDEFINE_COLOR
64if( Xw_get_trace() > 2 ) {
65 printf(" %d = Xw_isdefine_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
66}
67#endif
68
69 return (status) ;
70}
71#ifdef XW_PROTOTYPE
72XW_STATUS Xw_ifsystem_colorindex (XW_EXT_COLORMAP* acolormap, int index)
73#else
74XW_STATUS Xw_ifsystem_colorindex (acolormap,index)
75XW_EXT_COLORMAP *acolormap;
76int index ;
77#endif /*XW_PROTOTYPE*/
78/*
79 Check if System color index
80*/
81{
82XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
83XW_STATUS status = XW_ERROR ;
84
85 if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) &&
86 (pcolormap->define[index] == SYSTEMCOLOR) ) {
87 status = XW_SUCCESS ;
88 }
89
90#ifdef TRACE_ISDEFINE_COLOR
91if( Xw_get_trace() > 2 ) {
92 printf(" %d = Xw_ifsystem_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
93}
94#endif
95
96 return (status) ;
97}
98
99#ifdef XW_PROTOTYPE
100XW_STATUS Xw_ifimage_colorindex (XW_EXT_COLORMAP* acolormap, int index)
101#else
102XW_STATUS Xw_ifimage_colorindex (acolormap,index)
103XW_EXT_COLORMAP *acolormap;
104int index ;
105#endif /*XW_PROTOTYPE*/
106/*
107 Check if image color index
108*/
109{
110XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
111XW_STATUS status = XW_ERROR ;
112
113 if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) &&
114 (pcolormap->define[index] == IMAGECOLOR) ) {
115 status = XW_SUCCESS ;
116 }
117
118#ifdef TRACE_ISDEFINE_COLOR
119if( Xw_get_trace() > 2 ) {
120 printf(" %d = Xw_ifimage_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
121}
122#endif
123
124 return (status) ;
125}
126
127#ifdef XW_PROTOTYPE
128XW_STATUS Xw_ifbackground_colorindex (XW_EXT_COLORMAP* acolormap, int index)
129#else
130XW_STATUS Xw_ifbackground_colorindex (acolormap,index)
131XW_EXT_COLORMAP *acolormap;
132int index ;
133#endif /*XW_PROTOTYPE*/
134/*
135 Check if background color index
136*/
137{
138XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
139XW_STATUS status = XW_ERROR ;
140
141 if( pcolormap && ((index < 0) ||
142 ((index >= 0) && (index < pcolormap->maxcolor) &&
143 (pcolormap->define[index] == BACKCOLOR))) ) {
144 status = XW_SUCCESS ;
145 }
146
147#ifdef TRACE_ISDEFINE_COLOR
148if( Xw_get_trace() > 2 ) {
149 printf(" %d = Xw_ifbackground_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
150}
151#endif
152
153 return (status) ;
154}
155
156#ifdef XW_PROTOTYPE
157XW_STATUS Xw_ifhighlight_colorindex (XW_EXT_COLORMAP* acolormap, int index)
158#else
159XW_STATUS Xw_ifhighlight_colorindex (acolormap,index)
160XW_EXT_COLORMAP *acolormap;
161int index ;
162#endif /*XW_PROTOTYPE*/
163/*
164 Check if highlight color index
165*/
166{
167XW_EXT_COLORMAP *pcolormap = (XW_EXT_COLORMAP*)acolormap ;
168XW_STATUS status = XW_ERROR ;
169
170 if( pcolormap && (index >= 0) && (index < pcolormap->maxcolor) &&
171 (pcolormap->define[index] == HIGHCOLOR) ) {
172 status = XW_SUCCESS ;
173 }
174
175#ifdef TRACE_ISDEFINE_COLOR
176if( Xw_get_trace() > 2 ) {
177 printf(" %d = Xw_ifhighlight_colorindex(%lx,%d)\n",status,(long ) pcolormap,index) ;
178}
179#endif
180
181 return (status) ;
182}