Skip to content

Commit

Permalink
added a few new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Feb 24, 2024
1 parent f31e256 commit 076a1a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions silicon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,7 @@ enum{
NS_STRING_IS_EQUAL_CODE,
NS_WINDOW_SET_MAX_SIZE_CODE,
NS_WINDOW_SET_MIN_SIZE_CODE,
NS_GRAPHICS_CONTEXT_WIDTH_WINDOW_CODE,

NS_FUNC_LEN
};
Expand Down Expand Up @@ -1839,6 +1840,7 @@ void si_initNS(void) {
SI_NS_FUNCTIONS[NS_WINDOW_STYLE_MASK_CODE] = sel_getUid("styleMask");
SI_NS_FUNCTIONS[NS_WINDOW_SET_MAX_SIZE_CODE] = sel_getUid("setMinSize:");
SI_NS_FUNCTIONS[NS_WINDOW_SET_MIN_SIZE_CODE] = sel_getUid("setMaxSize:");
SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_WIDTH_WINDOW_CODE] = sel_getUid("graphicsContextWithWindow:");
}

void si_impl_func_to_SEL_with_name(const char* class_name, const char* register_name, void* function) {
Expand Down Expand Up @@ -2353,6 +2355,11 @@ void NSGraphicsContext_setCurrentContext(NSGraphicsContext* context, NSGraphicsC
objc_msgSend_void_id(context, func, currentContext);
}

NSGraphicsContext* NSGraphicsContext_graphicsContextWithWindow(NSWindow* window) {
void* func = SI_NS_FUNCTIONS[NS_GRAPHICS_CONTEXT_WIDTH_WINDOW_CODE];
return objc_msgSend_id_id(SI_NS_CLASSES[NS_GRAPHICS_CONTEXT_CODE], func, window);
}

void NSMenuItem_setSubmenu(NSMenuItem* item, NSMenu* submenu) {
void* func = SI_NS_FUNCTIONS[NS_MENU_ITEM_SET_SUBMENU_CODE];
objc_msgSend_void_id(item, func, submenu);
Expand Down

0 comments on commit 076a1a4

Please sign in to comment.