1 /*
2    GSCodingFlags.h
3 
4    Define flags used in Cocoa for keyed coding.
5 
6    Copyright (C) 2019 Free Software Foundation, Inc.
7 
8    Author: Fred Kiefer <fredkiefer@gmx.de>
9    Date: 12.2019
10    Original code by: Jonathan Gillaspie <jonathan.gillaspie@testplant.com>,
11                      Frank Le Grand <frank.legrand@testplant.com>
12                      Paul Landers <paul.landers@testplant.com> and
13                      Doug Simons <doug.simons@testplant.com>
14 
15    This file is part of the GNUstep GUI Library.
16 
17    This library is free software; you can redistribute it and/or
18    modify it under the terms of the GNU Lesser General Public
19    License as published by the Free Software Foundation; either
20    version 2 of the License, or (at your option) any later version.
21 
22    This library is distributed in the hope that it will be useful,
23    but WITHOUT ANY WARRANTY; without even the implied warranty of
24    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
25    Lesser General Public License for more details.
26 
27    You should have received a copy of the GNU Lesser General Public
28    License along with this library; see the file COPYING.LIB.
29    If not, see <http://www.gnu.org/licenses/> or write to the
30    Free Software Foundation, 51 Franklin Street, Fifth Floor,
31    Boston, MA 02110-1301, USA.
32 */
33 #ifndef _GNUstep_H_GSCodingFlags
34 #define _GNUstep_H_GSCodingFlags
35 
36 #import "GNUstepGUI/GSNibLoading.h"
37 
38 typedef struct _GSCellFlags {
39 #if GS_WORDS_BIGENDIAN == 1
40   unsigned int        state:1;
41   unsigned int        highlighted:1;
42   unsigned int        disabled:1;
43   unsigned int        editable:1;
44 
45   NSCellType          type:2;
46   unsigned int        vCentered:1;
47   unsigned int        hCentered:1;
48 
49   unsigned int        bordered:1;
50   unsigned int        bezeled:1;
51   unsigned int        selectable:1;
52   unsigned int        scrollable:1;
53 
54   unsigned int        continuous:1;
55   unsigned int        actOnMouseDown:1;
56   unsigned int        isLeaf:1;
57   unsigned int        invalidObjectValue:1;
58 
59   unsigned int        invalidFont:1;
60   NSLineBreakMode     lineBreakMode:3;
61 
62   unsigned int        weakTargetHelperFlag:1;
63   unsigned int        allowsAppearanceEffects:1;
64   unsigned int        singleLineMode:1;
65   unsigned int        actOnMouseDragged:1;
66 
67   unsigned int        isLoaded:1;
68   unsigned int        truncateLastLine:1;
69   unsigned int        dontActOnMouseUp:1;
70   unsigned int        isWhite:1;
71 
72   unsigned int        useUserKeyEquivalent:1;
73   unsigned int        showsFirstResponder:1;
74   unsigned int        focusRingType:2;
75 #else
76   unsigned int        focusRingType:2;
77   unsigned int        showsFirstResponder:1;
78   unsigned int        useUserKeyEquivalent:1;
79   unsigned int        isWhite:1;
80   unsigned int        dontActOnMouseUp:1;
81   unsigned int        truncateLastLine:1;
82   unsigned int        isLoaded:1;
83   unsigned int        actOnMouseDragged:1;
84   unsigned int        singleLineMode:1;
85   unsigned int        allowsAppearanceEffects:1;
86   unsigned int        weakTargetHelperFlag:1;
87   NSLineBreakMode     lineBreakMode:3;
88   unsigned int        invalidFont:1;
89   unsigned int        invalidObjectValue:1;
90   unsigned int        isLeaf:1;
91   unsigned int        actOnMouseDown:1;
92   unsigned int        continuous:1;
93   unsigned int        scrollable:1;
94   unsigned int        selectable:1;
95   unsigned int        bezeled:1;
96   unsigned int        bordered:1;
97   unsigned int        hCentered:1;
98   unsigned int        vCentered:1;
99   NSCellType          type:2;
100   unsigned int        editable:1;
101   unsigned int        disabled:1;
102   unsigned int        highlighted:1;
103   unsigned int        state:1;
104 #endif
105 } GSCellFlags;
106 
107 typedef union _GSCellFlagsUnion
108 {
109   GSCellFlags flags;
110   uint32_t    value;
111 } GSCellFlagsUnion;
112 
113 typedef struct _GSCellflags2
114 {
115 #if GS_WORDS_BIGENDIAN == 1
116   unsigned int unused1:1;
117   unsigned int allowsEditingTextAttributes:1;
118   unsigned int importsGraphics:1;
119   unsigned int alignment:3;
120   unsigned int refusesFirstResponder:1;
121   unsigned int allowsMixedState:1;
122   unsigned int unused2:1;
123   unsigned int sendsActionOnEndEditing:1;
124   unsigned int unused3:2;
125   unsigned int controlSize:3;
126   unsigned int unused4:4;
127   unsigned int doesNotAllowUndo:1;
128   unsigned int lineBreakMode:3;
129   unsigned int unused5:1;
130   unsigned int controlTint:3;
131   unsigned int unused6:5;
132 #else
133   unsigned int unused6:5;
134   unsigned int controlTint:3;
135   unsigned int unused5:1;
136   unsigned int lineBreakMode:3;
137   unsigned int doesNotAllowUndo:1;
138   unsigned int unused4:4;
139   unsigned int controlSize:3;
140   unsigned int unused3:2;
141   unsigned int sendsActionOnEndEditing:1;
142   unsigned int unused2:1;
143   unsigned int allowsMixedState:1;
144   unsigned int refusesFirstResponder:1;
145   unsigned int alignment:3;
146   unsigned int importsGraphics:1;
147   unsigned int allowsEditingTextAttributes:1;
148   unsigned int unused1:1;
149 #endif
150 } GSCellFlags2;
151 
152 typedef union _GSCellFlags2Union
153 {
154   GSCellFlags2 flags;
155   uint32_t     value;
156 } GSCellFlags2Union;
157 
158 typedef struct _GSButtonCellFlags
159 {
160 #if GS_WORDS_BIGENDIAN == 1
161   unsigned int isPushin:1;
162   unsigned int changeContents:1;
163   unsigned int changeBackground:1;
164   unsigned int changeGray:1;
165 
166   unsigned int highlightByContents:1;
167   unsigned int highlightByBackground:1;
168   unsigned int highlightByGray:1;
169   unsigned int drawing:1;
170 
171   unsigned int isBordered:1;
172   unsigned int imageDoesOverlap:1;
173   unsigned int isHorizontal:1;
174   unsigned int isBottomOrLeft:1;
175 
176   unsigned int isImageAndText:1;
177   unsigned int isImageSizeDiff:1;
178   unsigned int hasKeyEquiv:1;
179   unsigned int lastState:1;
180 
181   unsigned int isTransparent:1;
182   unsigned int inset:2; // inset:2
183   unsigned int doesNotDimImage:1; //doesn't dim:1
184 
185   unsigned int gradient:3; // gradient:3
186   unsigned int useButtonImageSource:1;
187 
188   unsigned int unused2:8; // alt mnemonic loc.
189 #else
190   unsigned int unused2:8; // alt mnemonic loc.
191   unsigned int useButtonImageSource:1;
192   unsigned int gradient:3; // gradient:3
193   unsigned int doesNotDimImage:1; // doesn't dim:1
194   unsigned int inset:2; // inset:2
195   unsigned int isTransparent:1;
196   unsigned int lastState:1;
197   unsigned int hasKeyEquiv:1;
198   unsigned int isImageSizeDiff:1;
199   unsigned int isImageAndText:1;
200   unsigned int isBottomOrLeft:1;
201   unsigned int isHorizontal:1;
202   unsigned int imageDoesOverlap:1;
203   unsigned int isBordered:1;
204   unsigned int drawing:1;
205   unsigned int highlightByGray:1;
206   unsigned int highlightByBackground:1;
207   unsigned int highlightByContents:1;
208   unsigned int changeGray:1;
209   unsigned int changeBackground:1;
210   unsigned int changeContents:1;
211   unsigned int isPushin:1;
212 #endif
213 } GSButtonCellFlags;
214 
215 typedef union _GSButtonCellFlagsUnion
216 {
217   GSButtonCellFlags flags;
218   uint32_t          value;
219 } GSButtonCellFlagsUnion;
220 
221 typedef struct _GSButtonCellFlags2 {
222 #if GS_WORDS_BIGENDIAN == 1
223   unsigned int	keyEquivalentModifierMask:24;
224   unsigned int	imageScaling:2;
225   unsigned int	bezelStyle2:1;
226   unsigned int	mouseInside:1;
227   unsigned int	showsBorderOnlyWhileMouseInside:1;
228   unsigned int	bezelStyle:3;
229 #else
230   unsigned int	bezelStyle:3;
231   unsigned int	showsBorderOnlyWhileMouseInside:1;
232   unsigned int	mouseInside:1;
233   unsigned int	bezelStyle2:1;
234   unsigned int	imageScaling:2;
235   unsigned int	keyEquivalentModifierMask:24;
236 #endif
237 } GSButtonCellFlags2;
238 
239 typedef union _GSButtonCellFlags2Union
240 {
241   GSButtonCellFlags2 flags;
242   uint32_t           value;
243 } GSButtonCellFlags2Union;
244 
245 typedef struct _GSvFlags
246 {
247 #if GS_WORDS_BIGENDIAN == 1
248   unsigned int isHidden:1;
249   unsigned int unused1:3;
250   unsigned int unused2:4;
251   unsigned int unused3:4;
252   unsigned int unused4:4;
253   unsigned int unused5:4;
254   unsigned int unused6:3;
255   unsigned int autoresizesSubviews:1;
256   unsigned int unused7:2;
257   unsigned int autoresizingMask:6;
258 #else
259   unsigned int autoresizingMask:6;
260   unsigned int unused7:2;
261   unsigned int autoresizesSubviews:1;
262   unsigned int unused6:3;
263   unsigned int unused5:4;
264   unsigned int unused4:4;
265   unsigned int unused3:4;
266   unsigned int unused2:4;
267   unsigned int unused1:3;
268   unsigned int isHidden:1;
269 #endif
270 } GSvFlags;
271 
272 typedef union _GSvFlagsUnion
273 {
274   GSvFlags flags;
275   uint32_t value;
276 } GSvFlagsUnion;
277 
278 typedef struct _GSTabViewTypeFlags
279 {
280 #if GS_WORDS_BIGENDIAN == 1
281   unsigned int reserved1:1;
282   unsigned int controlTint:3;
283   unsigned int controlSize:2;
284   unsigned int reserved2:18;
285   unsigned int tabPosition:5;
286   unsigned int tabViewBorderType:3;
287 #else
288   unsigned int tabViewBorderType:3;
289   unsigned int tabPosition:5;
290   unsigned int reserved2:18;
291   unsigned int controlSize:2;
292   unsigned int controlTint:3;
293   unsigned int reserved1:1;
294 #endif
295 } GSTabViewTypeFlags;
296 
297 typedef union _GSTabViewTypeFlagsUnion
298 {
299   GSTabViewTypeFlags flags;
300   unsigned int       value;
301 } GSTabViewTypeFlagsUnion;
302 
303 /*
304  * Nib compatibility struct.  This structure is used to
305  * pull the attributes out of the nib that we need to fill
306  * in the flags.
307  */
308 typedef struct _tableViewFlags
309 {
310 #if GS_WORDS_BIGENDIAN == 1
311   unsigned int columnOrdering:1;
312   unsigned int columnResizing:1;
313   unsigned int drawsGrid:1;
314   unsigned int emptySelection:1;
315   unsigned int multipleSelection:1;
316   unsigned int columnSelection:1;
317   unsigned int unknown1:1;
318   unsigned int columnAutosave:1;
319   unsigned int alternatingRowBackgroundColors:1;
320   unsigned int unknown2:3;
321   unsigned int _unused:20;
322 #else
323   unsigned int _unused:20;
324   unsigned int unknown2:3;
325   unsigned int alternatingRowBackgroundColors:1;
326   unsigned int columnAutosave:1;
327   unsigned int unknown1:1;
328   unsigned int columnSelection:1;
329   unsigned int multipleSelection:1;
330   unsigned int emptySelection:1;
331   unsigned int drawsGrid:1;
332   unsigned int columnResizing:1;
333   unsigned int columnOrdering:1;
334 #endif
335 } GSTableViewFlags;
336 
337 typedef union _GSTableViewFlagsUnion
338 {
339   GSTableViewFlags flags;
340   uint32_t         value;
341 } GSTableViewFlagsUnion;
342 
343 typedef union _GSWindowTemplateFlagsUnion
344 {
345   GSWindowTemplateFlags  flags;
346   uint32_t               value;
347 } GSWindowTemplateFlagsUnion;
348 
349 typedef struct _GSMatrixFlags {
350 #if GS_WORDS_BIGENDIAN == 1
351   unsigned int isHighlight:1;
352   unsigned int isRadio:1;
353   unsigned int isList:1;
354   unsigned int allowsEmptySelection:1;
355   unsigned int autoScroll:1;
356   unsigned int selectionByRect:1;
357   unsigned int drawCellBackground:1;
358   unsigned int drawBackground:1;
359   unsigned int autosizesCells:1;
360   unsigned int drawingAncestor:1;
361   unsigned int tabKeyTraversesCells:1;
362   unsigned int tabKeyTraversesCellsExplicitly:1;
363   unsigned int canSearchIncrementally:1;
364   unsigned int unused:19;
365 #else
366   unsigned int unused:19;
367   unsigned int canSearchIncrementally:1;
368   unsigned int tabKeyTraversesCellsExplicitly:1;
369   unsigned int tabKeyTraversesCells:1;
370   unsigned int drawingAncestor:1;
371   unsigned int autosizesCells:1;
372   unsigned int drawBackground:1;
373   unsigned int drawCellBackground:1;
374   unsigned int selectionByRect:1;
375   unsigned int autoScroll:1;
376   unsigned int allowsEmptySelection:1;
377   unsigned int isList:1;
378   unsigned int isRadio:1;
379   unsigned int isHighlight:1;
380 #endif
381 } GSMatrixFlags;
382 
383 typedef union _GSMatrixFlagsUnion
384 {
385   GSMatrixFlags flags;
386   unsigned int  value;
387 } GSMatrixFlagsUnion;
388 
389 #endif // _GNUstep_H_GSCodingFlags
390