-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathnative_widgets.v
More file actions
27 lines (24 loc) · 957 Bytes
/
native_widgets.v
File metadata and controls
27 lines (24 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2020-2025 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.
module ui
// NativeWidget holds an opaque handle to a platform-native widget.
// On macOS this is an NSView*, on Windows an HWND, on other platforms it is nil.
pub struct NativeWidget {
pub mut:
handle voidptr
}
// NativeWidgets manages creation, positioning and lifecycle of platform-native
// controls. When `Window` is created with `native_widgets: true`, every widget
// that has a native counterpart will create a platform control and delegate
// drawing/events to the OS instead of using the custom gg-based rendering.
pub struct NativeWidgets {
pub mut:
// Parent native window handle (NSWindow*/HWND)
parent_handle voidptr
enabled bool
}
// is_enabled returns whether native widgets mode is active.
pub fn (nw &NativeWidgets) is_enabled() bool {
return nw.enabled
}