Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
- `WindowBase`:
  - Generalize `create`.
- `Dialog.create`: call `ensureLoaded`.
  • Loading branch information
gmpassos committed Aug 10, 2023
1 parent b4215e7 commit 8741f49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
## 1.1.0

- `WindowBase`:
- Generalize `create`.
- `Dialog.create`: call `ensureLoaded`.

## 1.0.12

- `WindowBase`:
Expand Down
7 changes: 5 additions & 2 deletions lib/src/win32_dialog.dart
Expand Up @@ -273,7 +273,10 @@ class Dialog<R> extends WindowBase<Dialog> {
int? get hwndIfCreated => _hwnd;

/// Creates the [Dialog].
int create() {
@override
Future<int> create() async {
await ensureLoaded();

final createIdPtr = calloc<Uint32>();
createIdPtr.value = createId;

Expand Down Expand Up @@ -483,7 +486,7 @@ class Dialog<R> extends WindowBase<Dialog> {

@override
String toString() {
return 'Dialog{style: $style, title: $title, x: $x, y: $y, width: $width, height: $height, fontName: $fontName, fontSize: $fontSize, items: $items, dialogFunction: $dialogFunction, result: $result, parent: $parent}';
return 'Dialog{style: $style, title: $title, x: $x, y: $y, width: $width, height: $height, fontName: $fontName, fontSize: $fontSize, items: ${items.length}, dialogFunction: $dialogFunction, result: $result, parent: $parent}';
}
}

Expand Down
5 changes: 5 additions & 0 deletions lib/src/win32_gui_base.dart
Expand Up @@ -583,6 +583,10 @@ abstract class WindowBase<W extends WindowBase<W>> {
/// responding to a [WM_CREATE] or [WM_INITDIALOG] message.
int get createId;

/// Creates the [Window] or [Dialog].
/// - Should call: `await` [ensureLoaded].
Future<int> create();

Future<void>? _loadCall;

/// Ensures that [load] was called.
Expand Down Expand Up @@ -1098,6 +1102,7 @@ class Window extends WindowBase<Window> {
int? get hwndIfCreated => _hwnd;

/// Creates this [Window].
@override
Future<int> create({bool createChildren = true}) async {
await ensureLoaded();

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,6 +1,6 @@
name: win32_gui
description: Win32 API GUI in Object-Oriented style with some helpers. Uses package `win32` and `dart:ffi`.
version: 1.0.12
version: 1.1.0
repository: https://github.com/gmpassos/win32_gui

screenshots:
Expand Down

0 comments on commit 8741f49

Please sign in to comment.