This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(windows_system): add
Launcher
APIs (#228)
- Loading branch information
1 parent
d20a87a
commit 018299d
Showing
22 changed files
with
2,597 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/windows_system/lib/src/folderlauncheroptions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
import 'package:windows_storage/windows_storage.dart'; | ||
import 'package:windows_ui/windows_ui.dart'; | ||
|
||
import 'ifolderlauncheroptions.dart'; | ||
import 'ilauncherviewoptions.dart'; | ||
|
||
/// Specifies the options to use when launching File Explorer to display the | ||
/// contents of a specific folder by calling the | ||
/// LaunchFolderAsync(IStorageFolder, FolderLauncherOptions) method. | ||
/// | ||
/// {@category class} | ||
class FolderLauncherOptions extends IInspectable | ||
implements IFolderLauncherOptions, ILauncherViewOptions { | ||
FolderLauncherOptions() : super(activateClass(_className)); | ||
FolderLauncherOptions.fromPtr(super.ptr); | ||
|
||
static const _className = 'Windows.System.FolderLauncherOptions'; | ||
|
||
late final _iFolderLauncherOptions = IFolderLauncherOptions.from(this); | ||
|
||
@override | ||
IVector<IStorageItem> get itemsToSelect => | ||
_iFolderLauncherOptions.itemsToSelect; | ||
|
||
late final _iLauncherViewOptions = ILauncherViewOptions.from(this); | ||
|
||
@override | ||
ViewSizePreference get desiredRemainingView => | ||
_iLauncherViewOptions.desiredRemainingView; | ||
|
||
@override | ||
set desiredRemainingView(ViewSizePreference value) => | ||
_iLauncherViewOptions.desiredRemainingView = value; | ||
} |
55 changes: 55 additions & 0 deletions
55
packages/windows_system/lib/src/ifolderlauncheroptions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
import 'package:windows_storage/windows_storage.dart'; | ||
|
||
/// @nodoc | ||
const IID_IFolderLauncherOptions = '{bb91c27d-6b87-432a-bd04-776c6f5fb2ab}'; | ||
|
||
/// {@category interface} | ||
class IFolderLauncherOptions extends IInspectable { | ||
// vtable begins at 6, is 1 entries long. | ||
IFolderLauncherOptions.fromPtr(super.ptr); | ||
|
||
factory IFolderLauncherOptions.from(IInspectable interface) => | ||
IFolderLauncherOptions.fromPtr( | ||
interface.toInterface(IID_IFolderLauncherOptions)); | ||
|
||
IVector<IStorageItem> get itemsToSelect { | ||
final retValuePtr = calloc<COMObject>(); | ||
|
||
final hr = ptr.ref.vtable | ||
.elementAt(6) | ||
.cast< | ||
Pointer< | ||
NativeFunction< | ||
HRESULT Function(VTablePointer lpVtbl, | ||
Pointer<COMObject> retValuePtr)>>>() | ||
.value | ||
.asFunction< | ||
int Function(VTablePointer lpVtbl, | ||
Pointer<COMObject> retValuePtr)>()(ptr.ref.lpVtbl, retValuePtr); | ||
|
||
if (FAILED(hr)) { | ||
free(retValuePtr); | ||
throw WindowsException(hr); | ||
} | ||
|
||
return IVector.fromPtr(retValuePtr, | ||
iterableIid: '{bb8b8418-65d1-544b-b083-6d172f568c73}', | ||
creator: IStorageItem.fromPtr); | ||
} | ||
} |
Oops, something went wrong.