M7: test platform — Platform traits, Application, TestPlatform, VisualTestContext (#7)
This commit was merged in pull request #7.
This commit is contained in:
1 parent
fbe4c081e6
commit
73c67825b2
25 files changed
+3592
-83
No files matched your search
@@ -0,0 +1,111 @@
|
||||
// Generated using `moon info`, DON'T EDIT IT
|
||||
package "experiments/gpui/platform"
|
||||
|
||||
import {
|
||||
"experiments/gpui/executor",
|
||||
"experiments/gpui/geometry",
|
||||
"experiments/gpui/input",
|
||||
"experiments/gpui/scene",
|
||||
"experiments/gpui/style",
|
||||
"moonbitlang/core/debug",
|
||||
}
|
||||
|
||||
// Values
|
||||
|
||||
// Errors
|
||||
|
||||
// Types and methods
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum ClipboardEntry {
|
||||
String(ClipboardString)
|
||||
}
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct ClipboardItem {
|
||||
entries : Array[ClipboardEntry]
|
||||
}
|
||||
pub fn ClipboardItem::metadata(Self) -> String?
|
||||
pub fn ClipboardItem::new_string(String) -> Self
|
||||
pub fn ClipboardItem::new_string_with_metadata(String, String) -> Self
|
||||
pub fn ClipboardItem::text(Self) -> String?
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct ClipboardString {
|
||||
text : String
|
||||
metadata : String?
|
||||
}
|
||||
pub fn ClipboardString::new(String) -> Self
|
||||
pub fn ClipboardString::new_with_metadata(String, String) -> Self
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum WindowBounds {
|
||||
Windowed(@geometry.Bounds[@geometry.Pixels])
|
||||
Maximized(@geometry.Bounds[@geometry.Pixels])
|
||||
Fullscreen(@geometry.Bounds[@geometry.Pixels])
|
||||
}
|
||||
pub fn WindowBounds::get_bounds(Self) -> @geometry.Bounds[@geometry.Pixels]
|
||||
pub impl Default for WindowBounds
|
||||
|
||||
#derive(Compare, Eq, Hash, @debug.Debug)
|
||||
pub(all) struct WindowId(Int32)
|
||||
pub impl Show for WindowId
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct WindowOptions {
|
||||
window_bounds : WindowBounds?
|
||||
title : String?
|
||||
focus : Bool
|
||||
show : Bool
|
||||
scale_factor : Double?
|
||||
rem_size : @geometry.Pixels
|
||||
}
|
||||
pub fn WindowOptions::with_size(@geometry.Size[@geometry.Pixels], scale_factor? : Double, title? : String, rem_size? : @geometry.Pixels) -> Self
|
||||
pub impl Default for WindowOptions
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct WindowParams {
|
||||
bounds : @geometry.Bounds[@geometry.Pixels]
|
||||
title : String?
|
||||
focus : Bool
|
||||
show : Bool
|
||||
scale_factor : Double?
|
||||
}
|
||||
|
||||
// Type aliases
|
||||
|
||||
// Traits
|
||||
pub(open) trait Platform {
|
||||
fn dispatcher(Self) -> &@executor.Dispatcher
|
||||
fn default_window_bounds(Self) -> @geometry.Bounds[@geometry.Pixels]
|
||||
fn open_window(Self, WindowId, WindowParams) -> &PlatformWindow
|
||||
fn run(Self, () -> Unit) -> Unit
|
||||
fn quit(Self) -> Unit
|
||||
fn active_window(Self) -> WindowId?
|
||||
fn set_cursor_style(Self, @style.CursorStyle) -> Unit
|
||||
fn read_from_clipboard(Self) -> ClipboardItem?
|
||||
fn write_to_clipboard(Self, ClipboardItem) -> Unit
|
||||
fn open_url(Self, String) -> Unit
|
||||
}
|
||||
|
||||
pub(open) trait PlatformWindow {
|
||||
fn bounds(Self) -> @geometry.Bounds[@geometry.Pixels]
|
||||
fn content_size(Self) -> @geometry.Size[@geometry.Pixels]
|
||||
fn scale_factor(Self) -> Double
|
||||
fn mouse_position(Self) -> @geometry.Point[@geometry.Pixels]
|
||||
fn modifiers(Self) -> @input.Modifiers
|
||||
fn is_active(Self) -> Bool
|
||||
fn is_hovered(Self) -> Bool
|
||||
fn set_title(Self, String) -> Unit
|
||||
fn activate(Self) -> Unit
|
||||
fn resize(Self, @geometry.Size[@geometry.Pixels]) -> Unit
|
||||
fn draw(Self, @scene.Scene) -> Unit
|
||||
fn schedule_frame(Self) -> Unit
|
||||
fn close(Self) -> Unit
|
||||
fn on_request_frame(Self, () -> Unit) -> Unit
|
||||
fn on_input(Self, (@input.PlatformInput) -> @input.DispatchEventResult) -> Unit
|
||||
fn on_resize(Self, (@geometry.Size[@geometry.Pixels], Double) -> Unit) -> Unit
|
||||
fn on_active_status_change(Self, (Bool) -> Unit) -> Unit
|
||||
fn on_hover_status_change(Self, (Bool) -> Unit) -> Unit
|
||||
fn on_should_close(Self, () -> Bool) -> Unit
|
||||
fn on_close(Self, () -> Unit) -> Unit
|
||||
}
|
||||
Reference in new issue
Block a user