feat: (macOS) Add Support for plattform on native wrappers
This commit is contained in:
Родитель
dd874072db
Коммит
5c67d7e1b3
|
@ -156,7 +156,7 @@ namespace CalculationManager
|
||||||
public static SetExpressionDisplayCallbackFunc _setExpressionDisplayCallback = SetExpressionDisplayCallback;
|
public static SetExpressionDisplayCallbackFunc _setExpressionDisplayCallback = SetExpressionDisplayCallback;
|
||||||
public static SetMemorizedNumbersCallbackFunc _setMemorizedNumbersCallback = SetMemorizedNumbersCallback;
|
public static SetMemorizedNumbersCallbackFunc _setMemorizedNumbersCallback = SetMemorizedNumbersCallback;
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(MaxDigitsReachedCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(MaxDigitsReachedCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void MaxDigitsReachedCallback(IntPtr state)
|
public static void MaxDigitsReachedCallback(IntPtr state)
|
||||||
|
@ -167,7 +167,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.MaxDigitsReachedCallback");
|
DebugTrace($"CalculatorManager.MaxDigitsReachedCallback");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(MemoryItemChangedCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(MemoryItemChangedCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void MemoryItemChangedCallback(IntPtr state, int indexOfMemory)
|
public static void MemoryItemChangedCallback(IntPtr state, int indexOfMemory)
|
||||||
|
@ -178,7 +178,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.MemoryItemChangedCallback({indexOfMemory})");
|
DebugTrace($"CalculatorManager.MemoryItemChangedCallback({indexOfMemory})");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(OnHistoryItemAddedCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(OnHistoryItemAddedCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void OnHistoryItemAddedCallback(IntPtr state, int addedItemIndex)
|
public static void OnHistoryItemAddedCallback(IntPtr state, int addedItemIndex)
|
||||||
|
@ -189,7 +189,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.OnHistoryItemAddedCallback({addedItemIndex})");
|
DebugTrace($"CalculatorManager.OnHistoryItemAddedCallback({addedItemIndex})");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(OnNoRightParenAddedCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(OnNoRightParenAddedCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void OnNoRightParenAddedCallback(IntPtr state)
|
public static void OnNoRightParenAddedCallback(IntPtr state)
|
||||||
|
@ -200,7 +200,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.OnNoRightParenAddedCallback");
|
DebugTrace($"CalculatorManager.OnNoRightParenAddedCallback");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(SetExpressionDisplayCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(SetExpressionDisplayCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void SetExpressionDisplayCallback(IntPtr state, IntPtr historyItem)
|
public static void SetExpressionDisplayCallback(IntPtr state, IntPtr historyItem)
|
||||||
|
@ -220,7 +220,7 @@ namespace CalculationManager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(SetMemorizedNumbersCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(SetMemorizedNumbersCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void SetMemorizedNumbersCallback(IntPtr state, int count, IntPtr newMemorizedNumbers)
|
public static void SetMemorizedNumbersCallback(IntPtr state, int count, IntPtr newMemorizedNumbers)
|
||||||
|
@ -239,7 +239,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.SetMemorizedNumbersCallback({string.Join(";", numbers)})");
|
DebugTrace($"CalculatorManager.SetMemorizedNumbersCallback({string.Join(";", numbers)})");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(SetParenthesisNumberCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(SetParenthesisNumberCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void SetParenthesisNumberCallback(IntPtr state, int parenthesisCount)
|
public static void SetParenthesisNumberCallback(IntPtr state, int parenthesisCount)
|
||||||
|
@ -250,7 +250,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.SetParenthesisNumberCallback({parenthesisCount})");
|
DebugTrace($"CalculatorManager.SetParenthesisNumberCallback({parenthesisCount})");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(BinaryOperatorReceivedFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(BinaryOperatorReceivedFunc))]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.BinaryOperatorReceivedCallback");
|
DebugTrace($"CalculatorManager.BinaryOperatorReceivedCallback");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(SetPrimaryDisplayCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(SetPrimaryDisplayCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void SetPrimaryDisplayCallback(IntPtr state, IntPtr pDisplayStringValue, bool isError)
|
public static void SetPrimaryDisplayCallback(IntPtr state, IntPtr pDisplayStringValue, bool isError)
|
||||||
|
@ -275,7 +275,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.SetPrimaryDisplayCallback({displayStringValue}, {isError})");
|
DebugTrace($"CalculatorManager.SetPrimaryDisplayCallback({displayStringValue}, {isError})");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(SetIsInErrorCallbackFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(SetIsInErrorCallbackFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static void SetIsInErrorCallback(IntPtr state, bool isError)
|
public static void SetIsInErrorCallback(IntPtr state, bool isError)
|
||||||
|
@ -286,7 +286,7 @@ namespace CalculationManager
|
||||||
DebugTrace($"CalculatorManager.SetIsInErrorCallback({isError})");
|
DebugTrace($"CalculatorManager.SetIsInErrorCallback({isError})");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__ || __MACOS__
|
||||||
[ObjCRuntime.MonoPInvokeCallback(typeof(GetCEngineStringFunc))]
|
[ObjCRuntime.MonoPInvokeCallback(typeof(GetCEngineStringFunc))]
|
||||||
#endif
|
#endif
|
||||||
public static IntPtr GetCEngineStringCallback(IntPtr state, IntPtr pResourceId)
|
public static IntPtr GetCEngineStringCallback(IntPtr state, IntPtr pResourceId)
|
||||||
|
@ -306,7 +306,7 @@ namespace CalculationManager
|
||||||
|
|
||||||
internal static IntPtr StringToHGlobal(string resourceValue)
|
internal static IntPtr StringToHGlobal(string resourceValue)
|
||||||
{
|
{
|
||||||
#if __WASM__ || __IOS__ || __ANDROID__
|
#if __WASM__ || __IOS__ || __ANDROID__ || __MACOS__
|
||||||
// wchar_t is 32bits
|
// wchar_t is 32bits
|
||||||
return StringToHGlobalUTF32(resourceValue);
|
return StringToHGlobalUTF32(resourceValue);
|
||||||
#else
|
#else
|
||||||
|
@ -316,7 +316,7 @@ namespace CalculationManager
|
||||||
|
|
||||||
internal static string PtrToString(IntPtr pResourceId)
|
internal static string PtrToString(IntPtr pResourceId)
|
||||||
{
|
{
|
||||||
#if __WASM__ || __IOS__ || __ANDROID__
|
#if __WASM__ || __IOS__ || __ANDROID__ || __MACOS__
|
||||||
return PtrToStringUTF32(pResourceId);
|
return PtrToStringUTF32(pResourceId);
|
||||||
#else
|
#else
|
||||||
return Marshal.PtrToStringUni(pResourceId);
|
return Marshal.PtrToStringUni(pResourceId);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче