-
Notifications
You must be signed in to change notification settings - Fork 3
/
silicon.h
3677 lines (3115 loc) · 158 KB
/
silicon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2023 ColleagueRiley [email protected]
* 2022-2023 EimaMei/Sacode
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following r estrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
*
*/
/*
define args
(MAKE SURE ** #define SILICON_IMPLEMENTATION ** is in exactly one header or you use -D SILICON_IMPLEMENTATION)
#define SI_NO_RELEASE - do not define release (just use NSRelease)
*/
#ifndef SILICON_H
#define SILICON_H
#include <ApplicationServices/ApplicationServices.h>
#include <CoreVideo/CVDisplayLink.h>
#include <objc/runtime.h>
#include <objc/message.h>
#define SILICON_H
#ifdef SICDEF_STATIC
#define SICDEF static /* I have this so I can get warnings for functions that aren't defined */
#else
#define SICDEF static inline
#endif
#define NS_ENUM(type, name) type name; enum
#ifndef GL_SILENCE_DEPRECATION
#define NS_OPENGL_DEPRECATED(minVers, maxVers) API_DEPRECATED("OpenGL API deprecated; please use Metal and MetalKit. (Define GL_SILENCE_DEPRECATION to silence these warnings.)", macos(minVers,maxVers))
#define NS_OPENGL_ENUM_DEPRECATED(minVers, maxVers) API_DEPRECATED("OpenGL API deprecated; please use Metal and MetalKit. (Define GL_SILENCE_DEPRECATION to silence these warnings.)", macos(minVers,maxVers))
#define NS_OPENGL_CLASS_DEPRECATED(message, minVers, maxVers) API_DEPRECATED(message, macos(minVers,maxVers))
#else
#define NS_OPENGL_DEPRECATED(minVers, maxVers) API_AVAILABLE(macos(minVers))
#define NS_OPENGL_ENUM_DEPRECATED(minVers, maxVers) API_AVAILABLE(macos(minVers))
#define NS_OPENGL_CLASS_DEPRECATED(message, minVers, maxVers) API_AVAILABLE(macos(minVers))
#endif
#ifdef __cplusplus
#define APPKIT_EXTERN extern "C"
#else
#define APPKIT_EXTERN extern
#endif
#define macos_version(major, minor) major * 10000 + minor * 100
#define si_define_property(class, type, name, set_name, arg_name) \
SICDEF type class##_##name(class* arg_name); \
SICDEF void class##_set##set_name(class* arg_name, type name)
/* Useful Objective-C class macros. */
/* In cases where you need the actual Objective-C class type as a regular function argument. */
#define _MAC_CAT0(a, b) a##b
#define _MAC_CAT(a, b) _MAC_CAT0(a, b)
#define _(callable) _MAC_CAT(__, callable)()
#define objctype _
/* Gets the size of the class. */
#define sizeof_class(typename) class_getInstanceSize(class(typename))
#define NSUIntegerMax ULONG_MAX
#define si_SEL_exists(name) si_impl_SEL_exists(name, __FILE__, __LINE__)
#define selector(function) si_SEL_exists(#function":")
SICDEF SEL si_impl_SEL_exists(const char* name, const char* filename, int line);
#ifdef SILICON_IMPLEMENTATION
#define SILICON_ARRAY_IMPLEMENTATION
#endif
#define SI_DEFAULT "NSObject"
#if !defined(siArray)
/* Silicon array type. */
#define siArray(type) type*
/* Header for the array. */
typedef struct siArrayHeader {
size_t count;
/* TODO(EimaMei): Add a `type_width` later on. */
} siArrayHeader;
/* Gets the header of the siArray. */
#define SI_ARRAY_HEADER(s) ((siArrayHeader*)s - 1)
#endif
/* Initializes a Silicon array. */
void* si_array_init(void* allocator, size_t sizeof_element, size_t count);
/* Reserves a Silicon array with the provided element count. */
void* si_array_init_reserve(size_t sizeof_element, size_t count);
/* Gets the element count of the array. */
#if !defined(SI_INCLUDE_SI_H)
#define si_array_len(array) (SI_ARRAY_HEADER(array)->count)
#else
#define si_array_len(array) (SI_ARRAY_HEADER(array)->len)
#endif
/* Frees the array from memory. */
void si_array_free(siArray(void) array);
void si_impl_func_to_SEL_with_name(const char* class_name, const char* register_name, void* function);
/* Creates an Objective-C method (SEL) from a regular C function. */
#define si_func_to_SEL(class_name, function) si_impl_func_to_SEL_with_name(class_name, #function":", function)
/* Creates an Objective-C method (SEL) from a regular C function with the option to set the register name.*/
#define si_func_to_SEL_with_name(class_name, register_name, function) si_impl_func_to_SEL_with_name(class_name, register_name":", function)
typedef CGRect NSRect;
typedef CGPoint NSPoint;
typedef CGSize NSSize;
typedef void NSWindow;
typedef void NSWindowController;
typedef void NSApplication;
typedef void NSEvent;
typedef void NSScreen;
typedef void NSColor;
typedef void NSCursor;
typedef void NSPasteboard;
typedef void NSOpenGLContext;
typedef void NSOpenGLPixelFormat;
typedef void NSDraggingInfo;
typedef void NSImageRep;
typedef void NSGraphicsContext;
typedef void NSBitmapImageRep;
typedef void NSMenu;
typedef void NSMenuItem;
typedef void NSImage;
typedef void NSView;
typedef void NSViewController;
typedef void NSAutoreleasePool;
typedef void NSFontManager;
typedef void NSTextField;
typedef void NSProcessInfo;
typedef void NSButton;
typedef void NSComboBox;
typedef void NSSlider;
typedef void NSProgressIndicator;
typedef void NSSavePanel;
typedef void NSOpenPanel;
typedef void NSColorPanel;
typedef void NSBundle;
typedef void NSNotification;
typedef void NSNotificationCenter;
typedef void CALayer;
#ifndef __OBJC__
typedef void NSDictionary;
typedef void NSURL;
typedef void NSFont;
typedef void NSDate;
typedef void NSString;
typedef void NSArray;
typedef void NSThread;
#else
#endif
typedef NSView NSOpenGLView;
typedef const char* NSPasteboardType;
typedef unsigned long NSUInteger;
typedef long NSInteger;
typedef NSInteger NSModalResponse;
typedef uint32_t NSOpenGLPixelFormatAttribute NS_OPENGL_DEPRECATED(10.0, 10.14);
typedef NS_ENUM(NSUInteger, NSWindowStyleMask) {
NSWindowStyleMaskBorderless = 0,
NSWindowStyleMaskTitled = 1 << 0,
NSWindowStyleMaskClosable = 1 << 1,
NSWindowStyleMaskMiniaturizable = 1 << 2,
NSWindowStyleMaskResizable = 1 << 3,
NSWindowStyleMaskTexturedBackground = 1 << 8, /* deprecated */
NSWindowStyleMaskUnifiedTitleAndToolbar = 1 << 12,
NSWindowStyleMaskFullScreen = 1 << 14,
NSWindowStyleMaskFullSizeContentView = 1 << 15,
NSWindowStyleMaskUtilityWindow = 1 << 4,
NSWindowStyleMaskDocModalWindow = 1 << 6,
NSWindowStyleMaskNonactivatingPanel = 1 << 7,
NSWindowStyleMaskHUDWindow = 1 << 13
};
typedef NS_ENUM(NSUInteger, NSBackingStoreType) {
NSBackingStoreRetained = 0,
NSBackingStoreNonretained = 1,
NSBackingStoreBuffered = 2
};
typedef NS_ENUM(NSUInteger, NSEventType) { /* various types of events */
NSEventTypeLeftMouseDown = 1,
NSEventTypeLeftMouseUp = 2,
NSEventTypeRightMouseDown = 3,
NSEventTypeRightMouseUp = 4,
NSEventTypeMouseMoved = 5,
NSEventTypeLeftMouseDragged = 6,
NSEventTypeRightMouseDragged = 7,
NSEventTypeMouseEntered = 8,
NSEventTypeMouseExited = 9,
NSEventTypeKeyDown = 10,
NSEventTypeKeyUp = 11,
NSEventTypeFlagsChanged = 12,
NSEventTypeAppKitDefined = 13,
NSEventTypeSystemDefined = 14,
NSEventTypeApplicationDefined = 15,
NSEventTypePeriodic = 16,
NSEventTypeCursorUpdate = 17,
NSEventTypeScrollWheel = 22,
NSEventTypeTabletPoint = 23,
NSEventTypeTabletProximity = 24,
NSEventTypeOtherMouseDown = 25,
NSEventTypeOtherMouseUp = 26,
NSEventTypeOtherMouseDragged = 27,
/* The following event types are available on some hardware on 10.5.2 and later */
NSEventTypeGesture API_AVAILABLE(macos(10.5)) = 29,
NSEventTypeMagnify API_AVAILABLE(macos(10.5)) = 30,
NSEventTypeSwipe API_AVAILABLE(macos(10.5)) = 31,
NSEventTypeRotate API_AVAILABLE(macos(10.5)) = 18,
NSEventTypeBeginGesture API_AVAILABLE(macos(10.5)) = 19,
NSEventTypeEndGesture API_AVAILABLE(macos(10.5)) = 20,
NSEventTypeSmartMagnify API_AVAILABLE(macos(10.8)) = 32,
NSEventTypeQuickLook API_AVAILABLE(macos(10.8)) = 33,
NSEventTypePressure API_AVAILABLE(macos(10.10.3)) = 34,
NSEventTypeDirectTouch API_AVAILABLE(macos(10.10)) = 37,
NSEventTypeChangeMode API_AVAILABLE(macos(10.15)) = 38,
};
typedef NS_ENUM(unsigned long long, NSEventMask) { /* masks for the types of events */
NSEventMaskLeftMouseDown = 1ULL << NSEventTypeLeftMouseDown,
NSEventMaskLeftMouseUp = 1ULL << NSEventTypeLeftMouseUp,
NSEventMaskRightMouseDown = 1ULL << NSEventTypeRightMouseDown,
NSEventMaskRightMouseUp = 1ULL << NSEventTypeRightMouseUp,
NSEventMaskMouseMoved = 1ULL << NSEventTypeMouseMoved,
NSEventMaskLeftMouseDragged = 1ULL << NSEventTypeLeftMouseDragged,
NSEventMaskRightMouseDragged = 1ULL << NSEventTypeRightMouseDragged,
NSEventMaskMouseEntered = 1ULL << NSEventTypeMouseEntered,
NSEventMaskMouseExited = 1ULL << NSEventTypeMouseExited,
NSEventMaskKeyDown = 1ULL << NSEventTypeKeyDown,
NSEventMaskKeyUp = 1ULL << NSEventTypeKeyUp,
NSEventMaskFlagsChanged = 1ULL << NSEventTypeFlagsChanged,
NSEventMaskAppKitDefined = 1ULL << NSEventTypeAppKitDefined,
NSEventMaskSystemDefined = 1ULL << NSEventTypeSystemDefined,
NSEventMaskApplicationDefined = 1ULL << NSEventTypeApplicationDefined,
NSEventMaskPeriodic = 1ULL << NSEventTypePeriodic,
NSEventMaskCursorUpdate = 1ULL << NSEventTypeCursorUpdate,
NSEventMaskScrollWheel = 1ULL << NSEventTypeScrollWheel,
NSEventMaskTabletPoint = 1ULL << NSEventTypeTabletPoint,
NSEventMaskTabletProximity = 1ULL << NSEventTypeTabletProximity,
NSEventMaskOtherMouseDown = 1ULL << NSEventTypeOtherMouseDown,
NSEventMaskOtherMouseUp = 1ULL << NSEventTypeOtherMouseUp,
NSEventMaskOtherMouseDragged = 1ULL << NSEventTypeOtherMouseDragged,
};
/* The following event masks are available on some hardware on 10.5.2 and later */
#define NSEventMaskGesture API_AVAILABLE(macos(10.5)) (1ULL << NSEventTypeGesture)
#define NSEventMaskMagnify API_AVAILABLE(macos(10.5)) (1ULL << NSEventTypeMagnify)
#define NSEventMaskSwipe API_AVAILABLE(macos(10.5)) (1ULL << NSEventTypeSwipe)
#define NSEventMaskRotate API_AVAILABLE(macos(10.5)) (1ULL << NSEventTypeRotate)
#define NSEventMaskBeginGesture API_AVAILABLE(macos(10.5)) (1ULL << NSEventTypeBeginGesture)
#define NSEventMaskEndGesture API_AVAILABLE(macos(10.5)) (1ULL << NSEventTypeEndGesture)
/* Note: You can only use these event masks on 64 bit. In other words, you cannot setup a local, nor global, event monitor for these event types on 32 bit. Also, you cannot search the event queue for them (nextEventMatchingMask:...) on 32 bit. */
#define NSEventMaskSmartMagnify API_AVAILABLE(macos(10.8)) (1ULL << NSEventTypeSmartMagnify)
#define NSEventMaskPressure API_AVAILABLE(macos(10.10.3)) (1ULL << NSEventTypePressure)
#define NSEventMaskDirectTouch API_AVAILABLE(macos(10.12.2)) (1ULL << NSEventTypeDirectTouch)
#define NSEventMaskChangeMode API_AVAILABLE(macos(10.15)) (1ULL << NSEventTypeChangeMode)
#define NSEventMaskAny NSUIntegerMax
typedef NS_ENUM(NSInteger, NSOpenGLContextParameter) {
NSOpenGLContextParameterSwapInterval NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 222, /* 1 param. 0 -> Don't sync, 1 -> Sync to vertical retrace */
NSOpenGLContextParameterSurfaceOrder NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 235, /* 1 param. 1 -> Above Window (default), -1 -> Below Window */
NSOpenGLContextParameterSurfaceOpacity NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 236, /* 1 param. 1-> Surface is opaque (default), 0 -> non-opaque */
NSOpenGLContextParameterSurfaceBackingSize NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 304, /* 2 params. Width/height of surface backing size */
NSOpenGLContextParameterReclaimResources NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 308, /* 0 params. */
NSOpenGLContextParameterCurrentRendererID NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 309, /* 1 param. Retrieves the current renderer ID */
NSOpenGLContextParameterGPUVertexProcessing NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 310, /* 1 param. Currently processing vertices with GPU (get) */
NSOpenGLContextParameterGPUFragmentProcessing NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 311, /* 1 param. Currently processing fragments with GPU (get) */
NSOpenGLContextParameterHasDrawable NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 314, /* 1 param. Boolean returned if drawable is attached */
NSOpenGLContextParameterMPSwapsInFlight NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 315, /* 1 param. Max number of swaps queued by the MP GL engine */
NSOpenGLContextParameterSwapRectangle API_DEPRECATED("", macos(10.0,10.14)) = 200, /* 4 params. Set or get the swap rectangle {x, y, w, h} */
NSOpenGLContextParameterSwapRectangleEnable API_DEPRECATED("", macos(10.0,10.14)) = 201, /* Enable or disable the swap rectangle */
NSOpenGLContextParameterRasterizationEnable API_DEPRECATED("", macos(10.0,10.14)) = 221, /* Enable or disable all rasterization */
NSOpenGLContextParameterStateValidation API_DEPRECATED("", macos(10.0,10.14)) = 301, /* Validate state for multi-screen functionality */
NSOpenGLContextParameterSurfaceSurfaceVolatile API_DEPRECATED("", macos(10.0,10.14)) = 306, /* 1 param. Surface volatile state */
} NS_OPENGL_DEPRECATED(10.0, 10.14);
typedef NS_ENUM(NSUInteger, NSEventModifierFlags) {
NSEventModifierFlagCapsLock = 1 << 16, // Set if Caps Lock key is pressed.
NSEventModifierFlagShift = 1 << 17, // Set if Shift key is pressed.
NSEventModifierFlagControl = 1 << 18, // Set if Control key is pressed.
NSEventModifierFlagOption = 1 << 19, // Set if Option or Alternate key is pressed.
NSEventModifierFlagCommand = 1 << 20, // Set if Command key is pressed.
NSEventModifierFlagNumericPad = 1 << 21, // Set if any key in the numeric keypad is pressed.
NSEventModifierFlagHelp = 1 << 22, // Set if the Help key is pressed.
NSEventModifierFlagFunction = 1 << 23, // Set if any function key is pressed.
};
// Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
#define NSEventModifierFlagDeviceIndependentFlagsMask 0xffff0000UL
typedef NS_ENUM(NSUInteger, NSDragOperation) {
NSDragOperationNone = 0,
NSDragOperationCopy = 1,
NSDragOperationLink = 2,
NSDragOperationGeneric = 4,
NSDragOperationPrivate = 8,
NSDragOperationMove = 16,
NSDragOperationDelete = 32,
NSDragOperationAll_Obsolete API_DEPRECATED("", macos(10.0,10.10)) = 15, // Use NSDragOperationEvery
NSDragOperationAll API_DEPRECATED("", macos(10.0,10.10)) = NSDragOperationAll_Obsolete, // Use NSDragOperationEvery
};
#define NSDragOperationEvery = NSUIntegerMax,
typedef NS_ENUM(NSUInteger, NSBitmapFormat) {
NSBitmapFormatAlphaFirst = 1 << 0, // 0 means is alpha last (RGBA, CMYKA, etc.)
NSBitmapFormatAlphaNonpremultiplied = 1 << 1, // 0 means is premultiplied
NSBitmapFormatFloatingPointSamples = 1 << 2, // 0 is integer
NSBitmapFormatSixteenBitLittleEndian API_AVAILABLE(macos(10.10)) = (1 << 8),
NSBitmapFormatThirtyTwoBitLittleEndian API_AVAILABLE(macos(10.10)) = (1 << 9),
NSBitmapFormatSixteenBitBigEndian API_AVAILABLE(macos(10.10)) = (1 << 10),
NSBitmapFormatThirtyTwoBitBigEndian API_AVAILABLE(macos(10.10)) = (1 << 11)
};
typedef NS_ENUM(NSUInteger, NSFontTraitMask) {
NSItalicFontMask = 0x00000001,
NSBoldFontMask = 0x00000002,
NSUnboldFontMask = 0x00000004,
NSNonStandardCharacterSetFontMask = 0x00000008,
NSNarrowFontMask = 0x00000010,
NSExpandedFontMask = 0x00000020,
NSCondensedFontMask = 0x00000040,
NSSmallCapsFontMask = 0x00000080,
NSPosterFontMask = 0x00000100,
NSCompressedFontMask = 0x00000200,
NSFixedPitchFontMask = 0x00000400,
NSUnitalicFontMask = 0x01000000
};
typedef NS_ENUM(NSUInteger, NSButtonType) {
NSButtonTypeMomentaryLight = 0,
NSButtonTypePushOnPushOff = 1,
NSButtonTypeToggle = 2,
NSButtonTypeSwitch = 3,
NSButtonTypeRadio = 4,
NSButtonTypeMomentaryChange = 5,
NSButtonTypeOnOff = 6,
NSButtonTypeMomentaryPushIn = 7,
NSButtonTypeAccelerator API_AVAILABLE(macos(10.10.3)) = 8,
NSButtonTypeMultiLevelAccelerator API_AVAILABLE(macos(10.10.3)) = 9,
};
// Bitset options for the autoresizingMask
typedef NS_ENUM(NSUInteger, NSAutoresizingMaskOptions) {
NSViewNotSizable = 0,
NSViewMinXMargin = 1,
NSViewWidthSizable = 2,
NSViewMaxXMargin = 4,
NSViewMinYMargin = 8,
NSViewHeightSizable = 16,
NSViewMaxYMargin = 32
};
typedef NS_ENUM(NSUInteger, NSBezelStyle) {
NSBezelStyleRounded = 1,
NSBezelStyleRegularSquare = 2,
NSBezelStyleDisclosure = 5,
NSBezelStyleShadowlessSquare = 6,
NSBezelStyleCircular = 7,
NSBezelStyleTexturedSquare = 8,
NSBezelStyleHelpButton = 9,
NSBezelStyleSmallSquare = 10,
NSBezelStyleTexturedRounded = 11,
NSBezelStyleRoundRect = 12,
NSBezelStyleRecessed = 13,
NSBezelStyleRoundedDisclosure = 14,
NSBezelStyleInline API_AVAILABLE(macos(10.7)) = 15,
};
typedef NSInteger NSControlStateValue;
static const NSControlStateValue NSControlStateValueMixed = -1;
static const NSControlStateValue NSControlStateValueOff = 0;
static const NSControlStateValue NSControlStateValueOn = 1;
/*
** Attribute names for [NSOpenGLPixelFormat initWithAttributes]
** and [NSOpenGLPixelFormat getValues:forAttribute:forVirtualScreen].
*/
enum {
NSOpenGLPFAAllRenderers NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 1, /* choose from all available renderers */
NSOpenGLPFATripleBuffer NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 3, /* choose a triple buffered pixel format */
NSOpenGLPFADoubleBuffer NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 5, /* choose a double buffered pixel format */
NSOpenGLPFAAuxBuffers NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 7, /* number of aux buffers */
NSOpenGLPFAColorSize NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 8, /* number of color buffer bits */
NSOpenGLPFAAlphaSize NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 11, /* number of alpha component bits */
NSOpenGLPFADepthSize NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 12, /* number of depth buffer bits */
NSOpenGLPFAStencilSize NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 13, /* number of stencil buffer bits */
NSOpenGLPFAAccumSize NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 14, /* number of accum buffer bits */
NSOpenGLPFAMinimumPolicy NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 51, /* never choose smaller buffers than requested */
NSOpenGLPFAMaximumPolicy NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 52, /* choose largest buffers of type requested */
NSOpenGLPFASampleBuffers NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 55, /* number of multi sample buffers */
NSOpenGLPFASamples NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 56, /* number of samples per multi sample buffer */
NSOpenGLPFAAuxDepthStencil NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 57, /* each aux buffer has its own depth stencil */
NSOpenGLPFAColorFloat NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 58, /* color buffers store floating point pixels */
NSOpenGLPFAMultisample NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 59, /* choose multisampling */
NSOpenGLPFASupersample NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 60, /* choose supersampling */
NSOpenGLPFASampleAlpha NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 61, /* request alpha filtering */
NSOpenGLPFARendererID NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 70, /* request renderer by ID */
NSOpenGLPFANoRecovery NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 72, /* disable all failure recovery systems */
NSOpenGLPFAAccelerated NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 73, /* choose a hardware accelerated renderer */
NSOpenGLPFAClosestPolicy NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 74, /* choose the closest color buffer to request */
NSOpenGLPFABackingStore NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 76, /* back buffer contents are valid after swap */
NSOpenGLPFAScreenMask NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 84, /* bit mask of supported physical screens */
NSOpenGLPFAAllowOfflineRenderers NS_OPENGL_ENUM_DEPRECATED(10.5, 10.14) = 96, /* allow use of offline renderers */
NSOpenGLPFAAcceleratedCompute NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 97, /* choose a hardware accelerated compute device */
NSOpenGLPFAOpenGLProfile NS_OPENGL_ENUM_DEPRECATED(10.7, 10.14) = 99, /* specify an OpenGL Profile to use */
NSOpenGLProfileVersionLegacy NS_OPENGL_ENUM_DEPRECATED(10.7, 10.14) = 0x1000, /* The requested profile is a legacy (pre-OpenGL 3.0) profile. */
NSOpenGLProfileVersion3_2Core NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 0x3200, /* The 3.2 Profile of OpenGL */
NSOpenGLProfileVersion4_1Core NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 0x3200, /* The 4.1 profile of OpenGL */
NSOpenGLPFAVirtualScreenCount NS_OPENGL_ENUM_DEPRECATED(10.0, 10.14) = 128, /* number of virtual screens in this format */
NSOpenGLPFAStereo API_DEPRECATED("", macos(10.0,10.12)) = 6,
NSOpenGLPFAOffScreen API_DEPRECATED("", macos(10.0,10.7)) = 53,
NSOpenGLPFAFullScreen API_DEPRECATED("", macos(10.0,10.6)) = 54,
NSOpenGLPFASingleRenderer API_DEPRECATED("", macos(10.0,10.9)) = 71,
NSOpenGLPFARobust API_DEPRECATED("", macos(10.0,10.5)) = 75,
NSOpenGLPFAMPSafe API_DEPRECATED("", macos(10.0,10.5)) = 78,
NSOpenGLPFAWindow API_DEPRECATED("", macos(10.0,10.9)) = 80,
NSOpenGLPFAMultiScreen API_DEPRECATED("", macos(10.0,10.5)) = 81,
NSOpenGLPFACompliant API_DEPRECATED("", macos(10.0,10.9)) = 83,
NSOpenGLPFAPixelBuffer API_DEPRECATED("", macos(10.3,10.7)) = 90,
NSOpenGLPFARemotePixelBuffer API_DEPRECATED("", macos(10.3,10.7)) = 91,
};
typedef uint32_t NSOpenGLPixelFormatAttribute NS_OPENGL_DEPRECATED(10.0, 10.14);
typedef enum NSApplicationActivationPolicy {
NSApplicationActivationPolicyRegular,
NSApplicationActivationPolicyAccessory,
NSApplicationActivationPolicyProhibited
} NSApplicationActivationPolicy;
enum {
NSUpArrowFunctionKey = 0xF700,
NSDownArrowFunctionKey = 0xF701,
NSLeftArrowFunctionKey = 0xF702,
NSRightArrowFunctionKey = 0xF703,
NSF1FunctionKey = 0xF704,
NSF2FunctionKey = 0xF705,
NSF3FunctionKey = 0xF706,
NSF4FunctionKey = 0xF707,
NSF5FunctionKey = 0xF708,
NSF6FunctionKey = 0xF709,
NSF7FunctionKey = 0xF70A,
NSF8FunctionKey = 0xF70B,
NSF9FunctionKey = 0xF70C,
NSF10FunctionKey = 0xF70D,
NSF11FunctionKey = 0xF70E,
NSF12FunctionKey = 0xF70F,
NSF13FunctionKey = 0xF710,
NSF14FunctionKey = 0xF711,
NSF15FunctionKey = 0xF712,
NSF16FunctionKey = 0xF713,
NSF17FunctionKey = 0xF714,
NSF18FunctionKey = 0xF715,
NSF19FunctionKey = 0xF716,
NSF20FunctionKey = 0xF717,
NSF21FunctionKey = 0xF718,
NSF22FunctionKey = 0xF719,
NSF23FunctionKey = 0xF71A,
NSF24FunctionKey = 0xF71B,
NSF25FunctionKey = 0xF71C,
NSF26FunctionKey = 0xF71D,
NSF27FunctionKey = 0xF71E,
NSF28FunctionKey = 0xF71F,
NSF29FunctionKey = 0xF720,
NSF30FunctionKey = 0xF721,
NSF31FunctionKey = 0xF722,
NSF32FunctionKey = 0xF723,
NSF33FunctionKey = 0xF724,
NSF34FunctionKey = 0xF725,
NSF35FunctionKey = 0xF726,
NSInsertFunctionKey = 0xF727,
NSDeleteFunctionKey = 0xF728,
NSHomeFunctionKey = 0xF729,
NSBeginFunctionKey = 0xF72A,
NSEndFunctionKey = 0xF72B,
NSPageUpFunctionKey = 0xF72C,
NSPageDownFunctionKey = 0xF72D,
NSPrintScreenFunctionKey = 0xF72E,
NSScrollLockFunctionKey = 0xF72F,
NSPauseFunctionKey = 0xF730,
NSSysReqFunctionKey = 0xF731,
NSBreakFunctionKey = 0xF732,
NSResetFunctionKey = 0xF733,
NSStopFunctionKey = 0xF734,
NSMenuFunctionKey = 0xF735,
NSUserFunctionKey = 0xF736,
NSSystemFunctionKey = 0xF737,
NSPrintFunctionKey = 0xF738,
NSClearLineFunctionKey = 0xF739,
NSClearDisplayFunctionKey = 0xF73A,
NSInsertLineFunctionKey = 0xF73B,
NSDeleteLineFunctionKey = 0xF73C,
NSInsertCharFunctionKey = 0xF73D,
NSDeleteCharFunctionKey = 0xF73E,
NSPrevFunctionKey = 0xF73F,
NSNextFunctionKey = 0xF740,
NSSelectFunctionKey = 0xF741,
NSExecuteFunctionKey = 0xF742,
NSUndoFunctionKey = 0xF743,
NSRedoFunctionKey = 0xF744,
NSFindFunctionKey = 0xF745,
NSHelpFunctionKey = 0xF746,
NSModeSwitchFunctionKey = 0xF747,
NSBackspaceCharacter = 0x0008,
NSTabCharacter = 0x0009,
NSNewlineCharacter = 0x000a,
NSCarriageReturnCharacter = 0x000d
};
/* init function, this function is run by `NSApplication_sharedApplication` */
SICDEF void si_initNS(void);
/* release objects */
SICDEF id NSAutoRelease(id object);
SICDEF id NSInit(void* class);
SICDEF void NSRelease(id object);
SICDEF void NSRetain(id object);
#ifndef SI_NO_RELEASE
#define release NSRelease
#endif
/* ============ Geometry functions ============ */
/* Creates a new NSRect from the specified values. */
SICDEF NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h);
/* Creates a new NSPoint from the specified values. */
SICDEF NSPoint NSMakePoint(CGFloat x, CGFloat y);
/* Returns a new NSSize from the specified values. */
SICDEF NSSize NSMakeSize(CGFloat w, CGFloat h);
/* Returns the largest x coordinate of a given rectangle. */
SICDEF CGFloat NSMaxX(NSRect aRect);
/* Returns the largest y coordinate of a given rectangle. */
SICDEF CGFloat NSMaxY(NSRect aRect);
/* Returns the x coordinate of a given rectangle’s midpoint. */
SICDEF CGFloat NSMidX(NSRect aRect);
/* Returns the y coordinate of a given rectangle’s midpoint. */
SICDEF CGFloat NSMidY(NSRect aRect);
/* Returns the smallest x coordinate of a given rectangle. */
SICDEF CGFloat NSMinX(NSRect aRect);
/* Returns the smallest y coordinate of a given rectangle. */
SICDEF CGFloat NSMinY(NSRect aRect);
/* Returns the width of the specified rectangle. */
SICDEF CGFloat NSWidth(NSRect aRect);
/* Returns the height of a given rectangle. */
SICDEF CGFloat NSHeight(NSRect aRect);
/* Returns an NSRect typecast from a CGRect. */
SICDEF NSRect NSRectFromCGRect(CGRect cgrect);
/* Returns a CGRect typecast from an NSRect. */
SICDEF CGRect NSRectToCGRect(NSRect nsrect);
/* Returns an NSPoint typecast from a CGPoint. */
SICDEF NSPoint NSPointFromCGPoint(CGPoint cgpoint);
/* Returns a CGPoint typecast from an NSPoint. */
SICDEF CGPoint NSPointToCGPoint(NSPoint nspoint);
/* Returns an NSSize typecast from a CGSize. */
SICDEF NSSize NSSizeFromCGSize(CGSize cgsize);
/* Returns a CGSize typecast from an NSSize. */
SICDEF CGSize NSSizeToCGSize(NSSize nssize);
/* Returns a Boolean value that indicates whether a given point is in a given rectangle. */
SICDEF bool NSPointInRect(NSPoint aPoint, NSRect aRect);
/* ============ NSColor ============ */
/* ====== NSColor functions ====== */
/* */
SICDEF void NSColor_set(NSColor* color);
/* */
SICDEF NSColor* NSColor_colorWithRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha);
/* */
SICDEF NSColor* NSColor_colorWithSRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha);
/* Creates a color object using the given opacity and grayscale values. */
SICDEF NSColor* NSColor_colorWithCalibrated(CGFloat white, CGFloat alpha);
/* ====== NSColor properties ====== */
/* */
SICDEF NSColor* NSColor_clearColor(void);
/* */
SICDEF NSColor* NSColor_keyboardFocusIndicatorColor(void);
/* ============ NSString ============ */
/* ====== NSString functions ====== */
/* converts a C String to an NSString object */
SICDEF NSString* NSString_stringWithUTF8String(const char* str);
/* converts an NString object to a C String */
SICDEF const char* NSString_to_char(NSString* str);
/* the name of a class in string form */
SICDEF NSString* NSStringFromClass(id class);
/* compares an NSString object data with an C String */
SICDEF bool NSString_isEqualChar(NSString* str, const char* str2);
/* compares two NSString objects */
SICDEF bool NSString_isEqual(NSString* str, NSString* str2);
/* ============ NSDictionary ============ */
/* ====== NSDictionary functions ====== */
/* */
SICDEF const char* NSDictionary_objectForKey(NSDictionary* d, const char* str);
/* ============ NSBundle ============ */
/* ====== NSBundle functions ====== */
/* */
SICDEF NSDictionary* NSBundle_infoDictionary(NSBundle* bundle);
/* */
SICDEF NSBundle* NSBundle_mainBundle(void);
/* ============= NSArray ============ */
/* ====== NSArray functions ====== */
/* */
SICDEF NSArray* si_array_to_NSArray(siArray(void) array);
/* */
SICDEF NSUInteger NSArray_count(NSArray* array);
/* */
SICDEF void* NSArray_objectAtIndex(NSArray* array, NSUInteger index);
/* ============= NSBezierPath ============ */
/* ====== NSBezierPath functions ====== */
/* */
SICDEF void NSBezierPath_strokeLine(NSPoint from, NSPoint to);
/* ====== NSAutoreleasePool functions ====== */
/* */
SICDEF NSAutoreleasePool* NSAutoreleasePool_init(void);
SICDEF void NSAutoreleasePool_drain(NSAutoreleasePool* pool);
/* ============= NSDate ============ */
/* ====== NSDate functions ====== */
/* A date object representing a date in the distant future. */
SICDEF NSDate* NSDate_distantFuture(void);
/* A date object representing a date in the distant past. */
SICDEF NSDate* NSDate_distantPast(void);
/* ============ NSProcessInfo ============ */
/* ====== NSProcessInfo functions ====== */
/* */
SICDEF NSProcessInfo* NSProcessInfo_processInfo(void);
/* */
SICDEF const char* NSProcessInfo_processName(NSProcessInfo* processInfo);
/* ============ NSThread ============ */
/* ====== NSProcessInfo properties ====== */
/* (readonly) Returns a Boolean value that indicates whether the current thread
* is the main thread. */
SICDEF bool NSThread_isMainThread(void);
/* ============ NSApplication ============ */
/* ====== NSApplication properties ====== */
/* */
si_define_property(NSApplication, NSMenu*, mainMenu, MainMenu, application);
/* */
si_define_property(NSApplication, NSMenu*, servicesMenu, ServicesMenu, application);
/* */
si_define_property(NSApplication, NSMenu*, helpMenu, HelpMenu, application);
/* */
si_define_property(NSApplication, NSMenu*, windowsMenu, WindowsMenu, application);
/* */
si_define_property(NSApplication, NSApplicationActivationPolicy, activationPolicy, ActivationPolicy, application);
/* */
si_define_property(NSApplication, NSImage*, applicationIconImage, ApplicationIconImage, application);
/* ====== NSApplication functions ====== */
/* */
SICDEF NSApplication* NSApplication_sharedApplication(void);
/* */
SICDEF void NSApplication_finishLaunching(NSApplication* application);
/* */
SICDEF void NSApplication_run(NSApplication* application);
/* */
SICDEF void NSApplication_stop(NSApplication* application, void* view);
/* */
SICDEF void NSApplication_terminate(NSApplication* application, id sender);
/* */
SICDEF void NSApplication_sendEvent(NSApplication* application, NSEvent* event);
/* */
SICDEF void NSApplication_postEvent(NSApplication* application, NSEvent* event, bool atStart);
/* */
SICDEF void NSApplication_updateWindows(NSApplication* application);
/* */
SICDEF void NSApplication_activateIgnoringOtherApps(NSApplication* application, bool flag);
/* */
SICDEF NSEvent* NSApplication_nextEventMatchingMask(NSApplication* application, NSEventMask mask, NSDate* expiration, NSString* mode, bool deqFlag);
/* ============ NSScreen ============ */
/* ====== NSScreen properties ====== */
/* Returns the screen object containing the window with the keyboard focus. */
SICDEF NSScreen* NSScreen_mainScreen(void);
/* The dimensions and location of the screen. */
SICDEF NSRect NSScreen_frame(NSScreen* screen);
/* The current location and dimensions of the visible screen. */
SICDEF NSRect NSScreen_visibleFrame(NSScreen* screen);
/* ============ NSWindow ============ */
/* ====== NSWindow properties ====== */
/* The window’s delegate. */
si_define_property(NSWindow, id, delegate, Delegate, window);
/* The main content view controller for the window. */
si_define_property(NSWindow, NSViewController*, contentViewController, ContentViewController, window);
/* The window’s content view, the highest accessible view object in the window’s view hierarchy. */
si_define_property(NSWindow, NSView*, contentView, ContentView, window);
/* Get/Set the title of the window. */
si_define_property(NSWindow, const char*, title, Title, window);
/* Get/Set the visbility of the window. */
si_define_property(NSWindow, bool, isVisible, IsVisible, window);
/* Get/Set the background color of the window. */
si_define_property(NSWindow, NSColor*, backgroundColor, BackgroundColor, window);
/* Get/set the opaque of the window. */
si_define_property(NSWindow, bool, isOpaque, Opaque, window);
/* The window’s alpha value. */
si_define_property(NSWindow, CGFloat, alphaValue, AlphaValue, window);
/* A Boolean value that indicates whether the window accepts mouse-moved events. */
si_define_property(NSWindow, bool, acceptsMouseMovedEvents, AcceptsMouseMovedEvents, window);
/* (readonly) The window’s frame rectangle in screen coordinates, including the
* title bar. */
SICDEF NSRect NSWindow_frame(NSWindow* window);
/* ====== NSWindow functions ====== */
/* Creates a titled window that contains the specified content view controller. */
SICDEF NSWindow* NSWindow_initWithContentViewController(NSViewController* contentViewController);
/* Initializes the window with the specified values. */
SICDEF NSWindow* NSWindow_init(NSRect contentRect, NSWindowStyleMask style, NSBackingStoreType backingStoreType, bool flag);
/* */
SICDEF void NSWindow_orderFront(NSWindow* window, NSWindow* sender);
/* */
SICDEF void NSWindow_makeKeyAndOrderFront(NSWindow* window, SEL s);
/* */
SICDEF void NSWindow_makeKeyWindow(NSWindow* window);
/* */
SICDEF bool NSWindow_isKeyWindow(NSWindow* window);
/* */
SICDEF bool NSWindow_isVisible(NSWindow* window);
/* */
SICDEF bool NSWindow_isMiniaturized(NSWindow* window);
/* */
SICDEF bool NSWindow_isZoomed(NSWindow* window);
/* */
SICDEF NSWindowStyleMask NSWindow_styleMask(NSWindow* window);
/* */
SICDEF void NSWindow_center(NSWindow* window);
/* */
SICDEF void NSWindow_makeMainWindow(NSWindow* window);
/* */
SICDEF void NSWindow_setFrameAndDisplay(NSWindow* window, NSRect frame, bool display, bool animate);
/* */
SICDEF void NSWindow_performMiniaturize(NSWindow* window, SEL s);
/* */
SICDEF void NSWindow_performZoom(NSWindow* window, SEL s);
/* */
SICDEF NSPoint NSWindow_convertPointFromScreen(NSWindow* window, NSPoint point);
/* Passes a display message down the window’s view hierarchy, thus redrawing all views within the window. */
SICDEF void NSWindow_display(NSWindow* window);
/* Removes the window from the screen. */
SICDEF void NSWindow_close(NSWindow* window);
/* ============ NSView ============ */
/* ====== NSView functions ====== */
/* */
SICDEF NSView* NSView_init(void);
/* */
SICDEF NSView* NSView_initWithFrame(NSRect frameRect);
/* */
SICDEF void NSView_addSubview(NSView* view, NSView* subview);
/* */
SICDEF void NSView_registerForDraggedTypes(NSView* view, siArray(NSPasteboardType) newTypes);
/* ====== NSView properties ====== */
/* The Core Animation layer that the view uses as its backing store. */
si_define_property(NSView, CALayer*, layer, Layer, view);
/* A Boolean value indicating whether the view uses a layer as its backing store. */
si_define_property(NSView, bool, wantslayer, WantsLayer, view);
/* (nullable, readonly, unsafe_unretained) The view’s window object, if it is installed in a window. */
NSWindow* NSView_window(NSView* view);
/* ============ NSWindowController ============ */
/* ====== NSWindowController functions ====== */
/* Returns a window controller initialized with a given window. */
SICDEF NSWindowController* NSWindowController_initWithWindow(NSWindow* window);
/* ====== NSWindow properties ====== */
/* The view controller for the window’s content view. */
si_define_property(NSWindowController, NSViewController*, contentViewController, ContentViewController, windowController);
/* ============ NSTextField ============ */
/* ====== NSTextField properties ====== */
/* */
si_define_property(NSTextField, const char*, stringValue, StringValue, field);
/* */
si_define_property(NSTextField, bool, isBezeled, Bezeled, field);
/* */
si_define_property(NSTextField, bool, drawsBackground, DrawsBackground, field);
/* */
si_define_property(NSTextField, bool, isEditable, Editable, field);
/* */
si_define_property(NSTextField, bool, isSelectable, Selectable, field);
/* */
si_define_property(NSTextField, NSColor*, textColor, TextColor, field);
/* */
si_define_property(NSTextField, NSFont*, font, Font, field);
/* ====== NSTextField functions ====== */
/* Initializes a NSTextField handle. */
SICDEF NSTextField* NSTextField_initWithFrame(NSRect frameRect);
/* ============ NSFontManager ============ */
/* ====== NSFontManager functions ====== */
/* */
SICDEF NSFontManager* NSFontManager_sharedFontManager(void);
/* */
SICDEF NSFont* NSFontManager_convertFont(NSFontManager* manager, NSFont* fontObj);
/* */
SICDEF NSFont* NSFontManager_convertFontToHaveTrait(NSFontManager* manager, NSFont* fontObj, NSFontTraitMask trait);
/* ============ NSFont ============ */
/* ====== NSFont functions ====== */
/* */
SICDEF NSFont* NSFont_init(const char* fontName, CGFloat fontSize);
/* */
SICDEF const char* NSFont_fontName(NSFont* font);
/* ============ NSButton ============ */
/* ====== NSButton properties ====== */
/* */
si_define_property(NSButton, const char*, title, Title, button);
/* */
si_define_property(NSButton, NSBezelStyle, bezelStyle, BezelStyle, button);
/* */
si_define_property(NSButton, id, target, Target, button);
/* */
si_define_property(NSButton, SEL, action, Action, button);
/* */
si_define_property(NSButton, NSAutoresizingMaskOptions, autoresizingMask, AutoresizingMask, button);
/* */
si_define_property(NSButton, NSControlStateValue, state, State, button);
/* */
si_define_property(NSButton, bool, allowsMixedState, AllowsMixedState, button);
/* ====== NSButton functions ====== */
/* */
SICDEF NSButton* NSButton_initWithFrame(NSRect frameRect);
/* */
SICDEF void NSButton_setButtonType(NSButton* button, NSButtonType buttonType);
/* ============ NSComboBox ============ */
/* ====== NSComboBox properties ====== */
/* (read-only) */
SICDEF NSInteger NSComboBox_indexOfSelectedItem(NSComboBox* comboBox);
/* */
si_define_property(NSComboBox, id, target, Target, comboBox);
/* */
si_define_property(NSComboBox, SEL, action, Action, comboBox);
/**/
si_define_property(NSComboBox, NSFont*, font, Font, comboBox);
/* */
si_define_property(NSComboBox, const char*, stringValue, StringValue, field);
/* */
si_define_property(NSComboBox, bool, isBezeled, Bezeled, field);
/* */
si_define_property(NSComboBox, bool, drawsBackground, DrawsBackground, field);
/* */
si_define_property(NSComboBox, bool, isEditable, Editable, field);
/* */
si_define_property(NSComboBox, bool, isSelectable, Selectable, field);
/* */
si_define_property(NSComboBox, NSColor*, textColor, TextColor, field);
/* */
si_define_property(NSComboBox, NSFont*, font, Font, field);
/* ====== NSComboBox functions ====== */
/**/
SICDEF NSComboBox* NSComboBox_initWithFrame(NSRect frameRect);
/* */
SICDEF void NSComboBox_addItem(NSComboBox* comboBox, const char* item);
/* */
SICDEF void NSComboBox_selectItem(NSComboBox* comboBox, NSInteger index);
/* ============ NSEvent ============ */
/* ====== NSEvent functions ====== */
/* */
SICDEF NSEventType NSEvent_type(NSEvent* event);
/* */
SICDEF NSPoint NSEvent_locationInWindow(NSEvent* event);
/* */
SICDEF NSEventModifierFlags NSEvent_modifierFlags(NSEvent* event);
/* */
SICDEF unsigned short NSEvent_keyCode(NSEvent* event);
/* */
SICDEF const char* NSEvent_characters(NSEvent* event);
/* */
SICDEF CGFloat NSEvent_deltaY(NSEvent* event);
/* */
SICDEF unsigned short NSEvent_keyCodeForChar(char* keyStr);
/* */
SICDEF NSPoint NSEvent_mouseLocation(void);
/* */
SICDEF NSWindow* NSEvent_window(NSEvent* event);
/* ============ NSDraggingInfo ============ */
/* ====== NSDraggingInfo properties ====== */
/* */
SICDEF NSPasteboard* NSDraggingInfo_draggingPasteboard(NSDraggingInfo* info);
/* */
SICDEF NSPoint NSDraggingInfo_draggingLocation(NSDraggingInfo* info);
/* */
si_define_property(NSDraggingInfo, NSInteger, numberOfValidItemsForDrop, NumberOfValidItemsForDrop, info);
/* */
SICDEF NSWindow* NSDraggingInfo_draggingDestinationWindow(NSDraggingInfo* info);
/* ============ NSSlider ============ */
/* ====== NSSlider properties ====== */
/**/
si_define_property(NSSlider, id, target, Target, slider);
/* */
si_define_property(NSSlider, SEL, action, Action, slider);
/**/
si_define_property(NSSlider, NSFont*, font, Font, slider);
/* */
si_define_property(NSSlider, double, doubleValue, DoubleValue, slider);
/* */
si_define_property(NSSlider, double, maxValue, MaxValue, slider);
/* ====== NSSlider functions ====== */
/* */
SICDEF NSSlider* NSSlider_initWithFrame(NSRect frameRect);
/* ============ NSProgressIndicator ============ */
/* ====== NSProgressIndicator properties ====== */
/* */
si_define_property(NSProgressIndicator, double, doubleValue, DoubleValue, progressIndicator);
/* */
si_define_property(NSProgressIndicator, double, maxValue, MaxValue, progressIndicator);
/* */
si_define_property(NSProgressIndicator, bool, isIndeterminate, Indeterminate, progressIndicator);
/* ====== NSProgressIndicator functions ====== */
/* */
SICDEF NSProgressIndicator* NSProgressIndicator_init(NSRect frameRect);
/* ============ NSImage ============ */
/* ====== NSImage functions ====== */
/* Initializes and returns an image object with the specified dimensions. */
SICDEF NSImage* NSImage_initWithSize(NSSize size);
/* */
SICDEF NSImage* NSImage_initWithData(unsigned char* bitmapData, NSUInteger length);
/* Initializes a data object with the content of the file at a given path. */
SICDEF NSImage* NSImage_initWithFile(const char* path);
/* */
SICDEF NSImage* NSImage_initWithCGImage(CGImageRef cgImage, NSSize size);
/* Adds the specified image representation object to the image. */
SICDEF void NSImage_addRepresentation(NSImage* image, NSImageRep* imageRep);
/* Removes and releases the specified image representation. */
SICDEF void NSImage_removeRepresentation(NSImage* image, NSImageRep* imageRep);
/* Returns the application’s current cursor. */
SICDEF NSCursor* NSCursor_currentCursor(void);