public static void RegisterCallback(int index, IntPtr function) { switch (index) { case IDE_GET_PREF_AS_STRING: getPrefCallback = (IdeGetPrefAsString)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPrefAsString)); break; case IDE_GET_PERSONAL_PREF_SETS: getPrefSetsCallback = (IdeGetPersonalPrefSets)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPersonalPrefSets)); break; case IDE_GET_PREF_AS_BOOL: getBoolPrefCallback = (IdeGetPrefAsBool)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetPrefAsBool)); break; case IDE_EXECUTE_TEMPLATE: execTemplateCallback = (IdeExecuteTemplate)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeExecuteTemplate)); break; case IDE_GET_TEXT: getTextCallback = (IdeGetText)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetText)); break; case IDE_SET_TEXT: setTextCallback = (IdeSetText)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeSetText)); break; case IDE_GET_CURSOR_X: getCursorXCallback = (IdeGetCursorX)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetCursorX)); break; case IDE_GET_CURSOR_Y: getCursorYCallback = (IdeGetCursorY)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetCursorY)); break; case IDE_SET_CURSOR: setCursorCallback = (IdeSetCursor)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeSetCursor)); break; case IDE_GET_READ_ONLY: getReadOnlyCallback = (IdeGetReadOnly)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetReadOnly)); break; case IDE_GET_GENERAL_PREF: getGeneralPrefCallback = (IdeGetGeneralPref)Marshal.GetDelegateForFunctionPointer(function, typeof(IdeGetGeneralPref)); break; } }
public static void RegisterCallback(int index, IntPtr function) { switch (index) { case CREATE_WINDOW_CALLBACK: createWindowCallback = Marshal.GetDelegateForFunctionPointer <IdeCreateWindow>(function); break; case SET_TEXT_CALLBACK: setTextCallback = Marshal.GetDelegateForFunctionPointer <IdeSetText>(function); break; case GET_TEXT_CALLBACK: getTextCallback = Marshal.GetDelegateForFunctionPointer <IdeGetText>(function); break; case FILE_NAME_CALLBACK: fileNameCallback = Marshal.GetDelegateForFunctionPointer <IdeFileName>(function); break; case SAVE_FILE_CALLBACK: saveFileCallback = Marshal.GetDelegateForFunctionPointer <IdeSaveFile>(function); break; case SET_FILE_NAME_CALLBACK: setFilenameCallback = Marshal.GetDelegateForFunctionPointer <IdeSetFilename>(function); break; case GET_FILE_DATA_CALLBACK: getFileDataCallback = Marshal.GetDelegateForFunctionPointer <IdeGetFileData>(function); break; case SHOW_HTML_CALLBACK: showHtmlCallback = Marshal.GetDelegateForFunctionPointer <IdeShowHTML>(function); break; case GET_PREF_STRING_CALLBACK: getPrefAsStringCallback = Marshal.GetDelegateForFunctionPointer <IdeGetPrefAsString>(function); break; case SET_PREF_STRING_CALLBACK: setPrefAsStringCallback = Marshal.GetDelegateForFunctionPointer <IdeSetPrefAsString>(function); break; case SET_PREF_BOOL_CALLBACK: setPrefAsBoolCallback = Marshal.GetDelegateForFunctionPointer <IdeSetPrefAsBool>(function); break; case GET_PREF_BOOL_CALLBACK: getPrefAsBoolCallback = Marshal.GetDelegateForFunctionPointer <IdeGetPrefAsBool>(function); break; case PLUGIN_SETTING_CALLBACK: plugInSettingCallback = Marshal.GetDelegateForFunctionPointer <IdePlugInSetting>(function); break; case CREATE_POPUP_ITEM_CALLBACK: createPopupItemCallback = Marshal.GetDelegateForFunctionPointer <IdeCreatePopupItem>(function); break; case GET_POPUP_OBJECT_CALLBACK: getPopupObjectCallback = Marshal.GetDelegateForFunctionPointer <IdeGetPopupObject>(function); break; case GET_OBJECT_SOURCE_CALLBACK: getObjectSourceCallback = Marshal.GetDelegateForFunctionPointer <IdeGetObjectSource>(function); break; case GET_WINDOW_OBJECT_CALLBACK: getWindowObjectCallback = Marshal.GetDelegateForFunctionPointer <IdeGetWindowObject>(function); break; } }