Changed to writing macOS plugin in Swift
This commit is contained in:
@@ -7,8 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
731C6C6E25724025002E9709 /* OverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 731C6C6D25724025002E9709 /* OverlayView.swift */; };
|
||||
73575EF922BE18B200E9F019 /* LibUniWinC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 73575EF822BE18B200E9F019 /* LibUniWinC.mm */; };
|
||||
739194942AB93A9D006696F2 /* LibUniWinCPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 739194932AB93A9D006696F2 /* LibUniWinCPackage */; };
|
||||
73B2C793273559A60053A44D /* DebugUniWinCApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C792273559A60053A44D /* DebugUniWinCApp.swift */; };
|
||||
73B2C795273559A60053A44D /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C794273559A60053A44D /* ContentView.swift */; };
|
||||
73B2C797273559A60053A44D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 73B2C796273559A60053A44D /* Assets.xcassets */; };
|
||||
@@ -16,12 +15,7 @@
|
||||
73B2C7A5273559A70053A44D /* DebugUniWinCTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C7A4273559A70053A44D /* DebugUniWinCTests.swift */; };
|
||||
73B2C7AF273559A70053A44D /* DebugUniWinCUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C7AE273559A70053A44D /* DebugUniWinCUITests.swift */; };
|
||||
73B2C7B1273559A70053A44D /* DebugUniWinCUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C7B0273559A70053A44D /* DebugUniWinCUITestsLaunchTests.swift */; };
|
||||
73B2C7BD273559C80053A44D /* LibUniWinC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C7BC273559C80053A44D /* LibUniWinC.swift */; };
|
||||
73B2C7C027355B030053A44D /* OverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 731C6C6D25724025002E9709 /* OverlayView.swift */; };
|
||||
73B2C7C127355B060053A44D /* LibUniWinC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C7BC273559C80053A44D /* LibUniWinC.swift */; };
|
||||
73B2C7C52736ACE00053A44D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73B2C7C42736ACE00053A44D /* AppDelegate.swift */; };
|
||||
73FC88632753777D0024BABB /* CustomPanelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73FC88622753777D0024BABB /* CustomPanelHelper.swift */; };
|
||||
73FC886427537FEC0024BABB /* CustomPanelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73FC88622753777D0024BABB /* CustomPanelHelper.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -43,8 +37,8 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
7306572424F1F87900FAB8BC /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||
731C6C6D25724025002E9709 /* OverlayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayView.swift; sourceTree = "<group>"; };
|
||||
73575EF822BE18B200E9F019 /* LibUniWinC.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LibUniWinC.mm; sourceTree = "<group>"; };
|
||||
739194902AB939E1006696F2 /* LibUniWinCPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = LibUniWinCPackage; sourceTree = "<group>"; };
|
||||
739194912AB93A42006696F2 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
|
||||
73B2C790273559A60053A44D /* DebugUniWinC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DebugUniWinC.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
73B2C792273559A60053A44D /* DebugUniWinCApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugUniWinCApp.swift; sourceTree = "<group>"; };
|
||||
73B2C794273559A60053A44D /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
@@ -56,11 +50,9 @@
|
||||
73B2C7AA273559A70053A44D /* DebugUniWinCUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DebugUniWinCUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
73B2C7AE273559A70053A44D /* DebugUniWinCUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugUniWinCUITests.swift; sourceTree = "<group>"; };
|
||||
73B2C7B0273559A70053A44D /* DebugUniWinCUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugUniWinCUITestsLaunchTests.swift; sourceTree = "<group>"; };
|
||||
73B2C7BC273559C80053A44D /* LibUniWinC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibUniWinC.swift; sourceTree = "<group>"; };
|
||||
73B2C7C42736ACE00053A44D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
73DFCB7722B8ED3300DA41F2 /* LibUniWinC.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LibUniWinC.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
73DFCB7A22B8ED3300DA41F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
73FC88622753777D0024BABB /* CustomPanelHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomPanelHelper.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -89,12 +81,20 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
739194942AB93A9D006696F2 /* LibUniWinCPackage in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
739194922AB93A9D006696F2 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
73B2C791273559A60053A44D /* DebugUniWinC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -136,11 +136,13 @@
|
||||
73DFCB6E22B8ED3300DA41F2 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
739194902AB939E1006696F2 /* LibUniWinCPackage */,
|
||||
73DFCB7922B8ED3300DA41F2 /* LibUniWinC */,
|
||||
73B2C791273559A60053A44D /* DebugUniWinC */,
|
||||
73B2C7A3273559A70053A44D /* DebugUniWinCTests */,
|
||||
73B2C7AD273559A70053A44D /* DebugUniWinCUITests */,
|
||||
73DFCB7822B8ED3300DA41F2 /* Products */,
|
||||
739194922AB93A9D006696F2 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -158,12 +160,9 @@
|
||||
73DFCB7922B8ED3300DA41F2 /* LibUniWinC */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
73B2C7BC273559C80053A44D /* LibUniWinC.swift */,
|
||||
73DFCB7A22B8ED3300DA41F2 /* Info.plist */,
|
||||
73575EF822BE18B200E9F019 /* LibUniWinC.mm */,
|
||||
7306572424F1F87900FAB8BC /* README.md */,
|
||||
731C6C6D25724025002E9709 /* OverlayView.swift */,
|
||||
73FC88622753777D0024BABB /* CustomPanelHelper.swift */,
|
||||
739194912AB93A42006696F2 /* PrefixHeader.pch */,
|
||||
);
|
||||
path = LibUniWinC;
|
||||
sourceTree = "<group>";
|
||||
@@ -238,6 +237,9 @@
|
||||
dependencies = (
|
||||
);
|
||||
name = LibUniWinC;
|
||||
packageProductDependencies = (
|
||||
739194932AB93A9D006696F2 /* LibUniWinCPackage */,
|
||||
);
|
||||
productName = MacPluginTest;
|
||||
productReference = 73DFCB7722B8ED3300DA41F2 /* LibUniWinC.bundle */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
@@ -352,11 +354,8 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
73B2C795273559A60053A44D /* ContentView.swift in Sources */,
|
||||
73B2C7C127355B060053A44D /* LibUniWinC.swift in Sources */,
|
||||
73B2C793273559A60053A44D /* DebugUniWinCApp.swift in Sources */,
|
||||
73B2C7C52736ACE00053A44D /* AppDelegate.swift in Sources */,
|
||||
73FC886427537FEC0024BABB /* CustomPanelHelper.swift in Sources */,
|
||||
73B2C7C027355B030053A44D /* OverlayView.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -381,10 +380,6 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
73FC88632753777D0024BABB /* CustomPanelHelper.swift in Sources */,
|
||||
73B2C7BD273559C80053A44D /* LibUniWinC.swift in Sources */,
|
||||
731C6C6E25724025002E9709 /* OverlayView.swift in Sources */,
|
||||
73575EF922BE18B200E9F019 /* LibUniWinC.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -720,7 +715,7 @@
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
|
||||
MARKETING_VERSION = 0.9.2;
|
||||
MARKETING_VERSION = 0.9.3;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
@@ -755,7 +750,7 @@
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
|
||||
MARKETING_VERSION = 0.9.2;
|
||||
MARKETING_VERSION = 0.9.3;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.kirurobo.libuniwinc;
|
||||
@@ -817,6 +812,13 @@
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
739194932AB93A9D006696F2 /* LibUniWinCPackage */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = LibUniWinCPackage;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 73DFCB6F22B8ED3300DA41F2 /* Project object */;
|
||||
}
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
//
|
||||
// LibUniWinC on macOS
|
||||
//
|
||||
// Author: Kirurobo
|
||||
// License: MIT
|
||||
// Created: 2019/06/22
|
||||
// Copyright © 2019-2020 kirurobo. All rights reserved.
|
||||
//
|
||||
|
||||
#define UNIWINC_EXPORT extern "C"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "LibUniWinC-Swift.h"
|
||||
|
||||
// Actually the argument type is wchar_t*
|
||||
using StringCallback = void(* _Nonnull)(const void* _Nonnull);
|
||||
|
||||
// Callback for display changed
|
||||
using IntCallback = void(* _Nonnull)(const SInt32);
|
||||
|
||||
|
||||
UNIWINC_EXPORT BOOL IsActive() {
|
||||
return [LibUniWinC isActive];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL IsTransparent() {
|
||||
return [LibUniWinC isTransparent];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL IsBorderless() {
|
||||
return [LibUniWinC isBorderless];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL IsTopmost() {
|
||||
return [LibUniWinC isTopmost];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL IsBottommost() {
|
||||
return [LibUniWinC isBottommost];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL IsMaximized() {
|
||||
return [LibUniWinC isMaximized];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL IsMinimized() {
|
||||
return [LibUniWinC isMinimized];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL DetachWindow() {
|
||||
[LibUniWinC detachWindow];
|
||||
return true;
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL AttachMyWindow() {
|
||||
return [LibUniWinC attachMyWindow];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL AttachMyOwnerWindow() {
|
||||
return [LibUniWinC attachMyWindow];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL AttachMyActiveWindow() {
|
||||
return [LibUniWinC attachMyWindow];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetTransparent(BOOL isTransparent) {
|
||||
[LibUniWinC setTransparentWithIsTransparent:isTransparent];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetBorderless(BOOL isBorderless) {
|
||||
[LibUniWinC setBorderlessWithIsBorderless:isBorderless];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetAlphaValue(Float32 alpha) {
|
||||
[LibUniWinC setAlphaValueWithAlpha: alpha];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetTopmost(BOOL isTopmost) {
|
||||
[LibUniWinC setTopmostWithIsTopmost:isTopmost];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetBottommost(BOOL isBottommost) {
|
||||
[LibUniWinC setBottommostWithIsBottommost:isBottommost];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetMaximized(BOOL isZoomed) {
|
||||
[LibUniWinC setMaximizedWithIsZoomed:isZoomed];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT void SetClickThrough(BOOL isTransparent) {
|
||||
[LibUniWinC setClickThroughWithIsTransparent:isTransparent];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL SetPosition(Float32 x, Float32 y) {
|
||||
return [LibUniWinC setPositionWithX:x y:y];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL GetPosition(Float32* x, Float32* y) {
|
||||
return [LibUniWinC getPositionWithX:x y:y];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL SetSize(Float32 width, Float32 height) {
|
||||
return [LibUniWinC setSizeWithWidth:width height:height];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL GetSize(Float32* width, Float32* height) {
|
||||
return [LibUniWinC getSizeWithWidth:width height:height];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL GetClientSize(Float32* width, Float32* height) {
|
||||
return [LibUniWinC getClientSizeWithWidth:width height:height];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT SInt32 GetCurrentMonitor() {
|
||||
return [LibUniWinC getCurrentMonitor];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT SInt32 GetMonitorCount() {
|
||||
return [LibUniWinC getMonitorCount];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL GetMonitorRectangle(SInt32 monitorIndex, Float32* x, Float32* y, Float32* width, Float32* height) {
|
||||
return [LibUniWinC getMonitorRectangleWithMonitorIndex:monitorIndex x:x y:y width:width height:height];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL RegisterMonitorChangedCallback(IntCallback callback) {
|
||||
return [LibUniWinC registerMonitorChangedCallbackWithCallback: callback];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL UnregisterMonitorChangedCallback() {
|
||||
return [LibUniWinC unregisterMonitorChangedCallback];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL RegisterWindowStyleChangedCallback(IntCallback callback) {
|
||||
return [LibUniWinC registerWindowStyleChangedCallbackWithCallback: callback];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL UnregisterWindowStyleChangedCallback() {
|
||||
return [LibUniWinC unregisterWindowStyleChangedCallback];
|
||||
}
|
||||
|
||||
// コールバックにファイルはダブルクオーテーションで囲まれ改行区切りとなった文字列で渡ります。
|
||||
// e.g. "/Dir/File1.txt"\n"/Dir/File2.txt"\n"/Dir/File""3"".txt"\n
|
||||
UNIWINC_EXPORT BOOL RegisterDropFilesCallback(StringCallback callback) {
|
||||
return [LibUniWinC registerDropFilesCallbackWithCallback: callback];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL UnregisterDropFilesCallback() {
|
||||
return [LibUniWinC unregisterDropFilesCallback];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL SetAllowDrop(BOOL enabled) {
|
||||
return [LibUniWinC setAllowDropWithEnabled: enabled];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL SetCursorPosition(Float32 x, Float32 y) {
|
||||
return [LibUniWinC setCursorPositionWithX:x y:y];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL GetCursorPosition(Float32* x, Float32* y) {
|
||||
return [LibUniWinC getCursorPositionWithX:x y:y];
|
||||
}
|
||||
|
||||
// Call periodically to maintain window state.
|
||||
UNIWINC_EXPORT void Update() {
|
||||
[LibUniWinC update];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL OpenFilePanel(const void* lpPanelSettings, UniChar* lpwsBuffer, UInt32 bufferSize) {
|
||||
return [LibUniWinC openFilePanelWithLpSettings: lpPanelSettings lpBuffer:lpwsBuffer bufferSize: bufferSize];
|
||||
}
|
||||
|
||||
UNIWINC_EXPORT BOOL OpenSavePanel(const void* lpPanelSettings, UniChar* lpwsBuffer, UInt32 bufferSize) {
|
||||
return [LibUniWinC openSavePanelWithLpSettings: lpPanelSettings lpBuffer: lpwsBuffer bufferSize: bufferSize];
|
||||
}
|
||||
|
||||
|
||||
// For Windows only (Nothing to do on Mac)
|
||||
UNIWINC_EXPORT void SetTransparentType(SInt32 type) {
|
||||
[LibUniWinC setTransparentTypeWithType: type];
|
||||
}
|
||||
|
||||
// For Windows only (Nothing to do on Mac)
|
||||
UNIWINC_EXPORT void SetKeyColor(SInt32 color) {
|
||||
[LibUniWinC setKeyColorWithColor: color];
|
||||
}
|
||||
|
||||
// For Windows only (Nothing to do on Mac)
|
||||
UNIWINC_EXPORT BOOL AttachWindowHandle(UInt64 hwnd) {
|
||||
return [LibUniWinC attachWindowHandleWithHwnd: hwnd];
|
||||
}
|
||||
|
||||
|
||||
// For debugging
|
||||
UNIWINC_EXPORT SInt32 GetDebugInfo() {
|
||||
return [LibUniWinC getDebugInfo];
|
||||
}
|
||||
17
Xcode/LibUniWinC/PrefixHeader.pch
Normal file
17
Xcode/LibUniWinC/PrefixHeader.pch
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// PrefixHeader.pch
|
||||
// LibUniWinC
|
||||
//
|
||||
// Created by owner on 2023/09/19.
|
||||
// Copyright © 2023 kirurobo. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef PrefixHeader_pch
|
||||
#define PrefixHeader_pch
|
||||
|
||||
// Include any system framework and library headers here that should be included in all compilation units.
|
||||
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
|
||||
|
||||
@import LibUniWinCPackage;
|
||||
|
||||
#endif /* PrefixHeader_pch */
|
||||
9
Xcode/LibUniWinCPackage/.gitignore
vendored
Normal file
9
Xcode/LibUniWinCPackage/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
.DS_Store
|
||||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
xcuserdata/
|
||||
DerivedData/
|
||||
.swiftpm/config/registries.json
|
||||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||
.netrc
|
||||
28
Xcode/LibUniWinCPackage/Package.swift
Normal file
28
Xcode/LibUniWinCPackage/Package.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
// swift-tools-version: 5.8
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "LibUniWinCPackage",
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
.library(
|
||||
name: "LibUniWinCPackage",
|
||||
targets: ["LibUniWinCPackage"]),
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
// .package(url: /* package url */, from: "1.0.0"),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||
.target(
|
||||
name: "LibUniWinCPackage",
|
||||
dependencies: []),
|
||||
.testTarget(
|
||||
name: "LibUniWinCPackageTests",
|
||||
dependencies: ["LibUniWinCPackage"]),
|
||||
]
|
||||
)
|
||||
3
Xcode/LibUniWinCPackage/README.md
Normal file
3
Xcode/LibUniWinCPackage/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# LibUniWinCPackage
|
||||
|
||||
A description of this package.
|
||||
@@ -9,6 +9,7 @@
|
||||
// https://qiita.com/KRiver1/items/9ecf65759cf1349f56af
|
||||
//
|
||||
// References:
|
||||
// - https://qiita.com/fuziki/items/974f70b663ebfadfb136
|
||||
// - https://qiita.com/KRiver1/items/9ecf65759cf1349f56af
|
||||
// - http://tatsudoya.blog.fc2.com/blog-entry-244.html
|
||||
// - https://qiita.com/mybdesign/items/fe3e390741799c1814ad
|
||||
@@ -20,7 +21,7 @@ import Cocoa
|
||||
|
||||
/// Window controller main logic
|
||||
@objcMembers
|
||||
public class LibUniWinC : NSObject {
|
||||
public class LibUniWinC {
|
||||
|
||||
// MARK: - Internal structs and classes
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
public struct LibUniWinCPackage {
|
||||
//public private(set) var text = "Hello, World!"
|
||||
|
||||
public init() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
//
|
||||
// UnityInterface.swift
|
||||
//
|
||||
// Author: Kirurobo
|
||||
// License: MIT
|
||||
// Created: 2023/09/19
|
||||
// Copyright © 2023 kirurobo.
|
||||
//
|
||||
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
// Actually the argument type is wchar_t*
|
||||
//using StringCallback = void(* _Nonnull)(const void* _Nonnull);
|
||||
|
||||
// Callback for display changed
|
||||
//using IntCallback = void(* _Nonnull)(const SInt32);
|
||||
|
||||
@_cdecl("IsActive")
|
||||
public func IsActive() -> Bool {
|
||||
return LibUniWinC.isActive()
|
||||
}
|
||||
|
||||
|
||||
@_cdecl("IsTransparent")
|
||||
public func IsTransparent() -> Bool {
|
||||
return LibUniWinC.isTransparent()
|
||||
}
|
||||
|
||||
@_cdecl("IsBorderless")
|
||||
public func IsBorderless() -> Bool {
|
||||
return LibUniWinC.isBorderless()
|
||||
}
|
||||
|
||||
@_cdecl("IsTopmost")
|
||||
public func IsTopmost() -> Bool {
|
||||
return LibUniWinC.isTopmost()
|
||||
}
|
||||
|
||||
@_cdecl("IsBottommost")
|
||||
public func IsBottommost() -> Bool {
|
||||
return LibUniWinC.isBottommost()
|
||||
}
|
||||
|
||||
@_cdecl("IsMaximized")
|
||||
public func IsMaximized() -> Bool {
|
||||
return LibUniWinC.isMaximized()
|
||||
}
|
||||
|
||||
@_cdecl("IsMinimized")
|
||||
public func IsMinimized() -> Bool {
|
||||
return LibUniWinC.isMinimized()
|
||||
}
|
||||
|
||||
@_cdecl("DetachWindow")
|
||||
public func DetachWindow() -> Bool {
|
||||
LibUniWinC.detachWindow()
|
||||
return true;
|
||||
}
|
||||
|
||||
@_cdecl("AttachMyWindow")
|
||||
public func AttachMyWindow() -> Bool {
|
||||
return LibUniWinC.attachMyWindow()
|
||||
}
|
||||
|
||||
@_cdecl("AttachMyOwnerWindow")
|
||||
public func AttachMyOwnerWindow() -> Bool {
|
||||
return LibUniWinC.attachMyWindow()
|
||||
}
|
||||
|
||||
@_cdecl("AttachMyActiveWindow")
|
||||
public func AttachMyActiveWindow() -> Bool {
|
||||
return LibUniWinC.attachMyWindow()
|
||||
}
|
||||
|
||||
@_cdecl("SetTransparent")
|
||||
public func SetTransparent(isTransparent: Bool) -> Void {
|
||||
return LibUniWinC.setTransparent(isTransparent: isTransparent)
|
||||
}
|
||||
|
||||
@_cdecl("SetBorderless")
|
||||
public func SetBorderless(isBorderless: Bool) -> Void {
|
||||
return LibUniWinC.setBorderless(isBorderless: isBorderless)
|
||||
}
|
||||
|
||||
@_cdecl("SetAlphaValue")
|
||||
public func SetAlphaValue(alpha: Float32) -> Void {
|
||||
LibUniWinC.setAlphaValue(alpha: alpha)
|
||||
}
|
||||
|
||||
@_cdecl("SetTopmost")
|
||||
public func SetTopmost(isTopmost: Bool) -> Void {
|
||||
LibUniWinC.setTopmost(isTopmost: isTopmost)
|
||||
}
|
||||
|
||||
@_cdecl("SetBottommost")
|
||||
public func SetBottommost(isBottommost: Bool) -> Void {
|
||||
LibUniWinC.setBottommost(isBottommost: isBottommost)
|
||||
}
|
||||
|
||||
@_cdecl("SetMaximized")
|
||||
public func SetMaximized(isZoomed: Bool) -> Void {
|
||||
LibUniWinC.setMaximized(isZoomed: isZoomed)
|
||||
}
|
||||
|
||||
@_cdecl("SetClickThrough")
|
||||
public func SetClickThrough(isTransparent: Bool) -> Void {
|
||||
LibUniWinC.setClickThrough(isTransparent: isTransparent)
|
||||
}
|
||||
|
||||
@_cdecl("SetPosition")
|
||||
public func SetPosition(x: Float32, y: Float32) -> Bool {
|
||||
return LibUniWinC.setPosition(x: x, y: y)
|
||||
}
|
||||
|
||||
@_cdecl("GetPosition")
|
||||
public func GetPosition(x: UnsafeMutablePointer<Float32>, y: UnsafeMutablePointer<Float32>) -> Bool {
|
||||
return LibUniWinC.getPosition(x: x, y: y)
|
||||
}
|
||||
|
||||
@_cdecl("SetSize")
|
||||
public func SetSize(width: Float32, height: Float32) -> Bool {
|
||||
return LibUniWinC.setSize(width: width, height: height)
|
||||
}
|
||||
|
||||
@_cdecl("GetSize")
|
||||
public func GetSize(width: UnsafeMutablePointer<Float32>, height: UnsafeMutablePointer<Float32>) -> Bool {
|
||||
return LibUniWinC.getSize(width:width, height:height)
|
||||
}
|
||||
|
||||
@_cdecl("GetClientSize")
|
||||
public func GetClientSize(width: UnsafeMutablePointer<Float32>, height: UnsafeMutablePointer<Float32>) -> Bool {
|
||||
return LibUniWinC.getClientSize(width:width, height:height)
|
||||
}
|
||||
|
||||
@_cdecl("GetCurrentMonitor")
|
||||
public func GetCurrentMonitor() -> Int32 {
|
||||
return LibUniWinC.getCurrentMonitor()
|
||||
}
|
||||
|
||||
@_cdecl("GetMonitorCount")
|
||||
public func GetMonitorCount() -> Int32 {
|
||||
return LibUniWinC.getMonitorCount()
|
||||
}
|
||||
|
||||
@_cdecl("GetMonitorRectangle")
|
||||
public func GetMonitorRectangle(
|
||||
monitorIndex: Int32,
|
||||
x: UnsafeMutablePointer<Float32>, y: UnsafeMutablePointer<Float32>,
|
||||
width: UnsafeMutablePointer<Float32>, height: UnsafeMutablePointer<Float32>
|
||||
) -> Bool {
|
||||
return LibUniWinC.getMonitorRectangle(monitorIndex:monitorIndex, x:x, y:y, width:width, height:height)
|
||||
}
|
||||
|
||||
@_cdecl("RegisterMonitorChangedCallback")
|
||||
public func RegisterMonitorChangedCallback(callback: LibUniWinC.intCallback) -> Bool {
|
||||
return LibUniWinC.registerMonitorChangedCallback(callback: callback)
|
||||
}
|
||||
|
||||
@_cdecl("UnregisterMonitorChangedCallback")
|
||||
public func UnregisterMonitorChangedCallback() -> Bool {
|
||||
return LibUniWinC.unregisterMonitorChangedCallback()
|
||||
}
|
||||
|
||||
@_cdecl("RegisterWindowStyleChangedCallback")
|
||||
public func RegisterWindowStyleChangedCallback(callback: LibUniWinC.intCallback) -> Bool {
|
||||
return LibUniWinC.registerWindowStyleChangedCallback(callback: callback)
|
||||
}
|
||||
|
||||
@_cdecl("UnregisterWindowStyleChangedCallback")
|
||||
public func UnregisterWindowStyleChangedCallback() -> Bool {
|
||||
return LibUniWinC.unregisterWindowStyleChangedCallback()
|
||||
}
|
||||
|
||||
// コールバックにファイルはダブルクオーテーションで囲まれ改行区切りとなった文字列で渡ります。
|
||||
// e.g. "/Dir/File1.txt"\n"/Dir/File2.txt"\n"/Dir/File""3"".txt"\n
|
||||
@_cdecl("RegisterDropFilesCallback")
|
||||
public func RegisterDropFilesCallback(callback: LibUniWinC.stringCallback) -> Bool {
|
||||
return LibUniWinC.registerDropFilesCallback(callback: callback)
|
||||
}
|
||||
|
||||
@_cdecl("UnregisterDropFilesCallback")
|
||||
public func UnregisterDropFilesCallback() -> Bool {
|
||||
return LibUniWinC.unregisterDropFilesCallback()
|
||||
}
|
||||
|
||||
@_cdecl("SetAllowDrop")
|
||||
public func SetAllowDrop(enabled: Bool) -> Bool {
|
||||
return LibUniWinC.setAllowDrop(enabled: enabled)
|
||||
}
|
||||
|
||||
@_cdecl("SetCursorPosition")
|
||||
public func SetCursorPosition(x: Float32, y: Float32) -> Bool {
|
||||
return LibUniWinC.setCursorPosition(x:x, y:y)
|
||||
}
|
||||
|
||||
@_cdecl("GetCursorPosition")
|
||||
public func GetCursorPosition(x: UnsafeMutablePointer<Float32>, y: UnsafeMutablePointer<Float32>) -> Bool {
|
||||
return LibUniWinC.getCursorPosition(x:x, y:y)
|
||||
}
|
||||
|
||||
// Call periodically to maintain window state.
|
||||
@_cdecl("Update")
|
||||
public func Update() -> Void {
|
||||
LibUniWinC.update()
|
||||
}
|
||||
|
||||
@_cdecl("OpenFilePanel")
|
||||
public func OpenFilePanel(lpSettings: UnsafeRawPointer, lpBuffer: UnsafeMutablePointer<UniChar>?, bufferSize: UInt32) -> Bool {
|
||||
return LibUniWinC.openFilePanel(lpSettings: lpSettings, lpBuffer:lpBuffer, bufferSize: bufferSize)
|
||||
}
|
||||
|
||||
@_cdecl("OpenSavePanel")
|
||||
public func OpenSavePanel(lpSettings: UnsafeRawPointer, lpBuffer: UnsafeMutablePointer<UniChar>?, bufferSize: UInt32) -> Bool {
|
||||
return LibUniWinC.openSavePanel(lpSettings: lpSettings, lpBuffer: lpBuffer, bufferSize: bufferSize)
|
||||
}
|
||||
|
||||
|
||||
// For Windows only (Nothing to do on Mac)
|
||||
@_cdecl("SetTransparentType")
|
||||
public func SetTransparentType(type: Int32) -> Void {
|
||||
LibUniWinC.setTransparentType(type: type)
|
||||
}
|
||||
|
||||
// For Windows only (Nothing to do on Mac)
|
||||
@_cdecl("SetKeyColor")
|
||||
public func SetKeyColor(color: Int32) -> Void {
|
||||
return LibUniWinC.setKeyColor(color: color)
|
||||
}
|
||||
|
||||
// For Windows only (Nothing to do on Mac)
|
||||
@_cdecl("AttachWindowHandle")
|
||||
public func AttachWindowHandle(hwnd: UInt64) -> Bool {
|
||||
return LibUniWinC.attachWindowHandle(hwnd: hwnd)
|
||||
}
|
||||
|
||||
|
||||
// For debugging
|
||||
@_cdecl("GetDebugInfo")
|
||||
public func GetDebugInfo() -> Int32 {
|
||||
return LibUniWinC.getDebugInfo()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import XCTest
|
||||
@testable import LibUniWinCPackage
|
||||
|
||||
final class LibUniWinCPackageTests: XCTestCase {
|
||||
func testExample() throws {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct
|
||||
// results.
|
||||
XCTAssertEqual(LibUniWinCPackage().text, "Hello, World!")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user