diff --git a/RSGL.h b/RSGL.h index 8b81d03..ade6d1c 100644 --- a/RSGL.h +++ b/RSGL.h @@ -138,6 +138,8 @@ keys will not be reincluded into RSGL #endif #endif +#define RGFWDEF RSGLDEF + #if !defined(u8) #include @@ -351,6 +353,7 @@ RSGLDEF void RSGL_setFont(u32 font); typedef struct RFont_font RFont_font; RSGLDEF void RSGL_setRFont(RFont_font* font); +RSGLDEF void RSGL_drawText_len(const char* text, size_t len, RSGL_circle c, RSGL_color color); RSGLDEF void RSGL_drawText(const char* text, RSGL_circle c, RSGL_color color); #define RSGL_drawTextF(text, font, c, color) \ RSGL_setFont(font);\ @@ -1249,7 +1252,7 @@ void RSGL_setRFont(RFont_font* font) { RSGL_font.f = font; } -void RSGL_drawText(const char* text, RSGL_circle c, RSGL_color color) { +void RSGL_drawText_len(const char* text, size_t len, RSGL_circle c, RSGL_color color) { glEnable(GL_BLEND); if (text == NULL || text[0] == '\0') @@ -1260,13 +1263,17 @@ void RSGL_drawText(const char* text, RSGL_circle c, RSGL_color color) { glPrerequisites((RSGL_rect) {c.x, c.y + (c.d - (c.d/4)), w, c.d}, color); RFont_set_color(color.r / 255.0f, color.b / 255.0f, color.g / 255.0f, color.a / 255.0f); - RFont_draw_text(RSGL_font.f, text, c.x, c.y, c.d); + RFont_draw_text_len(RSGL_font.f, text, len, c.x, c.y, c.d, 0.0f); rglPopMatrix(); } +void RSGL_drawText(const char* text, RSGL_circle c, RSGL_color color) { + RSGL_drawText_len(text, 0, c, color); +} + u32 RSGL_textWidth(const char* text, u32 fontSize, size_t textEnd) { - return RFont_text_width(RSGL_font.f, text, fontSize); + return RFont_text_width_len(RSGL_font.f, text, fontSize, textEnd); } #endif /* RSGL_NO_TEXT */ diff --git a/deps/RFont.h b/deps/RFont.h index 9aec1ab..2a0538d 100644 --- a/deps/RFont.h +++ b/deps/RFont.h @@ -551,7 +551,10 @@ size_t RFont_text_width_len(RFont_font* font, const char* text, size_t len, u32 if (RFont_decode_utf8(&utf8state, &codepoint, *(const u8*)str) != RFONT_UTF8_ACCEPT) continue; - const u8 i = codepoint - ' '; + u32 i; + for (i = 0; i < font->glyph_len; i++) + if (font->glyphs[i].codepoint == codepoint && font->glyphs[i].size == size) + break; if (font->glyphs[i].codepoint == codepoint && font->glyphs[i].size == size) { glyph = font->glyphs[i].src; @@ -595,7 +598,8 @@ size_t RFont_text_width_len(RFont_font* font, const char* text, size_t len, u32 if (x > width) width = x; - + + printf("%i\n", width); return width; } diff --git a/deps/RGFW.h b/deps/RGFW.h index 1590fca..8be3944 100644 --- a/deps/RGFW.h +++ b/deps/RGFW.h @@ -60,6 +60,7 @@ Copyright (c) 2006-2019 Camilla Löwy */ +#define GL_SILENCE_DEPRECATION #ifndef RGFW_MALLOC #include #include @@ -265,7 +266,6 @@ typedef struct RGFW_window { #if defined(__APPLE__) && !defined(RGFW_MACOS_X11) void* view; /*apple viewpoint thingy*/ - u32 hideMouse; /*if the mouse is hidden or not*/ #endif #ifdef RGFW_EGL @@ -348,14 +348,10 @@ RGFWDEF void RGFW_window_setMouseDefault(RGFW_window* win); /* sets the mouse to /* where the mouse is on the screen, x = [0], y = [1] */ RGFWDEF int* RGFW_window_getGlobalMousePoint(RGFW_window* win); -#ifdef __APPLE__ -RGFWDEF void RGFW_window_hideMouse(RGFW_window* win); -#else #define RGFW_window_hideMouse(win) { \ u8 RGFW_blk[] = {0, 0, 0, 0}; /* for c++ support */\ RGFW_window_setMouse(win, RGFW_blk, 1, 1, 4); \ } -#endif RGFWDEF void RGFW_window_makeCurrent(RGFW_window* win); /*!< make the window the current opengl drawing context */ @@ -421,14 +417,11 @@ Example to get you started : linux : gcc main.c -lX11 -lXcursor -lGL windows : gcc main.c -lopengl32 -lshell32 -lgdi32 -macos: - can be replaced to where you have the Silicon headers stored - can be replaced to wherever you have libSilicon.a - clang main.c -I -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo +macos : gcc main.c -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo - NOTE(EimaMei): If you want the MacOS experience to be fully single header, then I'd be best to install Silicon (after compiling) - by going to the `Silicon` folder and running `make install`. After this you can easily include Silicon via `#include ' - and link it by doing `-lSilicon` +MACOS NOTE(Colleague Riley): MacOS requires silicon.h to either be included with RGFW or installed globally + This is because MacOS uses Objective-C for the API so Silicon.h is required to use it in pure C +MACOS NOTE(EimaMei): If you want the MacOS experience to be fully single header, then I'd be best to install Silicon into /usr/local/include #define RGFW_IMPLEMENTATION #include "RGFW.h" @@ -476,29 +469,9 @@ int main() { linux: gcc -shared RGFW.o -lX11 -lXcursor -lGL -o RGFW.so macos: - can be replaced to where you have the Silicon headers stored - can be replaced to wherever you have libSilicon.a - gcc -shared RGFW.o -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo -I - - installing/building silicon (macos) - - Silicon does not need to be installde per se. - I personally recommended that you use the Silicon included using RGFW - - to build this version of Silicon simplly run - - cd Silicon && make - - Alternatively, you also can find pre-built binaries for Silicon at - https://github.com/ColleagueRiley/Silicon/tree/binaries + gcc -shared RGFW.o -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo - you can then use Silicon/include and libSilicon.a for building RGFW projects - - ex. - gcc main.c -framework Foundation -lSilicon -framework AppKit -framework OpenGL -framework CoreVideo -ISilicon/include - - I also suggest you compile Silicon (and RGFW if applicable) - per each time you compile your application so you know that everything is compiled for the same architecture. + Silicon.h, silicon.h is a header file that either needs to be carried around with RGFW or installed into the include folder */ #ifdef RGFW_IMPLEMENTATION @@ -2715,8 +2688,8 @@ void RGFW_setThreadPriority(RGFW_thread thread, u8 priority) { SetThreadPriority #endif #if defined(__APPLE__) && !defined(RGFW_MACOS_X11) -#define GL_SILENCE_DEPRECATION -#include +#define SILICON_IMPLEMENTATION +#include "silicon.h" #include void* RGFWnsglFramework = NULL; @@ -2775,8 +2748,7 @@ bool performDragOperation(id self, SEL cmd, NSDraggingInfo* sender) { if (!found) i = 0; - - siArray(Class) array = si_array_init((Class[]){class(objctype(NSURL))}, sizeof(*array), 1); + siArray(Class) array = si_array_init((Class[]){SI_NS_CLASSES[NS_URL_CODE]}, sizeof(*array), 1); siArray(char*) droppedFiles = (siArray(char*))NSPasteboard_readObjectsForClasses(NSDraggingInfo_draggingPasteboard(sender), array, NULL); RGFW_windows[i]->event.droppedFilesCount = si_array_len(droppedFiles); @@ -2797,23 +2769,43 @@ bool performDragOperation(id self, SEL cmd, NSDraggingInfo* sender) { return true; } +typedef void NSNotification; +void RGFW_windowDidResize(void* sender, NSNotification *notification) { +printf("resize\n"); + // Handle window resize logic here... +} -RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 args){ - static u8 RGFW_loaded = 0; - - RGFW_window* win = RGFW_MALLOC(sizeof(RGFW_window)); +NSApplication* NSApp; - u32* r = RGFW_window_screenSize(win); +RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 args) { + static u8 RGFW_loaded = 0; - u32 i; - #ifdef RGFW_ALLOC_DROPFILES - win->event.droppedFiles = (char**)RGFW_MALLOC(sizeof(char*) * RGFW_MAX_DROPS); - - for (i = 0; i < RGFW_MAX_DROPS; i++) - win->event.droppedFiles[i] = (char*)RGFW_CALLOC(RGFW_MAX_PATH, sizeof(char)); - #endif + /* NOTE(EimaMei): Why does Apple hate good code? Like wtf, who thought of methods being a great idea??? + Imagine a universe, where MacOS had a proper system API (we would probably have like 20% better performance). + */ + si_func_to_SEL_with_name(SI_DEFAULT, "windowShouldClose", RGFW_OnClose); + si_func_to_SEL_with_name(SI_DEFAULT, "NSWindowDidResizeNotification", RGFW_windowDidResize); + si_func_to_SEL_with_name("NSWindow", "windowDidResize", RGFW_windowDidResize); + + /* NOTE(EimaMei): Fixes the 'Boop' sfx from constantly playing each time you click a key. Only a problem when running in the terminal. */ + si_func_to_SEL("NSWindow", acceptsFirstResponder); + si_func_to_SEL("NSWindow", performKeyEquivalent); + + void* WindowDelegateClass = objc_allocateClassPair((Class)objc_getClass("NSObject"), "WindowDelegate", 0); + class_addMethod(WindowDelegateClass, sel_registerName("windowDidResize:"), (IMP)RGFW_windowDidResize, "v@:@"); + + RGFW_window* win = (RGFW_window*)malloc(sizeof(RGFW_window)); + if (!win) { + // Handle memory allocation error + fprintf(stderr, "Failed to allocate memory for window\n"); + exit(EXIT_FAILURE); + } + + NSApp = NSApplication_sharedApplication(); - if (RGFW_FULLSCREEN & args){ + u32* r = RGFW_window_screenSize(win); + + if (RGFW_FULLSCREEN & args) { x = 0; y = 0; w = r[0]; @@ -2821,7 +2813,7 @@ RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 } if (RGFW_CENTER & args) { - x = (r[0] - w) / 1.1; + x = (r[0] - w) / 4; y = (r[1] - h) / 4; } @@ -2836,10 +2828,20 @@ RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 win->fpsCap = 0; win->event.inFocus = 0; - win->hideMouse = 0; win->event.type = 0; win->event.droppedFilesCount = 0; + win->cursor = NSCursor_currentCursor(); + + u32 i; + #ifdef RGFW_ALLOC_DROPFILES + win->event.droppedFiles = (char**)RGFW_MALLOC(sizeof(char*) * RGFW_MAX_DROPS); + + for (i = 0; i < RGFW_MAX_DROPS; i++) + win->event.droppedFiles[i] = (char*)RGFW_CALLOC(RGFW_MAX_PATH, sizeof(char)); + #endif + + NSRect windowRect = NSMakeRect(win->x, win->y, win->w, win->h); NSBackingStoreType macArgs = NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSBackingStoreBuffered | NSWindowStyleMaskTitled; if (!(RGFW_NO_RESIZE & args)) @@ -2849,10 +2851,22 @@ RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 else macArgs |= NSWindowStyleMaskBorderless; - - win->window = NSWindow_init(NSMakeRect(x, y, w, h), macArgs, false, NULL); + win->window = NSWindow_init(windowRect, macArgs, NSBackingStoreBuffered, false); + NSWindow_contentView_setWantsLayer(win->window, true); + NSRetain(win->window); NSWindow_setTitle(win->window, name); + if (RGFW_TRANSPARENT_WINDOW & args) { + #ifdef RGFW_GL + i32 opacity = 0; + NSOpenGLContext_setValues(win->glWin, &opacity, NSOpenGLContextParameterSurfaceOpacity); + #endif + NSWindow_setOpaque(win->window, false); + NSWindow_setBackgroundColor(win->window, NSColor_colorWithSRGB(0, 0, 0, 0)); + NSWindow_setAlphaValue(win->window, 0x00); + } + + #ifdef RGFW_GL NSOpenGLPixelFormatAttribute attributes[] = { NSOpenGLPFANoRecovery, NSOpenGLPFAAccelerated, @@ -2869,69 +2883,60 @@ RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 attributes[12] = (RGFW_majorVersion >= 4) ? NSOpenGLProfileVersion4_1Core : NSOpenGLProfileVersion3_2Core; } - #ifdef RGFW_GL NSOpenGLPixelFormat* format = NSOpenGLPixelFormat_initWithAttributes(attributes); win->view = NSOpenGLView_initWithFrame(NSMakeRect(0, 0, w, h), format); NSOpenGLView_prepareOpenGL(win->view); RGFW_window_swapInterval(win, 1); - #endif - - if (RGFW_ALLOW_DND & args) { - siArray(NSPasteboardType) array = si_array_init((NSPasteboardType[]){NSPasteboardTypeURL, NSPasteboardTypeFileURL, NSPasteboardTypeString}, sizeof(*array), 3); - NSView_registerForDraggedTypes(win->window, array); - si_array_free(array); - } - - if (RGFW_TRANSPARENT_WINDOW & args) { - #ifdef RGFW_GL - i32 opacity = 0; - NSOpenGLContext_setValues(win->glWin, &opacity, NSOpenGLContextParameterSurfaceOpacity); - #endif - NSWindow_setOpaque(win->window, false); - NSWindow_setBackgroundColor(win->window, NSColor_colorWithSRGB(0, 0, 0, 0)); - NSWindow_setAlphaValue(win->window, 0x00); - } - - #ifdef RGFW_GL NSOpenGLContext_makeCurrentContext(win->glWin); + + #else + NSRect contentRect = NSMakeRect(0, 0, w, h); + win->view = NSView_initWithFrame(contentRect); #endif + #ifdef RGFW_OSMESA win->glWin = OSMesaCreateContext(OSMESA_RGBA, NULL); win->buffer = RGFW_MALLOC(w * h * 4); OSMesaMakeCurrent(win->glWin, win->buffer, GL_UNSIGNED_BYTE, w, h); - - #ifdef RGFW_GL - win->render = 0; + + #ifdef RGFW_OPENGL + win->render = 0; #endif #endif - NSWindow_setContentView(win->window, (NSView*)win->view); - NSWindow_setIsVisible(win->window, true); - NSWindow_contentView_wantsLayer(win->window, true); + #ifdef RGFW_BUFFER + win->buffer = RGFW_MALLOC(w * h * 4); + win->render = 1; + #endif - if (!RGFW_loaded) { - NSWindow_makeMainWindow(win->window); + NSWindow_setContentView(win->window, win->view); - RGFW_loaded = 1; - } - - /* NOTE(EimaMei): Why does Apple hate good code? Like wtf, who thought of methods being a great idea??? - Imagine a universe, where MacOS had a proper system API (we would probably have like 20% better performance). - */ - si_func_to_SEL_with_name(SI_DEFAULT, "windowShouldClose", RGFW_OnClose); + if (RGFW_ALLOW_DND & args) { + siArray(NSPasteboardType) array = si_array_init((NSPasteboardType[]){NSPasteboardTypeURL, NSPasteboardTypeFileURL, NSPasteboardTypeString}, sizeof(*array), 3); + NSView_registerForDraggedTypes(win->view, array); + si_array_free(array); - /* NOTE(EimaMei): Fixes the 'Boop' sfx from constantly playing each time you click a key. Only a problem when running in the terminal. */ - si_func_to_SEL("NSWindow", acceptsFirstResponder); - si_func_to_SEL("NSWindow", performKeyEquivalent); + /* NOTE(EimaMei): Drag 'n Drop requires too many damn functions for just a Drag 'n Drop event. */ + si_func_to_SEL("NSWindow", draggingEntered); + si_func_to_SEL("NSWindow", draggingUpdated); + si_func_to_SEL("NSWindow", prepareForDragOperation); + si_func_to_SEL("NSWindow", performDragOperation); + } - /* NOTE(EimaMei): Drag 'n Drop requires too many damn functions for just a Drag 'n Drop event. */ - si_func_to_SEL("NSWindow", draggingEntered); - si_func_to_SEL("NSWindow", draggingUpdated); - si_func_to_SEL("NSWindow", prepareForDragOperation); - si_func_to_SEL("NSWindow", performDragOperation); + // Show the window + NSWindow_makeKeyAndOrderFront(win->window, NULL); + NSWindow_setIsVisible(win->window, true); + NSApplication_setActivationPolicy(NSApp, NSApplicationActivationPolicyRegular); + NSApplication_finishLaunching(NSApp); + + if (!RGFW_loaded) { + NSWindow_makeMainWindow(win->window); + RGFW_loaded = 1; + } + RGFW_windows_size++; RGFW_window** nWins = (RGFW_window**)malloc(sizeof(RGFW_window*) * RGFW_windows_size); @@ -2949,22 +2954,21 @@ RGFW_window* RGFW_createWindow(const char* name, i32 x, i32 y, i32 w, i32 h, u64 break; } - NSApplication_sharedApplication(NSApp); - NSApplication_setActivationPolicy(NSApp, NSApplicationActivationPolicyRegular); - NSApplication_finishLaunching(NSApp); - - return win; + return win; } + u32* RGFW_window_screenSize(RGFW_window* win){ static u32 RGFW_SreenSize[2]; + static CGDirectDisplayID display = 0; + + if (display == 0) + display = CGMainDisplayID(); + + RGFW_SreenSize[0] = CGDisplayPixelsWide(display); + RGFW_SreenSize[1] = CGDisplayPixelsHigh(display); - NSRect r = NSScreen_frame(NSScreen_mainScreen()); - - RGFW_SreenSize[0] = r.size.width; - RGFW_SreenSize[1] = r.size.height; - - return (unsigned int[2]){r.size.width, r.size.height}; + return RGFW_SreenSize; } int* RGFW_window_getGlobalMousePoint(RGFW_window* win) { @@ -2978,7 +2982,6 @@ int* RGFW_window_getGlobalMousePoint(RGFW_window* win) { u32 RGFW_keysPressed[10]; /*10 keys at a time*/ RGFW_Event* RGFW_window_checkEvent(RGFW_window* win) { - if (win->event.droppedFilesCount) { i32 i; for (i = 0; i < win->event.droppedFilesCount; i++) @@ -2998,12 +3001,12 @@ RGFW_Event* RGFW_window_checkEvent(RGFW_window* win) { NSCursor_set(win->cursor); } - NSEvent* e = NSApplication_nextEventMatchingMask(NSApp, NSEventMaskAny, NULL, 0, true); + NSEvent* e = NSApplication_nextEventMatchingMask(NSApp, NSEventMaskAny, NSDate_distantFuture(), NSDefaultRunLoopMode, true); if (NSEvent_window(e) == win->window) { u8 button = 0; - switch(NSEvent_type(e)){ + switch (NSEvent_type(e)) { case NSEventTypeKeyDown: win->event.type = RGFW_keyPressed; win->event.keyCode = (u16)NSEvent_keyCode(e); @@ -3065,6 +3068,7 @@ RGFW_Event* RGFW_window_checkEvent(RGFW_window* win) { win->event.type = RGFW_mousePosChanged; NSPoint p = NSEvent_locationInWindow(e); + win->event.x = p.x; win->event.y = p.y; break; @@ -3073,7 +3077,7 @@ RGFW_Event* RGFW_window_checkEvent(RGFW_window* win) { default: break; } - if (win->cursorChanged && NSPointInRect(NSEvent_mouseLocation(e), NSWindow_frame(win->window))) { + if (win->cursorChanged && win->event.inFocus) { if (win->cursor == NULL) CGDisplayHideCursor(kCGDirectMainDisplay); else { @@ -3131,7 +3135,6 @@ RGFWDEF void RGFW_window_setName(RGFW_window* win, char* name) { } void RGFW_window_setIcon(RGFW_window* win, u8* data, i32 width, i32 height, i32 channels) { - /* code by EimaMei */ // Make a bitmap representation, then copy the loaded image into it. NSBitmapImageRep* representation = NSBitmapImageRep_initWithBitmapData(NULL, width, height, 8, channels, (channels == 4), false, "NSCalibratedRGBColorSpace", NSBitmapFormatAlphaNonpremultiplied, width * channels, 8 * channels); @@ -3181,20 +3184,11 @@ void RGFW_window_setMouse(RGFW_window* win, u8* image, i32 width, i32 height, i3 release(representation); } -void RGFW_window_hideMouse(RGFW_window* win) { - if (win->cursor != NULL && win->cursor != NULL) - release(win->cursor); - - win->cursor = (void*)-1; - win->cursorChanged = true; -} - void RGFW_window_setMouseDefault(RGFW_window* win) { if (win->cursor != NULL && win->cursor != NULL) release(win->cursor); - win->cursor = NULL; - win->cursorChanged = true; + RGFW_window_setMouse(win, NULL, 0, 0, 0); } u8 RGFW_isPressedI(RGFW_window* win, u32 key) { @@ -3405,7 +3399,9 @@ void RGFW_window_swapBuffers(RGFW_window* win) { struct CGImage* myImage = CGBitmapContextCreateImage(bitmapContext); - CGContextDrawImage(NSGraphicsContext_currentContext(), rect, myImage); + NSGraphicsContext* context = NSGraphicsContext_currentContext(NULL); + + CGContextDrawImage(context, rect, myImage); CGContextRelease(bitmapContext); CGImageRelease(myImage); diff --git a/deps/Silicon/Silicon/mac/enums.h b/deps/Silicon/Silicon/mac/enums.h deleted file mode 100644 index 39b41a5..0000000 --- a/deps/Silicon/Silicon/mac/enums.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../macros.h" -#include "types.h" - -#include "headers/NSWindow.h" -#include "headers/NSView.h" -#include "headers/NSEvent.h" -#include "headers/NSFontManager.h" -#include "headers/NSFontDescriptor.h" -#include "headers/NSCell.h" -#include "headers/NSButtonCell.h" -#include "headers/NSPasteboard.h" -#include "headers/NSBitmapImageRep.h" -#include "headers/NSDragging.h" - -#include "headers/NSPathUtilities.h" - - -typedef NS_ENUM(NSUInteger, NSBackingStoreType) { - NSBackingStoreRetained = 0U, - NSBackingStoreNonretained = 1U, - NSBackingStoreBuffered = 2U -}; - -typedef enum NSApplicationActivationPolicy { - NSApplicationActivationPolicyRegular, - NSApplicationActivationPolicyAccessory, - NSApplicationActivationPolicyProhibited -} NSApplicationActivationPolicy; - - -/* - ** 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 */ - 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); - - -/* Parameter names for NSOpenGLContext -setValues:forParameter: and -getValues:forParameter: */ -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); - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSBitmapImageRep.h b/deps/Silicon/Silicon/mac/headers/NSBitmapImageRep.h deleted file mode 100644 index 75ccd5c..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSBitmapImageRep.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - NSBitmapImageRep.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -typedef NS_ENUM(NSUInteger, NSTIFFCompression) { - NSTIFFCompressionNone = 1, - NSTIFFCompressionCCITTFAX3 = 3, /* 1 bps only */ - NSTIFFCompressionCCITTFAX4 = 4, /* 1 bps only */ - NSTIFFCompressionLZW = 5, - NSTIFFCompressionJPEG = 6, /* No longer supported for input or output */ - NSTIFFCompressionNEXT = 32766, /* Input only */ - NSTIFFCompressionPackBits = 32773, - NSTIFFCompressionOldJPEG = 32865 /* No longer supported for input or output */ -}; - -typedef NS_ENUM(NSUInteger, NSBitmapImageFileType) { - NSBitmapImageFileTypeTIFF, - NSBitmapImageFileTypeBMP, - NSBitmapImageFileTypeGIF, - NSBitmapImageFileTypeJPEG, - NSBitmapImageFileTypePNG, - NSBitmapImageFileTypeJPEG2000 -}; - -typedef NS_ENUM(NSInteger, NSImageRepLoadStatus) { - NSImageRepLoadStatusUnknownType = -1, // not enough data to determine image format. please feed me more data - NSImageRepLoadStatusReadingHeader = -2, // image format known, reading header. not yet valid. more data needed - NSImageRepLoadStatusWillNeedAllData = -3, // can't read incrementally. will wait for complete data to become avail. - NSImageRepLoadStatusInvalidData = -4, // image decompression encountered error. - NSImageRepLoadStatusUnexpectedEOF = -5, // ran out of data before full image was decompressed. - NSImageRepLoadStatusCompleted = -6 // all is well, the full pixelsHigh image is valid. -}; - -typedef NS_OPTIONS(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 const char* NSBitmapImageRepPropertyKey; - -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageCompressionMethod; // TIFF input/output (NSTIFFCompression in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageCompressionFactor; // TIFF/JPEG input/output (float in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageDitherTransparency; // GIF output (BOOL in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageRGBColorTable; // GIF input/output (packed RGB in NSData) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageInterlaced; // PNG output (BOOL in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageColorSyncProfileData; // TIFF,GIF input/output (NSData) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageFrameCount; // GIF input (int in NSNumber) (read-only) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageCurrentFrame; // GIF input (int in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageCurrentFrameDuration; // GIF input (float in NSNumber) (read-only) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageLoopCount; // GIF input (int in NSNumber) (read-only) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageGamma; // PNG input/output (float in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageProgressive; // JPEG input/output (BOOL in NSNumber) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageEXIFData; // JPEG input/output (NSDictionary) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageIPTCData; // Photo Metadata (NSDictionary) -APPKIT_EXTERN NSBitmapImageRepPropertyKey NSImageFallbackBackgroundColor API_AVAILABLE(macos(10.5)); // JPEG output (NSColor) - - -static const NSBitmapImageFileType NSTIFFFileType API_DEPRECATED_WITH_REPLACEMENT("NSBitmapImageFileTypeTIFF", macos(10.0,10.14)) = NSBitmapImageFileTypeTIFF; -static const NSBitmapImageFileType NSBMPFileType API_DEPRECATED_WITH_REPLACEMENT("NSBitmapImageFileTypeBMP", macos(10.0,10.14)) = NSBitmapImageFileTypeBMP; -static const NSBitmapImageFileType NSGIFFileType API_DEPRECATED_WITH_REPLACEMENT("NSBitmapImageFileTypeGIF", macos(10.0,10.14)) = NSBitmapImageFileTypeGIF; -static const NSBitmapImageFileType NSJPEGFileType API_DEPRECATED_WITH_REPLACEMENT("NSBitmapImageFileTypeJPEG", macos(10.0,10.14)) = NSBitmapImageFileTypeJPEG; -static const NSBitmapImageFileType NSPNGFileType API_DEPRECATED_WITH_REPLACEMENT("NSBitmapImageFileTypePNG", macos(10.0,10.14)) = NSBitmapImageFileTypePNG; -static const NSBitmapImageFileType NSJPEG2000FileType API_DEPRECATED_WITH_REPLACEMENT("NSBitmapImageFileTypeJPEG2000", macos(10.0,10.14)) = NSBitmapImageFileTypeJPEG2000; - -static const NSBitmapFormat NSAlphaFirstBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatAlphaFirst", macos(10.5,10.14)) = NSBitmapFormatAlphaFirst; -static const NSBitmapFormat NSAlphaNonpremultipliedBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatAlphaNonpremultiplied", macos(10.0,10.14)) = NSBitmapFormatAlphaNonpremultiplied; -static const NSBitmapFormat NSFloatingPointSamplesBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatFloatingPointSamples", macos(10.0,10.14)) = NSBitmapFormatFloatingPointSamples; -static const NSBitmapFormat NS16BitLittleEndianBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatSixteenBitLittleEndian", macos(10.5,10.14)) = NSBitmapFormatSixteenBitLittleEndian; -static const NSBitmapFormat NS32BitLittleEndianBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatThirtyTwoBitLittleEndian", macos(10.0,10.14)) = NSBitmapFormatThirtyTwoBitLittleEndian; -static const NSBitmapFormat NS16BitBigEndianBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatSixteenBitBigEndian", macos(10.0,10.14)) = NSBitmapFormatSixteenBitBigEndian; -static const NSBitmapFormat NS32BitBigEndianBitmapFormat API_DEPRECATED_WITH_REPLACEMENT("NSBitmapFormatThirtyTwoBitBigEndian", macos(10.0,10.14)) = NSBitmapFormatThirtyTwoBitBigEndian; - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSButtonCell.h b/deps/Silicon/Silicon/mac/headers/NSButtonCell.h deleted file mode 100644 index bc9169d..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSButtonCell.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - NSButtonCell.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -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, -}; - -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, -}; - - -/* Deprecations */ - -typedef NS_ENUM(NSUInteger, NSGradientType) { - NSGradientNone = 0, - NSGradientConcaveWeak = 1, - NSGradientConcaveStrong = 2, - NSGradientConvexWeak = 3, - NSGradientConvexStrong = 4 -} API_DEPRECATED("", macos(10.0,10.12)); - -static const NSButtonType NSMomentaryLightButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeMomentaryLight", macos(10.0,10.14)) = NSButtonTypeMomentaryLight; -static const NSButtonType NSPushOnPushOffButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypePushOnPushOff", macos(10.0,10.14)) = NSButtonTypePushOnPushOff; -static const NSButtonType NSToggleButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeToggle", macos(10.0,10.14)) = NSButtonTypeToggle; -static const NSButtonType NSSwitchButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeSwitch", macos(10.0,10.14)) = NSButtonTypeSwitch; -static const NSButtonType NSRadioButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeRadio", macos(10.0,10.14)) = NSButtonTypeRadio; -static const NSButtonType NSMomentaryChangeButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeMomentaryChange", macos(10.0,10.14)) = NSButtonTypeMomentaryChange; -static const NSButtonType NSOnOffButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeOnOff", macos(10.0,10.14)) = NSButtonTypeOnOff; -static const NSButtonType NSMomentaryPushInButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeMomentaryPushIn", macos(10.0,10.14)) = NSButtonTypeMomentaryPushIn; -static const NSButtonType NSAcceleratorButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeAccelerator", macos(10.10.3,10.14)) = NSButtonTypeAccelerator; -static const NSButtonType NSMultiLevelAcceleratorButton API_DEPRECATED_WITH_REPLACEMENT("NSButtonTypeMultiLevelAccelerator", macos(10.10.3,10.14)) = NSButtonTypeMultiLevelAccelerator; - -/* These constants were accidentally reversed so that NSMomentaryPushButton lit and NSMomentaryLight pushed. These names are now deprecated */ -static const NSButtonType NSMomentaryPushButton API_DEPRECATED("This constant is misnamed and has the same effect as NSButtonTypeMomentaryLight. Use that name instead, or switch to NSButtonTypeMomentaryPushIn.", macos(10.0,10.9)) = NSButtonTypeMomentaryLight; -static const NSButtonType NSMomentaryLight API_DEPRECATED("This constant is misnamed and has the same effect as NSButtonTypeMomentaryPushIn. Use that name instead, or switch to NSButtonTypeMomentaryLight.", macos(10.0,10.9)) = NSButtonTypeMomentaryPushIn; - -static const NSBezelStyle NSRoundedBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRounded", macos(10.0,10.14)) = NSBezelStyleRounded; -static const NSBezelStyle NSRegularSquareBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRegularSquare", macos(10.0,10.14)) = NSBezelStyleRegularSquare; -static const NSBezelStyle NSDisclosureBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleDisclosure", macos(10.0,10.14)) = NSBezelStyleDisclosure; -static const NSBezelStyle NSShadowlessSquareBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleShadowlessSquare", macos(10.0,10.14)) = NSBezelStyleShadowlessSquare; -static const NSBezelStyle NSCircularBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleCircular", macos(10.0,10.14)) = NSBezelStyleCircular; -static const NSBezelStyle NSTexturedSquareBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleTexturedSquare", macos(10.0,10.14)) = NSBezelStyleTexturedSquare; -static const NSBezelStyle NSHelpButtonBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleHelpButton", macos(10.0,10.14)) = NSBezelStyleHelpButton; -static const NSBezelStyle NSSmallSquareBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleSmallSquare", macos(10.0,10.14)) = NSBezelStyleSmallSquare; -static const NSBezelStyle NSTexturedRoundedBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleTexturedRounded", macos(10.0,10.14)) = NSBezelStyleTexturedRounded; -static const NSBezelStyle NSRoundRectBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRoundRect", macos(10.0,10.14)) = NSBezelStyleRoundRect; -static const NSBezelStyle NSRecessedBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRecessed", macos(10.0,10.14)) = NSBezelStyleRecessed; -static const NSBezelStyle NSRoundedDisclosureBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRoundedDisclosure", macos(10.0,10.14)) = NSBezelStyleRoundedDisclosure; -static const NSBezelStyle NSInlineBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleInline", macos(10.0,10.14)) = NSBezelStyleInline; - -static const NSBezelStyle NSSmallIconButtonBezelStyle API_DEPRECATED("This bezel style is obsolete and should not be used.", macos(10.0,10.0)) = (NSBezelStyle)2; -static const NSBezelStyle NSThickSquareBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRegularSquare", macos(10.0,10.12)) = (NSBezelStyle)3; -static const NSBezelStyle NSThickerSquareBezelStyle API_DEPRECATED_WITH_REPLACEMENT("NSBezelStyleRegularSquare", macos(10.0,10.12)) = (NSBezelStyle)4; - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSCell.h b/deps/Silicon/Silicon/mac/headers/NSCell.h deleted file mode 100644 index ecfb726..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSCell.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - NSCell.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "../../macros.h" -#include "../types.h" - -typedef NS_ENUM(NSUInteger, NSCellType) { - NSNullCellType = 0, - NSTextCellType = 1, - NSImageCellType = 2 -}; - -typedef NS_ENUM(NSUInteger, NSCellAttribute) { - NSCellDisabled = 0, - NSCellState = 1, - NSPushInCell = 2, - NSCellEditable = 3, - NSChangeGrayCell = 4, - NSCellHighlighted = 5, - NSCellLightsByContents = 6, - NSCellLightsByGray = 7, - NSChangeBackgroundCell = 8, - NSCellLightsByBackground = 9, - NSCellIsBordered = 10, - NSCellHasOverlappingImage = 11, - NSCellHasImageHorizontal = 12, - NSCellHasImageOnLeftOrBottom = 13, - NSCellChangesContents = 14, - NSCellIsInsetButton = 15, - NSCellAllowsMixedState = 16 -}; - -typedef NS_ENUM(NSUInteger, NSCellImagePosition) { - NSNoImage = 0, - NSImageOnly = 1, - NSImageLeft = 2, - NSImageRight = 3, - NSImageBelow = 4, - NSImageAbove = 5, - NSImageOverlaps = 6, - NSImageLeading API_AVAILABLE(macos(10.12)) = 7, - NSImageTrailing API_AVAILABLE(macos(10.12)) = 8 -}; - -typedef NS_ENUM(NSUInteger, NSImageScaling) { - NSImageScaleProportionallyDown = 0, // Scale image down if it is too large for destination. Preserve aspect ratio. - NSImageScaleAxesIndependently, // Scale each dimension to exactly fit destination. Do not preserve aspect ratio. - NSImageScaleNone, // Do not scale. - NSImageScaleProportionallyUpOrDown, // Scale image to maximum possible dimensions while (1) staying within destination area (2) preserving aspect ratio - - NSScaleProportionally API_DEPRECATED("Use NSImageScaleProportionallyDown instead", macos(10.0,10.10)) = 0, - NSScaleToFit API_DEPRECATED("Use NSImageScaleAxesIndependently instead", macos(10.0,10.10)), - NSScaleNone API_DEPRECATED("Use NSImageScaleNone instead", macos(10.0,10.10)) -} API_AVAILABLE(macos(10.5)); - -typedef NSInteger NSControlStateValue; -static const NSControlStateValue NSControlStateValueMixed = -1; -static const NSControlStateValue NSControlStateValueOff = 0; -static const NSControlStateValue NSControlStateValueOn = 1; - -typedef NS_OPTIONS(NSUInteger, NSCellStyleMask) { - NSNoCellMask = 0, - NSContentsCellMask = 1, - NSPushInCellMask = 2, - NSChangeGrayCellMask = 4, - NSChangeBackgroundCellMask = 8 -}; - -typedef NS_ENUM(NSUInteger, NSControlTint) { - NSDefaultControlTint = 0, - NSBlueControlTint = 1, - NSGraphiteControlTint = 6, - NSClearControlTint = 7 -}; - -typedef NS_ENUM(NSUInteger, NSControlSize) { - NSControlSizeRegular = 0, - NSControlSizeSmall = 1, - NSControlSizeMini = 2, - NSControlSizeLarge API_AVAILABLE(macos(11.0)) = 3 -}; - -/* Cell Hit testing support */ - -typedef NS_OPTIONS(NSUInteger, NSCellHitResult) { - // An empty area, or did not hit in the cell - NSCellHitNone = 0, - // A content area in the cell - NSCellHitContentArea = 1 << 0, - // An editable text area of the cell - NSCellHitEditableTextArea = 1 << 1, - // A trackable area in the cell - NSCellHitTrackableArea = 1 << 2, -} API_AVAILABLE(macos(10.5)); - -typedef NS_ENUM(NSInteger, NSBackgroundStyle) { - /* The background reflects the predominant color scheme of the view's appearance. */ - NSBackgroundStyleNormal = 0, - - /* The background is indicating emphasis (e.g. selection state) using an alternate color or visual effect. Content may alter its appearance to reflect this emphasis. */ - NSBackgroundStyleEmphasized, - - /* The background is intended to appear higher than the content drawn on it. Content might need to be inset. */ - NSBackgroundStyleRaised, - - /* The background is intended to appear lower than the content drawn on it. Content might need to be embossed. */ - NSBackgroundStyleLowered, -} API_AVAILABLE(macos(10.5)); - -/* In some appearances, NSBackgroundStyleLight may refer to a state where the background is actually a dark color. Use NSBackgroundStyleNormal instead. */ -static const NSBackgroundStyle NSBackgroundStyleLight API_DEPRECATED_WITH_REPLACEMENT("NSBackgroundStyleNormal", macos(10.5, 11.0)) = NSBackgroundStyleNormal; -/* NSBackgroundStyleDark is not a reliable indicator of background states with visually dark or saturated colors. Use NSBackgroundStyleEmphasized instead. */ -static const NSBackgroundStyle NSBackgroundStyleDark API_DEPRECATED_WITH_REPLACEMENT("NSBackgroundStyleEmphasized", macos(10.5, 11.0)) = NSBackgroundStyleEmphasized; - -typedef NSControlStateValue NSCellStateValue API_DEPRECATED_WITH_REPLACEMENT("NSControlStateValue", macos(10.0,10.14)); -static const NSControlStateValue NSMixedState API_DEPRECATED_WITH_REPLACEMENT("NSControlStateValueMixed", macos(10.0,10.14)) = NSControlStateValueMixed; -static const NSControlStateValue NSOffState API_DEPRECATED_WITH_REPLACEMENT("NSControlStateValueOff", macos(10.0,10.14)) = NSControlStateValueOff; -static const NSControlStateValue NSOnState API_DEPRECATED_WITH_REPLACEMENT("NSControlStateValueOn", macos(10.0,10.14)) = NSControlStateValueOn; - -static const NSControlSize NSRegularControlSize API_DEPRECATED_WITH_REPLACEMENT("NSControlSizeRegular", macos(10.0,10.12)) = NSControlSizeRegular; -static const NSControlSize NSSmallControlSize API_DEPRECATED_WITH_REPLACEMENT("NSControlSizeSmall", macos(10.0,10.12)) = NSControlSizeSmall; -static const NSControlSize NSMiniControlSize API_DEPRECATED_WITH_REPLACEMENT("NSControlSizeMini", macos(10.0,10.12)) = NSControlSizeMini; - -APPKIT_EXTERN NSNotificationName NSControlTintDidChangeNotification API_DEPRECATED("Changes to the accent color can be manually observed by implementing -viewDidChangeEffectiveAppearance in a NSView subclass, or by Key-Value Observing the -effectiveAppearance property on NSApplication. Views are automatically redisplayed when the accent color changes.", macos(10.0, 11.0)); - -enum { - NSAnyType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 0, - NSIntType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 1, - NSPositiveIntType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 2, - NSFloatType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 3, - NSPositiveFloatType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 4, - NSDoubleType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 6, - NSPositiveDoubleType API_DEPRECATED("Use formatters instead", macos(10.0,10.0)) = 7 -}; - - -#ifdef __cplusplus -} -#endif diff --git a/deps/Silicon/Silicon/mac/headers/NSDragging.h b/deps/Silicon/Silicon/mac/headers/NSDragging.h deleted file mode 100644 index 3ffc3f2..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSDragging.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - NSDragging.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -typedef NS_OPTIONS(NSUInteger, NSDragOperation) { - NSDragOperationNone = 0, - NSDragOperationCopy = 1, - NSDragOperationLink = 2, - NSDragOperationGeneric = 4, - NSDragOperationPrivate = 8, - NSDragOperationMove = 16, - NSDragOperationDelete = 32, - NSDragOperationEvery = NSUIntegerMax, - - //NSDragOperationAll_Obsolete API_DEPRECATED("", macos(10.0,10.10)) = 15, // Use NSDragOperationEvery - //NSDragOperationAll API_DEPRECATED("", macos(10.0,10.10)) = NSDragOperationAll_Obsolete, // Use NSDragOperationEvery -}; - -typedef NS_ENUM(NSInteger, NSDraggingFormation) { - NSDraggingFormationDefault = 0, // System determined formation. - NSDraggingFormationNone, // Drag images maintain their set positions relative to each other - NSDraggingFormationPile, // Drag images are placed on top of each other with random rotations - NSDraggingFormationList, // Drag images are laid out vertically, non-overlapping with the left edges aligned - NSDraggingFormationStack // Drag images are laid out overlapping diagonally -} API_AVAILABLE(macos(10.7)); - -typedef NS_ENUM(NSInteger, NSDraggingContext) { - NSDraggingContextOutsideApplication = 0, - NSDraggingContextWithinApplication -} API_AVAILABLE(macos(10.7)); - -typedef NS_OPTIONS(NSUInteger, NSDraggingItemEnumerationOptions) { - //NSDraggingItemEnumerationConcurrent = NSEnumerationConcurrent, - /* When the following option is set, AppKit will automatically set the imageComponentProvider to nil for all dragging items that do not meet the classes/searchOptions criteria. Effectively, this hides the drag image for non valid items for this destination. */ - NSDraggingItemEnumerationClearNonenumeratedImages = (1UL << 16), -} API_AVAILABLE(macos(10.7)); - -/* The spring loading highlight styles roughly correlate to {None: NotSpringLoadable, Light: SpringLoadable, Dark: SpringLoadingEngaged}. However, this not not strictly true as Drag & Drop may switch between highlight styles as an animated signal to the user. */ -typedef NS_ENUM(NSInteger, NSSpringLoadingHighlight) { - NSSpringLoadingHighlightNone = 0, - NSSpringLoadingHighlightStandard, - NSSpringLoadingHighlightEmphasized -} API_AVAILABLE(macos(10.11)); - - -typedef NS_OPTIONS(NSUInteger, NSSpringLoadingOptions) { - NSSpringLoadingDisabled = 0, // Spring loading disabled - NSSpringLoadingEnabled = 1UL << 0, // Spring loading allowed (via Force Click release and hover timeout depending on user preferences) - - /* Activate spring loading when user enters Force Click as opposed to release from Force Click. Spring loading is de-activated when Force Click is released. If hover is enabled, spring loading is activated on hover timeout and deactivates when the drag exits the target. This option should be used sparingly. */ - NSSpringLoadingContinuousActivation = 1UL << 1, - - /* Disable spring loading activation via hover. This option should be used sparingly, but there are some rare cases where spring loading via hover results in too many false positives, but is otherwise very useful with a Force Click. These are generally cases when the destination view is very large, such as a canvas. */ - NSSpringLoadingNoHover = 1UL << 3 -} API_AVAILABLE(macos(10.11)); - - -#ifdef __cplusplus -} -#endif diff --git a/deps/Silicon/Silicon/mac/headers/NSEvent.h b/deps/Silicon/Silicon/mac/headers/NSEvent.h deleted file mode 100644 index c9c5d87..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSEvent.h +++ /dev/null @@ -1,385 +0,0 @@ -/* - NSEvent.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "../../macros.h" - - -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, -}; - -static const NSEventType NSLeftMouseDown API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeLeftMouseDown", macos(10.0,10.12)) = NSEventTypeLeftMouseDown; -static const NSEventType NSLeftMouseUp API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeLeftMouseUp", macos(10.0,10.12)) = NSEventTypeLeftMouseUp; -static const NSEventType NSRightMouseDown API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeRightMouseDown", macos(10.0,10.12)) = NSEventTypeRightMouseDown; -static const NSEventType NSRightMouseUp API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeRightMouseUp", macos(10.0,10.12)) = NSEventTypeRightMouseUp; -static const NSEventType NSMouseMoved API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeMouseMoved", macos(10.0,10.12)) = NSEventTypeMouseMoved; -static const NSEventType NSLeftMouseDragged API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeLeftMouseDragged", macos(10.0,10.12)) = NSEventTypeLeftMouseDragged; -static const NSEventType NSRightMouseDragged API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeRightMouseDragged", macos(10.0,10.12)) = NSEventTypeRightMouseDragged; -static const NSEventType NSMouseEntered API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeMouseEntered", macos(10.0,10.12)) = NSEventTypeMouseEntered; -static const NSEventType NSMouseExited API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeMouseExited", macos(10.0,10.12)) = NSEventTypeMouseExited; -static const NSEventType NSKeyDown API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeKeyDown", macos(10.0,10.12)) = NSEventTypeKeyDown; -static const NSEventType NSKeyUp API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeKeyUp", macos(10.0,10.12)) = NSEventTypeKeyUp; -static const NSEventType NSFlagsChanged API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeFlagsChanged", macos(10.0,10.12)) = NSEventTypeFlagsChanged; -static const NSEventType NSAppKitDefined API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeAppKitDefined", macos(10.0,10.12)) = NSEventTypeAppKitDefined; -static const NSEventType NSSystemDefined API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeSystemDefined", macos(10.0,10.12)) = NSEventTypeSystemDefined; -static const NSEventType NSApplicationDefined API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeApplicationDefined", macos(10.0,10.12)) = NSEventTypeApplicationDefined; -static const NSEventType NSPeriodic API_DEPRECATED_WITH_REPLACEMENT("NSEventTypePeriodic", macos(10.0,10.12)) = NSEventTypePeriodic; -static const NSEventType NSCursorUpdate API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeCursorUpdate", macos(10.0,10.12)) = NSEventTypeCursorUpdate; -static const NSEventType NSScrollWheel API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeScrollWheel", macos(10.0,10.12)) = NSEventTypeScrollWheel; -static const NSEventType NSTabletPoint API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeTabletPoint", macos(10.0,10.12)) = NSEventTypeTabletPoint; -static const NSEventType NSTabletProximity API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeTabletProximity", macos(10.0,10.12)) = NSEventTypeTabletProximity; -static const NSEventType NSOtherMouseDown API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeOtherMouseDown", macos(10.0,10.12)) = NSEventTypeOtherMouseDown; -static const NSEventType NSOtherMouseUp API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeOtherMouseUp", macos(10.0,10.12)) = NSEventTypeOtherMouseUp; -static const NSEventType NSOtherMouseDragged API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeOtherMouseDragged", macos(10.0,10.12)) = NSEventTypeOtherMouseDragged; - - -// For APIs introduced in Mac OS X 10.6 and later, this type is used with NS*Mask constants to indicate the events of interest. -typedef NS_OPTIONS(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 */ - NSEventMaskGesture API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeGesture, - NSEventMaskMagnify API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeMagnify, - NSEventMaskSwipe API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeSwipe, - NSEventMaskRotate API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeRotate, - NSEventMaskBeginGesture API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeBeginGesture, - 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. - */ - NSEventMaskSmartMagnify API_AVAILABLE(macos(10.8)) = 1ULL << NSEventTypeSmartMagnify, - NSEventMaskPressure API_AVAILABLE(macos(10.10.3)) = 1ULL << NSEventTypePressure, - NSEventMaskDirectTouch API_AVAILABLE(macos(10.12.2)) = 1ULL << NSEventTypeDirectTouch, - - NSEventMaskChangeMode API_AVAILABLE(macos(10.15)) = 1ULL << NSEventTypeChangeMode, - - NSEventMaskAny = NSUIntegerMax, - -}; - -static const NSEventMask NSLeftMouseDownMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskLeftMouseDown", macos(10.0,10.12)) = NSEventMaskLeftMouseDown; -static const NSEventMask NSLeftMouseUpMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskLeftMouseUp", macos(10.0,10.12)) = NSEventMaskLeftMouseUp; -static const NSEventMask NSRightMouseDownMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskRightMouseDown", macos(10.0,10.12)) = NSEventMaskRightMouseDown; -static const NSEventMask NSRightMouseUpMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskRightMouseUp", macos(10.0,10.12)) = NSEventMaskRightMouseUp; -static const NSEventMask NSMouseMovedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskMouseMoved", macos(10.0,10.12)) = NSEventMaskMouseMoved; -static const NSEventMask NSLeftMouseDraggedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskLeftMouseDragged", macos(10.0,10.12)) = NSEventMaskLeftMouseDragged; -static const NSEventMask NSRightMouseDraggedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskRightMouseDragged", macos(10.0,10.12)) = NSEventMaskRightMouseDragged; -static const NSEventMask NSMouseEnteredMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskMouseEntered", macos(10.0,10.12)) = NSEventMaskMouseEntered; -static const NSEventMask NSMouseExitedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskMouseExited", macos(10.0,10.12)) = NSEventMaskMouseExited; -static const NSEventMask NSKeyDownMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskKeyDown", macos(10.0,10.12)) = NSEventMaskKeyDown; -static const NSEventMask NSKeyUpMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskKeyUp", macos(10.0,10.12)) = NSEventMaskKeyUp; -static const NSEventMask NSFlagsChangedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskFlagsChanged", macos(10.0,10.12)) = NSEventMaskFlagsChanged; -static const NSEventMask NSAppKitDefinedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskAppKitDefined", macos(10.0,10.12)) = NSEventMaskAppKitDefined; -static const NSEventMask NSSystemDefinedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskSystemDefined", macos(10.0,10.12)) = NSEventMaskSystemDefined; -static const NSEventMask NSApplicationDefinedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskApplicationDefined", macos(10.0,10.12)) = NSEventMaskApplicationDefined; -static const NSEventMask NSPeriodicMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskPeriodic", macos(10.0,10.12)) = NSEventMaskPeriodic; -static const NSEventMask NSCursorUpdateMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskCursorUpdate", macos(10.0,10.12)) = NSEventMaskCursorUpdate; -static const NSEventMask NSScrollWheelMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskScrollWheel", macos(10.0,10.12)) = NSEventMaskScrollWheel; -static const NSEventMask NSTabletPointMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskTabletPoint", macos(10.0,10.12)) = NSEventMaskTabletPoint; -static const NSEventMask NSTabletProximityMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskTabletProximity", macos(10.0,10.12)) = NSEventMaskTabletProximity; -static const NSEventMask NSOtherMouseDownMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskOtherMouseDown", macos(10.0,10.12)) = NSEventMaskOtherMouseDown; -static const NSEventMask NSOtherMouseUpMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskOtherMouseUp", macos(10.0,10.12)) = NSEventMaskOtherMouseUp; -static const NSEventMask NSOtherMouseDraggedMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskOtherMouseDragged", macos(10.0,10.12)) = NSEventMaskOtherMouseDragged; -static const NSEventMask NSAnyEventMask API_DEPRECATED_WITH_REPLACEMENT("NSEventMaskAny", macos(10.0,10.12)) = NSUIntegerMax; - -inline NSEventMask NSEventMaskFromType(NSEventType type) { return (1UL << type); } - -/* Device-independent bits found in event modifier flags */ -typedef NS_OPTIONS(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. - NSEventModifierFlagDeviceIndependentFlagsMask = 0xffff0000UL -}; - -static const NSEventModifierFlags NSAlphaShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCapsLock", macos(10.0,10.12)) = NSEventModifierFlagCapsLock; -static const NSEventModifierFlags NSShiftKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagShift", macos(10.0,10.12)) = NSEventModifierFlagShift; -static const NSEventModifierFlags NSControlKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagControl", macos(10.0,10.12)) = NSEventModifierFlagControl; -static const NSEventModifierFlags NSAlternateKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagOption", macos(10.0,10.12)) = NSEventModifierFlagOption; -static const NSEventModifierFlags NSCommandKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagCommand", macos(10.0,10.12)) = NSEventModifierFlagCommand; -static const NSEventModifierFlags NSNumericPadKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagNumericPad", macos(10.0,10.12)) = NSEventModifierFlagNumericPad; -static const NSEventModifierFlags NSHelpKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagHelp", macos(10.0,10.12)) = NSEventModifierFlagHelp; -static const NSEventModifierFlags NSFunctionKeyMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagFunction", macos(10.0,10.12)) = NSEventModifierFlagFunction; -static const NSEventModifierFlags NSDeviceIndependentModifierFlagsMask API_DEPRECATED_WITH_REPLACEMENT("NSEventModifierFlagDeviceIndependentFlagsMask", macos(10.0,10.12)) = NSEventModifierFlagDeviceIndependentFlagsMask; - -/* pointer types for NSEventTypeTabletProximity events or mouse events with subtype NSEventSubtypeTabletProximity*/ -typedef NS_ENUM(NSUInteger, NSPointingDeviceType) { - NSPointingDeviceTypeUnknown = NX_TABLET_POINTER_UNKNOWN, - NSPointingDeviceTypePen = NX_TABLET_POINTER_PEN, - NSPointingDeviceTypeCursor = NX_TABLET_POINTER_CURSOR, - NSPointingDeviceTypeEraser = NX_TABLET_POINTER_ERASER -}; - -static const NSPointingDeviceType NSUnknownPointingDevice API_DEPRECATED_WITH_REPLACEMENT("NSPointingDeviceTypeUnknown", macos(10.0,10.12)) = NSPointingDeviceTypeUnknown; -static const NSPointingDeviceType NSPenPointingDevice API_DEPRECATED_WITH_REPLACEMENT("NSPointingDeviceTypePen", macos(10.0,10.12)) = NSPointingDeviceTypePen; -static const NSPointingDeviceType NSCursorPointingDevice API_DEPRECATED_WITH_REPLACEMENT("NSPointingDeviceTypeCursor", macos(10.0,10.12)) = NSPointingDeviceTypeCursor; -static const NSPointingDeviceType NSEraserPointingDevice API_DEPRECATED_WITH_REPLACEMENT("NSPointingDeviceTypeEraser", macos(10.0,10.12)) = NSPointingDeviceTypeEraser; - -/* button masks for NSEventTypeTabletPoint events or mouse events with subtype NSEventSubtypeTabletPoint */ -typedef NS_OPTIONS(NSUInteger, NSEventButtonMask) { - NSEventButtonMaskPenTip = NX_TABLET_BUTTON_PENTIPMASK, - NSEventButtonMaskPenLowerSide = NX_TABLET_BUTTON_PENLOWERSIDEMASK, - NSEventButtonMaskPenUpperSide = NX_TABLET_BUTTON_PENUPPERSIDEMASK -}; - -static const NSEventButtonMask NSPenTipMask API_DEPRECATED_WITH_REPLACEMENT("NSEventButtonMaskPenTip", macos(10.0,10.12)) = NSEventButtonMaskPenTip; -static const NSEventButtonMask NSPenLowerSideMask API_DEPRECATED_WITH_REPLACEMENT("NSEventButtonMaskPenLowerSide", macos(10.0,10.12)) = NSEventButtonMaskPenLowerSide; -static const NSEventButtonMask NSPenUpperSideMask API_DEPRECATED_WITH_REPLACEMENT("NSEventButtonMaskPenUpperSide", macos(10.0,10.12)) = NSEventButtonMaskPenUpperSide; - -typedef NS_OPTIONS(NSUInteger, NSEventPhase) { - NSEventPhaseNone = 0, // event not associated with a phase. - NSEventPhaseBegan = 0x1 << 0, - NSEventPhaseStationary = 0x1 << 1, - NSEventPhaseChanged = 0x1 << 2, - NSEventPhaseEnded = 0x1 << 3, - NSEventPhaseCancelled = 0x1 << 4, - NSEventPhaseMayBegin = 0x1 << 5, -} API_AVAILABLE(macos(10.7)); - -typedef NS_ENUM(NSInteger, NSEventGestureAxis) { - NSEventGestureAxisNone = 0, - NSEventGestureAxisHorizontal, - NSEventGestureAxisVertical -} API_AVAILABLE(macos(10.7)); - -typedef NS_OPTIONS(NSUInteger, NSEventSwipeTrackingOptions) { - NSEventSwipeTrackingLockDirection = 0x1 << 0, // Clamp gestureAmount to 0 if the user starts to swipe in the opposite direction than they started. - NSEventSwipeTrackingClampGestureAmount = 0x1 << 1 // Don't allow gestureAmount to go beyond +/-1.0 -} API_AVAILABLE(macos(10.7)); - -typedef NS_ENUM(short, NSEventSubtype) { - /* event subtypes for NSEventTypeAppKitDefined events */ - NSEventSubtypeWindowExposed = 0, - NSEventSubtypeApplicationActivated = 1, - NSEventSubtypeApplicationDeactivated = 2, - NSEventSubtypeWindowMoved = 4, - NSEventSubtypeScreenChanged = 8, - - /* event subtypes for NSEventTypeSystemDefined events */ - NSEventSubtypePowerOff = 1, - - /* event subtypes for mouse events */ - NSEventSubtypeMouseEvent = NX_SUBTYPE_DEFAULT, - NSEventSubtypeTabletPoint = NX_SUBTYPE_TABLET_POINT, - NSEventSubtypeTabletProximity = NX_SUBTYPE_TABLET_PROXIMITY, - NSEventSubtypeTouch API_AVAILABLE(macos(10.6)) = NX_SUBTYPE_MOUSE_TOUCH -}; - -static const NSEventSubtype NSWindowExposedEventType API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeWindowExposed", macos(10.0,10.12)) = NSEventSubtypeWindowExposed; -static const NSEventSubtype NSApplicationActivatedEventType API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeApplicationActivated", macos(10.0,10.12)) = NSEventSubtypeApplicationActivated; -static const NSEventSubtype NSApplicationDeactivatedEventType API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeApplicationDeactivated", macos(10.0,10.12)) = NSEventSubtypeApplicationDeactivated; -static const NSEventSubtype NSWindowMovedEventType API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeWindowMoved", macos(10.0,10.12)) = NSEventSubtypeWindowMoved; -static const NSEventSubtype NSScreenChangedEventType API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeScreenChanged", macos(10.0,10.12)) = NSEventSubtypeScreenChanged; -static const NSEventSubtype NSAWTEventType API_DEPRECATED("This subtype no longer exists", macos(10.10,10.12)) = (NSEventSubtype)16; -static const NSEventSubtype NSPowerOffEventType API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypePowerOff", macos(10.0,10.12)) = NSEventSubtypePowerOff; -static const NSEventSubtype NSMouseEventSubtype API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeMouseEvent", macos(10.0,10.12)) = NSEventSubtypeMouseEvent; -static const NSEventSubtype NSTabletPointEventSubtype API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeTabletPoint", macos(10.0,10.12)) = NSEventSubtypeTabletPoint; -static const NSEventSubtype NSTabletProximityEventSubtype API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeTabletProximity", macos(10.0,10.12)) = NSEventSubtypeTabletProximity; -static const NSEventSubtype NSTouchEventSubtype API_DEPRECATED_WITH_REPLACEMENT("NSEventSubtypeTouch", macos(10.0,10.12)) = NSEventSubtypeTouch; - - -// NSPressureBehavior - The pressure gesture behavior that describes how a pressure gesture behaves and progresses -// In general, pressure gestures begin when stage reaches 1 and end when stage reaches 0. This corresponds to the simultaneously generated mouse down/up events. -typedef NS_ENUM(NSInteger, NSPressureBehavior) { - NSPressureBehaviorUnknown = -1, - - // The default primary behavior when otherwise not explicitly configured. In 10.10.3 the default is NSPressureBehaviorPrimaryDeepClick. - NSPressureBehaviorPrimaryDefault = 0, - - // Variable pressure with a small dynamic range after mouseDown. - // Mouse events: LeftMouse - // # of Stages: 1 - // Allowed stage transitions: 1->0 - // Actuations: mouseDown, mouseUp - // stageTransition: NO - NSPressureBehaviorPrimaryClick = 1, - - // Variable pressure with a large dynamic range after mouseDown suitable for drawing and general pressure use. - // Mouse events: LeftMouse - // # of Stages: 1 - // Allowed stage transitions: 1->0 - // Actuations: mouseDown, mouseUp - // stageTransition: NO - NSPressureBehaviorPrimaryGeneric = 2, - - // Variable pressure after mouseDown suitable for controlling speed. Used by NSAcceleratorButton - // Mouse events: LeftMouse - // # of Stages: 1 - // Allowed stage transitions: 1->0 - // Actuations: mouseDown, mouseUp - // stageTransition: NO - NSPressureBehaviorPrimaryAccelerator = 3, - - // Toggle between stages 1 and 2 until drag or mouse up (e.g. Force Click) - // Mouse events: LeftMouse - // # of Stages: 2 (stage 2 is disabled once dragging starts) - // Allowed stage transitions: 1->0, 1->2, 2->1, 2->0 - // Actuations: mouseDown, mouseUp, 1->2, 2->1 - // stageTransition: into and release from stage 2 - NSPressureBehaviorPrimaryDeepClick = 5, - - // Toggle between stages 1 and 2 until mouse up (e.g. Force Click) - // Mouse events: LeftMouse - // # of Stages: 2 - // Allowed stage transitions: 1->0, 1->2, 2->1, 2->0 - // Actuations: mouseDown, mouseUp, 1->2, 2->1 - // stageTransition: into and release from stage 2 - NSPressureBehaviorPrimaryDeepDrag = 6, - -}API_AVAILABLE(macos(10.10.3)); - - -/* Unicodes we reserve for function keys on the keyboard, OpenStep reserves the range 0xF700-0xF8FF for this purpose. The availability of various keys will be system dependent. */ -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 -}; - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSFontDescriptor.h b/deps/Silicon/Silicon/mac/headers/NSFontDescriptor.h deleted file mode 100644 index fa2196a..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSFontDescriptor.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - NSFontDescriptor.h - Application Kit - Copyright (c) 2003-2021, Apple Inc. - All rights reserved. -*/ -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -/* Symbolic Font Traits */ -typedef uint32_t NSFontSymbolicTraits; // Deprecated. Use NSFontDescriptorSymbolicTraits instead - -typedef NS_OPTIONS(uint32_t, NSFontDescriptorSymbolicTraits) { - NSFontDescriptorTraitItalic = 1u << 0, - NSFontDescriptorTraitBold = 1u << 1, - NSFontDescriptorTraitExpanded = 1u << 5, - NSFontDescriptorTraitCondensed = 1u << 6, - NSFontDescriptorTraitMonoSpace = 1u << 10, - NSFontDescriptorTraitVertical = 1u << 11, - NSFontDescriptorTraitUIOptimized = 1u << 12, - NSFontDescriptorTraitTightLeading = 1u << 15, - NSFontDescriptorTraitLooseLeading = 1u << 16, - - NSFontDescriptorTraitEmphasized API_UNAVAILABLE(macos) = NSFontDescriptorTraitBold, - - NSFontDescriptorClassMask = 0xF0000000, - - NSFontDescriptorClassUnknown = 0u << 28, - NSFontDescriptorClassOldStyleSerifs = 1u << 28, - NSFontDescriptorClassTransitionalSerifs = 2u << 28, - NSFontDescriptorClassModernSerifs = 3u << 28, - NSFontDescriptorClassClarendonSerifs = 4u << 28, - NSFontDescriptorClassSlabSerifs = 5u << 28, - NSFontDescriptorClassFreeformSerifs = 7u << 28, - NSFontDescriptorClassSansSerif = 8u << 28, - NSFontDescriptorClassOrnamentals = 9u << 28, - NSFontDescriptorClassScripts = 10u << 28, - NSFontDescriptorClassSymbolic = 12u << 28 -}; - -// The following enum items are deprecated. Use NSFontDescriptorSymbolicTraits instead -enum { - NSFontUnknownClass = 0 << 28, - NSFontOldStyleSerifsClass = 1 << 28, - NSFontTransitionalSerifsClass = 2 << 28, - NSFontModernSerifsClass = 3 << 28, - NSFontClarendonSerifsClass = 4 << 28, - NSFontSlabSerifsClass = 5 << 28, - NSFontFreeformSerifsClass = 7 << 28, - NSFontSansSerifClass = 8 << 28, - NSFontOrnamentalsClass = 9 << 28, - NSFontScriptsClass = 10 << 28, - NSFontSymbolicClass = 12 << 28 -}; - -enum { - NSFontFamilyClassMask = 0xF0000000 -}; - -enum { - NSFontItalicTrait = (1 << 0), - NSFontBoldTrait = (1 << 1), - NSFontExpandedTrait = (1 << 5), - NSFontCondensedTrait = (1 << 6), - NSFontMonoSpaceTrait = (1 << 10), - NSFontVerticalTrait = (1 << 11), - NSFontUIOptimizedTrait = (1 << 12) -}; - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSFontManager.h b/deps/Silicon/Silicon/mac/headers/NSFontManager.h deleted file mode 100644 index f502d48..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSFontManager.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - NSFontManager.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -/* - * Font Traits - * - * This list should be kept small since the more traits that are assigned - * to a given font, the harder it will be to map it to some other family. - * Some traits are mutually exclusive such as NSExpanded and NSCondensed. - */ -typedef NS_OPTIONS(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_OPTIONS(NSUInteger, NSFontCollectionOptions) { - NSFontCollectionApplicationOnlyMask = 1 << 0 -}; - - -/* And these "actions" are really tag values in Font Menu cells which send any of the action messages listed above. Normally, they're pre-defined in the font panel. - */ -typedef NS_ENUM(NSUInteger, NSFontAction) { - NSNoFontChangeAction = 0, - NSViaPanelFontAction = 1, - NSAddTraitFontAction = 2, - NSSizeUpFontAction = 3, - NSSizeDownFontAction = 4, - NSHeavierFontAction = 5, - NSLighterFontAction = 6, - NSRemoveTraitFontAction = 7 -}; - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSPasteboard.h b/deps/Silicon/Silicon/mac/headers/NSPasteboard.h deleted file mode 100644 index d4d5e83..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSPasteboard.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - NSPasteboard.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "../../macros.h" -#include "../types.h" - - -/* Standard Pasteboard Types */ -typedef const char* NSPasteboardType; -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeString API_AVAILABLE(macos(10.6)); // Replaces NSStringPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypePDF API_AVAILABLE(macos(10.6)); // Replaces NSPDFPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeTIFF API_AVAILABLE(macos(10.6)); // Replaces NSTIFFPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypePNG API_AVAILABLE(macos(10.6)); -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeRTF API_AVAILABLE(macos(10.6)); // Replaces NSRTFPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeRTFD API_AVAILABLE(macos(10.6)); // Replaces NSRTFDPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeHTML API_AVAILABLE(macos(10.6)); // Replaces NSHTMLPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeTabularText API_AVAILABLE(macos(10.6)); // Replaces NSTabularTextPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeFont API_AVAILABLE(macos(10.6)); // Replaces NSFontPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeRuler API_AVAILABLE(macos(10.6)); // Replaces NSRulerPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeColor API_AVAILABLE(macos(10.6)); // Replaces NSColorPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeSound API_AVAILABLE(macos(10.6)); // Replaces NSSoundPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeMultipleTextSelection API_AVAILABLE(macos(10.6)); // Replaces NSMultipleTextSelectionPboardType -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeTextFinderOptions API_AVAILABLE(macos(10.7)); // Replaces NSPasteboardTypeFindPanelSearchOptions -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeURL API_AVAILABLE(macos(10.13)); // Equivalent to kUTTypeURL -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeFileURL API_AVAILABLE(macos(10.13)); // Equivalent to kUTTypeFileURL - - -/* Standard Pasteboard Names */ - -typedef const char* NSPasteboardName; -APPKIT_EXTERN NSPasteboardName NSPasteboardNameGeneral API_AVAILABLE(macos(10.13)); -APPKIT_EXTERN NSPasteboardName NSPasteboardNameFont API_AVAILABLE(macos(10.13)); -APPKIT_EXTERN NSPasteboardName NSPasteboardNameRuler API_AVAILABLE(macos(10.13)); -APPKIT_EXTERN NSPasteboardName NSPasteboardNameFind API_AVAILABLE(macos(10.13)); -APPKIT_EXTERN NSPasteboardName NSPasteboardNameDrag API_AVAILABLE(macos(10.13)); - -/* Options for prepareForNewContentsWithOptions: */ - -typedef NS_OPTIONS(NSUInteger, NSPasteboardContentsOptions) { - NSPasteboardContentsCurrentHostOnly = 1 << 0, // Specifies that the pasteboard contents should not be available to other devices -} API_AVAILABLE(macos(10.12)); - - -/* Pasteboard Reading Options - These options can be used for both the -readObjectsForClasses:options: and -canReadObjectForClasses:options: methods, unless otherwise specified. The currently available options allow for customization of how NSURLs are read from the pasteboard. - */ -typedef const char* NSPasteboardReadingOptionKey; -/* Option for reading NSURLs to restrict the results to file URLs only. The value for this key is an NSNumber with a boolean value. - */ -APPKIT_EXTERN NSPasteboardReadingOptionKey const NSPasteboardURLReadingFileURLsOnlyKey API_AVAILABLE(macos(10.6)); -/* Option for reading NSURLs to restrict the results to URLs with contents that conform to any of the provided UTI types. If the content type of a URL cannot be determined, it will not be considered to match. The value for this key is an array of UTI type strings. - */ -APPKIT_EXTERN NSPasteboardReadingOptionKey const NSPasteboardURLReadingContentsConformToTypesKey API_AVAILABLE(macos(10.6)); - - -/* The NSPasteboardWriting protocol enables instances of a class to be used with the -writeObjects: method of NSPasteboard. The Cocoa framework classes NSString, NSAttributedString, NSURL, NSColor, NSSound, NSImage, and NSPasteboardItem implement this protocol. The protocol can also be implemented by custom application classes for use with -writeObjects: - */ -typedef NS_OPTIONS(NSUInteger, NSPasteboardWritingOptions) { - NSPasteboardWritingPromised = 1 << 9, // Data for a type with this option will be promised, not immediately written -} API_AVAILABLE(macos(10.6)); - - -/* NSPasteboardReadingOptions specify how data is read from the pasteboard. You can specify only one option from this list. If you do not specify an option, the default NSPasteboardReadingAsData is used. The first three options specify how and if pasteboard data should be pre-processed by the pasteboard before being passed to -initWithPasteboardPropertyList:ofType. The fourth option, NSPasteboardReadingAsKeyedArchive, should be used when the data on the pasteboard is a keyed archive of this class. Using this option, a keyed unarchiver will be used and -initWithCoder: will be called to initialize the new instance. - */ -typedef NS_OPTIONS(NSUInteger, NSPasteboardReadingOptions) { - NSPasteboardReadingAsData = 0, // Reads data from the pasteboard as-is and returns it as an NSData - NSPasteboardReadingAsString = 1 << 0, // Reads data from the pasteboard and converts it to an NSString - NSPasteboardReadingAsPropertyList = 1 << 1, // Reads data from the pasteboard and un-serializes it as a property list - NSPasteboardReadingAsKeyedArchive = 1 << 2, // Reads data from the pasteboard and uses initWithCoder: to create the object -} API_AVAILABLE(macos(10.6)); - - - -/*** Deprecated ***/ -APPKIT_EXTERN NSPasteboardType NSStringPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeString", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSFilenamesPboardType API_DEPRECATED("Create multiple pasteboard items with NSPasteboardTypeFileURL or kUTTypeFileURL instead", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSTIFFPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeTIFF", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSRTFPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeRTF", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSTabularTextPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeTabularText", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSFontPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeFont", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSRulerPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeRuler", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSColorPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeColor", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSRTFDPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeRTFD", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSHTMLPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeHTML", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSURLPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeURL", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSPDFPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypePDF", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSMultipleTextSelectionPboardType API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeMultipleTextSelection", macos(10.5,10.14)); - -APPKIT_EXTERN NSPasteboardType NSPostScriptPboardType API_DEPRECATED_WITH_REPLACEMENT("@\"com.adobe.encapsulated-postscript\"", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSVCardPboardType API_DEPRECATED_WITH_REPLACEMENT("kUTTypeVCard", macos(10.0,10.14)); -APPKIT_EXTERN NSPasteboardType NSInkTextPboardType API_DEPRECATED_WITH_REPLACEMENT("kUTTypeInkText", macos(10.0,10.14)); - -// HFS Promise type for dragging only -APPKIT_EXTERN NSPasteboardType NSFilesPromisePboardType API_DEPRECATED_WITH_REPLACEMENT("kPasteboardTypeFileURLPromise", macos(10.0,10.14)); - -APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeFindPanelSearchOptions API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardTypeTextFinderOptions", macos(10.6,10.14)); - -APPKIT_EXTERN NSPasteboardName NSGeneralPboard API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardNameGeneral", macos(10.0,10.13)); -APPKIT_EXTERN NSPasteboardName NSFontPboard API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardNameFont", macos(10.0,10.13)); -APPKIT_EXTERN NSPasteboardName NSRulerPboard API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardNameRuler", macos(10.0,10.13)); -APPKIT_EXTERN NSPasteboardName NSFindPboard API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardNameFind", macos(10.0,10.13)); -APPKIT_EXTERN NSPasteboardName NSDragPboard API_DEPRECATED_WITH_REPLACEMENT("NSPasteboardNameDrag", macos(10.0,10.13)); - -/* NSPICTPboardType is deprecated in SnowLeopard. The PICT format was formally deprecated in Tiger along with QuickDraw. Applications should not be explicitly providing or looking for PICT data on the pasteboard. - -To aid in this deprecation, if PICT is the only image type on the pasteboard, as is sometimes the case when copying images from 32-bit Carbon applications, a translated image type will be automatically reported and provided by NSPasteboard. The translated type is added to the types array ahead of PICT so that the deprecated PICT format is not the preferred format. In addition, when an application provides image data to NSPasteboard, the Carbon Pasteboard Manager will automatically make a PICT translation available to 32-bit Carbon applications. - -Although NSPICTPboardType and its UTI equivalent kUTTypePICT will appear in a pasteboard's type array retrieved from the existing NSPasteboard API, it may cease to be reported in future releases. -*/ -APPKIT_EXTERN NSPasteboardType NSPICTPboardType API_DEPRECATED("", macos(10.0,10.6)); - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSPathUtilities.h b/deps/Silicon/Silicon/mac/headers/NSPathUtilities.h deleted file mode 100644 index fbf348b..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSPathUtilities.h +++ /dev/null @@ -1,56 +0,0 @@ -/* NSPathUtilities.h - Copyright (c) 1994-2019, Apple Inc. All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -typedef NS_ENUM(NSUInteger, NSSearchPathDirectory) { - NSApplicationDirectory = 1, // supported applications (Applications) - NSDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) - NSDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. - NSAdminApplicationDirectory, // system and network administration applications (Administration) - NSLibraryDirectory, // various documentation, support, and configuration files, resources (Library) - NSDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. - NSUserDirectory, // user home directories (Users) - NSDocumentationDirectory, // documentation (Documentation) - NSDocumentDirectory, // documents (Documents) - NSCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) - NSAutosavedInformationDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 11, // location of autosaved documents (Documents/Autosaved) - NSDesktopDirectory = 12, // location of user's desktop - NSCachesDirectory = 13, // location of discardable cache files (Library/Caches) - NSApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) - NSDownloadsDirectory API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0)) = 15, // location of the user's "Downloads" directory - NSInputMethodsDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 16, // input methods (Library/Input Methods) - NSMoviesDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 17, // location of user's Movies directory (~/Movies) - NSMusicDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 18, // location of user's Music directory (~/Music) - NSPicturesDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 19, // location of user's Pictures directory (~/Pictures) - NSPrinterDescriptionDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 20, // location of system's PPDs directory (Library/Printers/PPDs) - NSSharedPublicDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 21, // location of user's Public sharing directory (~/Public) - NSPreferencePanesDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) - NSApplicationScriptsDirectory API_AVAILABLE(macos(10.8)) API_UNAVAILABLE(ios, watchos, tvos) = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) - NSItemReplacementDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: - NSAllApplicationsDirectory = 100, // all directories where applications can occur - NSAllLibrariesDirectory = 101, // all directories where resources can occur - NSTrashDirectory API_AVAILABLE(macos(10.8), ios(11.0)) API_UNAVAILABLE(watchos, tvos) = 102 // location of Trash directory - -}; - -typedef NS_OPTIONS(NSUInteger, NSSearchPathDomainMask) { - NSUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) - NSLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) - NSNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) - NSSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) - NSAllDomainsMask = 0x0ffff // all domains: all of the above and future items -}; - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSView.h b/deps/Silicon/Silicon/mac/headers/NSView.h deleted file mode 100644 index 90eb31f..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSView.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - NSView.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -// Bitset options for the autoresizingMask -typedef NS_OPTIONS(NSUInteger, NSAutoresizingMaskOptions) { - NSViewNotSizable = 0, - NSViewMinXMargin = 1, - NSViewWidthSizable = 2, - NSViewMaxXMargin = 4, - NSViewMinYMargin = 8, - NSViewHeightSizable = 16, - NSViewMaxYMargin = 32 -}; - -typedef NS_ENUM(NSUInteger, NSBorderType) { - NSNoBorder = 0, - NSLineBorder = 1, - NSBezelBorder = 2, - NSGrooveBorder = 3 -}; - -typedef NS_ENUM(NSInteger, NSViewLayerContentsRedrawPolicy) { - // Leave the layer's contents alone. Never mark the layer as needing display, or draw the view's contents to the layer - NSViewLayerContentsRedrawNever = 0, - // Map view -setNeedsDisplay...: activity to the layer, and redraw affected layer parts by invoking the view's -drawRect:, but don't mark the view or layer as needing display when the view's size changes. - NSViewLayerContentsRedrawOnSetNeedsDisplay = 1, - // Resize the layer and redraw the view to the layer when the view's size changes. If the resize is animated, AppKit will drive the resize animation itself and will do this resize+redraw at each step of the animation. Affected parts of the layer will also be redrawn when the view is marked as needing display. (This mode is a superset of NSViewLayerContentsRedrawOnSetNeedsDisplay.) - NSViewLayerContentsRedrawDuringViewResize = 2, - // Resize the layer and redraw the view to the layer when the view's size changes. This will be done just once at the beginning of a resize animation, not at each frame of the animation. Affected parts of the layer will also be redrawn when the view is marked as needing display. (This mode is a superset of NSViewLayerContentsRedrawOnSetNeedsDisplay.) - NSViewLayerContentsRedrawBeforeViewResize = 3, - // When a view is resized, the layer contents will be redrawn once and the contents will crossfade from the old value to the new value. Use this in conjunction with the layerContentsPlacement to get a nice crossfade animation for complex layer-backed views that can't correctly update on each step of the animation - NSViewLayerContentsRedrawCrossfade API_AVAILABLE(macos(10.9)) = 4 -} API_AVAILABLE(macos(10.6)); - -typedef NS_ENUM(NSInteger, NSViewLayerContentsPlacement) { - NSViewLayerContentsPlacementScaleAxesIndependently = 0, - NSViewLayerContentsPlacementScaleProportionallyToFit = 1, - NSViewLayerContentsPlacementScaleProportionallyToFill = 2, - NSViewLayerContentsPlacementCenter = 3, - NSViewLayerContentsPlacementTop = 4, - NSViewLayerContentsPlacementTopRight = 5, - NSViewLayerContentsPlacementRight = 6, - NSViewLayerContentsPlacementBottomRight = 7, - NSViewLayerContentsPlacementBottom = 8, - NSViewLayerContentsPlacementBottomLeft = 9, - NSViewLayerContentsPlacementLeft = 10, - NSViewLayerContentsPlacementTopLeft = 11 -} API_AVAILABLE(macos(10.6)); - -typedef NSInteger NSTrackingRectTag; -typedef NSInteger NSToolTipTag; - -// /* Constants for options when entering and exiting full screen mode */ -// typedef const char* NSViewFullScreenModeOptionKey NS_TYPED_ENUM; -// APPKIT_EXTERN NSViewFullScreenModeOptionKey const NSFullScreenModeAllScreens API_AVAILABLE(macos(10.5)); // NSNumber numberWithBool:YES/NO -// APPKIT_EXTERN NSViewFullScreenModeOptionKey const NSFullScreenModeSetting API_AVAILABLE(macos(10.5)); // NSDictionary (obtained from CGSDisplay based functions) -// APPKIT_EXTERN NSViewFullScreenModeOptionKey const NSFullScreenModeWindowLevel API_AVAILABLE(macos(10.5)); // NSNumber numberWithInt:windowLevel -// APPKIT_EXTERN NSViewFullScreenModeOptionKey const NSFullScreenModeApplicationPresentationOptions API_AVAILABLE(macos(10.5)); // NSNumber numberWithUnsignedInteger:(NSApplicationPresentationOptions flags) -// -// -// -// /* NSDefinitionPresentationTypeKey is an optional key in 'options' that specifies the presentation type of the definition display. The possible values are NSDefinitionPresentationTypeOverlay that produces a small overlay window at the string location, or NSDefinitionPresentationTypeDictionaryApplication that invokes 'Dictionary' application to display the definition. Without this option, the definition will be shown in either of those presentation forms depending on the 'Contextual Menu:' setting in Dictionary application preferences. -// */ -// typedef const char* NSDefinitionOptionKey NS_TYPED_ENUM; -// APPKIT_EXTERN NSDefinitionOptionKey const NSDefinitionPresentationTypeKey API_AVAILABLE(macos(10.6)); -// -// typedef const char* NSDefinitionPresentationType NS_TYPED_ENUM; -// APPKIT_EXTERN NSDefinitionPresentationType const NSDefinitionPresentationTypeOverlay API_AVAILABLE(macos(10.6)); -// APPKIT_EXTERN NSDefinitionPresentationType const NSDefinitionPresentationTypeDictionaryApplication API_AVAILABLE(macos(10.6)); - -/* Notifications */ - -/* Sent when the frame changes for a view. This is only sent if postsFrameChangedNotifications is set to YES. - */ -APPKIT_EXTERN NSNotificationName NSViewFrameDidChangeNotification; -APPKIT_EXTERN NSNotificationName NSViewFocusDidChangeNotification API_DEPRECATED("", macos(10.0,10.4)); - -/* This notification is sent whenever the views bounds change and the frame does not. That is, it is sent whenever the view's bounds are translated, scaled or rotated, but NOT when the bounds change as a result of, for example, setFrameSize:. - */ -APPKIT_EXTERN NSNotificationName NSViewBoundsDidChangeNotification; - - -/* This notification is sent whenever an NSView that has an attached NSOpenGLContext changes size or changes screens (thus potentially changing graphics hardware drivers). - */ -APPKIT_EXTERN NSNotificationName NSViewGlobalFrameDidChangeNotification API_DEPRECATED("Use NSOpenGLView instead.", macos(10.0,10.14)); - -/* This notification is sent whenever tracking areas should be recalculated for the view. It is sent after the view receives -updateTrackingAreas. - */ -APPKIT_EXTERN NSNotificationName NSViewDidUpdateTrackingAreasNotification API_AVAILABLE(macos(10.5)); - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/headers/NSWindow.h b/deps/Silicon/Silicon/mac/headers/NSWindow.h deleted file mode 100644 index 9c92528..0000000 --- a/deps/Silicon/Silicon/mac/headers/NSWindow.h +++ /dev/null @@ -1,264 +0,0 @@ -/* - NSWindow.h - Application Kit - Copyright (c) 1994-2021, Apple Inc. - All rights reserved. -*/ -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include "../../macros.h" -#include "../types.h" - - -typedef NS_OPTIONS(NSUInteger, NSWindowStyleMask) { - NSWindowStyleMaskBorderless = 0, - NSWindowStyleMaskTitled = 1 << 0, - NSWindowStyleMaskClosable = 1 << 1, - NSWindowStyleMaskMiniaturizable = 1 << 2, - NSWindowStyleMaskResizable = 1 << 3, - - /* Specifies a window with textured background. Textured windows generally don't draw a top border line under the titlebar/toolbar. To get that line, use the NSUnifiedTitleAndToolbarWindowMask mask. - */ - NSWindowStyleMaskTexturedBackground API_DEPRECATED("Textured window style should no longer be used", macos(10.2, 11.0)) = 1 << 8, - - /* Specifies a window whose titlebar and toolbar have a unified look - that is, a continuous background. Under the titlebar and toolbar a horizontal separator line will appear. - */ - NSWindowStyleMaskUnifiedTitleAndToolbar = 1 << 12, - - /* When present, the window will appear full screen. This mask is automatically toggled when toggleFullScreen: is called. - */ - NSWindowStyleMaskFullScreen API_AVAILABLE(macos(10.7)) = 1 << 14, - - /* If set, the contentView will consume the full size of the window; it can be combined with other window style masks, but is only respected for windows with a titlebar. - Utilizing this mask opts-in to layer-backing. Utilize the contentLayoutRect or auto-layout contentLayoutGuide to layout views underneath the titlebar/toolbar area. - */ - NSWindowStyleMaskFullSizeContentView API_AVAILABLE(macos(10.10)) = 1 << 15, - - /* The following are only applicable for NSPanel (or a subclass thereof) - */ - NSWindowStyleMaskUtilityWindow = 1 << 4, - NSWindowStyleMaskDocModalWindow = 1 << 6, - NSWindowStyleMaskNonactivatingPanel = 1 << 7, // Specifies that a panel that does not activate the owning application - NSWindowStyleMaskHUDWindow API_AVAILABLE(macos(10.6)) = 1 << 13 // Specifies a heads up display panel -}; - -// Additional NSModalResponse values -static const NSModalResponse NSModalResponseOK = 1; -static const NSModalResponse NSModalResponseCancel = 0; - -/* used with NSRunLoop's performSelector:target:argument:order:modes: */ -enum { - NSDisplayWindowRunLoopOrdering = 600000, - NSResetCursorRectsRunLoopOrdering = 700000 -}; - -typedef NS_ENUM(NSUInteger, NSWindowSharingType) { - NSWindowSharingNone = 0, // Window contents may not be read by another process - NSWindowSharingReadOnly = 1, // Window contents may be read but not modified by another process - NSWindowSharingReadWrite = 2 // Window contents may be read or modified by another process -} API_AVAILABLE(macos(10.5)); - -typedef NS_OPTIONS(NSUInteger, NSWindowCollectionBehavior) { - NSWindowCollectionBehaviorDefault = 0, - NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0, - NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1, - - /* You may specify at most one of NSWindowCollectionBehaviorManaged, NSWindowCollectionBehaviorTransient, or NSWindowCollectionBehaviorStationary. If unspecified, the window gets the default behavior determined by its window level */ - NSWindowCollectionBehaviorManaged API_AVAILABLE(macos(10.6)) = 1 << 2, // participates in spaces, exposé. Default behavior if windowLevel == NSNormalWindowLevel - NSWindowCollectionBehaviorTransient API_AVAILABLE(macos(10.6)) = 1 << 3, // floats in spaces, hidden by exposé. Default behavior if windowLevel != NSNormalWindowLevel - NSWindowCollectionBehaviorStationary API_AVAILABLE(macos(10.6)) = 1 << 4, // unaffected by exposé. Stays visible and stationary, like desktop window - - /* You may specify at most one of NSWindowCollectionBehaviorParticipatesInCycle or NSWindowCollectionBehaviorIgnoresCycle. If unspecified, the window gets the default behavior determined by its window level */ - NSWindowCollectionBehaviorParticipatesInCycle API_AVAILABLE(macos(10.6)) = 1 << 5, // default behavior if windowLevel == NSNormalWindowLevel - NSWindowCollectionBehaviorIgnoresCycle API_AVAILABLE(macos(10.6)) = 1 << 6, // default behavior if windowLevel != NSNormalWindowLevel - - /* You may specify at most one of NSWindowCollectionBehaviorFullScreenPrimary, NSWindowCollectionBehaviorFullScreenAuxiliary, or NSWindowCollectionBehaviorFullScreenNone. */ - NSWindowCollectionBehaviorFullScreenPrimary API_AVAILABLE(macos(10.7)) = 1 << 7, // the frontmost window with this collection behavior will be the fullscreen window. - NSWindowCollectionBehaviorFullScreenAuxiliary API_AVAILABLE(macos(10.7)) = 1 << 8, // windows with this collection behavior can be shown with the fullscreen window. - NSWindowCollectionBehaviorFullScreenNone API_AVAILABLE(macos(10.7)) = 1 << 9, // The window can not be made fullscreen when this bit is set - - /* You may specify at most one of NSWindowCollectionBehaviorFullScreenAllowsTiling or NSWindowCollectionBehaviorFullScreenDisallowsTiling, or an assertion will be raised. - - The default behavior is to allow any window to participate in full screen tiling, as long as it meets certain requirements, such as being resizable and not a panel or sheet. Windows which are not full screen capable can still become a secondary tile in full screen. A window can explicitly allow itself to be placed into a full screen tile by including NSWindowCollectionBehaviorFullScreenAllowsTiling. Even if a window allows itself to be placed in a tile, it still may not be put in the tile if its minFullScreenContentSize is too large to fit. A window can explicitly disallow itself from being placed in a full screen tile by including NSWindowCollectionBehaviorFullScreenDisallowsTiling. This is useful for non-full screen capable windows to explicitly prevent themselves from being tiled. It can also be used by a full screen window to prevent any other windows from being placed in its full screen tile. */ - NSWindowCollectionBehaviorFullScreenAllowsTiling API_AVAILABLE(macos(10.11)) = 1 << 11, // This window can be a full screen tile window. It does not have to have FullScreenPrimary set. - NSWindowCollectionBehaviorFullScreenDisallowsTiling API_AVAILABLE(macos(10.11)) = 1 << 12 // This window can NOT be made a full screen tile window; it still may be allowed to be a regular FullScreenPrimary window. -} API_AVAILABLE(macos(10.5)); - - -typedef NS_ENUM(NSInteger, NSWindowAnimationBehavior) { - NSWindowAnimationBehaviorDefault = 0, // let AppKit infer animation behavior for this window - NSWindowAnimationBehaviorNone = 2, // suppress inferred animations (don't animate) - - NSWindowAnimationBehaviorDocumentWindow = 3, - NSWindowAnimationBehaviorUtilityWindow = 4, - NSWindowAnimationBehaviorAlertPanel = 5 -} API_AVAILABLE(macos(10.7)); - - -/* Options used in +windowNumbersWithOptions:. If no options are specified, the returned list contains window numbers for visible windows on the active space belonging to the calling application. */ -typedef NS_OPTIONS(NSUInteger, NSWindowNumberListOptions) { - NSWindowNumberListAllApplications = 1 << 0, - NSWindowNumberListAllSpaces = 1 << 4 -} API_AVAILABLE(macos(10.6)); - -typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) { - /* If set, at least part of the window is visible. If not set, the entire window is occluded. Windows with non-rectangular shapes may be completely occluded on screen but still count as visible, if their bounding box falls into a visible region. Windows that are completely transparent may also still count as visible. */ - NSWindowOcclusionStateVisible = 1UL << 1, -} API_AVAILABLE(macos(10.9)); - -static const NSInteger NSNormalWindowLevel = kCGNormalWindowLevel; -static const NSInteger NSFloatingWindowLevel = kCGFloatingWindowLevel; -static const NSInteger NSSubmenuWindowLevel = kCGTornOffMenuWindowLevel; -static const NSInteger NSTornOffMenuWindowLevel = kCGTornOffMenuWindowLevel; -static const NSInteger NSMainMenuWindowLevel = kCGMainMenuWindowLevel; -static const NSInteger NSStatusWindowLevel = kCGStatusWindowLevel; -static const NSInteger NSModalPanelWindowLevel = kCGModalPanelWindowLevel; -static const NSInteger NSPopUpMenuWindowLevel = kCGPopUpMenuWindowLevel; -static const NSInteger NSScreenSaverWindowLevel = kCGScreenSaverWindowLevel; - -typedef NS_ENUM(NSUInteger, NSSelectionDirection) { - NSDirectSelection = 0, - NSSelectingNext, - NSSelectingPrevious -}; - -/* Standard window buttons */ -typedef NS_ENUM(NSUInteger, NSWindowButton) { - NSWindowCloseButton, - NSWindowMiniaturizeButton, - NSWindowZoomButton, - NSWindowToolbarButton, - NSWindowDocumentIconButton, - NSWindowDocumentVersionsButton API_AVAILABLE(macos(10.7)) = 6, -}; - -typedef NS_ENUM(NSInteger, NSWindowTitleVisibility) { - /* The default mode has a normal window title and titlebar buttons. */ - NSWindowTitleVisible = 0, - /* The always hidden mode hides the title and moves the toolbar up into the area previously occupied by the title. */ - NSWindowTitleHidden = 1, -} API_AVAILABLE(macos(10.10)); - -typedef NS_ENUM(NSInteger, NSWindowToolbarStyle) { - // The default value. The style will be determined by the window's given configuration - NSWindowToolbarStyleAutomatic, - // The toolbar will appear below the window title - NSWindowToolbarStyleExpanded, - // The toolbar will appear below the window title and the items in the toolbar will attempt to have equal widths when possible - NSWindowToolbarStylePreference, - // The window title will appear inline with the toolbar when visible - NSWindowToolbarStyleUnified, - // Same as NSWindowToolbarStyleUnified, but with reduced margins in the toolbar allowing more focus to be on the contents of the window - NSWindowToolbarStyleUnifiedCompact -} API_AVAILABLE(macos(11.0)); - -static const NSTimeInterval NSEventDurationForever = DBL_MAX; - -typedef NS_ENUM(NSInteger, NSWindowUserTabbingPreference) { - NSWindowUserTabbingPreferenceManual, - NSWindowUserTabbingPreferenceAlways, - NSWindowUserTabbingPreferenceInFullScreen, -} API_AVAILABLE(macos(10.12)); - -typedef NS_ENUM(NSInteger, NSWindowTabbingMode) { - NSWindowTabbingModeAutomatic, // The system automatically prefers to tab this window when appropriate - NSWindowTabbingModePreferred, // The window explicitly should prefer to tab when shown - NSWindowTabbingModeDisallowed // The window explicitly should not prefer to tab when shown -} API_AVAILABLE(macos(10.12)); - -typedef NS_ENUM(NSInteger, NSTitlebarSeparatorStyle) { - NSTitlebarSeparatorStyleAutomatic, - NSTitlebarSeparatorStyleNone, - NSTitlebarSeparatorStyleLine, - NSTitlebarSeparatorStyleShadow -} API_AVAILABLE(macos(11.0)); - - -/*typedef NSString * NSWindowFrameAutosaveName NS_SWIFT_BRIDGED_TYPEDEF; -typedef NSString * NSWindowPersistableFrameDescriptor NS_SWIFT_BRIDGED_TYPEDEF; -typedef NSString * NSWindowTabbingIdentifier NS_SWIFT_BRIDGED_TYPEDEF;*/ - - -/* Notifications */ -APPKIT_EXTERN NSNotificationName NSWindowDidBecomeKeyNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidBecomeMainNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidChangeScreenNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidDeminiaturizeNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidExposeNotification; // userInfo key: @"NSExposedRect" -APPKIT_EXTERN NSNotificationName NSWindowDidMiniaturizeNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidMoveNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidResignKeyNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidResignMainNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidResizeNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidUpdateNotification; -APPKIT_EXTERN NSNotificationName NSWindowWillCloseNotification; -APPKIT_EXTERN NSNotificationName NSWindowWillMiniaturizeNotification; -APPKIT_EXTERN NSNotificationName NSWindowWillMoveNotification; -APPKIT_EXTERN NSNotificationName NSWindowWillBeginSheetNotification; -APPKIT_EXTERN NSNotificationName NSWindowDidEndSheetNotification; - -/* NSWindowDidChangeBackingPropertiesNotification is posted on 10.7.3 and later, when a window's backingScaleFactor and/or its colorSpace changes. When running on a system version where this new notification is available, applications should use it instead of NSWindowDidChangeScreenProfileNotification to watch for changes to either of these backing store properties. Many applications won't have any need to watch for this notification, but those that perform sophisticated color handling or manually manage their own caches of window-resolution-and/or/colorspace-appropriate bitmapped images will find this notification useful, as a prompt to invalidate their caches or schedule other reassessment for the new resolution and/or color space as needed. The notification's userInfo dictionary specifies the window's previous backingScaleFactor and colorSpace. You can compare these with the window's new backingScaleFactor and colorSpace at the time of the notification, to determine which of these two properties (potentially both) changed. -*/ -APPKIT_EXTERN NSNotificationName const NSWindowDidChangeBackingPropertiesNotification API_AVAILABLE(macos(10.7)); // added in 10.7.3; userInfo keys: NSBackingPropertyOldScaleFactorKey, NSBackingPropertyOldColorSpaceKey - -APPKIT_EXTERN const char* const NSBackingPropertyOldScaleFactorKey API_AVAILABLE(macos(10.7)); // added in 10.7.3; an NSNumber -APPKIT_EXTERN const char* const NSBackingPropertyOldColorSpaceKey API_AVAILABLE(macos(10.7)); // added in 10.7.3; an NSColorSpace - - -/* NSWindowDidChangeScreenProfileNotification is posted when a window's display's color profile changes, or when the window moves to a display that has a different color profile. When running on 10.7.3 or later, this notification is still posted for compatibility, but modern applications should instead watch for NSWindowDidChangeBackingPropertiesNotification, which is posted for both color space and resolution changes, and facilitates handling both in a single update and redisplay pass. -*/ -APPKIT_EXTERN NSNotificationName NSWindowDidChangeScreenProfileNotification; - -/* NSWindowWillStartLiveResizeNotification is sent when the user starts a live resize operation via a mouseDown in the resize corner. The notification will be sent before the window size is changed. Note that this notification is sent once for a sequence of window resize operations */ -APPKIT_EXTERN NSNotificationName const NSWindowWillStartLiveResizeNotification API_AVAILABLE(macos(10.6)); -/* NSWindowDidEndLiveResizeNotification is sent after the user ends a live resize operation via a mouseUp in the resize corner. The notification will be sent after the final window size change. Note that this notification is sent once for a sequence of window resize operations */ -APPKIT_EXTERN NSNotificationName const NSWindowDidEndLiveResizeNotification API_AVAILABLE(macos(10.6)); -APPKIT_EXTERN NSNotificationName const NSWindowWillEnterFullScreenNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowDidEnterFullScreenNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowWillExitFullScreenNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowDidExitFullScreenNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowWillEnterVersionBrowserNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowDidEnterVersionBrowserNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowWillExitVersionBrowserNotification API_AVAILABLE(macos(10.7)); -APPKIT_EXTERN NSNotificationName const NSWindowDidExitVersionBrowserNotification API_AVAILABLE(macos(10.7)); -/* Upon receiving this notification, you can query the NSWindow for its current occlusion state. Note that this only notifies about changes in the state of the occlusion, not when the occlusion region changes. You can use this notification to increase responsiveness and save power, by halting any expensive calculations that the user can not see. */ -APPKIT_EXTERN NSNotificationName const NSWindowDidChangeOcclusionStateNotification API_AVAILABLE(macos(10.9)); - -typedef NS_ENUM(NSUInteger, NSWindowBackingLocation) { - NSWindowBackingLocationDefault = 0, // System determines if window backing store is in VRAM or main memory - NSWindowBackingLocationVideoMemory = 1, // Window backing store is in VRAM - NSWindowBackingLocationMainMemory = 2 // Window backing store is in main memory -} API_DEPRECATED("", macos(10.5,10.14)); - - -/* Deprecated legacy style mask constants. Prefer to use NSWindowStyleMask values instead. - */ -static const NSWindowStyleMask NSBorderlessWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskBorderless", macos(10.0,10.12)) = NSWindowStyleMaskBorderless; -static const NSWindowStyleMask NSTitledWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskTitled", macos(10.0,10.12)) = NSWindowStyleMaskTitled; -static const NSWindowStyleMask NSClosableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskClosable", macos(10.0,10.12)) = NSWindowStyleMaskClosable; -static const NSWindowStyleMask NSMiniaturizableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskMiniaturizable", macos(10.0,10.12)) = NSWindowStyleMaskMiniaturizable; -static const NSWindowStyleMask NSResizableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskResizable", macos(10.0,10.12)) = NSWindowStyleMaskResizable; -static const NSWindowStyleMask NSTexturedBackgroundWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskTexturedBackground", macos(10.0,10.12)) = NSWindowStyleMaskTexturedBackground; -static const NSWindowStyleMask NSUnifiedTitleAndToolbarWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskUnifiedTitleAndToolbar", macos(10.0,10.12)) = NSWindowStyleMaskUnifiedTitleAndToolbar; -static const NSWindowStyleMask NSFullScreenWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskFullScreen", macos(10.0,10.12)) = NSWindowStyleMaskFullScreen; -static const NSWindowStyleMask NSFullSizeContentViewWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskFullSizeContentView", macos(10.0,10.12)) = NSWindowStyleMaskFullSizeContentView; -static const NSWindowStyleMask NSUtilityWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskUtilityWindow", macos(10.0,10.12)) = NSWindowStyleMaskUtilityWindow; -static const NSWindowStyleMask NSDocModalWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskDocModalWindow", macos(10.0,10.12)) = NSWindowStyleMaskDocModalWindow; -static const NSWindowStyleMask NSNonactivatingPanelMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskNonactivatingPanel", macos(10.0,10.12)) = NSWindowStyleMaskNonactivatingPanel; -static const NSWindowStyleMask NSHUDWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskHUDWindow", macos(10.0,10.12)) = NSWindowStyleMaskHUDWindow; -static const NSWindowStyleMask NSUnscaledWindowMask API_DEPRECATED("NSUnscaledWindowMask is deprecated and has no effect. The scale factor for a window backing store is dynamic and dependent on the screen it is placed on.", macos(10.0,10.9)) = 1 << 11; - -/* Deprecated window button constants - */ -static const NSWindowButton NSWindowFullScreenButton API_DEPRECATED("The standard window button for NSWindowFullScreenButton is always nil; use NSWindowZoomButton instead", macos(10.7,10.12)) = (NSWindowButton)7; - -/* Deprecated window levels - */ -static const NSWindowLevel NSDockWindowLevel API_DEPRECATED("", macos(10.0,10.13)) = kCGDockWindowLevel; - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/silicon.h b/deps/Silicon/Silicon/mac/silicon.h deleted file mode 100644 index c90108f..0000000 --- a/deps/Silicon/Silicon/mac/silicon.h +++ /dev/null @@ -1,595 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#define GL_SILENCE_DEPRECATION -#include -#include - - -#include "../macros.h" -#include "../mac_load.h" -#include "types.h" -#include "enums.h" - - -extern const NSSize _NSZeroSize; -/* An NSSize structure set to 0 in both dimensions. */ -#define NSZeroSize _NSZeroSize - - -/* Returns the logon name of the current user. */ -#define NSUserName _NSUserName -const char* NSUserName(); - -/* Returns the path to either the user’s or application’s home directory, depending on the platform. */ -#define NSHomeDirectory _NSHomeDirectory -const char* NSHomeDirectory(); - -/* Creates a list of directory search paths. */ -#define NSSearchPathForDirectoriesInDomains _NSSearchPathForDirectoriesInDomains -siArray(const char*) NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, bool expandTilde); - - -/* ============ Geometry functions ============ */ -/* Creates a new NSRect from the specified values. */ -NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h); -/* Creates a new NSPoint from the specified values. */ -NSPoint NSMakePoint(CGFloat x, CGFloat y); -/* Returns a new NSSize from the specified values. */ -NSSize NSMakeSize(CGFloat w, CGFloat h); -/* Returns the largest x coordinate of a given rectangle. */ -CGFloat NSMaxX(NSRect aRect); -/* Returns the largest y coordinate of a given rectangle. */ -CGFloat NSMaxY(NSRect aRect); -/* Returns the x coordinate of a given rectangle’s midpoint. */ -CGFloat NSMidX(NSRect aRect); -/* Returns the y coordinate of a given rectangle’s midpoint. */ -CGFloat NSMidY(NSRect aRect); -/* Returns the smallest x coordinate of a given rectangle. */ -CGFloat NSMinX(NSRect aRect); -/* Returns the smallest y coordinate of a given rectangle. */ -CGFloat NSMinY(NSRect aRect); -/* Returns the width of the specified rectangle. */ -CGFloat NSWidth(NSRect aRect); -/* Returns the height of a given rectangle. */ -CGFloat NSHeight(NSRect aRect); -/* Returns an NSRect typecast from a CGRect. */ -NSRect NSRectFromCGRect(CGRect cgrect); -/* Returns a CGRect typecast from an NSRect. */ -CGRect NSRectToCGRect(NSRect nsrect); -/* Returns an NSPoint typecast from a CGPoint. */ -NSPoint NSPointFromCGPoint(CGPoint cgpoint); -/* Returns a CGPoint typecast from an NSPoint. */ -CGPoint NSPointToCGPoint(NSPoint nspoint); -/* Returns an NSSize typecast from a CGSize. */ -NSSize NSSizeFromCGSize(CGSize cgsize); -/* Returns a CGSize typecast from an NSSize. */ -CGSize NSSizeToCGSize(NSSize nssize); -/* Returns a Boolean value that indicates whether a given point is in a given rectangle. */ -bool NSPointInRect(NSPoint aPoint, NSRect aRect); - - -/* ============ NSControl class ============ */ -/* ====== NSControl properties ======*/ -/**/ -define_property(NSControl, id, target, Target, control); -/**/ -define_property(NSControl, SEL, action, Action, control); -/**/ -define_property(NSControl, NSFont*, font, Font, control); -/* */ -define_property(NSControl, double, doubleValue, DoubleValue, control); - -/* ====== NSControl functions ======*/ -/**/ -NSControl* NSControl_initWithFrame(NSRect frameRect); - - -/* ============ NSWindow class ============ */ -/* ====== NSWindow properties ====== */ -/* Get/Set the title of the window. */ -define_property(NSWindow, const char*, title, Title, window); -/* Get/Set the NSView of the window. */ -define_property(NSWindow, NSView*, contentView, ContentView, window); -/* Get/Set the delegate of the window. */ -define_property(NSWindow, id, delegate, Delegate, window); -/* Get/Set the visbility of the window. */ -define_property(NSWindow, bool, isVisible, IsVisible, window); -/* Get/Set the background color of the window. */ -define_property(NSWindow, NSColor*, backgroundColor, BackgroundColor, window); -/* Get/set the opaque of the window. */ -define_property(NSWindow, bool, isOpaque, Opaque, window); -/* The window’s alpha value. */ -define_property(NSWindow, CGFloat, alphaValue, AlphaValue, window); -/* A Boolean value that indicates whether the window accepts mouse-moved events. */ -define_property(NSWindow, bool, acceptsMouseMovedEvents, AcceptsMouseMovedEvents, window); -/* Get/Set the frame of the window. */ -NSRect NSWindow_frame(NSWindow* window); - -/* ====== NSWindow functions ====== */ -/* Initializes a NSWindow handle. */ -NSWindow* NSWindow_init(NSRect contentRect, NSWindowStyleMask style, NSBackingStoreType backingStoreType, bool flag); -/* */ -void NSWindow_orderFront(NSWindow* window, NSWindow* sender); -/* */ -void NSWindow_makeKeyWindow(NSWindow* window); -/* */ -bool NSWindow_isKeyWindow(NSWindow* window); -/* */ -void NSWindow_center(NSWindow* window); -/* */ -void NSWindow_makeMainWindow(NSWindow* window); -/* */ -void NSWindow_setFrameAndDisplay(NSWindow* window, NSRect frame, bool display, bool animate); -/* */ -NSPoint NSWindow_convertPointFromScreen(NSWindow* window, NSPoint point); -/* Passes a display message down the window’s view hierarchy, thus redrawing all views within the window. */ -void NSWindow_display(NSWindow* window); -/* */ -void NSWindow_contentView_wantsLayer(NSWindow* window, bool wantsLayer); - - -/* ============ NSView class ============ */ -/* ====== NSView functions ====== */ -/* */ -NSView* NSView_init(); -/* */ -NSView* NSView_initWithFrame(NSRect frameRect); -/* */ -void NSView_addSubview(NSView* view, NSView* subview); -/* */ -void NSView_registerForDraggedTypes(NSView* view, siArray(NSPasteboardType) newTypes); - - -/* ============ NSTextField class ============ */ -/* ====== NSTextField properties ====== */ -/* */ -define_property(NSTextField, const char*, stringValue, StringValue, field); -/* */ -define_property(NSTextField, bool, isBezeled, Bezeled, field); -/* */ -define_property(NSTextField, bool, drawsBackground, DrawsBackground, field); -/* */ -define_property(NSTextField, bool, isEditable, Editable, field); -/* */ -define_property(NSTextField, bool, isSelectable, Selectable, field); -/* */ -define_property(NSTextField, NSColor*, textColor, TextColor, field); -/**/ -define_property(NSTextField, NSFont*, font, Font, field); - -/* ====== NSTextField functions ====== */ -/* Initializes a NSTextField handle. */ -NSTextField* NSTextField_initWithFrame(NSRect frameRect); - - -/* ============ NSFontManager class ============ */ -/* ====== NSFontManager functions ====== */ -/* */ -NSFontManager* NSFontManager_sharedFontManager(); -/* */ -NSFont* NSFontManager_convertFont(NSFontManager* manager, NSFont* fontObj); -/* */ -NSFont* NSFontManager_convertFontToHaveTrait(NSFontManager* manager, NSFont* fontObj, NSFontTraitMask trait); - - -/* ============ NSFont class ============ */ -/* ====== NSFont functions ====== */ -/* */ -NSFont* NSFont_init(const char* fontName, CGFloat fontSize); -/* */ -const char* NSFont_fontName(NSFont* font); - - -/* ============ NSButton class ============ */ -/* ====== NSButton properties ====== */ -/* */ -define_property(NSButton, const char*, title, Title, button); -/* */ -define_property(NSButton, NSBezelStyle, bezelStyle, BezelStyle, button); -/* */ -define_property(NSButton, id, target, Target, button); -/* */ -define_property(NSButton, SEL, action, Action, button); -/* */ -define_property(NSButton, NSAutoresizingMaskOptions, autoresizingMask, AutoresizingMask, button); -/* */ -define_property(NSButton, NSControlStateValue, state, State, button); -/* */ -define_property(NSButton, bool, allowsMixedState, AllowsMixedState, button); - -/* ====== NSButton functions ====== */ -/* */ -NSButton* NSButton_initWithFrame(NSRect frameRect); -/* */ -void NSButton_setButtonType(NSButton* button, NSButtonType buttonType); - - -/* ============ NSComboBox class ============ */ -/* ====== NSComboBox properties ====== */ -/* (read-only) */ -NSInteger NSComboBox_indexOfSelectedItem(NSComboBox* comboBox); -/**/ -define_property(NSComboBox, id, target, Target, comboBox); -/**/ -define_property(NSComboBox, SEL, action, Action, comboBox); -/**/ -define_property(NSComboBox, NSFont*, font, Font, comboBox); -/* */ -define_property(NSComboBox, const char*, stringValue, StringValue, field); -/* */ -define_property(NSComboBox, bool, isBezeled, Bezeled, field); -/* */ -define_property(NSComboBox, bool, drawsBackground, DrawsBackground, field); -/* */ -define_property(NSComboBox, bool, isEditable, Editable, field); -/* */ -define_property(NSComboBox, bool, isSelectable, Selectable, field); -/* */ -define_property(NSComboBox, NSColor*, textColor, TextColor, field); -/**/ -define_property(NSComboBox, NSFont*, font, Font, field); - - -/* ====== NSComboBox functions ====== */ -/**/ -NSComboBox* NSComboBox_initWithFrame(NSRect frameRect); -/* */ -void NSComboBox_addItem(NSComboBox* comboBox, void* item); -/* */ -void NSComboBox_selectItem(NSComboBox* comboBox, NSInteger index); - - -/* ============ NSApplication class ============ */ -extern NSApplication* _NSApp; -/* The global variable for the shared app instance. Get initialized after running the 'sharedApplication' function. */ -#define NSApp _NSApp -/* ====== NSApplication properties ====== */ -/* */ -define_property(NSApplication, NSMenu*, mainMenu, MainMenu, application); -/* */ -define_property(NSApplication, NSMenu*, servicesMenu, ServicesMenu, application); -/* */ -define_property(NSApplication, NSMenu*, helpMenu, HelpMenu, application); -/* */ -define_property(NSApplication, NSMenu*, windowsMenu, WindowsMenu, application); -/* */ -define_property(NSApplication, NSApplicationActivationPolicy, activationPolicy, ActivationPolicy, application); -/* */ -define_property(NSApplication, NSImage*, applicationIconImage, ApplicationIconImage, application); - -/* ====== NSApplication functions ====== */ -/* */ -NSApplication* NSApplication_sharedApplication(); -/* */ -void NSApplication_finishLaunching(NSApplication* application); -/* */ -void NSApplication_run(NSApplication* application); -/* */ -void NSApplication_stop(NSApplication* application, void* view); -/* */ -void NSApplication_terminate(NSApplication* application, id sender); -/* */ -void NSApplication_sendEvent(NSApplication* application, NSEvent* event); -/* */ -void NSApplication_updateWindows(NSApplication* application); -/* */ -void NSApplication_activateIgnoringOtherApps(NSApplication* application, bool flag); -/* */ -NSEvent* NSApplication_nextEventMatchingMask(NSApplication* application, NSEventMask mask, NSDate* expiration, int mode, bool deqFlag); - - -/* ============ NSScreen class ============ */ -/* ====== NSScreen properties ====== */ -/* Returns the screen object containing the window with the keyboard focus. */ -NSScreen* NSScreen_mainScreen(); -/* The dimensions and location of the screen. */ -NSRect NSScreen_frame(NSScreen* screen); -/* The current location and dimensions of the visible screen. */ -NSRect NSScreen_visibleFrame(NSScreen* screen); - - -/* ============ NSEvent class ============ */ -/* ====== NSEvent functions ====== */ -/* */ -NSEventType NSEvent_type(NSEvent* event); -/* */ -NSPoint NSEvent_locationInWindow(NSEvent* event); -/* */ -NSEventModifierFlags NSEvent_modifierFlags(NSEvent* event); -/* */ -unsigned short NSEvent_keyCode(NSEvent* event); -/* */ -const char* NSEvent_characters(NSEvent* event); -/* */ -CGFloat NSEvent_deltaY(NSEvent* event); -/* */ -unsigned short NSEvent_keyCodeForChar(char* keyStr); -/* */ -NSPoint NSEvent_mouseLocation(NSEvent* event); -/* */ -NSWindow* NSEvent_window(NSEvent* event); - - -/* ============ NSMenu class ============ */ -/* ====== NSMenu functions ====== */ -/* */ -NSMenu* NSMenu_init(const char* title); -/* */ -void NSMenu_addItem(NSMenu* menu, NSMenuItem* newItem); - - -/* ============ NSMenuItem class ============ */ -/* ====== NSMenuItem properties ====== */ -/* */ -define_property(NSMenuItem, NSMenu*, submenu, Submenu, item); -/* */ -define_property(NSMenuItem, const char*, title, Title, item); - -/* ====== NSMenuItem functions ====== */ -/* */ -NSMenuItem* NSMenuItem_init(const char* title, SEL selector, const char* keyEquivalent); -/* */ -siArray(NSMenuItem*) NSMenu_itemArray(NSMenu* menu); -/* */ -NSMenuItem* NSMenuItem_separatorItem(); - - -/* ============ NSColor class ============ */ -/* ====== NSColor properties ====== */ -/* */ -NSColor* NSColor_clearColor(); -/* */ -NSColor* NSColor_keyboardFocusIndicatorColor(); - -/* ====== NSColor functions ====== */ -/* */ -void NSColor_set(NSColor* color); -/* */ -NSColor* NSColor_colorWithRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); -/* */ -NSColor* NSColor_colorWithSRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); -/* Creates a color object using the given opacity and grayscale values. */ -NSColor* NSColor_colorWithCalibrated(CGFloat white, CGFloat alpha); - - -/* ============ NSBezierPath class ============ */ -/* ====== NSBezierPath functions ====== */ -/* */ -void NSBezierPath_strokeLine(NSPoint from, NSPoint to); - - -/* ============ NSDate class ============ */ -/* ====== NSDate functions ====== */ -/* */ -NSDate* NSDate_distantFuture(); - - -/* ============ NSProcessInfo class ============ */ -/* ====== NSProcessInfo functions ====== */ -/* */ -NSProcessInfo* NSProcessInfo_processInfo(); -/* */ -const char* NSProcessInfo_processName(NSProcessInfo* processInfo); - - -/* ============ NSImage class ============ */ -/* ====== NSImage functions ====== */ -/* Initializes and returns an image object with the specified dimensions. */ -NSImage* NSImage_initWithSize(NSSize size); -/* */ -NSImage* NSImage_initWithData(unsigned char* bitmapData, NSUInteger length); -/* Initializes a data object with the content of the file at a given path. */ -NSImage* NSImage_initWithFile(const char* path); -/* */ -NSImage* NSImage_initWithCGImage(CGImageRef cgImage, NSSize size); -/* Adds the specified image representation object to the image. */ -void NSImage_addRepresentation(NSImage* image, NSImageRep* imageRep); -/* Returns the application’s current cursor. */ -NSCursor* NSCursor_currentCursor(); - -/* ============ NSGraphicsContext class ============ */ -/* ====== NSGraphicsContext properties ====== */ -/* */ -#if (OS_X_VERSION_MAX_ALLOWED < macos_version(10, 5)) /* 'currentContext' doesn't exist in OS X 10.5+. */ -/* */ -implement_deprecated_property(NSGraphicsContext, NSGraphicsContext*, currentContext, CurrentContext, context, macos(10.5)); -#endif - - -/* =========== NSPasteboard class ============ */ -/* ====== NSPasteboard functions ====== */ -/* */ -NSPasteboard* NSPasteboard_generalPasteboard(); -/* */ -const char* NSPasteboard_stringForType(NSPasteboard* pasteboard, NSPasteboardType dataType); -/* */ -NSInteger NSPasteBoard_declareTypes(NSPasteboard* pasteboard, siArray(NSPasteboardType) newTypes, void* owner); -/* */ -bool NSPasteBoard_setString(NSPasteboard* pasteboard, const char* stringToWrite, NSPasteboardType dataType); -/* */ -siArray(const char*) NSPasteboard_readObjectsForClasses(NSPasteboard* pasteboard, siArray(Class) classArray, void* options); - - - -/* ============ NSSlider class ============ */ -/* ====== NSSlider properties ====== */ -/**/ -define_property(NSSlider, id, target, Target, slider); -/**/ -define_property(NSSlider, SEL, action, Action, slider); -/**/ -define_property(NSSlider, NSFont*, font, Font, slider); -/* */ -define_property(NSSlider, double, doubleValue, DoubleValue, slider); -/* */ -define_property(NSSlider, double, maxValue, MaxValue, slider); - -/* ====== NSSlider functions ====== */ -/* */ -NSSlider* NSSlider_initWithFrame(NSRect frameRect); - - - -/* ============ NSProgressIndicator class ============ */ -/* ====== NSProgressIndicator properties ====== */ -/* */ -define_property(NSProgressIndicator, double, doubleValue, DoubleValue, progressIndicator); -/* */ -define_property(NSProgressIndicator, double, maxValue, MaxValue, progressIndicator); -/* */ -define_property(NSProgressIndicator, bool, isIndeterminate, Indeterminate, progressIndicator); - -/* ====== NSProgressIndicator functions ====== */ -/* */ -NSProgressIndicator* NSProgressIndicator_init(NSRect frameRect); - - -/* ============ NSDraggingInfo class ============ */ -/* ====== NSDraggingInfo properties ====== */ -/* */ -NSPasteboard* NSDraggingInfo_draggingPasteboard(NSDraggingInfo* info); -/* */ -NSPoint NSDraggingInfo_draggingLocation(NSDraggingInfo* info); -/* */ -define_property(NSDraggingInfo, NSInteger, numberOfValidItemsForDrop, NumberOfValidItemsForDrop, info); -/* */ -NSWindow* NSDraggingInfo_draggingDestinationWindow(NSDraggingInfo* info); - - -/* ============ NSColorPanel class ============ */ -/* ====== NSColorPanel properties ====== */ -define_property(NSColorPanel, NSColor*, color, Color, colorPanel); - - -/* ============ NSBitmapImageRep class ============ */ -/* ====== NSBitmapImageRep properties ====== */ -unsigned char* NSBitmapImageRep_bitmapData(NSBitmapImageRep* imageRep); - -/* ====== NSBitmapImageRep functions ====== */ -/* Initializes a newly allocated bitmap image representation so it can render the specified image. */ -NSBitmapImageRep* NSBitmapImageRep_initWithBitmapData(unsigned char** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, const char* colorSpaceName, NSBitmapFormat bitmapFormat, NSInteger rowBytes, NSInteger pixelBits); - - -/* ============ NSSavePanel class ============ */ -/* ====== NSSavePanel properties ====== */ -/* A Boolean value that indicates whether the panel displays UI for creating directories. */ -define_property(NSSavePanel, bool, canCreateDirectories, CanCreateDirectories, savePanel); -/* (Deprecated!) An array of filename extensions or UTIs that represent the allowed file types for the panel. */ -define_property(NSSavePanel, siArray(const char*), allowedFileTypes, AllowedFileTypes, savePanel); -/* The current directory shown in the panel. */ -define_property(NSSavePanel, NSURL*, directoryURL, DirectoryURL, savePanel); -/* The user-editable filename currently shown in the name field. */ -define_property(NSSavePanel, const char*, nameFieldStringValue, NameFieldStringValue, savePanel); -/* A URL that contains the fully specified location of the targeted file. */ -NSURL* NSSavePanel_URL(NSSavePanel* savePanel); - -/* ====== NSSavePanel functions ====== */ -/* Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point. */ -NSModalResponse NSSavePanel_runModal(NSSavePanel* savePanel); - - -/* ============ NSURL class ============ */ -/* ====== NSURL properties ====== */ -const char* NSURL_path(NSURL* url); - -/* ====== NSURL functions ====== */ -/* Initializes and returns a newly created NSURL object as a file URL with a specified path. */ -NSURL* NSURL_fileURLWithPath(const char* path); - - -/* ============ NSOpenPanel class ============ */ -/* ====== NSOpenPanel properties ====== */ -/* A Boolean that indicates whether the user can choose files in the panel. */ -define_property(NSOpenPanel, bool, canChooseFiles, CanChooseFiles, openPanel); -/* A Boolean that indicates whether the user can choose directories in the panel. */ -define_property(NSOpenPanel, bool, canChooseDirectories, CanChooseDirectories, openPanel); -/* A Boolean value that indicates whether the panel displays UI for creating directories. */ -define_property(NSOpenPanel, bool, canCreateDirectories, CanCreateDirectories, openPanel); -/* A Boolean that indicates whether the panel resolves aliases. */ -define_property(NSOpenPanel, bool, resolvesAliases, ResolvesAliases, openPanel); -/* A Boolean that indicates whether the user may select multiple files and directories. */ -define_property(NSOpenPanel, bool, allowsMultipleSelection, AllowsMultipleSelection, openPanel); -/* A Boolean value that indicates whether the panel's accessory view is visible. */ -define_property(NSOpenPanel, bool, accessoryViewDisclosed, AccessoryViewDisclosed, openPanel); -/* An array of URLs, each of which contains the fully specified location of a selected file or directory. */ -siArray(NSURL*) NSOpenPanel_URLs(NSOpenPanel* openPanel); -/* A Boolean value that indicates how the panel responds to iCloud documents that aren't fully downloaded locally. */ -define_property(NSOpenPanel, bool, canDownloadUbiquitousContents, CanDownloadUbiquitousContents, openPanel); -/* A Boolean value that indicates whether the panel's accessory view is visible. */ -define_property(NSOpenPanel, bool, canResolveUbiquitousConflicts, CanResolveUbiquitousConflicts, openPanel); -/* (Deprecated!) An array of filename extensions or UTIs that represent the allowed file types for the panel. */ -define_property(NSOpenPanel, siArray(const char*), allowedFileTypes, AllowedFileTypes, openPanel); -/* The current directory shown in the panel. */ -define_property(NSOpenPanel, NSURL*, directoryURL, DirectoryURL, openPanel); -/* The user-editable filename currently shown in the name field. */ -define_property(NSOpenPanel, const char*, nameFieldStringValue, NameFieldStringValue, openPanel); -/* A URL that contains the fully specified location of the targeted file. */ -NSURL* NSOpenPanel_URL(NSOpenPanel* openPanel); - -/* ====== NSOpenPanel functions ====== */ -/* Creates a new Open panel and initializes it with a default configuration. */ -NSOpenPanel* NSOpenPanel_openPanel(); -/* Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point. */ -NSModalResponse NSOpenPanel_runModal(NSOpenPanel* openPanel); - - -/* ============ NSCursor class ============ */ -/* ====== NSCursor properties ====== */ -/* The cursor’s image. */ -NSImage* NSCursor_image(NSCursor* cursor); -/* The position of the cursor's hot spot. */ -NSPoint NSCursor_hotSpot(NSCursor* cursor); -/* Returns the default cursor, the arrow cursor. */ -NSCursor* NSCursor_arrowCursor(); - -/* ====== NSCursor functions ====== */ -/* Initializes a cursor with the given image and hot spot. */ -NSCursor* NSCursor_initWithImage(NSImage* newImage, NSPoint aPoint); -/* Makes the current cursor invisible. */ -void NSCursor_hide(); -/* Makes the current cursor invisible. */ -void NSCursor_unhide(); -/* Pops the current cursor off the top of the stack. */ -void NSCursor_pop(NSCursor* cursor); -/* Puts the receiver on top of the cursor stack and makes it the current cursor. */ -void NSCursor_push(NSCursor* cursor); -/* Makes the receiver the current cursor. */ -void NSCursor_set(NSCursor* cursor); - - -/* TODO(EimaMei): Add documentation & deprecations macros for the OpenGL functions. */ -NSOpenGLPixelFormat* NSOpenGLPixelFormat_initWithAttributes(const NSOpenGLPixelFormatAttribute* attribs); -NSOpenGLView* NSOpenGLView_initWithFrame(NSRect frameRect, NSOpenGLPixelFormat* format); -void NSOpenGLView_prepareOpenGL(NSOpenGLView* view); -NSOpenGLContext* NSOpenGLView_openGLContext(NSOpenGLView* view); -void NSOpenGLContext_setValues(NSOpenGLContext* context, const int* vals, NSOpenGLContextParameter param); -void NSOpenGLContext_makeCurrentContext(NSOpenGLContext* context); -void NSOpenGLContext_flushBuffer(NSOpenGLContext* context); - -#undef GL_SILENCE_DEPRECATION -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac/types.h b/deps/Silicon/Silicon/mac/types.h deleted file mode 100644 index 19a5df5..0000000 --- a/deps/Silicon/Silicon/mac/types.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "../macros.h" -#include "../mac_load.h" - - -#if SILICON_TARGET_64BIT - typedef double CGFloat; /* The basic type for all floating-point values. */ -#else - typedef float CGFloat; /* The basic type for all floating-point values. */ -#endif - - -/* CG -> NS typedefs. */ -typedef CGRect NSRect; /* A structure that contains the location and dimensions of a rectangle. */ -typedef CGSize NSSize; /* A structure that contains width and height values. */ -typedef CGPoint NSPoint; /* A structure that contains a point in a two-dimensional coordinate system. */ - -/* New NS types. */ -#if SILICON_TARGET_64BIT - typedef long NSInteger; /* Describes an integer. When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit application treats NSInteger as a 64-bit integer. */ - typedef unsigned long NSUInteger; /* Describes an unsigned integer. When building 32-bit applications, NSUInteger is a 32-bit unsigned integer. A 64-bit application treats NSUInteger as a 64-bit unsigned integer. */ -#else - typedef int NSInteger; /* Describes an integer. When building 32-bit applications, NSInteger is a 32-bit integer. A 64-bit application treats NSInteger as a 64-bit integer. */ - typedef unsigned int NSUInteger; /* Describes an unsigned integer. When building 32-bit applications, NSUInteger is a 32-bit unsigned integer. A 64-bit application treats NSUInteger as a 64-bit unsigned integer. */ -#endif - -typedef NSInteger NSModalResponse; -typedef double NSTimeInterval; -typedef NSInteger NSWindowLevel; -typedef char* NSNotificationName; /* Note: originally this was NSString* */ - -/* Objective-C classes. */ -mac_type_define(NSAutoreleasePool); -mac_type_define(NSWindow); -mac_type_define(NSView); -mac_type_define(NSApplication); -mac_type_define(NSColor); -mac_type_define(NSNotification); -mac_type_define(NSEvent); -mac_type_define(NSTextField); -mac_type_define(NSFontManager); -mac_type_define(NSFileManager); -mac_type_define(NSProcessInfo); -mac_type_define(NSMenu); -mac_type_define(NSMenuItem); -mac_type_define(NSButton); -mac_type_define(NSComboBox); -mac_type_define(NSControl); -mac_type_define(NSScreen); -mac_type_define(NSImage); -mac_type_define(NSPasteboard); -mac_type_define(NSGraphicsContext); -mac_type_define(NSSlider); -mac_type_define(UIView); -mac_type_define(NSProgressIndicator); -mac_type_define(NSSavePanel); -mac_type_define(NSColorPanel); -mac_type_define(NSOpenPanel); -mac_type_define(NSBitmapImageRep); -mac_type_define(NSImageRep); -mac_type_define(NSCursor); -/* Deprecated*/ -mac_type_define(NSOpenGLPixelFormat); -mac_type_define(NSOpenGLView); -mac_type_define(NSOpenGLContext); - - -typedef void NSDraggingInfo; - -#ifndef __OBJC__ /* These are already defined in Objective-C. */ -mac_type_define(NSFont); -mac_type_define(NSDate); -mac_type_define(NSURL); -#endif - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/mac_load.h b/deps/Silicon/Silicon/mac_load.h deleted file mode 100644 index e4cd2c3..0000000 --- a/deps/Silicon/Silicon/mac_load.h +++ /dev/null @@ -1,197 +0,0 @@ - -/** mac_load: create GUI apps for OS X in pure C; no ObjC knowledge required. - Original author: hidefromkgb (hidefromkgb@gmail.com) - _________________________________________________________________________ - This is free and unencumbered software released into the public domain. - Anyone is free to copy, modify, publish, use, compile, sell, or - distribute this software, either in source code form or as a compiled - binary, for any purpose, commercial or non-commercial, and by any means. - In jurisdictions that recognize copyright laws, the author or authors - of this software dedicate any and all copyright interest in the - software to the public domain. We make this dedication for the benefit - of the public at large and to the detriment of our heirs and - successors. We intend this dedication to be an overt act of - relinquishment in perpetuity of all present and future rights to this - software under copyright law. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - _________________________________________________________________________ -**/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include -#include -//#include - -// c - concatenator/sequencer; f - function -#define _MAC_L(c, f, ...) c( \ -c(c(_MAC_L4(c,f,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__VA_ARGS__), \ - _MAC_L4(c,f,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, __VA_ARGS__)), \ - c(_MAC_L4(c,f,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, __VA_ARGS__), \ - _MAC_L4(c,f,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, __VA_ARGS__))), \ -c(c(_MAC_L4(c,f,4,,,,,,,,,,,,,,,,,,,,,,,,, __VA_ARGS__), \ - _MAC_L4(c,f,5,,,,,,,,,,,,,,,,, __VA_ARGS__)), \ - c(_MAC_L4(c,f,6,,,,,,,,, __VA_ARGS__), \ - _MAC_L4(c,f,7, __VA_ARGS__)))) -// ^1 ^8 ^16 ^24 ^32 ^40 ^48 ^56 -#define _MAC_L4(c, f, i, ...) c( \ -c(c(_MAC_L3(f,0,i,0,,,,,,,,__VA_ARGS__), _MAC_L3(f,1,i,1,,,,,,,__VA_ARGS__)), \ - c(_MAC_L3(f,0,i,2,,,,,, __VA_ARGS__), _MAC_L3(f,1,i,3,,,,, __VA_ARGS__))), \ -c(c(_MAC_L3(f,0,i,4,,,, __VA_ARGS__), _MAC_L3(f,1,i,5,,, __VA_ARGS__)), \ - c(_MAC_L3(f,0,i,6,, __VA_ARGS__), _MAC_L3(f,1,i,7, __VA_ARGS__)))) - -#define _MAC_L3(...) _MAC_L2(__VA_ARGS__, \ -1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, \ -1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, \ -0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, \ -0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, ) - -// p - parity: 0 = even (0th, 2nd, ...), 1 = odd (1st, 3rd, ...) -// a00 - target argument; i##i00 - unique pseudonumeric index for a00 -#define _MAC_L2(f, p, i, \ -i00,i01,i02,i03, i04,i05,i06,i07, i08,i09,i0A,i0B, i0C,i0D,i0E,i0F, \ -i10,i11,i12,i13, i14,i15,i16,i17, i18,i19,i1A,i1B, i1C,i1D,i1E,i1F, \ -i20,i21,i22,i23, i24,i25,i26,i27, i28,i29,i2A,i2B, i2C,i2D,i2E,i2F, \ -i30,i31,i32,i33, i34,i35,i36,i37, i38,i39,i3A,i3B, i3C,i3D,i3E,i3F, \ -a00,a01,a02,a03, a04,a05,a06,a07, a08,a09,a0A,a0B, a0C,a0D,a0E,a0F, \ -a10,a11,a12,a13, a14,a15,a16,a17, a18,a19,a1A,a1B, a1C,a1D,a1E,a1F, \ -a20,a21,a22,a23, a24,a25,a26,a27, a28,a29,a2A,a2B, a2C,a2D,a2E,a2F, \ -a30,a31,a32,a33, a34,a35,a36,a37, a38,a39,a3A,a3B, a3C,a3D,a3E,a3F, \ -z, ...) _MAC_L##z(f, p, i##i00, a00) - -#define _MAC_L1(f, p, i, a) f##p(i, a) -#define _MAC_L0(f, p, i, a) - -#define _MAC_TYPE_ARG0(i, a) -#define _MAC_TYPE_ARG1(i, a) , a _##i -#define _MAC_ONLY_ARG0(i, a) -#define _MAC_ONLY_ARG1(i, a) , _##i -#define _MAC_FUNC_LEX0(i, a) a -#define _MAC_FUNC_LEX1(i, a) _ -#define _MAC_FUNC_STR0(i, a) #a -#define _MAC_FUNC_STR1(i, a) ":" - -#define _MAC_CAT0(a, b) a##b -#define _MAC_CAT(a, b) _MAC_CAT0(a, b) -#define _MAC_SEQ(a, b) a b - -// this is needed to get selectors or classes by name -#define _(callable) _MAC_CAT(__, callable)() - - -// these are needed to declare functions -#define _MAC_F(type, retn, ...) __attribute__((unused)) static \ -SEL _(_MAC_L(_MAC_CAT, _MAC_FUNC_LEX, __VA_ARGS__)) { \ - static SEL what = 0; if (!what) what = sel_registerName( \ - _MAC_L(_MAC_SEQ, _MAC_FUNC_STR, __VA_ARGS__)); return what; \ -} __attribute__((unused)) static inline \ -retn _MAC_L(_MAC_CAT, _MAC_FUNC_LEX, __VA_ARGS__) \ - (void *inst _MAC_L(_MAC_SEQ, _MAC_TYPE_ARG, __VA_ARGS__)) { \ - return ((retn (*)(void*, SEL \ - _MAC_L(_MAC_SEQ, _MAC_TYPE_ARG, __VA_ARGS__)))objc_msgSend##type) \ - (inst, _(_MAC_L(_MAC_CAT, _MAC_FUNC_LEX, __VA_ARGS__)) \ - _MAC_L(_MAC_SEQ, _MAC_ONLY_ARG, __VA_ARGS__)); \ -}; - -#define mac_function_define(retn, ...) _MAC_F( , retn, __VA_ARGS__) -#define _MAC_FF(retn, ...) _MAC_F(_fpret, retn, __VA_ARGS__) -#define _MAC_FS(retn, ...) _MAC_F(_stret, retn, __VA_ARGS__) - - - -#define mac_type_define(typename) \ - __attribute__((unused)) \ - static Class _(typename) { \ - static Class what = 0; \ - if (!what) \ - what = (Class)objc_getClass(#typename); \ - return what; \ - } typedef struct typename typename; \ - - -static struct { - Class uuid; - char *name; - long icnt; -} *_MAC_Subclasses = 0; - - -__attribute__((unused)) -static Class MAC_MakeClass(char *name, Class base, void **flds, void **mths) { - Class retn = 0; - long iter = 0; - - for (; _MAC_Subclasses && _MAC_Subclasses[iter].name; iter++) - if (!strcmp(name, _MAC_Subclasses[iter].name)) { - retn = _MAC_Subclasses[iter].uuid; - if (base) - _MAC_Subclasses[iter].icnt++; - break; - } - if (!retn) { - retn = objc_allocateClassPair(base, name, 0); - _MAC_Subclasses = realloc(_MAC_Subclasses, - (iter + 2) * sizeof(*_MAC_Subclasses)); - _MAC_Subclasses[iter] = - (__typeof__(*_MAC_Subclasses)){retn, strdup(name), 1}; - _MAC_Subclasses[iter + 1].name = 0; - - iter = -1; - /// adding fields - while (flds && flds[++iter]) - class_addIvar(retn, (char*)flds[iter], - sizeof(void*), (sizeof(void*) >= 8)? 3 : 2, 0); - iter = -2; - /// overloading methods - while (mths && mths[iter += 2]) - class_addMethod(retn, (SEL)mths[iter], (IMP)mths[iter + 1], 0); - - objc_registerClassPair(retn); - } - return retn; -} -#define MAC_LoadClass(n) MAC_MakeClass(n, (Class)0, (void**)0, (void**)0) -#define MAC_TempArray(...) (void*[]){__VA_ARGS__, 0} - - - -__attribute__((unused)) -static void MAC_FreeClass(Class uuid) { - long iter, size = 0; - - for (; _MAC_Subclasses && _MAC_Subclasses[size].name; size++); - for (iter = 0; iter < size; iter++) - if (uuid == _MAC_Subclasses[iter].uuid) { - _MAC_Subclasses[iter].icnt--; - if (!_MAC_Subclasses[iter].icnt) { - objc_disposeClassPair(_MAC_Subclasses[iter].uuid); - free(_MAC_Subclasses[iter].name); - if (iter < --size) { - _MAC_Subclasses[iter] = _MAC_Subclasses[size]; - iter = size; - } - _MAC_Subclasses[iter].name = 0; - } - break; - } - if (_MAC_Subclasses && !_MAC_Subclasses[0].name) { - free(_MAC_Subclasses); - _MAC_Subclasses = 0; - } -} - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/macros.h b/deps/Silicon/Silicon/macros.h deleted file mode 100644 index d194f34..0000000 --- a/deps/Silicon/Silicon/macros.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "mac_load.h" - - -#ifndef nil -/* The NULL to C. */ -#define nil ((void *)0) -#endif - -/* If our target OS is 64-bits. */ -#define SILICON_TARGET_64BIT __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 - -#ifdef __cplusplus -#define APPKIT_EXTERN extern "C" -#else -#define APPKIT_EXTERN extern -#endif - -#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 - - -#ifndef si_sizeof -/* `sizeof` but with the 'NSInteger' type. Generally better for performance than regular 'sizeof' on 64-bit machines. */ -#define si_sizeof(type) (NSInteger)sizeof(type) -#endif - -/* Declarations of enums macros. */ -#ifndef NS_OPTIONS -/* Used to declare structs with a specific type. */ -#define NS_OPTIONS(type, name) type name; enum -/* Used to declare structs with a specific type. */ -#define NS_ENUM(type, name) NS_OPTIONS(type, name) -#endif - - -/* Max/min integer value macros.*/ -/* The minimum value for an NSInteger. */ -#define NSIntegerMax LONG_MAX -/* The maximum value for an NSInteger. */ -#define NSIntegerMin LONG_MIN -/* The maximum value for an NSUInteger. */ -#define NSUIntegerMax ULONG_MAX - - -/* MacOS version macros. */ -#define OS_X_VERSION_MAX_ALLOWED __MAC_OS_X_VERSION_MAX_ALLOWED -#define macos_version(major, minor) major * 10000 + minor * 100 - - -/* Useful Objective-C class macros. */ -/* In cases where you need the actual Objective-C class type as a regular function argument. */ -#define objctype _ -/* Gets the size of the class. */ -#define sizeof_class(typename) class_getInstanceSize(class(typename)) - -/* Allocates memory for the provided class type. */ -#define malloc_class(typename) init(alloc(objctype(typename))) -/* Allocates memory for the provided class VARIABLE. Note that you cannot provide a class type with this macro. */ -#define malloc_class_var(variable) init(alloc(variable)) - -/* The default option for 'func_to_SEL()'. */ -#define SI_DEFAULT "NSObject" -/* 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) -/* Checks if the provided selector exist. */ -#define si_SEL_exists(name) si_impl_SEL_exists(name, __FILE__, __LINE__) -/* @selector() implementation in C. */ -#define selector(function) si_SEL_exists(#function":") - - -/* Defining common properties/methods macros. */ -/* Defines the `get` and `set` versions of the provided property. */ -#define define_property(class, type, name, set_name, arg_name) \ - type class##_##name(class* arg_name); \ - void class##_set##set_name(class* arg_name, type name) - - -/* Defines the `get` and `set` versions of the provided property with an API_AVAILABLE macro. */ -#define define_deprecated_property(class, type, name, set_name, arg_name, macos_macro) \ - type class##_##name(class* arg_name) API_AVAILABLE(macos_macro); \ - void class##_set##set_name(class* arg_name, type name) API_AVAILABLE(macos_macro) - - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/siArray.h b/deps/Silicon/Silicon/siArray.h deleted file mode 100644 index 8e77b56..0000000 --- a/deps/Silicon/Silicon/siArray.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -#ifndef usize -typedef size_t usize; -typedef ptrdiff_t isize; -#endif - -#ifndef si_sizeof -#define si_sizeof(type) (isize)sizeof(type) -#endif - - -/* Silicon array type. */ -#define siArray(type) type* - -/* Header for the array. */ -typedef struct siArrayHeader { - usize count; - /* TODO(EimaMei): Add a `type_width` later on. */ -} siArrayHeader; - -/* Gets the header of the siArray. */ -#define SI_ARRAY_HEADER(s) ((siArrayHeader*)s - 1) - - -/* Initializes a Silicon array. */ -void* si_array_init(void* allocator, isize sizeof_element, isize count); -/* Reserves a Silicon array with the provided element count. */ -void* si_array_init_reserve(isize sizeof_element, isize count); -/* Gets the element count of the array. */ -#define si_array_len(array) (SI_ARRAY_HEADER(array)->count) -/* Frees the array from memory. */ -void si_array_free(siArray(void) array); - - -#ifdef SI_ARRAY_IMPLEMENTATION -#include -#include - - -void* si_array_init(void* allocator, isize sizeof_element, isize count) { - void* array = si_array_init_reserve(sizeof_element, count); - memcpy(array, allocator, sizeof_element * count); - - return array; -} - -void* si_array_init_reserve(isize sizeof_element, isize count) { - void* ptr = malloc(si_sizeof(siArrayHeader) + (sizeof_element * count)); - siArray(void) array = ptr + si_sizeof(siArrayHeader); - - siArrayHeader* header = SI_ARRAY_HEADER(array); - header->count = count; - - return array; -} - - -void si_array_free(siArray(void) array) { - if (array == NULL) - return ; - - free(SI_ARRAY_HEADER(array)); -} - -#endif - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/Silicon/silicon.h b/deps/Silicon/Silicon/silicon.h deleted file mode 100644 index 0adf2db..0000000 --- a/deps/Silicon/Silicon/silicon.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#pragma once -#ifdef __cplusplus -extern "C" { -#endif - - -#define GL_SILENCE_DEPRECATION -#include "mac_load.h" -#include "siArray.h" - - -#define SILICON_CLASS "SILICON_CLASS" - -/* Objective-C class methods. */ -mac_function_define(Class, class); -mac_function_define(void*, init); -mac_function_define(void*, alloc); -mac_function_define(void*, release); -mac_function_define(void*, retain); -mac_function_define(void*, autorelease); - - -/* Checks if the provided selector exist. */ -SEL si_impl_SEL_exists(const char* name, const char* filename, int line); -/* Creates an Objective-C method (SEL) from a regular C function with the option to set the register name.*/ -void si_impl_func_to_SEL_with_name(const char* class_name, const char* register_name, void* function); - -/* Returns the name of a class as a string. */ -const char* CharFromClass(Class aClass); - - -#ifndef SILICON_IOS - #include "mac/silicon.h" -#else - #include "iphone/silicon.h" -#endif - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/implementation.h b/deps/Silicon/implementation.h deleted file mode 100644 index c447c55..0000000 --- a/deps/Silicon/implementation.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* NSString / char* conversion functions. */ -/* 'const char*' to 'NSString'. */ -/* TODO(EimaMei): remove this dumbass autorelease nonsense everywhere in the code. */ -#define char_to_NSString(text) [NSString stringWithUTF8String:(text)] -/* 'NSString' to 'const char*'. */ -#define NSString_to_char(text) [text UTF8String] - - -/* Implements the 'class' property. */ -#define implement_property(class, type, name, set_name, arg_name) \ - type class##_##name(class* arg_name) { \ - return [arg_name name]; \ - } \ - void class##_set##set_name(class* arg_name, type name) { \ - [arg_name set##set_name:name]; \ - } - - -/* Implements the 'class' deprecated property. */ -#define implement_deprecated_property(class, type, name, set_name, arg_name, macos_macro) \ - implement_property(class, type, name, set_name, arg_name); - - -/* Implements a property for a given class that requires a C string. */ -#define implement_str_property(class, type, name, set_name, arg_name) \ - type class##_##name(class* arg_name) { \ - return NSString_to_char([arg_name name]); \ - } \ - void class##_set##set_name(class* arg_name, type name) { \ - [arg_name set##set_name:([char_to_NSString(name) retain])]; \ - } - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/source/LICENSE b/deps/Silicon/source/LICENSE deleted file mode 100644 index d248a35..0000000 --- a/deps/Silicon/source/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Copyright (C) 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 restrictions: - -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. \ No newline at end of file diff --git a/deps/Silicon/source/NSGeometry.m b/deps/Silicon/source/NSGeometry.m deleted file mode 100644 index 395d65a..0000000 --- a/deps/Silicon/source/NSGeometry.m +++ /dev/null @@ -1,105 +0,0 @@ -/* NSGeometry.h - Copyright (c) 1994-2019, Apple Inc. All rights reserved. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - -/* ============ Geometry functions ============ */ -/* Creates a new NSRect from the specified values. */ -NSPoint NSMakePoint(CGFloat x, CGFloat y) { - NSPoint p; - p.x = x; - p.y = y; - return p; -} -/* Creates a new NSPoint from the specified values. */ -NSSize NSMakeSize(CGFloat w, CGFloat h) { - NSSize s; - s.width = w; - s.height = h; - return s; -} -/* Returns a new NSSize from the specified values. */ -NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h) { - NSRect r; - r.origin.x = x; - r.origin.y = y; - r.size.width = w; - r.size.height = h; - return r; -} -/* Returns the largest x coordinate of a given rectangle. */ -CGFloat NSMaxX(NSRect aRect) { - return (aRect.origin.x + aRect.size.width); -} -/* Returns the largest y coordinate of a given rectangle. */ -CGFloat NSMaxY(NSRect aRect) { - return (aRect.origin.y + aRect.size.height); -} -/* Returns the x coordinate of a given rectangle’s midpoint. */ -CGFloat NSMidX(NSRect aRect) { - return (aRect.origin.x + aRect.size.width * (CGFloat)0.5); -} -/* Returns the y coordinate of a given rectangle’s midpoint. */ -CGFloat NSMidY(NSRect aRect) { - return (aRect.origin.y + aRect.size.height * (CGFloat)0.5); -} -/* Returns the smallest x coordinate of a given rectangle. */ -CGFloat NSMinX(NSRect aRect) { - return (aRect.origin.x); -} -/* Returns the smallest y coordinate of a given rectangle. */ -CGFloat NSMinY(NSRect aRect) { - return (aRect.origin.y); -} -/* Returns the width of the specified rectangle. */ -CGFloat NSWidth(NSRect aRect) { - return (aRect.size.width); -} -/* Returns the height of a given rectangle. */ -CGFloat NSHeight(NSRect aRect) { - return (aRect.size.height); -} -/* Returns an NSRect typecast from a CGRect. */ -NSRect NSRectFromCGRect(CGRect cgrect) { - union _ {NSRect ns; CGRect cg;}; - return ((union _ *)&cgrect)->ns; -} -/* Returns a CGRect typecast from an NSRect. */ -CGRect NSRectToCGRect(NSRect nsrect) { - union _ {NSRect ns; CGRect cg;}; - return ((union _ *)&nsrect)->cg; -} -/* Returns an NSPoint typecast from a CGPoint. */ -NSPoint NSPointFromCGPoint(CGPoint cgpoint) { - union _ {NSPoint ns; CGPoint cg;}; - return ((union _ *)&cgpoint)->ns; -} -/* Returns a CGPoint typecast from an NSPoint. */ -CGPoint NSPointToCGPoint(NSPoint nspoint) { - union _ {NSPoint ns; CGPoint cg;}; - return ((union _ *)&nspoint)->cg; -} -/* Returns an NSSize typecast from a CGSize. */ -NSSize NSSizeFromCGSize(CGSize cgsize) { - union _ {NSSize ns; CGSize cg;}; - return ((union _ *)&cgsize)->ns; -} -/* Returns a CGSize typecast from an NSSize. */ -CGSize NSSizeToCGSize(NSSize nssize) { - union _ {NSSize ns; CGSize cg;}; - return ((union _ *)&nssize)->cg; -} -/* Returns a Boolean value that indicates whether a given point is in a given rectangle. */ -bool NSPointInRect(NSPoint aPoint, NSRect aRect) { - return (aPoint.x >= aRect.origin.x && aPoint.x <= aRect.origin.x + aRect.size.width && aPoint.y >= aRect.origin.y && aPoint.y <= aRect.origin.y + aRect.size.height); -} - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/source/NSOpengl.m b/deps/Silicon/source/NSOpengl.m deleted file mode 100644 index 9dbaf64..0000000 --- a/deps/Silicon/source/NSOpengl.m +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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 GL_SILENCE_DEPRECATION -#include - - -NSOpenGLPixelFormat* NSOpenGLPixelFormat_initWithAttributes(const NSOpenGLPixelFormatAttribute* attribs) { - return [[NSOpenGLPixelFormat alloc] initWithAttributes:(attribs)]; -} - - -NSOpenGLView* NSOpenGLView_initWithFrame(NSRect frameRect, NSOpenGLPixelFormat* format) { - return [[NSOpenGLView alloc] initWithFrame:(frameRect) pixelFormat:(format)]; -} - - -void NSOpenGLView_prepareOpenGL(NSOpenGLView* view) { - [view prepareOpenGL]; -} - - -NSOpenGLContext* NSOpenGLView_openGLContext(NSOpenGLView* view) { - return [view openGLContext]; -} - - -void NSOpenGLContext_setValues(NSOpenGLContext* context, const int* vals, NSOpenGLContextParameter param) { - [context setValues:(vals) forParameter:(param)]; -} - - -void NSOpenGLContext_makeCurrentContext(NSOpenGLContext* context) { - [context makeCurrentContext]; -} - - -void NSOpenGLContext_flushBuffer(NSOpenGLContext* context) { - [context flushBuffer]; -} \ No newline at end of file diff --git a/deps/Silicon/source/general.m b/deps/Silicon/source/general.m deleted file mode 100644 index 134441a..0000000 --- a/deps/Silicon/source/general.m +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include "implementation.h" -#define SI_ARRAY_IMPLEMENTATION -#include - - -/* Checks if the provided selector exist. */ -SEL si_impl_SEL_exists(const char* name, const char* filename, int line) { - SEL selector = sel_getUid(name); - - Class original_class = nil; - unsigned int class_count = 0; - Class* class_list = objc_copyClassList(&class_count); - - for (unsigned int i = 0; i < class_count; i++) { - Class cls = class_list[i]; - if ([NSStringFromClass(cls) isEqual:(@"UINSServiceViewController")]) // For whatever reason, this class ruins everything. - continue; - - if (class_getInstanceMethod(cls, selector)) { - original_class = cls; - break; - } - } - free(class_list); - - if (original_class == nil) { - printf("%s:%i: Method '%s' doesn't exist. If this is a C function, then make sure to convert it into a SEL method via 'func_to_SEL()' before this line.\n", filename, line, name); - return nil; - } - - return selector; -} - - -void si_impl_func_to_SEL_with_name(const char* class_name, const char* register_name, void* function) { - Class selected_class; - - if (strcmp(class_name, "NSView") == 0) { - selected_class = objc_getClass("ViewClass"); - } - else if (strcmp(class_name, "NSWindow") == 0) { - selected_class = objc_getClass("WindowClass"); - } - else { - selected_class = objc_getClass(class_name); - } - - class_addMethod(selected_class, sel_registerName(register_name), (IMP)function, 0); -} - - -/* Returns the name of a class as a string. */ -const char* CharFromClass(Class aClass) { - return NSString_to_char(NSStringFromClass(aClass)); -} - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/Silicon/source/mac.m b/deps/Silicon/source/mac.m deleted file mode 100644 index df493fd..0000000 --- a/deps/Silicon/source/mac.m +++ /dev/null @@ -1,891 +0,0 @@ -/* -Copyright (C) 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 restrictions: - -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. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include "../implementation.h" /* All of the macros that aren't from 'Silicon/macros.h' reside here. */ - - -const NSSize _NSZeroSize = {0, 0}; - -/* Key stuff. */ -const char* NSKEYS[] = { - "Up", "Down", "Left", "Right", - "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", - "Delete", "Insert", "Home", "End", "PageUp", "PageDown", - "Backspace", "Tab", "Enter", "Return", - "Escape", "Space", "Shift", "CapsLock", "BackSpace" -}; -const unsigned short NSKEYI[si_sizeof(NSKEYS)] = { - NSUpArrowFunctionKey, NSDownArrowFunctionKey, NSLeftArrowFunctionKey, NSRightArrowFunctionKey, - NSF1FunctionKey, NSF2FunctionKey, NSF3FunctionKey, NSF4FunctionKey, NSF5FunctionKey, NSF6FunctionKey, NSF7FunctionKey, NSF8FunctionKey, NSF9FunctionKey, NSF10FunctionKey, NSF11FunctionKey, NSF12FunctionKey, - NSDeleteFunctionKey, NSInsertFunctionKey, NSHomeFunctionKey, NSEndFunctionKey, NSPageUpFunctionKey, NSPageDownFunctionKey, - NSBackspaceCharacter, NSTabCharacter, NSNewlineCharacter, NSCarriageReturnCharacter, - 0x1B, 0x20, 0x56, 0x57, 0x51 -}; -const unsigned char NSKEYCOUNT = si_sizeof(NSKEYS); - - -@interface WindowClass : NSWindow {} -@end - -@implementation WindowClass - - (instancetype) returnWin { - return self; - } -@end - - -@interface ViewClass : NSView {} -@end - -@implementation ViewClass - - (NSTextField*)label { - return [NSTextField alloc]; - } -@end - - -/* Converts siArray to a NSArray. */ -NSArray* si_array_to_NSArray(siArray(void) array) { - size_t len = si_array_len(array); - return [[NSArray alloc] initWithObjects:(array) count:(len)]; -} - - -/* Returns the logon name of the current user. */ -const char* _NSUserName() { - return NSString_to_char(NSUserName()); -} - -/* Returns the path to either the user’s or application’s home directory, depending on the platform. */ -const char* _NSHomeDirectory() { - return NSString_to_char(NSHomeDirectory()); -} - -/* Creates a list of directory search paths. */ -siArray(const char*) _NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, bool expandTilde) { - NSArray* output = NSSearchPathForDirectoriesInDomains(directory, domainMask, expandTilde); /* wtf is this C++ faker doing in Objective-C??? */ - siArray(const char*) res = si_array_init_reserve(si_sizeof(const char*), output.count); - - for (NSUInteger i = 0; i < output.count; i++) - res[i] = NSString_to_char([output objectAtIndex:(i)]); - - return res; -} - -/* ============ NSControl class ============ */ -/* ====== NSControl properties ======*/ -/* */ -implement_property(NSControl, id, target, Target, control); -/* */ -implement_property(NSControl, SEL, action, Action, control); -/* */ -implement_property(NSControl, NSFont*, font, Font, control); -/* */ -implement_property(NSControl, double, doubleValue, DoubleValue, control); - -/* ====== NSControl functions ======*/ -/**/ -NSControl* NSControl_initWithFrame(NSRect frameRect) { - return [[NSControl alloc] initWithFrame:(frameRect)]; -} - - -/* ============ NSWindow class ============ */ -/* ====== NSWindow properties ====== */ -/* Get/Set the title of the window. */ -implement_str_property(NSWindow, const char*, title, Title, window); -/* Get/Set the delegate of the window. */ -implement_property(NSWindow, NSView*, contentView, ContentView, window); -/* Get/Set the NSView of the window. */ -implement_property(NSWindow, id, delegate, Delegate, window); -/* Get/Set the visbility of the window. */ -implement_property(NSWindow, bool, isVisible, IsVisible, window); -/* */ -implement_property(NSWindow, NSColor*, backgroundColor, BackgroundColor, window); -/* Toggle opaque for the window. */ -implement_property(NSWindow, bool, isOpaque, Opaque, window); -/* The window’s alpha value. */ -implement_property(NSWindow, CGFloat, alphaValue, AlphaValue, window); -/* A Boolean value that indicates whether the window accepts mouse-moved events. */ -implement_property(NSWindow, bool, acceptsMouseMovedEvents, AcceptsMouseMovedEvents, window); -/* Get the frame of the window. */ -NSRect NSWindow_frame(NSWindow* window) { return [window frame]; } - -/* ====== NSWindow functions ====== */ -/* Get/Set the title of the window. */ -NSWindow* NSWindow_init(NSRect contentRect, NSWindowStyleMask style, NSBackingStoreType backingStoreType, bool flag) { - return [[WindowClass alloc] initWithContentRect:(contentRect) styleMask:(style) backing:(backingStoreType) defer:(flag)]; -} -/* */ -void NSWindow_orderFront(NSWindow* window, NSWindow* sender){ - [window orderFront:(sender)]; -} -/* */ -void NSWindow_makeKeyWindow(NSWindow* window) { - [window makeKeyWindow]; -} -/* */ -bool NSWindow_isKeyWindow(NSWindow* window) { - return [window isKeyWindow]; -} -/* */ -void NSWindow_center(NSWindow* window) { - [window center]; -} -/* */ -void NSWindow_makeMainWindow(NSWindow* window) { - [window makeMainWindow]; -} -/* Set the frame of the window. */ -void NSWindow_setFrameAndDisplay(NSWindow* window, NSRect frame, bool display, bool animate) { - [window setFrame:(frame) display:(display) animate:(animate)]; -} -/* */ -NSPoint NSWindow_convertPointFromScreen(NSWindow* window, NSPoint point) { - //return [window convertPointFromScreen:(point)]; -} -/* Passes a display message down the window’s view hierarchy, thus redrawing all views within the window. */ -void NSWindow_display(NSWindow* window) { - return [window display]; -} -/* toggle wantslayer */ -void NSWindow_contentView_wantsLayer(NSWindow* window, bool wantsLayer) { - window.contentView.wantsLayer = wantsLayer; -} - - -/* ============ NSView class ============ */ -/* ====== NSView functions ====== */ -/* */ -NSView* NSView_init() { - return [[ViewClass alloc] init]; -} -/* */ -NSView* NSView_initWithFrame(NSRect frameRect) { - return [[ViewClass alloc] initWithFrame:(frameRect)]; -} -/* */ -void NSView_addSubview(NSView* view, NSView* subview) { - [view addSubview:(subview)]; -} -/* */ -void NSView_registerForDraggedTypes(NSView* view, siArray(NSPasteboardType) newTypes) { - NSArray* new_array = si_array_to_NSArray(newTypes); - - [view registerForDraggedTypes:(new_array)]; - [new_array release]; -} - - -/* ============ NSTextField class ============ */ -/* ====== NSTextField properties ====== */ -/* */ -implement_str_property(NSTextField, const char*, stringValue, StringValue, field); -/* */ -implement_property(NSTextField, bool, isBezeled, Bezeled, field); -/* */ -implement_property(NSTextField, bool, drawsBackground, DrawsBackground, field); -/* */ -implement_property(NSTextField, bool, isEditable, Editable, field); -/* */ -implement_property(NSTextField, bool, isSelectable, Selectable, field); -/* */ -implement_property(NSTextField, NSColor*, textColor, TextColor, field); -/* */ -implement_property(NSTextField, NSFont*, font, Font, field); - -/* ====== NSTextField functions ====== */ -/* Initializes a NSTextField handle. */ -NSTextField* NSTextField_initWithFrame(NSRect frameRect) { - return [[NSTextField alloc] initWithFrame:(frameRect)]; -} - - -/* ============ NSFontManager class ============ */ -/* ====== NSFontManager functions ====== */ -/* */ -NSFontManager* NSFontManager_sharedFontManager() { - return [NSFontManager sharedFontManager]; -} -/* */ -NSFont* NSFontManager_convertFont(NSFontManager* manager, NSFont* fontObj) { - return [manager convertFont:(fontObj)]; -} -/* */ -NSFont* NSFontManager_convertFontToHaveTrait(NSFontManager* manager, NSFont* fontObj, NSFontTraitMask trait) { - return [manager convertFont:(fontObj) toHaveTrait:(trait)]; -} - - -/* ============ NSFont class ============ */ -/* ====== NSFont functions ====== */ -/* */ -NSFont* NSFont_init(const char* fontName, CGFloat fontSize) { - NSString* str = char_to_NSString(fontName); - NSFont* res = [NSFont fontWithName:(str) size:(fontSize)]; - - [str release]; - return res; -} -/* */ -const char* NSFont_fontName(NSFont* font) { - return NSString_to_char([font fontName]); -} - - -/* ============ NSButton class ============ */ -/* ====== NSButton properties ====== */ -/* */ -implement_str_property(NSButton, const char*, title, Title, button); -/* */ -implement_property(NSButton, NSBezelStyle, bezelStyle, BezelStyle, button); -/* */ -implement_property(NSButton, id, target, Target, button); -/* */ -implement_property(NSButton, SEL, action, Action, button); -/* */ -implement_property(NSButton, NSAutoresizingMaskOptions, autoresizingMask, AutoresizingMask, button); -/* */ -implement_property(NSButton, NSControlStateValue, state, State, button); -/* */ -implement_property(NSButton, bool, allowsMixedState, AllowsMixedState, button); - -/* ====== NSButton functions ====== */ -/* */ -NSButton* NSButton_initWithFrame(NSRect frameRect) { - return [[NSButton alloc] initWithFrame:(frameRect)]; -} -/* */ -void NSButton_setButtonType(NSButton* button, NSButtonType buttonType) { - return [button setButtonType:(buttonType)]; -} - - -/* ============ NSComboBox class ============ */ -/* ====== NSComboBox properties ====== */ -/* */ -/* (read-only) */ -NSInteger NSComboBox_indexOfSelectedItem(NSComboBox* comboBox) { - return [comboBox indexOfSelectedItem]; -} -/* */ -implement_str_property(NSComboBox, const char*, stringValue, StringValue, field); -/* */ -implement_property(NSComboBox, bool, isBezeled, Bezeled, field); -/* */ -implement_property(NSComboBox, bool, drawsBackground, DrawsBackground, field); -/* */ -implement_property(NSComboBox, bool, isEditable, Editable, field); -/* */ -implement_property(NSComboBox, bool, isSelectable, Selectable, field); -/* */ -implement_property(NSComboBox, NSColor*, textColor, TextColor, field); -/* */ -implement_property(NSComboBox, id, target, Target, comboBox); -/* */ -implement_property(NSComboBox, SEL, action, Action, comboBox); - -/* ====== NSComboBox functions ====== */ -/**/ -NSComboBox* NSComboBox_initWithFrame(NSRect frameRect) { - return [[NSComboBox alloc] initWithFrame:(frameRect)]; -} -/* */ -void NSComboBox_addItem(NSComboBox* comboBox, const char* str) { - [comboBox addItemWithObjectValue:([char_to_NSString(str) retain])]; -} -/* */ -void NSComboBox_selectItem(NSComboBox* comboBox, NSInteger index) { - [comboBox selectItemAtIndex:(index)]; -} - - -/* ============ NSApplication class ============ */ -NSApplication* _NSApp; -/* ====== NSApplication properties ====== */ -/* */ -implement_property(NSApplication, NSMenu*, mainMenu, MainMenu, application); -/* */ -implement_property(NSApplication, NSMenu*, servicesMenu, ServicesMenu, application); -/* */ -implement_property(NSApplication, NSMenu*, helpMenu, HelpMenu, application); -/* */ -implement_property(NSApplication, NSMenu*, windowsMenu, WindowsMenu, application); -/* */ -implement_property(NSApplication, NSApplicationActivationPolicy, activationPolicy, ActivationPolicy, application); -/* */ -implement_property(NSApplication, NSImage*, applicationIconImage, ApplicationIconImage, application); - -/* ====== NSApplication functions ====== */ -/* */ -NSApplication* NSApplication_sharedApplication() { - _NSApp = [NSApplication sharedApplication]; - - return _NSApp; -} -/* */ -void NSApplication_finishLaunching(NSApplication* application) { - [application finishLaunching]; -} -/* */ -void NSApplication_run(NSApplication* application) { - [application run]; -} -/* */ -void NSApplication_stop(NSApplication* application, NSView* view) { - [application stop:(view)]; -} -/* */ -void NSApplication_terminate(NSApplication* application, id sender) { - [application terminate:(sender)]; -} -/* */ -void NSApplication_sendEvent(NSApplication* application, NSEvent* event) { - [application sendEvent:(event)]; -} -/* */ -void NSApplication_updateWindows(NSApplication* application) { - [application updateWindows]; -} -/* */ -void NSApplication_activateIgnoringOtherApps(NSApplication* application, bool flag) { - [application activateIgnoringOtherApps:(flag)]; -} -/* */ -NSEvent* NSApplication_nextEventMatchingMask(NSApplication* application, NSEventMask mask, NSDate* expiration, int mode, bool deqFlag) { - return [application nextEventMatchingMask:(mask) untilDate:(expiration) inMode:(NSDefaultRunLoopMode) dequeue:(deqFlag)];; -} - - -/* ============ NSScreen class ============*/ -/* ====== NSScreen properties ====== */ -/* Returns the screen object containing the window with the keyboard focus. */ -NSScreen* NSScreen_mainScreen() { - return [NSScreen mainScreen]; -} -/* The dimensions and location of the screen. */ -NSRect NSScreen_frame(NSScreen* screen) { - return [screen frame]; -} -/* The current location and dimensions of the visible screen. */ -NSRect NSScreen_visibleFrame(NSScreen* screen) { - return [screen visibleFrame]; -} - - -/* ============ NSEvent class ============ */ -/* ====== NSEvent functions ====== */ -/* */ -NSEventType NSEvent_type(NSEvent* event) { - return [event type]; -} -/* */ -NSPoint NSEvent_locationInWindow(NSEvent* event) { - return [event locationInWindow]; -} -/* */ -NSEventModifierFlags NSEvent_modifierFlags(NSEvent* event) { - return [event modifierFlags]; -} -/* */ -unsigned short NSEvent_keyCode(NSEvent* event) { - return [event keyCode]; -} -/* */ -NSPoint NSEvent_mouseLocation(NSEvent* event) { - return [NSEvent mouseLocation]; -} -/* */ -unsigned short NSEvent_keyCodeForChar(char* keyStr){ - for (NSUInteger i = 0; i < NSKEYCOUNT; i++) { - if (strcmp(keyStr, NSKEYS[i])) - return NSKEYI[i + 1]; - } - - NSString* keyString = char_to_NSString(keyStr); - unichar keyCode = [keyString characterAtIndex:(0)]; - - [keyString release]; - return keyCode; -} -/* */ -const char* NSEvent_characters(NSEvent* event) { - unichar keyCode = [[event charactersIgnoringModifiers] characterAtIndex:(0)]; - NSUInteger flags = [event modifierFlags] & (NSEventModifierFlagShift | NSEventModifierFlagControl | NSEventModifierFlagOption | NSEventModifierFlagCommand); - - for (NSUInteger i = 0; i < NSKEYCOUNT; i++) { - if (keyCode == NSKEYI[i]) - return NSKEYS[i]; - } - - return NSString_to_char([event characters]); -} -/* */ -CGFloat NSEvent_deltaY(NSEvent* event) { - return [event deltaY]; -} -/* */ -NSWindow* NSEvent_window(NSEvent* event){ - return [event window]; -} - - -/* ============ NSMenu class ============ */ -/* ====== NSMenu functions ====== */ -/* */ -NSMenu* NSMenu_init(const char* title) { - return [[NSMenu alloc] initWithTitle:(char_to_NSString(title))]; -} -/* */ -void NSMenu_addItem(NSMenu* menu, NSMenuItem* newItem) { - [menu addItem:(newItem)]; -} - - -/* ============ NSMenuItem class ============ */ -/* ====== NSMenuItem properties ====== */ -/* */ -implement_property(NSMenuItem, NSMenu*, submenu, Submenu, item); -/* */ -implement_str_property(NSMenuItem, const char*, title, Title, item); - -/* ====== NSMenuItem functions ====== */ -/* */ -NSMenuItem* NSMenuItem_init(const char* title, SEL selector, const char* keyEquivalent) { - NSString* menu_title = char_to_NSString(title); - NSString* key = char_to_NSString(keyEquivalent); - - return [[NSMenuItem alloc] initWithTitle:(menu_title) action:(selector) keyEquivalent:(key)]; -} -/* */ -siArray(NSMenuItem*) NSMenu_itemArray(NSMenu* menu) { - NSArray* item_array = [menu itemArray]; - siArray(NSMenuItem*) result = si_array_init_reserve(si_sizeof(*result), item_array.count); - - for (NSUInteger i = 0; i < item_array.count; i++) { - result[i] = [item_array objectAtIndex:(i)]; - [result[i] retain]; - } - /* TODO(EimaMei): Maybe release item_array here? */ - - return result; -} -/* */ -NSMenuItem* NSMenuItem_separatorItem() { - return [NSMenuItem separatorItem]; -} - - -/* ============ NSColor class ============ */ -/* ====== NSColor properties ====== */ -/* */ -NSColor* NSColor_clearColor() { - return [NSColor clearColor]; -} -/* */ -NSColor* NSColor_keyboardFocusIndicatorColor() { - return [NSColor keyboardFocusIndicatorColor]; -} - -/* ====== NSColor functions ====== */ -/* */ -void NSColor_set(NSColor* color) { - [color set]; -} -/* */ -NSColor* NSColor_colorWithRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { - return [NSColor colorWithRed:(red) green:(green) blue:(blue) alpha:(alpha)]; -} -/* */ -NSColor* NSColor_colorWithSRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { - return [NSColor colorWithSRGBRed:(red) green:(green) blue:(blue) alpha:(alpha)]; -} -/* Creates a color object using the given opacity and grayscale values. */ -NSColor* NSColor_colorWithCalibrated(CGFloat white, CGFloat alpha) { - return [NSColor colorWithCalibratedWhite:(white) alpha:(alpha)]; -} - - -/* ============ NSBezierPath class ============ */ -/* ====== NSBezierPath functions ====== */ -/* */ -void NSBezierPath_strokeLine(NSPoint from, NSPoint to) { - [NSBezierPath strokeLineFromPoint:(from) toPoint:(to)]; -} - - -/* ============ NSDate class ============ */ -/* ====== NSDate functions ====== */ -/* */ -NSDate* NSDate_distantFuture() { - return [NSDate distantFuture]; -} - - -/* ============ NSProcessInfo class ============ */ -/* ====== NSProcessInfo functions ====== */ -/* */ -NSProcessInfo* NSProcessInfo_processInfo() { - return [NSProcessInfo processInfo]; -} -/* */ -const char* NSProcessInfo_processName(NSProcessInfo* processInfo) { - return NSString_to_char([processInfo processName]); -} - - -/* ============ NSImage class ============ */ -/* ====== NSImage functions ====== */ -/* Initializes and returns an image object with the specified dimensions. */ -NSImage* NSImage_initWithSize(NSSize size) { - return [[NSImage alloc] initWithSize:(size)]; -} -/* */ -NSImage* NSImage_initWithData(unsigned char* bitmapData, NSUInteger length) { - NSData* data = [NSData dataWithBytes:(bitmapData) length:(length)]; - NSImage* result = [[NSImage alloc] initWithData:(data)]; - [data release]; - - return result; -} -/* Initializes a data object with the content of the file at a given path. */ -NSImage* NSImage_initWithFile(const char* path) { - NSString* filepath = char_to_NSString(path); - NSImage* result = [[NSImage alloc] initWithContentsOfFile:(filepath)]; - [filepath release]; - - return result; -} -/* */ -NSImage* NSImage_initWithCGImage(CGImageRef cgImage, NSSize size) { - return [[NSImage alloc] initWithCGImage:(cgImage) size:(size)]; -} -/* Adds the specified image representation object to the image. */ -void NSImage_addRepresentation(NSImage* image, NSImageRep* imageRep) { - [image addRepresentation:(imageRep)]; -} - - -/* ============ NSGraphicsContext class ============ */ -/* ====== NSGraphicsContext properties ====== */ -#if (OS_X_VERSION_MAX_ALLOWED < macos_version(10, 5)) /* 'currentContext' doesn't exist in OS X 10.5+. */ -/* */ -implement_deprecated_property(NSGraphicsContext, NSGraphicsContext*, currentContext, CurrentContext, context, macos(10.5)); -#endif - - -/* =========== NSPasteboard class ============ */ -/* ====== NSPasteboard functions ====== */ -/* */ -NSPasteboard* NSPasteboard_generalPasteboard() { - return [NSPasteboard generalPasteboard]; -} -const char* NSPasteboard_stringForType(NSPasteboard* pasteboard, NSPasteboardType dataType) { - return NSString_to_char([pasteboard stringForType:(dataType)]); -} -/* */ -NSInteger NSPasteBoard_declareTypes(NSPasteboard* pasteboard, siArray(NSPasteboardType) newTypes, void* owner) { - NSArray* new_array = si_array_to_NSArray(newTypes); - - NSInteger res = [pasteboard declareTypes:(new_array) owner:(owner)]; - [new_array release]; - - return res; -} -/* */ -bool NSPasteBoard_setString(NSPasteboard* pasteboard, const char* stringToWrite, NSPasteboardType dataType) { - return [pasteboard setString:(char_to_NSString(stringToWrite)) forType:(dataType)]; -} -/* */ -siArray(const char*) NSPasteboard_readObjectsForClasses(NSPasteboard* pasteboard, siArray(Class) classArray, void* options) { - NSArray* new_array = si_array_to_NSArray(classArray); - NSArray* filenames = [pasteboard readObjectsForClasses:(new_array) options:(options)]; - - siArray(const char*) output = si_array_init_reserve(si_sizeof(*output), filenames.count); - - for (NSUInteger i = 0; i < si_array_len(output); i++) - output[i] = NSString_to_char([[filenames objectAtIndex:(i)] path]); - - [new_array release]; - - return output; -} - - -/* ============ NSSlider class ============ */ -/* ====== NSSlider properties ====== */ -/**/ -implement_property(NSSlider, id, target, Target, slider); -/**/ -implement_property(NSSlider, SEL, action, Action, slider); -/**/ -implement_property(NSSlider, NSFont*, font, Font, slider); -/* */ -implement_property(NSSlider, double, doubleValue, DoubleValue, slider); -/* */ -implement_property(NSSlider, double, maxValue, MaxValue, slider); - -/* ====== NSSlider functions ====== */ -/* */ -NSSlider* NSSlider_initWithFrame(NSRect frameRect) { - return [[NSSlider alloc] initWithFrame:(frameRect)]; -} - - -/* ============ NSProgressIndicator class ============ */ -/* ====== NSProgressIndicator properties ====== */ -/* */ -implement_property(NSProgressIndicator, double, doubleValue, DoubleValue, progressIndicator); -/* */ -implement_property(NSProgressIndicator, double, maxValue, MaxValue, progressIndicator); -/* */ -implement_property(NSProgressIndicator, bool, isIndeterminate, Indeterminate, progressIndicator); - -/* ====== NSProgressIndicator functions ====== */ -/* */ -NSProgressIndicator* NSProgressIndicator_init(NSRect frameRect) { - return [[NSProgressIndicator alloc] initWithFrame:(frameRect)]; -} - - -/* ============ NSDraggingInfo class ============ */ -/* ====== NSDraggingInfo properties ====== */ -/* */ -NSPasteboard* NSDraggingInfo_draggingPasteboard(id info) { - return [info draggingPasteboard]; -} -/* */ -NSPoint NSDraggingInfo_draggingLocation(id info) { - return [info draggingLocation]; -} -/* */ -NSInteger NSDraggingInfo_numberOfValidItemsForDrop(id info) { - return [info numberOfValidItemsForDrop]; -} -void NSDraggingInfo_setNumberOfValidItemsForDrop(id info, NSInteger number) { - [info setNumberOfValidItemsForDrop:(number)]; -} -/* */ -NSWindow* NSDraggingInfo_draggingDestinationWindow(id info) { - return [info draggingDestinationWindow]; -} - - -/* ============ NSColorPanel class ============ */ -/* ====== NSColorPanel properties ====== */ -implement_property(NSColorPanel, NSColor*, color, Color, colorPanel); - - -/* ============ NSBitmapImageRep class ============ */ -/* ====== NSBitmapImageRep properties ====== */ -unsigned char* NSBitmapImageRep_bitmapData(NSBitmapImageRep* imageRep) { - return [imageRep bitmapData]; -} - -/* ====== NSBitmapImageRep functions ====== */ -/* Initializes a newly allocated bitmap image representation so it can render the specified image. */ -NSBitmapImageRep* NSBitmapImageRep_initWithBitmapData(unsigned char** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, const char* colorSpaceName, NSBitmapFormat bitmapFormat, NSInteger rowBytes, NSInteger pixelBits) { - return [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:(planes) - pixelsWide:(width) - pixelsHigh:(height) - bitsPerSample:(bps) - samplesPerPixel:(spp) - hasAlpha:(alpha) - isPlanar:(isPlanar) - colorSpaceName:(char_to_NSString(colorSpaceName)) - bitmapFormat:(bitmapFormat) - bytesPerRow:(rowBytes) - bitsPerPixel:(pixelBits) - ]; -} - - -/* ============ NSSavePanel class ============ */ -/* ====== NSSavePanel properties ====== */ -/* A Boolean value that indicates whether the panel displays UI for creating directories. */ -implement_property(NSSavePanel, bool, canCreateDirectories, CanCreateDirectories, savePanel); -/* (Deprecated!) An array of filename extensions or UTIs that represent the allowed file types for the panel. */ -siArray(const char*) NSSavePanel_allowedFileTypes(NSSavePanel* savePanel) { - NSArray* output = [savePanel allowedFileTypes]; - siArray(const char*) res = si_array_init_reserve(si_sizeof(const char*), output.count); - - for (NSUInteger i = 0; i < output.count; i++) { - res[i] = NSString_to_char([output objectAtIndex:(i)]); - } - - return res; -} -/* */ -void NSSavePanel_setAllowedFileTypes(NSSavePanel* savePanel, siArray(const char*) allowedFileTypes) { - siArray(NSString*) copy = si_array_init_reserve(si_sizeof(*copy), si_array_len(allowedFileTypes)); - - for (usize i = 0; i < si_array_len(copy); i++) { - copy[i] = char_to_NSString(allowedFileTypes[i]); - } - - NSArray* array = si_array_to_NSArray(copy); - [savePanel setAllowedFileTypes:(array)]; - - si_array_free(copy); - [array release]; -} -/* The current directory shown in the panel. */ -implement_property(NSSavePanel, NSURL*, directoryURL, DirectoryURL, savePanel); -/* The user-editable filename currently shown in the name field. */ -implement_str_property(NSSavePanel, const char*, nameFieldStringValue, NameFieldStringValue, savePanel); -/* A URL that contains the fully specified location of the targeted file. */ -NSURL* NSSavePanel_URL(NSSavePanel* savePanel) { - return [savePanel URL]; -} - -/* ====== NSSavePanel functions ====== */ -/* Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point. */ -NSModalResponse NSSavePanel_runModal(NSSavePanel* savePanel) { - return [savePanel runModal]; -} - - -/* ============ NSURL class ============ */ -/* ====== NSURL properties ====== */ -const char* NSURL_path(NSURL* url) { - return NSString_to_char([url path]); -} - -/* ====== NSURL functions ====== */ -/* Initializes and returns a newly created NSURL object as a file URL with a specified path. */ -NSURL* NSURL_fileURLWithPath(const char* path) { - NSString* txt = char_to_NSString(path); - NSURL* res = [NSURL fileURLWithPath:(txt)]; - - return res; -} - - -/* ============ NSOpenPanel class ============ */ -/* ====== NSOpenPanel properties ====== */ -/* A Boolean that indicates whether the user can choose files in the panel. */ -implement_property(NSOpenPanel, bool, canChooseFiles, CanChooseFiles, openPanel); -/* A Boolean that indicates whether the user can choose directories in the panel. */ -implement_property(NSOpenPanel, bool, canChooseDirectories, CanChooseDirectories, openPanel); -/* A Boolean value that indicates whether the panel displays UI for creating directories. */ -implement_property(NSOpenPanel, bool, canCreateDirectories, CanCreateDirectories, openPanel); -/* A Boolean that indicates whether the panel resolves aliases. */ -implement_property(NSOpenPanel, bool, resolvesAliases, ResolvesAliases, openPanel); -/* A Boolean that indicates whether the user may select multiple files and directories. */ -implement_property(NSOpenPanel, bool, allowsMultipleSelection, AllowsMultipleSelection, openPanel); -/* A Boolean value that indicates whether the panel's accessory view is visible. */ -implement_property(NSOpenPanel, bool, isAccessoryViewDisclosed, AccessoryViewDisclosed, openPanel); -/* An array of URLs, each of which contains the fully specified location of a selected file or directory. */ -siArray(NSURL*) NSOpenPanel_URLs(NSOpenPanel* openPanel) { - NSArray* output = [openPanel URLs]; - siArray(NSURL*) res = si_array_init_reserve(si_sizeof(NSURL*), output.count); - - for (NSUInteger i = 0; i < output.count; i++) - res[i] = [output objectAtIndex:(i)]; - - return res; -} -/* A Boolean value that indicates how the panel responds to iCloud documents that aren't fully downloaded locally. */ -implement_property(NSOpenPanel, bool, canDownloadUbiquitousContents, CanDownloadUbiquitousContents, openPanel); -/* A Boolean value that indicates whether the panel's accessory view is visible. */ -implement_property(NSOpenPanel, bool, canResolveUbiquitousConflicts, CanResolveUbiquitousConflicts, openPanel); -/* (Deprecated!) An array of filename extensions or UTIs that represent the allowed file types for the panel. */ -siArray(const char*) NSOpenPanel_allowedFileTypes(NSOpenPanel* savePanel) { return NSSavePanel_allowedFileTypes((NSSavePanel*)savePanel); } -void NSOpenPanel_setAllowedFileTypes(NSOpenPanel* savePanel, siArray(const char*) allowedFileTypes) { NSSavePanel_setAllowedFileTypes((NSSavePanel*)savePanel, allowedFileTypes);} -/* The current directory shown in the panel. */ -implement_property(NSOpenPanel, NSURL*, directoryURL, DirectoryURL, openPanel); -/* The user-editable filename currently shown in the name field. */ -implement_str_property(NSOpenPanel, const char*, nameFieldStringValue, NameFieldStringValue, openPanel); -/* A URL that contains the fully specified location of the targeted file. */ -NSURL* NSOpenPanel_URL(NSOpenPanel* openPanel) { return [openPanel URL]; } - -/* ====== NSOpenPanel functions ====== */ -/* Creates a new Open panel and initializes it with a default configuration. */ -NSOpenPanel* NSOpenPanel_openPanel() { - return [NSOpenPanel openPanel]; -} -/* Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point. */ -NSModalResponse NSOpenPanel_runModal(NSOpenPanel* openPanel) { - return [openPanel runModal]; -} - - -/* ============ NSCursor class ============ */ -/* ====== NSCursor properties ====== */ -/* The cursor’s image. */ -NSImage* NSCursor_image(NSCursor* cursor) { - return [cursor image]; -} -/* The position of the cursor's hot spot. */ -NSPoint NSCursor_hotSpot(NSCursor* cursor) { - return [cursor hotSpot]; -} -/* Returns the application’s current cursor. */ -NSCursor* NSCursor_currentCursor() { - return [NSCursor currentCursor]; -} -/* Returns the default cursor, the arrow cursor. */ -NSCursor* NSCursor_arrowCursor() { - return [NSCursor arrowCursor]; -} - -/* ====== NSCursor functions ====== */ -/* Initializes a cursor with the given image and hot spot. */ -NSCursor* NSCursor_initWithImage(NSImage* newImage, NSPoint aPoint) { - return [[NSCursor alloc] initWithImage:(newImage) hotSpot:(aPoint)]; -} -/* Makes the current cursor invisible. */ -void NSCursor_hide() { - [NSCursor hide]; -} -/* Makes the current cursor invisible. */ -void NSCursor_unhide() { - [NSCursor unhide]; -} -/* Pops the current cursor off the top of the stack. */ -void NSCursor_pop(NSCursor* cursor) { - [cursor pop]; -} -/* Puts the receiver on top of the cursor stack and makes it the current cursor. */ -void NSCursor_push(NSCursor* cursor) { - [cursor push]; -} -/* Makes the receiver the current cursor. */ -void NSCursor_set(NSCursor* cursor) { - [cursor set]; -} - - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/deps/silicon.h b/deps/silicon.h new file mode 100644 index 0000000..7a29c34 --- /dev/null +++ b/deps/silicon.h @@ -0,0 +1,3085 @@ +/* +* Copyright (C) 2023 ColleagueRiley ColleagueRiley@gmail.com +* 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 at least one header or you use -D SILICON_IMPLEMENTATION) + #define SI_NO_RELEASE - do not define release (just use NSRelease) +*/ + +#ifndef SILICON_H +#include +#include +#include +#include +#include + +#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 + +#ifndef siArray +#define SILICON_ARRAY_IMPLEMENTATION + +#ifndef usize +typedef size_t usize; +typedef ptrdiff_t isize; +#endif + +#ifndef si_sizeof +#define si_sizeof(type) (isize)sizeof(type) +#endif + +#define SI_DEFAULT "NSObject" + +/* Silicon array type. */ +#define siArray(type) type* + +/* Header for the array. */ +typedef struct siArrayHeader { + isize count; + /* TODO(EimaMei): Add a `type_width` later on. */ +} siArrayHeader; + +/* Gets the header of the siArray. */ +#define SI_ARRAY_HEADER(s) ((siArrayHeader*)s - 1) + + +/* Initializes a Silicon array. */ +void* si_array_init(void* allocator, isize sizeof_element, isize count); +/* Reserves a Silicon array with the provided element count. */ +void* si_array_init_reserve(isize sizeof_element, isize count); +/* Gets the element count of the array. */ +#define si_array_len(array) (SI_ARRAY_HEADER(array)->count) +/* Frees the array from memory. */ +void si_array_free(siArray(void) array); +#endif + +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 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 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; +#ifndef __OBJC__ +typedef void NSDictionary; +typedef void NSURL; +typedef void NSFont; +typedef void NSDate; +typedef void NSString; +typedef void NSArray; +#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 */ + NSEventMaskGesture API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeGesture, + NSEventMaskMagnify API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeMagnify, + NSEventMaskSwipe API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeSwipe, + NSEventMaskRotate API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeRotate, + NSEventMaskBeginGesture API_AVAILABLE(macos(10.5)) = 1ULL << NSEventTypeBeginGesture, + 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. + */ + NSEventMaskSmartMagnify API_AVAILABLE(macos(10.8)) = 1ULL << NSEventTypeSmartMagnify, + NSEventMaskPressure API_AVAILABLE(macos(10.10.3)) = 1ULL << NSEventTypePressure, + NSEventMaskDirectTouch API_AVAILABLE(macos(10.12.2)) = 1ULL << NSEventTypeDirectTouch, + + NSEventMaskChangeMode API_AVAILABLE(macos(10.15)) = 1ULL << NSEventTypeChangeMode, + + 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. + NSEventModifierFlagDeviceIndependentFlagsMask = 0xffff0000UL +}; + +typedef NS_ENUM(NSUInteger, NSDragOperation) { + NSDragOperationNone = 0, + NSDragOperationCopy = 1, + NSDragOperationLink = 2, + NSDragOperationGeneric = 4, + NSDragOperationPrivate = 8, + NSDragOperationMove = 16, + NSDragOperationDelete = 32, + NSDragOperationEvery = NSUIntegerMax, + + //NSDragOperationAll_Obsolete API_DEPRECATED("", macos(10.0,10.10)) = 15, // Use NSDragOperationEvery + //NSDragOperationAll API_DEPRECATED("", macos(10.0,10.10)) = NSDragOperationAll_Obsolete, // Use NSDragOperationEvery +}; + +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 */ + 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 class ============ */ +/* ====== NSColor properties ====== */ +/* */ +SICDEF NSColor* NSColor_clearColor(void); +/* */ +SICDEF NSColor* NSColor_keyboardFocusIndicatorColor(void); + +/* ============ NSString ============ */ +SICDEF NSString* NSString_stringWithUTF8String(const char* str); +SICDEF const char* NSString_to_char(NSString* str); + +/* ============ NSDictionary ============ */ +SICDEF const char* NSDictionary_objectForKey(NSDictionary* d, const char* str); + +/* ============ NSBundle ============ */ +SICDEF NSDictionary* NSBundle_infoDictionary(NSBundle* bundle); +SICDEF NSBundle* NSBundle_mainBundle(void); + +/* ============= NSArray ============ */ +SICDEF NSArray* si_array_to_NSArray(siArray(void) array); +SICDEF NSUInteger NSArray_count(NSArray* array); +SICDEF void* NSArray_objectAtIndex(NSArray* array, NSUInteger index); + +/* ====== 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); + +/* ====== NSBezierPath functions ====== */ +/* */ +SICDEF void NSBezierPath_strokeLine(NSPoint from, NSPoint to); + +/* ====== NSAutoreleasePool functions ====== */ +/* */ +SICDEF NSAutoreleasePool* NSAutoreleasePool_init(void); +SICDEF void NSAutoreleasePool_drain(NSAutoreleasePool* pool); + +/* ====== NSDate functions ====== */ +/* */ +SICDEF NSDate* NSDate_distantFuture(void); + +/* ============ NSProcessInfo class ============ */ +/* ====== NSProcessInfo functions ====== */ +/* */ +SICDEF NSProcessInfo* NSProcessInfo_processInfo(void); +/* */ +SICDEF const char* NSProcessInfo_processName(NSProcessInfo* processInfo); + + +/* ============ NSApplication class ============ */ +/* ====== 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_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 class ============ */ +/* ====== 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 class ============ */ +/* ====== NSWindow properties ====== */ +/* Get/Set the title of the window. */ +si_define_property(NSWindow, const char*, title, Title, window); +/* Get/Set the NSView of the window. */ +si_define_property(NSWindow, NSView*, contentView, ContentView, window); +/* Get/Set the delegate of the window. */ +si_define_property(NSWindow, id, delegate, Delegate, 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); +/* Get/Set the frame of the window. */ +SICDEF NSRect NSWindow_frame(NSWindow* window); + +/* ====== NSWindow functions ====== */ +/* Initializes a NSWindow handle. */ +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 void NSWindow_center(NSWindow* window); +/* */ +SICDEF void NSWindow_makeMainWindow(NSWindow* window); +/* */ +SICDEF void NSWindow_setFrameAndDisplay(NSWindow* window, NSRect frame, bool display, bool animate); +/* */ +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); +/* toggle wantslayer */ +SICDEF void NSWindow_contentView_setWantsLayer(NSWindow* window, bool wantsLayer) ; + +/* ============ NSView class ============ */ +/* ====== 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); + +/* ============ NSTextField class ============ */ +/* ====== 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 class ============ */ +/* ====== 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 class ============ */ +/* ====== NSFont functions ====== */ +/* */ +SICDEF NSFont* NSFont_init(const char* fontName, CGFloat fontSize); +/* */ +SICDEF const char* NSFont_fontName(NSFont* font); + +/* ============ NSButton class ============ */ +/* ====== 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 class ============ */ +/* ====== 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 class ============ */ +/* ====== 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 class ============ */ +/* ====== 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 class ============ */ +/* ====== 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 class ============ */ +/* ====== 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 class ============ */ +/* ====== 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); +/* Returns the application’s current cursor. */ +SICDEF NSCursor* NSCursor_currentCursor(void); + +/* ============ NSGraphicsContext class ============ */ +/* ====== NSGraphicsContext properties ====== */ +/* */ +#if (OS_X_VERSION_MAX_ALLOWED < macos_version(10, 5)) /* 'currentContext' doesn't exist in OS X 10.5+. */ +/* */ +si_define_property(NSGraphicsContext, NSGraphicsContext*, currentContext, CurrentContext, context); +#endif + +/* ============ NSCursor class ============ */ +/* ====== NSCursor properties ====== */ +/* The cursor’s image. */ +SICDEF NSImage* NSCursor_image(NSCursor* cursor); +/* The position of the cursor's hot spot. */ +SICDEF NSPoint NSCursor_hotSpot(NSCursor* cursor); +/* Returns the default cursor, the arrow cursor. */ +SICDEF NSCursor* NSCursor_arrowCursor(void); +/* Initializes a cursor with the given image and hot spot. */ +SICDEF NSCursor* NSCursor_initWithImage(NSImage* newImage, NSPoint aPoint); +/* Makes the current cursor invisible. */ +SICDEF void NSCursor_hide(void); +/* Makes the current cursor invisible. */ +SICDEF void NSCursor_unhide(void); +/* Pops the current cursor off the top of the stack. */ +SICDEF void NSCursor_pop(NSCursor* cursor); +/* Puts the receiver on top of the cursor stack and makes it the current cursor. */ +SICDEF void NSCursor_push(NSCursor* cursor); +/* Makes the receiver the current cursor. */ +SICDEF void NSCursor_set(NSCursor* cursor); + +/* =========== NSPasteboard class ============ */ +/* ====== NSPasteboard functions ====== */ +/* */ +SICDEF NSPasteboard* NSPasteboard_generalPasteboard(void); +/* */ +SICDEF const char* NSPasteboard_stringForType(NSPasteboard* pasteboard, NSPasteboardType dataType); +/* */ +SICDEF NSInteger NSPasteBoard_declareTypes(NSPasteboard* pasteboard, siArray(NSPasteboardType) newTypes, void* owner); +/* */ +SICDEF bool NSPasteBoard_setString(NSPasteboard* pasteboard, const char* stringToWrite, NSPasteboardType dataType); +/* */ +SICDEF siArray(const char*) NSPasteboard_readObjectsForClasses(NSPasteboard* pasteboard, siArray(Class) classArray, void* options); + +/* ============ NSMenu class ============ */ +/* ====== NSMenu functions ====== */ +/* */ +SICDEF NSMenu* NSMenu_init(const char* title); +/* */ +SICDEF void NSMenu_addItem(NSMenu* menu, NSMenuItem* newItem); + + +/* ============ NSMenuItem class ============ */ +/* ====== NSMenuItem properties ====== */ +/* */ +si_define_property(NSMenuItem, NSMenu*, submenu, Submenu, item); +/* */ +si_define_property(NSMenuItem, const char*, title, Title, item); + +/* ====== NSMenuItem functions ====== */ +/* */ +SICDEF NSMenuItem* NSMenuItem_init(const char* title, SEL selector, const char* keyEquivalent); +/* */ +SICDEF siArray(NSMenuItem*) NSMenu_itemArray(NSMenu* menu); +/* */ +SICDEF NSMenuItem* NSMenuItem_separatorItem(void); + +/* ============ NSColorPanel class ============ */ +/* =====si_= NSColorPanel properties ====== */ +si_define_property(NSColorPanel, NSColor*, color, Color, colorPanel); + +/* ============ NSBitmapImageRep class ============ */ +/* ====== NSBitmapImageRep properties ====== */ +SICDEF unsigned char* NSBitmapImageRep_bitmapData(NSBitmapImageRep* imageRep); + +/* ====== NSBitmapImageRep functions ====== */ +/* Initializes a newly allocated bitmap image representation so it can render the specified image. */ +SICDEF NSBitmapImageRep* NSBitmapImageRep_initWithBitmapData(unsigned char** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, const char* colorSpaceName, NSBitmapFormat bitmapFormat, NSInteger rowBytes, NSInteger pixelBits); + +/* ============ NSSavePanel class ============ */ +/* ====== NSSavePanel properties ====== */ +/* A Boosi_lean value that indicates whether the panel displays UI for creating directories. */ +si_define_property(NSSavePanel, bool, canCreateDirectories, CanCreateDirectories, savePanel); +/* (Deprsi_ecated!) An array of filename extensions or UTIs that represent the allowed file types for the panel. */ +si_define_property(NSSavePanel, siArray(const char*), allowedFileTypes, AllowedFileTypes, savePanel); +/* The csi_urrent directory shown in the panel. */ +si_define_property(NSSavePanel, NSURL*, directoryURL, DirectoryURL, savePanel); +/* The usi_ser-editable filename currently shown in the name field. */ +si_define_property(NSSavePanel, const char*, nameFieldStringValue, NameFieldStringValue, savePanel); +/* A URL that contains the fully specified location of the targeted file. */ +SICDEF NSURL* NSSavePanel_URL(NSSavePanel* savePanel); + +/* ====== NSSavePanel functions ====== */ +/* Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point. */ +SICDEF NSModalResponse NSSavePanel_runModal(NSSavePanel* savePanel); + + +/* ============ NSURL class ============ */ +/* ====== NSURL properties ====== */ +SICDEF const char* NSURL_path(NSURL* url); + +/* ====== NSURL functions ====== */ +/* Initializes and returns a newly created NSURL object as a file URL with a specified path. */ +SICDEF NSURL* NSURL_fileURLWithPath(const char* path); + + +/* ============ NSOpenPanel class ============ */ +/* ====== NSOpenPanel properties ====== */ +/* A Boosi_lean that indicates whether the user can choose files in the panel. */ +si_define_property(NSOpenPanel, bool, canChooseFiles, CanChooseFiles, openPanel); +/* A Boosi_lean that indicates whether the user can choose directories in the panel. */ +si_define_property(NSOpenPanel, bool, canChooseDirectories, CanChooseDirectories, openPanel); +/* A Boosi_lean value that indicates whether the panel displays UI for creating directories. */ +si_define_property(NSOpenPanel, bool, canCreateDirectories, CanCreateDirectories, openPanel); +/* A Boosi_lean that indicates whether the panel resolves aliases. */ +si_define_property(NSOpenPanel, bool, resolvesAliases, ResolvesAliases, openPanel); +/* A Boosi_lean that indicates whether the user may select multiple files and directories. */ +si_define_property(NSOpenPanel, bool, allowsMultipleSelection, AllowsMultipleSelection, openPanel); +/* A Boosi_lean value that indicates whether the panel's accessory view is visible. */ +si_define_property(NSOpenPanel, bool, accessoryViewDisclosed, AccessoryViewDisclosed, openPanel); +/* An array of URLs, each of which contains the fully specified location of a selected file or directory. */ +SICDEF siArray(NSURL*) NSOpenPanel_URLs(NSOpenPanel* openPanel); +/* A Boosi_lean value that indicates how the panel responds to iCloud documents that aren't fully downloaded locally. */ +si_define_property(NSOpenPanel, bool, canDownloadUbiquitousContents, CanDownloadUbiquitousContents, openPanel); +/* A Boosi_lean value that indicates whether the panel's accessory view is visible. */ +si_define_property(NSOpenPanel, bool, canResolveUbiquitousConflicts, CanResolveUbiquitousConflicts, openPanel); +/* (Deprsi_ecated!) An array of filename extensions or UTIs that represent the allowed file types for the panel. */ +si_define_property(NSOpenPanel, siArray(const char*), allowedFileTypes, AllowedFileTypes, openPanel); +/* The csi_urrent directory shown in the panel. */ +si_define_property(NSOpenPanel, NSURL*, directoryURL, DirectoryURL, openPanel); +/* The usi_ser-editable filename currently shown in the name field. */ +si_define_property(NSOpenPanel, const char*, nameFieldStringValue, NameFieldStringValue, openPanel); +/* A URL that contains the fully specified location of the targeted file. */ +SICDEF NSURL* NSOpenPanel_URL(NSOpenPanel* openPanel); + +/* ====== NSOpenPanel functions ====== */ +/* Creates a new Open panel and initializes it with a default configuration. */ +SICDEF NSOpenPanel* NSOpenPanel_openPanel(); +/* Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point. */ +SICDEF NSModalResponse NSOpenPanel_runModal(NSOpenPanel* openPanel); + +/* ============ OpenGL ============ */ +/* TODO(EimaMei): Add documentation & deprecations macros for the OpenGL functions. */ +SICDEF NSOpenGLPixelFormat* NSOpenGLPixelFormat_initWithAttributes(const NSOpenGLPixelFormatAttribute* attribs); +SICDEF NSOpenGLView* NSOpenGLView_initWithFrame(NSRect frameRect, NSOpenGLPixelFormat* format); +SICDEF void NSOpenGLView_prepareOpenGL(NSOpenGLView* view); +SICDEF NSOpenGLContext* NSOpenGLView_openGLContext(NSOpenGLView* view); +SICDEF void NSOpenGLContext_setValues(NSOpenGLContext* context, const int* vals, NSOpenGLContextParameter param); +SICDEF void NSOpenGLContext_makeCurrentContext(NSOpenGLContext* context); +SICDEF void NSOpenGLContext_flushBuffer(NSOpenGLContext* context); + +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeString API_AVAILABLE(macos(10.6)); // Replaces NSStringPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypePDF API_AVAILABLE(macos(10.6)); // Replaces NSPDFPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeTIFF API_AVAILABLE(macos(10.6)); // Replaces NSTIFFPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypePNG API_AVAILABLE(macos(10.6)); +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeRTF API_AVAILABLE(macos(10.6)); // Replaces NSRTFPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeRTFD API_AVAILABLE(macos(10.6)); // Replaces NSRTFDPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeHTML API_AVAILABLE(macos(10.6)); // Replaces NSHTMLPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeTabularText API_AVAILABLE(macos(10.6)); // Replaces NSTabularTextPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeFont API_AVAILABLE(macos(10.6)); // Replaces NSFontPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeRuler API_AVAILABLE(macos(10.6)); // Replaces NSRulerPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeColor API_AVAILABLE(macos(10.6)); // Replaces NSColorPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeSound API_AVAILABLE(macos(10.6)); // Replaces NSSoundPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeMultipleTextSelection API_AVAILABLE(macos(10.6)); // Replaces NSMultipleTextSelectionPboardType +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeTextFinderOptions API_AVAILABLE(macos(10.7)); // Replaces NSPasteboardTypeFindPanelSearchOptions +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeURL API_AVAILABLE(macos(10.13)); // Equivalent to kUTTypeURL +APPKIT_EXTERN NSPasteboardType const NSPasteboardTypeFileURL API_AVAILABLE(macos(10.13)); // Equivalent to kUTTypeFileURL + +static const NSWindowStyleMask NSBorderlessWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskBorderless", macos(10.0,10.12)) = NSWindowStyleMaskBorderless; +static const NSWindowStyleMask NSTitledWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskTitled", macos(10.0,10.12)) = NSWindowStyleMaskTitled; +static const NSWindowStyleMask NSClosableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskClosable", macos(10.0,10.12)) = NSWindowStyleMaskClosable; +static const NSWindowStyleMask NSMiniaturizableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskMiniaturizable", macos(10.0,10.12)) = NSWindowStyleMaskMiniaturizable; +static const NSWindowStyleMask NSResizableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskResizable", macos(10.0,10.12)) = NSWindowStyleMaskResizable; +static const NSWindowStyleMask NSTexturedBackgroundWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskTexturedBackground", macos(10.0,10.12)) = NSWindowStyleMaskTexturedBackground; +static const NSWindowStyleMask NSUnifiedTitleAndToolbarWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskUnifiedTitleAndToolbar", macos(10.0,10.12)) = NSWindowStyleMaskUnifiedTitleAndToolbar; +static const NSWindowStyleMask NSFullScreenWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskFullScreen", macos(10.0,10.12)) = NSWindowStyleMaskFullScreen; +static const NSWindowStyleMask NSFullSizeContentViewWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskFullSizeContentView", macos(10.0,10.12)) = NSWindowStyleMaskFullSizeContentView; +static const NSWindowStyleMask NSUtilityWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskUtilityWindow", macos(10.0,10.12)) = NSWindowStyleMaskUtilityWindow; +static const NSWindowStyleMask NSDocModalWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskDocModalWindow", macos(10.0,10.12)) = NSWindowStyleMaskDocModalWindow; +static const NSWindowStyleMask NSNonactivatingPanelMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskNonactivatingPanel", macos(10.0,10.12)) = NSWindowStyleMaskNonactivatingPanel; +static const NSWindowStyleMask NSHUDWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskHUDWindow", macos(10.0,10.12)) = NSWindowStyleMaskHUDWindow; +static const NSWindowStyleMask NSUnscaledWindowMask API_DEPRECATED("NSUnscaledWindowMask is deprecated and has no effect. The scale factor for a window backing store is dynamic and dependent on the screen it is placed on.", macos(10.0,10.9)) = 1 << 11; + +#define NSDefaultRunLoopMode NSString_stringWithUTF8String("kCFRunLoopDefaultMode") + +// Additional NSModalResponse values +static const NSModalResponse NSModalResponseOK = 1; +static const NSModalResponse NSModalResponseCancel = 0; + +enum { + NSFontItalicTrait = (1 << 0), + NSFontBoldTrait = (1 << 1), + NSFontExpandedTrait = (1 << 5), + NSFontCondensedTrait = (1 << 6), + NSFontMonoSpaceTrait = (1 << 10), + NSFontVerticalTrait = (1 << 11), + NSFontUIOptimizedTrait = (1 << 12) +}; + +typedef NS_ENUM(NSUInteger, NSSearchPathDirectory) { + NSApplicationDirectory = 1, // supported applications (Applications) + NSDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) + NSDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. + NSAdminApplicationDirectory, // system and network administration applications (Administration) + NSLibraryDirectory, // various documentation, support, and configuration files, resources (Library) + NSDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. + NSUserDirectory, // user home directories (Users) + NSDocumentationDirectory, // documentation (Documentation) + NSDocumentDirectory, // documents (Documents) + NSCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) + NSAutosavedInformationDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 11, // location of autosaved documents (Documents/Autosaved) + NSDesktopDirectory = 12, // location of user's desktop + NSCachesDirectory = 13, // location of discardable cache files (Library/Caches) + NSApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) + NSDownloadsDirectory API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0)) = 15, // location of the user's "Downloads" directory + NSInputMethodsDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 16, // input methods (Library/Input Methods) + NSMoviesDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 17, // location of user's Movies directory (~/Movies) + NSMusicDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 18, // location of user's Music directory (~/Music) + NSPicturesDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 19, // location of user's Pictures directory (~/Pictures) + NSPrinterDescriptionDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 20, // location of system's PPDs directory (Library/Printers/PPDs) + NSSharedPublicDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 21, // location of user's Public sharing directory (~/Public) + NSPreferencePanesDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) + NSApplicationScriptsDirectory API_AVAILABLE(macos(10.8)) API_UNAVAILABLE(ios, watchos, tvos) = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) + NSItemReplacementDirectory API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)) = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: + NSAllApplicationsDirectory = 100, // all directories where applications can occur + NSAllLibrariesDirectory = 101, // all directories where resources can occur + NSTrashDirectory API_AVAILABLE(macos(10.8), ios(11.0)) API_UNAVAILABLE(watchos, tvos) = 102 // location of Trash directory +}; + +typedef NS_ENUM(NSUInteger, NSSearchPathDomainMask) { + NSUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) + NSLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) + NSNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) + NSSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) + NSAllDomainsMask = 0x0ffff // all domains: all of the above and future items +}; + +siArray(const char*) NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, bool expandTilde); + +#endif /* ndef SILICON_H */ + +#ifdef SILICON_IMPLEMENTATION + +/* Defining common properties/methods macros. */ +/* Defines the `get` and `set` versions of the provided property. */ + +#define si_declare_single(class, type, name, func) \ + type class##_##name(class* obj) { \ + return (type)objc_func(obj, SI_NS_FUNCTIONS[func]); \ + } + +#define si_declare_double(class, type, name, func, arg_type) \ + type class##_##name(class* obj, arg_type d) { \ + return (type)objc_func(obj, SI_NS_FUNCTIONS[func], d); \ + } + +#define NSAlloc(nsclass) objc_func(nsclass, SI_NS_CLASSES[NS_ALLOC_CODE]) + +typedef void* (*objc_send_type)(id, SEL, ...); +objc_send_type objc_func = (objc_send_type)objc_msgSend; + +const NSSize _NSZeroSize = {0, 0}; + +/* Key stuff. */ +const char* NSKEYS[] = { + "Up", "Down", "Left", "Right", + "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", + "Delete", "Insert", "Home", "End", "PageUp", "PageDown", + "Backspace", "Tab", "Enter", "Return", + "Escape", "Space", "Shift", "CapsLock", "BackSpace" +}; +const unsigned short NSKEYI[sizeof(NSKEYS) / sizeof(char*)] = { + NSUpArrowFunctionKey, NSDownArrowFunctionKey, NSLeftArrowFunctionKey, NSRightArrowFunctionKey, + NSF1FunctionKey, NSF2FunctionKey, NSF3FunctionKey, NSF4FunctionKey, NSF5FunctionKey, NSF6FunctionKey, NSF7FunctionKey, NSF8FunctionKey, NSF9FunctionKey, NSF10FunctionKey, NSF11FunctionKey, NSF12FunctionKey, + NSDeleteFunctionKey, NSInsertFunctionKey, NSHomeFunctionKey, NSEndFunctionKey, NSPageUpFunctionKey, NSPageDownFunctionKey, + NSBackspaceCharacter, NSTabCharacter, NSNewlineCharacter, NSCarriageReturnCharacter, + 0x1B, 0x20, 0x56, 0x57, 0x51 +}; +const unsigned char NSKEYCOUNT = sizeof(NSKEYS); + +enum { /* classes */ + NS_APPLICATION_CODE = 0, + NS_WINDOW_CODE, + NS_ALLOC_CODE, + NS_VALUE_CODE, + NS_EVENT_CODE, + NS_DATE_CODE, + NS_VIEW_CODE, + NS_OPENGL_VIEW_CODE, + NS_SCREEN_CODE, + NS_COLOR_CODE, + NS_CURSOR_CODE, + NS_PASTEBOARD_CODE, + NS_STRING_CODE, + NS_OPENGL_CONTEXT_CODE, + NS_OPENGL_PF_CODE, + NS_IMAGE_CODE, + NS_MENU_CODE, + NS_MENUITEM_CODE, + NS_DRAG_INFO_CODE, + NS_IMAGE_REP_CODE, + NS_GRAPHICS_CONTEXT_CODE, + NS_BITMAPIMAGEREP_CODE, + NS_BEZIER_PATH_CODE, + NS_AUTO_RELEASE_POOL_CODE, + NS_ARRAY_CODE, + NS_SAVE_PANEL_CODE, + NS_TEXT_FIELD_CODE, + NS_FONT_MANAGER_CODE, + NS_PROCESS_INFO_CODE, + NS_FONT_CODE, + NS_BUTTON_CODE, + NS_COMBOBOX_CODE, + NS_PROGRESS_INDICATOR_CODE, + NS_SLIDER_CODE, + NS_URL_CODE, + NS_BUNDLE_CODE, + /* functions */ + NS_APPLICATION_SET_ACTIVATION_POLICY_CODE = 0, + NS_APPLICATION_SAPP_CODE, + NS_APPLICATION_RUN_CODE, + NS_APPLICATION_FL_CODE, + NS_WINDOW_INITR_CODE, + NS_WINDOW_MAKEKO_CODE, + NS_VALUE_RECT_CODE, + NS_RELEASE_CODE, + NS_WINDOW_MAKEOF_CODE, + NS_OPENGL_FB_CODE, + NS_COLOR_CLEAR_CODE, + NS_COLOR_KEYBOARD_FOCUS_INDICATOR_CODE, + NS_COLOR_SET_CODE, + NS_COLOR_WITH_RGB_CODE, + NS_COLOR_WITH_SRGB_CODE, + NS_COLOR_WITH_CALIBRATED_CODE, + NS_APPLICATION_MAIN_MENU_CODE, + NS_APPLICATION_SET_MAIN_MENU_CODE, + NS_APPLICATION_SERVICES_MENU_CODE, + NS_APPLICATION_SET_SERVICES_MENU_CODE, + NS_APPLICATION_HELP_MENU_CODE, + NS_APPLICATION_SET_HELP_MENU_CODE, + NS_APPLICATION_WINDOWS_MENU_CODE, + NS_APPLICATION_SET_WINDOWS_MENU_CODE, + NS_APPLICATION_ACTIVATION_POLICY_CODE, + NS_APPLICATION_APPLICATION_ICON_IMAGE_CODE, + NS_APPLICATION_SET_APPLICATION_ICON_IMAGE_CODE, + NS_APPLICATION_STOP_CODE, + NS_APPLICATION_TERMINATE_CODE, + NS_APPLICATION_SEND_EVENT_CODE, + NS_APPLICATION_UPDATE_WINDOWS_CODE, + NS_APPLICATION_ACTIVATE_IGNORING_OTHER_APPS_CODE, + NS_APPLICATION_NEXT_EVENT_MATCHING_MASK_CODE, + NS_SCREEN_MAIN_SCREEN_CODE, + NS_SCREEN_VISIBLE_FRAME_CODE, + NS_WINDOW_TITLE_CODE, + NS_WINDOW_SET_TITLE_CODE, + NS_WINDOW_CONTENT_VIEW_CODE, + NS_WINDOW_SET_CONTENT_VIEW_CODE, + NS_OPENGL_CONTEXT_FLUSH_BUFFER_CODE, + NS_WINDOW_DELEGATE_CODE, + NS_WINDOW_SET_DELEGATE_CODE, + NS_WINDOW_IS_VISIBLE_CODE, + NS_WINDOW_SET_IS_VISIBLE_CODE, + NS_WINDOW_BACKGROUND_COLOR_CODE, + NS_WINDOW_SET_BACKGROUND_COLOR_CODE, + NS_WINDOW_IS_OPAQUE_CODE, + NS_WINDOW_SET_OPAQUE_CODE, + NS_WINDOW_ALPHA_VALUE_CODE, + NS_WINDOW_SET_ALPHA_VALUE_CODE, + NS_WINDOW_ACCEPTS_MOUSE_MOVED_EVENTS_CODE, + NS_WINDOW_SET_ACCEPTS_MOUSE_MOVED_EVENTS_CODE, + NS_GRAPHICS_CONTEXT_CURRENT_CONTEXT_CODE, + NS_MENU_ITEM_SET_SUBMENU_CODE, + NS_MENU_ITEM_TITLE_CODE, + NS_FRAME_CODE, + NS_WINDOW_INIT_CODE, + NS_WINDOW_ORDER_FRONT_CODE, + NS_WINDOW_MAKE_KEY_AND_ORDER_FRONT_CODE, + NS_WINDOW_MAKE_KEY_WINDOW_CODE, + NS_WINDOW_IS_KEY_WINDOW_CODE, + NS_WINDOW_CENTER_CODE, + NS_WINDOW_MAKE_MAIN_WINDOW_CODE, + NS_WINDOW_SET_FRAME_AND_DISPLAY_CODE, + NS_WINDOW_CONVERT_POINT_FROM_SCREEN_CODE, + NS_WINDOW_DISPLAY_CODE, + NS_VIEW_INIT_CODE, + NS_VIEW_INIT_WITH_FRAME_CODE, + NS_VIEW_ADD_SUBVIEW_CODE, + NS_VIEW_REGISTER_FOR_DRAGGED_TYPES_CODE, + NS_EVENT_TYPE_CODE, + NS_EVENT_LOCATION_IN_WINDOW_CODE, + NS_EVENT_MODIFIER_FLAGS_CODE, + NS_EVENT_KEY_CODE_CODE, + NS_EVENT_CHARACTERS_CODE, + NS_EVENT_DELTA_Y_CODE, + NS_EVENT_KEY_CODE_FOR_CHAR_CODE, + NS_EVENT_MOUSE_LOCATION_CODE, + NS_EVENT_WINDOW_CODE, + NS_DRAGGING_INFO_DRAGGING_PASTEBOARD_CODE, + NS_DRAGGING_INFO_DRAGGING_LOCATION_CODE, + NS_DRAGGING_INFO_NUMBER_OF_VALID_ITEMS_FOR_DROP_CODE, + NS_DRAGGING_INFO_SET_NUMBER_OF_VALID_ITEMS_FOR_DROP_CODE, + NS_DRAGGING_INFO_DRAGGING_DESTINATION_WINDOW_CODE, + NS_IMAGE_INIT_WITH_SIZE_CODE, + NS_IMAGE_INIT_WITH_DATA_CODE, + NS_IMAGE_INIT_WITH_FILE_CODE, + NS_IMAGE_INIT_WITH_CGIMAGE_CODE, + NS_IMAGE_ADD_REPRESENTATION_CODE, + NS_CURSOR_CURRENT_CURSOR_CODE, + NS_GRAPHICS_CONTEXT_SET_CURRENT_CONTEXT_CODE, + NS_CURSOR_IMAGE_CODE, + NS_CURSOR_HOT_SPOT_CODE, + NS_CURSOR_ARROW_CURSOR_CODE, + NS_CURSOR_INIT_WITH_IMAGE_CODE, + NS_CURSOR_HIDE_CODE, + NS_CURSOR_UNHIDE_CODE, + NS_CURSOR_POP_CODE, + NS_CURSOR_PUSH_CODE, + NS_CURSOR_SET_CODE, + NS_PASTEBOARD_GENERAL_PASTEBOARD_CODE, + NS_PASTEBOARD_STRING_FOR_TYPE_CODE, + NS_PASTEBOARD_DECLARE_TYPES_CODE, + NS_PASTEBOARD_SET_STRING_CODE, + NS_PASTEBOARD_READ_OBJECTS_FOR_CLASSES_CODE, + NS_MENU_INIT_CODE, + NS_MENU_ADD_ITEM_CODE, + NS_MENU_ITEM_SET_TITLE_CODE, + NS_MENU_ITEM_SUBMENU_CODE, + NS_MENU_ITEM_INIT_CODE, + NS_MENU_ITEM_ARRAY_CODE, + NS_MENU_ITEM_SEPARATOR_ITEM_CODE, + NS_OPENGL_PIXEL_FORMAT_INIT_WITH_ATTRIBUTES_CODE, + NS_OPENGL_VIEW_INIT_WITH_FRAME_CODE, + NS_OPENGL_VIEW_PREPARE_OPENGL_CODE, + NS_OPENGL_VIEW_OPENGL_CONTEXT_CODE, + NS_OPENGL_CONTEXT_SET_VALUES_CODE, + NS_OPENGL_CONTEXT_MAKE_CURRENT_CONTEXT_CODE, + NS_BITMAPIMAGEREP_BITMAP_CODE, + NS_BITMAPIMAGEREP_INIT_BITMAP_CODE, + NS_VIEW_SET_WANTSLAYER_CODE, + NS_STRING_WIDTH_UTF8_STRING_CODE, + NS_ARRAY_SI_ARRAY_CODE, + NS_STROKE_LINE_CODE, + NS_AUTO_RELEASE_POOL_INIT_CODE, + NS_DISTANT_FUTURE_CODE, + NS_RETAIN_CODE, + NS_ARRAY_COUNT_CODE, + NS_OBJECT_AT_INDEX_CODE, + NS_UTF8_STRING_CODE, + NS_TEXT_FIELD_STRING_VALUE_CODE, + NS_TEXT_FIELD_SET_STRING_VALUE_CODE, + NS_TEXT_FIELD_IS_BEZELED_CODE, + NS_TEXT_FIELD_SET_BEZELED_CODE, + NS_TEXT_FIELD_DRAWS_BACKGROUND_CODE, + NS_TEXT_FIELD_SET_DRAWS_BACKGROUND_CODE, + NS_TEXT_FIELD_IS_EDITABLE_CODE, + NS_TEXT_FIELD_SET_EDITABLE_CODE, + NS_TEXT_FIELD_IS_SELECTABLE_CODE, + NS_TEXT_FIELD_SET_SEDITABLE_CODE, + NS_TEXT_FIELD_TEXT_COLOR_CODE, + NS_TEXT_FIELD_SET_TEXT_COLOR_CODE, + NS_TEXT_FIELD_FONT_CODE, + NS_TEXT_FIELD_SET_FONT_CODE, + NS_TEXT_FIELD_INIT_FRAME_CODE, + NS_FONT_MANAGER_SHARED_FONT_MANAGER_CODE, + NS_FONT_MANAGER_CONVERT_FONT_CODE, + NS_FONT_MANAGER_CONVERT_FONT_TO_HAVE_CODE, + NS_PROCESS_INFO_PROCESS_INFO_CODE, + NS_PROCESS_INFO_PROCESS_NAME_CODE, + NS_SLIDER_SET_TARGET_CODE, + NS_SLIDER_TARGET_CODE, + NS_SLIDER_SET_ACTION_CODE, + NS_SLIDER_ACTION_CODE, + NS_SLIDER_SET_FONT_CODE, + NS_SLIDER_FONT_CODE, + NS_SLIDER_SET_DOUBLE_VALUE_CODE, + NS_SLIDER_DOUBLE_VALUE_CODE, + NS_SLIDER_SET_MAX_VALUE_CODE, + NS_SLIDER_MAX_VALUE_CODE, + NS_SLIDER_INIT_WITH_FRAME_CODE, + NS_PROGRESS_INDICATOR_SET_DOUBLE_VALUE_CODE, + NS_PROGRESS_INDICATOR_DOUBLE_VALUE_CODE, + NS_PROGRESS_INDICATOR_SET_MAX_VALUE_CODE, + NS_PROGRESS_INDICATOR_MAX_VALUE_CODE, + NS_PROGRESS_INDICATOR_SET_INDETERMINATE_CODE, + NS_PROGRESS_INDICATOR_INDETERMINATE_CODE, + NS_PROGRESS_INDICATOR_INIT_CODE, + NS_FONT_INIT_CODE, + NS_FONT_FONT_NAME_CODE, + NS_BUTTON_TITLE_CODE, + NS_BUTTON_SET_TITLE_CODE, + NS_BUTTON_BEZEL_STYLE_CODE, + NS_BUTTON_SET_BEZEL_STYLE_CODE, + NS_BUTTON_TARGET_CODE, + NS_BUTTON_SET_TARGET_CODE, + NS_BUTTON_ACTION_CODE, + NS_BUTTON_SET_ACTION_CODE, + NS_BUTTON_AUTO_RESIZE_MASK_CODE, + NS_BUTTON_SET_AUTO_RESIZE_MASK_CODE, + NS_BUTTON_STATE_CODE, + NS_BUTTON_SET_STATE_CODE, + NS_BUTTON_ALLOWS_MIXED_STATE_CODE, + NS_BUTTON_SET_ALLOWS_MIXED_STATE_CODE, + NS_BUTTON_INIT_WITH_FRAME_CODE, + NS_BUTTON_SET_BUTTON_TYPE_CODE, + NS_COMBOBOX_INDEX_OF_SELECTED_ITEM_CODE, + NS_COMBOBOX_TARGET_CODE, + NS_COMBOBOX_SET_TARGET_CODE, + NS_COMBOBOX_ACTION_CODE, + NS_COMBOBOX_SET_ACTION_CODE, + NS_COMBOBOX_FONT_CODE, + NS_COMBOBOX_SET_FONT_CODE, + NS_COMBOBOX_STRING_VALUE_CODE, + NS_COMBOBOX_SET_STRING_VALUE_CODE, + NS_COMBOBOX_IS_BEZELED_CODE, + NS_COMBOBOX_SET_IS_BEZELED_CODE, + NS_COMBOBOX_DRAWS_BACKGROUND_CODE, + NS_COMBOBOX_SET_DRAWS_BACKGROUND_CODE, + NS_COMBOBOX_IS_EDITABLE_CODE, + NS_COMBOBOX_SET_IS_EDITABLE_CODE, + NS_COMBOBOX_IS_SELECTABLE_CODE, + NS_COMBOBOX_SET_IS_SELECTABLE_CODE, + NS_COMBOBOX_TEXT_COLOR_CODE, + NS_COMBOBOX_SET_TEXT_COLOR_CODE, + NS_COMBOBOX_INIT_WITH_FRAME_CODE, + NS_COMBOBOX_ADD_ITEM_CODE, + NS_COMBOBOX_SELECT_ITEM_CODE, + NS_SAVE_PANEL_SET_CAN_CREATE_DIRECTORIES_CODE, + NS_SAVE_PANEL_CAN_CREATE_DIRECTORIES_CODE, + NS_SAVE_PANEL_SET_ALLOWED_FILE_TYPES_CODE, + NS_SAVE_PANEL_ALLOWED_FILE_TYPES_CODE, + NS_SAVE_PANEL_SET_DIRECTORY_URL_CODE, + NS_SAVE_PANEL_DIRECTORY_URL_CODE, + NS_SAVE_PANEL_SET_NAME_FIELD_STRING_VALUE_CODE, + NS_SAVE_PANEL_NAME_FIELD_STRING_VALUE_CODE, + NS_SAVE_PANEL_URL_CODE, + NS_SAVE_PANEL_RUN_MODAL_CODE, + NSURL_PATH_CODE, + NSURL_FILE_URL_WITH_PATH_CODE, + NS_AUTORELEASE_CODE, + NS_INIT_CODE, + NS_FONT_MANAGER_CONVERT_TO_HAVE_FONT_CODE, + NS_AUTO_RELEASE_POOL_DRAIN_CODE, + NS_OBJECT_FOR_KEY_CODE, + NS_INFO_DICTIONARY_CODE, + NS_INFO_MAIN_BUNDLE_CODE, +}; + +void* SI_NS_CLASSES[36] = {NULL}; +void* SI_NS_FUNCTIONS[227]; + +void si_initNS(void) { + SI_NS_CLASSES[NS_APPLICATION_CODE] = objc_getClass("NSApplication"); + SI_NS_CLASSES[NS_WINDOW_CODE] = objc_getClass("NSWindow"); + SI_NS_CLASSES[NS_ALLOC_CODE] = sel_registerName("alloc"); + SI_NS_CLASSES[NS_VALUE_CODE] = objc_getClass("NSValue"); + SI_NS_CLASSES[NS_EVENT_CODE] = objc_getClass("NSEvent"); + SI_NS_CLASSES[NS_DATE_CODE] = objc_getClass("NSDate"); + SI_NS_CLASSES[NS_VIEW_CODE] = objc_getClass("NSView"); + SI_NS_CLASSES[NS_OPENGL_VIEW_CODE] = objc_getClass("NSOpenGLView"); + SI_NS_CLASSES[NS_SCREEN_CODE] = objc_getClass("NSScreen"); + SI_NS_CLASSES[NS_COLOR_CODE] = objc_getClass("NSColor"); + SI_NS_CLASSES[NS_CURSOR_CODE] = objc_getClass("NSCursor"); + SI_NS_CLASSES[NS_PASTEBOARD_CODE] = objc_getClass("NSPasteboard"); + SI_NS_CLASSES[NS_STRING_CODE] = objc_getClass("NSString"); + SI_NS_CLASSES[NS_OPENGL_CONTEXT_CODE] = objc_getClass("NSOpenGLContext"); + SI_NS_CLASSES[NS_OPENGL_PF_CODE] = objc_getClass("NSOpenGLPixelFormat"); + SI_NS_CLASSES[NS_IMAGE_CODE] = objc_getClass("NSImage"); + SI_NS_CLASSES[NS_MENU_CODE] = objc_getClass("NSMenu"); + SI_NS_CLASSES[NS_MENUITEM_CODE] = objc_getClass("NSMenuItem"); + SI_NS_CLASSES[NS_DRAG_INFO_CODE] = objc_getClass("NSDraggingInfo"); + SI_NS_CLASSES[NS_IMAGE_REP_CODE] = objc_getClass("NSImageRep"); + SI_NS_CLASSES[NS_GRAPHICS_CONTEXT_CODE] = objc_getClass("NSGraphicsContext"); + SI_NS_CLASSES[NS_BITMAPIMAGEREP_CODE] = objc_getClass("NSBitmapImageRep"); + SI_NS_CLASSES[NS_BEZIER_PATH_CODE] = objc_getClass("NSBezierPath"); + SI_NS_CLASSES[NS_AUTO_RELEASE_POOL_CODE] = objc_getClass("NSAutoreleasePool"); + SI_NS_CLASSES[NS_ARRAY_CODE] = objc_getClass("NSArray"); + SI_NS_CLASSES[NS_SAVE_PANEL_CODE] = objc_getClass("NSSavePanel"); + SI_NS_CLASSES[NS_TEXT_FIELD_CODE] = objc_getClass("NSTextField"); + SI_NS_CLASSES[NS_FONT_MANAGER_CODE] = objc_getClass("NSFontManager"); + SI_NS_CLASSES[NS_PROCESS_INFO_CODE] = objc_getClass("NSProcessInfo"); + SI_NS_CLASSES[NS_FONT_CODE] = objc_getClass("NSFont"); + SI_NS_CLASSES[NS_BUTTON_CODE] = objc_getClass("NSButton"); + SI_NS_CLASSES[NS_COMBOBOX_CODE] = objc_getClass("NSComboBox"); + SI_NS_CLASSES[NS_PROGRESS_INDICATOR_CODE] = objc_getClass("NSProgressIndicator"); + SI_NS_CLASSES[NS_SLIDER_CODE] = objc_getClass("NSSlider"); + SI_NS_CLASSES[NS_URL_CODE] = objc_getClass("NSURL"); + SI_NS_CLASSES[NS_BUNDLE_CODE] = objc_getClass("NSBundle"); + + SI_NS_FUNCTIONS[NS_APPLICATION_SET_ACTIVATION_POLICY_CODE] = sel_getUid("setActivationPolicy:"); + SI_NS_FUNCTIONS[NS_APPLICATION_SAPP_CODE] = sel_getUid("sharedApplication"); + SI_NS_FUNCTIONS[NS_APPLICATION_RUN_CODE] = sel_registerName("run"); + SI_NS_FUNCTIONS[NS_APPLICATION_FL_CODE] = sel_getUid("finishLaunching"); + SI_NS_FUNCTIONS[NS_WINDOW_INITR_CODE] = sel_registerName("initWithContentRect:styleMask:backing:defer:"); + SI_NS_FUNCTIONS[NS_WINDOW_MAKEKO_CODE] = sel_getUid("makeKeyAndOrderFront:"); + SI_NS_FUNCTIONS[NS_WINDOW_MAKEOF_CODE] = sel_getUid("orderFront:"); + SI_NS_FUNCTIONS[NS_VALUE_RECT_CODE] = sel_registerName("valueWithRect:"); + SI_NS_FUNCTIONS[NS_RELEASE_CODE] = sel_registerName("release"); + SI_NS_FUNCTIONS[NS_OPENGL_FB_CODE] = sel_getUid("flushBuffer"); + SI_NS_FUNCTIONS[NS_COLOR_CLEAR_CODE] = sel_getUid("clearColor"); + SI_NS_FUNCTIONS[NS_COLOR_KEYBOARD_FOCUS_INDICATOR_CODE] = sel_getUid("keyboardFocusIndicatorColor"); + SI_NS_FUNCTIONS[NS_COLOR_SET_CODE] = sel_getUid("set:"); + SI_NS_FUNCTIONS[NS_COLOR_WITH_RGB_CODE] = sel_getUid("colorWithRed:green:blue:alpha:"); + SI_NS_FUNCTIONS[NS_COLOR_WITH_SRGB_CODE] = sel_getUid("colorWithSRGBRed:green:blue:alpha:"); + SI_NS_FUNCTIONS[NS_COLOR_WITH_CALIBRATED_CODE] = sel_getUid("colorWithCalibratedWhite:alpha:"); + SI_NS_FUNCTIONS[NS_APPLICATION_MAIN_MENU_CODE] = sel_getUid("mainMenu"); + SI_NS_FUNCTIONS[NS_APPLICATION_SET_MAIN_MENU_CODE] = sel_getUid("setMainMenu:"); + SI_NS_FUNCTIONS[NS_APPLICATION_SERVICES_MENU_CODE] = sel_getUid("servicesMenu"); + SI_NS_FUNCTIONS[NS_APPLICATION_SET_SERVICES_MENU_CODE] = sel_getUid("setServicesMenu:"); + SI_NS_FUNCTIONS[NS_APPLICATION_HELP_MENU_CODE] = sel_getUid("helpMenu"); + SI_NS_FUNCTIONS[NS_APPLICATION_SET_HELP_MENU_CODE] = sel_getUid("setHelpMenu:"); + SI_NS_FUNCTIONS[NS_APPLICATION_WINDOWS_MENU_CODE] = sel_getUid("windowsMenu"); + SI_NS_FUNCTIONS[NS_APPLICATION_SET_WINDOWS_MENU_CODE] = sel_getUid("setWindowsMenu:"); + SI_NS_FUNCTIONS[NS_WINDOW_DELEGATE_CODE] = sel_getUid("delegate"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_DELEGATE_CODE] = sel_getUid("setDelegate:"); + SI_NS_FUNCTIONS[NS_WINDOW_IS_VISIBLE_CODE] = sel_getUid("isVisible"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_IS_VISIBLE_CODE] = sel_getUid("setIsVisible:"); + SI_NS_FUNCTIONS[NS_WINDOW_BACKGROUND_COLOR_CODE] = sel_getUid("backgroundColor"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_BACKGROUND_COLOR_CODE] = sel_getUid("setBackgroundColor:"); + SI_NS_FUNCTIONS[NS_WINDOW_IS_OPAQUE_CODE] = sel_getUid("isOpaque"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_OPAQUE_CODE] = sel_getUid("setOpaque:"); + SI_NS_FUNCTIONS[NS_WINDOW_ALPHA_VALUE_CODE] = sel_getUid("alphaValue"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_ALPHA_VALUE_CODE] = sel_getUid("setAlphaValue:"); + SI_NS_FUNCTIONS[NS_WINDOW_ACCEPTS_MOUSE_MOVED_EVENTS_CODE] = sel_getUid("acceptsMouseMovedEvents"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_ACCEPTS_MOUSE_MOVED_EVENTS_CODE] = sel_getUid("setAcceptsMouseMovedEvents:"); + SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_CURRENT_CONTEXT_CODE] = sel_getUid("currentContext"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_SET_SUBMENU_CODE] = sel_getUid("setSubmenu:"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_TITLE_CODE] = sel_getUid("title"); + SI_NS_FUNCTIONS[NS_WINDOW_INIT_CODE] = sel_getUid("initWithContentRect:styleMask:backing:defer:"); + SI_NS_FUNCTIONS[NS_WINDOW_ORDER_FRONT_CODE] = sel_getUid("orderFront:"); + SI_NS_FUNCTIONS[NS_WINDOW_MAKE_KEY_AND_ORDER_FRONT_CODE] = sel_getUid("makeKeyAndOrderFront:"); + SI_NS_FUNCTIONS[NS_WINDOW_MAKE_KEY_WINDOW_CODE] = sel_getUid("makeKeyWindow"); + SI_NS_FUNCTIONS[NS_WINDOW_IS_KEY_WINDOW_CODE] = sel_getUid("isKeyWindow"); + SI_NS_FUNCTIONS[NS_WINDOW_CENTER_CODE] = sel_getUid("center"); + SI_NS_FUNCTIONS[NS_WINDOW_MAKE_MAIN_WINDOW_CODE] = sel_getUid("makeMainWindow"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_FRAME_AND_DISPLAY_CODE] = sel_getUid("setFrame:display:animate:"); + SI_NS_FUNCTIONS[NS_WINDOW_CONVERT_POINT_FROM_SCREEN_CODE] = sel_getUid("convertPointFromScreen:"); + SI_NS_FUNCTIONS[NS_WINDOW_DISPLAY_CODE] = sel_getUid("display"); + SI_NS_FUNCTIONS[NS_VIEW_INIT_CODE] = sel_getUid("init"); + SI_NS_FUNCTIONS[NS_VIEW_INIT_WITH_FRAME_CODE] = sel_getUid("initWithFrame:"); + SI_NS_FUNCTIONS[NS_VIEW_ADD_SUBVIEW_CODE] = sel_getUid("addSubview:"); + SI_NS_FUNCTIONS[NS_VIEW_REGISTER_FOR_DRAGGED_TYPES_CODE] = sel_getUid("registerForDraggedTypes:"); + SI_NS_FUNCTIONS[NS_EVENT_TYPE_CODE] = sel_getUid("type"); + SI_NS_FUNCTIONS[NS_EVENT_LOCATION_IN_WINDOW_CODE] = sel_getUid("locationInWindow"); + SI_NS_FUNCTIONS[NS_EVENT_MODIFIER_FLAGS_CODE] = sel_getUid("modifierFlags"); + SI_NS_FUNCTIONS[NS_EVENT_KEY_CODE_CODE] = sel_getUid("keyCode"); + SI_NS_FUNCTIONS[NS_EVENT_CHARACTERS_CODE] = sel_getUid("characters"); + SI_NS_FUNCTIONS[NS_EVENT_DELTA_Y_CODE] = sel_getUid("deltaY"); + SI_NS_FUNCTIONS[NS_EVENT_KEY_CODE_FOR_CHAR_CODE] = sel_getUid("keyCodeForChar:"); + SI_NS_FUNCTIONS[NS_EVENT_MOUSE_LOCATION_CODE] = sel_getUid("mouseLocation"); + SI_NS_FUNCTIONS[NS_EVENT_WINDOW_CODE] = sel_getUid("window"); + SI_NS_FUNCTIONS[NS_DRAGGING_INFO_DRAGGING_PASTEBOARD_CODE] = sel_getUid("draggingPasteboard"); + SI_NS_FUNCTIONS[NS_DRAGGING_INFO_DRAGGING_LOCATION_CODE] = sel_getUid("draggingLocation"); + SI_NS_FUNCTIONS[NS_DRAGGING_INFO_NUMBER_OF_VALID_ITEMS_FOR_DROP_CODE] = sel_getUid("numberOfValidItemsForDrop"); + SI_NS_FUNCTIONS[NS_DRAGGING_INFO_SET_NUMBER_OF_VALID_ITEMS_FOR_DROP_CODE] = sel_getUid("setNumberOfValidItemsForDrop:"); + SI_NS_FUNCTIONS[NS_DRAGGING_INFO_DRAGGING_DESTINATION_WINDOW_CODE] = sel_getUid("draggingDestinationWindow"); + SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_SIZE_CODE] = sel_getUid("initWithSize:"); + SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_DATA_CODE] = sel_getUid("initWithData:"); + SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_FILE_CODE] = sel_getUid("initWithFile:"); + SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_CGIMAGE_CODE] = sel_getUid("initWithCGImage:size:"); + SI_NS_FUNCTIONS[NS_IMAGE_ADD_REPRESENTATION_CODE] = sel_getUid("addRepresentation:"); + SI_NS_FUNCTIONS[NS_CURSOR_CURRENT_CURSOR_CODE] = sel_getUid("currentCursor"); + SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_SET_CURRENT_CONTEXT_CODE] = sel_getUid("setCurrentContext:"); + SI_NS_FUNCTIONS[NS_CURSOR_IMAGE_CODE] = sel_getUid("image"); + SI_NS_FUNCTIONS[NS_CURSOR_HOT_SPOT_CODE] = sel_getUid("hotSpot"); + SI_NS_FUNCTIONS[NS_CURSOR_ARROW_CURSOR_CODE] = sel_getUid("arrowCursor"); + SI_NS_FUNCTIONS[NS_CURSOR_INIT_WITH_IMAGE_CODE] = sel_getUid("initWithImage:hotSpot:"); + SI_NS_FUNCTIONS[NS_CURSOR_HIDE_CODE] = sel_getUid("hide"); + SI_NS_FUNCTIONS[NS_CURSOR_UNHIDE_CODE] = sel_getUid("unhide"); + SI_NS_FUNCTIONS[NS_CURSOR_POP_CODE] = sel_getUid("pop"); + SI_NS_FUNCTIONS[NS_CURSOR_PUSH_CODE] = sel_getUid("push"); + SI_NS_FUNCTIONS[NS_CURSOR_SET_CODE] = sel_getUid("set"); + SI_NS_FUNCTIONS[NS_PASTEBOARD_GENERAL_PASTEBOARD_CODE] = sel_getUid("generalPasteboard"); + SI_NS_FUNCTIONS[NS_PASTEBOARD_STRING_FOR_TYPE_CODE] = sel_getUid("stringForType:"); + SI_NS_FUNCTIONS[NS_PASTEBOARD_DECLARE_TYPES_CODE] = sel_getUid("declareTypes:owner:"); + SI_NS_FUNCTIONS[NS_PASTEBOARD_SET_STRING_CODE] = sel_getUid("setString:forType:"); + SI_NS_FUNCTIONS[NS_PASTEBOARD_READ_OBJECTS_FOR_CLASSES_CODE] = sel_getUid("readObjectsForClasses:options:"); + SI_NS_FUNCTIONS[NS_MENU_INIT_CODE] = sel_getUid("initWithTitle:"); + SI_NS_FUNCTIONS[NS_MENU_ADD_ITEM_CODE] = sel_getUid("addItem:"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_SET_TITLE_CODE] = sel_getUid("setTitle:"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_TITLE_CODE] = sel_getUid("setTitle:"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_SUBMENU_CODE] = sel_getUid("submenu"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_INIT_CODE] = sel_getUid("initWithTitle:action:keyEquivalent:"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_ARRAY_CODE] = sel_getUid("itemArray"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_SEPARATOR_ITEM_CODE] = sel_getUid("separatorItem"); + SI_NS_FUNCTIONS[NS_OPENGL_PIXEL_FORMAT_INIT_WITH_ATTRIBUTES_CODE] = sel_getUid("initWithAttributes:"); + SI_NS_FUNCTIONS[NS_OPENGL_VIEW_INIT_WITH_FRAME_CODE] = sel_getUid("initWithFrame:pixelFormat:"); + SI_NS_FUNCTIONS[NS_OPENGL_VIEW_PREPARE_OPENGL_CODE] = sel_getUid("prepareOpenGL"); + SI_NS_FUNCTIONS[NS_OPENGL_VIEW_OPENGL_CONTEXT_CODE] = sel_getUid("openGLContext"); + SI_NS_FUNCTIONS[NS_OPENGL_CONTEXT_SET_VALUES_CODE] = sel_getUid("setValues:forParameter:"); + SI_NS_FUNCTIONS[NS_OPENGL_CONTEXT_MAKE_CURRENT_CONTEXT_CODE] = sel_getUid("makeCurrentContext"); + SI_NS_FUNCTIONS[NS_BITMAPIMAGEREP_BITMAP_CODE] = sel_getUid("bitmapData"); + SI_NS_FUNCTIONS[NS_BITMAPIMAGEREP_INIT_BITMAP_CODE] = sel_getUid("initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:"); + SI_NS_FUNCTIONS[NS_VIEW_SET_WANTSLAYER_CODE] = sel_getUid("setWantsLayer:"); + SI_NS_FUNCTIONS[NS_STRING_WIDTH_UTF8_STRING_CODE] = sel_getUid("stringWithUTF8String:"); + SI_NS_FUNCTIONS[NS_ARRAY_SI_ARRAY_CODE] = sel_getUid("initWithObjects:count:"); + SI_NS_FUNCTIONS[NS_WINDOW_SET_CONTENT_VIEW_CODE] = sel_getUid("setContentView:"); + SI_NS_FUNCTIONS[NS_APPLICATION_NEXT_EVENT_MATCHING_MASK_CODE] = sel_getUid("nextEventMatchingMask:untilDate:inMode:dequeue:"); + SI_NS_FUNCTIONS[NS_APPLICATION_SEND_EVENT_CODE] = sel_getUid("sendEvent:"); + SI_NS_FUNCTIONS[NS_APPLICATION_UPDATE_WINDOWS_CODE] = sel_getUid("updateWindows"); + SI_NS_FUNCTIONS[NS_OPENGL_CONTEXT_FLUSH_BUFFER_CODE] = sel_getUid("flushBuffer"); + SI_NS_FUNCTIONS[NS_APPLICATION_TERMINATE_CODE] = sel_getUid("terminate:"); + SI_NS_FUNCTIONS[NS_STROKE_LINE_CODE] = sel_getUid("strokeLine:"); + SI_NS_FUNCTIONS[NS_AUTO_RELEASE_POOL_INIT_CODE] = sel_getUid("init"); + SI_NS_FUNCTIONS[NS_DISTANT_FUTURE_CODE] = sel_getUid("distantFuture"); + SI_NS_FUNCTIONS[NS_FRAME_CODE] = sel_getUid("frame"); + SI_NS_FUNCTIONS[NS_SCREEN_MAIN_SCREEN_CODE] = sel_getUid("mainScreen"); + SI_NS_FUNCTIONS[NS_RETAIN_CODE] = sel_getUid("retain"); + SI_NS_FUNCTIONS[NS_ARRAY_COUNT_CODE] = sel_getUid("count"); + SI_NS_FUNCTIONS[NS_OBJECT_AT_INDEX_CODE] = sel_getUid("objectAtIndex:"); + SI_NS_FUNCTIONS[NS_UTF8_STRING_CODE] = sel_getUid("UTF8String"); + SI_NS_FUNCTIONS[NS_SCREEN_VISIBLE_FRAME_CODE] = sel_getUid("visibleFrame"); + SI_NS_FUNCTIONS[NS_WINDOW_TITLE_CODE] = sel_getUid("title"); + SI_NS_FUNCTIONS[NS_WINDOW_CONTENT_VIEW_CODE] = sel_getUid("contentView"); + SI_NS_FUNCTIONS[NS_APPLICATION_ACTIVATE_IGNORING_OTHER_APPS_CODE] = sel_getUid("activateIgnoringOtherApps:"); + SI_NS_FUNCTIONS[NS_APPLICATION_STOP_CODE] = sel_getUid("stop:"); + SI_NS_FUNCTIONS[NS_APPLICATION_APPLICATION_ICON_IMAGE_CODE] = sel_getUid("applicationIconImage"); + SI_NS_FUNCTIONS[NS_APPLICATION_SET_APPLICATION_ICON_IMAGE_CODE] = sel_getUid("setApplicationIconImage:"); + SI_NS_FUNCTIONS[NS_APPLICATION_ACTIVATION_POLICY_CODE] = sel_getUid("activationPolicy"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_STRING_VALUE_CODE] = sel_getUid("stringValue"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_STRING_VALUE_CODE] = sel_getUid("setStringValue:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_IS_BEZELED_CODE] = sel_getUid("isBezeled"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_BEZELED_CODE] = sel_getUid("setBezeled:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_DRAWS_BACKGROUND_CODE] = sel_getUid("drawsBackground"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_DRAWS_BACKGROUND_CODE] = sel_getUid("setDrawsBackground:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_IS_EDITABLE_CODE] = sel_getUid("isEditable"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_EDITABLE_CODE] = sel_getUid("setEditable:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_IS_SELECTABLE_CODE] = sel_getUid("isSelectable"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_SEDITABLE_CODE] = sel_getUid("setSelectable:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_TEXT_COLOR_CODE] = sel_getUid("textColor"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_TEXT_COLOR_CODE] = sel_getUid("setTextColor:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_FONT_CODE] = sel_getUid("font"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_FONT_CODE] = sel_getUid("setFont:"); + SI_NS_FUNCTIONS[NS_TEXT_FIELD_INIT_FRAME_CODE] = sel_getUid("initWithFrame:"); + SI_NS_FUNCTIONS[NS_FONT_MANAGER_SHARED_FONT_MANAGER_CODE] = sel_getUid("sharedFontManager"); + SI_NS_FUNCTIONS[NS_FONT_MANAGER_CONVERT_FONT_CODE] = sel_getUid("convertFont:"); + SI_NS_FUNCTIONS[NS_FONT_MANAGER_CONVERT_TO_HAVE_FONT_CODE] = sel_getUid("convertFont:toHaveTrait:"); + SI_NS_FUNCTIONS[NS_PROCESS_INFO_PROCESS_INFO_CODE] = sel_getUid("processInfo"); + SI_NS_FUNCTIONS[NS_PROCESS_INFO_PROCESS_NAME_CODE] = sel_getUid("processName"); + SI_NS_FUNCTIONS[NS_SLIDER_SET_TARGET_CODE] = sel_getUid("setTarget:"); + SI_NS_FUNCTIONS[NS_SLIDER_TARGET_CODE] = sel_getUid("target"); + SI_NS_FUNCTIONS[NS_SLIDER_SET_ACTION_CODE] = sel_getUid("setAction:"); + SI_NS_FUNCTIONS[NS_SLIDER_ACTION_CODE] = sel_getUid("action"); + SI_NS_FUNCTIONS[NS_SLIDER_SET_FONT_CODE] = sel_getUid("setFont:"); + SI_NS_FUNCTIONS[NS_SLIDER_FONT_CODE] = sel_getUid("font"); + SI_NS_FUNCTIONS[NS_SLIDER_SET_DOUBLE_VALUE_CODE] = sel_getUid("setDoubleValue:"); + SI_NS_FUNCTIONS[NS_SLIDER_DOUBLE_VALUE_CODE] = sel_getUid("doubleValue"); + SI_NS_FUNCTIONS[NS_SLIDER_SET_MAX_VALUE_CODE] = sel_getUid("setMaxValue:"); + SI_NS_FUNCTIONS[NS_SLIDER_MAX_VALUE_CODE] = sel_getUid("maxValue"); + SI_NS_FUNCTIONS[NS_SLIDER_INIT_WITH_FRAME_CODE] = sel_getUid("initWithFrame:"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_SET_DOUBLE_VALUE_CODE] = sel_getUid("setDoubleValue:"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_DOUBLE_VALUE_CODE] = sel_getUid("doubleValue"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_SET_MAX_VALUE_CODE] = sel_getUid("setMaxValue:"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_MAX_VALUE_CODE] = sel_getUid("maxValue"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_SET_INDETERMINATE_CODE] = sel_getUid("setIndeterminate:"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_INDETERMINATE_CODE] = sel_getUid("isIndeterminate"); + SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_INIT_CODE] = sel_getUid("initWithFrame:"); + SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_CURRENT_CONTEXT_CODE] = sel_getUid("currentContext"); + SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_SET_CURRENT_CONTEXT_CODE] = sel_getUid("setCurrentContext:"); + SI_NS_FUNCTIONS[NS_MENU_ITEM_SET_TITLE_CODE] = sel_getUid("setTitle:"); + SI_NS_FUNCTIONS[NS_FONT_INIT_CODE] = sel_getUid("fontWithName:size:"); + SI_NS_FUNCTIONS[NS_FONT_FONT_NAME_CODE] = sel_getUid("fontName"); + SI_NS_FUNCTIONS[NS_BUTTON_TITLE_CODE] = sel_getUid("title"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_TITLE_CODE] = sel_getUid("setTitle:"); + SI_NS_FUNCTIONS[NS_BUTTON_BEZEL_STYLE_CODE] = sel_getUid("bezelStyle"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_BEZEL_STYLE_CODE] = sel_getUid("setBezelStyle:"); + SI_NS_FUNCTIONS[NS_BUTTON_TARGET_CODE] = sel_getUid("target"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_TARGET_CODE] = sel_getUid("setTarget:"); + SI_NS_FUNCTIONS[NS_BUTTON_ACTION_CODE] = sel_getUid("action"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_ACTION_CODE] = sel_getUid("setAction:"); + SI_NS_FUNCTIONS[NS_BUTTON_AUTO_RESIZE_MASK_CODE] = sel_getUid("autoresizingMask"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_AUTO_RESIZE_MASK_CODE] = sel_getUid("setAutoresizingMask:"); + SI_NS_FUNCTIONS[NS_BUTTON_STATE_CODE] = sel_getUid("state"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_STATE_CODE] = sel_getUid("setState:"); + SI_NS_FUNCTIONS[NS_BUTTON_ALLOWS_MIXED_STATE_CODE] = sel_getUid("allowsMixedState"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_ALLOWS_MIXED_STATE_CODE] = sel_getUid("setAllowsMixedState:"); + SI_NS_FUNCTIONS[NS_BUTTON_INIT_WITH_FRAME_CODE] = sel_getUid("initWithFrame:"); + SI_NS_FUNCTIONS[NS_BUTTON_SET_BUTTON_TYPE_CODE] = sel_getUid("setButtonType:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_INDEX_OF_SELECTED_ITEM_CODE] = sel_getUid("indexOfSelectedItem"); + SI_NS_FUNCTIONS[NS_COMBOBOX_TARGET_CODE] = sel_getUid("target"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_TARGET_CODE] = sel_getUid("setTarget:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_ACTION_CODE] = sel_getUid("action"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_ACTION_CODE] = sel_getUid("setAction:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_FONT_CODE] = sel_getUid("font"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_FONT_CODE] = sel_getUid("setFont:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_STRING_VALUE_CODE] = sel_getUid("stringValue"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_STRING_VALUE_CODE] = sel_getUid("setStringValue:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_IS_BEZELED_CODE] = sel_getUid("isBezeled"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_IS_BEZELED_CODE] = sel_getUid("setBezeled:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_DRAWS_BACKGROUND_CODE] = sel_getUid("drawsBackground"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_DRAWS_BACKGROUND_CODE] = sel_getUid("setDrawsBackground:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_IS_EDITABLE_CODE] = sel_getUid("isEditable"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_IS_EDITABLE_CODE] = sel_getUid("setEditable:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_IS_SELECTABLE_CODE] = sel_getUid("isSelectable"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_IS_SELECTABLE_CODE] = sel_getUid("setSelectable:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_TEXT_COLOR_CODE] = sel_getUid("textColor"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SET_TEXT_COLOR_CODE] = sel_getUid("setTextColor:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_INIT_WITH_FRAME_CODE] = sel_getUid("initWithFrame:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_ADD_ITEM_CODE] = sel_getUid("addItemWithObjectValue:"); + SI_NS_FUNCTIONS[NS_COMBOBOX_SELECT_ITEM_CODE] = sel_getUid("selectItemAtIndex:"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_CAN_CREATE_DIRECTORIES_CODE] = sel_getUid("setCanCreateDirectories:"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_CAN_CREATE_DIRECTORIES_CODE] = sel_getUid("canCreateDirectories"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_ALLOWED_FILE_TYPES_CODE] = sel_getUid("setAllowedFileTypes:"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_ALLOWED_FILE_TYPES_CODE] = sel_getUid("allowedFileTypes"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_DIRECTORY_URL_CODE] = sel_getUid("setDirectoryURL:"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_DIRECTORY_URL_CODE] = sel_getUid("directoryURL"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_NAME_FIELD_STRING_VALUE_CODE] = sel_getUid("setNameFieldStringValue:"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_NAME_FIELD_STRING_VALUE_CODE] = sel_getUid("nameFieldStringValue"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_URL_CODE] = sel_getUid("URL"); + SI_NS_FUNCTIONS[NS_SAVE_PANEL_RUN_MODAL_CODE] = sel_getUid("runModal"); + SI_NS_FUNCTIONS[NSURL_PATH_CODE] = sel_getUid("path"); + SI_NS_FUNCTIONS[NSURL_FILE_URL_WITH_PATH_CODE] = sel_getUid("fileURLWithPath:"); + SI_NS_FUNCTIONS[NS_AUTORELEASE_CODE] = sel_getUid("autorelease"); + SI_NS_FUNCTIONS[NS_INIT_CODE] = sel_getUid("init"); + SI_NS_FUNCTIONS[NS_AUTO_RELEASE_POOL_DRAIN_CODE] = sel_getUid("drain"); + SI_NS_FUNCTIONS[NS_OBJECT_FOR_KEY_CODE] = sel_getUid("objectForKey:"); + SI_NS_FUNCTIONS[NS_INFO_DICTIONARY_CODE] = sel_getUid("infoDictionary"); + SI_NS_FUNCTIONS[NS_INFO_MAIN_BUNDLE_CODE] = sel_getUid("mainBundle"); +} + +void si_impl_func_to_SEL_with_name(const char* class_name, const char* register_name, void* function) { + Class selected_class; + + if (strcmp(class_name, "NSView") == 0) { + selected_class = objc_getClass("ViewClass"); + } + else if (strcmp(class_name, "NSWindow") == 0) { + selected_class = objc_getClass("WindowClass"); + } + else { + selected_class = objc_getClass(class_name); + } + + class_addMethod(selected_class, sel_registerName(register_name), (IMP)function, 0); +} + +NSRect NSMakeRect(double x, double y, double width, double height) { + NSRect r; + r.origin.x = x; + r.origin.y = y; + r.size.width = width; + r.size.height = height; + + return r; +} + +NSPoint NSMakePoint(double x, double y) { + NSPoint point; + point.x = x; + point.y = y; + return point; +} + +NSSize NSMakeSize(double w, double h) { + NSSize size; + size.width = w; + size.height = h; + return size; +} + +double NSMaxX(NSRect aRect) { return aRect.origin.x + aRect.size.width; } + +double NSMaxY(NSRect aRect) { return aRect.origin.y + aRect.size.height; } +double NSMidX(NSRect aRect) { return aRect.origin.x + (aRect.size.width / 2); } +double NSMidY(NSRect aRect) { return aRect.origin.y + (aRect.size.height / 2); } +double NSMinX(NSRect aRect) { return aRect.origin.x; } +double NSMinY(NSRect aRect) { return aRect.origin.y; } +double NSWidth(NSRect aRect) { return aRect.size.width; } +double NSHeight(NSRect aRect) { return aRect.size.height; } + +NSRect NSRectFromCGRect(CGRect cgrect) { + NSRect nsrect; + nsrect.origin = NSPointFromCGPoint(cgrect.origin); + nsrect.size = NSSizeFromCGSize(cgrect.size); + return nsrect; +} + +CGRect NSRectToCGRect(NSRect nsrect) { + union _ {NSRect ns; CGRect cg;}; + return ((union _ *)&nsrect)->cg; +} + +NSPoint NSPointFromCGPoint(CGPoint cgpoint) { return NSMakePoint(cgpoint.x, cgpoint.y); } +CGPoint NSPointToCGPoint(NSPoint nspoint) { return CGPointMake(nspoint.x, nspoint.y); } + +NSSize NSSizeFromCGSize(CGSize cgsize) { return NSMakeSize(cgsize.width, cgsize.height); } +CGSize NSSizeToCGSize(NSSize nssize) { return CGSizeMake(nssize.width, nssize.height); } + +bool NSPointInRect(NSPoint aPoint, NSRect aRect) { + return (aPoint.x >= aRect.origin.x && aPoint.x <= NSMaxX(aRect) && + aPoint.y >= aRect.origin.y && aPoint.y <= NSMaxY(aRect)); +} + +NSColor* NSColor_clearColor(void) { + void* nsclass = SI_NS_CLASSES[NS_COLOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_COLOR_CLEAR_CODE]; + return (NSColor*)objc_func(nsclass, func); +} + +NSColor* NSColor_keyboardFocusIndicatorColor(void) { + void* nsclass = SI_NS_CLASSES[NS_COLOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_COLOR_KEYBOARD_FOCUS_INDICATOR_CODE]; + return (NSColor*)objc_func(nsclass, func); +} + +void NSColor_set(NSColor* color) { + void* nsclass = SI_NS_CLASSES[NS_COLOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_COLOR_SET_CODE]; + objc_func(nsclass, func, color); +} + +NSColor* NSColor_colorWithRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { + void* nsclass = SI_NS_CLASSES[NS_COLOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_COLOR_WITH_RGB_CODE]; + return (NSColor*)objc_func(nsclass, func, red, green, blue, alpha); +} + +NSColor* NSColor_colorWithSRGB(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha) { + void* nsclass = SI_NS_CLASSES[NS_COLOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_COLOR_WITH_SRGB_CODE]; + return (NSColor*)objc_func(nsclass, func, red, green, blue, alpha); +} + +NSColor* NSColor_colorWithCalibrated(CGFloat white, CGFloat alpha) { + void* nsclass = SI_NS_CLASSES[NS_COLOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_COLOR_WITH_CALIBRATED_CODE]; + return (NSColor*)objc_func(nsclass, func, white, alpha); +} + +void NSBezierPath_strokeLine(NSPoint from, NSPoint to) { + void* nsclass = SI_NS_CLASSES[NS_BEZIER_PATH_CODE]; + void* func = SI_NS_FUNCTIONS[NS_STROKE_LINE_CODE]; + + objc_func(nsclass, func, from, to); +} + +NSAutoreleasePool* NSAutoreleasePool_init(void) { + void* nsclass = SI_NS_CLASSES[NS_AUTO_RELEASE_POOL_CODE]; + void* func = SI_NS_FUNCTIONS[NS_AUTO_RELEASE_POOL_INIT_CODE]; + + return objc_func(NSAlloc(nsclass), func); +} + +void NSAutoreleasePool_drain(NSAutoreleasePool* pool) { + void* func = SI_NS_FUNCTIONS[NS_AUTO_RELEASE_POOL_DRAIN_CODE]; + + objc_func(pool, func); +} + +SICDEF NSDate* NSDate_distantFuture(void) { + void* nsclass = SI_NS_CLASSES[NS_DATE_CODE]; + void* func = SI_NS_FUNCTIONS[NS_DISTANT_FUTURE_CODE]; + + return objc_func(nsclass, func); +} + +NSProcessInfo* NSProcessInfo_processInfo(void) { + void* nsclass = SI_NS_CLASSES[NS_PROCESS_INFO_CODE]; + void* func = SI_NS_FUNCTIONS[NS_PROCESS_INFO_PROCESS_INFO_CODE]; + + return objc_func(nsclass, func); +} + +const char* NSProcessInfo_processName(NSProcessInfo* processInfo) { + void* func = SI_NS_FUNCTIONS[NS_PROCESS_INFO_PROCESS_NAME_CODE]; + + return NSString_to_char(objc_func(processInfo, func)); +} + +NSApplication* NSApplication_sharedApplication(void) { + if (SI_NS_CLASSES[0] == NULL) + si_initNS(); + + void* nsclass = SI_NS_CLASSES[NS_APPLICATION_CODE]; + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SAPP_CODE]; + + return objc_func(nsclass, func); +} + +NSMenu* NSApplication_mainMenu(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_MAIN_MENU_CODE]; + return (NSMenu*)objc_func(application, func); +} + +void NSApplication_setMainMenu(NSApplication* application, NSMenu* mainMenu) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SET_MAIN_MENU_CODE]; + objc_func(application, func, mainMenu); +} + +NSMenu* NSApplication_servicesMenu(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SERVICES_MENU_CODE]; + return (NSMenu*)objc_func(application, func); +} + +void NSApplication_setServicesMenu(NSApplication* application, NSMenu* servicesMenu) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SET_SERVICES_MENU_CODE]; + objc_func(application, func, servicesMenu); +} + +NSMenu* NSApplication_helpMenu(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_HELP_MENU_CODE]; + return (NSMenu*)objc_func(application, func); +} + +void NSApplication_setHelpMenu(NSApplication* application, NSMenu* helpMenu) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SET_HELP_MENU_CODE]; + objc_func(application, func, helpMenu); +} + +NSMenu* NSApplication_windowsMenu(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_WINDOWS_MENU_CODE]; + return (NSMenu*)objc_func(application, func); +} + +void NSApplication_setWindowsMenu(NSApplication* application, NSMenu* windowsMenu) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SET_WINDOWS_MENU_CODE]; + objc_func(application, func, windowsMenu); +} + +NSApplicationActivationPolicy NSApplication_activationPolicy(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_ACTIVATION_POLICY_CODE]; + return (NSApplicationActivationPolicy)(intptr_t)objc_func(application, func); +} + +NSImage* NSApplication_applicationIconImage(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_APPLICATION_ICON_IMAGE_CODE]; + return (NSImage*)objc_func(application, func); +} + +void NSApplication_setApplicationIconImage(NSApplication* application, NSImage* applicationIconImage) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SET_APPLICATION_ICON_IMAGE_CODE]; + objc_func(application, func, applicationIconImage); +} + +void NSApplication_stop(NSApplication* application, void* view) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_STOP_CODE]; + objc_func(application, func, view); +} + +void NSApplication_terminate(NSApplication* application, id sender) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_TERMINATE_CODE]; + objc_func(application, func, sender); +} + +void NSApplication_sendEvent(NSApplication* application, NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_SEND_EVENT_CODE]; + objc_func(application, func, event); +} + +void NSApplication_updateWindows(NSApplication* application) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_UPDATE_WINDOWS_CODE]; + objc_func(application, func); +} + +void NSApplication_activateIgnoringOtherApps(NSApplication* application, bool flag) { + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_ACTIVATE_IGNORING_OTHER_APPS_CODE]; + objc_func(application, func, flag); +} + +NSEvent* NSApplication_nextEventMatchingMask(NSApplication* application, NSEventMask mask, NSDate* expiration, NSString* mode, bool deqFlag) { + if (mode == 0) + mode = (NSString*)NSBackingStoreBuffered; + + void* func = SI_NS_FUNCTIONS[NS_APPLICATION_NEXT_EVENT_MATCHING_MASK_CODE]; + return (NSEvent*)objc_func(application, func, mask, expiration, mode, deqFlag); +} + +si_declare_double(NSApplication, void, setActivationPolicy, NS_APPLICATION_SET_ACTIVATION_POLICY_CODE, NSApplicationActivationPolicy) +si_declare_single(NSApplication, void, run, NS_APPLICATION_RUN_CODE) +si_declare_single(NSApplication, void, finishLaunching, NS_APPLICATION_FL_CODE) + +NSScreen* NSScreen_mainScreen(void) { + void* func = SI_NS_FUNCTIONS[NS_SCREEN_MAIN_SCREEN_CODE]; + void* class = SI_NS_CLASSES[NS_SCREEN_CODE]; + + return (NSScreen*)objc_func(class, func); +} + +NSRect NSScreen_frame(NSScreen* screen) { + void* func = SI_NS_FUNCTIONS[NS_FRAME_CODE]; + + typedef NSRect (*objc_send_type)(id, SEL); + objc_send_type objc_func = (objc_send_type)objc_msgSend; + + return objc_func(screen, func); +} + +NSRect NSScreen_visibleFrame(NSScreen* screen) { + void* func = SI_NS_FUNCTIONS[NS_SCREEN_VISIBLE_FRAME_CODE]; + + typedef NSRect (*objc_send_type)(id, SEL); + objc_send_type objc_func = (objc_send_type)objc_msgSend; + + return objc_func(screen, func); +} + +NSWindow* NSWindow_init(NSRect contentRect, NSWindowStyleMask style, NSBackingStoreType backingStoreType, bool flag) { + void* nsclass = SI_NS_CLASSES[NS_WINDOW_CODE]; + void* func = SI_NS_FUNCTIONS[NS_WINDOW_INITR_CODE]; + + return objc_func(NSAlloc(nsclass), func, contentRect, style, backingStoreType, flag); +} + +const char* NSWindow_title(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_TITLE_CODE]; + return (const char*)NSString_to_char(objc_func(window, func)); +} + +void NSWindow_setTitle(NSWindow* window, const char* title) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_TITLE_CODE]; + + NSString* str = NSString_stringWithUTF8String(title); + objc_func(window, func, str); +} + +NSView* NSWindow_contentView(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_CONTENT_VIEW_CODE]; + return (NSView*)objc_func(window, func); +} + +void NSWindow_setContentView(NSWindow* window, NSView* contentView) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_CONTENT_VIEW_CODE]; + objc_func(window, func, contentView); +} + +id NSWindow_delegate(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_DELEGATE_CODE]; + return (id)objc_func(window, func); +} + +void NSWindow_setDelegate(NSWindow* window, id delegate) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_DELEGATE_CODE]; + objc_func(window, func, delegate); +} + +bool NSWindow_isVisible(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_IS_VISIBLE_CODE]; + return (bool)objc_func(window, func); +} + +void NSWindow_setIsVisible(NSWindow* window, bool isVisible) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_IS_VISIBLE_CODE]; + + objc_func(window, func, isVisible); +} + +NSColor* NSWindow_backgroundColor(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_BACKGROUND_COLOR_CODE]; + return (NSColor*)objc_func(window, func); +} + +void NSWindow_setBackgroundColor(NSWindow* window, NSColor* backgroundColor) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_BACKGROUND_COLOR_CODE]; + objc_func(window, func, backgroundColor); +} + +bool NSWindow_isOpaque(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_IS_OPAQUE_CODE]; + return (bool)objc_func(window, func); +} + +void NSWindow_setOpaque(NSWindow* window, bool isOpaque) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_OPAQUE_CODE]; + objc_func(window, func, isOpaque); +} + +CGFloat NSWindow_alphaValue(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_ALPHA_VALUE_CODE]; + return (CGFloat)(intptr_t)objc_func(window, func); +} + +void NSWindow_setAlphaValue(NSWindow* window, CGFloat alphaValue) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_ALPHA_VALUE_CODE]; + objc_func(window, func, (intptr_t)alphaValue); +} + +bool NSWindow_acceptsMouseMovedEvents(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_ACCEPTS_MOUSE_MOVED_EVENTS_CODE]; + return (bool)objc_func(window, func); +} + +void NSWindow_setAcceptsMouseMovedEvents(NSWindow* window, bool acceptsMouseMovedEvents) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_ACCEPTS_MOUSE_MOVED_EVENTS_CODE]; + objc_func(window, func, acceptsMouseMovedEvents); +} + +si_declare_single(NSWindow, void, makeKeyWindow, NS_WINDOW_MAKE_KEY_WINDOW_CODE) + +si_declare_double(NSWindow, void, orderFront, NS_WINDOW_MAKEOF_CODE, NSWindow*) +si_declare_double(NSWindow, void, makeKeyAndOrderFront, NS_WINDOW_MAKEKO_CODE, SEL) + +NSInteger NSDraggingInfo_numberOfValidItemsForDrop(NSDraggingInfo* info) { + void* func = SI_NS_FUNCTIONS[NS_DRAGGING_INFO_NUMBER_OF_VALID_ITEMS_FOR_DROP_CODE]; + return (NSInteger)(intptr_t)objc_func(info, func); +} + +void NSSlider_setTarget(NSSlider* slider, id target) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_SET_TARGET_CODE]; + objc_func(slider, func, target); +} + +id NSSlider_target(NSSlider* slider) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_TARGET_CODE]; + return objc_func(slider, func); +} + +void NSSlider_setAction(NSSlider* slider, SEL action) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_SET_ACTION_CODE]; + objc_func(slider, func, action); +} + +SEL NSSlider_action(NSSlider* slider) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_ACTION_CODE]; + return objc_func(slider, func); +} + +void NSSlider_setFont(NSSlider* slider, NSFont* font) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_SET_FONT_CODE]; + objc_func(slider, func, font); +} + +NSFont* NSSlider_font(NSSlider* slider) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_FONT_CODE]; + return (NSFont*)(intptr_t)objc_func(slider, func); +} + +void NSSlider_setDoubleValue(NSSlider* slider, double doubleValue) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_SET_DOUBLE_VALUE_CODE]; + objc_func(slider, func, (void*)(intptr_t)doubleValue); +} + +double NSSlider_doubleValue(NSSlider* slider) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_DOUBLE_VALUE_CODE]; + return (double)(intptr_t)objc_func(slider, func); +} + +void NSSlider_setMaxValue(NSSlider* slider, double maxValue) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_SET_MAX_VALUE_CODE]; + objc_func(slider, func, (void*)(intptr_t)maxValue); +} + +double NSSlider_maxValue(NSSlider* slider) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_MAX_VALUE_CODE]; + return (double)(intptr_t)objc_func(slider, func); +} + +NSSlider* NSSlider_initWithFrame(NSRect frameRect) { + void* func = SI_NS_FUNCTIONS[NS_SLIDER_INIT_WITH_FRAME_CODE]; + return (NSSlider*)(intptr_t)objc_func(NSAlloc(SI_NS_CLASSES[NS_SLIDER_CODE]), func, frameRect); +} + +void NSProgressIndicator_setDoubleValue(NSProgressIndicator* progressIndicator, double doubleValue) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_SET_DOUBLE_VALUE_CODE]; + objc_func(progressIndicator, func, (void*)(intptr_t)doubleValue); +} + +double NSProgressIndicator_doubleValue(NSProgressIndicator* progressIndicator) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_DOUBLE_VALUE_CODE]; + return (double)(intptr_t)objc_func(progressIndicator, func); +} + +void NSProgressIndicator_setMaxValue(NSProgressIndicator* progressIndicator, double maxValue) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_SET_MAX_VALUE_CODE]; + objc_func(progressIndicator, func, (void*)(intptr_t)maxValue); +} + +double NSProgressIndicator_maxValue(NSProgressIndicator* progressIndicator) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_MAX_VALUE_CODE]; + return (double)(intptr_t)objc_func(progressIndicator, func); +} + +void NSProgressIndicator_setIndeterminate(NSProgressIndicator* progressIndicator, bool isIndeterminate) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_SET_INDETERMINATE_CODE]; + objc_func(progressIndicator, func, (void*)(intptr_t)isIndeterminate); +} + +bool NSProgressIndicator_indeterminate(NSProgressIndicator* progressIndicator) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_INDETERMINATE_CODE]; + return (bool)(intptr_t)objc_func(progressIndicator, func); +} + +NSProgressIndicator* NSProgressIndicator_init(NSRect frameRect) { + void* func = SI_NS_FUNCTIONS[NS_PROGRESS_INDICATOR_INIT_CODE]; + return (NSProgressIndicator*)(intptr_t)objc_func(NSAlloc(SI_NS_CLASSES[NS_PROGRESS_INDICATOR_CODE]), func, frameRect); +} + +NSGraphicsContext* NSGraphicsContext_currentContext(NSGraphicsContext* context) { + void* func = SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_CURRENT_CONTEXT_CODE]; + return (NSGraphicsContext*)objc_func(SI_NS_CLASSES[NS_GRAPHICS_CONTEXT_CODE], func); +} + +void NSGraphicsContext_setCurrentContext(NSGraphicsContext* context, NSGraphicsContext* currentContext) { + void* func = SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_SET_CURRENT_CONTEXT_CODE]; + objc_func(context, func, currentContext); +} + +void NSMenuItem_setSubmenu(NSMenuItem* item, NSMenu* submenu) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_SET_SUBMENU_CODE]; + objc_func(item, func, submenu); +} + +void NSMenuItem_setTitle(NSMenuItem* item, const char* title) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_SET_TITLE_CODE]; + + objc_func(item, func, NSString_stringWithUTF8String(title)); +} + +NSRect NSWindow_frame(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_FRAME_CODE]; + + typedef NSRect (*objc_send_type)(id, SEL); + objc_send_type objc_func = (objc_send_type)objc_msgSend; + + return objc_func(window, func); +} + +bool NSWindow_isKeyWindow(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_IS_KEY_WINDOW_CODE]; + return (bool)objc_func(window, func); +} + +void NSWindow_center(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_CENTER_CODE]; + objc_func(window, func); +} + +void NSWindow_makeMainWindow(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_MAKE_MAIN_WINDOW_CODE]; + objc_func(window, func); +} + +void NSWindow_setFrameAndDisplay(NSWindow* window, NSRect frame, bool display, bool animate) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_SET_FRAME_AND_DISPLAY_CODE]; + objc_func(window, func, frame, display, animate); +} + +NSPoint NSWindow_convertPointFromScreen(NSWindow* window, NSPoint point) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_CONVERT_POINT_FROM_SCREEN_CODE]; + return *(NSPoint*)objc_func(window, func, point); +} + +void NSWindow_display(NSWindow* window) { + void* func = SI_NS_FUNCTIONS[NS_WINDOW_DISPLAY_CODE]; + objc_func(window, func); +} + +void NSWindow_contentView_setWantsLayer(NSWindow* window, bool wantsLayer) { + void* func = SI_NS_FUNCTIONS[NS_VIEW_SET_WANTSLAYER_CODE]; + + NSView* contentView = NSWindow_contentView(window); + + objc_func(contentView, func, wantsLayer); +} + +NSView* NSView_init(void) { + void* nclass = SI_NS_CLASSES[NS_VIEW_CODE]; + void* func = SI_NS_FUNCTIONS[NS_VIEW_INIT_CODE]; + return (NSView*)objc_func(NSAlloc(nclass), func); +} + +NSView* NSView_initWithFrame(NSRect frameRect) { + void* nclass = SI_NS_CLASSES[NS_VIEW_CODE]; + void* func = SI_NS_FUNCTIONS[NS_VIEW_INIT_WITH_FRAME_CODE]; + return (NSView*)objc_func(NSAlloc(nclass), func, frameRect); +} + +void NSView_addSubview(NSView* view, NSView* subview) { + void* func = SI_NS_FUNCTIONS[NS_VIEW_ADD_SUBVIEW_CODE]; + objc_func(view, func, subview); +} + +void NSView_registerForDraggedTypes(NSView* view, siArray(NSPasteboardType) newTypes) { + void* func = SI_NS_FUNCTIONS[NS_VIEW_REGISTER_FOR_DRAGGED_TYPES_CODE]; + + NSArray* array = si_array_to_NSArray(newTypes); + + objc_func(view, func, array); + + NSRelease(array); +} + +const char* NSTextField_stringValue(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_STRING_VALUE_CODE]; + + return (const char*)NSString_to_char(objc_func(obj, func)); +} + +void NSTextField_setStringValue(NSTextField* obj, const char* field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_STRING_VALUE_CODE]; + + NSString* str = NSString_stringWithUTF8String(field); + + objc_func(obj, func, str); +} + +bool NSTextField_isBezeled(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_IS_BEZELED_CODE]; + + return *(bool*)objc_func(obj, func); +} + +void NSTextField_setBezeled(NSTextField* obj, bool field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_BEZELED_CODE]; + + objc_func(obj, func, field); +} + +bool NSTextField_drawsBackground(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_DRAWS_BACKGROUND_CODE]; + + return *(bool*)objc_func(obj, func); +} + +void NSTextField_setDrawsBackground(NSTextField* obj, bool field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_DRAWS_BACKGROUND_CODE]; + + objc_func(obj, func, field); +} + +bool NSTextField_isEditable(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_IS_EDITABLE_CODE]; + + return *(bool*)objc_func(obj, func); +} + +void NSTextField_setEditable(NSTextField* obj, bool field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_EDITABLE_CODE]; + + objc_func(obj, func, field); +} + +bool NSTextField_isSelectable(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_IS_SELECTABLE_CODE]; + + return *(bool*)objc_func(obj, func); +} + +void NSTextField_setSelectable(NSTextField* obj, bool field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_SEDITABLE_CODE]; + + objc_func(obj, func, field); +} + +NSColor* NSTextField_textColor(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_TEXT_COLOR_CODE]; + + return (NSColor*)objc_func(obj, func); +} + +void NSTextField_setTextColor(NSTextField* obj, NSColor* field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_TEXT_COLOR_CODE]; + + objc_func(obj, func, field); +} + +NSFont* NSTextField_font(NSTextField* obj) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_FONT_CODE]; + + return (NSFont*)objc_func(obj, func); +} + +void NSTextField_setFont(NSTextField* obj, NSFont* field) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_SET_FONT_CODE]; + + objc_func(obj, func, field); +} + +NSTextField* NSTextField_initWithFrame(NSRect frameRect) { + void* func = SI_NS_FUNCTIONS[NS_TEXT_FIELD_INIT_FRAME_CODE]; + + return (NSTextField*)objc_func(NSAlloc(SI_NS_CLASSES[NS_TEXT_FIELD_CODE]), func, frameRect); +} + +NSFontManager* NSFontManager_sharedFontManager(void) { + void* func = SI_NS_FUNCTIONS[NS_FONT_MANAGER_SHARED_FONT_MANAGER_CODE]; + + return (NSFontManager*)objc_func(SI_NS_CLASSES[NS_FONT_MANAGER_CODE], func); +} + +NSFont* NSFontManager_convertFont(NSFontManager* manager, NSFont* fontObj) { + void* func = SI_NS_FUNCTIONS[NS_FONT_MANAGER_CONVERT_FONT_CODE]; + + return (NSFont*)objc_func(SI_NS_CLASSES[NS_FONT_MANAGER_CODE], func, manager, fontObj); +} + +NSFont* NSFontManager_convertFontToHaveTrait(NSFontManager* manager, NSFont* fontObj, NSFontTraitMask trait) { + void* func = SI_NS_FUNCTIONS[NS_FONT_MANAGER_CONVERT_TO_HAVE_FONT_CODE]; + + return (NSFont*)objc_func(manager, func, fontObj, trait); +} + +NSFont* NSFont_init(const char* fontName, CGFloat fontSize) { + void* func = SI_NS_FUNCTIONS[NS_FONT_INIT_CODE]; + + NSString* str = NSString_stringWithUTF8String(fontName); + + NSFont* font = (NSFont*)objc_func(SI_NS_CLASSES[NS_FONT_CODE], func, str, fontSize); + + NSRelease(str); + + return font; +} + +const char* NSFont_fontName(NSFont* font) { + void* func = SI_NS_FUNCTIONS[NS_FONT_FONT_NAME_CODE]; + + NSString* str = objc_func(font, func); + + return (const char*)NSString_to_char(str); +} + +SICDEF const char* NSButton_title(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_TITLE_CODE]; + return (const char*)NSString_to_char(objc_func(button, func)); +} + +void NSButton_setTitle(NSButton* button, const char* title) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_TITLE_CODE]; + objc_func(button, func, NSString_stringWithUTF8String(title)); +} + +NSBezelStyle NSButton_bezelStyle(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_BEZEL_STYLE_CODE]; + return (NSBezelStyle)(intptr_t)objc_func(button, func); +} + +void NSButton_setBezelStyle(NSButton* button, NSBezelStyle bezelStyle) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_BEZEL_STYLE_CODE]; + objc_func(button, func, (void*)(intptr_t)bezelStyle); +} + +id NSButton_target(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_TARGET_CODE]; + return (id)objc_func(button, func); +} + +void NSButton_setTarget(NSButton* button, id target) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_TARGET_CODE]; + objc_func(button, func, target); +} + +SEL NSButton_action(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_ACTION_CODE]; + return (SEL)objc_func(button, func); +} + +void NSButton_setAction(NSButton* button, SEL action) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_ACTION_CODE]; + objc_func(button, func, action); +} + +NSAutoresizingMaskOptions NSButton_autoresizingMask(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_AUTO_RESIZE_MASK_CODE]; + return (NSAutoresizingMaskOptions)(intptr_t)objc_func(button, func); +} + +void NSButton_setAutoresizingMask(NSButton* button, NSAutoresizingMaskOptions autoresizingMask) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_AUTO_RESIZE_MASK_CODE]; + objc_func(button, func, (void*)(intptr_t)autoresizingMask); +} + +NSControlStateValue NSButton_state(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_STATE_CODE]; + return (NSControlStateValue)(intptr_t)objc_func(button, func); +} + +void NSButton_setState(NSButton* button, NSControlStateValue state) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_STATE_CODE]; + objc_func(button, func, (void*)(intptr_t)state); +} + +bool NSButton_allowsMixedState(NSButton* button) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_ALLOWS_MIXED_STATE_CODE]; + return (bool)(intptr_t)objc_func(button, func); +} + +void NSButton_setAllowsMixedState(NSButton* button, bool allowsMixedState) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_ALLOWS_MIXED_STATE_CODE]; + objc_func(button, func, (void*)(intptr_t)allowsMixedState); +} + +NSButton* NSButton_initWithFrame(NSRect frameRect) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_INIT_WITH_FRAME_CODE]; + return (NSButton*)(intptr_t)objc_func(NSAlloc(SI_NS_CLASSES[NS_BUTTON_CODE]), func, frameRect); +} + +void NSButton_setButtonType(NSButton* button, NSButtonType buttonType) { + void* func = SI_NS_FUNCTIONS[NS_BUTTON_SET_BUTTON_TYPE_CODE]; + objc_func(button, func, (void*)(intptr_t)buttonType); +} + +NSInteger NSComboBox_indexOfSelectedItem(NSComboBox* comboBox) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_INDEX_OF_SELECTED_ITEM_CODE]; + return (NSInteger)(intptr_t)objc_func(comboBox, func); +} + +id NSComboBox_target(NSComboBox* comboBox) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_TARGET_CODE]; + return objc_func(comboBox, func); +} + +void NSComboBox_setTarget(NSComboBox* comboBox, id target) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_TARGET_CODE]; + objc_func(comboBox, func, target); +} + +SEL NSComboBox_action(NSComboBox* comboBox) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_ACTION_CODE]; + return objc_func(comboBox, func); +} + +void NSComboBox_setAction(NSComboBox* comboBox, SEL action) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_ACTION_CODE]; + objc_func(comboBox, func, action); +} + +NSFont* NSComboBox_font(NSComboBox* comboBox) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_FONT_CODE]; + return (NSFont*)(intptr_t)objc_func(comboBox, func); +} + +void NSComboBox_setFont(NSComboBox* comboBox, NSFont* font) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_FONT_CODE]; + objc_func(comboBox, func, font); +} + +const char* NSComboBox_stringValue(NSComboBox* field) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_STRING_VALUE_CODE]; + return (const char*)NSString_to_char(objc_func(field, func)); +} + +void NSComboBox_setStringValue(NSComboBox* field, const char* stringValue) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_STRING_VALUE_CODE]; + objc_func(field, func, NSString_stringWithUTF8String(stringValue)); +} + +bool NSComboBox_isBezeled(NSComboBox* field) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_IS_BEZELED_CODE]; + return (bool)(intptr_t)objc_func(field, func); +} + +void NSComboBox_setIsBezeled(NSComboBox* field, bool isBezeled) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_IS_BEZELED_CODE]; + objc_func(field, func, (void*)(intptr_t)isBezeled); +} + +bool NSComboBox_drawsBackground(NSComboBox* field) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_DRAWS_BACKGROUND_CODE]; + return (bool)(intptr_t)objc_func(field, func); +} + +void NSComboBox_setDrawsBackground(NSComboBox* field, bool drawsBackground) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_DRAWS_BACKGROUND_CODE]; + objc_func(field, func, (void*)(intptr_t)drawsBackground); +} + +bool NSComboBox_isEditable(NSComboBox* field) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_IS_EDITABLE_CODE]; + return (bool)(intptr_t)objc_func(field, func); +} + +void NSComboBox_setEditable(NSComboBox* field, bool isEditable) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_IS_EDITABLE_CODE]; + objc_func(field, func, (void*)(intptr_t)isEditable); +} + +bool NSComboBox_isSelectable(NSComboBox* field) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_IS_SELECTABLE_CODE]; + return (bool)(intptr_t)objc_func(field, func); +} + +void NSComboBox_setIsSelectable(NSComboBox* field, bool isSelectable) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_IS_SELECTABLE_CODE]; + objc_func(field, func, (void*)(intptr_t)isSelectable); +} + +NSColor* NSComboBox_textColor(NSComboBox* field) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_TEXT_COLOR_CODE]; + return (NSColor*)objc_func(field, func); +} + +void NSComboBox_setTextColor(NSComboBox* field, NSColor* textColor) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SET_TEXT_COLOR_CODE]; + objc_func(field, func, textColor); +} + +NSComboBox* NSComboBox_initWithFrame(NSRect frameRect) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_INIT_WITH_FRAME_CODE]; + return (NSComboBox*)(intptr_t)objc_func(NSAlloc(SI_NS_CLASSES[NS_COMBOBOX_CODE]), func, frameRect); +} + +void NSComboBox_addItem(NSComboBox* comboBox, const char* item) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_ADD_ITEM_CODE]; + + NSString* str = NSString_stringWithUTF8String(item); + NSRetain(str); + + objc_func(comboBox, func, str); +} + +void NSComboBox_selectItem(NSComboBox* comboBox, NSInteger index) { + void* func = SI_NS_FUNCTIONS[NS_COMBOBOX_SELECT_ITEM_CODE]; + objc_func(comboBox, func, index); +} + +NSEventType NSEvent_type(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_TYPE_CODE]; + return (NSEventType)(intptr_t)objc_func(event, func); +} + +NSPoint NSEvent_locationInWindow(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_LOCATION_IN_WINDOW_CODE]; + + typedef NSPoint (*objc_send_type)(id, SEL); + objc_send_type objc_func = (objc_send_type)objc_msgSend; + + return objc_func(event, func); +} + +NSEventModifierFlags NSEvent_modifierFlags(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_MODIFIER_FLAGS_CODE]; + return (NSEventModifierFlags)(intptr_t)objc_func(event, func); +} + +unsigned short NSEvent_keyCode(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_KEY_CODE_CODE]; + return (unsigned short)(intptr_t)objc_func(event, func); +} + +const char* NSEvent_characters(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_CHARACTERS_CODE]; + return (const char*)NSString_to_char(objc_func(event, func)); +} + +CGFloat NSEvent_deltaY(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_DELTA_Y_CODE]; + return *(CGFloat*)objc_func(event, func); +} + +unsigned short NSEvent_keyCodeForChar(char* keyStr) { + for (NSUInteger i = 0; i < NSKEYCOUNT; i++) { + if (strcmp(keyStr, NSKEYS[i])) + return NSKEYI[i + 1]; + } + + return keyStr[0]; +} + +NSPoint NSEvent_mouseLocation(void) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_MOUSE_LOCATION_CODE]; + return *(NSPoint*)objc_func(SI_NS_CLASSES[NS_EVENT_CODE], func); +} + +NSWindow* NSEvent_window(NSEvent* event) { + void* func = SI_NS_FUNCTIONS[NS_EVENT_WINDOW_CODE]; + return (NSWindow*)objc_func(event, func); +} + +NSPasteboard* NSDraggingInfo_draggingPasteboard(NSDraggingInfo* info) { + void* func = SI_NS_FUNCTIONS[NS_DRAGGING_INFO_DRAGGING_PASTEBOARD_CODE]; + return (NSPasteboard*)objc_func(info, func); +} + +NSPoint NSDraggingInfo_draggingLocation(NSDraggingInfo* info) { + void* func = SI_NS_FUNCTIONS[NS_DRAGGING_INFO_DRAGGING_LOCATION_CODE]; + return *(NSPoint*)objc_func(info, func); +} + +void NSDraggingInfo_setNumberOfValidItemsForDrop(NSDraggingInfo* info, NSInteger numberOfValidItemsForDrop) { + void* func = SI_NS_FUNCTIONS[NS_DRAGGING_INFO_SET_NUMBER_OF_VALID_ITEMS_FOR_DROP_CODE]; + objc_func(info, func, (intptr_t)numberOfValidItemsForDrop); +} + +NSWindow* NSDraggingInfo_draggingDestinationWindow(NSDraggingInfo* info) { + void* func = SI_NS_FUNCTIONS[NS_DRAGGING_INFO_DRAGGING_DESTINATION_WINDOW_CODE]; + return (NSWindow*)objc_func(info, func); +} + +NSImage* NSImage_initWithSize(NSSize size) { + void* func = SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_SIZE_CODE]; + return (NSImage*)objc_func(NSAlloc(SI_NS_CLASSES[NS_IMAGE_CODE]), func, size); +} + +NSImage* NSImage_initWithData(unsigned char* bitmapData, NSUInteger length) { + void* func = SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_DATA_CODE]; + return (NSImage*)objc_func(NSAlloc(SI_NS_CLASSES[NS_IMAGE_CODE]), func, bitmapData, length); +} + +NSImage* NSImage_initWithFile(const char* path) { + void* func = SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_FILE_CODE]; + return (NSImage*)objc_func(NSAlloc(SI_NS_CLASSES[NS_IMAGE_CODE]), func, NSString_stringWithUTF8String(path)); +} + +NSImage* NSImage_initWithCGImage(CGImageRef cgImage, NSSize size) { + void* func = SI_NS_FUNCTIONS[NS_IMAGE_INIT_WITH_CGIMAGE_CODE]; + return (NSImage*)objc_func(NSAlloc(SI_NS_CLASSES[NS_IMAGE_CODE]), func, cgImage, size); +} + +void NSImage_addRepresentation(NSImage* image, NSImageRep* imageRep) { + void* func = SI_NS_FUNCTIONS[NS_IMAGE_ADD_REPRESENTATION_CODE]; + objc_func(image, func, imageRep); +} + +NSCursor* NSCursor_currentCursor(void) { + void* nclass = SI_NS_CLASSES[NS_CURSOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_CURSOR_CURRENT_CURSOR_CODE]; + return (NSCursor*)objc_func(nclass, func); +} + +NSImage* NSCursor_image(NSCursor* cursor) { + void* func = SI_NS_FUNCTIONS[NS_CURSOR_IMAGE_CODE]; + return (NSImage*)objc_func(cursor, func); +} + +NSPoint NSCursor_hotSpot(NSCursor* cursor) { + void* func = SI_NS_FUNCTIONS[NS_CURSOR_HOT_SPOT_CODE]; + return *(NSPoint*)objc_func(cursor, func); +} + +NSCursor* NSCursor_arrowCursor(void) { + void* nclass = SI_NS_CLASSES[NS_CURSOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_CURSOR_ARROW_CURSOR_CODE]; + return (NSCursor*)objc_func(nclass, func); +} + +NSCursor* NSCursor_initWithImage(NSImage* newImage, NSPoint aPoint) { + void* func = SI_NS_FUNCTIONS[NS_CURSOR_INIT_WITH_IMAGE_CODE]; + void* nsclass = SI_NS_CLASSES[NS_CURSOR_CODE]; + + return (NSCursor*)objc_func(NSAlloc(nsclass), func, newImage, aPoint); +} + +void NSCursor_hide(void) { + void* nclass = SI_NS_CLASSES[NS_CURSOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_CURSOR_HIDE_CODE]; + objc_func(nclass, func); +} + +void NSCursor_unhide(void) { + void* nclass = SI_NS_CLASSES[NS_CURSOR_CODE]; + void* func = SI_NS_FUNCTIONS[NS_CURSOR_UNHIDE_CODE]; + objc_func(nclass, func); +} + +void NSCursor_pop(NSCursor* cursor) { + void* func = SI_NS_FUNCTIONS[NS_CURSOR_POP_CODE]; + objc_func(cursor, func); +} + +void NSCursor_push(NSCursor* cursor) { + void* func = SI_NS_FUNCTIONS[NS_CURSOR_PUSH_CODE]; + objc_func(cursor, func); +} + +void NSCursor_set(NSCursor* cursor) { + void* func = SI_NS_FUNCTIONS[NS_CURSOR_SET_CODE]; + objc_func(cursor, func); +} + +NSPasteboard* NSPasteboard_generalPasteboard(void) { + void* nclass = SI_NS_CLASSES[NS_PASTEBOARD_CODE]; + void* func = SI_NS_FUNCTIONS[NS_PASTEBOARD_GENERAL_PASTEBOARD_CODE]; + return (NSPasteboard*)objc_func(nclass, func); +} + +const char* NSPasteboard_stringForType(NSPasteboard* pasteboard, NSPasteboardType dataType) { + void* func = SI_NS_FUNCTIONS[NS_PASTEBOARD_STRING_FOR_TYPE_CODE]; + return (const char*)NSString_to_char(objc_func(pasteboard, func, dataType)); +} + +NSInteger NSPasteBoard_declareTypes(NSPasteboard* pasteboard, siArray(NSPasteboardType) newTypes, void* owner) { + void* func = SI_NS_FUNCTIONS[NS_PASTEBOARD_DECLARE_TYPES_CODE]; + + NSArray* array = si_array_to_NSArray(newTypes); + + NSInteger output = (NSInteger)(intptr_t)objc_func(pasteboard, func, array, owner); + NSRelease(array); + + return output; +} + +bool NSPasteBoard_setString(NSPasteboard* pasteboard, const char* stringToWrite, NSPasteboardType dataType) { + void* func = SI_NS_FUNCTIONS[NS_PASTEBOARD_SET_STRING_CODE]; + return (bool)objc_func(pasteboard, func, NSString_stringWithUTF8String(stringToWrite), dataType); +} + +siArray(const char*) NSPasteboard_readObjectsForClasses(NSPasteboard* pasteboard, siArray(Class) classArray, void* options) { + void* func = SI_NS_FUNCTIONS[NS_PASTEBOARD_READ_OBJECTS_FOR_CLASSES_CODE]; + + NSArray* array = si_array_to_NSArray(classArray); + + NSArray* output = (NSArray*)objc_func(pasteboard, func, array, options); + + NSRelease(array); + + NSUInteger count = NSArray_count(output); + + siArray(const char*) res = si_array_init_reserve(si_sizeof(const char*), count); + + for (NSUInteger i = 0; i < count; i++) + res[i] = NSString_to_char(NSArray_objectAtIndex(output, i)); + + return res; +} + +NSMenu* NSMenu_init(const char* title) { + void* func = SI_NS_FUNCTIONS[NS_MENU_INIT_CODE]; + return (NSMenu*)objc_func(NSAlloc(SI_NS_CLASSES[NS_MENU_CODE]), func, NSString_stringWithUTF8String(title)); +} + +void NSMenu_addItem(NSMenu* menu, NSMenuItem* newItem) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ADD_ITEM_CODE]; + objc_func(menu, func, newItem); +} + +const char* NSMenuItem_title(NSMenuItem* item) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_TITLE_CODE]; + return (const char*)NSString_to_char(objc_func(item, func)); +} + +NSMenu* NSMenuItem_submenu(NSMenuItem* item) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_SUBMENU_CODE]; + return (NSMenu*)objc_func(item, func); +} + +NSMenuItem* NSMenuItem_init(const char* title, SEL selector, const char* keyEquivalent) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_INIT_CODE]; + return (NSMenuItem*)objc_func(NSAlloc(SI_NS_CLASSES[NS_MENUITEM_CODE]), func, NSString_stringWithUTF8String(title), selector, NSString_stringWithUTF8String(keyEquivalent)); +} + +siArray(NSMenuItem*) NSMenu_itemArray(NSMenu* menu) { + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_ARRAY_CODE]; + + NSArray* array = (NSArray*)objc_func(menu, func); + + NSUInteger count = NSArray_count(array); + + siArray(NSMenuItem*) result = si_array_init_reserve(si_sizeof(*result), count); + + for (NSUInteger i = 0; i < count; i++) { + result[i] = NSArray_objectAtIndex(array, i); + NSRetain(result[i]); + } + /* TODO(EimaMei): Maybe release item_array here? */ + + return result; +} + +NSMenuItem* NSMenuItem_separatorItem(void) { + void* nclass = SI_NS_CLASSES[NS_MENUITEM_CODE]; + void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_SEPARATOR_ITEM_CODE]; + return (NSMenuItem*)objc_func(nclass, func); +} + +unsigned char* NSBitmapImageRep_bitmapData(NSBitmapImageRep* imageRep) { + void* func = SI_NS_FUNCTIONS[NS_BITMAPIMAGEREP_BITMAP_CODE]; + return (unsigned char*)objc_func(imageRep, func); +} + +NSBitmapImageRep* NSBitmapImageRep_initWithBitmapData(unsigned char** planes, NSInteger width, NSInteger height, NSInteger bps, NSInteger spp, bool alpha, bool isPlanar, const char* colorSpaceName, NSBitmapFormat bitmapFormat, NSInteger rowBytes, NSInteger pixelBits) { + void* func = SI_NS_FUNCTIONS[NS_BITMAPIMAGEREP_INIT_BITMAP_CODE]; + return (NSBitmapImageRep*)objc_func(NSAlloc(SI_NS_CLASSES[NS_BITMAPIMAGEREP_CODE]), func, planes, width, height, bps, spp, alpha, isPlanar, NSString_stringWithUTF8String(colorSpaceName), bitmapFormat, rowBytes, pixelBits); +} + +void NSSavePanel_setCanCreateDirectories(NSSavePanel* savePanel, bool canCreateDirectories) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_CAN_CREATE_DIRECTORIES_CODE]; + objc_func(savePanel, func, (void*)(intptr_t)canCreateDirectories); +} + +bool NSSavePanel_canCreateDirectories(NSSavePanel* savePanel) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_CAN_CREATE_DIRECTORIES_CODE]; + return (bool)(intptr_t)objc_func(savePanel, func); +} + +void NSSavePanel_setAllowedFileTypes(NSSavePanel* savePanel, siArray(const char*) allowedFileTypes) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_ALLOWED_FILE_TYPES_CODE]; + + siArray(NSString*) copy = si_array_init_reserve(si_sizeof(*copy), si_array_len(allowedFileTypes)); + + for (usize i = 0; i < si_array_len(copy); i++) { + copy[i] = NSString_stringWithUTF8String(allowedFileTypes[i]); + } + + NSArray* array = si_array_to_NSArray(copy); + objc_func(savePanel, func, array); + + si_array_free(copy); + NSRelease(array); +} + +siArray(const char*) NSSavePanel_allowedFileTypes(NSSavePanel* savePanel) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_ALLOWED_FILE_TYPES_CODE]; + NSArray* output = (NSArray*)objc_func(savePanel, func); + + NSUInteger count = NSArray_count(output); + + siArray(const char*) res = si_array_init_reserve(si_sizeof(const char*), count); + + for (NSUInteger i = 0; i < count; i++) + res[i] = NSString_to_char(NSArray_objectAtIndex(output, i)); + + NSRelease(output); + + return res; +} + +void NSSavePanel_setDirectoryURL(NSSavePanel* savePanel, NSURL* directoryURL) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_DIRECTORY_URL_CODE]; + objc_func(savePanel, func, directoryURL); +} + +NSURL* NSSavePanel_directoryURL(NSSavePanel* savePanel) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_DIRECTORY_URL_CODE]; + return (NSURL*)objc_func(savePanel, func); +} + +void NSSavePanel_setNameFieldStringValue(NSSavePanel* savePanel, const char* nameFieldStringValue) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_SET_NAME_FIELD_STRING_VALUE_CODE]; + objc_func(savePanel, func, NSString_stringWithUTF8String(nameFieldStringValue)); +} + +const char* NSSavePanel_nameFieldStringValue(NSSavePanel* savePanel) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_NAME_FIELD_STRING_VALUE_CODE]; + return (const char*)objc_func(savePanel, func); +} + +NSURL* NSSavePanel_URL(NSSavePanel* savePanel) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_URL_CODE]; + return (NSURL*)objc_func(savePanel, func); +} + +NSModalResponse NSSavePanel_runModal(NSSavePanel* savePanel) { + void* func = SI_NS_FUNCTIONS[NS_SAVE_PANEL_RUN_MODAL_CODE]; + return (NSModalResponse)(intptr_t)objc_func(savePanel, func); +} + +const char* NSURL_path(NSURL* url) { + void* func = SI_NS_FUNCTIONS[NSURL_PATH_CODE]; + return (const char*)objc_func(url, func); +} + +NSURL* NSURL_fileURLWithPath(const char* path) { + void* func = SI_NS_FUNCTIONS[NSURL_FILE_URL_WITH_PATH_CODE]; + return (NSURL*)objc_func(SI_NS_CLASSES[NS_URL_CODE], func, NSString_stringWithUTF8String(path)); +} + +NSString* NSString_stringWithUTF8String(const char* str) { + void* func = SI_NS_FUNCTIONS[NS_STRING_WIDTH_UTF8_STRING_CODE]; + return objc_func(SI_NS_CLASSES[NS_STRING_CODE], func, str); +} + +const char* NSString_to_char(NSString* str) { + void* func = SI_NS_FUNCTIONS[NS_UTF8_STRING_CODE]; + return objc_func(str, func); +} + +const char* NSDictionary_objectForKey(NSDictionary* d, const char* str) { + void* func = SI_NS_FUNCTIONS[NS_OBJECT_FOR_KEY_CODE]; + + NSString* s = NSString_stringWithUTF8String(str); + NSString* obj = objc_func(d, func, s); + + NSRelease(s); + + const char* out = NSString_to_char(obj); + NSRelease(obj); + + return out; +} + +NSDictionary* NSBundle_infoDictionary(NSBundle* bundle) { + void* func = SI_NS_FUNCTIONS[NS_INFO_DICTIONARY_CODE]; + return objc_func(bundle, func); +} + +NSBundle* NSBundle_mainBundle(void) { + void* func = SI_NS_FUNCTIONS[NS_INFO_MAIN_BUNDLE_CODE]; + void* nsclass = SI_NS_CLASSES[NS_BUNDLE_CODE]; + + return objc_func(nsclass, func); +} + +NSArray* si_array_to_NSArray(siArray(void) array) { + void* func = SI_NS_FUNCTIONS[NS_ARRAY_SI_ARRAY_CODE]; + void* nsclass = SI_NS_CLASSES[NS_ARRAY_CODE]; + + return objc_func(NSAlloc(nsclass), func, array, si_array_len(array)); +} + +NSUInteger NSArray_count(NSArray* array) { + void* func = SI_NS_FUNCTIONS[NS_ARRAY_COUNT_CODE]; + return *(NSUInteger*)objc_func(array, func); +} + +void* NSArray_objectAtIndex(NSArray* array, NSUInteger index) { + void* func = SI_NS_FUNCTIONS[NS_OBJECT_AT_INDEX_CODE]; + return objc_func(SI_NS_CLASSES[NS_STRING_CODE], func, index); +} + +id NSAutoRelease(id obj) { return (id)objc_func(obj, SI_NS_FUNCTIONS[NS_AUTORELEASE_CODE]); } + +id NSInit(void* class) { return (id)objc_func(class, SI_NS_FUNCTIONS[NS_INIT_CODE]); } + +void NSRelease(id obj) { objc_func(obj, SI_NS_FUNCTIONS[NS_RELEASE_CODE]); } + +void NSRetain(id obj) { objc_func(obj, SI_NS_FUNCTIONS[NS_RETAIN_CODE]); } + +/* ======== OpenGL ======== */ +NSOpenGLPixelFormat* NSOpenGLPixelFormat_initWithAttributes(const NSOpenGLPixelFormatAttribute* attribs) { + void* func = SI_NS_FUNCTIONS[NS_OPENGL_PIXEL_FORMAT_INIT_WITH_ATTRIBUTES_CODE]; + return (NSOpenGLPixelFormat*)objc_func(NSAlloc(SI_NS_CLASSES[NS_OPENGL_PF_CODE]), func, attribs); +} + +NSOpenGLView* NSOpenGLView_initWithFrame(NSRect frameRect, NSOpenGLPixelFormat* format) { + void* func = SI_NS_FUNCTIONS[NS_OPENGL_VIEW_INIT_WITH_FRAME_CODE]; + return (NSOpenGLView*)objc_func(NSAlloc(SI_NS_CLASSES[NS_OPENGL_VIEW_CODE]), func, frameRect, format); +} + +void NSOpenGLView_prepareOpenGL(NSOpenGLView* view) { + void* func = SI_NS_FUNCTIONS[NS_OPENGL_VIEW_PREPARE_OPENGL_CODE]; + objc_func(view, func); +} + +NSOpenGLContext* NSOpenGLView_openGLContext(NSOpenGLView* view) { + void* func = SI_NS_FUNCTIONS[NS_OPENGL_VIEW_OPENGL_CONTEXT_CODE]; + return (NSOpenGLContext*)objc_func(view, func); +} + +void NSOpenGLContext_setValues(NSOpenGLContext* context, const int* vals, NSOpenGLContextParameter param) { + void* func = SI_NS_FUNCTIONS[NS_OPENGL_CONTEXT_SET_VALUES_CODE]; + objc_func(context, func, vals, param); +} + +void NSOpenGLContext_makeCurrentContext(NSOpenGLContext* context) { + void* func = SI_NS_FUNCTIONS[NS_OPENGL_CONTEXT_MAKE_CURRENT_CONTEXT_CODE]; + objc_func(context, func); +} + +si_declare_single(NSOpenGLContext, void, flushBuffer, NS_OPENGL_CONTEXT_FLUSH_BUFFER_CODE) + +#if defined(SILICON_ARRAY_IMPLEMENTATION) || !defined(siArray) +#include +#include + +void* si_array_init(void* allocator, isize sizeof_element, isize count) { + void* array = si_array_init_reserve(sizeof_element, count); + memcpy(array, allocator, sizeof_element * count); + + return array; +} + +void* si_array_init_reserve(isize sizeof_element, isize count) { + void* ptr = malloc(si_sizeof(siArrayHeader) + (sizeof_element * count)); + siArray(void) array = ptr + si_sizeof(siArrayHeader); + + siArrayHeader* header = SI_ARRAY_HEADER(array); + header->count = count; + + return array; +} + + +void si_array_free(siArray(void) array) { + if (array == NULL) + return ; + + free(SI_ARRAY_HEADER(array)); +} +#endif + +#endif /* SILICON_IMPLEMENTATION */ \ No newline at end of file