XU XUv0.13.1
EN

UI / WIDGETS · 46

Widgets 组件目录

按用途选择组件。每个组件都有独立的用法、API 和体验入口。

操作

文本输入

选择与调节

导航

数据展示

布局与容器

文本与标记

反馈与浮层

嵌入内容

-title: #ui/widgets-->

#ui/widgets

导入方式: #ui/widgets

公开 API: 146 函数, 1915 方法, 98 类型, 275 常量, 4 方法集

Button、Checkbox、Progress、Scroll、Input / TextArea 与保留 View。Styles 提供字体、密度、颜色、几何和组合状态规则;StyledLabel 缓存排版。局部主题是完整快照。set_style_measure 注册测量,文字变化后 mark_measure;layout_styled 后 place_editor,再 present_styled。样式回调借用主题,使用节点局部坐标,不能修改 View 或拓扑。

使用指南与生命周期

扩展控件与统一样式切换

Switch、Radio、Slider、Stepper、Tabs、Select、Badge、Divider、Card 与 ListBox 共享 Styles、组合状态绘制规则、阴影及图标位置。使用 widgets.style_switcher() 创建深色、浅色和高对比预设;调用 use_preset、set_text_scale、set_density 后,通过 apply 应用到保留 View,或用 cycle 切换并应用下一预设。这些方法可能失败,须处理错误。View 接收完整样式快照,控件的显式覆盖继续生效。

正式版示例(完整工程与源码下载):widgets · editor_workbench · style_gallery · controls_gallery

将统一样式应用到保留 View:

@main
#ui/widgets

fn configure(view $&widgets.View) int {
    $themes := widgets.style_switcher()
    themes.use_preset(widgets.THEME_LIGHT) or >>
    themes.set_text_scale(1.2) or >>
    themes.set_density(0.85) or >>
    themes.apply(view) or >>
    // Call this from a theme-switch action to advance and apply the preset.
    themes.cycle(view) or >>
    << 0
}
fn main() int { << 0 }

组件工作坊:图文按钮、Tooltip 与密码

component_workshop 完整工程与源码提供 46 个入口,可切换主题、密度、100%/140%/200% 字号以及禁用、只读和错误状态。需要与源码配套的 Xu 0.10.11;Windows/Linux 的交叉构建不等于目标机器 GUI 验收。

Screen.button_with_icon() 创建图文按钮,icon_button() 创建纯图标按钮。每个按钮保存自己的样式快照;分别设置 icon_size 和 ICON_LEADING/TRAILING/ABOVE/BELOW,再用 measure_button() 获取内容尺寸并放置,避免示例按钮占满整行。资源随 --www 嵌入,下面的代码需要 www/logo.png。

Tooltip 默认上方居中;set_tooltip_placement() 设置四方向和边缘翻转。普通悬停约 500 ms 显示,键盘或显式焦点立即显示;移出、点击或滚动时收起。Escape 抑制当前这一轮提示,离开重入或重新聚焦后恢复。完全滚出裁剪区域的锚点不显示提示。

password_input() 是单行 Input 的真实密码模式,每个 Unicode 字素对应一个圆点。set_password_visible() 显隐切换保留值和选择;支持粘贴,显文时也禁止复制和剪切。原生周围文字查询和 XACP 节点文本不返回密码;text_value() 仍为应用返回实际值。应用应自行管理值的保存和日志,不应将掩码误认为内存加密。

@main
#ui/widgets

fn configure(screen $&widgets.Screen, styles &widgets.Styles) int {
    button := screen.button_with_icon("logo.png", "Build project") or >>
    $appearance := styles.button_variant(widgets.BUTTON_PRIMARY) or >>
    appearance.icon_placement = widgets.ICON_ABOVE
    appearance.icon_size = 32.0 * styles.text_scale
    screen.set_control_style(button, &appearance) or >>
    size := screen.measure_button(button) or >>
    screen.place(button, 24.0, 24.0, size.width, size.height) or >>
    tip := screen.tooltip(button, "Build project") or >>
    $placement := widgets.overlay_placement()
    placement.side = widgets.OVERLAY_RIGHT
    placement.align = widgets.OVERLAY_CENTER
    screen.set_tooltip_placement(tip, &placement) or >>
    password := screen.password_input("") or >>
    screen.place(password, 24.0, 160.0, 320.0, 48.0) or >>
    << 0
}
fn main() int { << 0 }

示例代码 · API 声明

示例代码

以下源码来自官方 examples 仓库,可复制或下载。请在完整工程中使用本地 Xu SDK 运行;网络、数据库和桌面示例需要对应的服务或资源。

16_ui_webview/editor_workbench/xuui_tokens/mod.xu

所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码

Xu本地 SDK 示例
@xuui_tokens
// XUUI 0.1.1-dev.1; generated from tokens/tokens.json.
// Regenerate with npm run build; retain this provenance when vendoring.
#ui/draw
#ui/widgets

pub fn canvas(dark bool) draw.Color {
    if dark { << draw.rgb(16,14,18) }
    << draw.rgb(246,243,239)
}
pub fn surface(dark bool) draw.Color {
    if dark { << draw.rgb(25,22,28) }
    << draw.rgb(255,253,251)
}
pub fn elevated(dark bool) draw.Color {
    if dark { << draw.rgb(35,31,39) }
    << draw.rgb(238,235,231)
}
pub fn subtle(dark bool) draw.Color {
    if dark { << draw.rgb(44,39,49) }
    << draw.rgb(232,227,223)
}
pub fn text(dark bool) draw.Color {
    if dark { << draw.rgb(245,240,237) }
    << draw.rgb(40,35,41)
}
pub fn muted(dark bool) draw.Color {
    if dark { << draw.rgb(179,170,182) }
    << draw.rgb(109,98,110)
}
pub fn brand(dark bool) draw.Color {
    if dark { << draw.rgb(255,82,116) }
    << draw.rgb(190,18,60)
}
pub fn focus(dark bool) draw.Color {
    if dark { << draw.rgb(168,217,255) }
    << draw.rgb(0,95,158)
}
pub fn control_border(dark bool) draw.Color {
    if dark { << draw.rgb(138,126,144) }
    << draw.rgb(133,121,135)
}
pub fn on_brand(dark bool) draw.Color {
    if dark { << draw.rgb(25,12,18) }
    << draw.rgb(255,248,250)
}
pub fn danger(dark bool) draw.Color {
    if dark { << draw.rgb(255,142,157) }
    << draw.rgb(184,33,56)
}
pub fn danger_soft(dark bool) draw.Color {
    if dark { << draw.rgb(60,32,40) }
    << draw.rgb(251,230,233)
}

// Editor appearance for XU SDK 0.10.11. Other controls retain SDK defaults.
pub fn editor_styles(dark bool) widgets.Styles {
    $styles := widgets.light_styles()
    if dark { styles = widgets.dark_styles() }
    styles.background = canvas(dark)
    $input := styles.input.clone()
    input.radius = 8.0
    input.min_height = 40.0
    input.padding.left = 12.0
    input.padding.right = 12.0
    input.padding.top = 8.0
    input.padding.bottom = 8.0
    input.border_width = 1.0
    input.focus_width = 2.0
    input.font.size = 16.0
    input.inherit_font = false
    input.palette.normal = surface(dark)
    input.palette.hovered = surface(dark)
    input.palette.pressed = subtle(dark)
    input.palette.disabled = surface(dark)
    input.palette.foreground = text(dark)
    input.palette.muted = muted(dark)
    input.palette.placeholder = muted(dark)
    input.palette.accent = brand(dark)
    input.palette.on_accent = on_brand(dark)
    input.palette.focus = focus(dark)
    input.palette.border = control_border(dark)
    input.palette.invalid = danger(dark)
    input.palette.invalid_fill = danger_soft(dark)
    input.palette.read_only = subtle(dark)
    input.palette.selection = brand(dark)
    input.palette.selection_text = on_brand(dark)
    $hover := widgets.state_paint(widgets.STATE_HOVERED)
    hover.unless = widgets.STATE_DISABLED | widgets.STATE_INVALID | widgets.STATE_READ_ONLY
    hover.fields = widgets.PAINT_BORDER
    hover.border = brand(dark)
    $focused := widgets.state_paint(widgets.STATE_FOCUSED)
    focused.unless = widgets.STATE_DISABLED | widgets.STATE_INVALID
    focused.fields = widgets.PAINT_BORDER
    focused.border = focus(dark)
    input.states = [hover,focused]
    styles.input = input.clone()
    styles.text_area = input.clone()
    styles.text_area.align_y = 0.0
    << styles
}
16_ui_webview/webview_component/main.xu

所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu

Xumain.xu
@main
#ui
#ui/widgets
#ui/webview
#math
demo #"github.com/xulang-org/examples/ui_demo"

fn document(title string, tone string) string {
    << "<!doctype html><html><head><meta charset='utf-8'><title>" + title + "</title><style>body{margin:0;padding:28px;font:15px -apple-system,system-ui;color:#252521;background:#faf9f6}small{letter-spacing:.14em;color:#797970}h1{font-size:28px;font-weight:600;letter-spacing:-.04em;margin:16px 0}p{line-height:1.65;color:#6b6b63}input,button{box-sizing:border-box;font:inherit;border-radius:8px;padding:12px;width:100%;margin:8px 0}input{border:1px solid #d8d8cf;background:white;outline-color:" + tone + "}button{border:0;background:" + tone + ";color:white;cursor:pointer}output{display:block;min-height:42px;padding:12px 0;line-height:1.5;color:" + tone + "}</style></head><body><small>EMBEDDED WEBVIEW</small><h1>" + title + "</h1><p>This document has its own viewport, focus and request identity.</p><input aria-label='Message' value='Hello from " + title + "'><button onclick='send()'>Ask native Xu</button><output aria-live='polite'>Ready for an independent native request.</output><p>Tab moves inside this document.<br>Ctrl + Tab returns to the native controls.</p><script>async function send(){let out=document.querySelector('output');out.textContent='Waiting…';try{out.textContent=await window.__XU__.invoke('echo',document.querySelector('input').value)}catch(e){out.textContent=e.message}}</script></body></html>"
}
fn route(request webview.InvokeRequest) string {
    target := request.target() or(err) { << "Target closed: " + err.msg()}
    script := "document.title"
    options := ui.RequestOptions{timeout_ms: 3000}
    result := ui.webview_request_wait(&target, ui.REQUEST_WEBVIEW_EVAL, &script, &options) or(err) { << err.msg()}
    << result.value + " · " + request.payload + " · view " + str(target.canvas_id)
}
fn ipc(events chan ui.Event, emits chan string) {
    webview.bind_ipc_requests_www(":mem:", route, emits, events) or(err) {eprintln(err.msg())
        << }
}
fn scene(events chan ui.Event) int {
    ready := demo.ready(events) or >>
    if ready.kind == ui.EV_EXIT{ << 0}
    $screen := widgets.screen(&ready) or >>
    screen.resize(1020.0, 720.0) or >>
    screen.set_min_size(760, 580) or >>
    title := screen.label("Web content. Native composition.", 26.0, false) or >>
    subtitle := screen.label("Two independent WebViews inside a Canvas window", 13.0, true) or >>
    hide := screen.button("Hide left") or >>
    reload := screen.button("Reload right") or >>
    close := screen.button("Dispose left") or >>
    modal_button := screen.button("Open modal") or >>
    left := screen.webview() or >>
    right := screen.webview() or >>
    status := screen.label("Resize the window, edit both pages, or test their native requests.", 13.0, true) or >>
    modal := screen.modal("Native overlay", "The WebViews resume when this dialog closes.") or >>
    dismiss := screen.button("Close dialog") or >>
    screen.set_parent(dismiss, modal) or >>
    screen.place(dismiss, 24.0, 175.0, 180.0, 38.0) or >>
    screen.load_web_html(left, document("Editor preview", "#b64c3c")) or >>
    screen.load_web_html(right, document("Reference panel", "#386f6b")) or >>
    $model := Model{left: left, right: right, hide: hide, close: close, status: status, modal: modal, hidden: false, disposed: false}
    $dispatcher := widgets.action_dispatcher(&model, &screen)
    dispatcher.on(hide, widgets.ACTION_ACTIVATE, toggle_left) or >>
    dispatcher.on(reload, widgets.ACTION_ACTIVATE, reload_right) or >>
    dispatcher.on(close, widgets.ACTION_ACTIVATE, dispose_left) or >>
    dispatcher.on(modal_button, widgets.ACTION_ACTIVATE, open_modal) or >>
    dispatcher.on(dismiss, widgets.ACTION_ACTIVATE, close_modal) or >>
    for id in[left, right] {
        dispatcher.on(id, widgets.ACTION_WEB_LOADED, web_loaded) or >>
        dispatcher.on(id, widgets.ACTION_WEB_FAILED, web_failed) or >>
    }
    while screen.is_open() {
        width := screen.width()
        height := screen.height()
        half :=(width - 76.0) * 0.5
        screen.place(title, 28.0, 25.0, width - 56.0, 38.0) or >>
        screen.place(subtitle, 28.0, 69.0, width - 56.0, 25.0) or >>
        screen.place(hide, 28.0, 112.0, 136.0, 38.0) or >>
        screen.place(reload, 174.0, 112.0, 146.0, 38.0) or >>
        screen.place(close, 330.0, 112.0, 136.0, 38.0) or >>
        screen.place(modal_button, 476.0, 112.0, 136.0, 38.0) or >>
        screen.place(left, 28.0, 174.0, half, math.max(300.0, height - 245.0)) or >>
        screen.place(right, 48.0 + half, 174.0, half, math.max(300.0, height - 245.0)) or >>
        screen.place(status, 28.0, height - 49.0, width - 56.0, 28.0) or >>
        _ := screen.render() or >>
        for action in screen.next(events) or >> {
            _ := dispatcher.dispatch(&action, $&model, $&screen) or >>
        }
    }
    screen.dispose()
    << 0
}
fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
        << }}
fn launch() int {
    $app := demo.app("XUUI / WebView Components", 1020, 720) or >>
    _ := ui.register_content_plugin(ui.content_plugin_webview())
    emits := chan string {cap: 64}
    xu ipc(app.event_ch, emits)
    xu worker(app.event_ch)
    << app.run() or >>
}
fn main() int { << launch() or(err) {eprintln(err.msg())
        << 1}}
Xuevents.xu
@main

#ui
#ui/widgets

struct Model{left int
    right int
    hide int
    close int
    status int
    modal int
    hidden bool
    disposed bool}
fn toggle_left(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    if m.disposed{ << ""}
    m.hidden = !m.hidden
    screen.set_visible(m.left, !m.hidden) or(err) { << err.msg()}
    if m.hidden{screen.set_text(m.hide, "Show left") or(err) { << err.msg()}} else {screen.set_text(m.hide, "Hide left") or(err) { << err.msg()}}
    << ""
}
fn reload_right(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    screen.webview_command(m.right, "reload") or(err) { << err.msg()}
    << ""
}
fn dispose_left(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    if m.disposed{ << ""}
    screen.close_webview(m.left) or(err) { << err.msg()}
    m.disposed = true
    screen.set_enabled(m.hide, false) or(err) { << err.msg()}
    screen.set_enabled(m.close, false) or(err) { << err.msg()}
    << ""
}
fn open_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    screen.open(m.modal) or(err) { << err.msg()}
    << ""
}
fn close_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    screen.close_overlay(m.modal) or(err) { << err.msg()}
    << ""
}
fn web_loaded(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    screen.set_text(m.status, "WebView " + str(action.id) + " loaded independently") or(err) { << err.msg()}
    << ""
}
fn web_failed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    screen.set_text(m.status, "WebView " + str(action.id) + " failed to load") or(err) { << err.msg()}
    << ""
}
16_ui_webview/xacp_screen/main.xu

所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu

Xumain.xu
@main

#ui
#ui/widgets
#xacp
#errors

demo #"github.com/xulang-org/examples/ui_demo"

struct Model{
    label_id int
    count int
}

fn (m $&Model) layout(s $&widgets.Screen) int {
    s.place(m.label_id, 32.0, 36.0, 540.0, 44.0) or >>
    << 0
}

fn inspect_screen(s $&widgets.Screen) int {
    $session := xacp.open_session()
    // The in-process adapter follows the current session lifecycle too.
    // This token belongs only to this local demonstration; no listener is opened.
    permissions := xacp.PERM_UI_READ | xacp.PERM_UI_MUTATE
    limits := xacp.default_limits()
    $nonces := xacp.new_nonce_registry(8, true)
    hello := xacp.parse_frame("id: !i 1\nop: xacp.hello\nargs:\n  ver: !ver 1.0.0\n  nonce: local-screen-demo\n  token: local-screen-demo\n  permissions: !i " + str(permissions) + "\n") or(err) {
        xacp.close_session($&session)
        >> err
    }
    opened := xacp.dispatch_with_token($&session, &hello, &limits, "local-screen-demo", $&nonces)
    if !opened.ok{
        xacp.close_session($&session)
        >> errors.new("xacp_screen: " + opened.err_msg)
    }
    tree := xacp.ui_tree(& * s, $&session, 2, false, 0, 32, &limits) or(err) {
        xacp.close_session($&session)
        >> err
    }
    println("XACP ui.tree: " + str(tree.nodes.len) + " visible nodes")
    for node in tree.nodes{
        println("  #" + str(node.id) + " kind=" + str(node.kind) + " " + node.text)
    }

    $snapshot := xacp.ui_screenshot(& * s, $&session, 3, 1.0, &limits) or(err) {
        xacp.close_session($&session)
        >> err
    }
    println("XACP ui.screenshot: " + str(snapshot.pixel_width) + "x" + str(snapshot.pixel_height) + " pixels")
    snapshot.dispose() or(err) {
        xacp.close_session($&session)
        >> err
    }

    _ := xacp.ui_act(& * s, $&session, 2, 4, "focus", "", false, &limits) or(err) {
        xacp.close_session($&session)
        >> err
    }
    xacp.close_session($&session)
    << 0
}

fn scene(events chan ui.Event) int {
    ready := demo.ready(events) or >>
    if ready.kind == ui.EV_EXIT{ << 0}
    $screen := widgets.screen(&ready) or >>
    screen.resize(640.0, 180.0) or >>
    label_id := screen.label("XACP Screen adapter", 22.0, false) or >>
    button_id := screen.button("Activate locally or through ui.act") or >>
    screen.place(label_id, 32.0, 36.0, 540.0, 44.0) or >>
    screen.place(button_id, 32.0, 96.0, 360.0, 40.0) or >>
    inspect_screen($&screen) or(err) {
        screen.dispose()
        >> err
    }
    $model := Model{label_id: label_id, count: 0}
    $actions := widgets.action_dispatcher(&model, &screen)
    actions.on(button_id, widgets.ACTION_ACTIVATE, activate) or >>
    actions.set_fallback(global_key)
    << widgets.run_screen_actions($&screen, events, $&model, layout_action, &actions) or >>
}

fn worker(events chan ui.Event) {
    scene(events) or(err) {demo.fail(err.msg())
        << }
}

fn launch() int {
    $app := demo.app("Xu / XACP Screen adapter", 640, 180) or >>
    xu worker(app.event_ch)
    << app.run() or >>
}

fn main() int {
    << launch() or(err) {eprintln(err.msg())
        << 1}
}
Xuevents.xu
@main

#ui
#ui/widgets

fn activate(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    m.count += 1
    screen.set_text(m.label_id, "Button actions: " + str(m.count)) or(err) { << err.msg()}
    << ""
}
fn global_key(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
    if action.kind == widgets.ACTION_KEY && int(action.value) == ui.KEY_ESCAPE{screen.close() or(err) { << err.msg()}}
    << ""
}
fn layout_action(m $&Model, screen $&widgets.Screen) string {
    m.layout(screen) or(err) { << err.msg()}
    << ""
}
更多相关示例
  • 16_ui_webview/controls_gallery/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu · style.xu

    Xumain.xu
    @main
    #ui
    #ui/draw
    #ui/layout
    #ui/widgets
    demo #"github.com/xulang-org/examples/ui_demo"
    
    fn rect(x f64, y f64, width f64, height f64) layout.Rect{
        << layout.Rect{x: x, y: y, width: width, height: height}
    }
    
    // One worker owns the controls and their canvas resources. Every recorded
    // label remains alive until the complete frame has been accepted.
    fn scene(ech chan ui.Event) int {
        ready := demo.ready(ech) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        identity := ui.canvas_of(&ready) or >>
        context := draw.context_of(&ready) or >>
        $switcher := widgets.style_switcher()
        switcher.use_preset(widgets.THEME_LIGHT) or >>
        $toggle := widgets.switch_control(&identity, 1, &rect(48.0, 116.0, 280.0, 48.0), true) or >>
        $radio := widgets.radio(&identity, 2, &rect(48.0, 180.0, 280.0, 48.0), 1, false) or >>
        $slider := widgets.slider(&identity, 3, &rect(48.0, 260.0, 280.0, 36.0), 0.0, 100.0, 50.0) or >>
        slider.set_step(5.0) or >>
        $stepper := widgets.stepper(&identity, 4, &rect(48.0, 324.0, 280.0, 48.0), 0.0, 20.0, 1.0, 5.0) or >>
        $tabs := widgets.tabs(&identity, 5, &rect(376.0, 116.0, 348.0, 48.0), 3, 0) or >>
        $dropdown := widgets.select_box(&identity, 6, &rect(376.0, 196.0, 348.0, 48.0), 3, 0) or >>
        $list := widgets.list_box(&identity, 7, &rect(376.0, 284.0, 348.0, 132.0), 3, 0) or >>
        panel := widgets.card(&rect(24.0, 92.0, 724.0, 352.0)) or >>
        badge := widgets.badge(&rect(48.0, 392.0, 280.0, 32.0)) or >>
        divider := widgets.divider(&rect(48.0, 244.0, 280.0, 2.0), widgets.AXIS_HORIZONTAL) or >>
        $label0 := widgets.styled_label(&context, &"Enabled")
        $label1 := widgets.styled_label(&context, &"Choose this option")
        $label2 := widgets.styled_label(&context, &"Stepper")
        $label3 := widgets.styled_label(&context, &"One")
        $label4 := widgets.styled_label(&context, &"Two")
        $label5 := widgets.styled_label(&context, &"Three")
        $label6 := widgets.styled_label(&context, &"Select an option")
        $label7 := widgets.styled_label(&context, &"Xu 0.10.2")
        $label8 := widgets.styled_label(&context, &"One")
        $label9 := widgets.styled_label(&context, &"Two")
        $label10 := widgets.styled_label(&context, &"Three")
        $frame := context.new_frame(16384)
        $state := Model{dirty: true, focus: 0}
        $dispatcher := widgets.action_dispatcher(&state, &switcher)
        for id in 1:8 {dispatcher.on_any(id, control_action) or >> }
        while true {
            if state.dirty{
                styles := switcher.styles()
                frame.begin() or >>
                frame.set_bg(styles.background) or >>
                panel.paint_styled($&frame, &styles) or >>
                ink := styles.button.palette.foreground
                title := "Extended controls / " + switcher.name()
                frame.text(32.0, 28.0, 22.0, ink, &title) or >>
                toggle.paint_styled($&frame, $&label0, &styles) or >>
                radio.paint_styled($&frame, $&label1, &styles) or >>
                divider.paint_styled($&frame, &styles) or >>
                slider.paint_styled($&frame, &styles) or >>
                stepper.paint_styled($&frame, $&label2, &styles) or >>
                tabs.paint_box_styled($&frame, &styles) or >>
                list.paint_box_styled($&frame, &styles) or >>
                tabs.paint_tab_styled($&frame, 0, $&label3, &styles) or >>
                list.paint_item_styled($&frame, 0, $&label8, &styles) or >>
                tabs.paint_tab_styled($&frame, 1, $&label4, &styles) or >>
                list.paint_item_styled($&frame, 1, $&label9, &styles) or >>
                tabs.paint_tab_styled($&frame, 2, $&label5, &styles) or >>
                list.paint_item_styled($&frame, 2, $&label10, &styles) or >>
                dropdown.paint_styled($&frame, $&label6, &styles) or >>
                badge.paint_styled($&frame, $&label7, &styles) or >>
                frame.text(32.0, 464.0, 15.0, ink, &"T: theme / S: text size / D: density / Tab: focus / Esc: quit") or >>
                status := "Slider " + str(int(slider.value())) + " / Stepper " + str(int(stepper.value())) + " / Select " + str(dropdown.selected() + 1)
                frame.text(32.0, 494.0, 15.0, ink, &status) or >>
                // A Select popup overlays the scene; this basic painter repeats
                // its label. The selected option index is shown in the status.
                dropdown.paint_popup_styled($&frame, $&label6, &styles) or >>
                // This worker can repaint for a burst of control and appearance actions.
                frame.present_wait() or >>
                toggle.painted()
                radio.painted()
                slider.painted()
                stepper.painted()
                tabs.painted()
                dropdown.painted()
                list.painted()
                state.dirty = false
            }
            event := demo.next(ech)
            if event.kind == ui.EV_EXIT{ <- }
            if event.window_id != identity.window_id{ -> }
            if event.kind == ui.EV_CANVAS_CLOSED{ <- }
            if event.kind == ui.EV_CANVAS_METRICS{state.dirty = true}
            if ui.is_input_event(event.kind) {
                input := ui.input_of(&event) or >>
                if input.generation != identity.generation{ -> }
                if input.kind == ui.EV_KEY_DOWN && input.repeat == 0 {
                    if input.key == ui.KEY_ESCAPE{
                        // App shutdown revokes canvas resources. Do not enqueue
                        // another frame while the native host is closing.
                        demo.quit() or >>
                        << 0
                    }
                    if appearance_key($&switcher, &input) or >> {state.dirty = true}
                    if input.key == ui.KEY_TAB{state.focus = state.focus % 7 + 1
                        state.dirty = true}
                }
            }
            // Route the popup first. A modal option click must not also focus
            // or activate the ListBox underneath it.
            popup_open := dropdown.is_open()
            first := dropdown.event(&event) or >>
            $actions :=[first]
            if !popup_open && !first.consumed{
                actions.push(toggle.event(&event) or >>)
                actions.push(radio.event(&event) or >>)
                actions.push(slider.event(&event) or >>)
                actions.push(stepper.event(&event) or >>)
                actions.push(tabs.event(&event) or >>)
                actions.push(list.event(&event) or >>)
            }
            for action in actions{
                if !(dispatcher.dispatch(&action, $&state, $&switcher) or >>) {
                    // ACTION_NONE may carry focus/repaint metadata without a semantic event.
                    action_state($&state, &action)
                }
            }
            toggle.set_focus(state.focus == 1)
            radio.set_focus(state.focus == 2)
            slider.set_focus(state.focus == 3)
            stepper.set_focus(state.focus == 4)
            tabs.set_focus(state.focus == 5)
            dropdown.set_focus(state.focus == 6)
            list.set_focus(state.focus == 7)
        }
        frame.dispose()
        if demo.alive(&identity) {
            label0.dispose()
            label1.dispose()
            label2.dispose()
            label3.dispose()
            label4.dispose()
            label5.dispose()
            label6.dispose()
            label7.dispose()
            label8.dispose()
            label9.dispose()
            label10.dispose()
        }
        << 0
    }
    fn worker(ech chan ui.Event) {
        scene(ech) or(err) {demo.fail(err.msg())
            << }
    }
    fn launch() int {
        $app := demo.app("Xu UI / Extended Controls", 780, 552) or >>
        xu worker(app.event_ch)
        << app.run() or >>
    }
    fn main() int {
        << launch() or(err) {eprintln(err.msg())
            << 1}
    }
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    
    struct Model{dirty bool
        focus int}
    fn action_state(m $&Model, action &widgets.Action) {
        if action.request_focus{m.focus = action.id}
        if action.needs_paint{m.dirty = true}
    }
    fn control_action(m $&Model, switcher $&widgets.StyleSwitcher, action &widgets.Action) string {
        action_state(m, action)
        << ""
    }
    Xustyle.xu
    @main
    
    #ui
    #ui/widgets
    
    fn appearance_key(switcher $&widgets.StyleSwitcher, input &ui.InputEvent) bool {
        if input.key == 84 || input.key == 116 {switcher.next() or >>
            << true}
        if input.key == 83 || input.key == 115 {
            $scale := 1.4
            if switcher.text_scale() > 1.0 {scale = 1.0}
            switcher.set_text_scale(scale) or >>
            << true
        }
        if input.key == 68 || input.key == 100 {
            $density := 0.85
            if switcher.density() < 1.0 {density = 1.0}
            switcher.set_density(density) or >>
            << true
        }
        << false
    }
  • 16_ui_webview/component_catalog/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu · style.xu

    Xumain.xu
    @main
    #ui
    #ui/widgets
    #ui/draw
    #time
    #math
    demo #"github.com/xulang-org/examples/ui_demo"
    
    // The model contains business choices and screen-local handles only.
    struct Model{
        page int
        theme int
        text_scale f64
        density f64
        appearance_dirty bool
        nav []int
        settings []int
        pages []int
        headings []int
        captions []int
        table int
        tree int
        pager int
        crumbs int
        combo int
        multi int
        color int
        spinner int
        overlay_buttons []int
        popover int
        modal int
        modal_actions []int
        value_label int
        note int
    }
    fn (m &Model) fill_table(screen $&widgets.Screen) int {
        names :=["Compiler", "Widgets", "Runtime", "Desktop", "Examples", "Tooling"]
        states :=["Ready", "Review", "Ready", "Draft", "Ready", "Review"]
        clocks :=["10:30", "11:15", "09:40", "12:00", "10:05", "08:50"]
        $order :=[0, 1, 2, 3, 4, 5]
        col := screen.sort_column(m.table) or >>
        if col == 0 {order =[0, 3, 4, 2, 5, 1]}
        if col == 1 {order =[3, 0, 2, 4, 1, 5]}
        if col == 2 {order =[5, 2, 4, 0, 1, 3]}
        desc := screen.sort_descending(m.table) or >>
        page :=(screen.selected(m.pager) or >>) + 1
        for row in 0:6 {
            $slot := row
            if desc{slot = 5 - row}
            i := order[slot]
            screen.set_cell(m.table, row, 0, names[i] + " / " + str(page)) or >>
            screen.set_cell(m.table, row, 1, states[i]) or >>
            screen.set_cell(m.table, row, 2, clocks[i]) or >>
        }
        << 0
    }
    fn (m $&Model) layout(screen $&widgets.Screen) int {
        width := screen.width()
        height := screen.height()
        row := screen.row_height()
        for i in 0:3 {
            screen.place(m.nav[i], 28.0 + f64(i) * 124.0, 142.0, 112.0, row) or >>
            screen.set_selected_button(m.nav[i], m.page == i) or >>
            screen.set_visible(m.pages[i], m.page == i) or >>
            screen.place(m.settings[i], width - 420.0 + f64(i) * 132.0, 142.0, 120.0, row) or >>
        }
        screen.place(m.headings[0], 28.0, 26.0, width - 56.0, 24.0) or >>
        screen.place(m.headings[1], 28.0, 61.0, width - 56.0, 46.0) or >>
        screen.place(m.headings[2], 28.0, 108.0, width - 56.0, 30.0) or >>
        screen.place(m.crumbs, 28.0, 204.0, width - 56.0, row) or >>
        screen.place(m.note, 28.0, height - 48.0, width - 56.0, 30.0) or >>
        content := math.max(160.0, height - 420.0)
        screen.place(m.captions[0], 28.0, 253.0, width * 0.62 - 40.0, 30.0) or >>
        screen.place(m.captions[1], width * 0.62 + 12.0, 253.0, width * 0.38 - 40.0, 30.0) or >>
        screen.place(m.table, 28.0, 280.0, width * 0.62 - 40.0, content) or >>
        screen.place(m.tree, width * 0.62 + 12.0, 280.0, width * 0.38 - 40.0, content) or >>
        screen.place(m.pager, 28.0, height - 118.0, 380.0, row) or >>
        screen.place(m.captions[2], 28.0, 253.0, 400.0, 30.0) or >>
        screen.place(m.captions[3], 28.0, 363.0, 400.0, 30.0) or >>
        screen.place(m.captions[4], 450.0, 253.0, width - 478.0, 30.0) or >>
        screen.place(m.combo, 28.0, 280.0, 370.0, row) or >>
        screen.place(m.multi, 28.0, 390.0, 370.0, row) or >>
        screen.place(m.color, 450.0, 280.0, width - 478.0, 240.0) or >>
        screen.place(m.spinner, 28.0, 562.0, 28.0, 28.0) or >>
        screen.place(m.captions[5], 70.0, 568.0, width - 98.0, 30.0) or >>
        screen.place(m.value_label, 28.0, 620.0, width - 56.0, 36.0) or >>
        screen.place(m.captions[6], 28.0, 253.0, width - 56.0, 30.0) or >>
        for i in 0:4 {screen.place(m.overlay_buttons[i], 28.0 + f64(i) * 208.0, 280.0, 190.0, row) or >>
            screen.place(m.captions[i + 7], 28.0, 365.0 + f64(i) * 40.0, width - 56.0, 32.0) or >> }
        screen.place(m.modal_actions[0], 24.0, 210.0, 194.0, row) or >>
        screen.place(m.modal_actions[1], 234.0, 210.0, 194.0, row) or >>
        << 0
    }
    fn new_model(screen $&widgets.Screen) Model{
        $nav :=[]int {}
        for text in["Data", "Inputs", "Overlays"] {nav.push(screen.button(text) or >>)}
        $settings :=[]int {}
        for text in["Theme", "Text size", "Density"] {settings.push(screen.button(text) or >>)}
        $pages :=[]int {}
        for i in 0:3 {pages.push(screen.group() or >>)}
        headings :=[screen.label("XUUI / COMPONENT CATALOG", 12.0, true) or >>,
        screen.label("Native components, working together.", 26.0, false) or >>,
        screen.label("Keyboard, pointer, themes, typography and density — managed by Screen.", 13.0, true) or >>]
        crumbs := screen.breadcrumbs(&["Workspace", "UI", "Component catalog"]) or >>
        note := screen.label("Choose a category · Tab / Shift+Tab · Escape", 13.0, true) or >>
        table := screen.table(&["Module", "State", "Updated"], 6, 0) or >>
        tree := screen.tree() or >>
        pager := screen.pagination(3, 0) or >>
        combo := screen.combo_box(&["Compiler", "Widgets", "Runtime", "Desktop", "Examples", "工具链"], "") or >>
        multi := screen.multi_select(&["Native", "Keyboard", "IME", "Theming", "Motion"]) or >>
        screen.set_checked(multi, 0, true) or >>
        color := screen.color_picker(draw.rgba(59, 130, 246, 220)) or >>
        spinner := screen.spinner() or >>
        value_label := screen.label("Value:    Selected tags: 1", 14.0, false) or >>
        $overlay_buttons :=[]int {}
        for text in["Open popover", "Open modal", "Show toast", "Hover / focus me"] {overlay_buttons.push(screen.button(text) or >>)}
        popover := screen.popover(overlay_buttons[0], "An anchored panel for related actions.") or >>
        modal := screen.modal("Keep focus where it belongs", "Screen owns focus, input isolation and restoration.") or >>
        _ := screen.tooltip(overlay_buttons[3], "Pointer and keyboard share this hint.") or >>
        modal_actions :=[screen.button("Complete action") or >>, screen.button("Close") or >>]
        for id in modal_actions{screen.set_parent(id, modal) or >> }
        $captions :=[]int {}
        for text in["TABLE / sort columns · select rows · scroll", "TREE / expand · navigate",
        "COMBO BOX / type to filter · native IME", "MULTI SELECT / independent choices",
        "COLOR PICKER / red · green · blue · alpha", "Loading indicator · respects reduced motion",
        "OVERLAYS / anchor placement · focus ownership · timed feedback",
        "Popover: anchored to its trigger and constrained to the canvas.",
        "Modal: Tab stays inside; Escape closes; focus returns to the trigger.",
        "Toast: closes automatically; hover or focus pauses its lifetime.",
        "Tooltip: hover or keyboard focus reveals a delayed explanation."] {captions.push(screen.label(text, 13.0, true) or >>)}
        for id in[table, tree, pager, captions[0], captions[1]] {screen.set_parent(id, pages[0]) or >> }
        for id in[combo, multi, color, spinner, value_label, captions[2], captions[3], captions[4], captions[5]] {screen.set_parent(id, pages[1]) or >> }
        for id in overlay_buttons{screen.set_parent(id, pages[2]) or >> }
        screen.set_parent(popover, pages[2]) or >>
        for i in 6:11 {screen.set_parent(captions[i], pages[2]) or >> }
        root := screen.tree_add(tree, - 1, "XU Workspace") or >>
        compiler := screen.tree_add(tree, root, "Compiler") or >>
        _ := screen.tree_add(tree, compiler, "Frontend") or >>
        _ := screen.tree_add(tree, compiler, "Native backend") or >>
        ui_root := screen.tree_add(tree, root, "UI") or >>
        _ := screen.tree_add(tree, ui_root, "Widgets") or >>
        _ := screen.tree_add(tree, ui_root, "Drawing") or >>
        _ := screen.tree_add(tree, root, "Examples") or >>
        for node in[root, compiler, ui_root] {screen.set_expanded(tree, node, true) or >> }
        m := Model{page: 0, theme: 1, text_scale: 1.0, density: 1.0, appearance_dirty: true, nav: nav, settings: settings, pages: pages, headings: headings, captions: captions,
            table: table, tree: tree, pager: pager, crumbs: crumbs, combo: combo, multi: multi, color: color, spinner: spinner,
            overlay_buttons: overlay_buttons, popover: popover, modal: modal, modal_actions: modal_actions, value_label: value_label, note: note}
        m.fill_table(screen) or >>
        << m
    }
    fn scene(events chan ui.Event) int {
        ready := demo.ready(events) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        $screen := widgets.screen(&ready) or >>
        screen.resize(1040.0, 820.0) or >>
        screen.set_min_size(1040, 760) or >>
        $model := new_model($&screen) or(err) {screen.dispose()
            >> err}
        actions := register_actions(&model, &screen) or >>
        << widgets.run_screen_actions($&screen, events, $&model, layout_action, &actions) or >>
    }
    fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
            << }}
    fn launch() int {$app := demo.app("Xu UI / Component Catalog", 1040, 820) or >>
        xu worker(app.event_ch)
        << app.run() or >> }
    fn main() int { << launch() or(err) {eprintln(err.msg())
            << 1}}
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    
    fn page_0(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.page = 0
        << ""
    }
    fn page_1(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.page = 1
        << ""
    }
    fn page_2(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.page = 2
        << ""
    }
    fn choose_theme(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.theme =(m.theme + 1) % 3
        m.appearance_dirty = true
        << ""
    }
    fn choose_scale(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        if m.text_scale == 1.0 {m.text_scale = 1.4} else {m.text_scale = 1.0}
        m.appearance_dirty = true
        << ""
    }
    fn choose_density(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        if m.density == 1.0 {m.density = 0.8} else {m.density = 1.0}
        m.appearance_dirty = true
        << ""
    }
    fn refresh_table(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.fill_table(screen) or(err) { << err.msg()}
        << ""
    }
    fn open_popover(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.open(m.popover) or(err) { << err.msg()}
        << ""
    }
    fn open_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.open(m.modal) or(err) { << err.msg()}
        << ""
    }
    fn notify_theme(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        _ := screen.notify("All components share the same theme.") or(err) { << err.msg()}
        << ""
    }
    fn complete_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.close_overlay(m.modal) or(err) { << err.msg()}
        _ := screen.notify("Action completed.") or(err) { << err.msg()}
        << ""
    }
    fn close_modal(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.close_overlay(m.modal) or(err) { << err.msg()}
        << ""
    }
    fn changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.set_text(m.note, "Value changed · Tab / Shift+Tab · Escape") or(err) { << err.msg()}
        << ""
    }
    fn page_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.fill_table(screen) or(err) { << err.msg()}
        << changed(m, screen, action)
    }
    fn inputs_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        value := screen.text_value(m.combo) or(err) { << err.msg()}
        count :=(screen.values(m.multi) or(err) { << err.msg()}).len
        screen.set_text(m.value_label, "Value: " + value + "    Selected tags: " + str(count)) or(err) { << err.msg()}
        << changed(m, screen, action)
    }
    fn global_key(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        if action.kind == widgets.ACTION_KEY && int(action.value) == ui.KEY_ESCAPE{screen.close() or(err) { << err.msg()}}
        << ""
    }
    fn register_actions(m &Model, screen &widgets.Screen) widgets.ActionDispatcher#Model, widgets.Screen, widgets.Action{
        $d := widgets.action_dispatcher(m, screen)
        d.on(m.nav[0], widgets.ACTION_ACTIVATE, page_0) or >>
        d.on(m.nav[1], widgets.ACTION_ACTIVATE, page_1) or >>
        d.on(m.nav[2], widgets.ACTION_ACTIVATE, page_2) or >>
        d.on(m.settings[0], widgets.ACTION_ACTIVATE, choose_theme) or >>
        d.on(m.settings[1], widgets.ACTION_ACTIVATE, choose_scale) or >>
        d.on(m.settings[2], widgets.ACTION_ACTIVATE, choose_density) or >>
        d.on(m.table, widgets.ACTION_ACTIVATE, refresh_table) or >>
        d.on(m.overlay_buttons[0], widgets.ACTION_ACTIVATE, open_popover) or >>
        d.on(m.overlay_buttons[1], widgets.ACTION_ACTIVATE, open_modal) or >>
        d.on(m.overlay_buttons[2], widgets.ACTION_ACTIVATE, notify_theme) or >>
        d.on(m.modal_actions[0], widgets.ACTION_ACTIVATE, complete_modal) or >>
        d.on(m.modal_actions[1], widgets.ACTION_ACTIVATE, close_modal) or >>
        for id in[m.table, m.tree, m.crumbs, m.color] {d.on(id, widgets.ACTION_CHANGE, changed) or >> }
        d.on(m.pager, widgets.ACTION_CHANGE, page_changed) or >>
        d.on(m.combo, widgets.ACTION_CHANGE, inputs_changed) or >>
        d.on(m.multi, widgets.ACTION_CHANGE, inputs_changed) or >>
        // Screen-wide keys have id 0, outside the by-id control namespace.
        d.set_fallback(global_key)
        << d
    }
    Xustyle.xu
    @main
    
    #ui
    #ui/widgets
    
    fn layout_action(m $&Model, screen $&widgets.Screen) string {
        apply_appearance(m, screen) or(err) { << err.msg()}
        m.layout(screen) or(err) { << err.msg()}
        << ""
    }
    fn apply_appearance(m $&Model, screen $&widgets.Screen) int {
        if !m.appearance_dirty{ << 0}
        $styles := widgets.preset_styles(m.theme) or >>
        styles.text_scale = m.text_scale
        styles.density = m.density
        appearance := widgets.screen_appearance(&styles, screen.reduced_motion()) or >>
        screen.apply_appearance(&appearance) or >>
        m.appearance_dirty = false
        << 0
    }
  • 16_ui_webview/widgets/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu

    Xumain.xu
    @main
    #ui
    #ui/draw
    #ui/layout
    #ui/widgets
    demo #"github.com/xulang-org/examples/ui_demo"
    
    struct Model{
        button widgets.Button
        checkbox widgets.Checkbox
        progress widgets.Progress
        scroll widgets.Scroll
        button_label draw.TextLayout
        checkbox_label draw.TextLayout
        theme widgets.Theme
        context draw.Context
        count int
        header_id int
        button_id int
        check_id int
        progress_id int
        scroll_id int
        row_ids []int
    }
    fn (model $&Model) button_input(kind int, input &ui.InputEvent) widgets.Action{
        button := $&model.button
        << button.route(kind, input) or >>
    }
    fn (model $&Model) checkbox_input(kind int, input &ui.InputEvent) widgets.Action{
        checkbox := $&model.checkbox
        << checkbox.route(kind, input) or >>
    }
    fn (model $&Model) scroll_input(kind int, input &ui.InputEvent) widgets.Action{
        scroll := $&model.scroll
        << scroll.route(kind, input) or >>
    }
    fn (model $&Model) input(id int, kind int, input &ui.InputEvent) widgets.Action{
        if id == model.button_id{ << model.button_input(kind, input) or >> }
        if id == model.check_id{ << model.checkbox_input(kind, input) or >> }
        if id == model.scroll_id{ << model.scroll_input(kind, input) or >> }
        << widgets.Action{kind: widgets.ACTION_NONE, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
    }
    fn (model $&Model) place_button(bounds &layout.Rect) int {
        button := $&model.button
        << button.set_bounds(bounds) or >>
    }
    fn (model $&Model) place_checkbox(bounds &layout.Rect) int {
        checkbox := $&model.checkbox
        << checkbox.set_bounds(bounds) or >>
    }
    fn (model $&Model) place_progress(bounds &layout.Rect) int {
        progress := $&model.progress
        << progress.set_bounds(bounds) or >>
    }
    fn (model $&Model) paint(id int, bounds &layout.Rect, frame $&draw.Frame) bool {
        model.draw_node(id, bounds, frame) or(err) {eprintln(err.msg())
            << false}
        << true
    }
    fn (model $&Model) draw_node(id int, bounds &layout.Rect, frame $&draw.Frame) int {
        if id == model.header_id{
            demo.text(&model.context, frame, 0.0, 0.0, 14.0, demo.accent(), "03 / RETAINED LAYOUT + CONTROLS") or >>
            demo.text(&model.context, frame, 0.0, 28.0, 24.0, demo.ink(), "Actions completed: " + str(model.count)) or >>
        } else if id == model.button_id{
            model.place_button(bounds) or >>
            model.button.paint(frame, &model.button_label, &model.theme) or >>
        } else if id == model.check_id{
            model.place_checkbox(bounds) or >>
            model.checkbox.paint(frame, &model.checkbox_label, &model.theme) or >>
        } else if id == model.progress_id{
            model.place_progress(bounds) or >>
            model.progress.paint(frame, &model.theme) or >>
        } else if id == model.scroll_id{
            scroll := $&model.scroll
            scroll.set_bounds(bounds) or >>
            frame.fill_rect(0.0, 0.0, bounds.width, bounds.height, draw.rgb(26, 37, 50)) or >>
        } else {
            for i in 0:model.row_ids.len{
                if id == model.row_ids[i] {demo.text(&model.context, frame, 12.0, 5.0, 15.0, demo.muted(), "Retained row " + str(i + 1) + " / scroll, Tab, PageDown, Home") or >> }
            }
        }
        << 0
    }
    fn (model $&Model) advance() int {
        model.count = model.count + 1
        println("Action count: " + str(model.count))
        value := f64(model.count % 11) / 10.0
        progress := $&model.progress
        << progress.set_value(value) or >>
    }
    fn (model $&Model) enable_button(enabled bool) {
        button := $&model.button
        button.set_enabled(enabled)
    }
    fn (model $&Model) acknowledge_button() {
        control := $&model.button
        control.painted()
    }
    fn (model $&Model) acknowledge_checkbox() {
        control := $&model.checkbox
        control.painted()
    }
    fn (model $&Model) acknowledge_progress() {
        control := $&model.progress
        control.painted()
    }
    fn (model $&Model) acknowledge_scroll() {
        control := $&model.scroll
        control.painted()
    }
    fn (model $&Model) acknowledge() {
        model.acknowledge_button()
        model.acknowledge_checkbox()
        model.acknowledge_progress()
        model.acknowledge_scroll()
    }
    fn scene(ech chan ui.Event) int {
        ready := demo.ready(ech) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        identity := ui.canvas_of(&ready) or >>
        context := draw.context_of(&ready) or >>
        host := widgets.Host{context: context, identity: identity}
        $column := layout.box_style(layout.BOX_COLUMN)
        column.padding = layout.insets(28.0) or >>
        column.gap = 14.0
        column.cross_alignment = layout.CROSS_STRETCH
        $view := host.view(&column, demo.background()) or >>
        leaf := layout.box_style(layout.BOX_LEAF)
        header := view.add(view.root(), &leaf, &layout.Size{width: 400.0, height: 72.0}) or >>
        button_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 44.0}) or >>
        check_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 40.0}) or >>
        progress_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 12.0}) or >>
        $viewport := layout.box_style(layout.BOX_COLUMN)
        viewport.height = 220.0
        viewport.clip = true
        viewport.cross_alignment = layout.CROSS_STRETCH
        viewport.gap = 6.0
        scroll_id := view.add(view.root(), &viewport, &layout.Size{width: 400.0, height: 220.0}) or >>
        $rows :=[]int {}
        for _ in 0:20 {
            row := view.add(scroll_id, &leaf, &layout.Size{width: 400.0, height: 32.0}) or >>
            rows.push(row)
            view.set_boundary(row, true) or >>
        }
        for id in[header, button_id, check_id, progress_id, scroll_id] {view.set_boundary(id, true) or >> }
        for id in[button_id, check_id, scroll_id] {view.set_input(id, true, true) or >> }
        empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
        options := draw.text_options(15.0)
        first := "Complete one action"
        second := "Enable action button"
        $model := Model{button: widgets.button(&identity, button_id, &empty) or >>,
            checkbox: widgets.checkbox(&identity, check_id, &empty, true) or >>,
            progress: widgets.progress(&empty, 0.0) or >>,
            scroll: widgets.scroll(&identity, scroll_id, &empty, widgets.AXIS_VERTICAL, 760.0) or >>,
            button_label: context.layout_text(&first, &options) or >>,
            checkbox_label: context.layout_text(&second, &options) or >>,
            theme: widgets.default_theme(), context: context, count: 0, header_id: header, button_id: button_id, check_id: check_id, progress_id: progress_id, scroll_id: scroll_id, row_ids: rows}
        dispatcher := register_actions(&model, &view) or >>
        $width := 700.0
        $height := 600.0
        while true {
            constraints := layout.tight(width, height) or >>
            submitted := widgets.present($&view, &constraints, $&model) or >>
            if submitted{model.acknowledge()}
            event := demo.next(ech)
            if event.kind == ui.EV_EXIT{ <- }
            if event.window_id != identity.window_id{ -> }
            if event.kind == ui.EV_CANVAS_METRICS{
                metrics := ui.metrics_of(&event) or >>
                if metrics.width > 0.0 && metrics.height > 0.0 {width = metrics.width
                    height = metrics.height}
            }
            actions := widgets.dispatch_event($&view, &event, $&model) or >>
            for action in actions{_ := dispatcher.dispatch(&action, $&model, $&view) or >> }
            if event.kind == ui.EV_CANVAS_CLOSED{ <- }
            if ui.is_input_event(event.kind) {
                input := ui.input_of(&event) or >>
                if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE{demo.quit() or >> }
            }
            stats := view.stats()
            if stats.recorded_boundaries > 0 || stats.reused_boundaries > 0 {
                println("View: " + str(stats.recorded_boundaries) + " recorded / " + str(stats.reused_boundaries) + " reused boundaries")
            }
        }
        view.dispose()
        // Native close revokes resources; only release user handles while live.
        if demo.alive(&identity) {
            label := $&model.button_label
            label.dispose() or >>
            check_label := $&model.checkbox_label
            check_label.dispose() or >>
        }
        << 0
    }
    fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
            << }}
    fn launch() int {
        $app := demo.app("Xu UI / Retained Controls", 700, 600) or >>
        xu worker(app.event_ch)
        << app.run() or >>
    }
    fn main() int { << launch() or(err) {eprintln(err.msg())
            << 1}}
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    
    fn activate(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        m.advance() or(err) { << err.msg()}
        screen.mark_paint(m.header_id) or(err) { << err.msg()}
        screen.mark_paint(m.progress_id) or(err) { << err.msg()}
        << ""
    }
    fn enable(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        enabled := m.checkbox.value()
        m.enable_button(enabled)
        screen.set_input(m.button_id, enabled, enabled) or(err) { << err.msg()}
        screen.mark_paint(m.button_id) or(err) { << err.msg()}
        << ""
    }
    fn scroll(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        screen.set_scroll(m.scroll_id, 0.0, action.value) or(err) { << err.msg()}
        << ""
    }
    fn register_actions(m &Model, screen &widgets.View) widgets.ActionDispatcher#Model, widgets.View, widgets.Action{
        $d := widgets.action_dispatcher(m, screen)
        d.on(m.button_id, widgets.ACTION_ACTIVATE, activate) or >>
        d.on(m.check_id, widgets.ACTION_CHANGE, enable) or >>
        d.on(m.scroll_id, widgets.ACTION_SCROLL, scroll) or >>
        << d
    }
  • 16_ui_webview/interaction_gallery/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu · style.xu

    Xumain.xu
    @main
    
    #ui
    #ui/widgets
    #ui/layout
    #time
    #math
    #errors
    demo #"github.com/xulang-org/examples/ui_demo"
    
    struct Model{
        tree int
        name int
        search int
        task int
        cancel int
        table int
        theme int
        guides int
        density int
        effects int
        failure int
        message int
        headings []int
        controls_page int
        work_group int
        basic_group int
        extras []int
        show_controls bool
        theme_index int
        guided bool
        compact bool
        reduced bool
        fail_next bool
        appearance_dirty bool
        task_id int
        completed int
        running bool
        checksum int
        next_work time.Instant
    }
    fn make_model(screen $&widgets.Screen) Model{
        $name_decoration := widgets.field_decoration(&"Output name")
        name_decoration.helper = "A persistent label, native text selection and IME"
        name_decoration.error = "Enter an output name before building."
        name_decoration.clearable = true
        name := screen.field("", &name_decoration) or >>
        $search_decoration := widgets.field_decoration(&"Find a component")
        search_decoration.helper = "Matching nodes keep their ancestor path"
        search_decoration.clearable = true
        search := screen.field("", &search_decoration) or >>
        tree := screen.tree() or >>
        root := screen.tree_add(tree, - 1, "xu-workbench") or >>
        src := screen.tree_add(tree, root, "src") or >>
        entry := screen.tree_add(tree, src, "main.xu") or >>
        controls := screen.tree_add(tree, src, "widgets") or >>
        for label in["tree_view.xu", "task_button.xu", "field.xu", "table.xu"] {
            node := screen.tree_add(tree, controls, label) or >>
            screen.set_tree_action(tree, node, true) or >>
        }
        manifest := screen.tree_add(tree, root, "xu.xun") or >>
        screen.set_tree_metadata(tree, entry, "entry") or >>
        screen.set_tree_metadata(tree, manifest, "module") or >>
        for node in[root, src, controls] {screen.set_expanded(tree, node, true) or >> }
        task := screen.task_button("Build project") or >>
        screen.set_task_labels(task, "Building", "Built · run again", "Retry build", "Build again") or >>
        table := screen.table(&["Component", "Experience", "Status"], 18, 0) or >>
        screen.set_table_column(table, 0, 144.0, 0.0) or >>
        screen.set_table_column(table, 1, 340.0, 0.0) or >>
        screen.set_table_column(table, 2, 128.0, 0.0) or >>
        names :=["TreeView", "TaskButton", "Field", "Table", "Select", "Popover"]
        details :=["Find and reveal", "Real task progress", "Floating label / native IME", "Resizable columns", "Keyboard choices", "Anchored feedback"]
        for row in 0:18 {
            index := row % 6
            screen.set_cell(table, row, 0, names[index]) or >>
            screen.set_cell(table, row, 1, details[index]) or >>
            screen.set_cell(table, row, 2, "Ready") or >>
        }
        headings :=[screen.label("XUUI / INTERACTION LAB", 12.0, true) or >>,
        screen.label("Precision in every interaction.", 25.0, false) or >>,
        screen.label("WORKSPACE", 12.0, true) or >>, screen.label("BUILD CONFIGURATION", 12.0, true) or >>,
        screen.label("COMPONENTS / scroll, select and sort", 12.0, true) or >>]
        work_group := screen.group() or >>
        basic_group := screen.group() or >>
        for id in[tree, name, search, task, table, headings[2], headings[3], headings[4]] {screen.set_parent(id, work_group) or >> }
        extras := extra_controls(screen) or >>
        for id in extras{screen.set_parent(id, basic_group) or >> }
        cancel := screen.button("Cancel task") or >>
        screen.set_parent(cancel, work_group) or >>
        controls_page := screen.button("All controls") or >>
        styles := screen.styles()
        primary_style := styles.button_variant(widgets.BUTTON_PRIMARY) or >>
        screen.set_control_style(task, &primary_style) or >>
        << Model{tree: tree, name: name, search: search, task: task, cancel: cancel,
            table: table, theme: screen.button("Theme") or >>, guides: screen.button("Tree guides") or >>,
            density: screen.button("Density") or >>, effects: screen.button("Motion") or >>, failure: screen.button("Fail next build") or >>,
            message: screen.label("Local work batches report completed items. No simulated percentage clock.", 13.0, true) or >>,
            headings: headings, controls_page: controls_page, work_group: work_group, basic_group: basic_group, extras: extras, show_controls: false, theme_index: 1, guided: false, compact: false, reduced: false, fail_next: false, appearance_dirty: true,
            task_id: 0, completed: 0, running: false, checksum: 0, next_work: time.zero_instant()}
    }
    fn (m &Model) layout(screen $&widgets.Screen) int {
        width := screen.width()
        height := screen.height()
        left := 310.0
        screen.place(m.headings[0], 28.0, 24.0, width - 56.0, 22.0) or >>
        screen.place(m.headings[1], 28.0, 54.0, width - 56.0, 36.0) or >>
        buttons :=[m.theme, m.guides, m.density, m.effects, m.failure, m.controls_page]
        for i in 0:buttons.len{screen.place(buttons[i], 28.0 + f64(i) * 144.0, 111.0, 132.0, 36.0) or >> }
        screen.set_visible(m.work_group, !m.show_controls) or >>
        screen.set_visible(m.basic_group, m.show_controls) or >>
        screen.set_selected_button(m.controls_page, m.show_controls) or >>
        extra_layout(screen, &m.extras) or >>
        screen.set_selected_button(m.guides, m.guided) or >>
        screen.set_selected_button(m.effects, m.reduced) or >>
        screen.set_selected_button(m.failure, m.fail_next) or >>
        screen.place(m.headings[2], 28.0, 173.0, left - 24.0, 24.0) or >>
        screen.place(m.search, 28.0, 208.0, left - 24.0, 80.0) or >>
        screen.place(m.tree, 28.0, 302.0, left - 24.0, height - 352.0) or >>
        x := left + 36.0
        right_width := width - x - 28.0
        screen.place(m.headings[3], x, 173.0, right_width, 24.0) or >>
        screen.place(m.name, x, 208.0, right_width, 86.0) or >>
        screen.place(m.task, x, 307.0, 230.0, 40.0) or >>
        screen.place(m.cancel, x + 246.0, 307.0, 136.0, 40.0) or >>
        screen.set_enabled(m.cancel, m.running) or >>
        screen.place(m.headings[4], x, 377.0, right_width, 24.0) or >>
        screen.place(m.table, x, 413.0, right_width, height - 493.0) or >>
        screen.place(m.message, 28.0, height - 41.0, width - 56.0, 24.0) or >>
        << 0
    }
    fn (m $&Model) work(screen $&widgets.Screen, now time.Instant) int {
        if !m.running || now.before(m.next_work) { << 0}
        // Each progress update follows an actual bounded work batch. The pause
        // represents an application work queue and never changes the percentage.
        for i in 0:5000 {m.checksum =(m.checksum + i *(m.completed + 1)) % 1000003}
        m.completed = m.completed + 1
        _ := screen.set_task_progress(m.task, m.task_id, f64(m.completed) / 48.0) or >>
        m.next_work = now.add(time.milliseconds(35) or >>) or >>
        if m.fail_next && m.completed == 18 {
            _ := screen.complete_task(m.task, m.task_id, widgets.TASK_ERROR) or >>
            m.running = false
            m.fail_next = false
            screen.set_text(m.message, "Example failure. Retry starts a new task; stale progress is rejected.") or >>
        } else if m.completed == 48 {
            _ := screen.complete_task(m.task, m.task_id, widgets.TASK_SUCCESS) or >>
            m.running = false
            screen.set_text(m.message, "48/48 work batches completed · checksum " + str(m.checksum)) or >>
        }
        << 0
    }
    fn extra_controls(screen $&widgets.Screen)[]int {
        $ids :=[]int {}
        ids.push(screen.card() or >>)
        ids.push(screen.label("CONTROLS / keyboard, pointer and state", 12.0, true) or >>)
        ids.push(screen.checkbox("Keep generated files", true) or >>)
        ids.push(screen.switch_control("Live preview", true) or >>)
        ids.push(screen.radio("Use workspace settings", 1, true) or >>)
        ids.push(screen.slider(0.0, 100.0, 40.0) or >>)
        ids.push(screen.stepper(1.0, 16.0, 1.0, 4.0) or >>)
        ids.push(screen.tabs(&["Files", "History", "Output"], 0) or >>)
        ids.push(screen.segmented(&["Desktop", "Tablet", "Phone"], 0) or >>)
        ids.push(screen.select_box(&["Xu source", "Configuration", "Plain text"], 0) or >>)
        ids.push(screen.list_box(&["Compiler", "Widgets", "Runtime", "Desktop", "Examples", "Tooling"], 0) or >>)
        ids.push(screen.progress(0.62) or >>)
        ids.push(screen.badge("Ready") or >>)
        ids.push(screen.divider(widgets.AXIS_HORIZONTAL) or >>)
        ids.push(screen.radio_group(&["Use local build", "Use cached build", "Build dependencies"], 0) or >>)
        ids.push(screen.input("Native input · 中文") or >>)
        ids.push(screen.text_area("A multi-line editor.\nSelection, clipboard and native IME remain available.") or >>)
        ids.push(screen.date_picker(time.date(2026, 10, 25, 10, 30, 0, 0)) or >>)
        ids.push(screen.time_picker(time.date(2026, 10, 25, 10, 30, 0, 0)) or >>)
        ids.push(screen.button("Queue notification") or >>)
        _ := screen.tooltip(ids[19], "Repeated notifications queue; hover or focus pauses expiry.") or >>
        screen.set_slider_commit_only(ids[5], true) or >>
        screen.set_checkbox_indeterminate(ids[2], true) or >>
        screen.set_select_option_enabled(ids[9], 2, false) or >>
        screen.set_badge_tone(ids[12], widgets.BADGE_SUCCESS) or >>
        screen.set_progress_buffer(ids[11], 0.84) or >>
        screen.set_date_options(ids[17], time.date(2026, 10, 25, 0, 0, 0, 0), true) or >>
        screen.set_clock_format(ids[18], true, true) or >>
        << ids
    }
    fn extra_layout(screen $&widgets.Screen, ids &[]int) int {
        gap := 28.0
        width :=(screen.width() - 84.0) * 0.5
        right := 56.0 + width
        screen.place(ids[0], gap, 628.0, width, 112.0) or >>
        screen.place(ids[1], gap, 173.0, screen.width() - 56.0, 24.0) or >>
        for i in 2:5 {screen.place(ids[i], gap, 211.0 + f64(i - 2) * 46.0, width, 36.0) or >> }
        screen.place(ids[5], gap, 357.0, width - 136.0, 36.0) or >>
        screen.place(ids[6], gap + width - 124.0, 357.0, 124.0, 36.0) or >>
        screen.place(ids[7], gap, 412.0, width, 36.0) or >>
        screen.place(ids[8], gap, 466.0, width, 36.0) or >>
        screen.place(ids[11], gap, 522.0, width - 120.0, 12.0) or >>
        screen.place(ids[12], gap + width - 100.0, 510.0, 100.0, 32.0) or >>
        screen.place(ids[13], gap, 607.0, width, 1.0) or >>
        screen.place(ids[14], right, 211.0, width, 126.0) or >>
        screen.place(ids[9], right, 357.0, width, 36.0) or >>
        screen.place(ids[10], right, 412.0, width, 158.0) or >>
        screen.place(ids[15], right, 590.0, width, 36.0) or >>
        screen.place(ids[16], right, 644.0, width, 96.0) or >>
        screen.place(ids[17], gap, 560.0,(width - 16.0) * 0.5, 36.0) or >>
        screen.place(ids[18], gap +(width + 16.0) * 0.5, 560.0,(width - 16.0) * 0.5, 36.0) or >>
        screen.place(ids[19], gap + 16.0, 665.0, width - 32.0, 38.0) or >>
        << 0
    }
    fn next_event(events chan ui.Event, deadline time.Instant) ui.Event{
        if deadline.is_zero() { << <- events}
        delay := deadline.since(time.instant())
        if delay.nanoseconds() <= 0 { << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}}
        timer := delay.timer()
        select {
            event := <- events{timer.stop()
                << event}
            _ := <- timer.c{timer.stop()}
        }
        << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
    }
    fn scene(events chan ui.Event) int {
        ready := demo.ready(events) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        $screen := widgets.screen(&ready) or >>
        screen.resize(1000.0, 820.0) or >>
        screen.set_min_size(900, 720) or >>
        $model := make_model($&screen) or(err) {screen.dispose()
            >> err}
        apply_appearance($&model, $&screen) or >>
        model.layout($&screen) or >>
        _ := screen.render() or >>
        $dispatcher := register_actions(&model, &screen) or >>
        while screen.is_open() {
            now := time.instant()
            apply_appearance($&model, $&screen) or >>
            register_notices(&screen, $&dispatcher) or >>
            model.work($&screen, now) or >>
            model.layout($&screen) or >>
            $deadline := screen.advance(now) or(err) { >> errors.new("gallery animation: " + err.msg())}
            for action in screen.take_actions() {_ := dispatcher.dispatch(&action, $&model, $&screen) or >> }
            apply_appearance($&model, $&screen) or >>
            _ := screen.render() or(err) { >> errors.new("gallery render: " + err.msg())}
            if model.running &&(deadline.is_zero() || model.next_work.before(deadline)) {deadline = model.next_work}
            event := next_event(events, deadline) or >>
            $actions := screen.event(&event) or >>
            $count := 0
            while screen.is_open() && count < 128 {
                pending := ui.poll_chan(events)
                if pending.kind == ui.EV_NONE{ <- }
                more := screen.event(&pending) or >>
                for action in more{actions.push(action)}
                count += 1
            }
            for action in actions{_ := dispatcher.dispatch(&action, $&model, $&screen) or >> }
        }
        screen.dispose()
        << 0
    }
    fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
            << }}
    fn launch() int {
        $app := demo.app("XUUI / Interaction Lab", 1000, 820) or >>
        xu worker(app.event_ch)
        << app.run() or >>
    }
    fn main() int { << launch() or(err) {eprintln(err.msg())
            << 1}}
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    #time
    
    fn search_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        query := screen.text_value(m.search) or(err) { << err.msg()}
        screen.set_tree_filter(m.tree, query) or(err) { << err.msg()}
        << ""
    }
    fn name_changed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.set_field_invalid(m.name, false) or(err) { << err.msg()}
        << ""
    }
    fn node_action(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        _ := screen.notify("Node action · " + str(int(action.value))) or(err) { << err.msg()}
        << ""
    }
    fn slider_committed(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.set_text(m.message, "Slider committed · " + str(int(action.value))) or(err) { << err.msg()}
        << ""
    }
    fn toggle_controls(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.show_controls = !m.show_controls
        << ""
    }
    fn queue_notice(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        $notice := widgets.notice(&"Saved a local configuration")
        notice.action = "Undo"
        _ := screen.enqueue_notice(&notice) or(err) { << err.msg()}
        << ""
    }
    fn choose_theme(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.theme_index =(m.theme_index + 1) % 3
        m.appearance_dirty = true
        << ""
    }
    fn choose_guides(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.guided = !m.guided
        m.appearance_dirty = true
        << ""
    }
    fn choose_density(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.compact = !m.compact
        m.appearance_dirty = true
        << ""
    }
    fn choose_motion(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.reduced = !m.reduced
        m.appearance_dirty = true
        << ""
    }
    fn choose_failure(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        m.fail_next = !m.fail_next
        << ""
    }
    fn start_task(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        if m.running{ << ""}
        name := screen.text_value(m.name) or(err) { << err.msg()}
        if name.len == 0 {screen.set_field_invalid(m.name, true) or(err) { << err.msg()}
            screen.focus(m.name) or(err) { << err.msg()}
            << ""}
        m.task_id = m.task_id + 1
        m.completed = 0
        m.checksum = 0
        m.running = true
        m.next_work = time.instant()
        screen.begin_task(m.task, m.task_id) or(err) { << err.msg()}
        << ""
    }
    fn cancel_task(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        if !m.running{ << ""}
        _ := screen.complete_task(m.task, m.task_id, widgets.TASK_CANCELLED) or(err) { << err.msg()}
        m.running = false
        screen.set_text(m.message, "Task cancelled. Completed work remains " + str(m.completed) + "/48.") or(err) { << err.msg()}
        << ""
    }
    fn notice_action(m $&Model, screen $&widgets.Screen, action &widgets.Action) string {
        screen.set_text(m.message, "Notification action · " + str(int(action.value))) or(err) { << err.msg()}
        << ""
    }
    fn register_actions(m &Model, screen &widgets.Screen) widgets.ActionDispatcher#Model, widgets.Screen, widgets.Action{
        $d := widgets.action_dispatcher(m, screen)
        d.on(m.search, widgets.ACTION_CHANGE, search_changed) or >>
        d.on(m.name, widgets.ACTION_CHANGE, name_changed) or >>
        d.on(m.tree, widgets.ACTION_ITEM_ACTION, node_action) or >>
        d.on(m.extras[5], widgets.ACTION_COMMIT, slider_committed) or >>
        d.on(m.controls_page, widgets.ACTION_ACTIVATE, toggle_controls) or >>
        d.on(m.extras[19], widgets.ACTION_ACTIVATE, queue_notice) or >>
        d.on(m.theme, widgets.ACTION_ACTIVATE, choose_theme) or >>
        d.on(m.guides, widgets.ACTION_ACTIVATE, choose_guides) or >>
        d.on(m.density, widgets.ACTION_ACTIVATE, choose_density) or >>
        d.on(m.effects, widgets.ACTION_ACTIVATE, choose_motion) or >>
        d.on(m.failure, widgets.ACTION_ACTIVATE, choose_failure) or >>
        d.on(m.task, widgets.ACTION_ACTIVATE, start_task) or >>
        d.on(m.cancel, widgets.ACTION_ACTIVATE, cancel_task) or >>
        << d
    }
    fn register_notices(screen &widgets.Screen, d $&widgets.ActionDispatcher#Model, widgets.Screen, widgets.Action) int {
        for id in screen.notice_ids() {d.on(id, widgets.ACTION_NOTICE_ACTION, notice_action) or >> }
        << 0
    }
    Xustyle.xu
    @main
    
    #ui
    #ui/widgets
    
    fn apply_appearance(m $&Model, screen $&widgets.Screen) int {
        if !m.appearance_dirty{ << 0}
        $styles := widgets.preset_styles(m.theme_index) or >>
        if m.compact{styles.density = 0.85}
        appearance := widgets.screen_appearance(&styles, m.reduced) or >>
        screen.apply_appearance(&appearance) or >>
        primary := styles.button_variant(widgets.BUTTON_PRIMARY) or >>
        screen.set_control_style(m.task, &primary) or >>
        $tree := widgets.tree_appearance()
        tree.guides = m.guided
        screen.set_tree_appearance(m.tree, &tree) or >>
        m.appearance_dirty = false
        << 0
    }
  • 16_ui_webview/editor_workbench/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu

    Xumain.xu
    @main
    #ui
    #ui/draw
    #ui/widgets
    #ui/layout
    tokens #xuui_tokens
    demo #"github.com/xulang-org/examples/ui_demo"
    
    struct Model{
        title widgets.Editor
        body widgets.Editor
        context draw.Context
        styles widgets.Styles
        dark bool
        header int
        title_id int
        body_id int
        footer int
        changes int
        status string
    }
    fn (model $&Model) input(id int, kind int, event &ui.InputEvent) widgets.Action{
        if id == model.title_id{control := $&model.title
            << control.route(kind, event) or >> }
        if id == model.body_id{control := $&model.body
            << control.route(kind, event) or >> }
        << widgets.Action{kind: 0, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
    }
    fn (model $&Model) paint(id int, bounds &layout.Rect, frame $&draw.Frame) bool {
        model.draw_node(id, frame) or(err) {eprintln(err.msg())
            << false}
        << true
    }
    fn (model $&Model) draw_node(id int,frame $&draw.Frame) int {
        styles := model.styles.clone()
        if id == model.title_id { control := $&model.title
            control.paint_styled(frame,&styles) or >> }
        else if id == model.body_id { control := $&model.body
            control.paint_styled(frame,&styles) or >> }
        else if id == model.header {
            demo.text(&model.context,frame,0.0,0.0,24.0,tokens.text(model.dark),"Writing desk") or >>
            demo.text(&model.context,frame,0.0,34.0,14.0,tokens.muted(model.dark),"XUUI design standard · native text and menu controls") or >>
            demo.text(&model.context,frame,0.0,62.0,14.0,tokens.muted(model.dark),"Tab / Shift+Tab · drag selection · copy / cut / paste · arrows / Home / End") or >>
        } else if id == model.footer {
            demo.text(&model.context,frame,0.0,0.0,14.0,tokens.brand(model.dark),"Changes: " + str(model.changes) + "  |  " + model.status) or >>
            demo.text(&model.context,frame,0.0,27.0,14.0,tokens.muted(model.dark),"Use the Document menu: toggle editing, reset, query screens. Escape quits.") or >>
        }
        << 0
    }
    fn (model $&Model) place(view $&widgets.View) int {
        title := $&model.title
        widgets.place_editor(view, title) or >>
        body := $&model.body
        widgets.place_editor(view, body) or >>
        << 0
    }
    fn (model $&Model) native_event(event &ui.Event) bool {
        title := $&model.title
        first := title.event(event) or >>
        body := $&model.body
        second := body.event(event) or >>
        << first.kind == widgets.ACTION_CHANGE || second.kind == widgets.ACTION_CHANGE
    }
    fn (model $&Model) editing(on bool) int {
        title := $&model.title
        title.enable(on) or >>
        body := $&model.body
        body.enable(on) or >>
        << 0
    }
    fn (model $&Model) reset() int {
        title := $&model.title
        title.set_value(&"Untitled note") or >>
        body := $&model.body
        body.set_value(&"Write here.\n你好,Xu。\n\nSelection and IME are native; layout and painting stay in the retained View.") or >>
        << 0
    }
    fn menus(window &ui.Window,enabled bool,dark bool) int {
        $entries := [ui.submenu("document","Document",-1)]
        $reset := ui.menu_action("reset","Reset note",0)
        reset.key = 82
        reset.modifiers = ui.MENU_PRIMARY | ui.MOD_SHIFT
        entries.push(reset)
        entries.push(ui.menu_check("editing","Enable editing",0,enabled))
        entries.push(ui.menu_separator(0))
        entries.push(ui.submenu("display","Displays",0))
        $query := ui.menu_action("screens","Query current screens",4)
        query.key = 68
        query.modifiers = ui.MENU_PRIMARY | ui.MOD_SHIFT
        entries.push(query)
        $unavailable := ui.menu_action("unavailable","Unavailable action",4)
        unavailable.enabled = false
        entries.push(unavailable)
        entries.push(ui.menu_check("dark-theme","Dark appearance",0,dark))
        << window.set_menu_entries(entries) or >>
    }
    fn scene(ech chan ui.Event) int {
        ready := demo.ready(ech) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        identity := ui.canvas_of(&ready) or >>
        context := draw.context_of(&ready) or >>
        window := ui.Window{id: identity.window_id, generation: identity.generation, title: "", width: 0, height: 0, content_kind: ui.CONTENT_DRAW, content_backend_id: identity.canvas_id, closed: 0}
        menus(&window, true, false) or >>
        host := widgets.Host{context: context, identity: identity}
        $column := layout.box_style(layout.BOX_COLUMN)
        column.padding = layout.insets(24.0) or >>
        column.gap = 16.0
        column.cross_alignment = layout.CROSS_STRETCH
        $view := host.view(&column, tokens.canvas(false)) or >>
        leaf := layout.box_style(layout.BOX_LEAF)
        header := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 88.0}) or >>
        title_id := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 44.0}) or >>
        body_id := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 260.0}) or >>
        footer := view.add(view.root(), &leaf, &layout.Size{width: 500.0, height: 72.0}) or >>
        for id in[header, title_id, body_id, footer] {view.set_boundary(id, true) or >> }
        for id in[title_id, body_id] {view.set_input(id, true, true) or >> }
        empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
        $model := Model{title: widgets.input(&context, &identity, title_id, &empty, &"Untitled note") or >>,
            body: widgets.text_area(&context, &identity, body_id, &empty, &"Write here.\n你好,Xu。\n\nSelection and IME are native; layout and painting stay in the retained View.") or >>,
            context: context, styles: tokens.editor_styles(false), dark: false, header: header, title_id: title_id, body_id: body_id, footer: footer, changes: 0, status: "Ready"}
        $dispatcher := widgets.action_dispatcher(&model, &view)
        dispatcher.on(title_id, widgets.ACTION_SUBMIT, submit_title) or >>
        $width := 820.0
        $height := 620.0
        $enabled := true
        options := ui.RequestOptions{timeout_ms: 5000}
        $screens := window.screens_async(&options) or >>
        $event := ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
        // Native text snapshots already carry the latest revision. Drain queued
        // edits before painting so a key burst cannot fill the frame queue.
        while true {
            if event.kind == ui.EV_NONE{
                constraints := layout.tight(width, height) or >>
                _ := view.layout(&constraints) or >>
                model.place($&view) or >>
                submitted := widgets.present($&view, &constraints, $&model) or >>
                if submitted{
                    first := $&model.title
                    first.painted()
                    second := $&model.body
                    second.painted()
                }
                event = demo.next(ech)
            }
            if event.kind == ui.EV_EXIT{ <- }
            if event.window_id != identity.window_id{event = ui.poll_chan(ech)
                -> }
            if event.kind == ui.EV_CANVAS_METRICS{metrics := ui.metrics_of(&event) or >>
                width = metrics.width
                height = metrics.height}
            actions := widgets.dispatch_event($&view, &event, $&model) or >>
            if model.native_event(&event) or >> {model.changes = model.changes + 1
                view.mark_paint(footer) or >> }
            for action in actions{_ := dispatcher.dispatch(&action, $&model, $&view) or >> }
            if event.kind == ui.EV_MENU_CLICKED{
                if event.menu_id == "reset" {model.reset() or >> }
                if event.menu_id == "editing" {enabled = !enabled
                    model.editing(enabled) or >>
                    for id in[title_id, body_id] {view.set_input(id, enabled, enabled) or >> }
                    menus(&window, enabled, model.dark) or >> }
                if event.menu_id == "dark-theme" {
                    model.dark = !model.dark
                    model.styles = tokens.editor_styles(model.dark)
                    view.set_background(tokens.canvas(model.dark))
                    for id in [header,title_id,body_id,footer] { view.mark_paint(id) or >> }
                    menus(&window,enabled,model.dark) or >>
                }
                if event.menu_id == "screens" {screens.cancel()
                    screens = window.screens_async(&options) or >> }
            }
            if event.kind == ui.EV_REQUEST{result := ui.request_of(&event) or >>
                if result.matches(&screens) && result.status == ui.REQUEST_COMPLETED{
                    displays := ui.screen_result(&result) or >>
                    model.status = str(displays.len) + " display(s)"
                    for display in displays{println("Screen: " + display.name + " / " + str(int(display.bounds.width)) + " x " + str(int(display.bounds.height)) + " / scale " + str(int(display.scale_x)))
                        if display.current{model.status = display.name + " · " + str(int(display.bounds.width)) + " x " + str(int(display.bounds.height))}}
                    view.mark_paint(footer) or >>
                }
            }
            if event.kind == ui.EV_CANVAS_CLOSED || event.kind == ui.EV_CLOSED{ <- }
            if ui.is_input_event(event.kind) {input := ui.input_of(&event) or >>
                if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE{demo.quit() or >> }}
            event = ui.poll_chan(ech)
        }
        screens.cancel()
        view.dispose()
        << 0
    }
    fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
            << }}
    fn main() int {
        $app := demo.app("Xu UI / Writing Desk", 820, 620) or(err) {eprintln(err.msg())
            << 1}
        xu worker(app.event_ch)
        << app.run() or(err) {eprintln(err.msg())
            << 1}
    }
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    
    fn submit_title(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        m.status = "Title submitted: " + m.title.value()
        screen.mark_paint(m.footer) or(err) { << err.msg()}
        << ""
    }
  • 16_ui_webview/workbench/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu

    Xumain.xu
    @main
    #ui
    #ui/draw
    #ui/layout
    #ui/widgets
    #math
    demo #"github.com/xulang-org/examples/ui_demo"
    
    struct Model{
        button widgets.Button
        checkbox widgets.Checkbox
        progress widgets.Progress
        scroll widgets.Scroll
        button_label draw.TextLayout
        checkbox_label draw.TextLayout
        theme widgets.Theme
        context draw.Context
        count int
        message string
        source string
        images []draw.Image
        header_id int
        button_id int
        check_id int
        progress_id int
        scroll_id int
        row_ids []int
        identity ui.CanvasEvent
        pending ui.Request
    }
    fn (model $&Model) button_input(kind int, input &ui.InputEvent) widgets.Action{
        button := $&model.button
        << button.route(kind, input) or >>
    }
    fn (model $&Model) checkbox_input(kind int, input &ui.InputEvent) widgets.Action{
        checkbox := $&model.checkbox
        << checkbox.route(kind, input) or >>
    }
    fn (model $&Model) scroll_input(kind int, input &ui.InputEvent) widgets.Action{
        scroll := $&model.scroll
        << scroll.route(kind, input) or >>
    }
    fn (model $&Model) input(id int, kind int, input &ui.InputEvent) widgets.Action{
        if id == model.button_id{ << model.button_input(kind, input) or >> }
        if id == model.check_id{ << model.checkbox_input(kind, input) or >> }
        if id == model.scroll_id{ << model.scroll_input(kind, input) or >> }
        << widgets.Action{kind: widgets.ACTION_NONE, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
    }
    fn (model $&Model) place_button(bounds &layout.Rect) int {
        button := $&model.button
        << button.set_bounds(bounds) or >>
    }
    fn (model $&Model) place_checkbox(bounds &layout.Rect) int {
        checkbox := $&model.checkbox
        << checkbox.set_bounds(bounds) or >>
    }
    fn (model $&Model) place_progress(bounds &layout.Rect) int {
        progress := $&model.progress
        << progress.set_bounds(bounds) or >>
    }
    fn (model $&Model) paint(id int, bounds &layout.Rect, frame $&draw.Frame) bool {
        model.draw_node(id, bounds, frame) or(err) {eprintln(err.msg())
            << false}
        << true
    }
    fn (model $&Model) draw_node(id int, bounds &layout.Rect, frame $&draw.Frame) int {
        if id == model.header_id{
            demo.text(&model.context, frame, 0.0, 0.0, 14.0, demo.accent(), "07 / IMAGE WORKBENCH") or >>
            demo.text(&model.context, frame, 0.0, 28.0, 24.0, demo.ink(), "Image workbench") or >>
            demo.text(&model.context, frame, 0.0, 58.0, 13.0, demo.muted(), model.message + "") or >>
        } else if id == model.button_id{
            model.place_button(bounds) or >>
            model.button.paint(frame, &model.button_label, &model.theme) or >>
        } else if id == model.check_id{
            model.place_checkbox(bounds) or >>
            model.checkbox.paint(frame, &model.checkbox_label, &model.theme) or >>
        } else if id == model.progress_id{
            model.place_progress(bounds) or >>
            model.progress.paint(frame, &model.theme) or >>
        } else if id == model.scroll_id{
            scroll := $&model.scroll
            scroll.set_bounds(bounds) or >>
            frame.fill_rect(0.0, 0.0, bounds.width, bounds.height, draw.rgb(26, 37, 50)) or >>
        } else if model.row_ids.len > 0 && id == model.row_ids[0] {
            if model.images.len > 0 {
                image := model.images[0]
                scale := math.min(bounds.width / f64(image.width), bounds.height / f64(image.height))
                frame.image(&image, 0.0, 0.0, f64(image.width) * scale, f64(image.height) * scale) or >>
            } else {demo.text(&model.context, frame, 12.0, 20.0, 17.0, demo.muted(), "The selected image appears here.") or >> }
        }
        << 0
    }
    fn (model $&Model) progress_value(value f64) int {
        progress := $&model.progress
        << progress.set_value(value) or >>
    }
    fn (model $&Model) retire_image(index int) int {
        $image := model.images[index]
        image.dispose() or >>
        model.images[index] = image
        << 0
    }
    fn (model $&Model) replace_image(image draw.Image) int {
        for i in 0:model.images.len{model.retire_image(i) or >> }
        model.images =[]draw.Image{}
        model.images.push(image)
        << 0
    }
    fn preview_paint(window &ui.Window, path &string) int {
        context := draw.window_context(window) or >>
        $image := context.load_image(path) or >>
        $frame := context.new_frame(256)
        frame.begin() or >>
        frame.set_bg(demo.background()) or >>
        scale := math.min(f64(window.width - 40) / f64(image.width), f64(window.height - 40) / f64(image.height))
        frame.image(&image, 20.0, 20.0, f64(image.width) * scale, f64(image.height) * scale) or >>
        frame.present() or >>
        frame.dispose()
        image.dispose() or >>
        << 0
    }
    fn (model $&Model) acknowledge_button() {
        control := $&model.button
        control.painted()
    }
    fn (model $&Model) acknowledge_checkbox() {
        control := $&model.checkbox
        control.painted()
    }
    fn (model $&Model) acknowledge_progress() {
        control := $&model.progress
        control.painted()
    }
    fn (model $&Model) acknowledge_scroll() {
        control := $&model.scroll
        control.painted()
    }
    fn (model $&Model) acknowledge() {
        model.acknowledge_button()
        model.acknowledge_checkbox()
        model.acknowledge_progress()
        model.acknowledge_scroll()
    }
    fn scene(ech chan ui.Event) int {
        ready := demo.ready(ech) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        identity := ui.canvas_of(&ready) or >>
        context := draw.context_of(&ready) or >>
        host := widgets.Host{context: context, identity: identity}
        $column := layout.box_style(layout.BOX_COLUMN)
        column.padding = layout.insets(28.0) or >>
        column.gap = 14.0
        column.cross_alignment = layout.CROSS_STRETCH
        $view := host.view(&column, demo.background()) or >>
        leaf := layout.box_style(layout.BOX_LEAF)
        header := view.add(view.root(), &leaf, &layout.Size{width: 400.0, height: 88.0}) or >>
        button_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 44.0}) or >>
        check_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 40.0}) or >>
        progress_id := view.add(view.root(), &leaf, &layout.Size{width: 280.0, height: 12.0}) or >>
        $viewport := layout.box_style(layout.BOX_COLUMN)
        viewport.height = 260.0
        viewport.clip = true
        viewport.cross_alignment = layout.CROSS_STRETCH
        viewport.gap = 6.0
        scroll_id := view.add(view.root(), &viewport, &layout.Size{width: 400.0, height: 260.0}) or >>
        $rows :=[]int {}
        for _ in 0:1 {
            row := view.add(scroll_id, &leaf, &layout.Size{width: 400.0, height: 250.0}) or >>
            rows.push(row)
            view.set_boundary(row, true) or >>
        }
        for id in[header, button_id, check_id, progress_id, scroll_id] {view.set_boundary(id, true) or >> }
        for id in[button_id, check_id, scroll_id] {view.set_input(id, true, true) or >> }
        empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
        options := draw.text_options(15.0)
        first := "Open a PNG or JPEG"
        second := "Show a separate preview window"
        $model := Model{button: widgets.button(&identity, button_id, &empty) or >>,
            checkbox: widgets.checkbox(&identity, check_id, &empty, true) or >>,
            progress: widgets.progress(&empty, 0.0) or >>,
            scroll: widgets.scroll(&identity, scroll_id, &empty, widgets.AXIS_VERTICAL, 250.0) or >>,
            button_label: context.layout_text(&first, &options) or >>,
            checkbox_label: context.layout_text(&second, &options) or >>,
            theme: widgets.default_theme(), context: context, count: 0, message: "Open a local image to begin.", source: "", images:[]draw.Image{}, header_id: header, button_id: button_id, check_id: check_id, progress_id: progress_id, scroll_id: scroll_id, row_ids: rows, identity: identity, pending: ui.Request{id: 0, window_id: 0, canvas_id: 0, generation: 0, kind: 0}}
        $width := 900.0
        $height := 700.0
        $native := demo.windows(ech)
        $preview := ui.Window{id: 0, generation: 0, title: "Preview", width: 720, height: 500, content_kind: ui.CONTENT_DRAW, content_backend_id: 0, closed: 1}
        dispatcher := register_actions(&model, &view) or >>
        while true {
            constraints := layout.tight(width, height) or >>
            submitted := widgets.present($&view, &constraints, $&model) or >>
            if submitted{model.acknowledge()}
            event := demo.next(ech)
            if event.kind == ui.EV_EXIT{ <- }
            if preview.id > 0 && event.window_id == preview.id{
                if event.kind == ui.EV_CLOSED || event.kind == ui.EV_WINDOW_FAILED{preview.closed = 1}
                if event.kind == ui.EV_CANVAS_READY && model.source.len > 0 {
                    preview.content_command("input_enabled\t1") or >>
                    preview.content_command("pan_enabled\t0") or >>
                    preview_paint(&preview, &model.source) or >> }
                if event.kind == ui.EV_CANVAS_METRICS{
                    metrics := ui.metrics_of(&event) or >>
                    if metrics.width > 40.0 && metrics.height > 40.0 {preview.width = int(metrics.width)
                        preview.height = int(metrics.height)
                        if model.source.len > 0 {preview_paint(&preview, &model.source) or >> }}
                }
                ->
            }
            if event.window_id != identity.window_id{ -> }
            if event.kind == ui.EV_REQUEST{
                result := ui.request_of(&event) or >>
                if result.matches(&model.pending) {
                    model.pending.id = 0
                    model.message = "Selection cancelled or failed."
                    if result.status == ui.REQUEST_COMPLETED{
                        paths := ui.file_paths(&result) or >>
                        if paths.len > 0 {
                            path := paths[0] + ""
                            image := context.load_image(&path) or(err) {model.message = err.msg()
                                view.mark_paint(header) or >>
                                -> }
                            model.replace_image(image) or >>
                            model.source = path + ""
                            model.message = "Loaded " + str(image.width) + " x " + str(image.height) + " pixels"
                            println(model.message + "")
                            model.progress_value(1.0) or >>
                            view.mark_paint(model.row_ids[0]) or >>
                            if model.checkbox.value() {
                                if preview.closed != 0 {preview = native.open_content_window(ui.WindowOpts{title: "Xu UI / Image Preview", width: 720, height: 500}, ui.CONTENT_DRAW) or >> }
                                else {preview_paint(&preview, &path) or >>
                                    preview.focus() or >> }
                            }
                        }
                    }
                    view.mark_paint(header) or >>
                    view.mark_paint(progress_id) or >>
                }
            }
            if event.kind == ui.EV_CANVAS_METRICS{
                metrics := ui.metrics_of(&event) or >>
                if metrics.width > 0.0 && metrics.height > 0.0 {width = metrics.width
                    height = metrics.height}
            }
            actions := widgets.dispatch_event($&view, &event, $&model) or >>
            for action in actions{_ := dispatcher.dispatch(&action, $&model, $&view) or >> }
            if event.kind == ui.EV_CANVAS_CLOSED{demo.quit() or >>
                <- }
            if ui.is_input_event(event.kind) {
                input := ui.input_of(&event) or >>
                if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE{demo.quit() or >> }
            }
            stats := view.stats()
            if stats.recorded_boundaries > 0 || stats.reused_boundaries > 0 {
                println("View: " + str(stats.recorded_boundaries) + " recorded / " + str(stats.reused_boundaries) + " reused boundaries")
            }
        }
        if model.pending.id > 0 {_ := model.pending.cancel()}
        view.dispose()
        // Native close has already revoked this canvas's images and text layouts.
        if demo.alive(&identity) {
            for i in 0:model.images.len{model.retire_image(i) or >> }
            label := $&model.button_label
            label.dispose() or >>
            check_label := $&model.checkbox_label
            check_label.dispose() or >>
        }
        << 0
    }
    fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
            << }}
    fn launch() int {
        $app := demo.app("Xu UI / Retained Image Workbench", 900, 700) or >>
        xu worker(app.event_ch)
        << app.run() or >>
    }
    fn main() int { << launch() or(err) {eprintln(err.msg())
            << 1}}
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    
    fn open_image(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        if m.pending.id != 0 { << ""}
        $options := ui.file_dialog_options()
        options.title = "Open an image"
        options.filters =[ui.FileFilter{label: "Images", extensions:["png", "jpg", "jpeg"]}]
        m.pending = ui.open_files_async(&m.identity, &options) or(err) { << err.msg()}
        m.message = "Choose a PNG or JPEG in the native dialog."
        m.progress_value(0.2) or(err) { << err.msg()}
        screen.mark_paint(m.header_id) or(err) { << err.msg()}
        screen.mark_paint(m.progress_id) or(err) { << err.msg()}
        << ""
    }
    fn scroll(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        screen.set_scroll(m.scroll_id, 0.0, action.value) or(err) { << err.msg()}
        << ""
    }
    fn register_actions(m &Model, screen &widgets.View) widgets.ActionDispatcher#Model, widgets.View, widgets.Action{
        $d := widgets.action_dispatcher(m, screen)
        d.on(m.button_id, widgets.ACTION_ACTIVATE, open_image) or >>
        d.on(m.scroll_id, widgets.ACTION_SCROLL, scroll) or >>
        << d
    }
  • 16_ui_webview/style_gallery/main.xu

    所需 SDK:Xu 0.10.13-dev.1 · 完整工程 · 下载源码 · events.xu · style.xu

    Xumain.xu
    @main
    #ui
    #ui/draw
    #ui/widgets
    #ui/layout
    #time
    demo #"github.com/xulang-org/examples/ui_demo"
    
    // IDs follow the stable topology created below. All control bounds are local;
    // Editor.place receives the separate canvas rectangle for native IME geometry.
    struct Model{
        theme widgets.Button
        scale widgets.Button
        density widgets.Button
        brand widgets.Button
        disabled widgets.Button
        check widgets.Checkbox
        toggle widgets.Switch
        radio_a widgets.Radio
        radio_b widgets.Radio
        slider widgets.Slider
        stepper widgets.Stepper
        tabs widgets.Tabs
        select_ctrl widgets.Select
        select_origin layout.Rect
        select_popup_armed bool
        transitions []widgets.PaintTransition
        switch_motion widgets.Tween
        popup_motion widgets.Tween
        clock time.Instant
        reduced_motion bool
        theme_index int
        text_scale f64
        density_scale f64
        appearance_dirty bool
        badge widgets.Badge
        divider widgets.Divider
        card widgets.Card
        list widgets.ListBox
        input widgets.Editor
        invalid widgets.Editor
        read_only widgets.Editor
        area widgets.Editor
        progress widgets.Progress
        scroll widgets.Scroll
        context draw.Context
        icon draw.Image
        switcher widgets.StyleSwitcher
        theme_label widgets.StyledLabel
        scale_label widgets.StyledLabel
        density_label widgets.StyledLabel
        brand_label widgets.StyledLabel
        disabled_label widgets.StyledLabel
        check_label widgets.StyledLabel
        toggle_label widgets.StyledLabel
        radio_a_label widgets.StyledLabel
        radio_b_label widgets.StyledLabel
        stepper_label widgets.StyledLabel
        badge_label widgets.StyledLabel
        divider_label widgets.StyledLabel
        card_label widgets.StyledLabel
        tab_label widgets.StyledLabel
        tab_2_label widgets.StyledLabel
        tab_3_label widgets.StyledLabel
        select_label widgets.StyledLabel
        option_auto widgets.StyledLabel
        option_manual widgets.StyledLabel
        option_locked widgets.StyledLabel
        list_label widgets.StyledLabel
        list_2_label widgets.StyledLabel
        list_3_label widgets.StyledLabel
        list_4_label widgets.StyledLabel
    }
    fn (m $&Model) motion_style(id int, base &widgets.ControlStyle, state int) widgets.ControlStyle{
        now := m.clock
        reduced := m.reduced_motion
        motion := $&m.transitions[id]
        << motion.style(base, state, now, reduced) or >>
    }
    fn (m $&Model) tick(view $&widgets.View, now time.Instant) int {
        m.clock = now
        reduced := m.reduced_motion
        for id in 1:m.transitions.len{
            motion := $&m.transitions[id]
            if reduced && motion.is_animating() {motion.finish()
                view.mark_paint(id) or >> }
            else if motion.advance(now) or >> {view.mark_paint(id) or >> }
        }
        $selected := 0.0
        if m.toggle.value() {selected = 1.0}
        switch_motion := $&m.switch_motion
        before_switch := switch_motion.value()
        switch_motion.retarget(selected, now, time.milliseconds(180) or >>, reduced) or >>
        if before_switch != switch_motion.value() {view.mark_paint(32) or >> }
        $opened := 0.0
        if m.select_ctrl.is_open() {opened = 1.0}
        popup_motion := $&m.popup_motion
        before_popup := popup_motion.value()
        $popup_duration := time.milliseconds(130) or >>
        if opened == 0.0 {popup_duration = time.milliseconds(95) or >> }
        popup_motion.retarget(opened, now, popup_duration, reduced) or >>
        if before_popup != popup_motion.value() {view.mark_paint(1) or >> }
        input := $&m.input
        if input.tick(now, reduced) or >> {view.mark_paint(12) or >> }
        invalid := $&m.invalid
        if invalid.tick(now, reduced) or >> {view.mark_paint(13) or >> }
        read_only := $&m.read_only
        if read_only.tick(now, reduced) or >> {view.mark_paint(14) or >> }
        area := $&m.area
        if area.tick(now, reduced) or >> {view.mark_paint(15) or >> }
        << 0
    }
    fn (m &Model) next_frame(now time.Instant) time.Instant{
        if m.switch_motion.is_animating() || m.popup_motion.is_animating() { << now.add(time.milliseconds(16) or >>) or >> }
        for motion in m.transitions{if motion.is_animating() { << now.add(time.milliseconds(16) or >>) or >> }}
        $deadline := time.zero_instant()
        for next in[m.input.next_caret_tick(now, m.reduced_motion) or >>, m.invalid.next_caret_tick(now, m.reduced_motion) or >>,
        m.read_only.next_caret_tick(now, m.reduced_motion) or >>, m.area.next_caret_tick(now, m.reduced_motion) or >>] {
            if !next.is_zero() &&(deadline.is_zero() || next.before(deadline)) {deadline = next}
        }
        << deadline
    }
    fn (m &Model) next_event(ech chan ui.Event) ui.Event{
        deadline := m.next_frame(time.instant()) or >>
        while true {
            event := ui.poll_chan(ech)
            if event.kind != ui.EV_NONE{ << event}
            if !deadline.is_zero() && !time.instant().before(deadline) { << event}
            pause := time.milliseconds(8) or >>
            pause.sleep()
        }
        << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
    }
    fn (m $&Model) measure_node(id int, s &widgets.Styles) layout.Size{
        if id == 4 {control := m.theme.clone()
            label := $&m.theme_label
            << control.measure_styled(label, s) or >> }
        if id == 5 {control := m.scale.clone()
            label := $&m.scale_label
            << control.measure_styled(label, s) or >> }
        if id == 6 {control := m.density.clone()
            label := $&m.density_label
            << control.measure_styled(label, s) or >> }
        if id == 8 {control := m.brand.clone()
            label := $&m.brand_label
            << control.measure_icon_styled(label, s) or >> }
        if id == 9 {control := m.disabled.clone()
            label := $&m.disabled_label
            << control.measure_styled(label, s) or >> }
        if id == 10 {control := m.check.clone()
            label := $&m.check_label
            << control.measure_styled(label, s) or >> }
        if id == 11 {control := m.progress.clone()
            << control.measure_styled(s) or >> }
        if id == 12 {control := $&m.input
            << control.measure_styled(s) or >> }
        if id == 13 {control := $&m.invalid
            << control.measure_styled(s) or >> }
        if id == 14 {control := $&m.read_only
            << control.measure_styled(s) or >> }
        if id == 15 {control := $&m.area
            << control.measure_styled(s) or >> }
        if id == 32 {control := m.toggle.clone()
            label := $&m.toggle_label
            << control.measure_styled(label, s) or >> }
        if id == 33 {control := m.radio_a.clone()
            label := $&m.radio_a_label
            << control.measure_styled(label, s) or >> }
        if id == 34 {control := m.radio_b.clone()
            label := $&m.radio_b_label
            << control.measure_styled(label, s) or >> }
        if id == 35 {control := m.slider.clone()
            << control.measure_styled(s) or >> }
        if id == 36 {control := m.stepper.clone()
            label := $&m.stepper_label
            << control.measure_styled(label, s) or >> }
        if id == 37 {control := m.badge.clone()
            label := $&m.badge_label
            << control.measure_styled(label, s) or >> }
        if id == 38 {control := m.divider.clone()
            label := $&m.divider_label
            << control.measure_labeled_styled(label, s) or >> }
        if id == 40 {control := m.tabs.clone()
            label := $&m.tab_label
            << control.measure_styled(label, s) or >> }
        if id == 41 {control := m.select_ctrl.clone()
            label := $&m.select_label
            << control.measure_styled(label, s) or >> }
        if id == 42 {control := m.card.clone()
            label := $&m.card_label
            << control.measure_header_styled(label, s) or >> }
        if id == 43 {control := m.list.clone()
            label := $&m.list_label
            << control.measure_styled(label, s) or >> }
        << layout.Size{width: 0.0, height: 0.0}
    }
    fn (m $&Model) measure_styled(id int, s &widgets.Styles) layout.Size{
        << m.measure_node(id, s) or(err) {eprintln(err.msg())
            << layout.Size{width: - 1.0, height: - 1.0}}
    }
    fn (m $&Model) draw_node(id int, b &layout.Rect, s &widgets.Styles, f $&draw.Frame) int {
        if id == 4 {target := $&m.theme
            target.set_bounds(b) or >>
            $control := m.theme.clone()
            base := control.style_or(s)
            appearance := m.motion_style(4, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.theme_label
            control.paint_styled(f, label, s) or >> }
        if id == 5 {target := $&m.scale
            target.set_bounds(b) or >>
            $control := m.scale.clone()
            base := control.style_or(s)
            appearance := m.motion_style(5, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.scale_label
            control.paint_styled(f, label, s) or >> }
        if id == 6 {target := $&m.density
            target.set_bounds(b) or >>
            $control := m.density.clone()
            base := control.style_or(s)
            appearance := m.motion_style(6, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.density_label
            control.paint_styled(f, label, s) or >> }
        if id == 8 {target := $&m.brand
            target.set_bounds(b) or >>
            $control := m.brand.clone()
            base := control.style_or(s)
            appearance := m.motion_style(8, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            icon := m.icon
            label := $&m.brand_label
            control.paint_icon_styled(f, label, &icon, s) or >> }
        if id == 9 {target := $&m.disabled
            target.set_bounds(b) or >>
            $control := m.disabled.clone()
            base := control.style_or(s)
            appearance := m.motion_style(9, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.disabled_label
            control.paint_styled(f, label, s) or >> }
        if id == 10 {target := $&m.check
            target.set_bounds(b) or >>
            $control := m.check.clone()
            base := control.style_or(s)
            appearance := m.motion_style(10, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.check_label
            control.paint_styled(f, label, s) or >> }
        if id == 12 {
            now := m.clock
            reduced := m.reduced_motion
            $motion := m.transitions[12]
            control := $&m.input
            control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
            m.transitions[12] = motion}
        if id == 13 {
            now := m.clock
            reduced := m.reduced_motion
            $motion := m.transitions[13]
            control := $&m.invalid
            control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
            m.transitions[13] = motion}
        if id == 14 {
            now := m.clock
            reduced := m.reduced_motion
            $motion := m.transitions[14]
            control := $&m.read_only
            control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
            m.transitions[14] = motion}
        if id == 15 {
            now := m.clock
            reduced := m.reduced_motion
            $motion := m.transitions[15]
            control := $&m.area
            control.paint_motion_styled(f, s, $&motion, now, reduced) or >>
            m.transitions[15] = motion}
        if id == 11 {control := $&m.progress
            control.set_bounds(b) or >>
            control.paint_styled(f, s) or >> }
        if id == 32 {target := $&m.toggle
            target.set_bounds(b) or >>
            $control := m.toggle.clone()
            base := control.style_or(s)
            appearance := m.motion_style(32, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            position := m.switch_motion.value()
            label := $&m.toggle_label
            control.paint_position_styled(f, label, s, position) or >> }
        if id == 33 {target := $&m.radio_a
            target.set_bounds(b) or >>
            $control := m.radio_a.clone()
            base := control.style_or(s)
            appearance := m.motion_style(33, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.radio_a_label
            control.paint_styled(f, label, s) or >> }
        if id == 34 {target := $&m.radio_b
            target.set_bounds(b) or >>
            $control := m.radio_b.clone()
            base := control.style_or(s)
            appearance := m.motion_style(34, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.radio_b_label
            control.paint_styled(f, label, s) or >> }
        if id == 35 {target := $&m.slider
            target.set_bounds(b) or >>
            $control := m.slider.clone()
            base := control.style_or(s)
            appearance := m.motion_style(35, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            control.paint_styled(f, s) or >> }
        if id == 36 {target := $&m.stepper
            target.set_bounds(b) or >>
            $control := m.stepper.clone()
            base := control.style_or(s)
            appearance := m.motion_style(36, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.stepper_label
            control.paint_styled(f, label, s) or >> }
        if id == 37 {target := $&m.badge
            target.set_bounds(b) or >>
            control := m.badge.clone()
            label := $&m.badge_label
            control.paint_styled(f, label, s) or >> }
        if id == 38 {target := $&m.divider
            target.set_bounds(b) or >>
            control := m.divider.clone()
            label := $&m.divider_label
            control.paint_labeled_styled(f, label, s) or >> }
        if id == 40 {target := $&m.tabs
            target.set_bounds(b) or >>
            control := m.tabs.clone()
            control.paint_box_styled(f, s) or >>
            l0 := $&m.tab_label
            control.paint_tab_styled(f, 0, l0, s) or >>
            l1 := $&m.tab_2_label
            control.paint_tab_styled(f, 1, l1, s) or >>
            l2 := $&m.tab_3_label
            control.paint_tab_styled(f, 2, l2, s) or >> }
        if id == 41 {target := $&m.select_ctrl
            target.set_bounds(b) or >>
            $control := m.select_ctrl.clone()
            base := control.style_or(s)
            appearance := m.motion_style(41, &base, control.visual_state()) or >>
            control.set_style(&appearance) or >>
            label := $&m.select_label
            control.paint_styled(f, label, s) or >> }
        if id == 42 {target := $&m.card
            target.set_bounds(b) or >>
            control := m.card.clone()
            label := $&m.card_label
            control.paint_header_styled(f, label, s) or >>
            demo.text(&m.context, f, 14.0 * s.density, 42.0 * s.density, 11.0 * s.text_scale, s.button.palette.muted, "Card body") or >> }
        if id == 43 {target := $&m.list
            target.set_bounds(b) or >>
            control := m.list.clone()
            control.paint_box_styled(f, s) or >>
            r0 := $&m.list_label
            control.paint_item_styled(f, 0, r0, s) or >>
            r1 := $&m.list_2_label
            control.paint_item_styled(f, 1, r1, s) or >>
            r2 := $&m.list_3_label
            control.paint_item_styled(f, 2, r2, s) or >>
            r3 := $&m.list_4_label
            control.paint_item_styled(f, 3, r3, s) or >> }
        if id == 2 {
            demo.text(&m.context, f, 0.0, 0.0, 24.0, s.button.palette.foreground, "A theme that reaches every control") or >>
            demo.text(&m.context, f, 0.0, 33.0, 13.0, s.button.palette.muted, "Light / dark / contrast · typography · density · local overrides · no idle redraw") or >>
        }
        if id >= 18 && id <= 29 {
            f.fill_rect(0.0, 0.0, b.width, b.height, s.input.palette.normal) or >>
            demo.text(&m.context, f, 12.0, 5.0, 14.0, s.input.palette.foreground, "Scrollable item " + str(id - 17) + "   —   wheel, drag the thumb, or Page Down") or >>
        }
        if id == 30 {
            demo.text(&m.context, f, 0.0, 0.0, 12.0, s.button.palette.muted, "The green button keeps its own font and palette. Error and read-only fields are distinct states.") or >>
            demo.text(&m.context, f, 0.0, 21.0, 12.0, s.button.palette.muted, "Tab / Shift+Tab to move focus · copy from read-only text · Escape to quit") or >>
        }
        << 0
    }
    fn (m $&Model) paint_styled(id int, b &layout.Rect, s &widgets.Styles, f $&draw.Frame) bool {
        m.draw_node(id, b, s, f) or(err) {eprintln(err.msg())
            << false}
        << true
    }
    fn (m $&Model) overlay_styled(id int, b &layout.Rect, s &widgets.Styles, f $&draw.Frame) bool {
        if id == 16 {control := $&m.scroll
            control.paint_scrollbar(f, s) or(err) {eprintln(err.msg())
                << false}}
        if id == 1 &&(m.select_ctrl.is_open() || m.popup_motion.value() > 0.0) {
            m.paint_select_popup(s, f) or(err) {eprintln(err.msg())
                << false}
        }
        << true
    }
    // Root overlay keeps the popup above every sibling and outside the button's box.
    fn (m $&Model) paint_select_popup(s &widgets.Styles, f $&draw.Frame) int {
        $control := m.select_ctrl.clone()
        control.set_open(true)
        opacity := m.popup_motion.value()
        if opacity <= 0.0 { << 0}
        base := control.style_or(s)
        appearance := base.with_opacity(opacity) or >>
        control.set_style(&appearance) or >>
        popup := control.popup_bounds(s)
        $offset := - 4.0 *(1.0 - opacity)
        if popup.y < 0.0 {offset = 4.0 *(1.0 - opacity)}
        f.push() or >>
        f.translate(m.select_origin.x, m.select_origin.y + offset) or >>
        control.paint_popup_box_styled(f, s) or >>
        auto_label := $&m.option_auto
        control.paint_option_styled(f, 0, auto_label, s) or >>
        manual_label := $&m.option_manual
        control.paint_option_styled(f, 1, manual_label, s) or >>
        locked_label := $&m.option_locked
        control.paint_option_styled(f, 2, locked_label, s) or >>
        f.pop() or >>
        << 0
    }
    // The popup is an overlay, so route its pointer sequence before normal tree hits.
    fn (m $&Model) dispatch_input(view $&widgets.View, event &ui.InputEvent)[]widgets.Action{
        was_open := m.select_ctrl.is_open()
        pointer := event.kind == ui.EV_POINTER_DOWN || event.kind == ui.EV_POINTER_UP ||
        event.kind == ui.EV_POINTER_MOVE || event.kind == ui.EV_POINTER_SCROLL
        if pointer &&(was_open || m.select_popup_armed) {
            local := view.local_input(41, event) or >>
            styles := view.styles_for(41) or >>
            pop := m.select_ctrl.popup_bounds(&styles)
            if pop.contains(local.x, local.y) || m.select_popup_armed{
                if event.kind == ui.EV_POINTER_DOWN && event.button == ui.BUTTON_LEFT{m.select_popup_armed = true}
                control := $&m.select_ctrl
                action := control.input(&local) or >>
                view.set_pointer_cursor(ui.CURSOR_HAND) or >>
                if event.kind == ui.EV_POINTER_UP{m.select_popup_armed = false}
                view.mark_paint(41) or >>
                view.mark_paint(1) or >>
                <<[action]
            }
        }
        if event.kind == ui.EV_POINTER_CANCEL{m.select_popup_armed = false}
        actions := widgets.dispatch(view, event, m) or >>
        if was_open || m.select_ctrl.is_open() {view.mark_paint(1) or >> }
        << actions
    }
    fn (m $&Model) dispatch_event(view $&widgets.View, event &ui.Event)[]widgets.Action{
        if ui.is_input_event(event.kind) {
            input := ui.input_of(event) or >>
            << m.dispatch_input(view, &input) or >>
        }
        was_open := m.select_ctrl.is_open()
        actions := widgets.dispatch_event(view, event, m) or >>
        m.select_popup_armed = false
        if was_open && !m.select_ctrl.is_open() {view.mark_paint(1) or >> }
        << actions
    }
    fn (m $&Model) input(id int, kind int, event &ui.InputEvent) widgets.Action{
        if id == 4 {control := $&m.theme
            << control.route(kind, event) or >> }
        if id == 5 {control := $&m.scale
            << control.route(kind, event) or >> }
        if id == 6 {control := $&m.density
            << control.route(kind, event) or >> }
        if id == 8 {control := $&m.brand
            << control.route(kind, event) or >> }
        if id == 9 {control := $&m.disabled
            << control.route(kind, event) or >> }
        if id == 10 {control := $&m.check
            << control.route(kind, event) or >> }
        if id == 12 {control := $&m.input
            << control.route(kind, event) or >> }
        if id == 13 {control := $&m.invalid
            << control.route(kind, event) or >> }
        if id == 14 {control := $&m.read_only
            << control.route(kind, event) or >> }
        if id == 15 {control := $&m.area
            << control.route(kind, event) or >> }
        if id == 16 {control := $&m.scroll
            << control.route(kind, event) or >> }
        if id == 32 {control := $&m.toggle
            << control.route(kind, event) or >> }
        if id == 33 {control := $&m.radio_a
            << control.route(kind, event) or >> }
        if id == 34 {control := $&m.radio_b
            << control.route(kind, event) or >> }
        if id == 35 {control := $&m.slider
            << control.route(kind, event) or >> }
        if id == 36 {control := $&m.stepper
            << control.route(kind, event) or >> }
        if id == 40 {control := $&m.tabs
            << control.route(kind, event) or >> }
        if id == 41 {control := $&m.select_ctrl
            << control.route(kind, event) or >> }
        if id == 43 {control := $&m.list
            << control.route(kind, event) or >> }
        << widgets.Action{kind: 0, id: id, needs_paint: false, request_focus: false, consumed: false, value: 0.0}
    }
    fn (m $&Model) place(view $&widgets.View) int {
        select_bounds := view.node_bounds(41) or >>
        m.select_origin = select_bounds
        select_styles := view.styles_for(41) or >>
        select_control := $&m.select_ctrl
        select_control.set_bounds(&layout.Rect{x: 0.0, y: 0.0, width: select_bounds.width, height: select_bounds.height}) or >>
        select_control.apply_styles(&select_styles) or >>
        popup := select_control.popup_bounds(&select_styles)
        window_bounds := view.node_bounds(1) or >>
        below := window_bounds.y + window_bounds.height - select_bounds.y - select_bounds.height
        above := select_bounds.y - window_bounds.y
        select_control.set_popup_above(below < popup.height + 2.0 * select_styles.density && above > below)
        list_bounds := view.node_bounds(43) or >>
        list_styles := view.styles_for(43) or >>
        list_control := $&m.list
        list_control.set_bounds(&layout.Rect{x: 0.0, y: 0.0, width: list_bounds.width, height: list_bounds.height}) or >>
        list_control.apply_styles(&list_styles) or >>
        input := $&m.input
        widgets.place_editor(view, input) or >>
        invalid := $&m.invalid
        widgets.place_editor(view, invalid) or >>
        read_only := $&m.read_only
        widgets.place_editor(view, read_only) or >>
        area := $&m.area
        widgets.place_editor(view, area) or >>
        bounds := view.node_bounds(16) or >>
        styles := view.styles_for(16) or >>
        control := $&m.scroll
        control.set_bounds(&layout.Rect{x: 0.0, y: 0.0, width: bounds.width, height: bounds.height}) or >>
        control.apply_styles(&styles) or >>
        view.set_scroll(16, 0.0, control.offset()) or >>
        << 0
    }
    fn (m $&Model) native_event(view $&widgets.View, event &ui.Event) int {
        input := $&m.input
        action_12 := input.event(event) or >>
        if action_12.needs_paint{view.mark_paint(12) or >> }
        invalid := $&m.invalid
        action_13 := invalid.event(event) or >>
        if action_13.needs_paint{view.mark_paint(13) or >> }
        read_only := $&m.read_only
        action_14 := read_only.event(event) or >>
        if action_14.needs_paint{view.mark_paint(14) or >> }
        area := $&m.area
        action_15 := area.event(event) or >>
        if action_15.needs_paint{view.mark_paint(15) or >> }
        << 0
    }
    fn (m $&Model) acknowledge() {
        theme := $&m.theme
        theme.painted()
        scale := $&m.scale
        scale.painted()
        density := $&m.density
        density.painted()
        brand := $&m.brand
        brand.painted()
        disabled := $&m.disabled
        disabled.painted()
        check := $&m.check
        check.painted()
        input := $&m.input
        input.painted()
        invalid := $&m.invalid
        invalid.painted()
        read_only := $&m.read_only
        read_only.painted()
        area := $&m.area
        area.painted()
        progress := $&m.progress
        progress.painted()
        scroll := $&m.scroll
        scroll.painted()
        toggle := $&m.toggle
        toggle.painted()
        radio_a := $&m.radio_a
        radio_a.painted()
        radio_b := $&m.radio_b
        radio_b.painted()
        slider := $&m.slider
        slider.painted()
        stepper := $&m.stepper
        stepper.painted()
        tabs := $&m.tabs
        tabs.painted()
        select_ctrl := $&m.select_ctrl
        select_ctrl.painted()
        badge := $&m.badge
        badge.painted()
        divider := $&m.divider
        divider.painted()
        card := $&m.card
        card.painted()
        list := $&m.list
        list.painted()
    }
    fn (m $&Model) cleanup() {
        icon := $&m.icon
        icon.dispose() or(err) {eprintln(err.msg())
            << }
        theme_label := $&m.theme_label
        theme_label.dispose()
        scale_label := $&m.scale_label
        scale_label.dispose()
        density_label := $&m.density_label
        density_label.dispose()
        brand_label := $&m.brand_label
        brand_label.dispose()
        disabled_label := $&m.disabled_label
        disabled_label.dispose()
        check_label := $&m.check_label
        check_label.dispose()
        toggle_label := $&m.toggle_label
        toggle_label.dispose()
        radio_a_label := $&m.radio_a_label
        radio_a_label.dispose()
        radio_b_label := $&m.radio_b_label
        radio_b_label.dispose()
        stepper_label := $&m.stepper_label
        stepper_label.dispose()
        badge_label := $&m.badge_label
        badge_label.dispose()
        divider_label := $&m.divider_label
        divider_label.dispose()
        card_label := $&m.card_label
        card_label.dispose()
        tab_label := $&m.tab_label
        tab_label.dispose()
        tab_2_label := $&m.tab_2_label
        tab_2_label.dispose()
        tab_3_label := $&m.tab_3_label
        tab_3_label.dispose()
        select_label := $&m.select_label
        select_label.dispose()
        option_auto := $&m.option_auto
        option_auto.dispose()
        option_manual := $&m.option_manual
        option_manual.dispose()
        option_locked := $&m.option_locked
        option_locked.dispose()
        list_label := $&m.list_label
        list_label.dispose()
        list_2_label := $&m.list_2_label
        list_2_label.dispose()
        list_3_label := $&m.list_3_label
        list_3_label.dispose()
        list_4_label := $&m.list_4_label
        list_4_label.dispose()
        input := $&m.input
        input.dispose()
        invalid := $&m.invalid
        invalid.dispose()
        read_only := $&m.read_only
        read_only.dispose()
        area := $&m.area
        area.dispose()
    }
    fn leaf(view $&widgets.View, parent int, width f64, height f64) int {
        style := layout.box_style(layout.BOX_LEAF)
        << view.add(parent, &style, &layout.Size{width: width, height: height}) or >>
    }
    fn brand_scope(view $&widgets.View) int {
        $brand := widgets.light_styles()
        brand.button.palette.normal = draw.rgb(10, 91, 69)
        brand.button.palette.hovered = draw.rgb(17, 120, 90)
        brand.button.palette.pressed = draw.rgb(7, 65, 49)
        brand.button.palette.foreground = draw.rgb(255, 255, 255)
        brand.button.font.size = 17.0
        brand.button.font.weight = 600
        brand.button.inherit_font = false
        brand.button.radius = 18.0
        brand.button.icon_size = 22.0
        brand.button.icon_placement = widgets.ICON_TRAILING
        $hover := widgets.state_paint(widgets.STATE_HOVERED)
        hover.unless = widgets.STATE_DISABLED
        hover.fields = widgets.PAINT_FOREGROUND | widgets.PAINT_BORDER
        hover.foreground = draw.rgb(209, 250, 229)
        hover.border = draw.rgb(110, 231, 183)
        brand.button.states =[hover]
        brand.button.shadow = draw.rgba(0, 0, 0, 28)
        brand.button.shadow_y = 2.0
        brand.button.shadow_blur = 6.0
        view.set_style_scope(8, &brand) or >>
        << 0
    }
    fn scene(ech chan ui.Event) int {
        ready := demo.ready(ech) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        identity := ui.canvas_of(&ready) or >>
        context := draw.context_of(&ready) or >>
        host := widgets.Host{context: context, identity: identity}
        $column := layout.box_style(layout.BOX_COLUMN)
        column.padding = layout.insets(22.0) or >>
        column.gap = 10.0
        column.cross_alignment = layout.CROSS_STRETCH
        $view := host.view(&column, draw.rgb(20, 25, 34)) or >>
        _ := leaf($&view, 1, 400.0, 56.0) or >>  // 2 header
        $row := layout.box_style(layout.BOX_ROW)
        row.gap = 12.0
        row.cross_alignment = layout.CROSS_CENTER
        _ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >>  // 3 toolbar
        for i in 0:3 {_ := leaf($&view, 3, 0.0, 0.0) or >> }  // 4..6
        _ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >>  // 7 controls
        for i in 0:3 {_ := leaf($&view, 7, 0.0, 0.0) or >> }  // 8..10
        _ := leaf($&view, 1, 300.0, 12.0) or >>  // 11 progress
        for i in 0:4 {_ := leaf($&view, 1, 300.0, 0.0) or >> }  // 12..15 editors
        $viewport := layout.box_style(layout.BOX_COLUMN)
        viewport.height = 84.0
        viewport.clip = true
        viewport.cross_alignment = layout.CROSS_STRETCH
        _ := view.add(1, &viewport, &layout.Size{width: 0.0, height: 0.0}) or >>  // 16 scroll
        $items := layout.box_style(layout.BOX_COLUMN)
        items.gap = 6.0
        items.cross_alignment = layout.CROSS_STRETCH
        _ := view.add(16, &items, &layout.Size{width: 0.0, height: 0.0}) or >>  // 17 items
        for i in 0:12 {_ := leaf($&view, 17, 300.0, 28.0) or >> }  // 18..29
        _ := leaf($&view, 1, 400.0, 42.0) or >>  // 30 footer
        _ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >>  // 31 extended controls row 1
        for i in 0:6 {_ := leaf($&view, 31, 0.0, 0.0) or >> }  // 32..37: switch, radio_a, radio_b, slider, stepper, badge
        _ := leaf($&view, 1, 300.0, 0.0) or >>  // 38 labeled divider
        _ := view.add(1, &row, &layout.Size{width: 0.0, height: 0.0}) or >>  // 39 extended controls row 2
        for i in 0:4 {_ := leaf($&view, 39, 0.0, 0.0) or >> }  // 40..43: tabs, select, card, list_box
        for id in[2, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 30, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43] {view.set_boundary(id, true) or >> }
        for id in[4, 5, 6, 8, 10, 12, 13, 14, 15, 16, 32, 33, 34, 35, 36, 40, 41, 43] {view.set_input(id, true, true) or >> }
        view.set_capture_outside(16, true) or >>
        view.set_capture_outside(35, true) or >>
        for id in[4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43] {view.set_style_measure(id, true) or >> }
        empty := layout.Rect{x: 0.0, y: 0.0, width: 0.0, height: 0.0}
        $m := Model{theme: widgets.button(&identity, 4, &empty) or >>, scale: widgets.button(&identity, 5, &empty) or >>,
            density: widgets.button(&identity, 6, &empty) or >>, brand: widgets.button(&identity, 8, &empty) or >>,
            disabled: widgets.button(&identity, 9, &empty) or >>, check: widgets.checkbox(&identity, 10, &empty, true) or >>,
            toggle: widgets.switch_control(&identity, 32, &empty, true) or >>,
            radio_a: widgets.radio(&identity, 33, &empty, 0, true) or >>,
            radio_b: widgets.radio(&identity, 34, &empty, 1, false) or >>,
            slider: widgets.slider(&identity, 35, &empty, 0.0, 100.0, 64.0) or >>,
            stepper: widgets.stepper(&identity, 36, &empty, 0.0, 100.0, 5.0, 65.0) or >>,
            tabs: widgets.tabs(&identity, 40, &empty, 3, 0) or >>,
            select_ctrl: widgets.select_box(&identity, 41, &empty, 3, 0) or >>,
            select_origin: empty, select_popup_armed: false,
            transitions:[]widgets.PaintTransition{}, switch_motion: widgets.tween(1.0) or >>, popup_motion: widgets.tween(0.0) or >>,
            clock: time.zero_instant(), reduced_motion: false, theme_index: 0, text_scale: 1.0, density_scale: 1.0, appearance_dirty: true,
            badge: widgets.badge(&empty) or >>,
            divider: widgets.divider(&empty, widgets.AXIS_HORIZONTAL) or >>,
            card: widgets.card(&empty) or >>,
            list: widgets.list_box(&identity, 43, &empty, 4, 0) or >>,
            input: widgets.input(&context, &identity, 12, &empty, &"Editable input · 你好 Xu") or >>,
            invalid: widgets.input(&context, &identity, 13, &empty, &"Invalid value — custom error colors") or >>,
            read_only: widgets.input(&context, &identity, 14, &empty, &"Read-only · select and copy, edits are ignored") or >>,
            area: widgets.text_area(&context, &identity, 15, &empty, &"TextArea uses the same font, padding and selection theme.\nIME, preedit and caret geometry follow typography changes.") or >>,
            progress: widgets.progress(&empty, 0.64) or >>, scroll: widgets.scroll(&identity, 16, &empty, widgets.AXIS_VERTICAL, 402.0) or >>,
            context: context, icon: context.load_embedded_image(&"logo.png") or >>, switcher: widgets.style_switcher(),
            theme_label: widgets.styled_label(&context, &"Theme: dark / light / contrast"),
            scale_label: widgets.styled_label(&context, &"Text: 100% / 140%"),
            density_label: widgets.styled_label(&context, &"Density: normal / compact"),
            brand_label: widgets.styled_label(&context, &"Local green"),
            disabled_label: widgets.styled_label(&context, &"Disabled"),
            check_label: widgets.styled_label(&context, &"Checkbox"),
            toggle_label: widgets.styled_label(&context, &"Switch"),
            radio_a_label: widgets.styled_label(&context, &"Radio A"),
            radio_b_label: widgets.styled_label(&context, &"Radio B"),
            stepper_label: widgets.styled_label(&context, &"65"),
            badge_label: widgets.styled_label(&context, &"Active"),
            divider_label: widgets.styled_label(&context, &"Navigation & Data Components"),
            card_label: widgets.styled_label(&context, &"Card Panel"),
            tab_label: widgets.styled_label(&context, &"Overview"),
            tab_2_label: widgets.styled_label(&context, &"Tokens"),
            tab_3_label: widgets.styled_label(&context, &"Themes"),
            select_label: widgets.styled_label(&context, &"Option: Auto"),
            option_auto: widgets.styled_label(&context, &"Auto"),
            option_manual: widgets.styled_label(&context, &"Manual"),
            option_locked: widgets.styled_label(&context, &"Locked"),
            list_label: widgets.styled_label(&context, &"1 · Buttons"),
            list_2_label: widgets.styled_label(&context, &"2 · Editors"),
            list_3_label: widgets.styled_label(&context, &"3 · Surfaces"),
            list_4_label: widgets.styled_label(&context, &"4 · Controls")}
        for i in 0:44 {m.transitions.push(widgets.paint_transition() or >>)}
        for id in[4, 5, 6, 8, 10, 32, 33, 34, 36, 40, 41, 43] {view.set_cursor(id, ui.CURSOR_HAND) or >> }
        for id in[12, 13, 14, 15] {view.set_cursor(id, ui.CURSOR_TEXT) or >> }
        view.set_cursor(35, ui.CURSOR_RESIZE_HORIZONTAL) or >>
        badge_ref := $&m.badge
        badge_ref.set_selected(true)
        disabled := $&m.disabled
        disabled.set_enabled(false)
        invalid := $&m.invalid
        invalid.set_invalid(true)
        read_only := $&m.read_only
        read_only.set_read_only(true) or >>
        apply_appearance($&m, $&view) or >>
        brand_scope($&view) or >>
        dispatcher := register_actions(&m, &view) or >>
        $width := 960.0
        $height := 820.0
        $event := ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
        // Drain input bursts before painting. Native text snapshots already hold
        // the latest revision; rendering each queued key would fill the frame queue.
        ui.request_canvas_preferences(&identity) or >>
        while true {
            if event.kind == ui.EV_NONE{
                apply_appearance($&m, $&view) or >>
                m.tick($&view, time.instant()) or >>
                constraints := layout.tight(width, height) or >>
                _ := widgets.layout_styled($&view, &constraints, $&m) or >>
                m.place($&view) or >>
                if widgets.present_styled($&view, &constraints, $&m) or >> {m.acknowledge()}
                event = m.next_event(ech)
            }
            if event.kind == ui.EV_EXIT{ <- }
            if event.window_id == identity.window_id{
                if event.kind == ui.EV_CANVAS_CLOSED || event.kind == ui.EV_CLOSED{ <- }
                if event.kind == ui.EV_CANVAS_METRICS{metrics := ui.metrics_of(&event) or >>
                    width = metrics.width
                    height = metrics.height}
                if event.kind == ui.EV_FOCUSED{ui.request_canvas_preferences(&identity) or >> }
                if event.kind == ui.EV_CANVAS_PREFERENCES{
                    preferences := ui.canvas_preferences_of(&event) or >>
                    if preferences.identity.canvas_id == identity.canvas_id && preferences.identity.generation == identity.generation{
                        m.reduced_motion = preferences.reduced_motion
                        view.mark_paint(1) or >>
                    }
                }
                popup_was_open := m.select_ctrl.is_open()
                actions := m.dispatch_event($&view, &event) or >>
                m.native_event($&view, &event) or >>
                for action in actions{_ := dispatcher.dispatch(&action, $&m, $&view) or >> }
                if ui.is_input_event(event.kind) {input := ui.input_of(&event) or >>
                    if input.kind == ui.EV_KEY_DOWN && input.key == ui.KEY_ESCAPE && !popup_was_open{
                        view.dispose()
                        if demo.alive(&identity) {m.cleanup()}
                        demo.quit() or >>
                        << 0
                    }}
            }
            event = ui.poll_chan(ech)
        }
        view.dispose()
        if demo.alive(&identity) {m.cleanup()}
        << 0
    }
    fn worker(ech chan ui.Event) {scene(ech) or(err) {demo.fail(err.msg())
            << }}
    fn main() int {
        $app := demo.app("Xu UI / Style Gallery", 960, 820) or(err) {eprintln(err.msg())
            << 1}
        xu worker(app.event_ch)
        << app.run() or(err) {eprintln(err.msg())
            << 1}
    }
    Xuevents.xu
    @main
    
    #ui
    #ui/widgets
    
    fn choose_theme(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        m.theme_index =(m.theme_index + 1) % 3
        m.appearance_dirty = true
        << ""
    }
    fn choose_scale(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        if m.text_scale == 1.0 {m.text_scale = 1.4} else {m.text_scale = 1.0}
        m.appearance_dirty = true
        << ""
    }
    fn choose_density(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        if m.density_scale == 1.0 {m.density_scale = 0.8} else {m.density_scale = 1.0}
        m.appearance_dirty = true
        << ""
    }
    fn cycle_option(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        sel := $&m.select_ctrl
        next_opt :=(sel.selected() + 1) % 3
        sel.set_selected(next_opt) or(err) { << err.msg()}
        lbl := $&m.select_label
        if next_opt == 0 {lbl.set_text(&"Option: Auto")}
        if next_opt == 1 {lbl.set_text(&"Option: Manual")}
        if next_opt == 2 {lbl.set_text(&"Option: Locked")}
        screen.mark_measure(41) or(err) { << err.msg()}
        screen.mark_paint(41) or(err) { << err.msg()}
        << ""
    }
    fn scroll(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        screen.set_scroll(16, 0.0, action.value) or(err) { << err.msg()}
        << ""
    }
    fn toggle_badge(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        bdg := $&m.badge
        bdg.set_selected(action.value > 0.5)
        blbl := $&m.badge_label
        if action.value > 0.5 {blbl.set_text(&"Active")} else {blbl.set_text(&"Paused")}
        screen.mark_measure(37) or(err) { << err.msg()}
        screen.mark_paint(37) or(err) { << err.msg()}
        << ""
    }
    fn radio_a_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        rb := $&m.radio_b
        rb.set_value(false)
        screen.mark_paint(34) or(err) { << err.msg()}
        << ""
    }
    fn radio_b_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        ra := $&m.radio_a
        ra.set_value(false)
        screen.mark_paint(33) or(err) { << err.msg()}
        << ""
    }
    fn slider_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        prog := $&m.progress
        prog.set_value(action.value / 100.0) or(err) { << err.msg()}
        screen.mark_paint(11) or(err) { << err.msg()}
        << ""
    }
    fn stepper_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        lbl := $&m.stepper_label
        lbl.set_text(&str(int(action.value)))
        screen.mark_measure(36) or(err) { << err.msg()}
        prog := $&m.progress
        prog.set_value(action.value / 100.0) or(err) { << err.msg()}
        screen.mark_paint(11) or(err) { << err.msg()}
        << ""
    }
    fn tabs_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        clbl := $&m.card_label
        if action.value == 0.0 {clbl.set_text(&"Card · Overview")}
        if action.value == 1.0 {clbl.set_text(&"Card · Tokens")}
        if action.value == 2.0 {clbl.set_text(&"Card · Segmented")}
        screen.mark_measure(42) or(err) { << err.msg()}
        screen.mark_paint(42) or(err) { << err.msg()}
        << ""
    }
    fn option_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        lbl := $&m.select_label
        if action.value == 0.0 {lbl.set_text(&"Option: Auto")}
        if action.value == 1.0 {lbl.set_text(&"Option: Manual")}
        if action.value == 2.0 {lbl.set_text(&"Option: Locked")}
        screen.mark_measure(41) or(err) { << err.msg()}
        screen.mark_paint(41) or(err) { << err.msg()}
        << ""
    }
    fn row_changed(m $&Model, screen $&widgets.View, action &widgets.Action) string {
        clbl := $&m.card_label
        clbl.set_text(&("Card · Row " + str(int(action.value) + 1)))
        screen.mark_measure(42) or(err) { << err.msg()}
        screen.mark_paint(42) or(err) { << err.msg()}
        << ""
    }
    fn register_actions(m &Model, screen &widgets.View) widgets.ActionDispatcher#Model, widgets.View, widgets.Action{
        $d := widgets.action_dispatcher(m, screen)
        d.on(4, widgets.ACTION_ACTIVATE, choose_theme) or >>
        d.on(5, widgets.ACTION_ACTIVATE, choose_scale) or >>
        d.on(6, widgets.ACTION_ACTIVATE, choose_density) or >>
        d.on(41, widgets.ACTION_ACTIVATE, cycle_option) or >>
        d.on(16, widgets.ACTION_SCROLL, scroll) or >>
        d.on(32, widgets.ACTION_CHANGE, toggle_badge) or >>
        d.on(33, widgets.ACTION_CHANGE, radio_a_changed) or >>
        d.on(34, widgets.ACTION_CHANGE, radio_b_changed) or >>
        d.on(35, widgets.ACTION_CHANGE, slider_changed) or >>
        d.on(36, widgets.ACTION_CHANGE, stepper_changed) or >>
        d.on(40, widgets.ACTION_CHANGE, tabs_changed) or >>
        d.on(41, widgets.ACTION_CHANGE, option_changed) or >>
        d.on(43, widgets.ACTION_CHANGE, row_changed) or >>
        << d
    }
    Xustyle.xu
    @main
    
    #ui
    #ui/widgets
    
    fn apply_appearance(m $&Model, view $&widgets.View) int {
        if !m.appearance_dirty{ << 0}
        theme := m.theme_index
        scale := m.text_scale
        density := m.density_scale
        switcher := $&m.switcher
        switcher.use_preset(theme) or >>
        switcher.set_text_scale(scale) or >>
        switcher.set_density(density) or >>
        switcher.apply(view) or >>
        m.appearance_dirty = false
        << 0
    }
  • 16_ui_webview/component_workshop/main.xu

    所需 SDK:Xu 0.10.13-dev.3 · 完整工程 · 下载源码 · events.xu · events_tools.xu · layout.xu · model.xu · style.xu · view.xu

    Xumain.xu
    @main
    
    #ui
    #ui/widgets
    #time
    demo #"github.com/xulang-org/examples/ui_demo"
    
    fn scene(events chan ui.Event) int {
        ready := demo.ready(events) or >>
        if ready.kind == ui.EV_EXIT{ << 0}
        $screen := widgets.screen(&ready) or >>
        screen.resize(1180.0, 900.0) or(err) {screen.dispose()
            >> err}
        screen.set_min_size(920, 780) or(err) {screen.dispose()
            >> err}
        $model := create($&screen) or(err) {screen.dispose()
            >> err}
        workshop_loop(events, $&model, $&screen) or(err) {screen.dispose()
            >> err}
        screen.dispose()
        << 0
    }
    
    fn worker(events chan ui.Event) {scene(events) or(err) {demo.fail(err.msg())
            << }}
    
    fn launch() int {
        $app := demo.app("XUUI / Component Workshop", 1180, 900) or >>
        xu worker(app.event_ch)
        << app.run() or >>
    }
    
    fn main() int { << launch() or(err) {eprintln(err.msg())
            << 1}}
    
    fn next_event(events chan ui.Event, deadline time.Instant) ui.Event{
        if deadline.is_zero() { << <- events}
        delay := deadline.since(time.instant())
        if delay.nanoseconds() <= 0 { << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}}
        timer := delay.timer()
        select {event := <- events{timer.stop()
                << event}
            _ := <- timer.c{timer.stop()}}
        << ui.Event{kind: ui.EV_NONE, window_id: 0, menu_id: "", width: 0, height: 0}
    }
    
    fn workshop_loop(events chan ui.Event, model $&Workshop, screen $&widgets.Screen) int {
        model.apply_locale(screen) or >>
        screen.set_text(model.title, "XUUI  /  Field") or >>
        model.configure_controls(screen) or >>
        model.controls_dirty = false
        model.apply_appearance(screen) or >>
        model.appearance_dirty = false
        $dispatcher := register_events(& * model, & * screen) or >>
        model.layout(screen) or >>
        while screen.is_open() {
            register_notice_events(& * screen, $&dispatcher) or >>
            now := time.instant()
            model.work(screen, now) or >>
            if model.controls_dirty{model.configure_controls(screen) or >>
                model.controls_dirty = false}
            if model.appearance_dirty{model.apply_appearance(screen) or >>
                model.appearance_dirty = false}
            model.apply_page_options(screen) or >>
            model.layout(screen) or >>
            $deadline := screen.advance(now) or >>
            $timed_actions := false
            for action in screen.take_actions() {
                _ := dispatcher.dispatch_or_fallback(&action, model, screen) or >>
                timed_actions = true
            }
            // Reconcile timer-driven values/styles before computing the next wait.
            if timed_actions{ -> }
            _ := screen.render() or >>
            if model.running &&(deadline.is_zero() || model.deadline.before(deadline)) {deadline = model.deadline}
            event := next_event(events, deadline) or >>
            $actions := screen.event(&event) or >>
            $count := 0
            while screen.is_open() && count < 128 {pending := ui.poll_chan(events)
                if pending.kind == ui.EV_NONE{ <- }
                more := screen.event(&pending) or >>
                for action in more{actions.push(action)}
                count += 1}
            for action in actions{register_notice_events(& * screen, $&dispatcher) or >>
                _ := dispatcher.dispatch_or_fallback(&action, model, screen) or >> }
        }
        << 0
    }
    Xuevents.xu
    @main
    
    #ui/widgets
    #time
    #math
    
    // Each control ID has one owner-specific handler. No page-number update switch.
    fn register_events(m &Workshop, s &widgets.Screen) widgets.ActionDispatcher#Workshop, widgets.Screen, widgets.Action{
        $d := widgets.action_dispatcher(m, s)
        for page in m.pages{for id in page.ids{d.on_any(id, sample_action) or >> }}
        d.on(m.navigation, widgets.ACTION_CHANGE, navigate) or >>
        d.on(m.language, widgets.ACTION_CHANGE, language_changed) or >>
        for id in[m.theme, m.density, m.scale, m.reduced] {d.on(id, widgets.ACTION_CHANGE, appearance_changed) or >> }
        d.on(m.state, widgets.ACTION_CHANGE, state_changed) or >>
        d.on(m.custom, widgets.ACTION_ACTIVATE, custom_clicked) or >>
        d.on(m.motion, widgets.ACTION_ACTIVATE, motion_clicked) or >>
        d.on(m.focus, widgets.ACTION_ACTIVATE, focus_clicked) or >>
        for id in m.tools{d.on(id, widgets.ACTION_ACTIVATE, tool_clicked) or >> }
        for i in 0:4 {d.on(m.pages[1].ids[9 + i], widgets.ACTION_CHANGE, appearance_changed) or >> }
        d.on(m.pages[7].ids[1], widgets.ACTION_CHANGE, tree_filter_changed) or >>
        d.on(m.pages[7].ids[0], widgets.ACTION_ITEM_ACTION, node_action) or >>
        d.on(m.pages[8].ids[0], widgets.ACTION_ACTIVATE, task_clicked) or >>
        for kind in[widgets.ACTION_CHANGE, widgets.ACTION_COMMIT] {
            d.on(m.pages[13].ids[0], kind, slider_changed) or >>
            d.on(m.pages[20].ids[0], kind, color_changed) or >>
            d.on(m.pages[40].ids[0], kind, range_changed) or >>
        }
        d.on(m.pages[17].ids[1], widgets.ACTION_CHANGE, multi_filter_changed) or >>
        d.on(m.pages[24].ids[0], widgets.ACTION_ACTIVATE, table_sorted) or >>
        d.on(m.pages[25].ids[0], widgets.ACTION_CHANGE, pagination_changed) or >>
        d.on(m.pages[25].ids[2], widgets.ACTION_CHANGE, page_size_changed) or >>
        for kind in[widgets.ACTION_SUBMIT, widgets.ACTION_COMMIT] {d.on(m.pages[25].ids[1], kind, page_submitted) or >> }
        d.on(m.pages[25].ids[4], widgets.ACTION_ACTIVATE, page_submitted) or >>
        d.on(m.pages[30].ids[1], widgets.ACTION_ACTIVATE, inbox_clicked) or >>
        d.on(m.pages[30].ids[2], widgets.ACTION_ACTIVATE, online_clicked) or >>
        d.on(m.pages[33].ids[0], widgets.ACTION_ACTIVATE, preferences_open) or >>
        d.on(m.pages[33].ids[6], widgets.ACTION_ACTIVATE, preferences_cancel) or >>
        d.on(m.pages[33].ids[7], widgets.ACTION_ACTIVATE, preferences_apply) or >>
        d.on(m.pages[35].ids[0], widgets.ACTION_ACTIVATE, notice_clicked) or >>
        d.on(m.pages[36].ids[0], widgets.ACTION_ACTIVATE, modal_open) or >>
        for i in 2:4 {d.on(m.pages[36].ids[i], widgets.ACTION_ACTIVATE, modal_close) or >> }
        for id in m.pages[38].ids{for kind in[widgets.ACTION_ACTIVATE, widgets.ACTION_CHANGE] {d.on(id, kind, group_changed) or >> }}
        for r in 1:7 {d.on(m.pages[39].ids[r], widgets.ACTION_CHANGE, chart_kind_changed) or >> }
        for kind in[widgets.ACTION_CHART_HOVER, widgets.ACTION_CHART_SELECT] {d.on(m.pages[39].ids[0], kind, chart_hit) or >> }
        d.on(m.pages[39].ids[0], widgets.ACTION_CHART_VIEWPORT, chart_viewport_changed) or >>
        d.on(m.pages[41].ids[0], widgets.ACTION_COMMIT, split_committed) or >>
        for page in 42:45 {for kind in[widgets.ACTION_ACTIVATE, widgets.ACTION_CHANGE] {d.on(m.pages[page].ids[0], kind, menu_action) or >> }}
        d.on(m.pages[45].ids[1], widgets.ACTION_CHANGE, password_visibility_changed) or >>
        for kind in[widgets.ACTION_WEB_LOADING, widgets.ACTION_WEB_LOADED, widgets.ACTION_WEB_FAILED, widgets.ACTION_WEB_PROGRESS] {
            d.on(m.pages[37].ids[0], kind, webview_changed) or >>
        }
        << d
    }
    fn register_notice_events(s &widgets.Screen, d $&widgets.ActionDispatcher#Workshop, widgets.Screen, widgets.Action) int {
        for id in s.notice_ids() {d.on(id, widgets.ACTION_NOTICE_ACTION, notice_action) or >> }
        << 0
    }
    // Adapters catch Xu errors before crossing the function-value ABI.
    fn sample_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        sample_action_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn navigate(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        navigate_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn language_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        language_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn appearance_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        appearance_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn custom_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        custom_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn motion_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        motion_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn focus_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        focus_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn tree_filter_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        tree_filter_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn multi_filter_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        multi_filter_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn slider_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        slider_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn color_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        color_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn pagination_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        pagination_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn page_size_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        page_size_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn page_submitted(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        page_submitted_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn task_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        task_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn inbox_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        inbox_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn online_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        online_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn preferences_open(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        preferences_open_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn preferences_cancel(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        preferences_cancel_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn preferences_apply(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        preferences_apply_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn notice_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        notice_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn notice_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        notice_action_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn modal_open(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        modal_open_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn modal_close(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        modal_close_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn group_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        group_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn chart_kind_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        chart_kind_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn chart_hit(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        chart_hit_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn chart_viewport_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        chart_viewport_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn range_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        range_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn split_committed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        split_committed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn menu_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        menu_action_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn password_visibility_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        password_visibility_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn table_sorted(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        table_sorted_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn node_action(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        node_action_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn webview_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        webview_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn state_changed(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        state_changed_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn sample_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        if a.kind == widgets.ACTION_COMMIT{s.set_text(m.status, "Committed value · " + str(int(a.value))) or >> }
        if a.kind == widgets.ACTION_ACTIVATE{s.set_text(m.status, "Activated / 已激活 · control " + str(a.id)) or >> }
        << 0
    }
    fn navigate_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        old := m.page_snapshot(m.selected)
        if m.selected == 33 || m.selected == 36 {s.close_overlay(old.ids[1]) or >> }
        m.controls_dirty = true
        m.selected = s.selected(m.navigation) or >>
        s.set_scroll_offset(m.preview, 0.0) or >>
        m.appearance_dirty = true
        << 0
    }
    fn language_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.apply_locale(s) or >> }
    fn appearance_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.appearance_dirty = true
        << 0}
    fn custom_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.customized = !m.customized
        m.controls_dirty = true
        m.appearance_dirty = true
        << 0}
    fn motion_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.slow = !m.slow
        m.controls_dirty = true
        m.appearance_dirty = true
        << 0}
    fn focus_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        page := m.page_snapshot(m.selected)
        $target := page.ids[0]
        if m.selected == 31 {target = page.ids[6]}
        s.focus(target) or >>
        << 0
    }
    fn tree_filter_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        s.set_tree_filter(m.pages[7].ids[0], s.text_value(a.id) or >>) or >>
        << 0
    }
    fn multi_filter_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        s.set_multi_filter(m.pages[17].ids[0], s.text_value(a.id) or >>) or >>
        << 0
    }
    fn slider_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        s.set_value(m.pages[13].ids[1], str(int(a.value))) or >>
        << sample_action_update(m, s, a) or >>
    }
    fn color_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        s.set_value(m.pages[20].ids[1], s.color_hex(a.id) or >>) or >>
        s.set_field_invalid(m.pages[20].ids[1], false) or >>
        << sample_action_update(m, s, a) or >>
    }
    fn pagination_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.update_pagination(s, true) or >> }
    fn page_size_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        page := m.page_snapshot(25)
        data := s.pagination_data(page.ids[0]) or >>
        sizes :=[10, 20, 50, 100]
        s.set_pagination_data(page.ids[0], max_int_local(0, data.total), sizes[s.selected(a.id) or >>]) or >>
        << m.update_pagination(s, true) or >>
    }
    fn page_submitted_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << tool_25_update(m, s, 0) or >> }
    fn task_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        if m.running{ << 0}
        m.revision += 1
        m.completed = 0
        m.checksum = 0
        m.running = true
        m.deadline = time.instant()
        s.begin_task(a.id, m.revision) or >>
        << 0
    }
    fn inbox_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.unread = 0
        << m.update_badges(s) or >> }
    fn online_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {m.online = !m.online
        << m.update_badges(s) or >> }
    fn preferences_open_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.open_preferences(s) or >> }
    fn preferences_cancel_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.close_overlay(m.pages[33].ids[1]) or >>
        << 0}
    fn preferences_apply_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        page := m.page_snapshot(33)
        name := s.text_value(page.ids[4]) or >>
        if name.len == 0 {s.set_field_invalid(page.ids[4], true) or >>
            << 0}
        s.set_field_invalid(page.ids[4], false) or >>
        $history := "off"
        if s.toggle_value(page.ids[5]) or >> {history = "on"}
        m.preferences_name = name
        m.preferences_history = s.toggle_value(page.ids[5]) or >>
        s.set_text(page.ids[8], "Current: " + m.preferences_name + " · history " + history) or >>
        s.close_overlay(page.ids[1]) or >>
        << 0
    }
    fn notice_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << tool_35_update(m, s, 0) or >> }
    fn notice_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Undo requested · business state can now be restored.") or >>
        << 0}
    fn modal_open_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.open(m.pages[36].ids[1]) or >>
        << 0}
    fn modal_close_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.close_overlay(m.pages[36].ids[1]) or >>
        << 0}
    fn group_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        values := s.button_group_values(a.id) or >>
        s.set_text(m.status, "ButtonGroup · key " + str(int(a.value)) + " · selected " + str(values.len)) or >>
        << 0
    }
    fn chart_kind_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        m.controls_dirty = true
        m.chart_kind = int(a.value) - 1
        english := (s.selected(m.language) or >>) == 1
        series := chart_data_locale(m.chart_kind, m.revision, english)
        s.set_chart_series(m.pages[39].ids[0], &series) or >>
        s.reset_chart_viewport(m.pages[39].ids[0]) or >>
        m.appearance_dirty = true
        << 0
    }
    fn chart_hit_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        $hit := s.chart_hovered(a.id) or >>
        if a.kind == widgets.ACTION_CHART_SELECT{hit = s.chart_selection(a.id) or >> }
        if hit.valid{s.set_text(m.status, "Series " + str(hit.series_id) + " / point " + str(hit.point_id) + " · " + str(int(hit.y))) or >> }
        << 0
    }
    fn chart_viewport_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Viewport updated · Double click / Home to reset") or >>
        << 0}
    fn range_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int { << m.range_summary(s, a.kind == widgets.ACTION_COMMIT) or >> }
    fn split_committed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Split ratio / 分栏比例 · " + str(int(math.round(a.value * 100.0))) + "%") or >>
        << 0}
    fn menu_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        for index in 42:45 {page := m.page_snapshot(index)
            if page.ids[0] == a.id{s.set_text(page.ids[1], "Action / 操作 · " + str(int(a.value))) or >> }}
        << 0
    }
    fn password_visibility_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_password_visible(m.pages[45].ids[0], s.toggle_value(a.id) or >>) or >>
        << 0}
    fn table_sorted_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        $direction := "ascending / 升序"
        if s.sort_descending(a.id) or >> {direction = "descending / 降序"}
        selected := s.table_selected_row(a.id) or >>
        s.set_text(m.status, "Sorted / 已排序 · " + direction + " · source row " + str(selected)) or >>
        << 0
    }
    fn node_action_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {s.set_text(m.status, "Node action · " + str(int(a.value))) or >>
        << 0}
    fn webview_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        if m.selected != 37 { << 0}s.set_text(m.status, "WebView · event " + str(a.kind) + " · " + str(int(a.value))) or >>
        << 0}
    
    fn state_changed_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        m.controls_dirty = true
        << 0
    }
    Xuevents_tools.xu
    @main
    
    #ui/widgets
    #ui/webview
    #time
    #math
    #errors
    #strconv
    
    fn tool_0_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(0)
        id := page.ids[0]
        $text := "精密 · 清晰 · 可靠。"
        if option == 0 {text = "长中文:输入、选择、复制与原生排版保持一致。Long English text wraps inside its content width. Family 👨‍👩‍👧‍👦 and developer 👩🏽‍💻 remain intact."}
        s.set_text(id, text) or >>
        << 0
    }
    
    fn tool_1_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(1)
        id := page.ids[0]
        s.set_selected_button(id, option == 0) or >>
        << 0
    }
    
    fn tool_2_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(2)
        id := page.ids[0]
        s.set_selected_button(id, option == 0) or >>
        << 0
    }
    
    fn tool_3_update(m $&Workshop, s $&widgets.Screen, option int) int {
        index := 3
        page := m.page_snapshot(3)
        id := page.ids[0]
        if option == 0 {s.set_value(id, "") or >> }
        if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽‍💻 🙂 abcdefghijklmnopqrstuvwxyz"
            if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
            s.set_value(id, value) or >> }
        << 0
    }
    
    fn tool_4_update(m $&Workshop, s $&widgets.Screen, option int) int {
        index := 4
        page := m.page_snapshot(4)
        id := page.ids[0]
        if option == 0 {s.set_value(id, "") or >> }
        if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽‍💻 🙂 abcdefghijklmnopqrstuvwxyz"
            if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
            s.set_value(id, value) or >> }
        << 0
    }
    
    fn tool_5_update(m $&Workshop, s $&widgets.Screen, option int) int {
        index := 5
        page := m.page_snapshot(5)
        id := page.ids[0]
        if option == 0 {s.set_value(id, "") or >> }
        if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽‍💻 🙂 abcdefghijklmnopqrstuvwxyz"
            if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
            s.set_value(id, value) or >> }
        if option == 2 && index >= 5 {m.field_options_dirty = true
            m.field_options_page = index
            m.variant += 1}
        << 0
    }
    
    fn tool_6_update(m $&Workshop, s $&widgets.Screen, option int) int {
        index := 6
        page := m.page_snapshot(6)
        id := page.ids[0]
        if option == 0 {s.set_value(id, "") or >> }
        if option == 1 {$value := "Long text · 很长的中文与 English · 👩🏽‍💻 🙂 abcdefghijklmnopqrstuvwxyz"
            if index == 4 || index == 6 {value = value + "\n第二行\n第三行\n第四行\n第五行\n第六行\n第七行:内部滚动"}
            s.set_value(id, value) or >> }
        if option == 2 && index >= 5 {m.field_options_dirty = true
            m.field_options_page = index
            m.variant += 1}
        << 0
    }
    
    fn tool_7_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(7)
        id := page.ids[0]
        if option == 0 {m.guided = !m.guided
            m.tree_options_dirty = true}
        if option == 1 {s.set_selected(id, 7) or >>
            s.focus(id) or >> }
        if option == 2 {s.set_value(page.ids[1], "") or >>
            s.set_tree_filter(id, "") or >> }
        << 0
    }
    
    fn tool_8_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(8)
        id := page.ids[0]
        if option == 0 {m.variant += 1
            s.set_task_progress_mode(id, m.variant % 3) or >> }
        if option == 1 {m.failure = !m.failure
            s.set_selected_button(m.tools[1], m.failure) or >> }
        if option == 2 && m.running{_ := s.complete_task(id, m.revision, widgets.TASK_CANCELLED) or >>
            m.running = false}
        << 0
    }
    
    fn tool_9_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(9)
        id := page.ids[0]
        s.set_checkbox_indeterminate(id, option == 0) or >>
        if option > 0 {s.set_toggle_value(id, option == 1) or >> }
        << 0
    }
    
    fn tool_10_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(10)
        id := page.ids[0]
        if option == 0 {m.pending_before = s.toggle_value(id) or >>
            s.set_switch_pending(id, true) or >>
            s.set_text(id, "Live preview · Saving…") or >> }
        else {s.set_switch_pending(id, false) or >>
            s.set_toggle_value(id, option == 1 || m.pending_before) or >>
            s.set_invalid(id, option == 2) or >>
            s.set_text(id, "Live preview 实时预览") or >> }
        << 0
    }
    
    fn tool_11_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(11)
        id := page.ids[0]
        s.set_toggle_value(id, option == 0) or >>
        << 0
    }
    
    fn tool_13_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(13)
        id := page.ids[0]
        if option > 0 {s.set_slider_commit_only(id, option == 1) or >> }
        else {text := s.text_value(page.ids[1]) or >>
            value := strconv.parse_float(&text) or(err) {s.set_field_invalid(page.ids[1], true) or >>
                << 0}
            if math.is_nan(value) || math.is_inf(value) || value < 0.0 || value > 100.0 {s.set_field_invalid(page.ids[1], true) or >>
                << 0}
            s.set_number_value(id, value) or >>
            s.set_field_invalid(page.ids[1], false) or >> }
        << 0
    }
    
    fn tool_15_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(15)
        id := page.ids[0]
        if option == 0 {s.set_candidate_open(id, true) or >> }
        else {s.set_select_option_enabled(id, 2, false) or >> }
        << 0
    }
    
    fn tool_16_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(16)
        id := page.ids[0]
        if option < 2 {s.set_combo_custom_values(id, option == 0) or >> }
        else {s.set_value(id, "") or >> }
        << 0
    }
    
    fn tool_17_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(17)
        id := page.ids[0]
        s.select_all(id, option == 0) or >>
        << 0
    }
    
    fn tool_18_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(18)
        id := page.ids[0]
        if option == 0 {s.clear_calendar(id) or >> }
        else {value := time.date(2026, 10, 25, 0, 0, 0, 0)
            s.set_calendar_value(id, value) or >> }
        << 0
    }
    
    fn tool_19_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(19)
        id := page.ids[0]
        s.set_clock_format(id, option == 0, option != 2) or >>
        << 0
    }
    
    fn tool_20_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(20)
        id := page.ids[0]
        $value := "#B4392DFF"
        if option == 0 {value = s.text_value(page.ids[1]) or >> }
        if option == 2 {value = "#3279A080"}
        s.set_color_hex(id, value) or(err) {s.set_field_invalid(page.ids[1], true) or >>
            s.set_text(m.status, err.msg()) or >>
            << 0}
        s.set_field_invalid(page.ids[1], false) or >>
        s.remember_color(id) or >>
        s.set_value(page.ids[1], s.color_hex(id) or >>) or >>
        << 0
    }
    
    fn tool_24_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(24)
        id := page.ids[0]
        s.set_table_status(id,["", "Loading workspace… 正在加载", "Unable to load. Retry when ready."][option]) or >>
        << 0
    }
    
    fn tool_25_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(25)
        id := page.ids[0]
        sizes :=[10, 20, 50, 100]
        size := sizes[s.selected(page.ids[2]) or >>]
        data := s.pagination_data(id) or >>
        if option == 2 {if data.total == 0 {s.set_pagination_data(id, 20000, size) or >> }
            else {s.set_pagination_data(id, 0, size) or >> }}
        else {
            if data.pages == 0 {m.pagination_invalid(s) or >>
                << 0}
            current := s.pagination_data(id) or >>
            $number := current.pages
            if option == 0 {text := s.text_value(page.ids[1]) or >>
                number = strconv.atoi(&text) or(err) {m.pagination_invalid(s) or >>
                    << 0}
                if number < 1 || number > current.pages{m.pagination_invalid(s) or >>
                    << 0}}
            s.set_selected(id, number - 1) or >>
            s.set_field_invalid(page.ids[1], false) or >>
        }
        m.update_pagination(s, true) or >>
        << 0
    }
    
    fn tool_27_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(27)
        id := page.ids[0]
        s.set_number_value(id,[0.0, 0.42, 1.0][option]) or >>
        << 0
    }
    
    fn tool_28_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(28)
        id := page.ids[0]
        if option < 2 {s.set_running(id, option == 0) or >> }
        else {m.spinner_options_dirty = true}
        << 0
    }
    
    fn tool_30_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(30)
        id := page.ids[0]
        if option == 0 {m.unread += 1}
        if option == 1 {m.unread = 0}
        if option == 2 {m.unread = 123}
        m.update_badges(s) or >>
        << 0
    }
    
    fn tool_32_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(32)
        id := page.ids[0]
        if option == 0 {s.set_scroll_offset(id, 0.0) or >> }
        if option == 1 {s.set_scroll_offset(id, 100000.0) or >> }
        if option == 2 {s.focus(page.ids[page.ids.len - 1]) or >> }
        << 0
    }
    
    fn tool_33_update(m $&Workshop, s $&widgets.Screen, option int) int {
        index := 33
        page := m.page_snapshot(33)
        id := page.ids[0]
        if option == 2 {m.variant =(m.variant + 1) % 4
            m.popover_options_dirty = true}
        if option == 0 {if index == 33 {m.open_preferences(s) or >> } else {s.open(page.ids[1]) or >> }}
        else if option == 1 {s.close_overlay(page.ids[1]) or >> }
        << 0
    }
    
    fn tool_34_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(34)
        id := page.ids[0]
        if option == 2 {m.tooltip_side =(m.tooltip_side + 1) % 4
            m.appearance_dirty = true
            s.focus(id) or >>
            s.set_text(m.status, "Tooltip · " +["Bottom 下", "Top 上", "Left 左", "Right 右"][m.tooltip_side] + " · flips at the viewport edge") or >> }
        if option == 0 {s.focus(id) or >> }
        else if option == 1 {s.focus(0) or >> }
        << 0
    }
    
    fn tool_35_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(35)
        id := page.ids[0]
        $notice := widgets.notice(&"Workspace saved · 工作区已保存")
        notice.action = "Undo"
        notice.key = "workspace-save"
        if option == 1 {notice.text = "Changes restored · 已撤销"
            notice.key = "workspace-undo"}
        $count := 1
        if option == 2 {count = 3}
        for i in 0:count{if count > 1 {notice.key = "notice-" + str(i)
                notice.text = "Queued notice " + str(i + 1)}
            _ := s.enqueue_notice(&notice) or >> }
        << 0
    }
    
    fn tool_36_update(m $&Workshop, s $&widgets.Screen, option int) int {
        index := 36
        page := m.page_snapshot(36)
        id := page.ids[0]
        if option == 0 {if index == 33 {m.open_preferences(s) or >> } else {s.open(page.ids[1]) or >> }}
        else if option == 1 {s.close_overlay(page.ids[1]) or >> }
        << 0
    }
    
    fn tool_37_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(37)
        id := page.ids[0]
        if option == 0 {native := s.webview_native(id) or >>
            client := webview.bind_native(&native) or >>
            client.command("reload") or >> }
        else {s.set_visible(id, option == 2) or >> }
        << 0
    }
    
    fn tool_38_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(38)
        id := page.ids[0]
        if option == 0 {m.group_disabled = !m.group_disabled
            m.controls_dirty = true}
        if option == 1 {m.group_vertical = !m.group_vertical}
        if option == 2 {m.group_joined = !m.group_joined}
        m.appearance_dirty = true
        << 0
    }
    
    fn tool_39_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(39)
        id := page.ids[0]
        if option == 0 {m.revision += 1
            english := (s.selected(m.language) or >>) == 1
            series := chart_data_locale(m.chart_kind, m.revision, english)
            s.set_chart_series(id, &series) or >>
            m.chart_paused = false}
        if option == 1 {s.reset_chart_viewport(id) or >> }
        if option == 2 {m.chart_paused = !m.chart_paused
            if m.chart_paused{s.pause_chart_animation(id) or >> }
            else {s.resume_chart_animation(id) or >> }}
        << 0
    }
    
    fn tool_40_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(40)
        id := page.ids[0]
        if option == 0 {m.range_push = !m.range_push}
        if option == 1 {m.range_commit = !m.range_commit}
        if option == 2 {m.range_vertical = !m.range_vertical}
        m.appearance_dirty = true
        m.range_summary(s, false) or >>
        << 0
    }
    
    fn tool_41_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(41)
        id := page.ids[0]
        if option == 0 {m.split_vertical = !m.split_vertical
            m.appearance_dirty = true}
        if option == 1 {m.split_collapsed =(s.split_layout(id) or >>).collapsed == 0
            s.set_split_collapsed(id, 0, m.split_collapsed) or >> }
        if option == 2 {m.split_collapsed = false
            s.set_split_ratio(id, 0.4) or >> }
        << 0
    }
    
    fn tool_42_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(42)
        id := page.ids[0]
        if option == 0 {s.focus(id) or >>
            s.set_menu_open(id, true) or >> }
        if option == 1 {m.menu_stays_open = !m.menu_stays_open
            m.appearance_dirty = true}
        if option == 2 {m.menu_export_disabled = !m.menu_export_disabled
            s.set_menu_item_enabled(id, 30, !m.menu_export_disabled) or >> }
        << 0
    }
    
    fn tool_43_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(43)
        id := page.ids[0]
        if option == 0 {s.focus(id) or >>
            s.set_menu_open(id, true) or >> }
        if option == 1 {m.menu_stays_open = !m.menu_stays_open
            m.appearance_dirty = true}
        if option == 2 {m.menu_export_disabled = !m.menu_export_disabled
            s.set_menu_item_enabled(id, 30, !m.menu_export_disabled) or >> }
        << 0
    }
    
    fn tool_44_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(44)
        id := page.ids[0]
        if option == 0 {s.focus(id) or >>
            s.set_menu_open(id, true) or >> }
        if option == 1 {m.menu_stays_open = !m.menu_stays_open
            m.appearance_dirty = true}
        if option == 2 {m.menu_export_disabled = !m.menu_export_disabled
            s.set_menu_item_enabled(id, 30, !m.menu_export_disabled) or >> }
        << 0
    }
    
    fn tool_45_update(m $&Workshop, s $&widgets.Screen, option int) int {
        page := m.page_snapshot(45)
        id := page.ids[0]
        if option == 0 {s.set_value(id, "") or >> }
        if option == 1 {s.set_value(id, "Xu-密码🙂") or >> }
        if option == 2 {s.focus(id) or >> }
        << 0
    }
    
    fn tool_none_update(m $&Workshop, s $&widgets.Screen, option int) int { << 0}
    
    fn tool_clicked_update(m $&Workshop, s $&widgets.Screen, a &widgets.Action) int {
        handlers :=[tool_0, tool_1, tool_2, tool_3, tool_4, tool_5, tool_6, tool_7, tool_8, tool_9, tool_10, tool_11, tool_none, tool_13, tool_none, tool_15, tool_16, tool_17, tool_18, tool_19, tool_20, tool_none, tool_none, tool_none, tool_24, tool_25, tool_none, tool_27, tool_28, tool_none, tool_30, tool_none, tool_32, tool_33, tool_34, tool_35, tool_36, tool_37, tool_38, tool_39, tool_40, tool_41, tool_42, tool_43, tool_44, tool_45]
        for i in 0:3 {if a.id == m.tools[i] {handler := handlers[m.selected]
                message := handler(m, s, i)
                if message.len > 0 { >> errors.new(message)}
                << 0}}
        << 0
    }
    
    fn tool_clicked(m $&Workshop, s $&widgets.Screen, a &widgets.Action) string {
        tool_clicked_update(m, s, a) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_0(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_0_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_1(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_1_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_2(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_2_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_3(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_3_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_4(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_4_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_5(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_5_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_6(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_6_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_7(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_7_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_8(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_8_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_9(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_9_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_10(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_10_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_11(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_11_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_13(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_13_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_15(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_15_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_16(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_16_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_17(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_17_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_18(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_18_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_19(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_19_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_20(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_20_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_24(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_24_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_25(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_25_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_27(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_27_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_28(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_28_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_30(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_30_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_32(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_32_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_33(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_33_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_34(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_34_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_35(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_35_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_36(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_36_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_37(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_37_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_38(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_38_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_39(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_39_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_40(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_40_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_41(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_41_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_42(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_42_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_43(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_43_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_44(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_44_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_45(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_45_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    
    fn tool_none(m $&Workshop, s $&widgets.Screen, option int) string {
        tool_none_update(m, s, option) or(err) { << err.msg()}
        << ""
    }
    Xulayout.xu
    @main
    
    #ui/widgets
    #ui/layout
    #math
    
    fn focusable_sample(index int) bool { << index != 0 && index != 27 && index != 28 && index != 29 && index != 30}
    
    fn (m &Workshop) layout(s $&widgets.Screen) int {
        styles := s.styles()
        scale := math.max(1.0, styles.text_scale)
        width := s.width()
        height := s.height()
        gap := 16.0
        rail := 216.0 + 40.0 *(scale - 1.0)
        x := rail + 48.0
        right := width - x - 24.0
        row := math.max(40.0 * styles.density, 36.0 * scale)
        s.place(m.title, 24.0, 20.0, width - 48.0, 36.0 * scale) or >>
        $top := 36.0 * scale + 32.0
        items :=[m.theme, m.density, m.scale, m.state]
        part :=(width - 48.0 - gap * 3.0) / 4.0
        for i in 0:4 {s.place(items[i], 24.0 + f64(i) *(part + gap), top, part, row) or >> }
        top += row + 12.0
        s.place(m.custom, 24.0, top, part, row) or >>
        s.place(m.motion, 24.0 + part + gap, top, part, row) or >>
        s.place(m.reduced, 24.0 +(part + gap) * 2.0, top, part, row) or >>
        s.place(m.focus, 24.0 +(part + gap) * 3.0, top, part, row) or >>
        top += row + 24.0
        s.place(m.navigation, 24.0, top, rail, height - top - row - 36.0) or >>
        s.place(m.language, 24.0, height - row - 24.0, rail, row) or >>
        s.place(m.caption, x, top, right, 58.0 * scale) or >>
        control_top := top + 66.0 * scale + 16.0
        content := math.max(100.0, right - 48.0)
        // Keep complete action labels at large text sizes. The toolbar shares the
        // preview's scroll area so wrapping never pushes the sample off the window.
        $columns := 3
        if content < 780.0 * scale{columns = 2}
        if content < 520.0 * scale{columns = 1}
        column :=(content - f64(columns - 1) * 12.0) / f64(columns)
        tool_names := tool_labels(m.selected)
        $tool_count := 0
        for i in 0:3 {if tool_names[i].len > 0 {
                s.place(m.tools[i], 24.0 + f64(tool_count % columns) *(column + 12.0), 24.0 + f64(tool_count / columns) *(row + 12.0), column, row) or >>
                tool_count += 1}}
        $tool_extent := 0.0
        if tool_count > 0 {tool_extent = f64((tool_count + columns - 1) / columns) *(row + 12.0) + 16.0}
        bottom := height - 56.0 * scale - 24.0
        s.place(m.preview, x, control_top, right, math.max(100.0, bottom - control_top)) or >>
        s.place(m.status, x, math.max(bottom + 12.0, control_top + 112.0), right, 52.0 * scale) or >>
        for i in 0:m.pages.len{s.set_visible(m.pages[i].group, i == m.selected) or >> }
        position := m.selected
        pages := &m.pages
        page := &pages[position]
        s.place(page.group, 0.0, tool_extent, right, 1000.0 * scale) or >>
        id := page.ids[0]
        $h := row
        if m.selected == 0 {h = 180.0 * scale}
        if m.selected == 4 {h = 220.0 * scale}
        if m.selected == 5 {h = 96.0 * scale}
        if m.selected == 6 {h = 210.0 * scale}
        if m.selected == 7 || m.selected == 23 || m.selected == 24 || m.selected == 32 || m.selected == 37 {h = 320.0 * scale}
        if m.selected == 12 {h = 144.0 * scale}
        if m.selected == 13 {h = 80.0 * scale}
        if m.selected == 20 {h = 280.0 * scale}
        if m.selected == 27 {h = 16.0 * scale}
        if m.selected == 28 {h = 54.0 * scale}
        if m.selected == 29 {h = 28.0 * scale}
        if m.selected == 30 {h = 320.0 * scale}
        if m.selected == 31 {h = 280.0 * scale}
        $y := 24.0
        if m.selected == 7 || m.selected == 17 {s.place(page.ids[1], 24.0, 24.0, content, 86.0 * scale) or >>
            y += 102.0 * scale}
        $sample_width := content
        if m.selected == 2 {sample_width = row
            h = row}
        if m.selected != 30 && m.selected != 1 {s.place(id, 24.0, y, sample_width, h) or >> }
        if m.selected == 1 {
            buttons := m.page_snapshot(1)
            h = layout_buttons(s, &buttons, content, row, scale) or >>
        }
        if m.selected == 34 {
            size := s.measure_button(id) or >>
            width := math.min(content, math.ceil(size.width))
            s.place(id, 24.0 +(content - width) * 0.5, y + 100.0 * scale, width, math.max(row, size.height)) or >>
            h = math.max(row, size.height) + 200.0 * scale
        }
        if m.selected == 0 {s.place(page.ids[1], 24.0, y + h + 16.0, content, 48.0 * scale) or >>
            h += 80.0 * scale}
        if m.selected == 13 {s.place(page.ids[1], 24.0, y + h + 24.0, content, 100.0 * scale) or >>
            h += 148.0 * scale}
        if m.selected == 25 {
            $summary_height := 28.0 * scale
            if content < 650.0 && scale > 1.4 {summary_height = 56.0 * scale}
            s.place(page.ids[3], 24.0, y, content, summary_height) or >>
            page_y := y + summary_height + 12.0 * scale
            s.place(id, 24.0, page_y, content, row) or >>
            cy := page_y + row + 28.0 * scale
            size_width := math.min(content, 150.0 * scale)
            input_width := 112.0 * scale
            go_width := 88.0 * scale
            $input_x := 40.0 + size_width
            $input_y := cy
            if size_width + input_width + go_width + 32.0 > content{
                input_x = 24.0
                input_y = cy + row + 32.0 * scale}
            s.place(page.ids[2], 24.0, cy, size_width, row) or >>
            s.place(page.ids[1], input_x, input_y - 8.0 * styles.density, input_width, row + 8.0 * styles.density) or >>
            s.place(page.ids[4], input_x + input_width + 16.0, input_y, go_width, row) or >>
            s.place(page.ids[5], 24.0, input_y + row + 12.0 * scale, content, 40.0 * scale) or >>
            h = input_y - y + row + 64.0 * scale
        }
        if m.selected == 33 {
            s.place(id, 24.0, y, math.min(content, 200.0 * scale), row) or >>
            s.place(page.ids[1], 0.0, 0.0, 360.0 * scale, 340.0 * scale) or >>
            s.place(page.ids[2], 24.0 * scale, 20.0 * scale, 312.0 * scale, 30.0 * scale) or >>
            s.place(page.ids[3], 24.0 * scale, 58.0 * scale, 312.0 * scale, 66.0 * scale) or >>
            s.place(page.ids[4], 24.0 * scale, 132.0 * scale, 312.0 * scale, 88.0 * scale) or >>
            s.place(page.ids[5], 24.0 * scale, 224.0 * scale, 312.0 * scale, row) or >>
            s.place(page.ids[6], 24.0 * scale, 280.0 * scale, 148.0 * scale, row) or >>
            s.place(page.ids[7], 188.0 * scale, 280.0 * scale, 148.0 * scale, row) or >>
            s.place(page.ids[8], 24.0, y + row + 20.0 * scale, content, 64.0 * scale) or >>
            h = row + 100.0 * scale
        }
        if m.selected == 20 {s.place(page.ids[1], 24.0, y + h + 24.0, content, 96.0 * scale) or >>
            h += 124.0 * scale}
        if m.selected == 28 || m.selected == 29 {s.place(page.ids[1], 24.0, y + h + 12.0, content, 36.0 * scale) or >>
            h += 60.0 * scale}
        if m.selected == 30 {
            button_width := math.min(content - 16.0, 220.0 * scale)
            s.place(page.ids[1], 24.0, y, button_width, row) or >>
            s.place(page.ids[6], 24.0, y + row + 14.0 * scale, content, 36.0 * scale) or >>
            ay := y + row + 78.0 * scale
            s.place(page.ids[2], 24.0, ay, 56.0 * scale, 56.0 * scale) or >>
            s.place(page.ids[7], 100.0 * scale, ay, math.max(1.0, content - 100.0 * scale), 32.0 * scale) or >>
            s.place(page.ids[8], 100.0 * scale, ay + 34.0 * scale, math.max(1.0, content - 100.0 * scale), 40.0 * scale) or >>
            sy := ay + 106.0 * scale
            tag := s.badge_size(page.ids[4]) or >>
            beta := s.badge_size(page.ids[5]) or >>
            label_width := 220.0 * scale
            $tx := 24.0
            $ty := sy + 44.0 * scale
            if label_width + tag.width + beta.width + 32.0 <= content{
                s.place(page.ids[9], 24.0, sy, label_width, 32.0 * scale) or >>
                tx = 40.0 + label_width
                ty = sy
            } else {s.place(page.ids[9], 24.0, sy, content, 32.0 * scale) or >> }
            s.place(page.ids[4], tx, ty, tag.width, tag.height) or >>
            s.place(page.ids[5], tx + 16.0 + tag.width, ty, beta.width, beta.height) or >>
            h = ty + math.max(tag.height, 32.0 * scale)
        }
        if m.selected == 31 {s.place(page.ids[4], 0.0, 0.0, content - 32.0, 36.0 * scale) or >>
            s.place(page.ids[5], 0.0, 0.0, content - 32.0, 110.0 * scale) or >>
            s.place(page.ids[6], 0.0, 0.0, content - 32.0, row) or >> }
        if m.selected == 32 {s.set_scroll_extent(id, 14.0 *(row + 16.0) + 24.0) or >>
            for i in 1:page.ids.len{s.place(page.ids[i], 12.0, 12.0 + f64(i - 1) *(row + 16.0), content - 44.0, row) or >> }}
        if m.selected == 38 {
            height := row
            $group_h := height
            if m.group_vertical{group_h = row * 3.0}
            $group_width := content
            if m.group_vertical{group_width = math.min(content, 260.0 * scale)}
            for i in 0:3 {cy := y + f64(i) *(group_h + 40.0 * scale)
                s.place(page.ids[3 + i], 24.0, cy, content, 24.0 * scale) or >>
                s.place(page.ids[i], 24.0, cy + 28.0 * scale, group_width, group_h) or >> }
            h = 3.0 *(group_h + 40.0 * scale)
        }
        if m.selected == 39 {
            $selector_h := row
            $selector := widgets.button_group_appearance()
            selector.equal_width = true
            selector.allow_empty = true
            if scale > 1.4 && content < 560.0 {selector.vertical = true
                selector_h = row * 5.0}
            $cy := y
            for r in 0:6 {
                gid := page.ids[1 + r]
                s.set_button_group_appearance(gid, &selector) or >>
                s.place(gid, 24.0, cy, content, selector_h) or >>
                cy += selector_h + 8.0 * scale
            }
            chart_y := cy + 12.0 * scale
            chart_h := math.max(320.0, 320.0 * scale)
            s.place(id, 24.0, chart_y, content, chart_h) or >>
            h = (chart_y - y) + chart_h + 20.0 * scale
        }
        if m.selected >= 40 {h = m.interaction_layout(s, row, scale, content) or >> }
        if m.selected == 36 {s.place(page.ids[2], 24.0 * scale, 190.0 * scale, 170.0 * scale, row) or >>
            s.place(page.ids[3], 210.0 * scale, 190.0 * scale, 170.0 * scale, row) or >> }
        s.set_scroll_extent(m.preview, tool_extent + y + h + 32.0) or >>
        << 0
    }
    
    fn layout_buttons(s $&widgets.Screen, page &Page, content f64, row f64, scale f64) f64 {
        stepper_width := math.min(content, 160.0 * scale)
        label_height := 24.0 * scale
        inspector_height := label_height + 8.0 + row + 12.0
        $cy := 24.0
        // Keep each direction pair together when it fits, then wrap by the native
        // measured size rather than stretching every example across the preview.
        for group in 0:2 {
            $x := 24.0
            $line_height := 0.0
            for i in(group * 2):(group * 2 + 2) {
                size := s.measure_button(page.ids[i]) or >>
                width := math.min(content, math.ceil(size.width))
                height := math.max(row, math.ceil(size.height))
                column := math.max(width, stepper_width)
                if x > 24.0 && x + column > 24.0 + content{
                    x = 24.0
                    cy += line_height + 12.0
                    line_height = 0.0
                }
                s.place(page.ids[13 + i], x, cy, column, label_height) or >>
                s.place(page.ids[9 + i], x, cy + label_height + 8.0, stepper_width, row) or >>
                s.place(page.ids[i], x, cy + inspector_height, width, height) or >>
                x += column + 16.0
                line_height = math.max(line_height, inspector_height + height)
            }
            cy += line_height + 20.0
        }
        $x := 24.0
        $line_height := 0.0
        for i in 4:9 {
            size := s.measure_button(page.ids[i]) or >>
            width := math.min(content, math.ceil(size.width))
            height := math.max(row, math.ceil(size.height))
            if x > 24.0 && x + width > 24.0 + content{
                x = 24.0
                cy += line_height + 12.0
                line_height = 0.0
            }
            s.place(page.ids[i], x, cy, width, height) or >>
            x += width + 12.0
            line_height = math.max(line_height, height)
        }
        cy += line_height + 20.0
        << cy - 24.0
    }
    
    fn (m &Workshop) interaction_layout(s $&widgets.Screen, row f64, scale f64, content f64) f64 {
        position := m.selected
        pages := &m.pages
        page := &pages[position]
        id := page.ids[0]
        if m.selected == 45 {
            width := math.min(content, 380.0 * scale)
            label_height := 28.0 * scale
            input_height := math.max(row, 48.0 * s.styles().density)
            input_y := 24.0 + label_height + 8.0
            s.place(page.ids[2], 24.0, 24.0, width, label_height) or >>
            s.place(id, 24.0, input_y, width, input_height) or >>
            s.place(page.ids[1], 24.0, input_y + input_height + 16.0, content, row) or >>
            s.place(page.ids[3], 24.0, input_y + input_height + row + 36.0, content, 100.0 * scale) or >>
            << label_height + input_height + row + 160.0 * scale
        }
        if m.selected == 40 {
            $width := content
            $height := 104.0 * scale
            if m.range_vertical{width = math.min(content, 160.0 * scale)
                height = 300.0 * scale}
            s.place(page.ids[1], 24.0, 24.0, content, 32.0 * scale) or >>
            s.place(id, 24.0, 64.0 * scale, width, height) or >>
            s.place(page.ids[2], 24.0, 80.0 * scale + height, content, 64.0 * scale) or >>
            << height + 144.0 * scale
        }
        if m.selected == 41 {
            height := 320.0 * scale
            s.place(id, 24.0, 24.0, content, height) or >>
            boxes := s.split_layout(id) or >>
            for pane in 0:2 {
                $width := boxes.first.width
                $height := boxes.first.height
                if pane == 1 {width = boxes.second.width
                    height = boxes.second.height}
                inner := math.max(1.0, width - 32.0)
                caption_height := math.max(1.0, math.min(100.0 * scale, height - row - 48.0))
                s.place(page.ids[3 + pane], 16.0, 16.0, inner, caption_height) or >>
                s.set_visible(page.ids[5 + pane], height >= row + 32.0) or >>
                s.place(page.ids[5 + pane], 16.0, math.max(16.0, height - row - 16.0), inner, row) or >>
            }
            << height
        }
        if m.selected >= 42 && m.selected <= 44 {
            $width := math.min(content, 240.0 * scale)
            $height := row
            if m.selected == 43 {width = content
                height = 180.0 * scale}
            s.place(id, 24.0, 24.0, width, height) or >>
            s.place(page.ids[1], 24.0, height + 44.0 * scale, content, 44.0 * scale) or >>
            s.place(page.ids[2], 24.0, height + 100.0 * scale, content, 80.0 * scale) or >>
            << height + 180.0 * scale
        }
        << row
    }
    Xumodel.xu
    @main
    
    #ui/widgets
    #time
    #strconv
    
    struct Page{group int
        ids []int}
    // A state transition may reconfigure Workshop while these control IDs are in
    // use. Copy the IDs; Screen keeps ownership of the actual controls.
    
    fn (m &Workshop) page_snapshot(index int) Page{
        group := m.pages[index].group
        $ids :=[]int {}
        for id in m.pages[index].ids{ids.push(id)}
        << Page{group: group, ids: ids}
    }
    
    struct Workshop{
        controls_dirty bool
        field_options_page int
        appearance_dirty bool
        tree_options_dirty bool
        field_options_dirty bool
        spinner_options_dirty bool
        popover_options_dirty bool
        tooltip_side int
        range_push bool
        range_vertical bool
        range_commit bool
        split_vertical bool
        split_collapsed bool
        menu_stays_open bool
        menu_export_disabled bool
        chart_kind int
        chart_paused bool
        group_vertical bool
        group_joined bool
        group_disabled bool
        pages []Page
        names []string
        navigation int
        language int
        preview int
        title int
        caption int
        status int
        theme int
        density int
        scale int
        state int
        custom int
        reduced int
        motion int
        focus int
        tools []int
        selected int
        customized bool
        guided bool
        slow bool
        variant int
        revision int
        completed int
        running bool
        failure bool
        pending_before bool
        pagination_error bool
        preferences_name string
        preferences_history bool
        unread int
        online bool
        checksum int
        deadline time.Instant
    }
    
    fn create(s $&widgets.Screen) Workshop{
        labels := names()
        $pages :=[]Page{}
        preview := s.scroll_area(widgets.AXIS_VERTICAL, 760.0) or >>
        for index in 0:labels.len{page := new_page(s, index) or >>
            s.set_parent(page.group, preview) or >>
            pages.push(page)}
        title := s.label("", 25.0, false) or >>
        caption := s.label("", 13.0, true) or >>
        s.set_label_wrapped(caption, true) or >>
        status := s.label("Hover · press · Tab · arrows · Escape / 使用真实鼠标与键盘状态", 12.0, true) or >>
        s.set_label_wrapped(status, true) or >>
        navigation := s.list_box(&labels, 5) or >>
        language := s.select_box(&["中文", "English", "Custom"], 1) or >>
        _ := s.tooltip(language, "Component language · 组件默认文案与格式") or >>
        tools :=[s.button("Option 1") or >>, s.button("Option 2") or >>, s.button("Option 3") or >>]
        for tool in tools{s.set_parent(tool, preview) or >> }
        << Workshop{controls_dirty: true, field_options_page: 5, appearance_dirty: true, tree_options_dirty: false, field_options_dirty: false, spinner_options_dirty: false, popover_options_dirty: false, tooltip_side: widgets.OVERLAY_TOP, range_push: false, range_vertical: false, range_commit: false, split_vertical: false, split_collapsed: false, menu_stays_open: false, menu_export_disabled: false, chart_kind: 0, chart_paused: false, group_vertical: false, group_joined: true, group_disabled: false, language: language, pages: pages, names: labels, navigation: navigation, preview: preview, title: title, caption: caption, status: status,
            theme: s.select_box(&["Light 亮色", "Dark 暗色", "Contrast 对比"], 1) or >>,
            density: s.select_box(&["Normal 常规", "Compact 紧凑", "Touch 触控"], 0) or >>,
            scale: s.select_box(&["Text 100%", "Text 140%", "Text 200%"], 0) or >>,
            state: s.select_box(&["Normal 普通", "Disabled 禁用", "Read only 只读", "Invalid 错误"], 0) or >>,
            custom: s.button("Default 默认") or >>, reduced: s.checkbox("Reduce 减少动效", false) or >>,
            motion: s.button("Motion 160ms") or >>, focus: s.button("Focus sample") or >>,
            tools: tools, selected: 5, customized: false, guided: true, slow: false,
            variant: 0, revision: 0, completed: 0, running: false, failure: false, pending_before: false, pagination_error: false, preferences_name: "XU workspace", preferences_history: true, unread: 12, online: true, checksum: 0, deadline: time.zero_instant()}
    }
    
    fn (m $&Workshop) apply_locale(s $&widgets.Screen) int {
        index := s.selected(m.language) or >>
        $locale := widgets.locale_en_us()
        if index != 1 {locale = widgets.locale_zh_cn()}
        if index == 2 {
            locale.set_text(widgets.TEXT_TODAY, "回到今天") or >>
            locale.set_text(widgets.TEXT_CLEAR, "移除日期") or >>
            locale.set_text(widgets.TEXT_DATE_PLACEHOLDER, "预约日期") or >>
            locale.set_text(widgets.TEXT_DATE_PATTERN, "{day}.{month}.{year}") or >>
            locale.set_text(widgets.TEXT_DECIMAL_SEPARATOR, ",") or >>
            locale.set_text(widgets.TEXT_GROUP_SEPARATOR, " ") or >>
            locale.set_weekdays(&["周日", "周一", "周二", "周三", "周四", "周五", "周六"]) or >>
        }
        s.set_locale(&locale) or >>
        pages := &m.pages
        pagination := &pages[25]
        sizes :=[10, 20, 50, 100]
        for i in 0:4 {s.set_option_text(pagination.ids[2], i, locale.count_text(widgets.TEXT_ITEMS_PER_PAGE, sizes[i]) or >>) or >> }
        m.update_pagination(s, false) or >>
        // Business copy is supplied by the app, never silently translated by the widget.
        english := index == 1
        m.names = names_locale(english)
        for i in 0:m.names.len {s.set_option_text(m.navigation, i, m.names[i]) or >> }
        $themes :=["亮色", "暗色", "高对比"]
        $densities :=["常规", "紧凑", "触控"]
        $scales :=["字号 100%", "字号 140%", "字号 200%"]
        $states :=["普通", "禁用", "只读", "错误"]
        $choices :=["工作区", "历史", "输出"]
        $segments :=["日", "周", "月"]
        $group_titles :=["独立操作", "单选", "多选"]
        $btn_samples :=["构建项目", "打开工作区 · 右侧图标", "保存修改 · 上方图标", "下载 SDK · 下方图标", "次要按钮", "描边按钮", "幽灵按钮", "危险操作", "轻量按钮"]
        $overlay_triggers :=["打开浮层", "聚焦或悬停查看帮助", "发送通知", "打开确认弹窗"]
        if english{
            themes =["Light", "Dark", "Contrast"]
            densities =["Normal", "Compact", "Touch"]
            scales =["Text 100%", "Text 140%", "Text 200%"]
            states =["Normal", "Disabled", "Read only", "Invalid"]
            choices =["Workspace", "History", "Output"]
            segments =["Day", "Week", "Month"]
            group_titles =["Actions", "Single", "Multiple"]
            btn_samples =["Build project", "Open workspace · trailing", "Save changes · above", "Download SDK · below", "Secondary", "Outline", "Ghost", "Danger", "Subtle"]
            overlay_triggers =["Open popover", "Focus or hover for help", "Enqueue notification", "Open confirmation"]
        }
        for i in 0:9 {s.set_text(m.pages[1].ids[i], btn_samples[i]) or >> }
        for i in 0:4 {s.set_text(m.pages[33 + i].ids[0], overlay_triggers[i]) or >> }
        for i in 0:3 {
            s.set_option_text(m.theme, i, themes[i]) or >>
            s.set_option_text(m.density, i, densities[i]) or >>
            s.set_option_text(m.scale, i, scales[i]) or >>
            s.set_option_text(m.pages[21].ids[0], i, choices[i]) or >>
            s.set_option_text(m.pages[22].ids[0], i, segments[i]) or >>
            s.set_text(m.pages[38].ids[3 + i], group_titles[i]) or >>
        }
        for i in 0:4 {s.set_option_text(m.state, i, states[i]) or >> }
        page := &m.pages[8]
        if english {
            s.set_text(page.ids[0], "Build project") or >>
            s.set_task_labels(page.ids[0], "Building", "Built · run again", "Retry build", "Build again") or >>
            s.set_text(m.reduced, "Reduce motion") or >>
            s.set_text(m.focus, "Focus sample") or >>
            s.set_text(m.pages[9].ids[0], "Keep generated files") or >>
            s.set_text(m.pages[10].ids[0], "Live preview") or >>
            s.set_text(m.pages[11].ids[0], "Use workspace settings") or >>
            s.set_text(m.pages[25].ids[4], "Go") or >>
            s.set_text(m.pages[28].ids[1], "Loading assets…") or >>
            s.set_text(m.pages[29].ids[1], "SECTION") or >>
            s.set_text(m.pages[30].ids[1], "Inbox") or >>
            s.set_text(m.pages[30].ids[4], "Synced") or >>
            s.set_text(m.pages[30].ids[9], "Workspace") or >>
            s.set_text(m.pages[31].ids[4], "Workspace configuration") or >>
            s.set_text(m.pages[31].ids[6], "Open workspace") or >>
            s.set_text(m.pages[33].ids[2], "Workspace preferences") or >>
            s.set_text(m.pages[33].ids[5], "Keep history") or >>
            s.set_text(m.pages[33].ids[6], "Cancel") or >>
            s.set_text(m.pages[33].ids[7], "Apply") or >>
            s.set_text(m.pages[36].ids[2], "Cancel") or >>
            s.set_text(m.pages[36].ids[3], "Apply changes") or >>
            s.set_text(m.pages[41].ids[5], "Open workspace") or >>
            s.set_text(m.pages[41].ids[6], "Refresh preview") or >>
            s.set_text(m.pages[45].ids[1], "Show password") or >>
            s.set_text(m.pages[45].ids[2], "Password") or >>
        } else {
            s.set_text(page.ids[0], "构建项目") or >>
            s.set_task_labels(page.ids[0], "正在构建", "已构建 · 再次运行", "重试构建", "再次构建") or >>
            s.set_text(m.reduced, "减少动效") or >>
            s.set_text(m.focus, "聚焦示例") or >>
            s.set_text(m.pages[9].ids[0], "保留生成产物") or >>
            s.set_text(m.pages[10].ids[0], "实时预览") or >>
            s.set_text(m.pages[11].ids[0], "使用工作区设置") or >>
            s.set_text(m.pages[25].ids[4], "跳转") or >>
            s.set_text(m.pages[28].ids[1], "正在加载资源…") or >>
            s.set_text(m.pages[29].ids[1], "章节分隔") or >>
            s.set_text(m.pages[30].ids[1], "收件箱") or >>
            s.set_text(m.pages[30].ids[4], "已同步") or >>
            s.set_text(m.pages[30].ids[9], "工作区") or >>
            s.set_text(m.pages[31].ids[4], "工作区配置") or >>
            s.set_text(m.pages[31].ids[6], "打开工作区") or >>
            s.set_text(m.pages[33].ids[2], "工作区偏好设置") or >>
            s.set_text(m.pages[33].ids[5], "保留历史记录") or >>
            s.set_text(m.pages[33].ids[6], "取消") or >>
            s.set_text(m.pages[33].ids[7], "应用") or >>
            s.set_text(m.pages[36].ids[2], "取消") or >>
            s.set_text(m.pages[36].ids[3], "应用更改") or >>
            s.set_text(m.pages[41].ids[5], "打开工作区") or >>
            s.set_text(m.pages[41].ids[6], "刷新预览") or >>
            s.set_text(m.pages[45].ids[1], "显示密码") or >>
            s.set_text(m.pages[45].ids[2], "密码") or >>
        }
        m.update_badges(s) or >>
        m.range_summary(s, false) or >>
        m.appearance_dirty = true
        $group_labels :=[["Undo", "Redo", "Save"],["Day", "Week", "Month"],["Bold", "Italic", "Underline"]]
        $type_labels :=["Line", "Area", "Bar", "Scatter", "Donut",
            "Step", "StackArea", "StackBar", "H-Bar", "Pie",
            "Rose", "Radar", "Gauge", "Bubble", "Histogram",
            "Boxplot", "Heatmap", "Candle", "Waterfall", "Funnel",
            "Spline", "SplineArea", "PolarBar", "Treemap", "Sankey",
            "Violin", "Bullet", "Lollipop", "Dumbbell", "Pareto"]
        if !english {
            group_labels =[["撤销", "重做", "保存"],["日", "周", "月"],["加粗", "斜体", "下划线"]]
            type_labels =["折线", "面积", "柱状", "散点", "环形",
                "阶梯", "堆叠面积", "堆叠柱状", "水平条形", "饼图",
                "玫瑰", "雷达", "仪表盘", "气泡", "直方图",
                "箱线", "热力", "K 线", "瀑布", "漏斗",
                "样条线", "样条面积", "极坐标环", "树图", "桑基",
                "小提琴", "子弹图", "棒棒糖", "哑铃", "帕累托"]
        }
        for mode in 0:3 {for i in 0:3 {s.set_button_group_label(m.pages[38].ids[mode],(i + 1) * 10, group_labels[mode][i]) or >> }}
        for r in 0:6 {
            gid := m.pages[39].ids[1 + r]
            for k in 0:5 {
                key := r * 5 + k + 1
                s.set_button_group_label(gid, key, type_labels[key - 1]) or >>
            }
        }
        series := chart_data_locale(m.chart_kind, m.revision, english)
        s.set_chart_series(m.pages[39].ids[0], &series) or >>
        translated := workshop_menu_items(english)
        for page_index in 42:45 {for item in translated{s.set_menu_item_label(m.pages[page_index].ids[0], item.key, item.label) or >> }}
        $menu_labels :=["Actions", "Right click here", "Save"]
        if !english {menu_labels =["操作", "右键打开菜单", "保存"]}
        for page_index in 42:45 {s.set_menu_label(m.pages[page_index].ids[0], menu_labels[page_index - 42]) or >> }
        m.controls_dirty = true
    
        << 0
    }
    
    fn max_int_local(a int, b int) int {if a > b{ << a}
        << b}
    
    fn (m &Workshop) open_preferences(s $&widgets.Screen) int {
        pages := &m.pages
        page := &pages[33]
        s.set_value(page.ids[4], m.preferences_name) or >>
        s.set_toggle_value(page.ids[5], m.preferences_history) or >>
        s.set_field_invalid(page.ids[4], false) or >>
        s.open(page.ids[1]) or >>
        << 0
    }
    
    fn (m $&Workshop) pagination_invalid(s $&widgets.Screen) int {
        m.pagination_error = true
        page := m.page_snapshot(25)
        data := s.pagination_data(page.ids[0]) or >>
        s.set_field_invalid(page.ids[1], true) or >>
        $message := "Enter a page from 1 to " + str(data.pages) + "."
        if(s.selected(m.language) or >>) != 1 {message = "请输入 1 至 " + str(data.pages) + " 之间的页码。"}
        if data.pages == 0 {message = "No pages / 暂无数据,无法跳页。"}
        s.set_text(page.ids[5], message) or >>
        << 0
    }
    
    fn (m $&Workshop) update_pagination(s $&widgets.Screen, sync_input bool) int {
        page := m.page_snapshot(25)
        data := s.pagination_data(page.ids[0]) or >>
        s.set_text(page.ids[3], s.pagination_summary(page.ids[0]) or >>) or >>
        s.set_enabled(page.ids[1], data.pages > 0) or >>
        s.set_enabled(page.ids[4], data.pages > 0) or >>
        if sync_input{
            m.pagination_error = false
            s.set_field_invalid(page.ids[1], false) or >>
            $text := ""
            if data.current >= 0 {text = str(data.current + 1)}
            s.set_value(page.ids[1], text) or >> }
        if m.pagination_error{m.pagination_invalid(s) or >> }
        else {$hint := "Enter ↵ · 1–" + str(data.pages)
            if data.pages == 0 {hint = "No data / 暂无数据"}
            s.set_text(page.ids[5], hint) or >> }
        << 0
    }
    
    fn (m &Workshop) update_badges(s $&widgets.Screen) int {
        english := (s.selected(m.language) or >>) == 1
        pages := &m.pages
        page := &pages[30]
        s.set_badge_count(page.ids[0], m.unread, 99, false) or >>
        $summary := str(m.unread) + " 条未读 · 点击收件箱清零,徽标随数字收紧。"
        if english {summary = str(m.unread) + " unread · Click Inbox to clear; badge tightens with digits."}
        s.set_text(page.ids[6], summary) or >>
        s.set_visible(page.ids[3], m.online) or >>
        $name := "林文 · 离线"
        if m.online{name = "林文 · 在线"}
        if english {
            name = "Lin Wen · Away"
            if m.online{name = "Lin Wen · Available"}
        }
        s.set_text(page.ids[7], name) or >>
        << 0
    }
    
    fn (m $&Workshop) work(s $&widgets.Screen, now time.Instant) int {
        if !m.running || now.before(m.deadline) { << 0}
        for i in 0:5000 {m.checksum =(m.checksum + i *(m.completed + 1)) % 1000003}
        m.completed += 1
        id := m.pages[8].ids[0]
        _ := s.set_task_progress(id, m.revision, f64(m.completed) / 48.0) or >>
        m.deadline = now.add(time.milliseconds(35) or >>) or >>
        if m.failure && m.completed == 18 {_ := s.complete_task(id, m.revision, widgets.TASK_ERROR) or >>
            m.running = false
            m.failure = false
            if m.selected == 8 {s.set_selected_button(m.tools[1], false) or >> }}
        else if m.completed == 48 {_ := s.complete_task(id, m.revision, widgets.TASK_SUCCESS) or >>
            m.running = false}
        << 0
    }
    
    fn (m &Workshop) range_summary(s $&widgets.Screen, committed bool) int {
        english := (s.selected(m.language) or >>) == 1
        pages := &m.pages
        page := &pages[40]
        values := s.range_values(page.ids[0]) or >>
        $prefix := "预览"
        if committed{prefix = "已提交"}
        if english {
            prefix = "Preview"
            if committed{prefix = "Committed"}
        }
        text := strconv.format_float(values.lower, 102, 0) or >>
        upper := strconv.format_float(values.upper, 102, 0) or >>
        s.set_text(page.ids[1], prefix + " · " + text + " – " + upper) or >>
        << 0
    }
    
    fn (m $&Workshop) configure_controls(s $&widgets.Screen) int {
        position := m.selected
        page := m.page_snapshot(position)
        s.set_text(m.title, "XUUI  /  " + m.names[position]) or >>
        s.set_selected(m.navigation, position) or >>
        id := page.ids[0]
        state := s.selected(m.state) or >>
        s.set_enabled(id, state != 1) or >>
        if position == 45 {s.set_enabled(page.ids[1], state != 1) or >> }
        if position == 25 {s.set_enabled(page.group, state != 1) or >> }
        if read_only(m.selected) {s.set_read_only(id, state == 2) or >> }
        if invalid(m.selected) || m.selected == 31 || m.selected == 32 {s.set_invalid(id, state == 3) or >> }
        if position == 1 {for i in 0:9 {s.set_enabled(page.ids[i], state != 1) or >> }}
        if position == 38 {for i in 0:3 {
                s.set_button_group_item_enabled(page.ids[i], 20, !m.group_disabled) or >>
                s.set_enabled(page.ids[i], state != 1) or >>
                s.set_read_only(page.ids[i], state == 2) or >>
            }}
        if position == 39 {
            for r in 0:6 {
                gid := page.ids[1 + r]
                for k in 0:5 {
                    key := r * 5 + k + 1
                    s.set_button_group_checked(gid, key, m.chart_kind + 1 == key) or >>
                }
                s.set_enabled(gid, state != 1) or >>
                s.set_read_only(gid, state == 2) or >>
            }
        }
        english := (s.selected(m.language) or >>) == 1
        s.set_enabled(m.motion, animated(m.selected) ||(m.selected >= 33 && m.selected <= 36)) or >>
        s.set_selected_button(m.custom, m.customized) or >>
        $custom_text := "默认样式"
        if m.customized{custom_text = "自定义样式"}
        if english {
            custom_text = "Default"
            if m.customized{custom_text = "Custom"}
        }
        s.set_text(m.custom, custom_text) or >>
        $motion_text := "动效 160ms"
        if m.slow{motion_text = "动效 420ms"}
        if english {
            motion_text = "Motion 160ms"
            if m.slow{motion_text = "Motion 420ms"}
        }
        s.set_text(m.motion, motion_text) or >>
        caption := description_locale(m.selected, english)
        s.set_text(m.caption, caption) or >>
        $state_text := "悬停 · 按下 · Tab · 方向键 · Escape(使用真实鼠标与键盘状态)"
        if english {state_text = "Hover · press · Tab · arrows · Escape"}
        if(state == 2 && !read_only(m.selected)) ||(state == 3 && !invalid(m.selected) && m.selected != 31 && m.selected != 32) {
            state_text = "此组件没有该状态。预览保持其实际语义。"
            if english {state_text = "This component does not have that state; preview keeps its actual semantics."}
        }
        s.set_text(m.status, state_text) or >>
        labels := tool_labels_locale(m.selected, english)
        for i in 0:3 {s.set_text(m.tools[i], labels[i]) or >>
            s.set_selected_button(m.tools[i], false) or >>
            s.set_enabled(m.tools[i], labels[i].len > 0) or >>
            s.set_visible(m.tools[i], labels[i].len > 0) or >> }
        if m.selected == 8 {s.set_selected_button(m.tools[1], m.failure) or >> }
        s.set_visible(m.focus, focusable_sample(m.selected)) or >>
        << 0
    }
    Xustyle.xu
    @main
    
    #ui/widgets
    #ui/chart
    #ui/draw
    #ui/layout
    #time
    
    fn read_only(index int) bool { << index >= 38 ||(index >= 1 && index <= 26 && index != 8 && index != 25 && index != 26)}
    
    fn invalid(index int) bool { << index >= 40 || index >= 1 && index <= 30 && index != 7 && index != 8 && index != 12 && index != 24 && index != 25 && index != 26 && index != 28}
    
    fn animated(index int) bool { <<(index >= 38 && index <= 44) || index == 1 || index == 2 || index == 5 || index == 6 || index == 7 || index == 8 || index == 9 || index == 10 || index == 11 || index == 25}
    
    fn appearance(styles &widgets.Styles, index int) widgets.ControlStyle{
        if index == 0 {$c := styles.input.clone()
            c.padding = layout.Insets{left: 0.0, top: 0.0, right: 0.0, bottom: 0.0}
            c.align_x = 0.0
            c.align_y = 0.0
            << c}
        if index == 7 { << styles.tree_style()}
        if index == 24 { << styles.table_style()}
        if index == 9 || index == 10 || index == 11 || index == 12 { << styles.checkbox.clone()}
        if index == 3 || index == 5 || index == 45 { << styles.input.clone()}
        if index == 4 || index == 6 { << styles.text_area.clone()}
        if index == 13 || index == 40 { << styles.slider_style()}
        if index == 41 { << styles.card_style()}
        if index == 14 { << styles.stepper_style()}
        if index == 15 { << styles.select_style()}
        if index == 21 || index == 22 { << styles.tabs_style()}
        if index == 23 { << styles.list_box_style()}
        if index == 27 { << styles.progress.clone()}
        if index == 29 { << styles.divider_style()}
        if index == 30 { << styles.badge_style()}
        if index == 31 { << styles.card_style()}
        if index == 32 { << styles.scroll.clone()}
        << styles.button.clone()
    }
    
    fn (m $&Workshop) apply_appearance(s $&widgets.Screen) int {
        theme := s.selected(m.theme) or >>
        density := s.selected(m.density) or >>
        scale := s.selected(m.scale) or >>
        preset :=[widgets.THEME_LIGHT, widgets.THEME_DARK, widgets.THEME_CONTRAST][theme]
        $styles := widgets.preset_styles(preset) or >>
        styles.density =[1.0, 0.85, 1.25][density]
        styles.text_scale =[1.0, 1.4, 2.0][scale]
        sheet := widgets.screen_appearance(&styles, s.toggle_value(m.reduced) or >>) or >>
        s.apply_appearance(&sheet) or >>
        position := m.selected
        pages := &m.pages
        page := &pages[position]
        id := page.ids[0]
        if m.selected == 30 {$avatar := styles.button_variant(widgets.BUTTON_SUBTLE) or >>
            avatar.radius = 999.0
            s.set_control_style(page.ids[2], &avatar) or >> }
        if m.selected <= 32 || m.selected >= 40 {
            s.clear_control_style(id) or >>
            if m.customized{$c := appearance(&styles, m.selected)
                c.radius = 14.0
                c.border_width = 1.5
                c.padding.left += 4.0
                c.padding.right += 4.0
                s.set_control_style(id, &c) or >> }
        }
        $spec := widgets.motion_spec()
        if m.slow{spec.change = time.milliseconds(420) or >>
            spec.hover = time.milliseconds(320) or >>
            spec.enter = time.milliseconds(360) or >>
            spec.exit = time.milliseconds(240) or >>
            spec.curve = widgets.EASE_OUT_QUINT}
        if animated(m.selected) {s.set_motion(id, &spec) or >> }
        if m.selected == 1 {
            handles :=[page.ids[0], page.ids[1], page.ids[2], page.ids[3]]
            placements :=[widgets.ICON_LEADING, widgets.ICON_TRAILING, widgets.ICON_ABOVE, widgets.ICON_BELOW]
            english := (s.selected(m.language) or >>) == 1
            for i in 0:4 {
                icon_size := s.number_value(page.ids[9 + i]) or >>
                $icon_prefix := "图标 · "
                if english {icon_prefix = "Icon · "}
                s.set_text(page.ids[13 + i], icon_prefix + str(int(icon_size)) + " px") or >>
                $c := styles.button_variant(widgets.BUTTON_OUTLINE) or >>
                if i == 0 {c = styles.button_variant(widgets.BUTTON_PRIMARY) or >> }
                c.icon_placement = placements[i]
                c.icon_size = icon_size * styles.text_scale
                if m.customized{c.radius = 14.0
                    c.border_width = 1.5}
                s.set_control_style(handles[i], &c) or >>
                s.set_motion(handles[i], &spec) or >>
            }
        }
        if m.selected == 33 || m.selected == 34 || m.selected == 36 {s.set_motion(page.ids[1], &spec) or >>
            $c := styles.overlay_style()
            if m.customized{c.radius = 18.0
                c.border_width = 2.0}
            s.set_control_style(page.ids[1], &c) or >> }
        if m.selected == 34 {
            $placement := widgets.overlay_placement()
            placement.side = m.tooltip_side
            placement.align = widgets.OVERLAY_CENTER
            s.set_tooltip_placement(page.ids[1], &placement) or >>
        }
        if m.selected == 35 {
            s.set_notice_motion(&spec) or >>
            if m.customized{$c := styles.overlay_style()
                c.radius = 18.0
                c.border_width = 2.0
                s.set_notice_style(&c) or >> }
            else {s.clear_notice_style() or >> }
        }
        if m.selected == 38 {
            $group_appearance := widgets.button_group_appearance()
            group_appearance.vertical = m.group_vertical
            group_appearance.joined = m.group_joined
            for i in 0:3 {s.set_button_group_appearance(page.ids[i], &group_appearance) or >>
                s.clear_control_style(page.ids[i]) or >>
                s.set_motion(page.ids[i], &spec) or >>
                if m.customized{$c := styles.button_variant(widgets.BUTTON_OUTLINE) or >>
                    c.radius = 12.0
                    c.border_width = 1.5
                    s.set_control_style(page.ids[i], &c) or >> }}
        }
        if m.selected == 39 {
            s.clear_control_style(id) or >>
            $appearance := chart.chart_appearance()
            appearance.y_unit = " ms"
            if m.chart_kind == widgets.CHART_DONUT || m.chart_kind == widgets.CHART_PIE || m.chart_kind == widgets.CHART_ROSE ||
               m.chart_kind == widgets.CHART_FUNNEL || m.chart_kind == widgets.CHART_TREEMAP || m.chart_kind == widgets.CHART_SANKEY{appearance.y_unit = ""}
            else if m.chart_kind == widgets.CHART_GAUGE || m.chart_kind == widgets.CHART_POLAR_BAR{appearance.y_unit = "%"}
            if m.customized{appearance.grid = false
                appearance.area_opacity = 0.26
                appearance.inner_radius = 0.78
                appearance.palette =[draw.rgb(41, 126, 178), draw.rgb(215, 146, 42), draw.rgb(56, 153, 124)]
                $c := styles.card_style()
                c.radius = 18.0
                s.set_control_style(id, &c) or >> }
            s.set_chart_appearance(id, &appearance) or >>
            $options := widgets.animation_options()
            options.duration = time.milliseconds(650) or >>
            options.curve = widgets.EASE_IN_OUT_CUBIC
            if m.slow{options.duration = time.milliseconds(1200) or >> }
            s.set_chart_animation(id, &options) or >>
            if m.chart_paused{s.pause_chart_animation(id) or >> }
        }
        if m.selected == 40 {
            $options := widgets.range_slider_options()
            options.step = 5.0
            options.min_distance = 10.0
            if m.range_push{options.collision = widgets.RANGE_PUSH}
            options.vertical = m.range_vertical
            options.commit_only = m.range_commit
            s.set_range_options(id, &options) or >>
            $appearance := widgets.slider_appearance()
            appearance.ticks = 11
            appearance.show_value = true
            s.set_range_appearance(id, &appearance) or >>
        }
        if m.selected == 41 {
            $options := widgets.split_view_options()
            options.vertical = m.split_vertical
            options.minimum_first = 120.0 * styles.text_scale
            options.minimum_second = 140.0 * styles.text_scale
            s.set_split_options(id, &options) or >>
        }
        if m.selected >= 42 && m.selected <= 44 {
            $appearance := widgets.menu_appearance()
            appearance.close_on_select = !m.menu_stays_open
            s.set_menu_appearance(id, &appearance) or >>
        }
        if m.selected == 37 {$radius := 8.0
            if m.customized{radius = 18.0}
            s.set_webview_radius(id, radius) or >> }
        << 0
    }
    
    // Business handlers set option flags. Appearance changes run only here.
    fn (m $&Workshop) apply_page_options(s $&widgets.Screen) int {
        if m.tree_options_dirty{
            $appearance := widgets.tree_appearance()
            appearance.guides = m.guided
            s.set_tree_appearance(m.pages[7].ids[0], &appearance) or >>
            m.tree_options_dirty = false
        }
        if m.field_options_dirty{
            $decoration := widgets.field_decoration(&"Project name 项目名称")
            decoration.variant =(m.variant - 1) % 3
            decoration.floating =(m.variant - 1) % 4
            decoration.helper = "Floating / fixed label and stable helper area"
            decoration.error = "Please enter a valid name."
            decoration.clearable = true
            s.set_field_decoration(m.pages[m.field_options_page].ids[0], &decoration) or >>
            m.field_options_dirty = false
        }
        if m.spinner_options_dirty{
            s.set_spinner_appearance(m.pages[28].ids[0], 48.0, 4.0, time.milliseconds(1200) or >>) or >>
            m.spinner_options_dirty = false
        }
        if m.popover_options_dirty{
            $placement := widgets.overlay_placement()
            placement.side = m.variant
            placement.align = widgets.OVERLAY_CENTER
            s.set_popover_placement(m.pages[33].ids[1], &placement) or >>
            m.popover_options_dirty = false
        }
        << 0
    }
    Xuview.xu
    @main
    
    #ui
    #ui/widgets
    #ui/chart
    #ui/draw
    #time
    #math
    
    fn names()[]string { << names_locale(true) }
    
    fn names_locale(english bool)[]string {
        if english {
            <<["StyledLabel", "Button", "IconButton", "Input", "TextArea", "Field", "FieldArea", "TreeView", "TaskButton", "Checkbox", "Switch", "Radio", "RadioGroup", "Slider", "Stepper", "Select", "ComboBox", "MultiSelect", "DatePicker", "TimePicker", "ColorPicker", "Tabs", "Segmented", "ListBox", "Table", "Pagination", "Breadcrumbs", "Progress", "Spinner", "Divider", "Badge", "Card", "Scroll", "Popover", "Tooltip", "ToastHost", "Modal", "WebView", "ButtonGroup", "Chart", "RangeSlider", "SplitView", "Menu", "ContextMenu", "SplitButton", "PasswordInput"]
        }
        <<["StyledLabel 文本", "Button 按钮", "IconButton 图标按钮", "Input 单行输入", "TextArea 多行输入", "Field 表单字段", "FieldArea 多行字段", "TreeView 树形视图", "TaskButton 任务按钮", "Checkbox 复选框", "Switch 开关", "Radio 单选框", "RadioGroup 单选组", "Slider 滑块", "Stepper 步进器", "Select 下拉选择", "ComboBox 组合框", "MultiSelect 多选框", "DatePicker 日期选择", "TimePicker 时间选择", "ColorPicker 颜色选择", "Tabs 标签页", "Segmented 分段控件", "ListBox 列表框", "Table 数据表格", "Pagination 分页器", "Breadcrumbs 面包屑", "Progress 进度条", "Spinner 加载指示", "Divider 分割线", "Badge 徽标", "Card 卡片", "Scroll 滚动容器", "Popover 气泡浮层", "Tooltip 文字提示", "ToastHost 通知队列", "Modal 模态弹窗", "WebView 网页视图", "ButtonGroup 按钮组", "Chart 图表", "RangeSlider 区间滑块", "SplitView 分栏视图", "Menu 下拉菜单", "ContextMenu 右键菜单", "SplitButton 拆分按钮", "PasswordInput 密码框"]
    }
    
    fn new_page(s $&widgets.Screen, index int) Page{
        group := s.group() or >>
        $ids :=[]int {}
        choices :=["Workspace 工作区", "History 历史", "Output 输出"]
        if index == 0 {ids.push(s.label("清晰的层级,让每个细节都服务于使用。\n中文、English 与 emoji 👩🏽‍💻 都使用原生排版。", 20.0, false) or >>)
            s.set_label_wrapped(ids[0], true) or >>
            ids.push(s.label("很长的完整内容:Cluster-safe truncation · 👨‍👩‍👧‍👦 family · workspace / widgets / component.xu", 16.0, false) or >>)
            s.set_label_ellipsis(ids[1], true) or >>
            anchor := ids[1]
            ids.push(s.tooltip(anchor, "很长的完整内容:Cluster-safe truncation · 👨‍👩‍👧‍👦 family · workspace / widgets / component.xu") or >>)}
        if index == 1 {
            $sizes :=[]int {}
            $labels :=[]int {}
            for text in["Build project", "Open workspace · trailing", "Save changes · above", "Download SDK · below"] {
                // Each inspector precedes its own button in both layout and Tab order.
                inspector := s.stepper(12.0, 64.0, 4.0, 24.0) or >>
                sizes.push(inspector)
                _ := s.tooltip(inspector, text + " · Icon size 图标尺寸 (px)") or >>
                labels.push(s.label("Icon 图标 · 24 px", 14.0, true) or >>)
                ids.push(s.button_with_icon("logo.png", text) or >>)}
            for text in["Secondary", "Outline", "Ghost", "Danger", "Subtle"] {ids.push(s.button(text) or >>)}
            s.set_button_variant(ids[0], widgets.BUTTON_PRIMARY) or >>
            for variant in 1:6 {s.set_button_variant(ids[variant + 3], variant) or >> }
            for id in sizes{ids.push(id)}
            for id in labels{ids.push(id)}}
        if index == 2 {ids.push(s.icon_button("logo.png", "Open XU workspace") or >>)
            anchor := ids[0]
            ids.push(s.tooltip(anchor, "Open XU workspace · Enter") or >>)}
        if index == 3 {ids.push(s.input("中文 / English / 🙂") or >>)}
        if index == 4 {ids.push(s.text_area("Native text editing\n选择文字、复制、粘贴,保留输入法会话。\n👩🏽‍💻 family 👨‍👩‍👧‍👦") or >>)}
        if index == 5 || index == 6 {
            $decoration := widgets.field_decoration(&"Project name 项目名称")
            decoration.helper = "Enter a name · Native IME / selection / clipboard"
            decoration.error = "名称不能为空。Please enter a project name."
            decoration.clearable = true
            if index == 5 {decoration.prefix = "xu /"
                ids.push(s.field("", &decoration) or >>)}
            else {ids.push(s.text_field_area("Build notes\n中文与 emoji 🙂", &decoration) or >>)}
            $options := widgets.field_text_options()
            options.counter = true
            options.character_limit = 32
            if index == 6 {options.min_rows = 3
                options.max_rows = 6}
            s.set_field_text_options(ids[0], &options) or >>
        }
        if index == 7 {
            ids.push(s.tree() or >>)
            root := s.tree_add(ids[0], - 1, "XU workspace") or >>
            src := s.tree_add(ids[0], root, "src") or >>
            widgets_node := s.tree_add(ids[0], src, "widgets") or >>
            for name in["tree_view.xu", "task_button.xu", "field.xu", "screen.xu"] {leaf := s.tree_add(ids[0], widgets_node, name) or >>
                s.set_tree_metadata(ids[0], leaf, "Xu") or >>
                s.set_tree_action(ids[0], leaf, true) or >> }
            _ := s.tree_add(ids[0], root, "xu.xun") or >>
            for node in[root, src, widgets_node] {s.set_expanded(ids[0], node, true) or >> }
            $appearance := widgets.tree_appearance()
            appearance.guides = true
            s.set_tree_appearance(ids[0], &appearance) or >>
            $decoration := widgets.field_decoration(&"Find a node")
            decoration.clearable = true
            ids.push(s.field("", &decoration) or >>)
        }
        if index == 8 {ids.push(s.task_button("Build project") or >>)
            s.set_task_labels(ids[0], "Building", "Built · run again", "Retry build", "Build again") or >> }
        if index == 9 {ids.push(s.checkbox("Keep generated files 保留产物", true) or >>)}
        if index == 10 {ids.push(s.switch_control("Live preview 实时预览", true) or >>)}
        if index == 11 {ids.push(s.radio("Use workspace settings", 1, true) or >>)}
        if index == 12 {ids.push(s.radio_group(&choices, 0) or >>)}
        if index == 13 {ids.push(s.slider(0.0, 100.0, 40.0) or >>)
            $appearance := widgets.slider_appearance()
            appearance.ticks = 11
            appearance.show_value = true
            s.set_slider_appearance(ids[0], &appearance, 10.0) or >>
            s.set_slider_commit_only(ids[0], true) or >>
            $decoration := widgets.field_decoration(&"Exact value / 精确数值")
            decoration.helper = "0–100 · step 10 · Apply input"
            decoration.error = "Enter a number between 0 and 100."
            ids.push(s.field("40", &decoration) or >>)}
        if index == 14 {ids.push(s.stepper(0.0, 100.0, 1.0, 24.0) or >>)
            s.set_stepper_repeat(ids[0], true, time.milliseconds(400) or >>, time.milliseconds(80) or >>) or >> }
        if index == 15 {$unavailable := widgets.select_option("Remote (unavailable)")
            unavailable.enabled = false
            options :=[widgets.select_group("LOCAL"), widgets.select_option("Workspace 工作区"), widgets.select_option("History 历史"), widgets.select_group("REMOTE"), unavailable]
            ids.push(s.select_options(&options, 1) or >>)}
        if index == 16 {ids.push(s.combo_box(&choices, "") or >>)
            s.set_combo_custom_values(ids[0], false) or >> }
        if index == 17 {ids.push(s.multi_select(&choices) or >>)
            $decoration := widgets.field_decoration(&"Filter options")
            decoration.clearable = true
            ids.push(s.field("", &decoration) or >>)}
        if index == 18 || index == 19 {value := time.date(2026, 10, 25, 14, 30, 0, 0)
            if index == 18 {ids.push(s.date_picker(value) or >>)
                s.set_date_options(ids[0], value, true) or >> }
            else {ids.push(s.time_picker(value) or >>)
                s.set_clock_format(ids[0], true, true) or >> }}
        if index == 20 {ids.push(s.color_picker(draw.rgb(180, 57, 45)) or >>)
            s.set_color_swatches(ids[0], &[draw.rgb(180, 57, 45), draw.rgb(50, 121, 160), draw.rgb(72, 130, 90)]) or >>
            $decoration := widgets.field_decoration(&"HEX / RGBA")
            decoration.helper = "#RGB, #RGBA, #RRGGBB, #RRGGBBAA"
            decoration.error = "Use a valid HEX value."
            ids.push(s.field("#B4392DFF", &decoration) or >>)}
        if index == 21 {ids.push(s.tabs(&choices, 0) or >>)
            s.set_tab_behavior(ids[0], &[180.0, 144.0, 160.0], false) or >> }
        if index == 22 {ids.push(s.segmented(&["Day", "Week", "Month"], 0) or >>)}
        if index == 23 {ids.push(s.list_box(&["TreeView", "TaskButton", "Field", "Table", "WebView", "Scroll", "Tabs", "Select", "ToastHost"], 0) or >>)
            for row in 0:9 {$detail := widgets.list_row(["TreeView", "TaskButton", "Field", "Table", "WebView", "Scroll", "Tabs", "Select", "ToastHost"][row])
                detail.description = "Native component · 原生交互"
                detail.detail = "Ready"
                detail.icon = widgets.TREE_ICON_FILE
                s.set_list_row(ids[0], row, &detail) or >> }}
        if index == 24 {ids.push(s.table(&["Component", "Build ms", "Status"], 12, 0) or >>)
            components :=["Button", "TreeView", "Field", "Input", "Tabs", "Checkbox", "Switch", "Menu", "WebView", "Chart", "Table", "Badge"]
            durations :=[14, 7, 120, 3, 21, 7, 45, 9, 210, 32, 18, 2]
            for row in 0:12 {s.set_cell(ids[0], row, 0, components[row]) or >>
                s.set_cell(ids[0], row, 1, str(durations[row])) or >>
                s.set_cell(ids[0], row, 2,["Ready", "Review", "Draft"][row % 3]) or >> }
            s.set_table_sort_kind(ids[0], 1, widgets.TABLE_SORT_NUMBER) or >>
            s.set_table_column_min_width(ids[0], 0, 160.0) or >>
            s.set_table_column(ids[0], 0, 280.0, 0.0) or >>
            s.set_table_column(ids[0], 1, 160.0, 1.0) or >>
            s.set_table_column(ids[0], 2, 200.0, 0.0) or >> }
        if index == 25 {ids.push(s.pagination(1000, 122) or >>)
            s.set_pagination_data(ids[0], 20000, 20) or >>
            $decoration := widgets.field_decoration(&"Page 页码")
            decoration.helper = ""
            decoration.error = ""
            decoration.reserve_helper = false
            decoration.floating = widgets.LABEL_ALWAYS
            ids.push(s.field("123", &decoration) or >>)
            ids.push(s.select_box(&["10 / page", "20 / page", "50 / page", "100 / page"], 1) or >>)
            ids.push(s.label("", 14.0, true) or >>)
            s.set_label_wrapped(ids[3], true) or >>
            ids.push(s.button("Go 跳转") or >>)
            ids.push(s.label("", 13.0, true) or >>)
            s.set_label_wrapped(ids[5], true) or >> }
        if index == 26 {ids.push(s.breadcrumbs(&["Home", "XU workspace", "src", "ui", "widgets", "A long Chinese path 中文路径", "field.xu"]) or >>)}
        if index == 27 {ids.push(s.progress(0.42) or >>)
            s.set_progress_buffer(ids[0], 0.72) or >> }
        if index == 28 {ids.push(s.spinner() or >>)
            s.set_spinner_appearance(ids[0], 32.0, 3.0, time.milliseconds(900) or >>) or >>
            s.set_running(ids[0], true) or >>
            ids.push(s.label("Loading assets… 正在加载", 14.0, true) or >>)}
        if index == 29 {ids.push(s.divider(widgets.AXIS_HORIZONTAL) or >>)
            ids.push(s.label("SECTION / 章节", 12.0, true) or >>)}
        if index == 30 {
            inbox := s.button("Inbox 收件箱") or >>
            count := s.badge_on(inbox, "12", widgets.BADGE_COUNT) or >>
            s.set_badge_tone(count, widgets.BADGE_ERROR) or >>
            avatar := s.button("LW") or >>
            s.set_button_variant(avatar, widgets.BUTTON_SUBTLE) or >>
            dot := s.badge_on(avatar, "", widgets.BADGE_DOT) or >>
            s.set_badge_anchor(dot, avatar, 0.86, 0.86) or >>
            s.set_badge_tone(dot, widgets.BADGE_SUCCESS) or >>
            synced := s.badge("Synced 已同步") or >>
            s.set_badge_tone(synced, widgets.BADGE_SUCCESS) or >>
            beta := s.badge("BETA") or >>
            s.set_badge_tone(beta, widgets.BADGE_INFO) or >>
            ids =[count, inbox, avatar, dot, synced, beta,
            s.label("12 unread · 点击收件箱清零,徽标随数字收紧。", 14.0, true) or >>,
            s.label("林文 · Available 在线", 16.0, false) or >>,
            s.label("点击头像切换在线状态;状态点不单独承担文字含义。", 13.0, true) or >>,
            s.label("Workspace 工作区", 16.0, false) or >>]
        }
        if index == 31 {
            ids.push(s.card() or >>)
            sections := s.card_sections(ids[0], 36.0, 44.0) or >>
            for parent in[sections.header, sections.body, sections.footer] {ids.push(parent)}
            ids.push(s.label("Workspace configuration", 18.0, false) or >>)
            ids.push(s.label("Header, body and footer keep distinct spacing.\n正文区域随密度与字号调整。", 14.0, true) or >>)
            s.set_label_wrapped(ids[5], true) or >>
            ids.push(s.button("Open workspace") or >>)
            s.set_parent(ids[4], sections.header) or >>
            s.set_parent(ids[5], sections.body) or >>
            s.set_parent(ids[6], sections.footer) or >>
        }
        if index == 32 {ids.push(s.scroll_area(widgets.AXIS_VERTICAL, 1100.0) or >>)
            for row in 0:14 {id := s.button("Focusable row " + str(row + 1) + " · 滚动内容") or >>
                s.set_parent(id, ids[0]) or >>
                ids.push(id)}}
        if index >= 33 && index <= 36 {ids.push(s.button(["Open popover", "Focus or hover for help", "Enqueue notification", "Open confirmation"][index - 33]) or >>)
            anchor := ids[0]
            if index == 33 {
                ids.push(s.popover(anchor, "") or >>)
                ids.push(s.label("Workspace preferences", 18.0, false) or >>)
                ids.push(s.label("Edit a draft, then apply. Escape or clicking outside dismisses.\n编辑草稿后应用;关闭不会提交。", 13.0, true) or >>)
                s.set_label_wrapped(ids[3], true) or >>
                $decoration := widgets.field_decoration(&"Workspace name 工作区名称")
                decoration.clearable = true
                decoration.error = "名称不能为空 / Enter a name"
                ids.push(s.field("XU workspace", &decoration) or >>)
                ids.push(s.checkbox("Keep history 保留历史", true) or >>)
                ids.push(s.button("Cancel 取消") or >>)
                ids.push(s.button("Apply 应用") or >>)
                s.set_button_variant(ids[7], widgets.BUTTON_PRIMARY) or >>
                ids.push(s.label("Current: XU workspace · history on", 14.0, true) or >>)
                for i in 2:8 {s.set_parent(ids[i], ids[1]) or >> }
            }
            if index == 34 {ids.push(s.tooltip(anchor, "Hover waits 500 ms; keyboard focus shows help immediately.\n鼠标离开或点击收起;Escape 抑制重复提示。") or >>)}
            if index == 36 {ids.push(s.modal("Apply configuration?", "Focus stays inside this confirmation. Escape returns to the trigger.") or >>)
                ids.push(s.button("Cancel") or >>)
                ids.push(s.button("Apply changes") or >>)
                s.set_parent(ids[2], ids[1]) or >>
                s.set_parent(ids[3], ids[1]) or >> }
        }
        if index == 37 {ids.push(s.webview() or >>)
            s.load_web_html(ids[0], "<!doctype html><html><meta charset='utf-8'><style>body{font:16px system-ui;background:#f3f2ee;color:#292c30;padding:24px}input{font:inherit;padding:12px;border:1px solid #747b83;border-radius:6px;width:80%}h2{font-weight:500}</style><h2>WebView is a component.</h2><p>Native focus, clipping and independent lifecycle.</p><input aria-label='Web content' placeholder='中文 / English / 🙂'></html>") or >> }
        if index == 38 {
            actions :=[widgets.button_group_item(10, "Undo"), widgets.button_group_item(20, "Redo"), widgets.button_group_item(30, "Save")]
            group_choices :=[widgets.button_group_item(10, "Day"), widgets.button_group_item(20, "Week"), widgets.button_group_item(30, "Month")]
            formats :=[widgets.button_group_item(10, "Bold"), widgets.button_group_item(20, "Italic"), widgets.button_group_item(30, "Underline")]
            ids.push(s.button_group(&actions, widgets.BUTTON_GROUP_ACTIONS) or >>)
            ids.push(s.button_group(&group_choices, widgets.BUTTON_GROUP_SINGLE) or >>)
            ids.push(s.button_group(&formats, widgets.BUTTON_GROUP_MULTIPLE) or >>)
            ids.push(s.label("Actions / 独立操作", 12.0, true) or >>)
            ids.push(s.label("Single / 单选", 12.0, true) or >>)
            ids.push(s.label("Multiple / 多选", 12.0, true) or >>)
        }
        if index == 39 {
            ids.push(s.chart() or >>)
            row0 :=[widgets.button_group_item(1, "Line"), widgets.button_group_item(2, "Area"), widgets.button_group_item(3, "Bar"), widgets.button_group_item(4, "Scatter"), widgets.button_group_item(5, "Donut")]
            row1 :=[widgets.button_group_item(6, "Step"), widgets.button_group_item(7, "StackArea"), widgets.button_group_item(8, "StackBar"), widgets.button_group_item(9, "H-Bar"), widgets.button_group_item(10, "Pie")]
            row2 :=[widgets.button_group_item(11, "Rose"), widgets.button_group_item(12, "Radar"), widgets.button_group_item(13, "Gauge"), widgets.button_group_item(14, "Bubble"), widgets.button_group_item(15, "Histogram")]
            row3 :=[widgets.button_group_item(16, "Boxplot"), widgets.button_group_item(17, "Heatmap"), widgets.button_group_item(18, "Candle"), widgets.button_group_item(19, "Waterfall"), widgets.button_group_item(20, "Funnel")]
            row4 :=[widgets.button_group_item(21, "Spline"), widgets.button_group_item(22, "SplineArea"), widgets.button_group_item(23, "PolarBar"), widgets.button_group_item(24, "Treemap"), widgets.button_group_item(25, "Sankey")]
            row5 :=[widgets.button_group_item(26, "Violin"), widgets.button_group_item(27, "Bullet"), widgets.button_group_item(28, "Lollipop"), widgets.button_group_item(29, "Dumbbell"), widgets.button_group_item(30, "Pareto")]
            $selector := widgets.button_group_appearance()
            selector.equal_width = true
            selector.allow_empty = true
            rows :=[row0, row1, row2, row3, row4, row5]
            for r in 0:6 {
                gid := s.button_group(&rows[r], widgets.BUTTON_GROUP_SINGLE) or >>
                s.set_button_group_appearance(gid, &selector) or >>
                ids.push(gid)
            }
            series := chart_data(widgets.CHART_LINE, 0)
            s.set_chart_series(ids[0], &series) or >>
        }
        if index == 40 {
            ids.push(s.range_slider(0.0, 100.0, 20.0, 80.0) or >>)
            ids.push(s.label("20 – 80", 18.0, false) or >>)
            ids.push(s.label("Drag either thumb or the selected band. Tab visits both thumbs. Escape cancels a pending edit.\n拖动端点或整段;Tab 访问两个端点。", 14.0, true) or >>)
            s.set_label_wrapped(ids[2], true) or >>
        }
        if index == 41 {
            ids.push(s.split_view(0.4) or >>)
            split := ids[0]
            ids.push(s.split_pane(split, 0) or >>)
            ids.push(s.split_pane(split, 1) or >>)
            ids.push(s.label("Workspace / 工作区\nPane content follows the available size.", 16.0, false) or >>)
            ids.push(s.label("Preview / 预览\nDrag the handle; arrows adjust, Shift accelerates.", 16.0, false) or >>)
            ids.push(s.button("Open workspace") or >>)
            ids.push(s.button("Refresh preview") or >>)
            for i in 0:2 {s.set_label_wrapped(ids[3 + i], true) or >>
                s.set_parent(ids[3 + i], ids[1 + i]) or >>
                s.set_parent(ids[5 + i], ids[1 + i]) or >> }
        }
        if index >= 42 && index <= 44 {
            mode :=[widgets.MENU_DROPDOWN, widgets.MENU_CONTEXT, widgets.MENU_SPLIT][index - 42]
            label :=["Actions", "Right click here · 右键打开菜单", "Save"][index - 42]
            ids.push(s.menu(label, &workshop_menu_items(true), mode, 100) or >>)
            ids.push(s.label("Choose an action · 选择操作", 16.0, false) or >>)
            ids.push(s.label("Check and radio items preserve their state. Navigate submenus with arrows; Escape returns one level.\n操作文案与快捷键由应用配置。", 14.0, true) or >>)
            s.set_label_wrapped(ids[1], true) or >>
            s.set_label_wrapped(ids[2], true) or >>
        }
        if index == 45 {
            ids.push(s.password_input("Xu-密码🙂") or >>)
            ids.push(s.checkbox("Show password 显示密码", false) or >>)
            ids.push(s.label("Password 密码", 15.0, false) or >>)
            ids.push(s.label("Paste is supported. Copy and cut are blocked even when revealed.\n支持粘贴、选择和中英文输入;显隐切换保留内容与光标。", 14.0, true) or >>)
            s.set_label_wrapped(ids[3], true) or >>
        }
        for i in 0:ids.len{
            // Card slots and scroll children retain their content parent.
            if index == 30 &&(i == 0 || i == 3) { -> }
            if index == 31 && i > 0 { -> }
            if index == 41 && i > 0 { -> }
            if index == 32 && i > 0 { -> }
            if index == 36 && i > 1 { -> }
            if index == 33 && i >= 2 && i <= 7 { -> }
            s.set_parent(ids[i], group) or >>
        }
        s.set_visible(group, false) or >>
        << Page{group: group, ids: ids}
    }
    
    fn description(index int) string { << description_locale(index, false) }
    
    fn description_locale(index int, english bool) string {
        if english {
            if index == 45 { << "Unicode grapheme masking; reveal toggle, native editing, read-only and disabled states; copy/cut blocked."}
            if index == 40 { << "Dual-thumb range: step, minimum distance, clamp/push, band dragging; independent focus and commit."}
            if index == 41 { << "Resizable split panes: minimum constraints, collapse/restore, keyboard adjustment; content clipped per pane."}
            if index >= 42 && index <= 44 { << "Action / check / radio / submenu items; keyboard navigation, edge flipping, shortcuts and per-item feedback."}
            if index == 38 { << "Actions / single / multiple selection; per-item disable, arrow navigation, Enter or Space activation."}
            if index == 39 { << "Native interactive charts (30 types): stable-ID transitions, hover/select, legend; Ctrl/⌘ + wheel zoom, drag pan, double-click reset."}
            en :=["Layered body, heading and muted text; native line wrapping and font overrides.",
            "Leading / trailing / above / below icons; independent size steppers and content-width wrapping.",
            "Standalone hit target and action label; keyboard focus also triggers tooltip help.",
            "Native single-line editing: selection, copy, paste and IME composition.",
            "Native multi-line editing: paragraphs, internal scrolling and IME candidate placement.",
            "Floating / fixed labels and three border variants; soft counter never truncates input.",
            "Multi-line Field: min 3 rows, max 6 rows; character counter and stable helper region.",
            "Hierarchy guides, vector arrows, icons, metadata, filtering and node actions.",
            "Real compute batches drive progress; task ID rejects stale callbacks.",
            "Full-row click target; indeterminate mixed state; interruptible check animation.",
            "Track and thumb transition; interruptible rapid toggling; read-only preserves focus.",
            "Single radio item and selection animation; full label hit target.",
            "Arrow keys manage mutual exclusion; Tab enters the group once.",
            "11 ticks, step-10 snapping, value readout; commit on release.",
            "Hold to repeat and accelerate; stops cleanly at bounds.",
            "Typed groups and disabled options; arrow keys skip non-selectable rows.",
            "Local match highlighting and empty state; configurable free-text input.",
            "Candidate filtering, removable tags, select-all and clear actions.",
            "Today / Clear actions; Page Up/Down switches months, Shift switches years.",
            "12/24-hour clock format; stores explicit typed time values.",
            "RGBA channels, exact HEX input, swatches and recent color history.",
            "Variable-width tabs; arrow keys move focus, Enter activates manually.",
            "Segmented selection plate and container semantics distinct from Tabs.",
            "Icon / primary & secondary text / trailing detail; hit testing scales with font size.",
            "Resizable columns, horizontal & vertical scrolling, and data status messages.",
            "First, last and ellipsis items; fast page jumping for large datasets.",
            "Preserves current path; middle segments collapse into an interactive menu.",
            "Determinate progress and buffer shown separately without fabricated percentages.",
            "Configurable size, stroke width and period; static feedback under reduced motion.",
            "Subtle divider paired with section heading; unified horizontal and vertical spec.",
            "Badges in context: unread count, avatar status dot and status tags.",
            "Header / body / footer content slots; actions use standalone Buttons.",
            "True child clipping, wheel bubbling, track dragging and keyboard focus scroll-into-view.",
            "Anchor placement and edge flipping; outside click or Escape dismisses.",
            "Hover delay and immediate focus help; Escape suppresses repeated tooltips.",
            "Up to three visible notices; queueing, deduplication, priority and undo action.",
            "Modal focus loop and restoration; safe action receives initial focus.",
            "Native webview child component with clipping and independent lifecycle."]
            << en[index]
        }
        if index == 45 { << "按 Unicode 字素掩码;显隐切换、原生编辑、只读与禁用,禁止复制或剪切密码。"}
        if index == 40 { << "双端区间:步进、最小间距、端点推挤、整段拖动;独立焦点与提交。"}
        if index == 41 { << "可调整分栏:尺寸约束、折叠恢复、键盘调整;内容保持在各自面板内。"}
        if index >= 42 && index <= 44 { << "动作 / 勾选 / 单选 / 子菜单;键盘、边缘翻转、快捷键与可定制的逐项反馈。"}
        if index == 38 { << "独立操作 / 单选 / 多选;逐项禁用,方向键导航,Enter 或空格激活。"}
        if index == 39 { << "原生交互图表(30 种类型):稳定 ID 数据过渡、悬停/选中、图例;Ctrl/⌘ + 滚轮缩放,拖动平移,双击复位。"}
        descriptions :=["正文、标题与辅助文字分层;原生换行与字体覆盖。",
        "图标左 / 右 / 上 / 下;各自调节尺寸,按钮按内容宽度自动换行。",
        "独立点击目标与动作名称;键盘焦点也能查看提示。",
        "原生单行编辑:选区、复制、粘贴与 IME。",
        "原生多行编辑:段落、内部滚动与输入法候选定位。",
        "浮动标签 / 固定标签 / 三种边框;软计数不截断输入。",
        "多行 Field:最小 3 行、最大 6 行;计数与稳定辅助区。",
        "层级引导、矢量箭头、图标、元数据、筛选和节点动作。",
        "真实计算批次驱动进度;任务 ID 拒绝旧回调。",
        "整行点击;混合态;可中断的勾选显现。",
        "轨道与圆钮过渡;快速切换可中断;只读保留焦点。",
        "单项选择与选中动效;完整标签点击目标。",
        "方向键管理互斥;Tab 只进入一次。",
        "11 个刻度、10 步吸附、数值提示;松开才提交。",
        "按住连续增加并加速;到达边界停止。",
        "有类型的分组 / 禁用选项;方向键跳过不可选行。",
        "本地匹配高亮与无结果;可控制是否接受自由输入。",
        "候选筛选、可移除标签、全选和清空。",
        "今天 / 清空;Page Up/Down 快速翻月,Shift 切年。",
        "12/24 小时可选;存储保持明确的时间值。",
        "RGBA 通道、HEX 精确输入、色板与最近颜色。",
        "可变宽标签;方向键移动,Enter 手动激活。",
        "与 Tabs 分开的选中底板和容器语义。",
        "图标 / 主副文本 / 尾部信息;字体放大后命中保持一致。",
        "拖动调整列宽;横向与纵向滚动;数据状态文字。",
        "首页、末页与省略项;大页数仍可快速定位。",
        "保留当前路径;中间段收进可交互的菜单。",
        "真实确定进度与缓冲区分别显示,不伪造百分比。",
        "大小 / 粗细 / 周期可配置;减少动效显示静态反馈。",
        "弱分隔与章节文字组合;水平和垂直使用同一规范。",
        "Badge 放入真实上下文:未读计数、头像状态点与列表标签。",
        "Header / body / footer 内容槽;动作使用独立 Button。",
        "真实子控件裁剪、滚轮冒泡、轨道拖动与键盘焦点滚入。",
        "锚点定位、边缘翻转;外点 / Escape 关闭。",
        "Hover 延迟、focus 立即显示;Escape 抑制重复提示。",
        "最多三条可见通知;队列、去重、优先级与撤销动作。",
        "模态焦点循环与恢复;安全动作先获得焦点。",
        "原生网页子视图作为 Screen 组件,支持裁剪与独立生命周期。"]
        << descriptions[index]
    }
    
    fn tool_labels(index int)[]string { << tool_labels_locale(index, false) }
    
    fn tool_labels_locale(index int, english bool)[]string {
        if english {
            if index == 45 { <<["Clear", "Reset sample", "Focus input"]}
            if index == 40 { <<["Clamp / push", "Commit mode", "Orientation"]}
            if index == 41 { <<["Orientation", "Collapse / restore", "Reset ratio"]}
            if index >= 42 && index <= 44 { <<["Open menu", "Keep open", "Disable export"]}
            if index == 38 { <<["Disable middle", "Orientation", "Joined / gap"]}
            if index == 39 { <<["Update data", "Reset zoom", "Pause / resume"]}
            if index == 0 { <<["Long text", "Short text", ""]}
            if index == 1 || index == 2 { <<["Select", "Clear selection", ""]}
            if index == 3 || index == 4 { <<["Clear", "Long text", ""]}
            if index == 5 || index == 6 { <<["Clear", "Long text", "Appearance"]}
            if index == 7 { <<["Guides", "Reveal last", "Clear filter"]}
            if index == 8 { <<["Progress mode", "Fail next", "Cancel"]}
            if index == 9 { <<["Mixed", "Checked", "Unchecked"]}
            if index == 10 { <<["Pending", "Resolve", "Fail"]}
            if index == 11 { <<["Select", "Deselect", ""]}
            if index == 13 { <<["Apply input", "Commit only", "Live updates"]}
            if index == 15 { <<["Open", "Disable option", ""]}
            if index == 16 { <<["Allow custom", "Options only", "Clear"]}
            if index == 17 { <<["Select all", "Clear", ""]}
            if index == 18 { <<["Clear", "Set today", ""]}
            if index == 19 { <<["12 hour", "24 hour", "Hide seconds"]}
            if index == 20 { <<["Apply HEX", "Cinnabar", "Transparent"]}
            if index == 24 { <<["Data", "Loading", "Error"]}
            if index == 25 { <<["Jump", "Last page", "Empty / full"]}
            if index == 27 { <<["0%", "42%", "100%"]}
            if index == 28 { <<["Start", "Stop", "Large size"]}
            if index == 30 { <<["+1 unread", "Clear", "99+ overflow"]}
            if index == 32 { <<["Scroll top", "Scroll bottom", "Focus last"]}
            if index == 33 { <<["Open", "Close", "Placement"]}
            if index == 34 { <<["Focus help", "Blur", "Placement"]}
            if index == 35 { <<["Enqueue", "Undo", "Burst 3"]}
            if index == 36 { <<["Open", "Close", ""]}
            if index == 37 { <<["Reload", "Hide", "Show"]}
            <<["", "", ""]
        }
        if index == 45 { <<["清空", "重置示例", "聚焦输入"]}
        if index == 40 { <<["端点限制 / 推挤", "提交模式", "切换方向"]}
        if index == 41 { <<["切换方向", "折叠 / 恢复", "复位比例"]}
        if index >= 42 && index <= 44 { <<["打开菜单", "保持展开", "禁用导出"]}
        if index == 38 { <<["逐项禁用", "切换方向", "拼接 / 间距"]}
        if index == 39 { <<["更新数据", "复位缩放", "暂停 / 继续"]}
        if index == 0 { <<["切换长文", "切换短文", ""]}
        if index == 1 || index == 2 { <<["设为选中", "取消选中", ""]}
        if index == 3 || index == 4 { <<["清空内容", "填充长文", ""]}
        if index == 5 || index == 6 { <<["清空内容", "填充长文", "切换外观"]}
        if index == 7 { <<["引导线", "定位末项", "清空筛选"]}
        if index == 8 { <<["进度外观", "下次失败", "取消任务"]}
        if index == 9 { <<["混合态", "勾选", "取消勾选"]}
        if index == 10 { <<["等待态", "完成切换", "失败恢复"]}
        if index == 11 { <<["选中", "取消选中", ""]}
        if index == 13 { <<["应用输入", "松开提交", "实时更新"]}
        if index == 15 { <<["展开候选", "禁用选项", ""]}
        if index == 16 { <<["允许自由输入", "仅限选项", "清空"]}
        if index == 17 { <<["全选", "清空", ""]}
        if index == 18 { <<["清空日期", "设为今天", ""]}
        if index == 19 { <<["12 小时制", "24 小时制", "隐藏秒数"]}
        if index == 20 { <<["应用 HEX", "朱砂色", "半透明"]}
        if index == 24 { <<["正常数据", "正在加载", "加载错误"]}
        if index == 25 { <<["页码跳转", "跳至末页", "空 / 满数据"]}
        if index == 27 { <<["0%", "42%", "100%"]}
        if index == 28 { <<["开始旋转", "停止旋转", "切换大号"]}
        if index == 30 { <<["+1 未读", "清零未读", "99+ 溢出"]}
        if index == 32 { <<["滚至顶部", "滚至底部", "聚焦末项"]}
        if index == 33 { <<["打开浮层", "关闭浮层", "切换方位"]}
        if index == 34 { <<["聚焦提示", "移出隐藏", "切换方位"]}
        if index == 35 { <<["发送通知", "撤销通知", "连发三条"]}
        if index == 36 { <<["打开确认框", "关闭确认框", ""]}
        if index == 37 { <<["重新加载", "隐藏视图", "恢复显示"]}
        <<["", "", ""]
    }
    
    fn workshop_menu_items(english bool)[]widgets.MenuItem{
        labels :=["Open workspace", "Show grid", "Export", "PNG image", "SVG image", "Unavailable", "Save", "View density", "Compact", "Comfortable"]
        $translated := labels
        if !english{translated =["打开工作区", "显示网格", "导出", "PNG 图片", "SVG 图片", "暂不可用", "保存", "视图密度", "紧凑", "舒适"]}
        $grid := widgets.menu_item(20, translated[1])
        grid.kind = widgets.MENU_CHECK
        $export := widgets.menu_item(30, translated[2])
        export.kind = widgets.MENU_SUBMENU
        $png := widgets.menu_item(31, translated[3])
        png.parent = 30
        $svg := widgets.menu_item(32, translated[4])
        svg.parent = 30
        $unavailable := widgets.menu_item(40, translated[5])
        unavailable.enabled = false
        $save := widgets.menu_item(50, translated[6])
        save.shortcut_key = 115
        save.shortcut_modifiers = ui.MOD_META
        save.shortcut_label = "⌘S"
        $separator := widgets.menu_item(60, "")
        separator.kind = widgets.MENU_SEPARATOR
        $heading := widgets.menu_item(70, translated[7])
        heading.kind = widgets.MENU_HEADING
        $compact := widgets.menu_item(80, translated[8])
        compact.kind = widgets.MENU_RADIO
        compact.radio_group = 1
        $comfortable := widgets.menu_item(81, translated[9])
        comfortable.kind = widgets.MENU_RADIO
        comfortable.radio_group = 1
        comfortable.checked = true
        <<[widgets.menu_item(10, translated[0]), grid, export, png, svg, unavailable, save, separator, heading, compact, comfortable]
    }
    
    fn chart_data(kind int, revision int)[]chart.ChartSeries{
        << chart_data_locale(kind, revision, true)
    }
    
    fn chart_data_locale(kind int, revision int, english bool)[]chart.ChartSeries{
        $result :=[]chart.ChartSeries{}
        $series_count := 2
        single := kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
            kind == widgets.CHART_GAUGE || kind == widgets.CHART_HISTOGRAM || kind == widgets.CHART_BOXPLOT ||
            kind == widgets.CHART_CANDLESTICK || kind == widgets.CHART_WATERFALL || kind == widgets.CHART_FUNNEL ||
            (kind >= widgets.CHART_POLAR_BAR && kind <= widgets.CHART_SANKEY) || kind == widgets.CHART_VIOLIN ||
            kind == widgets.CHART_BULLET || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_PARETO
        if single{series_count = 1}
        if kind == widgets.CHART_HEATMAP{series_count = 3}
        for si in 0:series_count{
            $name := "构建"
            if si == 1 {name = "索引"}
            if si == 2 {name = "绘制"}
            if single{name = "工作量"}
            if english {
                name = "Build"
                if si == 1 {name = "Index"}
                if si == 2 {name = "Render"}
                if single{name = "Workload"}
            }
            $series := chart.chart_series(si + 1, name, kind)
            series.smooth = kind == widgets.CHART_LINE || kind == widgets.CHART_AREA || kind == widgets.CHART_STACKED_AREA ||
                kind == widgets.CHART_SMOOTH_LINE || kind == widgets.CHART_SMOOTH_AREA
            $count := 12 - revision % 2
            if kind == widgets.CHART_SCATTER{count = 64}
            else if kind == widgets.CHART_BUBBLE{count = 16}
            else if kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
                    kind == widgets.CHART_FUNNEL || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{count = 5}
            else if kind == widgets.CHART_RADAR || kind == widgets.CHART_PARETO{count = 6}
            else if kind == widgets.CHART_GAUGE{count = 3}
            else if kind == widgets.CHART_POLAR_BAR{count = 4}
            else if kind == widgets.CHART_HORIZONTAL_BAR || kind == widgets.CHART_HEATMAP || kind == widgets.CHART_BULLET ||
                    kind == widgets.CHART_LOLLIPOP || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_VIOLIN{count = 8}
            else if kind == widgets.CHART_WATERFALL{count = 7}
            for i in 0:count{
                x := f64(i + 1)
                phase := f64(revision) * 0.9 + f64(si) * 1.7
                $y := 48.0 + f64(si) * 20.0 + math.sin(x * 0.55 + phase) * 20.0 + math.cos(x * 0.17 + phase) * 7.0
                if kind == widgets.CHART_FUNNEL || kind == widgets.CHART_PARETO || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{
                    y = f64((count - i) * 22 + (revision % 3) * 4)
                } else if kind == widgets.CHART_GAUGE || kind == widgets.CHART_POLAR_BAR{
                    y = math.max(12.0, math.min(96.0, 34.0 + f64(i) * 18.0 + math.sin(phase + x) * 14.0))
                } else if kind == widgets.CHART_WATERFALL{
                    deltas :=[42.0, 18.0, 0.0 - 14.0, 24.0, 0.0 - 11.0, 16.0, 0.0]
                    y = deltas[i] + math.sin(phase) * 3.0
                    if i == count - 1 {y = 0.0}
                }
                $point := chart.chart_point(i + 1, x, y)
                if kind == widgets.CHART_BUBBLE{
                    point = chart.chart_bubble_point(i + 1, x, y, 12.0 + math.abs(math.cos(x * 0.7 + phase)) * 36.0)
                } else if kind == widgets.CHART_BOXPLOT || kind == widgets.CHART_CANDLESTICK ||
                          kind == widgets.CHART_VIOLIN || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_BULLET{
                    $close := y + math.sin(x * 0.9 + phase) * 12.0
                    if (kind == widgets.CHART_BOXPLOT || kind == widgets.CHART_VIOLIN || kind == widgets.CHART_DUMBBELL || kind == widgets.CHART_BULLET) && close < y{
                        close = y + 10.0
                    }
                    low := math.min(y, close) - 8.0 - math.abs(math.cos(x + phase)) * 6.0
                    high := math.max(y, close) + 8.0 + math.abs(math.sin(x + phase)) * 6.0
                    point = chart.chart_range_point(i + 1, x, y, low, high, close)
                } else if kind == widgets.CHART_WATERFALL && i == count - 1 {
                    point.size = 1.0
                }
                if english {
                    point.label = "Sample " + str(i + 1)
                    if kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
                       kind == widgets.CHART_FUNNEL || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{
                        point.label =["Compile", "Index", "Render", "I/O", "Other"][i]
                    } else if kind == widgets.CHART_RADAR{
                        point.label =["Throughput", "Latency", "Memory", "Startup", "Cache", "Binary"][i]
                    } else if kind == widgets.CHART_GAUGE{
                        point.label =["CPU", "Memory", "Cache"][i]
                    } else if kind == widgets.CHART_POLAR_BAR{
                        point.label =["Core 0", "Core 1", "Core 2", "Core 3"][i]
                    } else if kind == widgets.CHART_WATERFALL && i == count - 1 {
                        point.label = "Total"
                    }
                } else {
                    point.label = "样本 " + str(i + 1)
                    if kind == widgets.CHART_DONUT || kind == widgets.CHART_PIE || kind == widgets.CHART_ROSE ||
                       kind == widgets.CHART_FUNNEL || kind == widgets.CHART_TREEMAP || kind == widgets.CHART_SANKEY{
                        point.label =["编译", "索引", "绘制", "输入输出", "其他"][i]
                    } else if kind == widgets.CHART_RADAR{
                        point.label =["吞吐量", "延迟", "内存", "启动", "缓存", "体积"][i]
                    } else if kind == widgets.CHART_GAUGE{
                        point.label =["处理器", "内存", "缓存"][i]
                    } else if kind == widgets.CHART_POLAR_BAR{
                        point.label =["核心 0", "核心 1", "核心 2", "核心 3"][i]
                    } else if kind == widgets.CHART_WATERFALL && i == count - 1 {
                        point.label = "总计"
                    }
                }
                series.points.push(point)
            }
            result.push(series)
        }
        << result
    }

API 声明

const CHART_LINE

XuAPI
pub const CHART_LINE = 0

用途

常量 CHART_LINE,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_AREA

XuAPI
pub const CHART_AREA = 1

用途

常量 CHART_AREA,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_BAR

XuAPI
pub const CHART_BAR = 2

用途

常量 CHART_BAR,定义了相关的协议或算法配置参数。

const CHART_SCATTER

XuAPI
pub const CHART_SCATTER = 3

用途

常量 CHART_SCATTER,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_DONUT

XuAPI
pub const CHART_DONUT = 4

用途

常量 CHART_DONUT,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_STEP_LINE

XuAPI
pub const CHART_STEP_LINE = 5

用途

常量 CHART_STEP_LINE,定义了相关的协议或算法配置参数。

const CHART_STACKED_AREA

XuAPI
pub const CHART_STACKED_AREA = 6

用途

常量 CHART_STACKED_AREA,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_STACKED_BAR

XuAPI
pub const CHART_STACKED_BAR = 7

用途

常量 CHART_STACKED_BAR,定义了相关的协议或算法配置参数。

const CHART_HORIZONTAL_BAR

XuAPI
pub const CHART_HORIZONTAL_BAR = 8

用途

常量 CHART_HORIZONTAL_BAR,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_PIE

XuAPI
pub const CHART_PIE = 9

用途

常量 CHART_PIE,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_ROSE

XuAPI
pub const CHART_ROSE = 10

用途

常量 CHART_ROSE,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_RADAR

XuAPI
pub const CHART_RADAR = 11

用途

常量 CHART_RADAR,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_GAUGE

XuAPI
pub const CHART_GAUGE = 12

用途

常量 CHART_GAUGE,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_BUBBLE

XuAPI
pub const CHART_BUBBLE = 13

用途

常量 CHART_BUBBLE,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_HISTOGRAM

XuAPI
pub const CHART_HISTOGRAM = 14

用途

常量 CHART_HISTOGRAM,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_BOXPLOT

XuAPI
pub const CHART_BOXPLOT = 15

用途

常量 CHART_BOXPLOT,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_HEATMAP

XuAPI
pub const CHART_HEATMAP = 16

用途

常量 CHART_HEATMAP,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_CANDLESTICK

XuAPI
pub const CHART_CANDLESTICK = 17

用途

常量 CHART_CANDLESTICK,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_WATERFALL

XuAPI
pub const CHART_WATERFALL = 18

用途

常量 CHART_WATERFALL,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_FUNNEL

XuAPI
pub const CHART_FUNNEL = 19

用途

常量 CHART_FUNNEL,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_SMOOTH_LINE

XuAPI
pub const CHART_SMOOTH_LINE = 20

用途

常量 CHART_SMOOTH_LINE,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_SMOOTH_AREA

XuAPI
pub const CHART_SMOOTH_AREA = 21

用途

常量 CHART_SMOOTH_AREA,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_POLAR_BAR

XuAPI
pub const CHART_POLAR_BAR = 22

用途

常量 CHART_POLAR_BAR,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_TREEMAP

XuAPI
pub const CHART_TREEMAP = 23

用途

常量 CHART_TREEMAP,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_SANKEY

XuAPI
pub const CHART_SANKEY = 24

用途

常量 CHART_SANKEY,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_VIOLIN

XuAPI
pub const CHART_VIOLIN = 25

用途

常量 CHART_VIOLIN,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_BULLET

XuAPI
pub const CHART_BULLET = 26

用途

常量 CHART_BULLET,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_LOLLIPOP

XuAPI
pub const CHART_LOLLIPOP = 27

用途

常量 CHART_LOLLIPOP,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_DUMBBELL

XuAPI
pub const CHART_DUMBBELL = 28

用途

常量 CHART_DUMBBELL,定义了相关的协议或算法配置参数。

查看用法示例

const CHART_PARETO

XuAPI
pub const CHART_PARETO = 29

用途

常量 CHART_PARETO,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_CHART_HOVER

XuAPI
pub const ACTION_CHART_HOVER = 40

用途

常量 ACTION_CHART_HOVER,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_CHART_SELECT

XuAPI
pub const ACTION_CHART_SELECT = 41

用途

常量 ACTION_CHART_SELECT,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_CHART_VIEWPORT

XuAPI
pub const ACTION_CHART_VIEWPORT = 42

用途

常量 ACTION_CHART_VIEWPORT,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_CHART_LEGEND

XuAPI
pub const ACTION_CHART_LEGEND = 43

用途

常量 ACTION_CHART_LEGEND,定义了相关的协议或算法配置参数。

chart_appearance

XuAPI
pub fn chart_appearance() chart.ChartAppearance

用途

执行 chart appearance 操作。

参数

无需传入参数。

返回值

chart.ChartAppearance — 该类型的值

chart_series

XuAPI
pub fn chart_series(id int,name string,kind int) chart.ChartSeries

用途

执行 chart series 操作。

参数

id int
id(int)
name string
名字(string)
kind int
类型标签(int)

返回值

chart.ChartSeries — 该类型的值

chart_point

XuAPI
pub fn chart_point(id int,x f64,y f64) chart.ChartPoint

用途

执行 chart point 操作。

参数

id int
id(int)
x f64
值(f64)
y f64
值(f64)

返回值

chart.ChartPoint — 该类型的值

chart_domain

XuAPI
pub fn chart_domain(x_min f64,x_max f64,y_min f64,y_max f64) chart.ChartDomain

用途

执行 chart domain 操作。

参数

x_min f64
x_min(f64)
x_max f64
x_max(f64)
y_min f64
y_min(f64)
y_max f64
y_max(f64)

返回值

chart.ChartDomain — 该类型的值

const ACTION_NONE

XuAPI
pub const ACTION_NONE = 0

用途

常量 ACTION_NONE,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_ACTIVATE

XuAPI
pub const ACTION_ACTIVATE = 1

用途

常量 ACTION_ACTIVATE,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_CHANGE

XuAPI
pub const ACTION_CHANGE = 2

用途

常量 ACTION_CHANGE,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_SCROLL

XuAPI
pub const ACTION_SCROLL = 3

用途

常量 ACTION_SCROLL,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_COMMIT

XuAPI
pub const ACTION_COMMIT = 8

用途

常量 ACTION_COMMIT,定义了相关的协议或算法配置参数。

查看用法示例

struct Action

XuAPI
pub struct Action {
    pub kind int
    pub id int
    pub needs_paint bool
    pub request_focus bool
    pub consumed bool
    pub value f64
}

用途

承载 kind、id、needs_paint、request_focus、consumed 等属性的结构体。

公开字段

kind int
类型标签
id int
字段(int)
needs_paint bool
字段(bool)
request_focus bool
字段(bool)
consumed bool
字段(bool)
value f64
字段(f64)

查看用法示例

struct Theme

XuAPI
pub struct Theme {
    pub normal draw.Color
    pub hovered draw.Color
    pub pressed draw.Color
    pub disabled draw.Color
    pub foreground draw.Color
    pub muted draw.Color
    pub accent draw.Color
    pub focus draw.Color
}

用途

承载 normal、hovered、pressed、disabled、foreground 等属性的结构体。

公开字段

normal draw.Color
字段(draw.Color)
hovered draw.Color
字段(draw.Color)
pressed draw.Color
字段(draw.Color)
disabled draw.Color
字段(draw.Color)
foreground draw.Color
字段(draw.Color)
muted draw.Color
字段(draw.Color)
accent draw.Color
字段(draw.Color)
focus draw.Color
字段(draw.Color)

查看用法示例

default_theme

XuAPI
pub fn default_theme() Theme

用途

执行 default theme 操作。

参数

无需传入参数。

返回值

Theme — 该类型的值

查看用法示例

belongs

XuAPI
pub fn belongs(identity &ui.CanvasEvent,input &ui.InputEvent) bool

用途

执行 belongs 处理。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

bool — 是否成立

copy_rect

XuAPI
pub fn copy_rect(bounds &layout.Rect) layout.Rect

用途

拷贝矩形。

参数

bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

layout.Rect — 该类型的值

copy_identity

XuAPI
pub fn copy_identity(identity &ui.CanvasEvent) ui.CanvasEvent

用途

执行 copy identity 操作。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)

返回值

ui.CanvasEvent — 该类型的值

no_action

XuAPI
pub fn no_action(id int,dirty bool) Action

用途

执行 no action 操作。

参数

id int
id(int)
dirty bool
dirty(bool)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

struct Button

XuAPI
pub struct Button {

}

用途

Button 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

button

XuAPI
pub fn button(identity &ui.CanvasEvent,id int,bounds &layout.Rect) Button

用途

执行 button 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Button — 该类型的值

查看用法示例

(&Button) id

XuAPI
pub fn (button &Button) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Button) is_closed

XuAPI
pub fn (button &Button) is_closed() bool

用途

&Button 上的操作:判断是否 closed。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Button) close

XuAPI
pub fn (button $&Button) close()

用途

$&Button 上的操作:关闭资源。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Button) identity

XuAPI
pub fn (button &Button) identity() ui.CanvasEvent

用途

在 &Button 上执行 identity 操作。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

ui.CanvasEvent — 该类型的值

(&Button) needs_paint

XuAPI
pub fn (button &Button) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_focused

XuAPI
pub fn (button &Button) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_enabled

XuAPI
pub fn (button &Button) is_enabled() bool

用途

返回控件当前是否可用。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_selectable

XuAPI
pub fn (button &Button) is_selectable() bool

用途

&Button 上的操作:判断是否 selectable。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Button) set_selectable

XuAPI
pub fn (button $&Button) set_selectable(selectable bool)

用途

$&Button 上的操作:设置 selectable。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Button) bounds

XuAPI
pub fn (button &Button) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Button) painted

XuAPI
pub fn (button $&Button) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Button) invalidate

XuAPI
pub fn (button $&Button) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Button) cancel

XuAPI
pub fn (button $&Button) cancel()

用途

$&Button 上的操作:取消。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Button) set_enabled

XuAPI
pub fn (button $&Button) set_enabled(enabled bool)

用途

$&Button 上的操作:设置 enabled。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Button) set_focus

XuAPI
pub fn (button $&Button) set_focus(focused bool)

用途

$&Button 上的操作:设置 focus。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Button) set_bounds

XuAPI
pub fn (button $&Button) set_bounds(bounds &layout.Rect) int

用途

$&Button 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Button) input

XuAPI
pub fn (button $&Button) input(input &ui.InputEvent) Action

用途

处理按钮的按下、释放和键盘激活,只有一次完整的激活才触发业务动作。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 在按钮内按下并在内部释放,或聚焦后按下并释放 Enter/空格,产生 ACTION_ACTIVATE;只读状态不会激活。

($&Button) event

XuAPI
pub fn (button $&Button) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

button_size

XuAPI
pub fn button_size(label &draw.TextLayout) layout.Size

用途

执行 button size 操作。

参数

label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)

返回值

layout.Size — 该类型的值

(&Button) paint

XuAPI
pub fn (button &Button) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

struct Checkbox

XuAPI
pub struct Checkbox {

}

用途

Checkbox 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

checkbox

XuAPI
pub fn checkbox(identity &ui.CanvasEvent,id int,bounds &layout.Rect,checked bool) Checkbox

用途

执行 checkbox 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
checked bool
checked(bool)

返回值

Checkbox — 该类型的值

查看用法示例

($&Checkbox) set_focus

XuAPI
pub fn (checkbox $&Checkbox) set_focus(focused bool)

用途

$&Checkbox 上的操作:设置 focus。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Checkbox) set_enabled

XuAPI
pub fn (checkbox $&Checkbox) set_enabled(enabled bool)

用途

$&Checkbox 上的操作:设置 enabled。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Checkbox) set_bounds

XuAPI
pub fn (checkbox $&Checkbox) set_bounds(bounds &layout.Rect) int

用途

$&Checkbox 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Checkbox) needs_paint

XuAPI
pub fn (checkbox &Checkbox) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Checkbox) painted

XuAPI
pub fn (checkbox $&Checkbox) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Checkbox) is_selectable

XuAPI
pub fn (checkbox &Checkbox) is_selectable() bool

用途

&Checkbox 上的操作:判断是否 selectable。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Checkbox) set_selectable

XuAPI
pub fn (checkbox $&Checkbox) set_selectable(selectable bool)

用途

$&Checkbox 上的操作:设置 selectable。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Checkbox) value

XuAPI
pub fn (checkbox &Checkbox) value() bool

用途

&Checkbox 上的操作:值。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Checkbox) is_indeterminate

XuAPI
pub fn (checkbox &Checkbox) is_indeterminate() bool

用途

&Checkbox 上的操作:判断是否 indeterminate。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Checkbox) set_indeterminate

XuAPI
pub fn (checkbox $&Checkbox) set_indeterminate(mixed bool)

用途

$&Checkbox 上的操作:设置 indeterminate。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
mixed bool
mixed(bool)

返回值

不返回值。

($&Checkbox) set_value

XuAPI
pub fn (checkbox $&Checkbox) set_value(checked bool)

用途

设置复选框的勾选状态,并清除不确定状态,适合用业务数据更新控件。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
checked bool
要显示的勾选状态。

返回值

不返回值;状态改变时会标记需要重绘,不生成用户输入动作。

($&Checkbox) input

XuAPI
pub fn (checkbox $&Checkbox) input(input &ui.InputEvent) Action

用途

处理复选框交互,并在用户激活时更新勾选状态。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 改变时返回 ACTION_CHANGE,value 为 1.0(勾选)或 0.0(未勾选);不确定状态首次激活后变为勾选。

($&Checkbox) event

XuAPI
pub fn (checkbox $&Checkbox) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Checkbox) paint

XuAPI
pub fn (checkbox &Checkbox) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

struct Progress

XuAPI
pub struct Progress {

}

用途

Progress 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

progress

XuAPI
pub fn progress(bounds &layout.Rect,value f64) Progress

用途

执行 progress 处理。失败时抛出错误,调用方需处理或继续传播。

参数

bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value f64
value(f64)

返回值

Progress — 该类型的值

查看用法示例

(&Progress) value

XuAPI
pub fn (progress &Progress) value() f64

用途

&Progress 上的操作:值。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Progress) needs_paint

XuAPI
pub fn (progress &Progress) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Progress) painted

XuAPI
pub fn (progress $&Progress) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Progress) is_selectable

XuAPI
pub fn (progress &Progress) is_selectable() bool

用途

&Progress 上的操作:判断是否 selectable。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Progress) set_selectable

XuAPI
pub fn (progress $&Progress) set_selectable(selectable bool)

用途

$&Progress 上的操作:设置 selectable。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Progress) set_value

XuAPI
pub fn (progress $&Progress) set_value(value f64) int

用途

$&Progress 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)

返回值

int — 该类型的值

($&Progress) set_bounds

XuAPI
pub fn (progress $&Progress) set_bounds(bounds &layout.Rect) int

用途

$&Progress 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Progress) paint

XuAPI
pub fn (progress &Progress) paint(frame $&draw.Frame,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

struct Host

XuAPI
pub struct Host {
    pub context draw.Context
    pub identity ui.CanvasEvent
}

用途

UI 宿主环境接口,对接原生窗口、事件循环与剪贴板调度。

公开字段

context draw.Context
字段(draw.Context)
identity ui.CanvasEvent
字段(ui.CanvasEvent)

查看用法示例

attach

XuAPI
pub fn attach(window &ui.Window) Host

用途

执行 attach 处理。失败时抛出错误,调用方需处理或继续传播。

参数

window &ui.Window
window(只读借用,调用方仍持有原值;类型 &ui.Window)

返回值

Host — 该类型的值

const ROLE_NONE

XuAPI
pub const ROLE_NONE = 0

用途

常量 ROLE_NONE,定义了相关的协议或算法配置参数。

const ROLE_WINDOW

XuAPI
pub const ROLE_WINDOW = 1

用途

常量 ROLE_WINDOW,定义了相关的协议或算法配置参数。

const ROLE_GROUP

XuAPI
pub const ROLE_GROUP = 2

用途

常量 ROLE_GROUP,定义了相关的协议或算法配置参数。

const ROLE_BUTTON

XuAPI
pub const ROLE_BUTTON = 3

用途

常量 ROLE_BUTTON,定义了相关的协议或算法配置参数。

const ROLE_CHECKBOX

XuAPI
pub const ROLE_CHECKBOX = 4

用途

常量 ROLE_CHECKBOX,定义了相关的协议或算法配置参数。

const ROLE_SWITCH

XuAPI
pub const ROLE_SWITCH = 5

用途

常量 ROLE_SWITCH,定义了相关的协议或算法配置参数。

const ROLE_RADIO_BUTTON

XuAPI
pub const ROLE_RADIO_BUTTON = 6

用途

常量 ROLE_RADIO_BUTTON,定义了相关的协议或算法配置参数。

const ROLE_TEXT_FIELD

XuAPI
pub const ROLE_TEXT_FIELD = 7

用途

常量 ROLE_TEXT_FIELD,定义了相关的协议或算法配置参数。

const ROLE_TEXT_AREA

XuAPI
pub const ROLE_TEXT_AREA = 8

用途

常量 ROLE_TEXT_AREA,定义了相关的协议或算法配置参数。

const ROLE_LABEL

XuAPI
pub const ROLE_LABEL = 9

用途

常量 ROLE_LABEL,定义了相关的协议或算法配置参数。

const ROLE_SLIDER

XuAPI
pub const ROLE_SLIDER = 10

用途

常量 ROLE_SLIDER,定义了相关的协议或算法配置参数。

const ROLE_STEPPER

XuAPI
pub const ROLE_STEPPER = 11

用途

常量 ROLE_STEPPER,定义了相关的协议或算法配置参数。

const ROLE_TAB_LIST

XuAPI
pub const ROLE_TAB_LIST = 12

用途

常量 ROLE_TAB_LIST,定义了相关的协议或算法配置参数。

const ROLE_TAB

XuAPI
pub const ROLE_TAB = 13

用途

常量 ROLE_TAB,定义了相关的协议或算法配置参数。

const ROLE_TAB_PANEL

XuAPI
pub const ROLE_TAB_PANEL = 14

用途

常量 ROLE_TAB_PANEL,定义了相关的协议或算法配置参数。

const ROLE_SELECT

XuAPI
pub const ROLE_SELECT = 15

用途

常量 ROLE_SELECT,定义了相关的协议或算法配置参数。

const ROLE_LIST

XuAPI
pub const ROLE_LIST = 16

用途

常量 ROLE_LIST,定义了相关的协议或算法配置参数。

const ROLE_LIST_ITEM

XuAPI
pub const ROLE_LIST_ITEM = 17

用途

常量 ROLE_LIST_ITEM,定义了相关的协议或算法配置参数。

const ROLE_TABLE

XuAPI
pub const ROLE_TABLE = 18

用途

常量 ROLE_TABLE,定义了相关的协议或算法配置参数。

const ROLE_TABLE_ROW

XuAPI
pub const ROLE_TABLE_ROW = 19

用途

常量 ROLE_TABLE_ROW,定义了相关的协议或算法配置参数。

const ROLE_TABLE_CELL

XuAPI
pub const ROLE_TABLE_CELL = 20

用途

常量 ROLE_TABLE_CELL,定义了相关的协议或算法配置参数。

const ROLE_TABLE_HEADER

XuAPI
pub const ROLE_TABLE_HEADER = 21

用途

常量 ROLE_TABLE_HEADER,定义了相关的协议或算法配置参数。

const ROLE_TREE

XuAPI
pub const ROLE_TREE = 22

用途

常量 ROLE_TREE,定义了相关的协议或算法配置参数。

const ROLE_TREE_ITEM

XuAPI
pub const ROLE_TREE_ITEM = 23

用途

常量 ROLE_TREE_ITEM,定义了相关的协议或算法配置参数。

const ROLE_PROGRESS_BAR

XuAPI
pub const ROLE_PROGRESS_BAR = 24

用途

常量 ROLE_PROGRESS_BAR,定义了相关的协议或算法配置参数。

const ROLE_SEPARATOR

XuAPI
pub const ROLE_SEPARATOR = 25

用途

常量 ROLE_SEPARATOR,定义了相关的协议或算法配置参数。

const ROLE_MENU

XuAPI
pub const ROLE_MENU = 26

用途

常量 ROLE_MENU,定义了相关的协议或算法配置参数。

const ROLE_MENU_ITEM

XuAPI
pub const ROLE_MENU_ITEM = 27

用途

常量 ROLE_MENU_ITEM,定义了相关的协议或算法配置参数。

const ROLE_DIALOG

XuAPI
pub const ROLE_DIALOG = 28

用途

常量 ROLE_DIALOG,定义了相关的协议或算法配置参数。

const ROLE_TOOLTIP

XuAPI
pub const ROLE_TOOLTIP = 29

用途

常量 ROLE_TOOLTIP,定义了相关的协议或算法配置参数。

const ROLE_TOOLBAR

XuAPI
pub const ROLE_TOOLBAR = 30

用途

常量 ROLE_TOOLBAR,定义了相关的协议或算法配置参数。

const ROLE_SCROLL_BAR

XuAPI
pub const ROLE_SCROLL_BAR = 31

用途

常量 ROLE_SCROLL_BAR,定义了相关的协议或算法配置参数。

const ROLE_BREADCRUMB

XuAPI
pub const ROLE_BREADCRUMB = 32

用途

常量 ROLE_BREADCRUMB,定义了相关的协议或算法配置参数。

const ROLE_BADGE

XuAPI
pub const ROLE_BADGE = 34

用途

常量 ROLE_BADGE,定义了相关的协议或算法配置参数。

const ROLE_CARD

XuAPI
pub const ROLE_CARD = 35

用途

常量 ROLE_CARD,定义了相关的协议或算法配置参数。

const ROLE_CHART

XuAPI
pub const ROLE_CHART = 36

用途

常量 ROLE_CHART,定义了相关的协议或算法配置参数。

const ROLE_COLOR_PICKER

XuAPI
pub const ROLE_COLOR_PICKER = 37

用途

常量 ROLE_COLOR_PICKER,定义了相关的协议或算法配置参数。

const ROLE_DATE_PICKER

XuAPI
pub const ROLE_DATE_PICKER = 38

用途

常量 ROLE_DATE_PICKER,定义了相关的协议或算法配置参数。

const ROLE_TIME_PICKER

XuAPI
pub const ROLE_TIME_PICKER = 39

用途

常量 ROLE_TIME_PICKER,定义了相关的协议或算法配置参数。

const ROLE_SPINNER

XuAPI
pub const ROLE_SPINNER = 40

用途

常量 ROLE_SPINNER,定义了相关的协议或算法配置参数。

const ROLE_COMBOBOX

XuAPI
pub const ROLE_COMBOBOX = 41

用途

常量 ROLE_COMBOBOX,定义了相关的协议或算法配置参数。

const ROLE_SPLIT_VIEW

XuAPI
pub const ROLE_SPLIT_VIEW = 42

用途

常量 ROLE_SPLIT_VIEW,定义了相关的协议或算法配置参数。

const ROLE_WEBVIEW

XuAPI
pub const ROLE_WEBVIEW = 43

用途

常量 ROLE_WEBVIEW,定义了相关的协议或算法配置参数。

const ROLE_PASSWORD_FIELD

XuAPI
pub const ROLE_PASSWORD_FIELD = 44

用途

常量 ROLE_PASSWORD_FIELD,定义了相关的协议或算法配置参数。

const ROLE_POPOVER

XuAPI
pub const ROLE_POPOVER = 45

用途

常量 ROLE_POPOVER,定义了相关的协议或算法配置参数。

const ROLE_TOAST

XuAPI
pub const ROLE_TOAST = 46

用途

常量 ROLE_TOAST,定义了相关的协议或算法配置参数。

const ACC_STATE_DISABLED

XuAPI
pub const ACC_STATE_DISABLED = 1

用途

常量 ACC_STATE_DISABLED,定义了相关的协议或算法配置参数。

const ACC_STATE_FOCUSED

XuAPI
pub const ACC_STATE_FOCUSED = 2

用途

常量 ACC_STATE_FOCUSED,定义了相关的协议或算法配置参数。

const ACC_STATE_SELECTED

XuAPI
pub const ACC_STATE_SELECTED = 4

用途

常量 ACC_STATE_SELECTED,定义了相关的协议或算法配置参数。

const ACC_STATE_CHECKED

XuAPI
pub const ACC_STATE_CHECKED = 8

用途

常量 ACC_STATE_CHECKED,定义了相关的协议或算法配置参数。

const ACC_STATE_EXPANDED

XuAPI
pub const ACC_STATE_EXPANDED = 16

用途

常量 ACC_STATE_EXPANDED,定义了相关的协议或算法配置参数。

const ACC_STATE_COLLAPSED

XuAPI
pub const ACC_STATE_COLLAPSED = 32

用途

常量 ACC_STATE_COLLAPSED,定义了相关的协议或算法配置参数。

const ACC_STATE_READ_ONLY

XuAPI
pub const ACC_STATE_READ_ONLY = 64

用途

常量 ACC_STATE_READ_ONLY,定义了相关的协议或算法配置参数。

const ACC_STATE_REQUIRED

XuAPI
pub const ACC_STATE_REQUIRED = 128

用途

常量 ACC_STATE_REQUIRED,定义了相关的协议或算法配置参数。

const ACC_STATE_INVALID

XuAPI
pub const ACC_STATE_INVALID = 256

用途

常量 ACC_STATE_INVALID,定义了相关的协议或算法配置参数。

const ACC_STATE_BUSY

XuAPI
pub const ACC_STATE_BUSY = 512

用途

常量 ACC_STATE_BUSY,定义了相关的协议或算法配置参数。

const ACC_STATE_PRESSED

XuAPI
pub const ACC_STATE_PRESSED = 1024

用途

常量 ACC_STATE_PRESSED,定义了相关的协议或算法配置参数。

const ACC_STATE_MODAL

XuAPI
pub const ACC_STATE_MODAL = 2048

用途

常量 ACC_STATE_MODAL,定义了相关的协议或算法配置参数。

const ACC_STATE_HIDDEN

XuAPI
pub const ACC_STATE_HIDDEN = 4096

用途

常量 ACC_STATE_HIDDEN,定义了相关的协议或算法配置参数。

const ACC_STATE_INDETERMINATE

XuAPI
pub const ACC_STATE_INDETERMINATE = 8192

用途

常量 ACC_STATE_INDETERMINATE,定义了相关的协议或算法配置参数。

const ACC_STATE_PASSWORD

XuAPI
pub const ACC_STATE_PASSWORD = 16384

用途

常量 ACC_STATE_PASSWORD,定义了相关的协议或算法配置参数。

const ACC_STATE_MULTILINE

XuAPI
pub const ACC_STATE_MULTILINE = 32768

用途

常量 ACC_STATE_MULTILINE,定义了相关的协议或算法配置参数。

const LIVE_OFF

XuAPI
pub const LIVE_OFF = 0

用途

常量 LIVE_OFF,定义了相关的协议或算法配置参数。

const LIVE_POLITE

XuAPI
pub const LIVE_POLITE = 1

用途

常量 LIVE_POLITE,定义了相关的协议或算法配置参数。

const LIVE_ASSERTIVE

XuAPI
pub const LIVE_ASSERTIVE = 2

用途

常量 LIVE_ASSERTIVE,定义了相关的协议或算法配置参数。

const MAX_ACCESSIBILITY_NODES

XuAPI
pub const MAX_ACCESSIBILITY_NODES = 512

用途

常量 MAX_ACCESSIBILITY_NODES,定义了相关的协议或算法配置参数。

const MAX_ACCESSIBILITY_TEXT

XuAPI
pub const MAX_ACCESSIBILITY_TEXT = 65536

用途

常量 MAX_ACCESSIBILITY_TEXT,定义了相关的协议或算法配置参数。

struct AccessibilityNode

XuAPI
pub struct AccessibilityNode {
    pub id int
    pub role int
    pub parent int
    pub name string
    pub description string
    pub value string
    pub selected_text string
    pub copy_enabled bool
    pub states int
    pub live int
    pub x f64
    pub y f64
    pub width f64
    pub height f64
    pub value_min f64
    pub value_max f64
    pub value_now f64
    pub row_index int
    pub row_count int
    pub column_index int
    pub column_count int
    pub level int
    pub children []int
}

用途

承载 id、role、parent、name、description 等属性的结构体。

公开字段

id int
字段(int)
role int
字段(int)
parent int
字段(int)
name string
名字
description string
字段(string)
value string
字段(string)
selected_text string
字段(string)
copy_enabled bool
字段(bool)
states int
字段(int)
live int
字段(int)
x f64
值
y f64
值
width f64
字段(f64)
height f64
字段(f64)
value_min f64
字段(f64)
value_max f64
字段(f64)
value_now f64
字段(f64)
row_index int
字段(int)
row_count int
字段(int)
column_index int
字段(int)
column_count int
字段(int)
level int
字段(int)
children []int
字段([]int)

($&Screen) accessibility_tree

XuAPI
pub fn (s $&Screen) accessibility_tree() []AccessibilityNode

用途

$&Screen 上的操作:执行 accessibility tree 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

[]AccessibilityNode — 切片结果

(&AccessibilityNode) clone

XuAPI
pub fn (node &AccessibilityNode) clone() AccessibilityNode

用途

复制控件或样式快照,返回独立的 AccessibilityNode 值。

参数

node &AccessibilityNode
本次调用使用的 AccessibilityNode 实例;以只读借用传入,调用方仍持有实例。

返回值

AccessibilityNode — 该类型的值

accessibility_node_by_id

XuAPI
pub fn accessibility_node_by_id(tree &[]AccessibilityNode, id int) AccessibilityNode

用途

执行 accessibility node by id 操作。失败时抛出错误,调用方需处理或继续传播。

参数

tree &[]AccessibilityNode
tree(只读借用,调用方仍持有原值;类型 &[]AccessibilityNode)
id int
id(int)

返回值

AccessibilityNode — 该类型的值

(&AccessibilityNode) has_state

XuAPI
pub fn (node &AccessibilityNode) has_state(state int) bool

用途

&AccessibilityNode 上的操作:判断是否具有 state。

参数

node &AccessibilityNode
本次调用使用的 AccessibilityNode 实例;以只读借用传入,调用方仍持有实例。
state int
state(int)

返回值

bool — 是否成立

role_name

XuAPI
pub fn role_name(role int) string

用途

执行 role name 操作。

参数

role int
role(int)

返回值

string — 结果字符串

const CHANGE_ADDED

XuAPI
pub const CHANGE_ADDED = 1

用途

常量 CHANGE_ADDED,定义了相关的协议或算法配置参数。

const CHANGE_REMOVED

XuAPI
pub const CHANGE_REMOVED = 2

用途

常量 CHANGE_REMOVED,定义了相关的协议或算法配置参数。

const CHANGE_NAME

XuAPI
pub const CHANGE_NAME = 4

用途

常量 CHANGE_NAME,定义了相关的协议或算法配置参数。

const CHANGE_VALUE

XuAPI
pub const CHANGE_VALUE = 8

用途

常量 CHANGE_VALUE,定义了相关的协议或算法配置参数。

const CHANGE_STATES

XuAPI
pub const CHANGE_STATES = 16

用途

常量 CHANGE_STATES,定义了相关的协议或算法配置参数。

const CHANGE_BOUNDS

XuAPI
pub const CHANGE_BOUNDS = 32

用途

常量 CHANGE_BOUNDS,定义了相关的协议或算法配置参数。

const CHANGE_FOCUS

XuAPI
pub const CHANGE_FOCUS = 64

用途

常量 CHANGE_FOCUS,定义了相关的协议或算法配置参数。

const CHANGE_CHILDREN

XuAPI
pub const CHANGE_CHILDREN = 128

用途

常量 CHANGE_CHILDREN,定义了相关的协议或算法配置参数。

const CHANGE_ROLE

XuAPI
pub const CHANGE_ROLE = 256

用途

常量 CHANGE_ROLE,定义了相关的协议或算法配置参数。

const CHANGE_LIVE_REGION

XuAPI
pub const CHANGE_LIVE_REGION = 512

用途

常量 CHANGE_LIVE_REGION,定义了相关的协议或算法配置参数。

struct AccessibilityChange

XuAPI
pub struct AccessibilityChange {
    pub id int
    pub kind int
    pub role int
    pub name string
}

用途

承载 id、kind、role、name 等属性的结构体。

公开字段

id int
字段(int)
kind int
类型标签
role int
字段(int)
name string
名字

diff_accessibility_trees

XuAPI
pub fn diff_accessibility_trees(old &[]AccessibilityNode, new &[]AccessibilityNode) []AccessibilityChange

用途

执行 diff accessibility trees 操作。

参数

old &[]AccessibilityNode
旧值 / 被替换片段(只读借用,调用方仍持有原值;类型 &[]AccessibilityNode)
new &[]AccessibilityNode
新值 / 替换成的片段(只读借用,调用方仍持有原值;类型 &[]AccessibilityNode)

返回值

[]AccessibilityChange — 切片结果

focused_node

XuAPI
pub fn focused_node(tree &[]AccessibilityNode) int

用途

执行 focused node 操作。

参数

tree &[]AccessibilityNode
tree(只读借用,调用方仍持有原值;类型 &[]AccessibilityNode)

返回值

int — 该类型的值

(&AccessibilityChange) has_change

XuAPI
pub fn (change &AccessibilityChange) has_change(flag int) bool

用途

&AccessibilityChange 上的操作:判断是否具有 change。

参数

change &AccessibilityChange
本次调用使用的 AccessibilityChange 实例;以只读借用传入,调用方仍持有实例。
flag int
flag(int)

返回值

bool — 是否成立

const ANIMATION_IDLE

XuAPI
pub const ANIMATION_IDLE = 0

用途

常量 ANIMATION_IDLE,定义了相关的协议或算法配置参数。

const ANIMATION_RUNNING

XuAPI
pub const ANIMATION_RUNNING = 1

用途

常量 ANIMATION_RUNNING,定义了相关的协议或算法配置参数。

const ANIMATION_PAUSED

XuAPI
pub const ANIMATION_PAUSED = 2

用途

常量 ANIMATION_PAUSED,定义了相关的协议或算法配置参数。

const ANIMATION_FINISHED

XuAPI
pub const ANIMATION_FINISHED = 3

用途

常量 ANIMATION_FINISHED,定义了相关的协议或算法配置参数。

struct AnimationOptions

XuAPI
pub struct AnimationOptions {
    pub duration time.Duration
    pub delay time.Duration
    pub iterations int
    pub alternate bool
    pub curve int
    pub rate f64
}

用途

Widgets 配置参数与选项集合。

公开字段

duration time.Duration
字段(time.Duration)
delay time.Duration
字段(time.Duration)
iterations int
字段(int)
alternate bool
字段(bool)
curve int
字段(int)
rate f64
字段(f64)

animation_options

XuAPI
pub fn animation_options() AnimationOptions

用途

执行 animation options 操作。

参数

无需传入参数。

返回值

AnimationOptions — 该类型的值

查看用法示例

(&AnimationOptions) validate

XuAPI
pub fn (options &AnimationOptions) validate() int

用途

在 &AnimationOptions 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

options &AnimationOptions
本次调用使用的 AnimationOptions 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

struct AnimationController

XuAPI
pub struct AnimationController {
    pub options AnimationOptions
    pub stamp time.Instant
}

用途

承载 options、stamp 等属性的结构体。

公开字段

options AnimationOptions
字段(AnimationOptions)
stamp time.Instant
字段(time.Instant)

animation_controller

XuAPI
pub fn animation_controller(options &AnimationOptions) AnimationController

用途

执行 animation controller 操作。失败时抛出错误,调用方需处理或继续传播。

参数

options &AnimationOptions
options(只读借用,调用方仍持有原值;类型 &AnimationOptions)

返回值

AnimationController — 该类型的值

(&AnimationController) state

XuAPI
pub fn (a &AnimationController) state() int

用途

在 &AnimationController 上执行 state 操作。

参数

a &AnimationController
本次调用使用的 AnimationController 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&AnimationController) is_running

XuAPI
pub fn (a &AnimationController) is_running() bool

用途

&AnimationController 上的操作:判断是否 running。

参数

a &AnimationController
本次调用使用的 AnimationController 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&AnimationController) progress

XuAPI
pub fn (a &AnimationController) progress() f64

用途

在 &AnimationController 上执行 progress 操作。

参数

a &AnimationController
本次调用使用的 AnimationController 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&AnimationController) value

XuAPI
pub fn (a &AnimationController) value() f64

用途

&AnimationController 上的操作:值。

参数

a &AnimationController
本次调用使用的 AnimationController 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

($&AnimationController) play

XuAPI
pub fn (a $&AnimationController) play(now time.Instant,reduced_motion bool) int

用途

在 $&AnimationController 上执行 play 操作。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

int — 该类型的值

($&AnimationController) finish

XuAPI
pub fn (a $&AnimationController) finish()

用途

在 $&AnimationController 上执行 finish 操作。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&AnimationController) cancel

XuAPI
pub fn (a $&AnimationController) cancel()

用途

$&AnimationController 上的操作:取消。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&AnimationController) advance

XuAPI
pub fn (a $&AnimationController) advance(now time.Instant,reduced_motion bool) bool

用途

在 $&AnimationController 上执行 advance 操作。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

($&AnimationController) pause

XuAPI
pub fn (a $&AnimationController) pause(now time.Instant) int

用途

在 $&AnimationController 上执行 pause 操作。失败时抛出错误,调用方需处理或继续传播。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

($&AnimationController) resume

XuAPI
pub fn (a $&AnimationController) resume(now time.Instant)

用途

在 $&AnimationController 上执行 resume 操作。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

不返回值。

($&AnimationController) reverse

XuAPI
pub fn (a $&AnimationController) reverse(now time.Instant) int

用途

$&AnimationController 上的操作:逆序。失败时抛出错误,调用方需处理或继续传播。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

($&AnimationController) seek

XuAPI
pub fn (a $&AnimationController) seek(progress f64,now time.Instant) int

用途

$&AnimationController 上的操作:按 whence 把读位置移到 offset。whence 0/1/2 分别为绝对、相对、从末尾。失败时抛出错误,调用方需处理或继续传播。

参数

a $&AnimationController
本次调用使用的 AnimationController 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
progress f64
progress(f64)
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

(&AnimationController) next_tick

XuAPI
pub fn (a &AnimationController) next_tick(now time.Instant) time.Instant

用途

&AnimationController 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

a &AnimationController
本次调用使用的 AnimationController 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

motion_ease

XuAPI
pub fn motion_ease(curve int,fraction f64) f64

用途

执行 motion ease 操作。

参数

curve int
curve(int)
fraction f64
fraction(f64)

返回值

f64 — 该类型的值

motion_lerp

XuAPI
pub fn motion_lerp(from f64,to f64,progress f64) f64

用途

执行 motion lerp 操作。

参数

from f64
from(f64)
to f64
to(f64)
progress f64
progress(f64)

返回值

f64 — 该类型的值

const BUTTON_PRIMARY

XuAPI
pub const BUTTON_PRIMARY = 0

用途

常量 BUTTON_PRIMARY,定义了相关的协议或算法配置参数。

查看用法示例

const BUTTON_SECONDARY

XuAPI
pub const BUTTON_SECONDARY = 1

用途

常量 BUTTON_SECONDARY,定义了相关的协议或算法配置参数。

const BUTTON_OUTLINE

XuAPI
pub const BUTTON_OUTLINE = 2

用途

常量 BUTTON_OUTLINE,定义了相关的协议或算法配置参数。

查看用法示例

const BUTTON_GHOST

XuAPI
pub const BUTTON_GHOST = 3

用途

常量 BUTTON_GHOST,定义了相关的协议或算法配置参数。

const BUTTON_DANGER

XuAPI
pub const BUTTON_DANGER = 4

用途

常量 BUTTON_DANGER,定义了相关的协议或算法配置参数。

const BUTTON_SUBTLE

XuAPI
pub const BUTTON_SUBTLE = 5

用途

常量 BUTTON_SUBTLE,定义了相关的协议或算法配置参数。

查看用法示例

(&Styles) button_variant

XuAPI
pub fn (styles &Styles) button_variant(variant int) ControlStyle

用途

&Styles 上的操作:执行 button variant 操作。失败时抛出错误,调用方需处理或继续传播。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。
variant int
variant(int)

返回值

ControlStyle — 该类型的值

(&Styles) tree_style

XuAPI
pub fn (styles &Styles) tree_style() ControlStyle

用途

&Styles 上的操作:执行 tree style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) table_style

XuAPI
pub fn (styles &Styles) table_style() ControlStyle

用途

&Styles 上的操作:执行 table style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) overlay_style

XuAPI
pub fn (styles &Styles) overlay_style() ControlStyle

用途

&Styles 上的操作:执行 overlay style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) overlay_scrim

XuAPI
pub fn (styles &Styles) overlay_scrim() draw.Color

用途

&Styles 上的操作:执行 overlay scrim 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

draw.Color — 该类型的值

const TREE_ICON_NONE

XuAPI
pub const TREE_ICON_NONE = 0

用途

常量 TREE_ICON_NONE,定义了相关的协议或算法配置参数。

const TREE_ICON_AUTO

XuAPI
pub const TREE_ICON_AUTO = 1

用途

常量 TREE_ICON_AUTO,定义了相关的协议或算法配置参数。

const TREE_ICON_FOLDER

XuAPI
pub const TREE_ICON_FOLDER = 2

用途

常量 TREE_ICON_FOLDER,定义了相关的协议或算法配置参数。

const TREE_ICON_FILE

XuAPI
pub const TREE_ICON_FILE = 3

用途

常量 TREE_ICON_FILE,定义了相关的协议或算法配置参数。

查看用法示例

struct TreeAppearance

XuAPI
pub struct TreeAppearance {
    pub indent f64
    pub row_height f64
    pub guides bool
    pub icons bool
    pub selection_mark bool
    pub guide_opacity f64
    pub action_width f64
}

用途

承载 indent、row_height、guides、icons、selection_mark 等属性的结构体。

公开字段

indent f64
字段(f64)
row_height f64
字段(f64)
guides bool
字段(bool)
icons bool
字段(bool)
selection_mark bool
字段(bool)
guide_opacity f64
字段(f64)
action_width f64
字段(f64)

tree_appearance

XuAPI
pub fn tree_appearance() TreeAppearance

用途

执行 tree appearance 操作。

参数

无需传入参数。

返回值

TreeAppearance — 该类型的值

查看用法示例

(&TreeAppearance) validate

XuAPI
pub fn (a &TreeAppearance) validate() int

用途

在 &TreeAppearance 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

a &TreeAppearance
本次调用使用的 TreeAppearance 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

const BADGE_NEUTRAL

XuAPI
pub const BADGE_NEUTRAL = 0

用途

常量 BADGE_NEUTRAL,定义了相关的协议或算法配置参数。

const BADGE_INFO

XuAPI
pub const BADGE_INFO = 1

用途

常量 BADGE_INFO,定义了相关的协议或算法配置参数。

查看用法示例

const BADGE_SUCCESS

XuAPI
pub const BADGE_SUCCESS = 2

用途

常量 BADGE_SUCCESS,定义了相关的协议或算法配置参数。

查看用法示例

const BADGE_WARNING

XuAPI
pub const BADGE_WARNING = 3

用途

常量 BADGE_WARNING,定义了相关的协议或算法配置参数。

const BADGE_ERROR

XuAPI
pub const BADGE_ERROR = 4

用途

常量 BADGE_ERROR,定义了相关的协议或算法配置参数。

查看用法示例

(&Styles) badge_variant

XuAPI
pub fn (styles &Styles) badge_variant(tone int) ControlStyle

用途

&Styles 上的操作:执行 badge variant 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。
tone int
tone(int)

返回值

ControlStyle — 该类型的值

const BADGE_STATUS

XuAPI
pub const BADGE_STATUS = 0

用途

常量 BADGE_STATUS,定义了相关的协议或算法配置参数。

const BADGE_COUNT

XuAPI
pub const BADGE_COUNT = 1

用途

常量 BADGE_COUNT,定义了相关的协议或算法配置参数。

查看用法示例

const BADGE_DOT

XuAPI
pub const BADGE_DOT = 2

用途

常量 BADGE_DOT,定义了相关的协议或算法配置参数。

查看用法示例

(&Badge) variant

XuAPI
pub fn (badge &Badge) variant() int

用途

在 &Badge 上执行 variant 操作。

参数

badge &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Badge) set_variant

XuAPI
pub fn (badge $&Badge) set_variant(variant int) int

用途

$&Badge 上的操作:设置 variant。失败时抛出错误,调用方需处理或继续传播。

参数

badge $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
variant int
variant(int)

返回值

int — 该类型的值

($&Screen) badge_on

XuAPI
pub fn (s $&Screen) badge_on(anchor int,text string,variant int) int

用途

$&Screen 上的操作:执行 badge on 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
anchor int
anchor(int)
text string
文本(string)
variant int
variant(int)

返回值

int — 该类型的值

($&Screen) set_badge_variant

XuAPI
pub fn (s $&Screen) set_badge_variant(id int,variant int) int

用途

$&Screen 上的操作:设置 badge variant。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
variant int
variant(int)

返回值

int — 该类型的值

($&Screen) set_badge_anchor

XuAPI
pub fn (s $&Screen) set_badge_anchor(id int,anchor int,x f64,y f64) int

用途

$&Screen 上的操作:设置 badge anchor。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
anchor int
anchor(int)
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

($&Screen) badge_size

XuAPI
pub fn (s $&Screen) badge_size(id int) layout.Size

用途

$&Screen 上的操作:执行 badge size 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

layout.Size — 该类型的值

(&Breadcrumbs) overflow_bounds

XuAPI
pub fn (crumbs &Breadcrumbs) overflow_bounds() layout.Rect

用途

&Breadcrumbs 上的操作:执行 overflow bounds 操作。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Breadcrumbs) popup_bounds

XuAPI
pub fn (crumbs &Breadcrumbs) popup_bounds() layout.Rect

用途

&Breadcrumbs 上的操作:执行 popup bounds 操作。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Breadcrumbs) set_popup_above

XuAPI
pub fn (crumbs $&Breadcrumbs) set_popup_above(above bool)

用途

$&Breadcrumbs 上的操作:设置 popup above。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
above bool
above(bool)

返回值

不返回值。

($&Breadcrumbs) paint_popup_styled

XuAPI
pub fn (crumbs $&Breadcrumbs) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Breadcrumbs 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Breadcrumbs

XuAPI
pub struct Breadcrumbs {

}

用途

面包屑路径层级导航控件,指示当前界面位置与层级跳转。

公开字段

此类型没有公开字段。

(&Breadcrumbs) id

XuAPI
pub fn (crumbs &Breadcrumbs) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Breadcrumbs) bounds

XuAPI
pub fn (crumbs &Breadcrumbs) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Breadcrumbs) count

XuAPI
pub fn (crumbs &Breadcrumbs) count() int

用途

返回该控件当前包含的项目数量。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Breadcrumbs) is_selectable

XuAPI
pub fn (crumbs &Breadcrumbs) is_selectable() bool

用途

&Breadcrumbs 上的操作:判断是否 selectable。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Breadcrumbs) set_selectable

XuAPI
pub fn (crumbs $&Breadcrumbs) set_selectable(selectable bool)

用途

$&Breadcrumbs 上的操作:设置 selectable。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Breadcrumbs) needs_paint

XuAPI
pub fn (crumbs &Breadcrumbs) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Breadcrumbs) visual_state

XuAPI
pub fn (crumbs &Breadcrumbs) visual_state() int

用途

&Breadcrumbs 上的操作:执行 visual state 操作。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Breadcrumbs) style_or

XuAPI
pub fn (crumbs &Breadcrumbs) style_or(styles &Styles) ControlStyle

用途

&Breadcrumbs 上的操作:执行 style or 操作。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Breadcrumbs) set_style

XuAPI
pub fn (crumbs $&Breadcrumbs) set_style(style &ControlStyle) int

用途

$&Breadcrumbs 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Breadcrumbs) set_enabled

XuAPI
pub fn (crumbs $&Breadcrumbs) set_enabled(enabled bool)

用途

$&Breadcrumbs 上的操作:设置 enabled。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Breadcrumbs) set_read_only

XuAPI
pub fn (crumbs $&Breadcrumbs) set_read_only(read_only bool) int

用途

$&Breadcrumbs 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&Breadcrumbs) set_bounds

XuAPI
pub fn (crumbs $&Breadcrumbs) set_bounds(bounds &layout.Rect) int

用途

$&Breadcrumbs 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Breadcrumbs) set_focus

XuAPI
pub fn (crumbs $&Breadcrumbs) set_focus(focused bool)

用途

$&Breadcrumbs 上的操作:设置 focus。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Breadcrumbs) set_text

XuAPI
pub fn (crumbs $&Breadcrumbs) set_text(index int,text &string) int

用途

$&Breadcrumbs 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&Breadcrumbs) apply_styles

XuAPI
pub fn (crumbs $&Breadcrumbs) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Breadcrumbs) measure_styled

XuAPI
pub fn (crumbs $&Breadcrumbs) measure_styled(styles &Styles) layout.Size

用途

$&Breadcrumbs 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Breadcrumbs) item_bounds

XuAPI
pub fn (crumbs &Breadcrumbs) item_bounds(index int) layout.Rect

用途

&Breadcrumbs 上的操作:执行 item bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

(&Breadcrumbs) cursor_at

XuAPI
pub fn (crumbs &Breadcrumbs) cursor_at(x f64,y f64) int

用途

&Breadcrumbs 上的操作:执行 cursor at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs &Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以只读借用传入,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

($&Breadcrumbs) input

XuAPI
pub fn (crumbs $&Breadcrumbs) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Breadcrumbs) route

XuAPI
pub fn (crumbs $&Breadcrumbs) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Breadcrumbs) paint_styled

XuAPI
pub fn (crumbs $&Breadcrumbs) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Breadcrumbs 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Breadcrumbs) dispose

XuAPI
pub fn (crumbs $&Breadcrumbs) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

crumbs $&Breadcrumbs
本次调用使用的 Breadcrumbs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

const BUTTON_GROUP_ACTIONS

XuAPI
pub const BUTTON_GROUP_ACTIONS = 0

用途

常量 BUTTON_GROUP_ACTIONS,定义了相关的协议或算法配置参数。

查看用法示例

const BUTTON_GROUP_SINGLE

XuAPI
pub const BUTTON_GROUP_SINGLE = 1

用途

常量 BUTTON_GROUP_SINGLE,定义了相关的协议或算法配置参数。

查看用法示例

const BUTTON_GROUP_MULTIPLE

XuAPI
pub const BUTTON_GROUP_MULTIPLE = 2

用途

常量 BUTTON_GROUP_MULTIPLE,定义了相关的协议或算法配置参数。

查看用法示例

struct ButtonGroupItem

XuAPI
pub struct ButtonGroupItem {
    pub key int
    pub label string
    pub enabled bool
    pub selected bool
    pub variant int
}

用途

承载 key、label、enabled、selected、variant 等属性的结构体。

公开字段

key int
键
label string
字段(string)
enabled bool
字段(bool)
selected bool
字段(bool)
variant int
字段(int)

button_group_item

XuAPI
pub fn button_group_item(key int,label string) ButtonGroupItem

用途

执行 button group item 操作。

参数

key int
键(int)
label string
label(string)

返回值

ButtonGroupItem — 该类型的值

查看用法示例

struct ButtonGroupAppearance

XuAPI
pub struct ButtonGroupAppearance {
    pub vertical bool
    pub joined bool
    pub equal_width bool
    pub allow_empty bool
    pub gap f64
    pub min_item_width f64
}

用途

承载 vertical、joined、equal_width、allow_empty、gap 等属性的结构体。

公开字段

vertical bool
字段(bool)
joined bool
字段(bool)
equal_width bool
字段(bool)
allow_empty bool
字段(bool)
gap f64
字段(f64)
min_item_width f64
字段(f64)

button_group_appearance

XuAPI
pub fn button_group_appearance() ButtonGroupAppearance

用途

执行 button group appearance 操作。

参数

无需传入参数。

返回值

ButtonGroupAppearance — 该类型的值

查看用法示例

(&ButtonGroupAppearance) validate

XuAPI
pub fn (a &ButtonGroupAppearance) validate() int

用途

在 &ButtonGroupAppearance 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

a &ButtonGroupAppearance
本次调用使用的 ButtonGroupAppearance 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

struct ButtonGroup

XuAPI
pub struct ButtonGroup {

}

用途

ButtonGroup 上下文或状态结构体。

公开字段

此类型没有公开字段。

button_group

XuAPI
pub fn button_group(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,items &[]ButtonGroupItem,mode int) ButtonGroup

用途

执行 button group 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
items &[]ButtonGroupItem
元素列表(只读借用,调用方仍持有原值;类型 &[]ButtonGroupItem)
mode int
模式(int)

返回值

ButtonGroup — 该类型的值

(&ButtonGroup) id

XuAPI
pub fn (g &ButtonGroup) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ButtonGroup) bounds

XuAPI
pub fn (g &ButtonGroup) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ButtonGroup) needs_paint

XuAPI
pub fn (g &ButtonGroup) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ButtonGroup) painted

XuAPI
pub fn (g $&ButtonGroup) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&ButtonGroup) is_enabled

XuAPI
pub fn (g &ButtonGroup) is_enabled() bool

用途

返回控件当前是否可用。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ButtonGroup) is_selectable

XuAPI
pub fn (g &ButtonGroup) is_selectable() bool

用途

&ButtonGroup 上的操作:判断是否 selectable。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ButtonGroup) set_selectable

XuAPI
pub fn (g $&ButtonGroup) set_selectable(selectable bool)

用途

$&ButtonGroup 上的操作:设置 selectable。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&ButtonGroup) is_focused

XuAPI
pub fn (g &ButtonGroup) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ButtonGroup) active_key

XuAPI
pub fn (g &ButtonGroup) active_key() int

用途

&ButtonGroup 上的操作:执行 active key 操作。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ButtonGroup) values

XuAPI
pub fn (g &ButtonGroup) values() []int

用途

返回当前集合、参数表或映射中所有值的切片。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

[]int — 切片结果

($&ButtonGroup) set_items

XuAPI
pub fn (g $&ButtonGroup) set_items(items &[]ButtonGroupItem) int

用途

$&ButtonGroup 上的操作:设置 items。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
items &[]ButtonGroupItem
元素列表(只读借用,调用方仍持有原值;类型 &[]ButtonGroupItem)

返回值

int — 该类型的值

($&ButtonGroup) set_appearance

XuAPI
pub fn (g $&ButtonGroup) set_appearance(a &ButtonGroupAppearance) int

用途

$&ButtonGroup 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
a &ButtonGroupAppearance
值(只读借用,调用方仍持有原值;类型 &ButtonGroupAppearance)

返回值

int — 该类型的值

($&ButtonGroup) set_item_enabled

XuAPI
pub fn (g $&ButtonGroup) set_item_enabled(key int,enabled bool) int

用途

$&ButtonGroup 上的操作:设置 item enabled。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&ButtonGroup) set_item_label

XuAPI
pub fn (g $&ButtonGroup) set_item_label(key int,label string) int

用途

$&ButtonGroup 上的操作:设置 item label。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
label string
label(string)

返回值

int — 该类型的值

($&ButtonGroup) set_checked

XuAPI
pub fn (g $&ButtonGroup) set_checked(key int,selected bool) int

用途

$&ButtonGroup 上的操作:设置 checked。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
selected bool
selected(bool)

返回值

int — 该类型的值

($&ButtonGroup) set_focus

XuAPI
pub fn (g $&ButtonGroup) set_focus(value bool)

用途

$&ButtonGroup 上的操作:设置 focus。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&ButtonGroup) cancel

XuAPI
pub fn (g $&ButtonGroup) cancel()

用途

$&ButtonGroup 上的操作:取消。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ButtonGroup) set_enabled

XuAPI
pub fn (g $&ButtonGroup) set_enabled(value bool)

用途

$&ButtonGroup 上的操作:设置 enabled。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&ButtonGroup) set_read_only

XuAPI
pub fn (g $&ButtonGroup) set_read_only(value bool)

用途

$&ButtonGroup 上的操作:设置 read only。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&ButtonGroup) set_bounds

XuAPI
pub fn (g $&ButtonGroup) set_bounds(bounds &layout.Rect) int

用途

$&ButtonGroup 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&ButtonGroup) set_style

XuAPI
pub fn (g $&ButtonGroup) set_style(style &ControlStyle) int

用途

$&ButtonGroup 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&ButtonGroup) clear_style

XuAPI
pub fn (g $&ButtonGroup) clear_style()

用途

$&ButtonGroup 上的操作:执行 clear style 操作。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ButtonGroup) set_motion

XuAPI
pub fn (g $&ButtonGroup) set_motion(spec &MotionSpec) int

用途

$&ButtonGroup 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&ButtonGroup) apply_styles

XuAPI
pub fn (g $&ButtonGroup) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&ButtonGroup) item_bounds

XuAPI
pub fn (g &ButtonGroup) item_bounds(key int) layout.Rect

用途

&ButtonGroup 上的操作:执行 item bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。
key int
键(int)

返回值

layout.Rect — 该类型的值

($&ButtonGroup) input

XuAPI
pub fn (g $&ButtonGroup) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ButtonGroup) route

XuAPI
pub fn (g $&ButtonGroup) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ButtonGroup) tick

XuAPI
pub fn (g $&ButtonGroup) tick(styles &Styles,now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&ButtonGroup) next_tick

XuAPI
pub fn (g &ButtonGroup) next_tick(now time.Instant) time.Instant

用途

&ButtonGroup 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

g &ButtonGroup
本次调用使用的 ButtonGroup 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&ButtonGroup) paint_styled

XuAPI
pub fn (g $&ButtonGroup) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&ButtonGroup 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&ButtonGroup) dispose

XuAPI
pub fn (g $&ButtonGroup) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

g $&ButtonGroup
本次调用使用的 ButtonGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Button) measure_icon_styled

XuAPI
pub fn (button &Button) measure_icon_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

测量图标、标签、间距与内边距;icon_size=0 时不保留图标间距。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

固有逻辑尺寸

(&Button) paint_icon_styled

XuAPI
pub fn (button &Button) paint_icon_styled(frame $&draw.Frame,label $&StyledLabel,image &draw.Image,styles &Styles) int

用途

按样式绘制图片图标和标签;图像保持纵横比,调用者拥有 Image。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
image &draw.Image
image(只读借用,调用方仍持有原值;类型 &draw.Image)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

struct CardRegions

XuAPI
pub struct CardRegions {
    pub header layout.Rect
    pub body layout.Rect
    pub footer layout.Rect
}

用途

承载 header、body、footer 等属性的结构体。

公开字段

header layout.Rect
字段(layout.Rect)
body layout.Rect
正文
footer layout.Rect
字段(layout.Rect)

(&Card) regions

XuAPI
pub fn (card &Card) regions(styles &Styles,header_height f64,footer_height f64) CardRegions

用途

在 &Card 上执行 regions 操作。失败时抛出错误,调用方需处理或继续传播。

参数

card &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
header_height f64
header_height(f64)
footer_height f64
footer_height(f64)

返回值

CardRegions — 该类型的值

struct CardSections

XuAPI
pub struct CardSections {
    pub header int
    pub body int
    pub footer int
}

用途

承载 header、body、footer 等属性的结构体。

公开字段

header int
字段(int)
body int
正文
footer int
字段(int)

($&Screen) card_sections

XuAPI
pub fn (s $&Screen) card_sections(id int,header_height f64,footer_height f64) CardSections

用途

$&Screen 上的操作:执行 card sections 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
header_height f64
header_height(f64)
footer_height f64
footer_height(f64)

返回值

CardSections — 该类型的值

badge_count_text

XuAPI
pub fn badge_count_text(count int,maximum int) string

用途

执行 badge count text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

count int
count(int)
maximum int
maximum(int)

返回值

string — 结果字符串

($&Screen) set_badge_count

XuAPI
pub fn (s $&Screen) set_badge_count(id int,count int,maximum int,show_zero bool) int

用途

$&Screen 上的操作:设置 badge count。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
count int
count(int)
maximum int
maximum(int)
show_zero bool
show_zero(bool)

返回值

int — 该类型的值

(&Locale) badge_count

XuAPI
pub fn (locale &Locale) badge_count(count int,maximum int) string

用途

&Locale 上的操作:执行 badge count 操作。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
count int
count(int)
maximum int
maximum(int)

返回值

string — 结果字符串

struct ColorPicker

XuAPI
pub struct ColorPicker {

}

用途

RGBA 颜色选择调色板控件,支持通道调节与实时预览。

公开字段

此类型没有公开字段。

color_picker

XuAPI
pub fn color_picker(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value draw.Color) ColorPicker

用途

执行 color picker 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value draw.Color
value(draw.Color)

返回值

ColorPicker — 该类型的值

(&ColorPicker) id

XuAPI
pub fn (picker &ColorPicker) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ColorPicker) bounds

XuAPI
pub fn (picker &ColorPicker) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ColorPicker) is_enabled

XuAPI
pub fn (picker &ColorPicker) is_enabled() bool

用途

返回控件当前是否可用。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ColorPicker) is_selectable

XuAPI
pub fn (picker &ColorPicker) is_selectable() bool

用途

&ColorPicker 上的操作:判断是否 selectable。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ColorPicker) set_selectable

XuAPI
pub fn (picker $&ColorPicker) set_selectable(selectable bool)

用途

$&ColorPicker 上的操作:设置 selectable。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&ColorPicker) is_focused

XuAPI
pub fn (picker &ColorPicker) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ColorPicker) active_channel

XuAPI
pub fn (picker &ColorPicker) active_channel() int

用途

&ColorPicker 上的操作:执行 active channel 操作。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ColorPicker) needs_paint

XuAPI
pub fn (picker &ColorPicker) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ColorPicker) channel

XuAPI
pub fn (picker &ColorPicker) channel(index int) int

用途

在 &ColorPicker 上执行 channel 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

(&ColorPicker) value

XuAPI
pub fn (picker &ColorPicker) value() draw.Color

用途

读取当前四个通道组成的颜色,供绘制或保存。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

包含红、绿、蓝和透明度的 draw.Color。

($&ColorPicker) set_channel

XuAPI
pub fn (picker $&ColorPicker) set_channel(index int,value int) int

用途

更新一个 RGBA 通道,适合从数值输入框单独调整颜色分量。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
通道编号:0 红、1 绿、2 蓝、3 透明度。
value int
通道强度 0..255;透明度 0 全透明、255 不透明。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

错误处理

  • 控件已释放、通道编号或数值越界时抛错;这里不会静默截断到有效范围。

($&ColorPicker) set_value

XuAPI
pub fn (picker $&ColorPicker) set_value(value draw.Color) int

用途

一次设置 RGBA 颜色,并同步四个通道滑块。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value draw.Color
完整的 draw.Color,包含透明度。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

错误处理

  • 任一通道更新失败时继续抛错。

(&ColorPicker) style_or

XuAPI
pub fn (picker &ColorPicker) style_or(styles &Styles) ControlStyle

用途

&ColorPicker 上的操作:执行 style or 操作。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&ColorPicker) set_style

XuAPI
pub fn (picker $&ColorPicker) set_style(style &ControlStyle) int

用途

$&ColorPicker 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&ColorPicker) set_enabled

XuAPI
pub fn (picker $&ColorPicker) set_enabled(enabled bool)

用途

$&ColorPicker 上的操作:设置 enabled。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&ColorPicker) set_read_only

XuAPI
pub fn (picker $&ColorPicker) set_read_only(read_only bool) int

用途

$&ColorPicker 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&ColorPicker) set_invalid

XuAPI
pub fn (picker $&ColorPicker) set_invalid(invalid bool)

用途

$&ColorPicker 上的操作:设置 invalid。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&ColorPicker) set_focus

XuAPI
pub fn (picker $&ColorPicker) set_focus(focused bool)

用途

$&ColorPicker 上的操作:设置 focus。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&ColorPicker) preview_bounds

XuAPI
pub fn (picker &ColorPicker) preview_bounds() layout.Rect

用途

&ColorPicker 上的操作:执行 preview bounds 操作。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ColorPicker) channel_bounds

XuAPI
pub fn (picker &ColorPicker) channel_bounds(index int) layout.Rect

用途

&ColorPicker 上的操作:执行 channel bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

($&ColorPicker) set_bounds

XuAPI
pub fn (picker $&ColorPicker) set_bounds(bounds &layout.Rect) int

用途

$&ColorPicker 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&ColorPicker) apply_styles

XuAPI
pub fn (picker $&ColorPicker) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&ColorPicker) input

XuAPI
pub fn (picker $&ColorPicker) input(event &ui.InputEvent) Action

用途

把输入交给当前 RGBA 通道,更新颜色并返回颜色变化或提交动作。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 聚焦时用上/下方向键切换通道;Action.value 是打包颜色的数值,读取 value() 可得到 draw.Color。

($&ColorPicker) route

XuAPI
pub fn (picker $&ColorPicker) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ColorPicker) event

XuAPI
pub fn (picker $&ColorPicker) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ColorPicker) measure_styled

XuAPI
pub fn (picker $&ColorPicker) measure_styled(styles &Styles) layout.Size

用途

$&ColorPicker 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&ColorPicker) paint_styled

XuAPI
pub fn (picker $&ColorPicker) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&ColorPicker 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&ColorPicker) dispose

XuAPI
pub fn (picker $&ColorPicker) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&ColorPicker) hex

XuAPI
pub fn (picker &ColorPicker) hex() string

用途

&ColorPicker 上的操作:十六进制。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&ColorPicker) set_hex

XuAPI
pub fn (picker $&ColorPicker) set_hex(text &string) int

用途

$&ColorPicker 上的操作:设置 hex。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&ColorPicker) set_swatches

XuAPI
pub fn (picker $&ColorPicker) set_swatches(colors &[]draw.Color) int

用途

$&ColorPicker 上的操作:设置 swatches。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
colors &[]draw.Color
colors(只读借用,调用方仍持有原值;类型 &[]draw.Color)

返回值

int — 该类型的值

($&ColorPicker) remember

XuAPI
pub fn (picker $&ColorPicker) remember()

用途

在 $&ColorPicker 上执行 remember 操作。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&ColorPicker) recent_colors

XuAPI
pub fn (picker &ColorPicker) recent_colors() []draw.Color

用途

&ColorPicker 上的操作:执行 recent colors 操作。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。

返回值

[]draw.Color — 切片结果

(&ColorPicker) swatch_bounds

XuAPI
pub fn (picker &ColorPicker) swatch_bounds(index int) layout.Rect

用途

&ColorPicker 上的操作:执行 swatch bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &ColorPicker
本次调用使用的 ColorPicker 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

($&ColorPicker) set_show_swatches

XuAPI
pub fn (picker $&ColorPicker) set_show_swatches(visible bool)

用途

$&ColorPicker 上的操作:设置 show swatches。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
visible bool
visible(bool)

返回值

不返回值。

struct ComboBox

XuAPI
pub struct ComboBox {

}

用途

下拉组合选择输入框控件,支持文本编辑与弹出项选择。

公开字段

此类型没有公开字段。

combo_box

XuAPI
pub fn combo_box(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,options &[]string,value &string) ComboBox

用途

执行 combo box 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

ComboBox — 该类型的值

(&ComboBox) id

XuAPI
pub fn (combo &ComboBox) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ComboBox) bounds

XuAPI
pub fn (combo &ComboBox) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ComboBox) value

XuAPI
pub fn (combo &ComboBox) value() string

用途

&ComboBox 上的操作:值。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&ComboBox) selected_text

XuAPI
pub fn (combo &ComboBox) selected_text() string

用途

&ComboBox 上的操作:执行 selected text 操作。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&ComboBox) selected

XuAPI
pub fn (combo &ComboBox) selected() int

用途

读取当前文字匹配的原选项索引,适合检查输入是否对应已有选项。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

匹配选项的索引;文字不匹配任何选项时为 -1。

(&ComboBox) count

XuAPI
pub fn (combo &ComboBox) count() int

用途

返回该控件当前包含的项目数量。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ComboBox) filtered_count

XuAPI
pub fn (combo &ComboBox) filtered_count() int

用途

&ComboBox 上的操作:执行 filtered count 操作。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ComboBox) is_open

XuAPI
pub fn (combo &ComboBox) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ComboBox) has_popup_open

XuAPI
pub fn (combo &ComboBox) has_popup_open() bool

用途

&ComboBox 上的操作:判断是否具有 popup open。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ComboBox) is_selectable

XuAPI
pub fn (combo &ComboBox) is_selectable() bool

用途

&ComboBox 上的操作:判断是否 selectable。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ComboBox) is_focused

XuAPI
pub fn (combo &ComboBox) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ComboBox) is_enabled

XuAPI
pub fn (combo &ComboBox) is_enabled() bool

用途

返回控件当前是否可用。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ComboBox) needs_paint

XuAPI
pub fn (combo &ComboBox) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ComboBox) set_placeholder

XuAPI
pub fn (combo $&ComboBox) set_placeholder(value &string) int

用途

$&ComboBox 上的操作:设置 placeholder。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

(&ComboBox) style_or

XuAPI
pub fn (combo &ComboBox) style_or(styles &Styles) ControlStyle

用途

&ComboBox 上的操作:执行 style or 操作。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&ComboBox) set_style

XuAPI
pub fn (combo $&ComboBox) set_style(style &ControlStyle) int

用途

$&ComboBox 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&ComboBox) set_enabled

XuAPI
pub fn (combo $&ComboBox) set_enabled(enabled bool) int

用途

$&ComboBox 上的操作:设置 enabled。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&ComboBox) set_read_only

XuAPI
pub fn (combo $&ComboBox) set_read_only(read_only bool) int

用途

$&ComboBox 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&ComboBox) set_selectable

XuAPI
pub fn (combo $&ComboBox) set_selectable(selectable bool) int

用途

$&ComboBox 上的操作:设置 selectable。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

int — 该类型的值

($&ComboBox) set_viewport

XuAPI
pub fn (combo $&ComboBox) set_viewport(viewport &layout.Rect)

用途

$&ComboBox 上的操作:设置 viewport。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&ComboBox) set_invalid

XuAPI
pub fn (combo $&ComboBox) set_invalid(invalid bool)

用途

$&ComboBox 上的操作:设置 invalid。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&ComboBox) focus_session

XuAPI
pub fn (combo $&ComboBox) focus_session(focused bool) int

用途

$&ComboBox 上的操作:执行 focus session 操作。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

int — 该类型的值

($&ComboBox) set_bounds

XuAPI
pub fn (combo $&ComboBox) set_bounds(bounds &layout.Rect) int

用途

$&ComboBox 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

place_combo_box

XuAPI
pub fn place_combo_box(view $&View,combo $&ComboBox) int

用途

执行 place combo box 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
combo $&ComboBox
combo(独占借用,可修改原值;类型 $&ComboBox)

返回值

int — 该类型的值

($&ComboBox) set_value

XuAPI
pub fn (combo $&ComboBox) set_value(value &string) int

用途

以程序方式更新可输入下拉框的文字,并刷新内部查询状态。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &string
新的完整文字;与已有选项完全一致时会更新匹配索引。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

错误处理

  • 编辑器拒绝替换(例如输入法组合尚未完成)时继续抛错。

($&ComboBox) set_selected

XuAPI
pub fn (combo $&ComboBox) set_selected(index int) int

用途

选择下拉框中的一个已有选项,把该选项文字写入编辑器并关闭菜单。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
原选项列表中从 0 开始的索引;不是过滤后的可见行号。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

错误处理

  • 索引越界抛出 widgets: combo choice out of range;编辑器处于输入法组合状态时,替换文字也可能抛错。

($&ComboBox) set_open

XuAPI
pub fn (combo $&ComboBox) set_open(open bool)

用途

控制下拉选项列表的打开状态。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
open bool
true 请求打开,false 关闭;禁用或只读时请求打开也会保持关闭。

返回值

不返回值;更新后的状态可用 is_open() 读取。

使用时注意

  • 打开状态与绘制是两步:还需在合适的覆盖层调用 paint_popup_styled。
  • 显式打开时先展示全部选项;随后编辑文字才按输入过滤。

($&ComboBox) set_popup_above

XuAPI
pub fn (combo $&ComboBox) set_popup_above(above bool)

用途

$&ComboBox 上的操作:设置 popup above。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
above bool
above(bool)

返回值

不返回值。

($&ComboBox) apply_styles

XuAPI
pub fn (combo $&ComboBox) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&ComboBox) popup_bounds

XuAPI
pub fn (combo &ComboBox) popup_bounds() layout.Rect

用途

读取下拉列表在画布中的矩形,用于覆盖层命中测试或布局判断。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

弹出列表的 layout.Rect;读取矩形不会打开列表,应同时检查 is_open()。

(&ComboBox) option_bounds

XuAPI
pub fn (combo &ComboBox) option_bounds(index int) layout.Rect

用途

&ComboBox 上的操作:执行 option bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

(&ComboBox) toggle_bounds

XuAPI
pub fn (combo &ComboBox) toggle_bounds() layout.Rect

用途

&ComboBox 上的操作:执行 toggle bounds 操作。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&ComboBox) input

XuAPI
pub fn (combo $&ComboBox) input(event &ui.InputEvent) Action

用途

处理可输入下拉框的菜单选择、展开按钮和编辑器输入。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 选中菜单项时返回 ACTION_CHANGE,value 为原选项列表中的索引;输入法组合期间把 Enter/方向键留给编辑器。

($&ComboBox) route

XuAPI
pub fn (combo $&ComboBox) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ComboBox) event

XuAPI
pub fn (combo $&ComboBox) event(event &ui.Event) Action

用途

接收窗口原生事件;输入事件转交 input,其余事件交给内部编辑器或基础控件处理。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
窗口提供的完整 ui.Event;需要输入法、失焦和生命周期处理时使用这个入口。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 内部失去焦点后会关闭下拉列表。

($&ComboBox) tick

XuAPI
pub fn (combo $&ComboBox) tick(now time.Instant,reduced_motion bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

(&ComboBox) next_caret_tick

XuAPI
pub fn (combo &ComboBox) next_caret_tick(now time.Instant,reduced_motion bool) time.Instant

用途

&ComboBox 上的操作:执行 next caret tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

time.Instant — 该类型的值

($&ComboBox) measure_styled

XuAPI
pub fn (combo $&ComboBox) measure_styled(styles &Styles) layout.Size

用途

$&ComboBox 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&ComboBox) paint_styled

XuAPI
pub fn (combo $&ComboBox) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&ComboBox 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&ComboBox) paint_popup_styled

XuAPI
pub fn (combo $&ComboBox) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

绘制展开的选项列表;与输入框本体分开绘制,以便选项覆盖后面的控件。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
当前绘制帧;本调用向其中记录绘制命令。
styles &Styles
当前生效的样式;提供颜色、间距、字体和状态外观。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 在画布坐标空间中绘制,通常放在普通控件之后;不要沿用输入框内部的局部变换或裁剪,否则列表可能被截掉。

错误处理

  • 绘制帧、文字或样式操作失败时继续抛出错误。

($&ComboBox) dispose

XuAPI
pub fn (combo $&ComboBox) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ComboBox) set_allow_custom

XuAPI
pub fn (combo $&ComboBox) set_allow_custom(allowed bool)

用途

$&ComboBox 上的操作:设置 allow custom。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
allowed bool
allowed(bool)

返回值

不返回值。

(&ComboBox) is_valid_choice

XuAPI
pub fn (combo &ComboBox) is_valid_choice() bool

用途

&ComboBox 上的操作:判断是否 valid choice。

参数

combo &ComboBox
本次调用使用的 ComboBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) clone

XuAPI
pub fn (b &Button) clone() Button

用途

复制控件或样式快照,返回独立的 Button 值。

参数

b &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

Button — 该类型的值

(&Radio) clone

XuAPI
pub fn (r &Radio) clone() Radio

用途

复制控件或样式快照,返回独立的 Radio 值。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

Radio — 该类型的值

(&Checkbox) clone

XuAPI
pub fn (c &Checkbox) clone() Checkbox

用途

复制控件或样式快照,返回独立的 Checkbox 值。

参数

c &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

Checkbox — 该类型的值

(&Switch) clone

XuAPI
pub fn (value &Switch) clone() Switch

用途

复制控件或样式快照,返回独立的 Switch 值。

参数

value &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

Switch — 该类型的值

(&Slider) clone

XuAPI
pub fn (value &Slider) clone() Slider

用途

复制控件或样式快照,返回独立的 Slider 值。

参数

value &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

Slider — 该类型的值

(&Stepper) clone

XuAPI
pub fn (value &Stepper) clone() Stepper

用途

复制控件或样式快照,返回独立的 Stepper 值。

参数

value &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

Stepper — 该类型的值

(&Tabs) clone

XuAPI
pub fn (value &Tabs) clone() Tabs

用途

复制控件或样式快照,返回独立的 Tabs 值。

参数

value &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

Tabs — 该类型的值

(&Select) clone

XuAPI
pub fn (value &Select) clone() Select

用途

复制控件或样式快照,返回独立的 Select 值。

参数

value &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

Select — 该类型的值

(&ListBox) clone

XuAPI
pub fn (value &ListBox) clone() ListBox

用途

复制控件或样式快照,返回独立的 ListBox 值。

参数

value &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

ListBox — 该类型的值

(&Progress) clone

XuAPI
pub fn (value &Progress) clone() Progress

用途

复制控件或样式快照,返回独立的 Progress 值。

参数

value &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

Progress — 该类型的值

(&Divider) clone

XuAPI
pub fn (value &Divider) clone() Divider

用途

复制控件或样式快照,返回独立的 Divider 值。

参数

value &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

Divider — 该类型的值

(&Badge) clone

XuAPI
pub fn (value &Badge) clone() Badge

用途

复制控件或样式快照,返回独立的 Badge 值。

参数

value &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

Badge — 该类型的值

(&Card) clone

XuAPI
pub fn (value &Card) clone() Card

用途

复制控件或样式快照,返回独立的 Card 值。

参数

value &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

Card — 该类型的值

(&Scroll) clone

XuAPI
pub fn (value &Scroll) clone() Scroll

用途

复制控件或样式快照,返回独立的 Scroll 值。

参数

value &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

Scroll — 该类型的值

($&DatePicker) set_locale

XuAPI
pub fn (picker $&DatePicker) set_locale(locale &Locale) int

用途

$&DatePicker 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&TimePicker) set_locale

XuAPI
pub fn (picker $&TimePicker) set_locale(locale &Locale) int

用途

$&TimePicker 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Table) set_locale

XuAPI
pub fn (table $&Table) set_locale(locale &Locale) int

用途

$&Table 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

table $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Pagination) set_locale

XuAPI
pub fn (page $&Pagination) set_locale(locale &Locale) int

用途

$&Pagination 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

page $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&ColorPicker) set_locale

XuAPI
pub fn (picker $&ColorPicker) set_locale(locale &Locale) int

用途

$&ColorPicker 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&ColorPicker
本次调用使用的 ColorPicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Slider) set_locale

XuAPI
pub fn (slider $&Slider) set_locale(locale &Locale) int

用途

$&Slider 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

slider $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Stepper) set_locale

XuAPI
pub fn (stepper $&Stepper) set_locale(locale &Locale) int

用途

$&Stepper 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

stepper $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Field) set_locale

XuAPI
pub fn (field $&Field) set_locale(locale &Locale) int

用途

$&Field 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

field $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&TaskButton) set_locale

XuAPI
pub fn (task $&TaskButton) set_locale(locale &Locale) int

用途

$&TaskButton 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&TaskButton) use_locale_labels

XuAPI
pub fn (task $&TaskButton) use_locale_labels() int

用途

$&TaskButton 上的操作:执行 use locale labels 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

(&TaskButton) label_text

XuAPI
pub fn (task &TaskButton) label_text() string

用途

&TaskButton 上的操作:执行 label text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&MultiSelect) set_locale

XuAPI
pub fn (multi $&MultiSelect) set_locale(locale &Locale) int

用途

$&MultiSelect 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&ComboBox) set_locale

XuAPI
pub fn (combo $&ComboBox) set_locale(locale &Locale) int

用途

$&ComboBox 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

combo $&ComboBox
本次调用使用的 ComboBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

(&MultiSelect) selection_text

XuAPI
pub fn (multi &MultiSelect) selection_text() string

用途

&MultiSelect 上的操作:执行 selection text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Stepper) value_text

XuAPI
pub fn (stepper &Stepper) value_text() string

用途

&Stepper 上的操作:值文本。失败时抛出错误,调用方需处理或继续传播。

参数

stepper &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&TimePicker) use_locale_clock

XuAPI
pub fn (picker $&TimePicker) use_locale_clock()

用途

$&TimePicker 上的操作:执行 use locale clock 操作。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&DatePicker) display_text

XuAPI
pub fn (picker &DatePicker) display_text() string

用途

&DatePicker 上的操作:执行 display text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

struct Switch

XuAPI
pub struct Switch {

}

用途

Switch 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

switch_control

XuAPI
pub fn switch_control(identity &ui.CanvasEvent,id int,bounds &layout.Rect,checked bool) Switch

用途

执行 switch control 操作。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
checked bool
checked(bool)

返回值

Switch — 该类型的值

查看用法示例

(&Switch) id

XuAPI
pub fn (sw &Switch) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Switch) bounds

XuAPI
pub fn (sw &Switch) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Switch) needs_paint

XuAPI
pub fn (sw &Switch) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) painted

XuAPI
pub fn (sw $&Switch) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Switch) invalidate

XuAPI
pub fn (sw $&Switch) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Switch) cancel

XuAPI
pub fn (sw $&Switch) cancel()

用途

$&Switch 上的操作:取消。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Switch) is_enabled

XuAPI
pub fn (sw &Switch) is_enabled() bool

用途

返回控件当前是否可用。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Switch) is_selectable

XuAPI
pub fn (sw &Switch) is_selectable() bool

用途

&Switch 上的操作:判断是否 selectable。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) set_selectable

XuAPI
pub fn (sw $&Switch) set_selectable(selectable bool)

用途

$&Switch 上的操作:设置 selectable。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Switch) set_enabled

XuAPI
pub fn (sw $&Switch) set_enabled(enabled bool)

用途

$&Switch 上的操作:设置 enabled。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Switch) is_focused

XuAPI
pub fn (sw &Switch) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) set_focus

XuAPI
pub fn (sw $&Switch) set_focus(focused bool)

用途

$&Switch 上的操作:设置 focus。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Switch) is_hovered

XuAPI
pub fn (sw &Switch) is_hovered() bool

用途

&Switch 上的操作:判断是否 hovered。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Switch) is_pressed

XuAPI
pub fn (sw &Switch) is_pressed() bool

用途

&Switch 上的操作:判断是否 pressed。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Switch) is_invalid

XuAPI
pub fn (sw &Switch) is_invalid() bool

用途

&Switch 上的操作:判断是否 invalid。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) set_invalid

XuAPI
pub fn (sw $&Switch) set_invalid(invalid bool)

用途

$&Switch 上的操作:设置 invalid。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Switch) is_read_only

XuAPI
pub fn (sw &Switch) is_read_only() bool

用途

&Switch 上的操作:判断是否 read only。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) set_read_only

XuAPI
pub fn (sw $&Switch) set_read_only(read_only bool)

用途

$&Switch 上的操作:设置 read only。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&Switch) set_bounds

XuAPI
pub fn (sw $&Switch) set_bounds(bounds &layout.Rect) int

用途

$&Switch 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Switch) value

XuAPI
pub fn (sw &Switch) value() bool

用途

&Switch 上的操作:值。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) set_value

XuAPI
pub fn (sw $&Switch) set_value(checked bool)

用途

$&Switch 上的操作:设置 value。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
checked bool
checked(bool)

返回值

不返回值。

(&Switch) visual_state

XuAPI
pub fn (sw &Switch) visual_state() int

用途

&Switch 上的操作:执行 visual state 操作。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Switch) has_style

XuAPI
pub fn (sw &Switch) has_style() bool

用途

&Switch 上的操作:判断是否具有 style。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Switch) style_or

XuAPI
pub fn (sw &Switch) style_or(styles &Styles) ControlStyle

用途

&Switch 上的操作:执行 style or 操作。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Switch) set_style

XuAPI
pub fn (sw $&Switch) set_style(style &ControlStyle) int

用途

$&Switch 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Switch) clear_style

XuAPI
pub fn (sw $&Switch) clear_style()

用途

$&Switch 上的操作:执行 clear style 操作。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Switch) input

XuAPI
pub fn (sw $&Switch) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Switch) event

XuAPI
pub fn (sw $&Switch) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Switch) paint

XuAPI
pub fn (sw &Switch) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Switch) measure_styled

XuAPI
pub fn (sw &Switch) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Switch 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Switch) paint_styled

XuAPI
pub fn (sw &Switch) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Switch 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Switch) paint_position_styled

XuAPI
pub fn (sw &Switch) paint_position_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles,position f64) int

用途

&Switch 上的操作:执行 paint position styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
position f64
position(f64)

返回值

int — 该类型的值

struct Radio

XuAPI
pub struct Radio {

}

用途

Radio 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

radio

XuAPI
pub fn radio(identity &ui.CanvasEvent,id int,bounds &layout.Rect,option_value int,selected bool) Radio

用途

执行 radio 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
option_value int
option_value(int)
selected bool
selected(bool)

返回值

Radio — 该类型的值

查看用法示例

(&Radio) id

XuAPI
pub fn (r &Radio) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Radio) bounds

XuAPI
pub fn (r &Radio) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Radio) option

XuAPI
pub fn (r &Radio) option() int

用途

在 &Radio 上执行 option 操作。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Radio) value

XuAPI
pub fn (r &Radio) value() bool

用途

&Radio 上的操作:值。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Radio) set_value

XuAPI
pub fn (r $&Radio) set_value(selected bool)

用途

$&Radio 上的操作:设置 value。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
selected(bool)

返回值

不返回值。

(&Radio) needs_paint

XuAPI
pub fn (r &Radio) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Radio) painted

XuAPI
pub fn (r $&Radio) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Radio) invalidate

XuAPI
pub fn (r $&Radio) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Radio) cancel

XuAPI
pub fn (r $&Radio) cancel()

用途

$&Radio 上的操作:取消。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Radio) is_enabled

XuAPI
pub fn (r &Radio) is_enabled() bool

用途

返回控件当前是否可用。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Radio) is_selectable

XuAPI
pub fn (r &Radio) is_selectable() bool

用途

&Radio 上的操作:判断是否 selectable。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Radio) set_selectable

XuAPI
pub fn (r $&Radio) set_selectable(selectable bool)

用途

$&Radio 上的操作:设置 selectable。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Radio) set_enabled

XuAPI
pub fn (r $&Radio) set_enabled(enabled bool)

用途

$&Radio 上的操作:设置 enabled。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Radio) is_focused

XuAPI
pub fn (r &Radio) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Radio) set_focus

XuAPI
pub fn (r $&Radio) set_focus(focused bool)

用途

$&Radio 上的操作:设置 focus。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Radio) is_hovered

XuAPI
pub fn (r &Radio) is_hovered() bool

用途

&Radio 上的操作:判断是否 hovered。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Radio) is_pressed

XuAPI
pub fn (r &Radio) is_pressed() bool

用途

&Radio 上的操作:判断是否 pressed。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Radio) is_invalid

XuAPI
pub fn (r &Radio) is_invalid() bool

用途

&Radio 上的操作:判断是否 invalid。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Radio) set_invalid

XuAPI
pub fn (r $&Radio) set_invalid(invalid bool)

用途

$&Radio 上的操作:设置 invalid。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Radio) is_read_only

XuAPI
pub fn (r &Radio) is_read_only() bool

用途

&Radio 上的操作:判断是否 read only。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Radio) set_read_only

XuAPI
pub fn (r $&Radio) set_read_only(read_only bool)

用途

$&Radio 上的操作:设置 read only。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&Radio) set_bounds

XuAPI
pub fn (r $&Radio) set_bounds(bounds &layout.Rect) int

用途

$&Radio 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Radio) visual_state

XuAPI
pub fn (r &Radio) visual_state() int

用途

&Radio 上的操作:执行 visual state 操作。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Radio) has_style

XuAPI
pub fn (r &Radio) has_style() bool

用途

&Radio 上的操作:判断是否具有 style。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Radio) style_or

XuAPI
pub fn (r &Radio) style_or(styles &Styles) ControlStyle

用途

&Radio 上的操作:执行 style or 操作。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Radio) set_style

XuAPI
pub fn (r $&Radio) set_style(style &ControlStyle) int

用途

$&Radio 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Radio) clear_style

XuAPI
pub fn (r $&Radio) clear_style()

用途

$&Radio 上的操作:执行 clear style 操作。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Radio) input

XuAPI
pub fn (r $&Radio) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Radio) event

XuAPI
pub fn (r $&Radio) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Radio) paint

XuAPI
pub fn (r &Radio) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Radio) measure_styled

XuAPI
pub fn (r &Radio) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Radio 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Radio) paint_styled

XuAPI
pub fn (r &Radio) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Radio 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

r &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Slider

XuAPI
pub struct Slider {

}

用途

Slider 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

slider

XuAPI
pub fn slider(identity &ui.CanvasEvent,id int,bounds &layout.Rect,min f64,max f64,value f64) Slider

用途

执行 slider 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
min f64
下限(f64)
max f64
上限(f64)
value f64
value(f64)

返回值

Slider — 该类型的值

查看用法示例

(&Slider) id

XuAPI
pub fn (s &Slider) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Slider) is_selectable

XuAPI
pub fn (s &Slider) is_selectable() bool

用途

&Slider 上的操作:判断是否 selectable。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Slider) set_selectable

XuAPI
pub fn (s $&Slider) set_selectable(selectable bool)

用途

$&Slider 上的操作:设置 selectable。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Slider) bounds

XuAPI
pub fn (s &Slider) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Slider) value

XuAPI
pub fn (s &Slider) value() f64

用途

&Slider 上的操作:值。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Slider) min

XuAPI
pub fn (s &Slider) min() f64

用途

&Slider 上的操作:返回两数值中的较小值。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Slider) max

XuAPI
pub fn (s &Slider) max() f64

用途

&Slider 上的操作:返回两数值中的较大值。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Slider) step

XuAPI
pub fn (s &Slider) step() f64

用途

在 &Slider 上执行 step 操作。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Slider) ratio

XuAPI
pub fn (s &Slider) ratio() f64

用途

在 &Slider 上执行 ratio 操作。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Slider) needs_paint

XuAPI
pub fn (s &Slider) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Slider) painted

XuAPI
pub fn (s $&Slider) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Slider) invalidate

XuAPI
pub fn (s $&Slider) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Slider) cancel

XuAPI
pub fn (s $&Slider) cancel()

用途

$&Slider 上的操作:取消。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Slider) is_enabled

XuAPI
pub fn (s &Slider) is_enabled() bool

用途

返回控件当前是否可用。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Slider) set_enabled

XuAPI
pub fn (s $&Slider) set_enabled(enabled bool)

用途

$&Slider 上的操作:设置 enabled。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Slider) is_focused

XuAPI
pub fn (s &Slider) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Slider) set_focus

XuAPI
pub fn (s $&Slider) set_focus(focused bool)

用途

$&Slider 上的操作:设置 focus。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Slider) is_hovered

XuAPI
pub fn (s &Slider) is_hovered() bool

用途

&Slider 上的操作:判断是否 hovered。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Slider) is_dragging

XuAPI
pub fn (s &Slider) is_dragging() bool

用途

&Slider 上的操作:判断是否 dragging。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Slider) is_invalid

XuAPI
pub fn (s &Slider) is_invalid() bool

用途

&Slider 上的操作:判断是否 invalid。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Slider) set_invalid

XuAPI
pub fn (s $&Slider) set_invalid(invalid bool)

用途

$&Slider 上的操作:设置 invalid。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Slider) is_read_only

XuAPI
pub fn (s &Slider) is_read_only() bool

用途

&Slider 上的操作:判断是否 read only。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Slider) set_read_only

XuAPI
pub fn (s $&Slider) set_read_only(read_only bool)

用途

$&Slider 上的操作:设置 read only。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&Slider) set_value

XuAPI
pub fn (s $&Slider) set_value(value f64) int

用途

设置滑块数值,按已配置范围和步长约束结果。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
有限浮点数;超出范围会被限制到端点,并按步长对齐。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

错误处理

  • NaN 或无穷值抛出 widgets: invalid slider value。

($&Slider) set_range

XuAPI
pub fn (s $&Slider) set_range(min f64,max f64) int

用途

$&Slider 上的操作:设置 range。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
min f64
下限(f64)
max f64
上限(f64)

返回值

int — 该类型的值

($&Slider) set_step

XuAPI
pub fn (s $&Slider) set_step(step f64) int

用途

$&Slider 上的操作:设置 step。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
step f64
step(f64)

返回值

int — 该类型的值

($&Slider) set_bounds

XuAPI
pub fn (s $&Slider) set_bounds(bounds &layout.Rect) int

用途

$&Slider 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Slider) visual_state

XuAPI
pub fn (s &Slider) visual_state() int

用途

&Slider 上的操作:执行 visual state 操作。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Slider) has_style

XuAPI
pub fn (s &Slider) has_style() bool

用途

&Slider 上的操作:判断是否具有 style。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Slider) style_or

XuAPI
pub fn (s &Slider) style_or(styles &Styles) ControlStyle

用途

&Slider 上的操作:执行 style or 操作。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Slider) set_style

XuAPI
pub fn (s $&Slider) set_style(style &ControlStyle) int

用途

$&Slider 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Slider) clear_style

XuAPI
pub fn (s $&Slider) clear_style()

用途

$&Slider 上的操作:执行 clear style 操作。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Slider) input

XuAPI
pub fn (s $&Slider) input(input &ui.InputEvent) Action

用途

处理拖动和键盘调节,在连续变化和最终提交之间区分动作类型。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • ACTION_CHANGE 表示连续变化,ACTION_COMMIT 表示一次已改变数值的交互完成;value 是当前数值。启用 set_commit_only 后不发送连续变化。

($&Slider) event

XuAPI
pub fn (s $&Slider) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Slider) paint

XuAPI
pub fn (s &Slider) paint(frame $&draw.Frame,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Slider) measure_styled

XuAPI
pub fn (s &Slider) measure_styled(styles &Styles) layout.Size

用途

&Slider 上的操作:执行 measure styled 操作。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Slider) paint_styled

XuAPI
pub fn (s &Slider) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

&Slider 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Slider) set_commit_only

XuAPI
pub fn (s $&Slider) set_commit_only(enabled bool)

用途

选择只在一次调节结束时发出提交动作,适合变化处理较昂贵的业务。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
为 true 时抑制拖动中的 ACTION_CHANGE,保留结束时的 ACTION_COMMIT。

返回值

不返回值;设置时会清除当前待提交标记。

使用时注意

  • 拖动时控件内部数值仍更新并重绘;调用方把昂贵操作放到提交动作中处理。

($&Switch) set_motion

XuAPI
pub fn (sw $&Switch) set_motion(spec &MotionSpec) int

用途

$&Switch 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Switch) tick

XuAPI
pub fn (sw $&Switch) tick(now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&Switch) next_tick

XuAPI
pub fn (sw &Switch) next_tick(now time.Instant) time.Instant

用途

&Switch 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&Slider) apply_styles

XuAPI
pub fn (s $&Slider) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Stepper

XuAPI
pub struct Stepper {

}

用途

Stepper 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

stepper

XuAPI
pub fn stepper(identity &ui.CanvasEvent,id int,bounds &layout.Rect,min f64,max f64,step f64,value f64) Stepper

用途

执行 stepper 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
min f64
下限(f64)
max f64
上限(f64)
step f64
step(f64)
value f64
value(f64)

返回值

Stepper — 该类型的值

查看用法示例

(&Stepper) id

XuAPI
pub fn (st &Stepper) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Stepper) is_selectable

XuAPI
pub fn (st &Stepper) is_selectable() bool

用途

&Stepper 上的操作:判断是否 selectable。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Stepper) set_selectable

XuAPI
pub fn (st $&Stepper) set_selectable(selectable bool)

用途

$&Stepper 上的操作:设置 selectable。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Stepper) bounds

XuAPI
pub fn (st &Stepper) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Stepper) value

XuAPI
pub fn (st &Stepper) value() f64

用途

&Stepper 上的操作:值。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Stepper) min

XuAPI
pub fn (st &Stepper) min() f64

用途

&Stepper 上的操作:返回两数值中的较小值。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Stepper) max

XuAPI
pub fn (st &Stepper) max() f64

用途

&Stepper 上的操作:返回两数值中的较大值。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Stepper) step

XuAPI
pub fn (st &Stepper) step() f64

用途

在 &Stepper 上执行 step 操作。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Stepper) can_decrement

XuAPI
pub fn (st &Stepper) can_decrement() bool

用途

&Stepper 上的操作:执行 can decrement 操作。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Stepper) can_increment

XuAPI
pub fn (st &Stepper) can_increment() bool

用途

&Stepper 上的操作:执行 can increment 操作。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Stepper) needs_paint

XuAPI
pub fn (st &Stepper) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Stepper) painted

XuAPI
pub fn (st $&Stepper) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Stepper) invalidate

XuAPI
pub fn (st $&Stepper) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Stepper) cancel

XuAPI
pub fn (st $&Stepper) cancel()

用途

$&Stepper 上的操作:取消。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Stepper) is_enabled

XuAPI
pub fn (st &Stepper) is_enabled() bool

用途

返回控件当前是否可用。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Stepper) set_enabled

XuAPI
pub fn (st $&Stepper) set_enabled(enabled bool)

用途

$&Stepper 上的操作:设置 enabled。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Stepper) is_focused

XuAPI
pub fn (st &Stepper) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Stepper) set_focus

XuAPI
pub fn (st $&Stepper) set_focus(focused bool)

用途

$&Stepper 上的操作:设置 focus。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Stepper) is_hovered

XuAPI
pub fn (st &Stepper) is_hovered() bool

用途

&Stepper 上的操作:判断是否 hovered。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Stepper) is_invalid

XuAPI
pub fn (st &Stepper) is_invalid() bool

用途

&Stepper 上的操作:判断是否 invalid。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Stepper) set_invalid

XuAPI
pub fn (st $&Stepper) set_invalid(invalid bool)

用途

$&Stepper 上的操作:设置 invalid。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Stepper) is_read_only

XuAPI
pub fn (st &Stepper) is_read_only() bool

用途

&Stepper 上的操作:判断是否 read only。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Stepper) set_read_only

XuAPI
pub fn (st $&Stepper) set_read_only(read_only bool)

用途

$&Stepper 上的操作:设置 read only。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&Stepper) set_value

XuAPI
pub fn (st $&Stepper) set_value(value f64) int

用途

$&Stepper 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)

返回值

int — 该类型的值

($&Stepper) set_range

XuAPI
pub fn (st $&Stepper) set_range(min f64,max f64,step f64) int

用途

$&Stepper 上的操作:设置 range。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
min f64
下限(f64)
max f64
上限(f64)
step f64
step(f64)

返回值

int — 该类型的值

($&Stepper) set_bounds

XuAPI
pub fn (st $&Stepper) set_bounds(bounds &layout.Rect) int

用途

$&Stepper 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Stepper) visual_state

XuAPI
pub fn (st &Stepper) visual_state() int

用途

&Stepper 上的操作:执行 visual state 操作。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Stepper) has_style

XuAPI
pub fn (st &Stepper) has_style() bool

用途

&Stepper 上的操作:判断是否具有 style。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Stepper) style_or

XuAPI
pub fn (st &Stepper) style_or(styles &Styles) ControlStyle

用途

&Stepper 上的操作:执行 style or 操作。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Stepper) set_style

XuAPI
pub fn (st $&Stepper) set_style(style &ControlStyle) int

用途

$&Stepper 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Stepper) clear_style

XuAPI
pub fn (st $&Stepper) clear_style()

用途

$&Stepper 上的操作:执行 clear style 操作。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Stepper) input

XuAPI
pub fn (st $&Stepper) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Stepper) event

XuAPI
pub fn (st $&Stepper) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Stepper) paint

XuAPI
pub fn (st &Stepper) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Stepper) measure_styled

XuAPI
pub fn (st &Stepper) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Stepper 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Stepper) paint_styled

XuAPI
pub fn (st &Stepper) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Stepper 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct ListBox

XuAPI
pub struct ListBox {

}

用途

ListBox 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

list_box

XuAPI
pub fn list_box(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) ListBox

用途

执行 list box 操作。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
count int
count(int)
selected int
selected(int)

返回值

ListBox — 该类型的值

查看用法示例

(&ListBox) id

XuAPI
pub fn (lb &ListBox) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) bounds

XuAPI
pub fn (lb &ListBox) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ListBox) count

XuAPI
pub fn (lb &ListBox) count() int

用途

返回该控件当前包含的项目数量。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) selected

XuAPI
pub fn (lb &ListBox) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) hovered_item

XuAPI
pub fn (lb &ListBox) hovered_item() int

用途

&ListBox 上的操作:执行 hovered item 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) scroll_offset

XuAPI
pub fn (lb &ListBox) scroll_offset() f64

用途

&ListBox 上的操作:执行 scroll offset 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&ListBox) is_selectable

XuAPI
pub fn (lb &ListBox) is_selectable() bool

用途

&ListBox 上的操作:判断是否 selectable。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ListBox) set_selectable

XuAPI
pub fn (lb $&ListBox) set_selectable(selectable bool)

用途

$&ListBox 上的操作:设置 selectable。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&ListBox) has_popup_open

XuAPI
pub fn (lb &ListBox) has_popup_open() bool

用途

&ListBox 上的操作:判断是否具有 popup open。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListBox) popup_bounds

XuAPI
pub fn (lb &ListBox) popup_bounds() layout.Rect

用途

&ListBox 上的操作:执行 popup bounds 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ListBox) cursor

XuAPI
pub fn (lb &ListBox) cursor() int

用途

&ListBox 上的操作:游标。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&ListBox) set_locale

XuAPI
pub fn (lb $&ListBox) set_locale(locale &Locale) int

用途

$&ListBox 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&ListBox) set_viewport

XuAPI
pub fn (lb $&ListBox) set_viewport(viewport &layout.Rect,context &draw.Context)

用途

$&ListBox 上的操作:设置 viewport。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)

返回值

不返回值。

($&ListBox) paint_popup_styled

XuAPI
pub fn (lb $&ListBox) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&ListBox 上的操作:执行 paint popup styled 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&ListBox) dispose_aux

XuAPI
pub fn (lb $&ListBox) dispose_aux()

用途

$&ListBox 上的操作:执行 dispose aux 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ListBox) set_styles_cache

XuAPI
pub fn (lb $&ListBox) set_styles_cache(styles &Styles)

用途

$&ListBox 上的操作:设置 styles cache。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

不返回值。

(&ListBox) style_snapshot

XuAPI
pub fn (lb &ListBox) style_snapshot() Styles

用途

&ListBox 上的操作:执行 style snapshot 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

Styles — 该类型的值

(&ListBox) has_selection_for_row

XuAPI
pub fn (lb &ListBox) has_selection_for_row(row int) bool

用途

&ListBox 上的操作:判断是否具有 selection for row。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
row int
row(int)

返回值

bool — 是否成立

(&ListBox) row_sel_anchor

XuAPI
pub fn (lb &ListBox) row_sel_anchor() int

用途

&ListBox 上的操作:执行 row sel anchor 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) row_sel_focus

XuAPI
pub fn (lb &ListBox) row_sel_focus() int

用途

&ListBox 上的操作:执行 row sel focus 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) selected_text

XuAPI
pub fn (lb &ListBox) selected_text() string

用途

&ListBox 上的操作:执行 selected text 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&ListBox) route_popup

XuAPI
pub fn (lb $&ListBox) route_popup(event &ui.InputEvent) Action

用途

$&ListBox 上的操作:执行 route popup 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ListBox) handle_text_key

XuAPI
pub fn (lb $&ListBox) handle_text_key(event &ui.InputEvent) Action

用途

$&ListBox 上的操作:执行 handle text key 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ListBox) ensure_row_text

XuAPI
pub fn (lb $&ListBox) ensure_row_text(row int,col int,text &string,row_text &string)

用途

$&ListBox 上的操作:执行 ensure row text 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
row int
row(int)
col int
col(int)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
row_text &string
row_text(只读借用,调用方仍持有原值;类型 &string)

返回值

不返回值。

($&ListBox) open_row_menu

XuAPI
pub fn (lb $&ListBox) open_row_menu(context &draw.Context,x f64,y f64,text &string,row_text &string,row int,col int,show_row bool) bool

用途

$&ListBox 上的操作:执行 open row menu 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
x f64
值(f64)
y f64
值(f64)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
row_text &string
row_text(只读借用,调用方仍持有原值;类型 &string)
row int
row(int)
col int
col(int)
show_row bool
show_row(bool)

返回值

bool — 是否成立

($&ListBox) begin_row_pointer

XuAPI
pub fn (lb $&ListBox) begin_row_pointer(text &string,row_text &string,idx int,row int,col int,event &ui.InputEvent) bool

用途

$&ListBox 上的操作:执行 begin row pointer 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
row_text &string
row_text(只读借用,调用方仍持有原值;类型 &string)
idx int
idx(int)
row int
row(int)
col int
col(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

bool — 是否成立

($&ListBox) should_begin_row_drag

XuAPI
pub fn (lb $&ListBox) should_begin_row_drag(x f64,y f64,density f64) bool

用途

$&ListBox 上的操作:执行 should begin row drag 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)
density f64
density(f64)

返回值

bool — 是否成立

($&ListBox) drag_row_pointer

XuAPI
pub fn (lb $&ListBox) drag_row_pointer(idx int) bool

用途

$&ListBox 上的操作:执行 drag row pointer 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
idx int
idx(int)

返回值

bool — 是否成立

($&ListBox) end_row_pointer

XuAPI
pub fn (lb $&ListBox) end_row_pointer()

用途

$&ListBox 上的操作:执行 end row pointer 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ListBox) clear_text_selection

XuAPI
pub fn (lb $&ListBox) clear_text_selection()

用途

$&ListBox 上的操作:执行 clear text selection 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&ListBox) needs_paint

XuAPI
pub fn (lb &ListBox) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ListBox) painted

XuAPI
pub fn (lb $&ListBox) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ListBox) invalidate

XuAPI
pub fn (lb $&ListBox) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ListBox) cancel

XuAPI
pub fn (lb $&ListBox) cancel()

用途

$&ListBox 上的操作:取消。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&ListBox) is_enabled

XuAPI
pub fn (lb &ListBox) is_enabled() bool

用途

返回控件当前是否可用。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ListBox) set_enabled

XuAPI
pub fn (lb $&ListBox) set_enabled(enabled bool)

用途

$&ListBox 上的操作:设置 enabled。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&ListBox) is_focused

XuAPI
pub fn (lb &ListBox) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ListBox) set_focus

XuAPI
pub fn (lb $&ListBox) set_focus(focused bool)

用途

$&ListBox 上的操作:设置 focus。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&ListBox) is_hovered

XuAPI
pub fn (lb &ListBox) is_hovered() bool

用途

&ListBox 上的操作:判断是否 hovered。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListBox) is_invalid

XuAPI
pub fn (lb &ListBox) is_invalid() bool

用途

&ListBox 上的操作:判断是否 invalid。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ListBox) set_invalid

XuAPI
pub fn (lb $&ListBox) set_invalid(invalid bool)

用途

$&ListBox 上的操作:设置 invalid。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&ListBox) is_read_only

XuAPI
pub fn (lb &ListBox) is_read_only() bool

用途

&ListBox 上的操作:判断是否 read only。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&ListBox) set_read_only

XuAPI
pub fn (lb $&ListBox) set_read_only(read_only bool)

用途

$&ListBox 上的操作:设置 read only。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&ListBox) set_scroll_offset

XuAPI
pub fn (lb $&ListBox) set_scroll_offset(offset f64) int

用途

$&ListBox 上的操作:设置 scroll offset。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
offset f64
偏移(f64)

返回值

int — 该类型的值

($&ListBox) ensure_visible

XuAPI
pub fn (lb $&ListBox) ensure_visible(index int)

用途

$&ListBox 上的操作:执行 ensure visible 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

不返回值。

($&ListBox) set_count

XuAPI
pub fn (lb $&ListBox) set_count(count int) int

用途

$&ListBox 上的操作:设置 count。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
count int
count(int)

返回值

int — 该类型的值

($&ListBox) set_selected

XuAPI
pub fn (lb $&ListBox) set_selected(index int) int

用途

$&ListBox 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&ListBox) set_bounds

XuAPI
pub fn (lb $&ListBox) set_bounds(bounds &layout.Rect) int

用途

$&ListBox 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&ListBox) visual_state

XuAPI
pub fn (lb &ListBox) visual_state() int

用途

&ListBox 上的操作:执行 visual state 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) item_visual_state

XuAPI
pub fn (lb &ListBox) item_visual_state(index int) int

用途

&ListBox 上的操作:执行 item visual state 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

(&ListBox) has_style

XuAPI
pub fn (lb &ListBox) has_style() bool

用途

&ListBox 上的操作:判断是否具有 style。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListBox) style_or

XuAPI
pub fn (lb &ListBox) style_or(styles &Styles) ControlStyle

用途

&ListBox 上的操作:执行 style or 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&ListBox) set_style

XuAPI
pub fn (lb $&ListBox) set_style(style &ControlStyle) int

用途

$&ListBox 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&ListBox) clear_style

XuAPI
pub fn (lb $&ListBox) clear_style()

用途

$&ListBox 上的操作:执行 clear style 操作。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ListBox) apply_styles

XuAPI
pub fn (lb $&ListBox) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&ListBox) hit_row

XuAPI
pub fn (lb &ListBox) hit_row(x f64,y f64) int

用途

&ListBox 上的操作:执行 hit row 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

($&ListBox) input

XuAPI
pub fn (lb $&ListBox) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ListBox) event

XuAPI
pub fn (lb $&ListBox) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&ListBox) paint

XuAPI
pub fn (lb &ListBox) paint(frame $&draw.Frame,labels &[]draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
labels &[]draw.TextLayout
labels(只读借用,调用方仍持有原值;类型 &[]draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&ListBox) measure_styled

XuAPI
pub fn (lb &ListBox) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&ListBox 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&ListBox) paint_box_styled

XuAPI
pub fn (lb &ListBox) paint_box_styled(frame $&draw.Frame,styles &Styles) int

用途

&ListBox 上的操作:执行 paint box styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&ListBox) paint_item_styled

XuAPI
pub fn (lb &ListBox) paint_item_styled(frame $&draw.Frame,index int,label $&StyledLabel,styles &Styles) int

用途

&ListBox 上的操作:执行 paint item styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
index int
index(int)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&ListBox) paint_styled

XuAPI
pub fn (lb &ListBox) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&ListBox 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Stepper) set_repeat

XuAPI
pub fn (st $&Stepper) set_repeat(enabled bool,delay time.Duration,interval time.Duration) int

用途

$&Stepper 上的操作:设置 repeat。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)
delay time.Duration
delay(time.Duration)
interval time.Duration
interval(time.Duration)

返回值

int — 该类型的值

($&Stepper) apply_styles

XuAPI
pub fn (st $&Stepper) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Stepper) next_tick

XuAPI
pub fn (st &Stepper) next_tick(now time.Instant) time.Instant

用途

&Stepper 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

st &Stepper
本次调用使用的 Stepper 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&Stepper) tick

XuAPI
pub fn (st $&Stepper) tick(now time.Instant) Action

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

struct Divider

XuAPI
pub struct Divider {

}

用途

Divider 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

divider

XuAPI
pub fn divider(bounds &layout.Rect,axis int) Divider

用途

执行 divider 处理。失败时抛出错误,调用方需处理或继续传播。

参数

bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
axis int
axis(int)

返回值

Divider — 该类型的值

查看用法示例

(&Divider) is_selectable

XuAPI
pub fn (div &Divider) is_selectable() bool

用途

&Divider 上的操作:判断是否 selectable。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Divider) set_selectable

XuAPI
pub fn (div $&Divider) set_selectable(selectable bool)

用途

$&Divider 上的操作:设置 selectable。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Divider) axis

XuAPI
pub fn (div &Divider) axis() int

用途

在 &Divider 上执行 axis 操作。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Divider) set_axis

XuAPI
pub fn (div $&Divider) set_axis(axis int) int

用途

$&Divider 上的操作:设置 axis。失败时抛出错误,调用方需处理或继续传播。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
axis int
axis(int)

返回值

int — 该类型的值

(&Divider) bounds

XuAPI
pub fn (div &Divider) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Divider) set_bounds

XuAPI
pub fn (div $&Divider) set_bounds(bounds &layout.Rect) int

用途

$&Divider 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Divider) needs_paint

XuAPI
pub fn (div &Divider) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Divider) painted

XuAPI
pub fn (div $&Divider) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Divider) invalidate

XuAPI
pub fn (div $&Divider) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Divider) is_enabled

XuAPI
pub fn (div &Divider) is_enabled() bool

用途

返回控件当前是否可用。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Divider) set_enabled

XuAPI
pub fn (div $&Divider) set_enabled(enabled bool)

用途

$&Divider 上的操作:设置 enabled。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Divider) is_invalid

XuAPI
pub fn (div &Divider) is_invalid() bool

用途

&Divider 上的操作:判断是否 invalid。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Divider) set_invalid

XuAPI
pub fn (div $&Divider) set_invalid(invalid bool)

用途

$&Divider 上的操作:设置 invalid。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Divider) is_selected

XuAPI
pub fn (div &Divider) is_selected() bool

用途

&Divider 上的操作:判断是否 selected。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Divider) set_selected

XuAPI
pub fn (div $&Divider) set_selected(selected bool)

用途

$&Divider 上的操作:设置 selected。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
selected(bool)

返回值

不返回值。

(&Divider) visual_state

XuAPI
pub fn (div &Divider) visual_state() int

用途

&Divider 上的操作:执行 visual state 操作。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Divider) has_style

XuAPI
pub fn (div &Divider) has_style() bool

用途

&Divider 上的操作:判断是否具有 style。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Divider) style_or

XuAPI
pub fn (div &Divider) style_or(styles &Styles) ControlStyle

用途

&Divider 上的操作:执行 style or 操作。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Divider) set_style

XuAPI
pub fn (div $&Divider) set_style(style &ControlStyle) int

用途

$&Divider 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Divider) clear_style

XuAPI
pub fn (div $&Divider) clear_style()

用途

$&Divider 上的操作:执行 clear style 操作。

参数

div $&Divider
本次调用使用的 Divider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Divider) paint

XuAPI
pub fn (div &Divider) paint(frame $&draw.Frame,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Divider) measure_styled

XuAPI
pub fn (div &Divider) measure_styled(styles &Styles) layout.Size

用途

&Divider 上的操作:执行 measure styled 操作。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Divider) measure_labeled_styled

XuAPI
pub fn (div &Divider) measure_labeled_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Divider 上的操作:执行 measure labeled styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Divider) paint_styled

XuAPI
pub fn (div &Divider) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

&Divider 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Divider) paint_labeled_styled

XuAPI
pub fn (div &Divider) paint_labeled_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Divider 上的操作:执行 paint labeled styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

div &Divider
本次调用使用的 Divider 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Badge

XuAPI
pub struct Badge {

}

用途

Badge 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

badge

XuAPI
pub fn badge(bounds &layout.Rect) Badge

用途

执行 badge 处理。失败时抛出错误,调用方需处理或继续传播。

参数

bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Badge — 该类型的值

查看用法示例

(&Badge) is_selectable

XuAPI
pub fn (bg &Badge) is_selectable() bool

用途

&Badge 上的操作:判断是否 selectable。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) set_selectable

XuAPI
pub fn (bg $&Badge) set_selectable(selectable bool)

用途

$&Badge 上的操作:设置 selectable。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Badge) bounds

XuAPI
pub fn (bg &Badge) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Badge) set_bounds

XuAPI
pub fn (bg $&Badge) set_bounds(bounds &layout.Rect) int

用途

$&Badge 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Badge) needs_paint

XuAPI
pub fn (bg &Badge) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) painted

XuAPI
pub fn (bg $&Badge) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Badge) invalidate

XuAPI
pub fn (bg $&Badge) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Badge) is_enabled

XuAPI
pub fn (bg &Badge) is_enabled() bool

用途

返回控件当前是否可用。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) set_enabled

XuAPI
pub fn (bg $&Badge) set_enabled(enabled bool)

用途

$&Badge 上的操作:设置 enabled。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Badge) is_selected

XuAPI
pub fn (bg &Badge) is_selected() bool

用途

&Badge 上的操作:判断是否 selected。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) set_selected

XuAPI
pub fn (bg $&Badge) set_selected(selected bool)

用途

$&Badge 上的操作:设置 selected。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
selected(bool)

返回值

不返回值。

(&Badge) is_invalid

XuAPI
pub fn (bg &Badge) is_invalid() bool

用途

&Badge 上的操作:判断是否 invalid。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) set_invalid

XuAPI
pub fn (bg $&Badge) set_invalid(invalid bool)

用途

$&Badge 上的操作:设置 invalid。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Badge) is_focused

XuAPI
pub fn (bg &Badge) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) set_focus

XuAPI
pub fn (bg $&Badge) set_focus(focused bool)

用途

$&Badge 上的操作:设置 focus。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Badge) is_hovered

XuAPI
pub fn (bg &Badge) is_hovered() bool

用途

&Badge 上的操作:判断是否 hovered。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Badge) set_hovered

XuAPI
pub fn (bg $&Badge) set_hovered(hovered bool)

用途

$&Badge 上的操作:设置 hovered。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
hovered bool
hovered(bool)

返回值

不返回值。

(&Badge) visual_state

XuAPI
pub fn (bg &Badge) visual_state() int

用途

&Badge 上的操作:执行 visual state 操作。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Badge) has_style

XuAPI
pub fn (bg &Badge) has_style() bool

用途

&Badge 上的操作:判断是否具有 style。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Badge) style_or

XuAPI
pub fn (bg &Badge) style_or(styles &Styles) ControlStyle

用途

&Badge 上的操作:执行 style or 操作。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Badge) set_style

XuAPI
pub fn (bg $&Badge) set_style(style &ControlStyle) int

用途

$&Badge 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Badge) clear_style

XuAPI
pub fn (bg $&Badge) clear_style()

用途

$&Badge 上的操作:执行 clear style 操作。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Badge) paint

XuAPI
pub fn (bg &Badge) paint(frame $&draw.Frame,label &draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label &draw.TextLayout
label(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Badge) measure_styled

XuAPI
pub fn (bg &Badge) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Badge 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Badge) paint_styled

XuAPI
pub fn (bg &Badge) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Badge 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

bg &Badge
本次调用使用的 Badge 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Card

XuAPI
pub struct Card {

}

用途

Card 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

card

XuAPI
pub fn card(bounds &layout.Rect) Card

用途

执行 card 处理。失败时抛出错误,调用方需处理或继续传播。

参数

bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Card — 该类型的值

查看用法示例

(&Card) is_selectable

XuAPI
pub fn (cd &Card) is_selectable() bool

用途

&Card 上的操作:判断是否 selectable。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) set_selectable

XuAPI
pub fn (cd $&Card) set_selectable(selectable bool)

用途

$&Card 上的操作:设置 selectable。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Card) bounds

XuAPI
pub fn (cd &Card) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Card) set_bounds

XuAPI
pub fn (cd $&Card) set_bounds(bounds &layout.Rect) int

用途

$&Card 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Card) content_bounds

XuAPI
pub fn (cd &Card) content_bounds(styles &Styles) layout.Rect

用途

&Card 上的操作:执行 content bounds 操作。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Rect — 该类型的值

(&Card) needs_paint

XuAPI
pub fn (cd &Card) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) painted

XuAPI
pub fn (cd $&Card) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Card) invalidate

XuAPI
pub fn (cd $&Card) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Card) is_enabled

XuAPI
pub fn (cd &Card) is_enabled() bool

用途

返回控件当前是否可用。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) set_enabled

XuAPI
pub fn (cd $&Card) set_enabled(enabled bool)

用途

$&Card 上的操作:设置 enabled。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Card) is_selected

XuAPI
pub fn (cd &Card) is_selected() bool

用途

&Card 上的操作:判断是否 selected。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) set_selected

XuAPI
pub fn (cd $&Card) set_selected(selected bool)

用途

$&Card 上的操作:设置 selected。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
selected(bool)

返回值

不返回值。

(&Card) is_invalid

XuAPI
pub fn (cd &Card) is_invalid() bool

用途

&Card 上的操作:判断是否 invalid。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) set_invalid

XuAPI
pub fn (cd $&Card) set_invalid(invalid bool)

用途

$&Card 上的操作:设置 invalid。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Card) is_focused

XuAPI
pub fn (cd &Card) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) set_focus

XuAPI
pub fn (cd $&Card) set_focus(focused bool)

用途

$&Card 上的操作:设置 focus。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Card) is_hovered

XuAPI
pub fn (cd &Card) is_hovered() bool

用途

&Card 上的操作:判断是否 hovered。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Card) set_hovered

XuAPI
pub fn (cd $&Card) set_hovered(hovered bool)

用途

$&Card 上的操作:设置 hovered。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
hovered bool
hovered(bool)

返回值

不返回值。

(&Card) visual_state

XuAPI
pub fn (cd &Card) visual_state() int

用途

&Card 上的操作:执行 visual state 操作。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Card) has_style

XuAPI
pub fn (cd &Card) has_style() bool

用途

&Card 上的操作:判断是否具有 style。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Card) style_or

XuAPI
pub fn (cd &Card) style_or(styles &Styles) ControlStyle

用途

&Card 上的操作:执行 style or 操作。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Card) set_style

XuAPI
pub fn (cd $&Card) set_style(style &ControlStyle) int

用途

$&Card 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Card) clear_style

XuAPI
pub fn (cd $&Card) clear_style()

用途

$&Card 上的操作:执行 clear style 操作。

参数

cd $&Card
本次调用使用的 Card 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Card) paint

XuAPI
pub fn (cd &Card) paint(frame $&draw.Frame,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Card) measure_styled

XuAPI
pub fn (cd &Card) measure_styled(styles &Styles) layout.Size

用途

&Card 上的操作:执行 measure styled 操作。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Card) measure_header_styled

XuAPI
pub fn (cd &Card) measure_header_styled(title $&StyledLabel,styles &Styles) layout.Size

用途

&Card 上的操作:执行 measure header styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
title $&StyledLabel
title(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Card) paint_styled

XuAPI
pub fn (cd &Card) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

&Card 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Card) paint_header_styled

XuAPI
pub fn (cd &Card) paint_header_styled(frame $&draw.Frame,title $&StyledLabel,styles &Styles) int

用途

&Card 上的操作:执行 paint header styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cd &Card
本次调用使用的 Card 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
title $&StyledLabel
title(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Badge) set_tone

XuAPI
pub fn (bg $&Badge) set_tone(tone int) int

用途

$&Badge 上的操作:设置 tone。失败时抛出错误,调用方需处理或继续传播。

参数

bg $&Badge
本次调用使用的 Badge 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
tone int
tone(int)

返回值

int — 该类型的值

struct Tabs

XuAPI
pub struct Tabs {

}

用途

Tabs 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

tabs

XuAPI
pub fn tabs(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) Tabs

用途

执行 tabs 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
count int
count(int)
selected int
selected(int)

返回值

Tabs — 该类型的值

查看用法示例

(&Tabs) is_selectable

XuAPI
pub fn (t &Tabs) is_selectable() bool

用途

&Tabs 上的操作:判断是否 selectable。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tabs) set_selectable

XuAPI
pub fn (t $&Tabs) set_selectable(selectable bool)

用途

$&Tabs 上的操作:设置 selectable。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

segmented

XuAPI
pub fn segmented(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) Tabs

用途

执行 segmented 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
count int
count(int)
selected int
selected(int)

返回值

Tabs — 该类型的值

(&Tabs) id

XuAPI
pub fn (t &Tabs) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tabs) bounds

XuAPI
pub fn (t &Tabs) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Tabs) count

XuAPI
pub fn (t &Tabs) count() int

用途

返回该控件当前包含的项目数量。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tabs) selected

XuAPI
pub fn (t &Tabs) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tabs) hovered_item

XuAPI
pub fn (t &Tabs) hovered_item() int

用途

&Tabs 上的操作:执行 hovered item 操作。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tabs) needs_paint

XuAPI
pub fn (t &Tabs) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tabs) painted

XuAPI
pub fn (t $&Tabs) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Tabs) invalidate

XuAPI
pub fn (t $&Tabs) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Tabs) cancel

XuAPI
pub fn (t $&Tabs) cancel()

用途

$&Tabs 上的操作:取消。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Tabs) is_enabled

XuAPI
pub fn (t &Tabs) is_enabled() bool

用途

返回控件当前是否可用。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tabs) set_enabled

XuAPI
pub fn (t $&Tabs) set_enabled(enabled bool)

用途

$&Tabs 上的操作:设置 enabled。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Tabs) is_focused

XuAPI
pub fn (t &Tabs) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tabs) set_focus

XuAPI
pub fn (t $&Tabs) set_focus(focused bool)

用途

$&Tabs 上的操作:设置 focus。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Tabs) is_hovered

XuAPI
pub fn (t &Tabs) is_hovered() bool

用途

&Tabs 上的操作:判断是否 hovered。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Tabs) is_invalid

XuAPI
pub fn (t &Tabs) is_invalid() bool

用途

&Tabs 上的操作:判断是否 invalid。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tabs) set_invalid

XuAPI
pub fn (t $&Tabs) set_invalid(invalid bool)

用途

$&Tabs 上的操作:设置 invalid。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Tabs) is_read_only

XuAPI
pub fn (t &Tabs) is_read_only() bool

用途

&Tabs 上的操作:判断是否 read only。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tabs) set_read_only

XuAPI
pub fn (t $&Tabs) set_read_only(read_only bool)

用途

$&Tabs 上的操作:设置 read only。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&Tabs) set_count

XuAPI
pub fn (t $&Tabs) set_count(count int) int

用途

$&Tabs 上的操作:设置 count。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
count int
count(int)

返回值

int — 该类型的值

($&Tabs) set_selected

XuAPI
pub fn (t $&Tabs) set_selected(index int) int

用途

$&Tabs 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&Tabs) set_bounds

XuAPI
pub fn (t $&Tabs) set_bounds(bounds &layout.Rect) int

用途

$&Tabs 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Tabs) visual_state

XuAPI
pub fn (t &Tabs) visual_state() int

用途

&Tabs 上的操作:执行 visual state 操作。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tabs) item_visual_state

XuAPI
pub fn (t &Tabs) item_visual_state(index int) int

用途

&Tabs 上的操作:执行 item visual state 操作。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

(&Tabs) has_style

XuAPI
pub fn (t &Tabs) has_style() bool

用途

&Tabs 上的操作:判断是否具有 style。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Tabs) style_or

XuAPI
pub fn (t &Tabs) style_or(styles &Styles) ControlStyle

用途

&Tabs 上的操作:执行 style or 操作。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Tabs) set_style

XuAPI
pub fn (t $&Tabs) set_style(style &ControlStyle) int

用途

$&Tabs 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Tabs) clear_style

XuAPI
pub fn (t $&Tabs) clear_style()

用途

$&Tabs 上的操作:执行 clear style 操作。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Tabs) item_bounds

XuAPI
pub fn (t &Tabs) item_bounds(index int,styles &Styles) layout.Rect

用途

&Tabs 上的操作:执行 item bounds 操作。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Rect — 该类型的值

($&Tabs) apply_styles

XuAPI
pub fn (t $&Tabs) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Tabs) set_item_widths

XuAPI
pub fn (t $&Tabs) set_item_widths(widths &[]f64) int

用途

$&Tabs 上的操作:设置 item widths。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
widths &[]f64
widths(只读借用,调用方仍持有原值;类型 &[]f64)

返回值

int — 该类型的值

($&Tabs) set_automatic_activation

XuAPI
pub fn (t $&Tabs) set_automatic_activation(automatic bool)

用途

$&Tabs 上的操作:设置 automatic activation。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
automatic bool
automatic(bool)

返回值

不返回值。

($&Tabs) input

XuAPI
pub fn (t $&Tabs) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Tabs) event

XuAPI
pub fn (t $&Tabs) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Tabs) paint

XuAPI
pub fn (t &Tabs) paint(frame $&draw.Frame,labels &[]draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
labels &[]draw.TextLayout
labels(只读借用,调用方仍持有原值;类型 &[]draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Tabs) measure_styled

XuAPI
pub fn (t &Tabs) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Tabs 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Tabs) paint_box_styled

XuAPI
pub fn (t &Tabs) paint_box_styled(frame $&draw.Frame,styles &Styles) int

用途

&Tabs 上的操作:执行 paint box styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Tabs) paint_tab_styled

XuAPI
pub fn (t &Tabs) paint_tab_styled(frame $&draw.Frame,index int,label $&StyledLabel,styles &Styles) int

用途

&Tabs 上的操作:执行 paint tab styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
index int
index(int)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Tabs) paint_styled

XuAPI
pub fn (t &Tabs) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Tabs 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Select

XuAPI
pub struct Select {

}

用途

Select 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

select_box

XuAPI
pub fn select_box(identity &ui.CanvasEvent,id int,bounds &layout.Rect,count int,selected int) Select

用途

执行 select box 操作。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
count int
count(int)
selected int
selected(int)

返回值

Select — 该类型的值

查看用法示例

(&Select) is_selectable

XuAPI
pub fn (sel &Select) is_selectable() bool

用途

&Select 上的操作:判断是否 selectable。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Select) set_selectable

XuAPI
pub fn (sel $&Select) set_selectable(selectable bool)

用途

$&Select 上的操作:设置 selectable。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Select) id

XuAPI
pub fn (sel &Select) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Select) bounds

XuAPI
pub fn (sel &Select) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Select) count

XuAPI
pub fn (sel &Select) count() int

用途

返回该控件当前包含的项目数量。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Select) selected

XuAPI
pub fn (sel &Select) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Select) is_open

XuAPI
pub fn (sel &Select) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Select) hovered_option

XuAPI
pub fn (sel &Select) hovered_option() int

用途

返回指针悬停的选项索引;无悬停项时返回 -1。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Select) needs_paint

XuAPI
pub fn (sel &Select) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Select) painted

XuAPI
pub fn (sel $&Select) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Select) invalidate

XuAPI
pub fn (sel $&Select) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Select) cancel

XuAPI
pub fn (sel $&Select) cancel()

用途

$&Select 上的操作:取消。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Select) is_enabled

XuAPI
pub fn (sel &Select) is_enabled() bool

用途

返回控件当前是否可用。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Select) set_enabled

XuAPI
pub fn (sel $&Select) set_enabled(enabled bool)

用途

$&Select 上的操作:设置 enabled。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Select) is_focused

XuAPI
pub fn (sel &Select) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Select) set_focus

XuAPI
pub fn (sel $&Select) set_focus(focused bool)

用途

$&Select 上的操作:设置 focus。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

(&Select) is_hovered

XuAPI
pub fn (sel &Select) is_hovered() bool

用途

&Select 上的操作:判断是否 hovered。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Select) is_invalid

XuAPI
pub fn (sel &Select) is_invalid() bool

用途

&Select 上的操作:判断是否 invalid。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Select) set_invalid

XuAPI
pub fn (sel $&Select) set_invalid(invalid bool)

用途

$&Select 上的操作:设置 invalid。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Select) is_read_only

XuAPI
pub fn (sel &Select) is_read_only() bool

用途

&Select 上的操作:判断是否 read only。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Select) set_read_only

XuAPI
pub fn (sel $&Select) set_read_only(read_only bool)

用途

$&Select 上的操作:设置 read only。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

($&Select) set_open

XuAPI
pub fn (sel $&Select) set_open(open bool)

用途

$&Select 上的操作:设置 open。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
open bool
open(bool)

返回值

不返回值。

($&Select) set_count

XuAPI
pub fn (sel $&Select) set_count(count int) int

用途

$&Select 上的操作:设置 count。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
count int
count(int)

返回值

int — 该类型的值

($&Select) set_selected

XuAPI
pub fn (sel $&Select) set_selected(index int) int

用途

$&Select 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&Select) set_bounds

XuAPI
pub fn (sel $&Select) set_bounds(bounds &layout.Rect) int

用途

$&Select 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Select) visual_state

XuAPI
pub fn (sel &Select) visual_state() int

用途

&Select 上的操作:执行 visual state 操作。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Select) has_style

XuAPI
pub fn (sel &Select) has_style() bool

用途

&Select 上的操作:判断是否具有 style。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Select) style_or

XuAPI
pub fn (sel &Select) style_or(styles &Styles) ControlStyle

用途

&Select 上的操作:执行 style or 操作。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Select) set_style

XuAPI
pub fn (sel $&Select) set_style(style &ControlStyle) int

用途

$&Select 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Select) clear_style

XuAPI
pub fn (sel $&Select) clear_style()

用途

$&Select 上的操作:执行 clear style 操作。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Select) popup_bounds

XuAPI
pub fn (sel &Select) popup_bounds(styles &Styles) layout.Rect

用途

&Select 上的操作:执行 popup bounds 操作。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Rect — 该类型的值

($&Select) set_popup_above

XuAPI
pub fn (sel $&Select) set_popup_above(above bool)

用途

$&Select 上的操作:设置 popup above。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
above bool
above(bool)

返回值

不返回值。

($&Select) apply_styles

XuAPI
pub fn (sel $&Select) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Select) option_bounds

XuAPI
pub fn (sel &Select) option_bounds(index int,styles &Styles) layout.Rect

用途

&Select 上的操作:执行 option bounds 操作。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Rect — 该类型的值

($&Select) input

XuAPI
pub fn (sel $&Select) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Select) event

XuAPI
pub fn (sel $&Select) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Select) paint

XuAPI
pub fn (sel &Select) paint(frame $&draw.Frame,labels &[]draw.TextLayout,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
labels &[]draw.TextLayout
labels(只读借用,调用方仍持有原值;类型 &[]draw.TextLayout)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

(&Select) measure_styled

XuAPI
pub fn (sel &Select) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

&Select 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Select) paint_styled

XuAPI
pub fn (sel &Select) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Select 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Select) paint_popup_box_styled

XuAPI
pub fn (sel &Select) paint_popup_box_styled(frame $&draw.Frame,styles &Styles) int

用途

&Select 上的操作:执行 paint popup box styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Select) paint_option_styled

XuAPI
pub fn (sel &Select) paint_option_styled(frame $&draw.Frame,index int,label $&StyledLabel,styles &Styles) int

用途

&Select 上的操作:执行 paint option styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
index int
index(int)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Select) paint_popup_styled

XuAPI
pub fn (sel &Select) paint_popup_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Select 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Select) set_option_enabled

XuAPI
pub fn (sel $&Select) set_option_enabled(index int,enabled bool) int

用途

$&Select 上的操作:设置 option enabled。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Select) set_popup_rows

XuAPI
pub fn (sel $&Select) set_popup_rows(rows int) int

用途

$&Select 上的操作:设置 popup rows。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
rows int
rows(int)

返回值

int — 该类型的值

(&Tabs) is_automatic

XuAPI
pub fn (t &Tabs) is_automatic() bool

用途

&Tabs 上的操作:判断是否 automatic。

参数

t &Tabs
本次调用使用的 Tabs 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

struct DatePicker

XuAPI
pub struct DatePicker {

}

用途

日期选择器控件,支持日历弹层面板与年月日切换。

公开字段

此类型没有公开字段。

date_picker

XuAPI
pub fn date_picker(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value time.Time) DatePicker

用途

执行 date picker 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value time.Time
value(time.Time)

返回值

DatePicker — 该类型的值

(&DatePicker) id

XuAPI
pub fn (picker &DatePicker) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&DatePicker) bounds

XuAPI
pub fn (picker &DatePicker) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&DatePicker) value

XuAPI
pub fn (picker &DatePicker) value() time.Time

用途

&DatePicker 上的操作:值。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

time.Time — 该类型的值

(&DatePicker) is_open

XuAPI
pub fn (picker &DatePicker) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&DatePicker) is_selectable

XuAPI
pub fn (picker &DatePicker) is_selectable() bool

用途

&DatePicker 上的操作:判断是否 selectable。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&DatePicker) set_selectable

XuAPI
pub fn (picker $&DatePicker) set_selectable(selectable bool)

用途

$&DatePicker 上的操作:设置 selectable。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&DatePicker) needs_paint

XuAPI
pub fn (picker &DatePicker) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&DatePicker) visual_state

XuAPI
pub fn (picker &DatePicker) visual_state() int

用途

&DatePicker 上的操作:执行 visual state 操作。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&DatePicker) style_or

XuAPI
pub fn (picker &DatePicker) style_or(styles &Styles) ControlStyle

用途

&DatePicker 上的操作:执行 style or 操作。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&DatePicker) set_style

XuAPI
pub fn (picker $&DatePicker) set_style(style &ControlStyle) int

用途

$&DatePicker 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&DatePicker) set_enabled

XuAPI
pub fn (picker $&DatePicker) set_enabled(enabled bool)

用途

$&DatePicker 上的操作:设置 enabled。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&DatePicker) set_read_only

XuAPI
pub fn (picker $&DatePicker) set_read_only(read_only bool) int

用途

$&DatePicker 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&DatePicker) set_invalid

XuAPI
pub fn (picker $&DatePicker) set_invalid(invalid bool)

用途

$&DatePicker 上的操作:设置 invalid。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&DatePicker) set_focus

XuAPI
pub fn (picker $&DatePicker) set_focus(focused bool)

用途

$&DatePicker 上的操作:设置 focus。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&DatePicker) set_bounds

XuAPI
pub fn (picker $&DatePicker) set_bounds(bounds &layout.Rect) int

用途

$&DatePicker 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&DatePicker) set_value

XuAPI
pub fn (picker $&DatePicker) set_value(value time.Time) int

用途

$&DatePicker 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value time.Time
value(time.Time)

返回值

int — 该类型的值

($&DatePicker) set_range

XuAPI
pub fn (picker $&DatePicker) set_range(minimum time.Time,maximum time.Time) int

用途

$&DatePicker 上的操作:设置 range。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
minimum time.Time
minimum(time.Time)
maximum time.Time
maximum(time.Time)

返回值

int — 该类型的值

($&DatePicker) set_open

XuAPI
pub fn (picker $&DatePicker) set_open(open bool)

用途

$&DatePicker 上的操作:设置 open。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
open bool
open(bool)

返回值

不返回值。

($&DatePicker) set_popup_above

XuAPI
pub fn (picker $&DatePicker) set_popup_above(above bool)

用途

$&DatePicker 上的操作:设置 popup above。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
above bool
above(bool)

返回值

不返回值。

($&DatePicker) apply_styles

XuAPI
pub fn (picker $&DatePicker) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&DatePicker) popup_bounds

XuAPI
pub fn (picker &DatePicker) popup_bounds() layout.Rect

用途

&DatePicker 上的操作:执行 popup bounds 操作。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&DatePicker) calendar_cell

XuAPI
pub fn (picker &DatePicker) calendar_cell(index int) layout.Rect

用途

&DatePicker 上的操作:执行 calendar cell 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

(&DatePicker) calendar_date

XuAPI
pub fn (picker &DatePicker) calendar_date(index int) time.Time

用途

&DatePicker 上的操作:执行 calendar date 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

time.Time — 该类型的值

($&DatePicker) input

XuAPI
pub fn (picker $&DatePicker) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&DatePicker) route

XuAPI
pub fn (picker $&DatePicker) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&DatePicker) measure_styled

XuAPI
pub fn (picker $&DatePicker) measure_styled(styles &Styles) layout.Size

用途

$&DatePicker 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&DatePicker) paint_styled

XuAPI
pub fn (picker $&DatePicker) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&DatePicker 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&DatePicker) paint_popup_styled

XuAPI
pub fn (picker $&DatePicker) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&DatePicker 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&DatePicker) dispose

XuAPI
pub fn (picker $&DatePicker) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&DatePicker) has_value

XuAPI
pub fn (picker &DatePicker) has_value() bool

用途

&DatePicker 上的操作:判断是否具有 value。

参数

picker &DatePicker
本次调用使用的 DatePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&DatePicker) set_clearable

XuAPI
pub fn (picker $&DatePicker) set_clearable(enabled bool)

用途

$&DatePicker 上的操作:设置 clearable。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&DatePicker) clear

XuAPI
pub fn (picker $&DatePicker) clear() int

用途

清空所有已缓冲或存储的数据项与内部状态。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&DatePicker) set_today

XuAPI
pub fn (picker $&DatePicker) set_today(today time.Time) int

用途

$&DatePicker 上的操作:设置 today。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&DatePicker
本次调用使用的 DatePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
today time.Time
today(time.Time)

返回值

int — 该类型的值

const ACTION_SUBMIT

XuAPI
pub const ACTION_SUBMIT = 4

用途

常量 ACTION_SUBMIT,定义了相关的协议或算法配置参数。

查看用法示例

struct Editor

XuAPI
pub struct Editor {

}

用途

文本编辑核心控制器,提供光标移动、选区、撤销重做与排版。

公开字段

此类型没有公开字段。

查看用法示例

input

XuAPI
pub fn input(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string) Editor

用途

创建持久单行 Editor;文本最多 16384 个 UTF-8 字节且不含 NUL,Context 必须匹配窗口身份。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

拥有的 Editor;关闭时 dispose

查看用法示例

text_area

XuAPI
pub fn text_area(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string) Editor

用途

创建持久多行 Editor;文本最多 16384 个 UTF-8 字节且不含 NUL,Context 必须匹配窗口身份。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

拥有的 Editor;关闭时 dispose

查看用法示例

(&Editor) id

XuAPI
pub fn (editor &Editor) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Editor) value

XuAPI
pub fn (editor &Editor) value() string

用途

&Editor 上的操作:值。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Editor) has_selection

XuAPI
pub fn (editor &Editor) has_selection() bool

用途

&Editor 上的操作:判断是否具有 selection。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) selection_range

XuAPI
pub fn (editor &Editor) selection_range() TextRange

用途

&Editor 上的操作:执行 selection range 操作。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

TextRange — 该类型的值

(&Editor) selected_text

XuAPI
pub fn (editor &Editor) selected_text() string

用途

&Editor 上的操作:执行 selected text 操作。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Editor) is_password

XuAPI
pub fn (editor &Editor) is_password() bool

用途

&Editor 上的操作:判断是否 password。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) is_password_visible

XuAPI
pub fn (editor &Editor) is_password_visible() bool

用途

&Editor 上的操作:判断是否 password visible。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Editor) set_password

XuAPI
pub fn (editor $&Editor) set_password(on bool) int

用途

$&Editor 上的操作:设置 password。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

int — 该类型的值

($&Editor) set_password_visible

XuAPI
pub fn (editor $&Editor) set_password_visible(visible bool) int

用途

$&Editor 上的操作:设置 password visible。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
visible bool
visible(bool)

返回值

int — 该类型的值

(&Editor) is_focused

XuAPI
pub fn (editor &Editor) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) is_enabled

XuAPI
pub fn (editor &Editor) is_enabled() bool

用途

返回控件当前是否可用。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) is_selectable

XuAPI
pub fn (editor &Editor) is_selectable() bool

用途

&Editor 上的操作:判断是否 selectable。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) has_popup_open

XuAPI
pub fn (editor &Editor) has_popup_open() bool

用途

&Editor 上的操作:判断是否具有 popup open。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) popup_bounds

XuAPI
pub fn (editor &Editor) popup_bounds() layout.Rect

用途

&Editor 上的操作:执行 popup bounds 操作。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Editor) cursor

XuAPI
pub fn (editor &Editor) cursor() int

用途

&Editor 上的操作:游标。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Editor) needs_paint

XuAPI
pub fn (editor &Editor) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Editor) painted

XuAPI
pub fn (editor $&Editor) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Editor) set_locale

XuAPI
pub fn (editor $&Editor) set_locale(locale &Locale) int

用途

$&Editor 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Editor) set_viewport

XuAPI
pub fn (editor $&Editor) set_viewport(viewport &layout.Rect)

用途

$&Editor 上的操作:设置 viewport。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&Editor) set_selectable

XuAPI
pub fn (editor $&Editor) set_selectable(selectable bool) int

用途

$&Editor 上的操作:设置 selectable。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

int — 该类型的值

($&Editor) paint_popup_styled

XuAPI
pub fn (editor $&Editor) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Editor 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Editor) set_placeholder

XuAPI
pub fn (editor $&Editor) set_placeholder(value &string) int

用途

$&Editor 上的操作:设置 placeholder。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&Editor) focus_session

XuAPI
pub fn (editor $&Editor) focus_session(on bool) int

用途

切换编辑焦点并管理原生输入会话;失焦保留提交值。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

成功为 0;失败抛出错误

($&Editor) enable

XuAPI
pub fn (editor $&Editor) enable(on bool) int

用途

在 $&Editor 上执行 enable 操作。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

int — 该类型的值

($&Editor) place

XuAPI
pub fn (editor $&Editor) place(bounds &layout.Rect) int

用途

设置画布全局矩形;布局或祖先滚动后更新,以同步原生 IME 几何。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

成功为 0;失败抛出错误

place_editor

XuAPI
pub fn place_editor(view $&View,editor $&Editor) int

用途

从 View 获取编辑器的画布位置、同步 IME、允许视口外捕获,并传播重绘标记。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
editor $&Editor
editor(独占借用,可修改原值;类型 $&Editor)

返回值

成功为 0;失败抛出错误

查看用法示例

($&Editor) set_value

XuAPI
pub fn (editor $&Editor) set_value(value &string) int

用途

$&Editor 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&Editor) route

XuAPI
pub fn (editor $&Editor) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Editor) event

XuAPI
pub fn (editor $&Editor) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Editor) paint

XuAPI
pub fn (editor $&Editor) paint(frame $&draw.Frame,theme &Theme) int

用途

在目标画布或渲染目标上执行控件的视觉绘制。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
theme &Theme
theme(只读借用,调用方仍持有原值;类型 &Theme)

返回值

int — 该类型的值

($&Editor) dispose

XuAPI
pub fn (editor $&Editor) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Editor) caret_opacity

XuAPI
pub fn (editor &Editor) caret_opacity() f64

用途

&Editor 上的操作:执行 caret opacity 操作。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Editor) has_caret_animation

XuAPI
pub fn (editor &Editor) has_caret_animation() bool

用途

&Editor 上的操作:判断是否具有 caret animation。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) next_caret_tick

XuAPI
pub fn (editor &Editor) next_caret_tick(now time.Instant,reduced_motion bool) time.Instant

用途

&Editor 上的操作:执行 next caret tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

time.Instant — 该类型的值

($&Editor) tick

XuAPI
pub fn (editor $&Editor) tick(now time.Instant,reduced_motion bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

(&Editor) bounds

XuAPI
pub fn (editor &Editor) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Editor) is_invalid

XuAPI
pub fn (editor &Editor) is_invalid() bool

用途

&Editor 上的操作:判断是否 invalid。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) is_hovered

XuAPI
pub fn (editor &Editor) is_hovered() bool

用途

&Editor 上的操作:判断是否 hovered。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) visual_state

XuAPI
pub fn (editor &Editor) visual_state() int

用途

&Editor 上的操作:执行 visual state 操作。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Editor) has_style

XuAPI
pub fn (editor &Editor) has_style() bool

用途

&Editor 上的操作:判断是否具有 style。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Editor) style_or

XuAPI
pub fn (editor &Editor) style_or(styles &Styles) ControlStyle

用途

&Editor 上的操作:执行 style or 操作。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Editor) set_style

XuAPI
pub fn (editor $&Editor) set_style(style &ControlStyle) int

用途

$&Editor 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Editor) clear_style

XuAPI
pub fn (editor $&Editor) clear_style()

用途

$&Editor 上的操作:执行 clear style 操作。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Editor) apply_styles

XuAPI
pub fn (editor $&Editor) apply_styles(styles &Styles) int

用途

应用并验证主题;指标变化时更新布局 / 几何并标记重绘。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

($&Editor) paint_motion_styled

XuAPI
pub fn (editor $&Editor) paint_motion_styled(frame $&draw.Frame,styles &Styles,motion $&PaintTransition,now time.Instant,reduced_motion bool) int

用途

$&Editor 上的操作:执行 paint motion styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
motion $&PaintTransition
motion(独占借用,可修改原值;类型 $&PaintTransition)
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

int — 该类型的值

($&Editor) set_invalid

XuAPI
pub fn (editor $&Editor) set_invalid(invalid bool)

用途

$&Editor 上的操作:设置 invalid。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Editor) is_read_only

XuAPI
pub fn (editor &Editor) is_read_only() bool

用途

&Editor 上的操作:判断是否 read only。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Editor) set_read_only

XuAPI
pub fn (editor $&Editor) set_read_only(on bool) int

用途

切换只读并释放或重启原生输入会话;保留选择、导航、复制,拒绝只读期间的写入与迟到 IME 提交。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

成功为 0;失败抛出错误

(&Editor) is_copy_enabled

XuAPI
pub fn (editor &Editor) is_copy_enabled() bool

用途

&Editor 上的操作:判断是否 copy enabled。

参数

editor &Editor
本次调用使用的 Editor 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Editor) set_copy_enabled

XuAPI
pub fn (editor $&Editor) set_copy_enabled(on bool)

用途

$&Editor 上的操作:设置 copy enabled。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

不返回值。

($&Editor) measure_styled

XuAPI
pub fn (editor $&Editor) measure_styled(styles &Styles) layout.Size

用途

按有效字体、密度、内容和最小尺寸测量Editor。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

固有逻辑尺寸;原生排版失败时抛出错误

($&Editor) paint_styled

XuAPI
pub fn (editor $&Editor) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

使用当前完整主题绘制Editor;控件边界与 Frame 使用相同的局部坐标。

参数

editor $&Editor
本次调用使用的 Editor 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

const FIELD_OUTLINED

XuAPI
pub const FIELD_OUTLINED = 0

用途

常量 FIELD_OUTLINED,定义了相关的协议或算法配置参数。

const FIELD_FILLED

XuAPI
pub const FIELD_FILLED = 1

用途

常量 FIELD_FILLED,定义了相关的协议或算法配置参数。

const FIELD_UNDERLINED

XuAPI
pub const FIELD_UNDERLINED = 2

用途

常量 FIELD_UNDERLINED,定义了相关的协议或算法配置参数。

const LABEL_AUTO

XuAPI
pub const LABEL_AUTO = 0

用途

常量 LABEL_AUTO,定义了相关的协议或算法配置参数。

const LABEL_ALWAYS

XuAPI
pub const LABEL_ALWAYS = 1

用途

常量 LABEL_ALWAYS,定义了相关的协议或算法配置参数。

查看用法示例

const LABEL_NEVER

XuAPI
pub const LABEL_NEVER = 2

用途

常量 LABEL_NEVER,定义了相关的协议或算法配置参数。

const LABEL_STATIC

XuAPI
pub const LABEL_STATIC = 3

用途

常量 LABEL_STATIC,定义了相关的协议或算法配置参数。

struct FieldDecoration

XuAPI
pub struct FieldDecoration {
    pub label string
    pub helper string
    pub error string
    pub prefix string
    pub suffix string
    pub variant int
    pub floating int
    pub clearable bool
    pub reserve_helper bool
}

用途

承载 label、helper、error、prefix、suffix 等属性的结构体。

公开字段

label string
字段(string)
helper string
字段(string)
error string
字段(string)
prefix string
前缀
suffix string
后缀
variant int
字段(int)
floating int
字段(int)
clearable bool
字段(bool)
reserve_helper bool
字段(bool)

field_decoration

XuAPI
pub fn field_decoration(label &string) FieldDecoration

用途

执行 field decoration 操作。

参数

label &string
label(只读借用,调用方仍持有原值;类型 &string)

返回值

FieldDecoration — 该类型的值

查看用法示例

(&FieldDecoration) validate

XuAPI
pub fn (d &FieldDecoration) validate() int

用途

在 &FieldDecoration 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

d &FieldDecoration
本次调用使用的 FieldDecoration 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

struct Field

XuAPI
pub struct Field {

}

用途

Field 上下文或状态结构体。

公开字段

此类型没有公开字段。

field

XuAPI
pub fn field(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string,decoration &FieldDecoration) Field

用途

执行 field 处理。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
decoration &FieldDecoration
decoration(只读借用,调用方仍持有原值;类型 &FieldDecoration)

返回值

Field — 该类型的值

text_field_area

XuAPI
pub fn text_field_area(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value &string,decoration &FieldDecoration) Field

用途

执行 text field area 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
decoration &FieldDecoration
decoration(只读借用,调用方仍持有原值;类型 &FieldDecoration)

返回值

Field — 该类型的值

(&Field) id

XuAPI
pub fn (f &Field) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Field) bounds

XuAPI
pub fn (f &Field) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Field) value

XuAPI
pub fn (f &Field) value() string

用途

&Field 上的操作:值。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Field) has_selection

XuAPI
pub fn (f &Field) has_selection() bool

用途

&Field 上的操作:判断是否具有 selection。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) is_copy_enabled

XuAPI
pub fn (f &Field) is_copy_enabled() bool

用途

&Field 上的操作:判断是否 copy enabled。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) selected_text

XuAPI
pub fn (f &Field) selected_text() string

用途

&Field 上的操作:执行 selected text 操作。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Field) is_enabled

XuAPI
pub fn (f &Field) is_enabled() bool

用途

返回控件当前是否可用。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) is_focused

XuAPI
pub fn (f &Field) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) is_read_only

XuAPI
pub fn (f &Field) is_read_only() bool

用途

&Field 上的操作:判断是否 read only。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) is_invalid

XuAPI
pub fn (f &Field) is_invalid() bool

用途

&Field 上的操作:判断是否 invalid。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) is_selectable

XuAPI
pub fn (f &Field) is_selectable() bool

用途

&Field 上的操作:判断是否 selectable。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) cursor

XuAPI
pub fn (f &Field) cursor() int

用途

&Field 上的操作:游标。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Field) has_popup_open

XuAPI
pub fn (f &Field) has_popup_open() bool

用途

&Field 上的操作:判断是否具有 popup open。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) popup_bounds

XuAPI
pub fn (f &Field) popup_bounds() layout.Rect

用途

&Field 上的操作:执行 popup bounds 操作。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Field) needs_paint

XuAPI
pub fn (f &Field) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Field) painted

XuAPI
pub fn (f $&Field) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Field) style_or

XuAPI
pub fn (f &Field) style_or(styles &Styles) ControlStyle

用途

&Field 上的操作:执行 style or 操作。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Field) set_style

XuAPI
pub fn (f $&Field) set_style(style &ControlStyle) int

用途

$&Field 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Field) set_decoration

XuAPI
pub fn (f $&Field) set_decoration(decoration &FieldDecoration) int

用途

$&Field 上的操作:设置 decoration。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
decoration &FieldDecoration
decoration(只读借用,调用方仍持有原值;类型 &FieldDecoration)

返回值

int — 该类型的值

($&Field) set_motion

XuAPI
pub fn (f $&Field) set_motion(spec &MotionSpec) int

用途

$&Field 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Field) set_invalid

XuAPI
pub fn (f $&Field) set_invalid(invalid bool)

用途

$&Field 上的操作:设置 invalid。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&Field) set_value

XuAPI
pub fn (f $&Field) set_value(value &string) int

用途

$&Field 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&Field) set_read_only

XuAPI
pub fn (f $&Field) set_read_only(read_only bool) int

用途

$&Field 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&Field) set_selectable

XuAPI
pub fn (f $&Field) set_selectable(selectable bool) int

用途

$&Field 上的操作:设置 selectable。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

int — 该类型的值

($&Field) set_copy_enabled

XuAPI
pub fn (f $&Field) set_copy_enabled(on bool)

用途

$&Field 上的操作:设置 copy enabled。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

不返回值。

($&Field) set_viewport

XuAPI
pub fn (f $&Field) set_viewport(viewport &layout.Rect)

用途

$&Field 上的操作:设置 viewport。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&Field) paint_popup_styled

XuAPI
pub fn (f $&Field) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Field 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Field) focus_session

XuAPI
pub fn (f $&Field) focus_session(focused bool) int

用途

$&Field 上的操作:执行 focus session 操作。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

int — 该类型的值

($&Field) enable

XuAPI
pub fn (f $&Field) enable(enabled bool) int

用途

在 $&Field 上执行 enable 操作。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Field) place

XuAPI
pub fn (f $&Field) place(bounds &layout.Rect) int

用途

在画布中计算并设置控件的局部几何布局坐标与尺寸。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Field) apply_styles

XuAPI
pub fn (f $&Field) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Field) input

XuAPI
pub fn (f $&Field) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Field) route

XuAPI
pub fn (f $&Field) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Field) event

XuAPI
pub fn (f $&Field) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Field) tick

XuAPI
pub fn (f $&Field) tick(now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&Field) next_caret_tick

XuAPI
pub fn (f &Field) next_caret_tick(now time.Instant,reduced bool) time.Instant

用途

&Field 上的操作:执行 next caret tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

time.Instant — 该类型的值

($&Field) measure_styled

XuAPI
pub fn (f $&Field) measure_styled(styles &Styles) layout.Size

用途

$&Field 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&Field) dispose

XuAPI
pub fn (f $&Field) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Field) paint_styled

XuAPI
pub fn (f $&Field) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Field 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct FieldTextOptions

XuAPI
pub struct FieldTextOptions {
    pub min_rows int
    pub max_rows int
    pub counter bool
    pub character_limit int
}

用途

Widgets 配置参数与选项集合。

公开字段

min_rows int
字段(int)
max_rows int
字段(int)
counter bool
字段(bool)
character_limit int
字段(int)

field_text_options

XuAPI
pub fn field_text_options() FieldTextOptions

用途

执行 field text options 操作。

参数

无需传入参数。

返回值

FieldTextOptions — 该类型的值

查看用法示例

(&FieldTextOptions) validate

XuAPI
pub fn (options &FieldTextOptions) validate() int

用途

在 &FieldTextOptions 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

options &FieldTextOptions
本次调用使用的 FieldTextOptions 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Field) set_text_options

XuAPI
pub fn (f $&Field) set_text_options(options &FieldTextOptions) int

用途

$&Field 上的操作:设置 text options。失败时抛出错误,调用方需处理或继续传播。

参数

f $&Field
本次调用使用的 Field 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &FieldTextOptions
options(只读借用,调用方仍持有原值;类型 &FieldTextOptions)

返回值

int — 该类型的值

(&Field) text_options

XuAPI
pub fn (f &Field) text_options() FieldTextOptions

用途

&Field 上的操作:执行 text options 操作。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

FieldTextOptions — 该类型的值

(&Field) character_count

XuAPI
pub fn (f &Field) character_count() int

用途

&Field 上的操作:执行 character count 操作。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Field) is_over_limit

XuAPI
pub fn (f &Field) is_over_limit() bool

用途

&Field 上的操作:判断是否 over limit。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Field) preferred_rows

XuAPI
pub fn (f &Field) preferred_rows() int

用途

&Field 上的操作:执行 preferred rows 操作。

参数

f &Field
本次调用使用的 Field 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&StyledLabel) paint_ellipsized_styled

XuAPI
pub fn (label $&StyledLabel) paint_ellipsized_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int) int

用途

$&StyledLabel 上的操作:执行 paint ellipsized styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)

返回值

int — 该类型的值

($&Screen) set_label_ellipsis

XuAPI
pub fn (s $&Screen) set_label_ellipsis(id int,enabled bool) int

用途

$&Screen 上的操作:设置 label ellipsis。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

struct ListAppearance

XuAPI
pub struct ListAppearance {
    pub row_height f64
    pub leading_size f64
    pub gap f64
    pub detail_width f64
    pub secondary bool
}

用途

承载 row_height、leading_size、gap、detail_width、secondary 等属性的结构体。

公开字段

row_height f64
字段(f64)
leading_size f64
字段(f64)
gap f64
字段(f64)
detail_width f64
字段(f64)
secondary bool
字段(bool)

list_appearance

XuAPI
pub fn list_appearance() ListAppearance

用途

执行 list appearance 操作。

参数

无需传入参数。

返回值

ListAppearance — 该类型的值

(&ListAppearance) validate

XuAPI
pub fn (appearance &ListAppearance) validate() int

用途

在 &ListAppearance 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

appearance &ListAppearance
本次调用使用的 ListAppearance 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&ListBox) set_appearance

XuAPI
pub fn (lb $&ListBox) set_appearance(appearance &ListAppearance) int

用途

$&ListBox 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
appearance &ListAppearance
appearance(只读借用,调用方仍持有原值;类型 &ListAppearance)

返回值

int — 该类型的值

(&ListBox) item_bounds

XuAPI
pub fn (lb &ListBox) item_bounds(index int,styles &Styles) layout.Rect

用途

&ListBox 上的操作:执行 item bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Rect — 该类型的值

struct ListRow

XuAPI
pub struct ListRow {
    pub title string
    pub description string
    pub detail string
    pub icon int
}

用途

承载 title、description、detail、icon 等属性的结构体。

公开字段

title string
字段(string)
description string
字段(string)
detail string
字段(string)
icon int
字段(int)

list_row

XuAPI
pub fn list_row(title string) ListRow

用途

执行 list row 操作。

参数

title string
title(string)

返回值

ListRow — 该类型的值

查看用法示例

(&ListRow) validate

XuAPI
pub fn (row &ListRow) validate() int

用途

在 &ListRow 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

row &ListRow
本次调用使用的 ListRow 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListBox) hit_item_byte

XuAPI
pub fn (lb &ListBox) hit_item_byte(index int,title $&StyledLabel,styles &Styles,has_row_layout bool,has_description bool,has_detail bool,icon int,x_pos f64,y_pos f64) int

用途

&ListBox 上的操作:执行 hit item byte 操作。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)
title $&StyledLabel
title(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
has_row_layout bool
has_row_layout(bool)
has_description bool
has_description(bool)
has_detail bool
has_detail(bool)
icon int
icon(int)
x_pos f64
x_pos(f64)
y_pos f64
y_pos(f64)

返回值

int — 该类型的值

(&ListBox) paint_row_styled

XuAPI
pub fn (lb &ListBox) paint_row_styled(frame $&draw.Frame,index int,title $&StyledLabel,description $&StyledLabel,detail $&StyledLabel,icon int,styles &Styles) int

用途

&ListBox 上的操作:执行 paint row styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

lb &ListBox
本次调用使用的 ListBox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
index int
index(int)
title $&StyledLabel
title(独占借用,可修改原值;类型 $&StyledLabel)
description $&StyledLabel
description(独占借用,可修改原值;类型 $&StyledLabel)
detail $&StyledLabel
detail(独占借用,可修改原值;类型 $&StyledLabel)
icon int
icon(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Screen) set_list_row

XuAPI
pub fn (s $&Screen) set_list_row(id int,index int,row &ListRow) int

用途

$&Screen 上的操作:设置 list row。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
index int
index(int)
row &ListRow
row(只读借用,调用方仍持有原值;类型 &ListRow)

返回值

int — 该类型的值

struct Locale

XuAPI
pub struct Locale {

}

用途

Locale 上下文或状态结构体。

公开字段

此类型没有公开字段。

const TEXT_DATE_PLACEHOLDER

XuAPI
pub const TEXT_DATE_PLACEHOLDER = 0

用途

常量 TEXT_DATE_PLACEHOLDER,定义了相关的协议或算法配置参数。

查看用法示例

const TEXT_TODAY

XuAPI
pub const TEXT_TODAY = 1

用途

常量 TEXT_TODAY,定义了相关的协议或算法配置参数。

查看用法示例

const TEXT_CLEAR

XuAPI
pub const TEXT_CLEAR = 2

用途

常量 TEXT_CLEAR,定义了相关的协议或算法配置参数。

查看用法示例

const TEXT_NO_OPTIONS

XuAPI
pub const TEXT_NO_OPTIONS = 3

用途

常量 TEXT_NO_OPTIONS,定义了相关的协议或算法配置参数。

const TEXT_NO_MATCHES

XuAPI
pub const TEXT_NO_MATCHES = 4

用途

常量 TEXT_NO_MATCHES,定义了相关的协议或算法配置参数。

const TEXT_CHOOSE_OPTIONS

XuAPI
pub const TEXT_CHOOSE_OPTIONS = 5

用途

常量 TEXT_CHOOSE_OPTIONS,定义了相关的协议或算法配置参数。

const TEXT_SELECTED_COUNT

XuAPI
pub const TEXT_SELECTED_COUNT = 6

用途

常量 TEXT_SELECTED_COUNT,定义了相关的协议或算法配置参数。

const TEXT_NO_RECORDS

XuAPI
pub const TEXT_NO_RECORDS = 7

用途

常量 TEXT_NO_RECORDS,定义了相关的协议或算法配置参数。

const TEXT_TASK_WORKING

XuAPI
pub const TEXT_TASK_WORKING = 8

用途

常量 TEXT_TASK_WORKING,定义了相关的协议或算法配置参数。

const TEXT_TASK_DONE

XuAPI
pub const TEXT_TASK_DONE = 9

用途

常量 TEXT_TASK_DONE,定义了相关的协议或算法配置参数。

const TEXT_TASK_RETRY

XuAPI
pub const TEXT_TASK_RETRY = 10

用途

常量 TEXT_TASK_RETRY,定义了相关的协议或算法配置参数。

const TEXT_TASK_CANCELLING

XuAPI
pub const TEXT_TASK_CANCELLING = 11

用途

常量 TEXT_TASK_CANCELLING,定义了相关的协议或算法配置参数。

const TEXT_WEB_CONTENT

XuAPI
pub const TEXT_WEB_CONTENT = 12

用途

常量 TEXT_WEB_CONTENT,定义了相关的协议或算法配置参数。

const TEXT_WEB_LOADING

XuAPI
pub const TEXT_WEB_LOADING = 13

用途

常量 TEXT_WEB_LOADING,定义了相关的协议或算法配置参数。

const TEXT_WEB_UNAVAILABLE

XuAPI
pub const TEXT_WEB_UNAVAILABLE = 14

用途

常量 TEXT_WEB_UNAVAILABLE,定义了相关的协议或算法配置参数。

const TEXT_WEB_FAILED

XuAPI
pub const TEXT_WEB_FAILED = 15

用途

常量 TEXT_WEB_FAILED,定义了相关的协议或算法配置参数。

const TEXT_AM

XuAPI
pub const TEXT_AM = 16

用途

常量 TEXT_AM,定义了相关的协议或算法配置参数。

const TEXT_PM

XuAPI
pub const TEXT_PM = 17

用途

常量 TEXT_PM,定义了相关的协议或算法配置参数。

const TEXT_DATE_PATTERN

XuAPI
pub const TEXT_DATE_PATTERN = 18

用途

常量 TEXT_DATE_PATTERN,定义了相关的协议或算法配置参数。

查看用法示例

const TEXT_CALENDAR_PATTERN

XuAPI
pub const TEXT_CALENDAR_PATTERN = 19

用途

常量 TEXT_CALENDAR_PATTERN,定义了相关的协议或算法配置参数。

const TEXT_DECIMAL_SEPARATOR

XuAPI
pub const TEXT_DECIMAL_SEPARATOR = 20

用途

常量 TEXT_DECIMAL_SEPARATOR,定义了相关的协议或算法配置参数。

查看用法示例

const TEXT_GROUP_SEPARATOR

XuAPI
pub const TEXT_GROUP_SEPARATOR = 21

用途

常量 TEXT_GROUP_SEPARATOR,定义了相关的协议或算法配置参数。

查看用法示例

const TEXT_PERCENT_PATTERN

XuAPI
pub const TEXT_PERCENT_PATTERN = 22

用途

常量 TEXT_PERCENT_PATTERN,定义了相关的协议或算法配置参数。

const TEXT_OVERFLOW_PATTERN

XuAPI
pub const TEXT_OVERFLOW_PATTERN = 23

用途

常量 TEXT_OVERFLOW_PATTERN,定义了相关的协议或算法配置参数。

const TEXT_COUNTER_PATTERN

XuAPI
pub const TEXT_COUNTER_PATTERN = 24

用途

常量 TEXT_COUNTER_PATTERN,定义了相关的协议或算法配置参数。

const TEXT_TIME_SEPARATOR

XuAPI
pub const TEXT_TIME_SEPARATOR = 25

用途

常量 TEXT_TIME_SEPARATOR,定义了相关的协议或算法配置参数。

const TEXT_RED

XuAPI
pub const TEXT_RED = 26

用途

常量 TEXT_RED,定义了相关的协议或算法配置参数。

const TEXT_GREEN

XuAPI
pub const TEXT_GREEN = 27

用途

常量 TEXT_GREEN,定义了相关的协议或算法配置参数。

const TEXT_BLUE

XuAPI
pub const TEXT_BLUE = 28

用途

常量 TEXT_BLUE,定义了相关的协议或算法配置参数。

const TEXT_ALPHA

XuAPI
pub const TEXT_ALPHA = 29

用途

常量 TEXT_ALPHA,定义了相关的协议或算法配置参数。

const TEXT_SELECTED_ONE

XuAPI
pub const TEXT_SELECTED_ONE = 30

用途

常量 TEXT_SELECTED_ONE,定义了相关的协议或算法配置参数。

const TEXT_PAGE_SUMMARY

XuAPI
pub const TEXT_PAGE_SUMMARY = 63

用途

常量 TEXT_PAGE_SUMMARY,定义了相关的协议或算法配置参数。

const TEXT_ITEMS_PER_PAGE

XuAPI
pub const TEXT_ITEMS_PER_PAGE = 64

用途

常量 TEXT_ITEMS_PER_PAGE,定义了相关的协议或算法配置参数。

查看用法示例

locale_default

XuAPI
pub fn locale_default() Locale

用途

执行 locale default 操作。

参数

无需传入参数。

返回值

Locale — 该类型的值

locale_en_us

XuAPI
pub fn locale_en_us() Locale

用途

执行 locale en us 操作。

参数

无需传入参数。

返回值

Locale — 该类型的值

查看用法示例

locale_zh_cn

XuAPI
pub fn locale_zh_cn() Locale

用途

执行 locale zh cn 操作。

参数

无需传入参数。

返回值

Locale — 该类型的值

查看用法示例

(&Locale) clone

XuAPI
pub fn (locale &Locale) clone() Locale

用途

复制控件或样式快照,返回独立的 Locale 值。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。

返回值

Locale — 该类型的值

(&Locale) validate

XuAPI
pub fn (locale &Locale) validate() int

用途

在 &Locale 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Locale) text

XuAPI
pub fn (locale &Locale) text(key int) string

用途

&Locale 上的操作:返回当前文本。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
key int
键(int)

返回值

string — 结果字符串

($&Locale) set_text

XuAPI
pub fn (locale $&Locale) set_text(key int,text string) int

用途

$&Locale 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
text string
文本(string)

返回值

int — 该类型的值

($&Locale) set_weekdays

XuAPI
pub fn (locale $&Locale) set_weekdays(names &[]string) int

用途

$&Locale 上的操作:设置 weekdays。失败时抛出错误,调用方需处理或继续传播。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
names &[]string
names(只读借用,调用方仍持有原值;类型 &[]string)

返回值

int — 该类型的值

($&Locale) set_months

XuAPI
pub fn (locale $&Locale) set_months(names &[]string) int

用途

$&Locale 上的操作:设置 months。失败时抛出错误,调用方需处理或继续传播。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
names &[]string
names(只读借用,调用方仍持有原值;类型 &[]string)

返回值

int — 该类型的值

($&Locale) set_digits

XuAPI
pub fn (locale $&Locale) set_digits(names &[]string) int

用途

$&Locale 上的操作:设置 digits。失败时抛出错误,调用方需处理或继续传播。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
names &[]string
names(只读借用,调用方仍持有原值;类型 &[]string)

返回值

int — 该类型的值

(&Locale) weekday

XuAPI
pub fn (locale &Locale) weekday(column int) string

用途

&Locale 上的操作:星期。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
column int
column(int)

返回值

string — 结果字符串

(&Locale) number

XuAPI
pub fn (locale &Locale) number(value string,grouped bool) string

用途

在 &Locale 上执行 number 操作。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
value string
value(string)
grouped bool
grouped(bool)

返回值

string — 结果字符串

(&Locale) integer

XuAPI
pub fn (locale &Locale) integer(value int) string

用途

在 &Locale 上执行 integer 操作。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
value int
value(int)

返回值

string — 结果字符串

(&Locale) count_text

XuAPI
pub fn (locale &Locale) count_text(key int,count int) string

用途

&Locale 上的操作:计数文本。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
key int
键(int)
count int
count(int)

返回值

string — 结果字符串

(&Locale) date_text

XuAPI
pub fn (locale &Locale) date_text(value time.Time) string

用途

&Locale 上的操作:日期文本。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
value time.Time
value(time.Time)

返回值

string — 结果字符串

(&Locale) calendar_title

XuAPI
pub fn (locale &Locale) calendar_title(value time.Time) string

用途

&Locale 上的操作:执行 calendar title 操作。失败时抛出错误,调用方需处理或继续传播。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。
value time.Time
value(time.Time)

返回值

string — 结果字符串

(&Locale) first_weekday

XuAPI
pub fn (locale &Locale) first_weekday() int

用途

&Locale 上的操作:首次星期。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Locale) set_first_weekday

XuAPI
pub fn (locale $&Locale) set_first_weekday(day int) int

用途

$&Locale 上的操作:设置 first weekday。失败时抛出错误,调用方需处理或继续传播。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
day int
day(int)

返回值

int — 该类型的值

(&Locale) twelve_hour

XuAPI
pub fn (locale &Locale) twelve_hour() bool

用途

&Locale 上的操作:执行 twelve hour 操作。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Locale) set_12_hour

XuAPI
pub fn (locale $&Locale) set_12_hour(enabled bool)

用途

$&Locale 上的操作:设置 12 hour。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Locale) period_before

XuAPI
pub fn (locale &Locale) period_before() bool

用途

&Locale 上的操作:执行 period before 操作。

参数

locale &Locale
本次调用使用的 Locale 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Locale) set_period_before

XuAPI
pub fn (locale $&Locale) set_period_before(before bool)

用途

$&Locale 上的操作:设置 period before。

参数

locale $&Locale
本次调用使用的 Locale 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
before bool
before(bool)

返回值

不返回值。

const MENU_DROPDOWN

XuAPI
pub const MENU_DROPDOWN = 0

用途

常量 MENU_DROPDOWN,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_CONTEXT

XuAPI
pub const MENU_CONTEXT = 1

用途

常量 MENU_CONTEXT,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_SPLIT

XuAPI
pub const MENU_SPLIT = 2

用途

常量 MENU_SPLIT,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_ACTION

XuAPI
pub const MENU_ACTION = 0

用途

常量 MENU_ACTION,定义了相关的协议或算法配置参数。

const MENU_CHECK

XuAPI
pub const MENU_CHECK = 1

用途

常量 MENU_CHECK,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_RADIO

XuAPI
pub const MENU_RADIO = 2

用途

常量 MENU_RADIO,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_SEPARATOR

XuAPI
pub const MENU_SEPARATOR = 3

用途

常量 MENU_SEPARATOR,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_HEADING

XuAPI
pub const MENU_HEADING = 4

用途

常量 MENU_HEADING,定义了相关的协议或算法配置参数。

查看用法示例

const MENU_SUBMENU

XuAPI
pub const MENU_SUBMENU = 5

用途

常量 MENU_SUBMENU,定义了相关的协议或算法配置参数。

查看用法示例

struct MenuItem

XuAPI
pub struct MenuItem {
    pub key int
    pub parent int
    pub label string
    pub shortcut_label string
    pub shortcut_key int
    pub shortcut_modifiers int
    pub kind int
    pub enabled bool
    pub checked bool
    pub radio_group int
}

用途

承载 key、parent、label、shortcut_label、shortcut_key 等属性的结构体。

公开字段

key int
键
parent int
字段(int)
label string
字段(string)
shortcut_label string
字段(string)
shortcut_key int
字段(int)
shortcut_modifiers int
字段(int)
kind int
类型标签
enabled bool
字段(bool)
checked bool
字段(bool)
radio_group int
字段(int)

查看用法示例

struct MenuAppearance

XuAPI
pub struct MenuAppearance {
    pub row_height f64
    pub min_width f64
    pub max_width f64
    pub close_on_select bool
    pub hover_delay time.Duration
}

用途

承载 row_height、min_width、max_width、close_on_select、hover_delay 等属性的结构体。

公开字段

row_height f64
字段(f64)
min_width f64
字段(f64)
max_width f64
字段(f64)
close_on_select bool
字段(bool)
hover_delay time.Duration
字段(time.Duration)

struct Menu

XuAPI
pub struct Menu {

}

用途

Menu 上下文或状态结构体。

公开字段

此类型没有公开字段。

(&Menu) id

XuAPI
pub fn (m &Menu) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Menu) bounds

XuAPI
pub fn (m &Menu) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Menu) is_enabled

XuAPI
pub fn (m &Menu) is_enabled() bool

用途

返回控件当前是否可用。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Menu) is_selectable

XuAPI
pub fn (m &Menu) is_selectable() bool

用途

&Menu 上的操作:判断是否 selectable。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Menu) set_selectable

XuAPI
pub fn (m $&Menu) set_selectable(selectable bool)

用途

$&Menu 上的操作:设置 selectable。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Menu) is_open

XuAPI
pub fn (m &Menu) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Menu) opacity

XuAPI
pub fn (m &Menu) opacity() f64

用途

在 &Menu 上执行 opacity 操作。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Menu) needs_paint

XuAPI
pub fn (m &Menu) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Menu) painted

XuAPI
pub fn (m $&Menu) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Menu) set_items

XuAPI
pub fn (m $&Menu) set_items(items &[]MenuItem) int

用途

$&Menu 上的操作:设置 items。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
items &[]MenuItem
元素列表(只读借用,调用方仍持有原值;类型 &[]MenuItem)

返回值

int — 该类型的值

($&Menu) set_item_label

XuAPI
pub fn (m $&Menu) set_item_label(key int,label string) int

用途

$&Menu 上的操作:设置 item label。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
label string
label(string)

返回值

int — 该类型的值

($&Menu) set_label

XuAPI
pub fn (m $&Menu) set_label(label string)

用途

$&Menu 上的操作:设置 label。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
label string
label(string)

返回值

不返回值。

(&Menu) checked

XuAPI
pub fn (m &Menu) checked(key int) bool

用途

在 &Menu 上执行 checked 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。
key int
键(int)

返回值

bool — 是否成立

($&Menu) set_checked

XuAPI
pub fn (m $&Menu) set_checked(key int,value bool) int

用途

$&Menu 上的操作:设置 checked。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
value bool
value(bool)

返回值

int — 该类型的值

($&Menu) set_item_enabled

XuAPI
pub fn (m $&Menu) set_item_enabled(key int,value bool) int

用途

$&Menu 上的操作:设置 item enabled。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
key int
键(int)
value bool
value(bool)

返回值

int — 该类型的值

($&Menu) set_appearance

XuAPI
pub fn (m $&Menu) set_appearance(a &MenuAppearance) int

用途

$&Menu 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
a &MenuAppearance
值(只读借用,调用方仍持有原值;类型 &MenuAppearance)

返回值

int — 该类型的值

($&Menu) close

XuAPI
pub fn (m $&Menu) close() int

用途

$&Menu 上的操作:关闭资源。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&Menu) cancel

XuAPI
pub fn (m $&Menu) cancel()

用途

$&Menu 上的操作:取消。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Menu) set_focus

XuAPI
pub fn (m $&Menu) set_focus(value bool)

用途

$&Menu 上的操作:设置 focus。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&Menu) set_enabled

XuAPI
pub fn (m $&Menu) set_enabled(value bool)

用途

$&Menu 上的操作:设置 enabled。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&Menu) set_read_only

XuAPI
pub fn (m $&Menu) set_read_only(value bool)

用途

$&Menu 上的操作:设置 read only。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&Menu) set_bounds

XuAPI
pub fn (m $&Menu) set_bounds(b &layout.Rect) int

用途

$&Menu 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
b &layout.Rect
b(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Menu) set_style

XuAPI
pub fn (m $&Menu) set_style(style &ControlStyle) int

用途

$&Menu 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Menu) clear_style

XuAPI
pub fn (m $&Menu) clear_style()

用途

$&Menu 上的操作:执行 clear style 操作。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Menu) set_motion

XuAPI
pub fn (m $&Menu) set_motion(spec &MotionSpec) int

用途

$&Menu 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Menu) dispose

XuAPI
pub fn (m $&Menu) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Menu) popup_bounds

XuAPI
pub fn (m &Menu) popup_bounds() layout.Rect

用途

&Menu 上的操作:执行 popup bounds 操作。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Menu) set_viewport

XuAPI
pub fn (m $&Menu) set_viewport(viewport &layout.Rect) int

用途

$&Menu 上的操作:设置 viewport。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Menu) apply_styles

XuAPI
pub fn (m $&Menu) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Menu) tick

XuAPI
pub fn (m $&Menu) tick(styles &Styles,now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&Menu) next_tick

XuAPI
pub fn (m &Menu) next_tick(now time.Instant) time.Instant

用途

&Menu 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Menu
本次调用使用的 Menu 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&Menu) open_at

XuAPI
pub fn (m $&Menu) open_at(x f64,y f64,context bool) int

用途

$&Menu 上的操作:执行 open at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)
context bool
context(bool)

返回值

int — 该类型的值

($&Menu) shortcut

XuAPI
pub fn (m $&Menu) shortcut(event &ui.InputEvent) Action

用途

在 $&Menu 上执行 shortcut 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Menu) input

XuAPI
pub fn (m $&Menu) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Menu) route

XuAPI
pub fn (m $&Menu) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Menu) paint_styled

XuAPI
pub fn (m $&Menu) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Menu 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Menu) paint_popup_styled

XuAPI
pub fn (m $&Menu) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Menu 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Menu
本次调用使用的 Menu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

const EASE_LINEAR

XuAPI
pub const EASE_LINEAR = 0

用途

常量 EASE_LINEAR,定义了相关的协议或算法配置参数。

const EASE_OUT_QUART

XuAPI
pub const EASE_OUT_QUART = 1

用途

常量 EASE_OUT_QUART,定义了相关的协议或算法配置参数。

const EASE_OUT_QUINT

XuAPI
pub const EASE_OUT_QUINT = 2

用途

常量 EASE_OUT_QUINT,定义了相关的协议或算法配置参数。

查看用法示例

const EASE_IN_QUART

XuAPI
pub const EASE_IN_QUART = 3

用途

常量 EASE_IN_QUART,定义了相关的协议或算法配置参数。

const EASE_IN_OUT_CUBIC

XuAPI
pub const EASE_IN_OUT_CUBIC = 4

用途

常量 EASE_IN_OUT_CUBIC,定义了相关的协议或算法配置参数。

查看用法示例

const EASE_IN_QUINT

XuAPI
pub const EASE_IN_QUINT = 5

用途

常量 EASE_IN_QUINT,定义了相关的协议或算法配置参数。

struct MotionSpec

XuAPI
pub struct MotionSpec {
    pub hover time.Duration
    pub press time.Duration
    pub change time.Duration
    pub enter time.Duration
    pub exit time.Duration
    pub curve int
}

用途

承载 hover、press、change、enter、exit 等属性的结构体。

公开字段

hover time.Duration
字段(time.Duration)
press time.Duration
字段(time.Duration)
change time.Duration
字段(time.Duration)
enter time.Duration
字段(time.Duration)
exit time.Duration
字段(time.Duration)
curve int
字段(int)

motion_spec

XuAPI
pub fn motion_spec() MotionSpec

用途

执行 motion spec 操作。

参数

无需传入参数。

返回值

MotionSpec — 该类型的值

查看用法示例

(&MotionSpec) validate

XuAPI
pub fn (spec &MotionSpec) validate() int

用途

在 &MotionSpec 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

spec &MotionSpec
本次调用使用的 MotionSpec 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

struct Tween

XuAPI
pub struct Tween {

}

用途

Tween 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

tween

XuAPI
pub fn tween(value f64) Tween

用途

执行 tween 处理。失败时抛出错误,调用方需处理或继续传播。

参数

value f64
value(f64)

返回值

Tween — 该类型的值

查看用法示例

($&Tween) set_curve

XuAPI
pub fn (t $&Tween) set_curve(curve int) int

用途

$&Tween 上的操作:设置 curve。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tween
本次调用使用的 Tween 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
curve int
curve(int)

返回值

int — 该类型的值

(&Tween) value

XuAPI
pub fn (t &Tween) value() f64

用途

&Tween 上的操作:值。

参数

t &Tween
本次调用使用的 Tween 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Tween) is_animating

XuAPI
pub fn (t &Tween) is_animating() bool

用途

&Tween 上的操作:判断是否 animating。

参数

t &Tween
本次调用使用的 Tween 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tween) snap

XuAPI
pub fn (t $&Tween) snap(value f64) int

用途

在 $&Tween 上执行 snap 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tween
本次调用使用的 Tween 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)

返回值

int — 该类型的值

($&Tween) advance

XuAPI
pub fn (t $&Tween) advance(now time.Instant) bool

用途

在 $&Tween 上执行 advance 操作。

参数

t $&Tween
本次调用使用的 Tween 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

bool — 是否成立

($&Tween) retarget

XuAPI
pub fn (t $&Tween) retarget(value f64,now time.Instant,duration time.Duration,reduced_motion bool) int

用途

在 $&Tween 上执行 retarget 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tween
本次调用使用的 Tween 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)
now time.Instant
now(time.Instant)
duration time.Duration
duration(time.Duration)
reduced_motion bool
reduced_motion(bool)

返回值

int — 该类型的值

fade_color

XuAPI
pub fn fade_color(color draw.Color,opacity f64) draw.Color

用途

执行 fade color 操作。

参数

color draw.Color
color(draw.Color)
opacity f64
opacity(f64)

返回值

draw.Color — 该类型的值

(&ControlStyle) with_opacity

XuAPI
pub fn (base &ControlStyle) with_opacity(opacity f64) ControlStyle

用途

&ControlStyle 上的操作:派生一个带 opacity 的新值。失败时抛出错误,调用方需处理或继续传播。

参数

base &ControlStyle
本次调用使用的 ControlStyle 实例;以只读借用传入,调用方仍持有实例。
opacity f64
opacity(f64)

返回值

ControlStyle — 该类型的值

struct PaintTransition

XuAPI
pub struct PaintTransition {

}

用途

PaintTransition 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

paint_transition

XuAPI
pub fn paint_transition() PaintTransition

用途

执行 paint transition 操作。失败时抛出错误,调用方需处理或继续传播。

参数

无需传入参数。

返回值

PaintTransition — 该类型的值

查看用法示例

($&PaintTransition) set_spec

XuAPI
pub fn (motion $&PaintTransition) set_spec(spec &MotionSpec) int

用途

$&PaintTransition 上的操作:设置 spec。失败时抛出错误,调用方需处理或继续传播。

参数

motion $&PaintTransition
本次调用使用的 PaintTransition 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

(&PaintTransition) next_tick

XuAPI
pub fn (motion &PaintTransition) next_tick(now time.Instant) time.Instant

用途

&PaintTransition 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

motion &PaintTransition
本次调用使用的 PaintTransition 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

(&PaintTransition) is_animating

XuAPI
pub fn (motion &PaintTransition) is_animating() bool

用途

&PaintTransition 上的操作:判断是否 animating。

参数

motion &PaintTransition
本次调用使用的 PaintTransition 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&PaintTransition) finish

XuAPI
pub fn (motion $&PaintTransition) finish()

用途

在 $&PaintTransition 上执行 finish 操作。

参数

motion $&PaintTransition
本次调用使用的 PaintTransition 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&PaintTransition) advance

XuAPI
pub fn (motion $&PaintTransition) advance(now time.Instant) bool

用途

在 $&PaintTransition 上执行 advance 操作。失败时抛出错误,调用方需处理或继续传播。

参数

motion $&PaintTransition
本次调用使用的 PaintTransition 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

bool — 是否成立

($&PaintTransition) style

XuAPI
pub fn (motion $&PaintTransition) style(base &ControlStyle,state int,now time.Instant,reduced_motion bool) ControlStyle

用途

在 $&PaintTransition 上执行 style 操作。失败时抛出错误,调用方需处理或继续传播。

参数

motion $&PaintTransition
本次调用使用的 PaintTransition 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
base &ControlStyle
进制(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

ControlStyle — 该类型的值

($&Tween) retarget_unit

XuAPI
pub fn (t $&Tween) retarget_unit(value f64,now time.Instant,duration time.Duration,reduced bool) int

用途

$&Tween 上的操作:执行 retarget unit 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tween
本次调用使用的 Tween 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)
now time.Instant
now(time.Instant)
duration time.Duration
duration(time.Duration)
reduced bool
reduced(bool)

返回值

int — 该类型的值

struct MultiSelect

XuAPI
pub struct MultiSelect {

}

用途

MultiSelect 上下文或状态结构体。

公开字段

此类型没有公开字段。

multi_select

XuAPI
pub fn multi_select(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,options &[]string) MultiSelect

用途

执行 multi select 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)

返回值

MultiSelect — 该类型的值

(&MultiSelect) id

XuAPI
pub fn (multi &MultiSelect) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&MultiSelect) bounds

XuAPI
pub fn (multi &MultiSelect) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&MultiSelect) is_open

XuAPI
pub fn (multi &MultiSelect) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&MultiSelect) is_enabled

XuAPI
pub fn (multi &MultiSelect) is_enabled() bool

用途

返回控件当前是否可用。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&MultiSelect) is_selectable

XuAPI
pub fn (multi &MultiSelect) is_selectable() bool

用途

&MultiSelect 上的操作:判断是否 selectable。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&MultiSelect) set_selectable

XuAPI
pub fn (multi $&MultiSelect) set_selectable(selectable bool)

用途

$&MultiSelect 上的操作:设置 selectable。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&MultiSelect) needs_paint

XuAPI
pub fn (multi &MultiSelect) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&MultiSelect) count

XuAPI
pub fn (multi &MultiSelect) count() int

用途

返回该控件当前包含的项目数量。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&MultiSelect) selected

XuAPI
pub fn (multi &MultiSelect) selected(index int) bool

用途

检查某一选项当前是否勾选,适合在变化动作后读取最终状态。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。
index int
原选项列表中从 0 开始的索引。

返回值

勾选时为 true,否则为 false。

错误处理

  • 索引越界抛出 widgets: choice index out of range。

(&MultiSelect) values

XuAPI
pub fn (multi &MultiSelect) values() []int

用途

返回当前集合、参数表或映射中所有值的切片。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

[]int — 切片结果

($&MultiSelect) set_selected

XuAPI
pub fn (multi $&MultiSelect) set_selected(index int,selected bool) int

用途

设置某一选项是否勾选,不改变其他选项,适合回填表单中的多选结果。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
原选项列表中从 0 开始的索引。
selected bool
true 勾选,false 取消勾选。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

错误处理

  • 控件已释放或索引不在 0..count()-1 时抛错。

(&MultiSelect) style_or

XuAPI
pub fn (multi &MultiSelect) style_or(styles &Styles) ControlStyle

用途

&MultiSelect 上的操作:执行 style or 操作。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&MultiSelect) set_style

XuAPI
pub fn (multi $&MultiSelect) set_style(style &ControlStyle) int

用途

$&MultiSelect 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&MultiSelect) set_enabled

XuAPI
pub fn (multi $&MultiSelect) set_enabled(enabled bool)

用途

$&MultiSelect 上的操作:设置 enabled。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&MultiSelect) set_read_only

XuAPI
pub fn (multi $&MultiSelect) set_read_only(read_only bool) int

用途

$&MultiSelect 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&MultiSelect) set_invalid

XuAPI
pub fn (multi $&MultiSelect) set_invalid(invalid bool)

用途

$&MultiSelect 上的操作:设置 invalid。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&MultiSelect) set_focus

XuAPI
pub fn (multi $&MultiSelect) set_focus(focused bool)

用途

$&MultiSelect 上的操作:设置 focus。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&MultiSelect) set_open

XuAPI
pub fn (multi $&MultiSelect) set_open(open bool)

用途

控制下拉选项列表的打开状态。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
open bool
true 请求打开,false 关闭;禁用或只读时请求打开也会保持关闭。

返回值

不返回值;更新后的状态可用 is_open() 读取。

使用时注意

  • 打开状态与绘制是两步:还需在合适的覆盖层调用 paint_popup_styled。

($&MultiSelect) set_popup_above

XuAPI
pub fn (multi $&MultiSelect) set_popup_above(above bool)

用途

$&MultiSelect 上的操作:设置 popup above。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
above bool
above(bool)

返回值

不返回值。

($&MultiSelect) set_bounds

XuAPI
pub fn (multi $&MultiSelect) set_bounds(bounds &layout.Rect) int

用途

$&MultiSelect 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&MultiSelect) apply_styles

XuAPI
pub fn (multi $&MultiSelect) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&MultiSelect) popup_bounds

XuAPI
pub fn (multi &MultiSelect) popup_bounds() layout.Rect

用途

读取下拉列表在画布中的矩形,用于覆盖层命中测试或布局判断。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。

返回值

弹出列表的 layout.Rect;读取矩形不会打开列表,应同时检查 is_open()。

(&MultiSelect) option_bounds

XuAPI
pub fn (multi &MultiSelect) option_bounds(index int) layout.Rect

用途

&MultiSelect 上的操作:执行 option bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

multi &MultiSelect
本次调用使用的 MultiSelect 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

($&MultiSelect) input

XuAPI
pub fn (multi $&MultiSelect) input(event &ui.InputEvent) Action

用途

处理展开、多项勾选和已选标签交互,把用户选择写回控件状态。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 选项切换返回 ACTION_CHANGE,value 为发生变化的选项索引;读取 selected(index) 获取该项现在的勾选状态。

($&MultiSelect) route

XuAPI
pub fn (multi $&MultiSelect) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&MultiSelect) event

XuAPI
pub fn (multi $&MultiSelect) event(event &ui.Event) Action

用途

接收窗口原生事件;输入事件转交 input,其余事件交给内部编辑器或基础控件处理。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
窗口提供的完整 ui.Event;需要输入法、失焦和生命周期处理时使用这个入口。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 内部失去焦点后会关闭下拉列表。

($&MultiSelect) measure_styled

XuAPI
pub fn (multi $&MultiSelect) measure_styled(styles &Styles) layout.Size

用途

$&MultiSelect 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&MultiSelect) paint_styled

XuAPI
pub fn (multi $&MultiSelect) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&MultiSelect 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&MultiSelect) paint_popup_styled

XuAPI
pub fn (multi $&MultiSelect) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

绘制展开的选项列表;与输入框本体分开绘制,以便选项覆盖后面的控件。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
当前绘制帧;本调用向其中记录绘制命令。
styles &Styles
当前生效的样式;提供颜色、间距、字体和状态外观。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 在画布坐标空间中绘制,通常放在普通控件之后;不要沿用输入框内部的局部变换或裁剪,否则列表可能被截掉。

错误处理

  • 绘制帧、文字或样式操作失败时继续抛出错误。

($&MultiSelect) dispose

XuAPI
pub fn (multi $&MultiSelect) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&MultiSelect) set_filter

XuAPI
pub fn (multi $&MultiSelect) set_filter(query &string) int

用途

$&MultiSelect 上的操作:设置 filter。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
query &string
query(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&MultiSelect) select_all

XuAPI
pub fn (multi $&MultiSelect) select_all(selected bool) int

用途

$&MultiSelect 上的操作:执行 select all 操作。失败时抛出错误,调用方需处理或继续传播。

参数

multi $&MultiSelect
本次调用使用的 MultiSelect 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
selected(bool)

返回值

int — 该类型的值

($&Screen) set_notice_style

XuAPI
pub fn (s $&Screen) set_notice_style(style &ControlStyle) int

用途

$&Screen 上的操作:设置 notice style。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Screen) clear_notice_style

XuAPI
pub fn (s $&Screen) clear_notice_style() int

用途

$&Screen 上的操作:执行 clear notice style 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&Screen) set_notice_motion

XuAPI
pub fn (s $&Screen) set_notice_motion(spec &MotionSpec) int

用途

$&Screen 上的操作:设置 notice motion。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Screen) find_next_option

XuAPI
pub fn (s $&Screen) find_next_option(id int,prefix &string) int

用途

$&Screen 上的操作:执行 find next option 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
prefix &string
前缀(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

anchored_overlay_bounds

XuAPI
pub fn anchored_overlay_bounds(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) layout.Rect

用途

气泡弹出浮层容器,锚定在指定界面元素周边。失败时抛出错误,调用方需处理或继续传播。

参数

anchor &layout.Rect
anchor(只读借用,调用方仍持有原值;类型 &layout.Rect)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

layout.Rect — 该类型的值

overlay_next_tick

XuAPI
pub fn overlay_next_tick(animated bool,now time.Instant) time.Instant

用途

执行 overlay next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

animated bool
animated(bool)
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

struct Popover

XuAPI
pub struct Popover {

}

用途

气泡弹出浮层容器,锚定在指定界面元素周边。

公开字段

此类型没有公开字段。

popover

XuAPI
pub fn popover(identity &ui.CanvasEvent,id int,anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) Popover

用途

执行 popover 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
anchor &layout.Rect
anchor(只读借用,调用方仍持有原值;类型 &layout.Rect)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Popover — 该类型的值

(&Popover) id

XuAPI
pub fn (p &Popover) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Popover) bounds

XuAPI
pub fn (p &Popover) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Popover) is_enabled

XuAPI
pub fn (p &Popover) is_enabled() bool

用途

返回控件当前是否可用。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Popover) is_selectable

XuAPI
pub fn (p &Popover) is_selectable() bool

用途

&Popover 上的操作:判断是否 selectable。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Popover) set_selectable

XuAPI
pub fn (p $&Popover) set_selectable(selectable bool)

用途

$&Popover 上的操作:设置 selectable。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Popover) set_text

XuAPI
pub fn (p $&Popover) set_text(context &draw.Context,text &string) int

用途

$&Popover 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

(&Popover) has_popup_open

XuAPI
pub fn (p &Popover) has_popup_open() bool

用途

&Popover 上的操作:判断是否具有 popup open。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Popover) popup_bounds

XuAPI
pub fn (p &Popover) popup_bounds() layout.Rect

用途

&Popover 上的操作:执行 popup bounds 操作。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Popover) selected_text

XuAPI
pub fn (p &Popover) selected_text() string

用途

&Popover 上的操作:执行 selected text 操作。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Popover) copy_selection

XuAPI
pub fn (p &Popover) copy_selection() int

用途

&Popover 上的操作:执行 copy selection 操作。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Popover) selection_range

XuAPI
pub fn (p &Popover) selection_range() ui.TextRange

用途

&Popover 上的操作:执行 selection range 操作。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

ui.TextRange — 该类型的值

(&Popover) cursor

XuAPI
pub fn (p &Popover) cursor() int

用途

&Popover 上的操作:游标。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Popover) set_viewport

XuAPI
pub fn (p $&Popover) set_viewport(viewport &layout.Rect)

用途

$&Popover 上的操作:设置 viewport。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&Popover) set_locale

XuAPI
pub fn (p $&Popover) set_locale(locale &Locale) int

用途

$&Popover 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

(&Popover) is_open

XuAPI
pub fn (p &Popover) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Popover) is_visible

XuAPI
pub fn (p &Popover) is_visible() bool

用途

判断弹出层是否仍需要绘制,包括正在退场的阶段。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

打开或仍有退场透明度时为 true;完全消失后为 false。

(&Popover) opacity

XuAPI
pub fn (p &Popover) opacity() f64

用途

在 &Popover 上执行 opacity 操作。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Popover) needs_paint

XuAPI
pub fn (p &Popover) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Popover) painted

XuAPI
pub fn (p $&Popover) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Popover) set_geometry

XuAPI
pub fn (p $&Popover) set_geometry(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) int

用途

$&Popover 上的操作:设置 geometry。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
anchor &layout.Rect
anchor(只读借用,调用方仍持有原值;类型 &layout.Rect)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Popover) open

XuAPI
pub fn (p $&Popover) open(now time.Instant,reduced_motion bool) int

用途

打开弹出层并启动入场动画;禁用的弹出层保持关闭。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
当前动画时间 time.Instant;打开、更新和关闭应使用同一时间基准。
reduced_motion bool
是否减少动态效果;为 true 时直接到目标状态。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 每帧调用 tick 推进动画,用 is_visible 决定是否继续绘制。

错误处理

  • 动画参数或状态无效时抛错。

($&Popover) close

XuAPI
pub fn (p $&Popover) close(now time.Instant,reduced_motion bool) int

用途

请求关闭并启动退场动画;逻辑关闭之后可能还需要继续绘制几帧。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
当前动画时间 time.Instant;打开、更新和关闭应使用同一时间基准。
reduced_motion bool
是否减少动态效果;为 true 时直接到目标状态。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • is_open() 随关闭请求变为 false,is_visible() 在退场动画结束后才变为 false。

错误处理

  • 动画操作失败时继续抛错。

($&Popover) set_enabled

XuAPI
pub fn (p $&Popover) set_enabled(enabled bool) int

用途

$&Popover 上的操作:设置 enabled。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Popover) tick

XuAPI
pub fn (p $&Popover) tick(now time.Instant,reduced_motion bool) bool

用途

把淡入淡出动画推进到当前时间,用返回值决定是否安排重绘。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
当前动画时间 time.Instant;打开、更新和关闭应使用同一时间基准。
reduced_motion bool
是否减少动态效果;为 true 时直接到目标状态。

返回值

透明度发生变化时返回 true;没有变化返回 false。

错误处理

  • 时间或动画状态无效时抛错。

(&Popover) next_tick

XuAPI
pub fn (p &Popover) next_tick(now time.Instant) time.Instant

用途

&Popover 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&Popover) input

XuAPI
pub fn (p $&Popover) input(event &ui.InputEvent) Action

用途

处理弹出层的外部点击、Escape 和取消输入,按关闭策略更新打开状态。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 锚点和面板内部的点击不会作为外部点击关闭;面板内容的业务交互由调用方继续分发。

($&Popover) route

XuAPI
pub fn (p $&Popover) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Popover) paint_styled

XuAPI
pub fn (p &Popover) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

绘制弹出面板的样式背景与边框。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
当前绘制帧;本调用向其中记录绘制命令。
styles &Styles
当前生效的样式;提供颜色、间距、字体和状态外观。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 面板内容由调用方绘制;本调用不会自动创建、布局或分发内容控件。

错误处理

  • 绘制命令失败时继续抛错。

($&Popover) paint_content_styled

XuAPI
pub fn (p $&Popover) paint_content_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Popover 上的操作:执行 paint content styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Popover) paint_popup_styled

XuAPI
pub fn (p $&Popover) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Popover 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Modal

XuAPI
pub struct Modal {

}

用途

模态弹窗遮罩对话框,独占用户交互与键盘焦点。

公开字段

此类型没有公开字段。

(&Modal) id

XuAPI
pub fn (m &Modal) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Modal) bounds

XuAPI
pub fn (m &Modal) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Modal) is_enabled

XuAPI
pub fn (m &Modal) is_enabled() bool

用途

返回控件当前是否可用。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Modal) is_selectable

XuAPI
pub fn (m &Modal) is_selectable() bool

用途

&Modal 上的操作:判断是否 selectable。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Modal) set_selectable

XuAPI
pub fn (m $&Modal) set_selectable(selectable bool)

用途

$&Modal 上的操作:设置 selectable。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Modal) set_text

XuAPI
pub fn (m $&Modal) set_text(context &draw.Context,text &string) int

用途

$&Modal 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

(&Modal) has_popup_open

XuAPI
pub fn (m &Modal) has_popup_open() bool

用途

&Modal 上的操作:判断是否具有 popup open。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Modal) popup_bounds

XuAPI
pub fn (m &Modal) popup_bounds() layout.Rect

用途

&Modal 上的操作:执行 popup bounds 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Modal) selected_text

XuAPI
pub fn (m &Modal) selected_text() string

用途

&Modal 上的操作:执行 selected text 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Modal) copy_selection

XuAPI
pub fn (m &Modal) copy_selection() int

用途

&Modal 上的操作:执行 copy selection 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Modal) cursor

XuAPI
pub fn (m &Modal) cursor() int

用途

&Modal 上的操作:游标。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Modal) set_locale

XuAPI
pub fn (m $&Modal) set_locale(locale &Locale) int

用途

$&Modal 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

(&Modal) is_open

XuAPI
pub fn (m &Modal) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Modal) is_visible

XuAPI
pub fn (m &Modal) is_visible() bool

用途

判断模态层是否仍需要绘制,包括正在退场的阶段。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

打开或仍有退场透明度时为 true;完全消失后为 false。

(&Modal) blocks_input

XuAPI
pub fn (m &Modal) blocks_input() bool

用途

&Modal 上的操作:执行 blocks input 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Modal) opacity

XuAPI
pub fn (m &Modal) opacity() f64

用途

在 &Modal 上执行 opacity 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Modal) needs_paint

XuAPI
pub fn (m &Modal) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Modal) painted

XuAPI
pub fn (m $&Modal) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Modal) set_dismiss_on_outside

XuAPI
pub fn (m $&Modal) set_dismiss_on_outside(enabled bool)

用途

$&Modal 上的操作:设置 dismiss on outside。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Modal) focused_id

XuAPI
pub fn (m &Modal) focused_id() int

用途

&Modal 上的操作:执行 focused id 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Modal) focus_restore_id

XuAPI
pub fn (m &Modal) focus_restore_id() int

用途

&Modal 上的操作:执行 focus restore id 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Modal) take_restore_focus

XuAPI
pub fn (m $&Modal) take_restore_focus() int

用途

在模态层完全关闭后,取出一次性的焦点恢复目标并交给窗口焦点逻辑处理。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

待恢复的控件 ID;仍可见或没有待处理恢复请求时返回 0。同一请求只取一次。

(&Modal) contains_focus

XuAPI
pub fn (m &Modal) contains_focus(id int) bool

用途

&Modal 上的操作:执行 contains focus 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Modal) set_focus_order

XuAPI
pub fn (m $&Modal) set_focus_order(ids &[]int) int

用途

设置模态层内部的 Tab 遍历顺序,让键盘焦点在指定控件中循环。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
ids &[]int
内容控件 ID 的有序列表,最多 256 项;ID 必须为正数、不能重复,也不能等于模态层自身 ID。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 原焦点仍在新列表中时保留它,否则选第一项;空列表表示没有内容焦点目标。

错误处理

  • 数量、ID 或重复校验失败时抛错。

($&Modal) set_content_focus

XuAPI
pub fn (m $&Modal) set_content_focus(id int) int

用途

$&Modal 上的操作:设置 content focus。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Modal) open

XuAPI
pub fn (m $&Modal) open(now time.Instant,reduced_motion bool,restore_focus int) int

用途

打开模态层并记录关闭后的焦点恢复目标。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
当前动画时间 time.Instant;打开、更新和关闭应使用同一时间基准。
reduced_motion bool
是否减少动态效果;为 true 时直接到目标状态。
restore_focus int
关闭完成后需要恢复的控件 ID;0 表示没有恢复目标,不能为负数。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 每帧调用 tick 推进动画,用 is_visible 决定是否继续绘制。

错误处理

  • 动画参数或状态无效时抛错。焦点恢复 ID 为负数也会抛错。

($&Modal) close

XuAPI
pub fn (m $&Modal) close(now time.Instant,reduced_motion bool) int

用途

请求关闭并启动退场动画;逻辑关闭之后可能还需要继续绘制几帧。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
当前动画时间 time.Instant;打开、更新和关闭应使用同一时间基准。
reduced_motion bool
是否减少动态效果;为 true 时直接到目标状态。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • is_open() 随关闭请求变为 false,is_visible() 在退场动画结束后才变为 false。

错误处理

  • 动画操作失败时继续抛错。

($&Modal) set_enabled

XuAPI
pub fn (m $&Modal) set_enabled(enabled bool) int

用途

$&Modal 上的操作:设置 enabled。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Modal) set_geometry

XuAPI
pub fn (m $&Modal) set_geometry(bounds &layout.Rect,viewport &layout.Rect) int

用途

$&Modal 上的操作:设置 geometry。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Modal) close_bounds

XuAPI
pub fn (m &Modal) close_bounds() layout.Rect

用途

&Modal 上的操作:执行 close bounds 操作。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Modal) allows_content

XuAPI
pub fn (m &Modal) allows_content(event &ui.InputEvent) bool

用途

判断当前输入能否交给模态面板内部的控件,用于模态层优先分发后的下一步。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。
event &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

允许时为 true;未打开、身份不匹配、Tab/Escape 或落在关闭按钮上的输入为 false。

使用时注意

  • 键盘输入还要求存在内容焦点目标;指针输入需要落在面板内。

($&Modal) input

XuAPI
pub fn (m $&Modal) input(event &ui.InputEvent) Action

用途

先处理模态层的关闭和 Tab 焦点循环,再决定是否把输入交给面板内容。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
同一窗口、画布和代次的输入事件;坐标按控件所在的画布空间传入。

返回值

Action 描述本次交互:kind 是动作类型,consumed 表示事件是否已处理,request_focus 请求焦点,needs_paint 表示需要重绘。

使用时注意

  • 先于背景控件分发;用 allows_content 判断内容输入。退出动画尚未结束时仍阻止背景交互。

($&Modal) route

XuAPI
pub fn (m $&Modal) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Modal) tick

XuAPI
pub fn (m $&Modal) tick(now time.Instant,reduced_motion bool) bool

用途

把淡入淡出动画推进到当前时间,用返回值决定是否安排重绘。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
当前动画时间 time.Instant;打开、更新和关闭应使用同一时间基准。
reduced_motion bool
是否减少动态效果;为 true 时直接到目标状态。

返回值

透明度发生变化时返回 true;没有变化返回 false。

错误处理

  • 时间或动画状态无效时抛错。

(&Modal) next_tick

XuAPI
pub fn (m &Modal) next_tick(now time.Instant) time.Instant

用途

&Modal 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

(&Modal) paint_styled

XuAPI
pub fn (m &Modal) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

绘制模态遮罩、面板和关闭按钮。

参数

m &Modal
本次调用使用的 Modal 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
当前绘制帧;本调用向其中记录绘制命令。
styles &Styles
当前生效的样式;提供颜色、间距、字体和状态外观。

返回值

成功返回 0;失败时抛错,不以非零返回码表示失败。

使用时注意

  • 遮罩取自 Styles.overlay_scrim(),其透明度随模态动画变化。
  • 面板内容由调用方绘制;本调用不会自动创建、布局或分发内容控件。

错误处理

  • 绘制命令失败时继续抛错。

($&Modal) paint_content_styled

XuAPI
pub fn (m $&Modal) paint_content_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Modal 上的操作:执行 paint content styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Modal) paint_popup_styled

XuAPI
pub fn (m $&Modal) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Modal 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Popover) style_or

XuAPI
pub fn (p &Popover) style_or(styles &Styles) ControlStyle

用途

&Popover 上的操作:执行 style or 操作。

参数

p &Popover
本次调用使用的 Popover 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Popover) set_style

XuAPI
pub fn (p $&Popover) set_style(style &ControlStyle) int

用途

$&Popover 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Popover) set_motion

XuAPI
pub fn (p $&Popover) set_motion(spec &MotionSpec) int

用途

$&Popover 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Modal) set_style

XuAPI
pub fn (m $&Modal) set_style(style &ControlStyle) int

用途

$&Modal 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Modal) set_motion

XuAPI
pub fn (m $&Modal) set_motion(spec &MotionSpec) int

用途

$&Modal 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Modal
本次调用使用的 Modal 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

struct Pagination

XuAPI
pub struct Pagination {

}

用途

分页栏控件,支持页码跳转与上一页/下一页导航。

公开字段

此类型没有公开字段。

pagination

XuAPI
pub fn pagination(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,pages int,current int) Pagination

用途

执行 pagination 处理。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
pages int
pages(int)
current int
current(int)

返回值

Pagination — 该类型的值

(&Pagination) id

XuAPI
pub fn (p &Pagination) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Pagination) bounds

XuAPI
pub fn (p &Pagination) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Pagination) page_count

XuAPI
pub fn (p &Pagination) page_count() int

用途

&Pagination 上的操作:执行 page count 操作。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Pagination) selected

XuAPI
pub fn (p &Pagination) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Pagination) needs_paint

XuAPI
pub fn (p &Pagination) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Pagination) painted

XuAPI
pub fn (p $&Pagination) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Pagination) is_enabled

XuAPI
pub fn (p &Pagination) is_enabled() bool

用途

返回控件当前是否可用。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Pagination) is_selectable

XuAPI
pub fn (p &Pagination) is_selectable() bool

用途

&Pagination 上的操作:判断是否 selectable。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Pagination) set_selectable

XuAPI
pub fn (p $&Pagination) set_selectable(selectable bool)

用途

$&Pagination 上的操作:设置 selectable。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Pagination) is_focused

XuAPI
pub fn (p &Pagination) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Pagination) is_read_only

XuAPI
pub fn (p &Pagination) is_read_only() bool

用途

&Pagination 上的操作:判断是否 read only。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Pagination) cancel

XuAPI
pub fn (p $&Pagination) cancel()

用途

$&Pagination 上的操作:取消。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Pagination) set_focus

XuAPI
pub fn (p $&Pagination) set_focus(focused bool)

用途

$&Pagination 上的操作:设置 focus。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Pagination) set_enabled

XuAPI
pub fn (p $&Pagination) set_enabled(enabled bool)

用途

$&Pagination 上的操作:设置 enabled。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Pagination) set_read_only

XuAPI
pub fn (p $&Pagination) set_read_only(value bool) int

用途

$&Pagination 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

int — 该类型的值

($&Pagination) set_page_count

XuAPI
pub fn (p $&Pagination) set_page_count(pages int) int

用途

$&Pagination 上的操作:设置 page count。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
pages int
pages(int)

返回值

int — 该类型的值

($&Pagination) set_selected

XuAPI
pub fn (p $&Pagination) set_selected(index int) int

用途

$&Pagination 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&Pagination) set_bounds

XuAPI
pub fn (p $&Pagination) set_bounds(bounds &layout.Rect) int

用途

$&Pagination 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Pagination) style_or

XuAPI
pub fn (p &Pagination) style_or(styles &Styles) ControlStyle

用途

&Pagination 上的操作:执行 style or 操作。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Pagination) set_style

XuAPI
pub fn (p $&Pagination) set_style(style &ControlStyle) int

用途

$&Pagination 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Pagination) clear_style

XuAPI
pub fn (p $&Pagination) clear_style()

用途

$&Pagination 上的操作:执行 clear style 操作。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Pagination) apply_styles

XuAPI
pub fn (p $&Pagination) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Pagination) item_bounds

XuAPI
pub fn (p &Pagination) item_bounds(slot int) layout.Rect

用途

&Pagination 上的操作:执行 item bounds 操作。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。
slot int
slot(int)

返回值

layout.Rect — 该类型的值

($&Pagination) input

XuAPI
pub fn (p $&Pagination) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Pagination) route

XuAPI
pub fn (p $&Pagination) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Pagination) event

XuAPI
pub fn (p $&Pagination) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Pagination) measure_styled

XuAPI
pub fn (p $&Pagination) measure_styled(styles &Styles) layout.Size

用途

$&Pagination 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&Pagination) paint_styled

XuAPI
pub fn (p $&Pagination) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Pagination 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Pagination) dispose

XuAPI
pub fn (p $&Pagination) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

struct PaginationAppearance

XuAPI
pub struct PaginationAppearance {
    pub gap f64
    pub min_item_width f64
    pub stretch bool
}

用途

承载 gap、min_item_width、stretch 等属性的结构体。

公开字段

gap f64
字段(f64)
min_item_width f64
字段(f64)
stretch bool
字段(bool)

pagination_appearance

XuAPI
pub fn pagination_appearance() PaginationAppearance

用途

执行 pagination appearance 操作。

参数

无需传入参数。

返回值

PaginationAppearance — 该类型的值

($&Pagination) set_appearance

XuAPI
pub fn (page $&Pagination) set_appearance(appearance &PaginationAppearance) int

用途

$&Pagination 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

page $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
appearance &PaginationAppearance
appearance(只读借用,调用方仍持有原值;类型 &PaginationAppearance)

返回值

int — 该类型的值

struct PaginationData

XuAPI
pub struct PaginationData {
    pub total int
    pub page_size int
    pub pages int
    pub current int
}

用途

承载 total、page_size、pages、current 等属性的结构体。

公开字段

total int
字段(int)
page_size int
字段(int)
pages int
字段(int)
current int
字段(int)

(&Pagination) data

XuAPI
pub fn (page &Pagination) data() PaginationData

用途

在 &Pagination 上执行 data 操作。

参数

page &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

PaginationData — 该类型的值

($&Pagination) set_data

XuAPI
pub fn (page $&Pagination) set_data(total int,page_size int) int

用途

$&Pagination 上的操作:设置 data。失败时抛出错误,调用方需处理或继续传播。

参数

page $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
total int
total(int)
page_size int
page_size(int)

返回值

int — 该类型的值

($&Pagination) jump

XuAPI
pub fn (page $&Pagination) jump(one_based int) int

用途

在 $&Pagination 上执行 jump 操作。失败时抛出错误,调用方需处理或继续传播。

参数

page $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
one_based int
one_based(int)

返回值

int — 该类型的值

(&Pagination) summary_text

XuAPI
pub fn (page &Pagination) summary_text() string

用途

&Pagination 上的操作:执行 summary text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

page &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&Screen) set_pagination_data

XuAPI
pub fn (s $&Screen) set_pagination_data(id int,total int,page_size int) int

用途

$&Screen 上的操作:设置 pagination data。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
total int
total(int)
page_size int
page_size(int)

返回值

int — 该类型的值

($&Screen) pagination_data

XuAPI
pub fn (s $&Screen) pagination_data(id int) PaginationData

用途

$&Screen 上的操作:执行 pagination data 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

PaginationData — 该类型的值

($&Screen) pagination_summary

XuAPI
pub fn (s $&Screen) pagination_summary(id int) string

用途

$&Screen 上的操作:执行 pagination summary 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

string — 结果字符串

($&Pagination) set_motion

XuAPI
pub fn (p $&Pagination) set_motion(spec &MotionSpec) int

用途

$&Pagination 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Pagination) tick

XuAPI
pub fn (p $&Pagination) tick(styles &Styles,now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

p $&Pagination
本次调用使用的 Pagination 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&Pagination) next_tick

XuAPI
pub fn (p &Pagination) next_tick(now time.Instant) time.Instant

用途

&Pagination 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

p &Pagination
本次调用使用的 Pagination 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

(&Switch) is_pending

XuAPI
pub fn (sw &Switch) is_pending() bool

用途

&Switch 上的操作:判断是否 pending。

参数

sw &Switch
本次调用使用的 Switch 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Switch) set_pending

XuAPI
pub fn (sw $&Switch) set_pending(pending bool)

用途

$&Switch 上的操作:设置 pending。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
pending bool
pending(bool)

返回值

不返回值。

($&Screen) set_switch_pending

XuAPI
pub fn (s $&Screen) set_switch_pending(id int,pending bool) int

用途

$&Screen 上的操作:设置 switch pending。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
pending bool
pending(bool)

返回值

int — 该类型的值

const OVERLAY_BOTTOM

XuAPI
pub const OVERLAY_BOTTOM = 0

用途

常量 OVERLAY_BOTTOM,定义了相关的协议或算法配置参数。

const OVERLAY_TOP

XuAPI
pub const OVERLAY_TOP = 1

用途

常量 OVERLAY_TOP,定义了相关的协议或算法配置参数。

查看用法示例

const OVERLAY_LEFT

XuAPI
pub const OVERLAY_LEFT = 2

用途

常量 OVERLAY_LEFT,定义了相关的协议或算法配置参数。

const OVERLAY_RIGHT

XuAPI
pub const OVERLAY_RIGHT = 3

用途

常量 OVERLAY_RIGHT,定义了相关的协议或算法配置参数。

const OVERLAY_START

XuAPI
pub const OVERLAY_START = 0

用途

常量 OVERLAY_START,定义了相关的协议或算法配置参数。

const OVERLAY_CENTER

XuAPI
pub const OVERLAY_CENTER = 1

用途

常量 OVERLAY_CENTER,定义了相关的协议或算法配置参数。

查看用法示例

const OVERLAY_END

XuAPI
pub const OVERLAY_END = 2

用途

常量 OVERLAY_END,定义了相关的协议或算法配置参数。

struct OverlayPlacement

XuAPI
pub struct OverlayPlacement {
    pub side int
    pub align int
    pub gap f64
    pub offset f64
    pub flip bool
}

用途

承载 side、align、gap、offset、flip 等属性的结构体。

公开字段

side int
字段(int)
align int
字段(int)
gap f64
字段(f64)
offset f64
偏移
flip bool
字段(bool)

overlay_placement

XuAPI
pub fn overlay_placement() OverlayPlacement

用途

执行 overlay placement 操作。

参数

无需传入参数。

返回值

OverlayPlacement — 该类型的值

查看用法示例

placed_overlay_bounds

XuAPI
pub fn placed_overlay_bounds(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect,placement &OverlayPlacement) layout.Rect

用途

执行 placed overlay bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

anchor &layout.Rect
anchor(只读借用,调用方仍持有原值;类型 &layout.Rect)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)
placement &OverlayPlacement
placement(只读借用,调用方仍持有原值;类型 &OverlayPlacement)

返回值

layout.Rect — 该类型的值

($&Popover) set_placement

XuAPI
pub fn (panel $&Popover) set_placement(placement &OverlayPlacement) int

用途

$&Popover 上的操作:设置 placement。失败时抛出错误,调用方需处理或继续传播。

参数

panel $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
placement &OverlayPlacement
placement(只读借用,调用方仍持有原值;类型 &OverlayPlacement)

返回值

int — 该类型的值

($&Popover) set_dismissal

XuAPI
pub fn (panel $&Popover) set_dismissal(outside bool,escape bool)

用途

$&Popover 上的操作:设置 dismissal。

参数

panel $&Popover
本次调用使用的 Popover 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
outside bool
outside(bool)
escape bool
escape(bool)

返回值

不返回值。

($&Screen) set_popover_placement

XuAPI
pub fn (s $&Screen) set_popover_placement(id int,placement &OverlayPlacement) int

用途

$&Screen 上的操作:设置 popover placement。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
placement &OverlayPlacement
placement(只读借用,调用方仍持有原值;类型 &OverlayPlacement)

返回值

int — 该类型的值

($&Screen) set_tooltip_placement

XuAPI
pub fn (s $&Screen) set_tooltip_placement(id int,placement &OverlayPlacement) int

用途

$&Screen 上的操作:设置 tooltip placement。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
placement &OverlayPlacement
placement(只读借用,调用方仍持有原值;类型 &OverlayPlacement)

返回值

int — 该类型的值

($&Screen) set_popover_dismissal

XuAPI
pub fn (s $&Screen) set_popover_dismissal(id int,outside bool,escape bool) int

用途

$&Screen 上的操作:设置 popover dismissal。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
outside bool
outside(bool)
escape bool
escape(bool)

返回值

int — 该类型的值

struct RadioGroup

XuAPI
pub struct RadioGroup {

}

用途

RadioGroup 上下文或状态结构体。

公开字段

此类型没有公开字段。

radio_group

XuAPI
pub fn radio_group(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,options &[]string,selected int) RadioGroup

用途

执行 radio group 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
selected int
selected(int)

返回值

RadioGroup — 该类型的值

(&RadioGroup) id

XuAPI
pub fn (g &RadioGroup) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&RadioGroup) bounds

XuAPI
pub fn (g &RadioGroup) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&RadioGroup) count

XuAPI
pub fn (g &RadioGroup) count() int

用途

返回该控件当前包含的项目数量。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&RadioGroup) selected

XuAPI
pub fn (g &RadioGroup) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&RadioGroup) needs_paint

XuAPI
pub fn (g &RadioGroup) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&RadioGroup) is_enabled

XuAPI
pub fn (g &RadioGroup) is_enabled() bool

用途

返回控件当前是否可用。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&RadioGroup) is_selectable

XuAPI
pub fn (g &RadioGroup) is_selectable() bool

用途

&RadioGroup 上的操作:判断是否 selectable。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&RadioGroup) set_selectable

XuAPI
pub fn (g $&RadioGroup) set_selectable(selectable bool)

用途

$&RadioGroup 上的操作:设置 selectable。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&RadioGroup) is_focused

XuAPI
pub fn (g &RadioGroup) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&RadioGroup) set_horizontal

XuAPI
pub fn (g $&RadioGroup) set_horizontal(horizontal bool)

用途

$&RadioGroup 上的操作:设置 horizontal。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
horizontal bool
horizontal(bool)

返回值

不返回值。

($&RadioGroup) set_focus

XuAPI
pub fn (g $&RadioGroup) set_focus(focused bool)

用途

$&RadioGroup 上的操作:设置 focus。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&RadioGroup) set_enabled

XuAPI
pub fn (g $&RadioGroup) set_enabled(enabled bool)

用途

$&RadioGroup 上的操作:设置 enabled。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&RadioGroup) set_read_only

XuAPI
pub fn (g $&RadioGroup) set_read_only(value bool)

用途

$&RadioGroup 上的操作:设置 read only。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&RadioGroup) set_selected

XuAPI
pub fn (g $&RadioGroup) set_selected(index int) int

用途

$&RadioGroup 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&RadioGroup) set_bounds

XuAPI
pub fn (g $&RadioGroup) set_bounds(bounds &layout.Rect) int

用途

$&RadioGroup 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&RadioGroup) style_or

XuAPI
pub fn (g &RadioGroup) style_or(styles &Styles) ControlStyle

用途

&RadioGroup 上的操作:执行 style or 操作。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&RadioGroup) set_style

XuAPI
pub fn (g $&RadioGroup) set_style(style &ControlStyle) int

用途

$&RadioGroup 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&RadioGroup) painted

XuAPI
pub fn (g $&RadioGroup) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&RadioGroup) cancel

XuAPI
pub fn (g $&RadioGroup) cancel()

用途

$&RadioGroup 上的操作:取消。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&RadioGroup) item_bounds

XuAPI
pub fn (g &RadioGroup) item_bounds(index int) layout.Rect

用途

&RadioGroup 上的操作:执行 item bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

g &RadioGroup
本次调用使用的 RadioGroup 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

($&RadioGroup) input

XuAPI
pub fn (g $&RadioGroup) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&RadioGroup) route

XuAPI
pub fn (g $&RadioGroup) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&RadioGroup) measure_styled

XuAPI
pub fn (g $&RadioGroup) measure_styled(styles &Styles) layout.Size

用途

$&RadioGroup 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&RadioGroup) paint_styled

XuAPI
pub fn (g $&RadioGroup) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&RadioGroup 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&RadioGroup) dispose

XuAPI
pub fn (g $&RadioGroup) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

g $&RadioGroup
本次调用使用的 RadioGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

const RANGE_CLAMP

XuAPI
pub const RANGE_CLAMP = 0

用途

常量 RANGE_CLAMP,定义了相关的协议或算法配置参数。

const RANGE_PUSH

XuAPI
pub const RANGE_PUSH = 1

用途

常量 RANGE_PUSH,定义了相关的协议或算法配置参数。

查看用法示例

struct RangeValues

XuAPI
pub struct RangeValues {
    pub lower f64
    pub upper f64
    pub active int
}

用途

承载 lower、upper、active 等属性的结构体。

公开字段

lower f64
字段(f64)
upper f64
字段(f64)
active int
字段(int)

struct RangeSliderOptions

XuAPI
pub struct RangeSliderOptions {
    pub step f64
    pub min_distance f64
    pub collision int
    pub vertical bool
    pub reversed bool
    pub drag_range bool
    pub commit_only bool
}

用途

Widgets 配置参数与选项集合。

公开字段

step f64
字段(f64)
min_distance f64
字段(f64)
collision int
字段(int)
vertical bool
字段(bool)
reversed bool
字段(bool)
drag_range bool
字段(bool)
commit_only bool
字段(bool)

range_slider_options

XuAPI
pub fn range_slider_options() RangeSliderOptions

用途

执行 range slider options 操作。

参数

无需传入参数。

返回值

RangeSliderOptions — 该类型的值

查看用法示例

struct RangeSlider

XuAPI
pub struct RangeSlider {

}

用途

RangeSlider 上下文或状态结构体。

公开字段

此类型没有公开字段。

range_slider

XuAPI
pub fn range_slider(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,minimum f64,maximum f64,lower f64,upper f64) RangeSlider

用途

执行 range slider 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
minimum f64
minimum(f64)
maximum f64
maximum(f64)
lower f64
lower(f64)
upper f64
upper(f64)

返回值

RangeSlider — 该类型的值

(&RangeSlider) id

XuAPI
pub fn (r &RangeSlider) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&RangeSlider) bounds

XuAPI
pub fn (r &RangeSlider) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&RangeSlider) values

XuAPI
pub fn (r &RangeSlider) values() RangeValues

用途

返回当前集合、参数表或映射中所有值的切片。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。

返回值

RangeValues — 该类型的值

(&RangeSlider) needs_paint

XuAPI
pub fn (r &RangeSlider) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&RangeSlider) painted

XuAPI
pub fn (r $&RangeSlider) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&RangeSlider) is_enabled

XuAPI
pub fn (r &RangeSlider) is_enabled() bool

用途

返回控件当前是否可用。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&RangeSlider) style_or

XuAPI
pub fn (r &RangeSlider) style_or(styles &Styles) ControlStyle

用途

&RangeSlider 上的操作:执行 style or 操作。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&RangeSlider) set_values

XuAPI
pub fn (r $&RangeSlider) set_values(lower f64,upper f64) int

用途

$&RangeSlider 上的操作:设置 values。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
lower f64
lower(f64)
upper f64
upper(f64)

返回值

int — 该类型的值

($&RangeSlider) set_options

XuAPI
pub fn (r $&RangeSlider) set_options(o &RangeSliderOptions) int

用途

$&RangeSlider 上的操作:设置 options。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
o &RangeSliderOptions
o(只读借用,调用方仍持有原值;类型 &RangeSliderOptions)

返回值

int — 该类型的值

($&RangeSlider) set_appearance

XuAPI
pub fn (r $&RangeSlider) set_appearance(a &SliderAppearance) int

用途

$&RangeSlider 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
a &SliderAppearance
值(只读借用,调用方仍持有原值;类型 &SliderAppearance)

返回值

int — 该类型的值

($&RangeSlider) set_locale

XuAPI
pub fn (r $&RangeSlider) set_locale(locale &Locale) int

用途

$&RangeSlider 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&RangeSlider) set_style

XuAPI
pub fn (r $&RangeSlider) set_style(style &ControlStyle) int

用途

$&RangeSlider 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&RangeSlider) clear_style

XuAPI
pub fn (r $&RangeSlider) clear_style()

用途

$&RangeSlider 上的操作:执行 clear style 操作。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&RangeSlider) set_motion

XuAPI
pub fn (r $&RangeSlider) set_motion(spec &MotionSpec) int

用途

$&RangeSlider 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&RangeSlider) cancel

XuAPI
pub fn (r $&RangeSlider) cancel()

用途

$&RangeSlider 上的操作:取消。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&RangeSlider) set_focus

XuAPI
pub fn (r $&RangeSlider) set_focus(value bool)

用途

$&RangeSlider 上的操作:设置 focus。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&RangeSlider) set_enabled

XuAPI
pub fn (r $&RangeSlider) set_enabled(value bool)

用途

$&RangeSlider 上的操作:设置 enabled。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&RangeSlider) set_read_only

XuAPI
pub fn (r $&RangeSlider) set_read_only(value bool)

用途

$&RangeSlider 上的操作:设置 read only。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&RangeSlider) set_bounds

XuAPI
pub fn (r $&RangeSlider) set_bounds(b &layout.Rect) int

用途

$&RangeSlider 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
b &layout.Rect
b(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&RangeSlider) dispose

XuAPI
pub fn (r $&RangeSlider) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&RangeSlider) tab

XuAPI
pub fn (r $&RangeSlider) tab(backward bool,entering bool) bool

用途

在 $&RangeSlider 上执行 tab 操作。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
backward bool
backward(bool)
entering bool
entering(bool)

返回值

bool — 是否成立

($&RangeSlider) input

XuAPI
pub fn (r $&RangeSlider) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&RangeSlider) route

XuAPI
pub fn (r $&RangeSlider) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&RangeSlider) apply_styles

XuAPI
pub fn (r $&RangeSlider) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&RangeSlider) tick

XuAPI
pub fn (r $&RangeSlider) tick(styles &Styles,now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&RangeSlider) next_tick

XuAPI
pub fn (r &RangeSlider) next_tick(now time.Instant) time.Instant

用途

&RangeSlider 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

r &RangeSlider
本次调用使用的 RangeSlider 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&RangeSlider) paint_styled

XuAPI
pub fn (r $&RangeSlider) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&RangeSlider 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

r $&RangeSlider
本次调用使用的 RangeSlider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

const SPAN_NORMAL

XuAPI
pub const SPAN_NORMAL = 0

用途

常量 SPAN_NORMAL,定义了相关的协议或算法配置参数。

const SPAN_BOLD

XuAPI
pub const SPAN_BOLD = 1

用途

常量 SPAN_BOLD,定义了相关的协议或算法配置参数。

const SPAN_ITALIC

XuAPI
pub const SPAN_ITALIC = 2

用途

常量 SPAN_ITALIC,定义了相关的协议或算法配置参数。

const SPAN_CODE

XuAPI
pub const SPAN_CODE = 4

用途

常量 SPAN_CODE,定义了相关的协议或算法配置参数。

const SPAN_UNDERLINE

XuAPI
pub const SPAN_UNDERLINE = 8

用途

常量 SPAN_UNDERLINE,定义了相关的协议或算法配置参数。

const SPAN_STRIKETHROUGH

XuAPI
pub const SPAN_STRIKETHROUGH = 16

用途

常量 SPAN_STRIKETHROUGH,定义了相关的协议或算法配置参数。

struct TextSpan

XuAPI
pub struct TextSpan {
    pub text string
    pub flags int
    pub link_url string
    pub color draw.Color
}

用途

承载 text、flags、link_url、color 等属性的结构体。

公开字段

text string
文本
flags int
字段(int)
link_url string
字段(string)
color draw.Color
字段(draw.Color)

text_span

XuAPI
pub fn text_span(text string, flags int) TextSpan

用途

执行 text span 操作。

参数

text string
文本(string)
flags int
flags(int)

返回值

TextSpan — 该类型的值

(&TextSpan) has_flag

XuAPI
pub fn (span &TextSpan) has_flag(flag int) bool

用途

&TextSpan 上的操作:判断是否具有 flag。

参数

span &TextSpan
本次调用使用的 TextSpan 实例;以只读借用传入,调用方仍持有实例。
flag int
flag(int)

返回值

bool — 是否成立

($&TextSpan) toggle_flag

XuAPI
pub fn (span $&TextSpan) toggle_flag(flag int)

用途

$&TextSpan 上的操作:执行 toggle flag 操作。

参数

span $&TextSpan
本次调用使用的 TextSpan 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
flag int
flag(int)

返回值

不返回值。

(&TextSpan) clone

XuAPI
pub fn (span &TextSpan) clone() TextSpan

用途

复制控件或样式快照,返回独立的 TextSpan 值。

参数

span &TextSpan
本次调用使用的 TextSpan 实例;以只读借用传入,调用方仍持有实例。

返回值

TextSpan — 该类型的值

struct RichParagraph

XuAPI
pub struct RichParagraph {
    pub spans []TextSpan
    pub heading_level int
}

用途

承载 spans、heading_level 等属性的结构体。

公开字段

spans []TextSpan
字段([]TextSpan)
heading_level int
字段(int)

rich_paragraph

XuAPI
pub fn rich_paragraph(heading int) RichParagraph

用途

执行 rich paragraph 操作。

参数

heading int
heading(int)

返回值

RichParagraph — 该类型的值

(&RichParagraph) text

XuAPI
pub fn (p &RichParagraph) text() string

用途

&RichParagraph 上的操作:返回当前文本。

参数

p &RichParagraph
本次调用使用的 RichParagraph 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&RichParagraph) append_span

XuAPI
pub fn (p $&RichParagraph) append_span(span TextSpan)

用途

$&RichParagraph 上的操作:执行 append span 操作。

参数

p $&RichParagraph
本次调用使用的 RichParagraph 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
span TextSpan
span(TextSpan)

返回值

不返回值。

struct RichDocument

XuAPI
pub struct RichDocument {
    pub paragraphs []RichParagraph
    pub anchor int
    pub focus int
}

用途

承载 paragraphs、anchor、focus 等属性的结构体。

公开字段

paragraphs []RichParagraph
字段([]RichParagraph)
anchor int
字段(int)
focus int
字段(int)

rich_document

XuAPI
pub fn rich_document() RichDocument

用途

执行 rich document 操作。

参数

无需传入参数。

返回值

RichDocument — 该类型的值

(&RichDocument) is_empty

XuAPI
pub fn (doc &RichDocument) is_empty() bool

用途

&RichDocument 上的操作:判断是否 empty。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&RichDocument) append_paragraph

XuAPI
pub fn (doc $&RichDocument) append_paragraph(heading int) int

用途

$&RichDocument 上的操作:执行 append paragraph 操作。

参数

doc $&RichDocument
本次调用使用的 RichDocument 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
heading int
heading(int)

返回值

int — 该类型的值

($&RichDocument) append_span

XuAPI
pub fn (doc $&RichDocument) append_span(para_idx int, span TextSpan) int

用途

$&RichDocument 上的操作:执行 append span 操作。失败时抛出错误,调用方需处理或继续传播。

参数

doc $&RichDocument
本次调用使用的 RichDocument 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
para_idx int
para_idx(int)
span TextSpan
span(TextSpan)

返回值

int — 该类型的值

(&RichDocument) to_plain_text

XuAPI
pub fn (doc &RichDocument) to_plain_text() string

用途

&RichDocument 上的操作:转换为 plain text。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&RichDocument) char_count

XuAPI
pub fn (doc &RichDocument) char_count() int

用途

&RichDocument 上的操作:执行 char count 操作。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&RichDocument) set_selection

XuAPI
pub fn (doc $&RichDocument) set_selection(anchor int, focus int)

用途

$&RichDocument 上的操作:设置 selection。

参数

doc $&RichDocument
本次调用使用的 RichDocument 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
anchor int
anchor(int)
focus int
focus(int)

返回值

不返回值。

(&RichDocument) has_selection

XuAPI
pub fn (doc &RichDocument) has_selection() bool

用途

&RichDocument 上的操作:判断是否具有 selection。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&RichDocument) is_copy_enabled

XuAPI
pub fn (doc &RichDocument) is_copy_enabled() bool

用途

&RichDocument 上的操作:判断是否 copy enabled。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&RichDocument) set_copy_enabled

XuAPI
pub fn (doc $&RichDocument) set_copy_enabled(on bool)

用途

$&RichDocument 上的操作:设置 copy enabled。

参数

doc $&RichDocument
本次调用使用的 RichDocument 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

不返回值。

(&RichDocument) selection_range

XuAPI
pub fn (doc &RichDocument) selection_range() TextRange

用途

&RichDocument 上的操作:执行 selection range 操作。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

TextRange — 该类型的值

(&RichDocument) selected_text

XuAPI
pub fn (doc &RichDocument) selected_text() string

用途

&RichDocument 上的操作:执行 selected text 操作。

参数

doc &RichDocument
本次调用使用的 RichDocument 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

const SCREEN_SECRET_INPUT

XuAPI
pub const SCREEN_SECRET_INPUT = 35

用途

常量 SCREEN_SECRET_INPUT,定义了相关的协议或算法配置参数。

const SCREEN_SELECTABLE_TEXT

XuAPI
pub const SCREEN_SELECTABLE_TEXT = 40

用途

常量 SCREEN_SELECTABLE_TEXT,定义了相关的协议或算法配置参数。

const ACTION_KEY

XuAPI
pub const ACTION_KEY = 5

用途

常量 ACTION_KEY,定义了相关的协议或算法配置参数。

查看用法示例

struct ScreenNodeInfo

XuAPI
pub struct ScreenNodeInfo {
    pub id int
    pub kind int
    pub parent int
    pub x f64
    pub y f64
    pub width f64
    pub height f64
    pub visible bool
    pub enabled bool
    pub focusable bool
    pub focused bool
    pub text string
    pub secure bool
}

用途

承载 id、kind、parent、x、y 等属性的结构体。

公开字段

id int
字段(int)
kind int
类型标签
parent int
字段(int)
x f64
值
y f64
值
width f64
字段(f64)
height f64
字段(f64)
visible bool
字段(bool)
enabled bool
字段(bool)
focusable bool
字段(bool)
focused bool
字段(bool)
text string
文本
secure bool
字段(bool)

const XACP_MAX_NODES

XuAPI
pub const XACP_MAX_NODES = 512

用途

常量 XACP_MAX_NODES,定义了相关的协议或算法配置参数。

const XACP_MAX_NODE_TEXT

XuAPI
pub const XACP_MAX_NODE_TEXT = 65536

用途

常量 XACP_MAX_NODE_TEXT,定义了相关的协议或算法配置参数。

struct Screen

XuAPI
pub struct Screen {

}

用途

Screen 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

screen

XuAPI
pub fn screen(ready &ui.Event) Screen

用途

执行 screen 处理。失败时抛出错误,调用方需处理或继续传播。

参数

ready &ui.Event
ready(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Screen — 该类型的值

查看用法示例

(&Screen) is_open

XuAPI
pub fn (s &Screen) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Screen) xacp_window_id

XuAPI
pub fn (s &Screen) xacp_window_id() int

用途

&Screen 上的操作:执行 xacp window id 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Screen) xacp_canvas_id

XuAPI
pub fn (s &Screen) xacp_canvas_id() int

用途

&Screen 上的操作:执行 xacp canvas id 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Screen) xacp_generation

XuAPI
pub fn (s &Screen) xacp_generation() int

用途

&Screen 上的操作:执行 xacp generation 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Screen) xacp_close_events

XuAPI
pub fn (s &Screen) xacp_close_events() chan int

用途

&Screen 上的操作:执行 xacp close events 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

chan int — 该类型的值

(&Screen) width

XuAPI
pub fn (s &Screen) width() f64

用途

在 &Screen 上执行 width 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Screen) height

XuAPI
pub fn (s &Screen) height() f64

用途

在 &Screen 上执行 height 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Screen) focused

XuAPI
pub fn (s &Screen) focused() int

用途

在 &Screen 上执行 focused 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Screen) reduced_motion

XuAPI
pub fn (s &Screen) reduced_motion() bool

用途

&Screen 上的操作:执行 reduced motion 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Screen) viewport

XuAPI
pub fn (s &Screen) viewport() layout.Rect

用途

在 &Screen 上执行 viewport 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Screen) invalidate

XuAPI
pub fn (s $&Screen) invalidate()

用途

标记控件区域为脏,请求系统在下一帧重新绘制。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Screen) resize

XuAPI
pub fn (s $&Screen) resize(width f64,height f64) int

用途

在 $&Screen 上执行 resize 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
width f64
width(f64)
height f64
height(f64)

返回值

int — 该类型的值

($&Screen) set_min_size

XuAPI
pub fn (s $&Screen) set_min_size(width int,height int) int

用途

$&Screen 上的操作:设置 min size。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
width int
width(int)
height int
height(int)

返回值

int — 该类型的值

($&Screen) set_styles

XuAPI
pub fn (s $&Screen) set_styles(styles &Styles) int

用途

$&Screen 上的操作:设置 styles。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Screen) styles

XuAPI
pub fn (s &Screen) styles() Styles

用途

在 &Screen 上执行 styles 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

Styles — 该类型的值

(&Screen) row_height

XuAPI
pub fn (s &Screen) row_height() f64

用途

&Screen 上的操作:执行 row height 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

($&Screen) set_reduced_motion

XuAPI
pub fn (s $&Screen) set_reduced_motion(reduced bool)

用途

$&Screen 上的操作:设置 reduced motion。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
reduced bool
reduced(bool)

返回值

不返回值。

($&Screen) group

XuAPI
pub fn (s $&Screen) group() int

用途

在 $&Screen 上执行 group 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&Screen) button

XuAPI
pub fn (s $&Screen) button(text string) int

用途

在 Screen 中创建 Button,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) label

XuAPI
pub fn (s $&Screen) label(text string,size f64,muted bool) int

用途

在 Screen 中创建 StyledLabel,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)
size f64
size(f64)
muted bool
muted(bool)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_text

XuAPI
pub fn (s $&Screen) set_text(id int,text string) int

用途

$&Screen 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
text string
文本(string)

返回值

int — 该类型的值

($&Screen) set_selected_button

XuAPI
pub fn (s $&Screen) set_selected_button(id int,selected bool) int

用途

$&Screen 上的操作:设置 selected button。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
selected bool
selected(bool)

返回值

int — 该类型的值

(&Screen) is_descendant

XuAPI
pub fn (s &Screen) is_descendant(id int,parent int) bool

用途

&Screen 上的操作:判断是否 descendant。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)
parent int
parent(int)

返回值

bool — 是否成立

(&Screen) is_visible

XuAPI
pub fn (s &Screen) is_visible(id int) bool

用途

&Screen 上的操作:判断是否 visible。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Screen) set_parent

XuAPI
pub fn (s $&Screen) set_parent(id int,parent int) int

用途

$&Screen 上的操作:设置 parent。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
parent int
parent(int)

返回值

int — 该类型的值

($&Screen) set_visible

XuAPI
pub fn (s $&Screen) set_visible(id int,visible bool) int

用途

$&Screen 上的操作:设置 visible。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
visible bool
visible(bool)

返回值

int — 该类型的值

($&Screen) set_enabled

XuAPI
pub fn (s $&Screen) set_enabled(id int,enabled bool) int

用途

$&Screen 上的操作:设置 enabled。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) place

XuAPI
pub fn (s $&Screen) place(id int,x f64,y f64,width f64,height f64) int

用途

在画布中计算并设置控件的局部几何布局坐标与尺寸。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
x f64
值(f64)
y f64
值(f64)
width f64
width(f64)
height f64
height(f64)

返回值

int — 该类型的值

(&Screen) bounds

XuAPI
pub fn (s &Screen) bounds(id int) layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。失败时抛出错误,调用方需处理或继续传播。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

layout.Rect — 该类型的值

($&Screen) xacp_tree

XuAPI
pub fn (s $&Screen) xacp_tree(include_hidden bool,max_rows int) []ScreenNodeInfo

用途

$&Screen 上的操作:执行 xacp tree 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
include_hidden bool
include_hidden(bool)
max_rows int
max_rows(int)

返回值

[]ScreenNodeInfo — 切片结果

($&Screen) xacp_input

XuAPI
pub fn (s $&Screen) xacp_input(events &[]ui.InputEvent,max_events int) []Action

用途

$&Screen 上的操作:执行 xacp input 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
events &[]ui.InputEvent
events(只读借用,调用方仍持有原值;类型 &[]ui.InputEvent)
max_events int
max_events(int)

返回值

[]Action — 切片结果

($&Screen) xacp_act

XuAPI
pub fn (s $&Screen) xacp_act(id int,act string,text string,checked bool) []Action

用途

$&Screen 上的操作:执行 xacp act 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
act string
act(string)
text string
文本(string)
checked bool
checked(bool)

返回值

[]Action — 切片结果

($&Screen) cancel_all

XuAPI
pub fn (s $&Screen) cancel_all() int

用途

$&Screen 上的操作:执行 cancel all 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&Screen) focus

XuAPI
pub fn (s $&Screen) focus(id int) int

用途

在 $&Screen 上执行 focus 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) render

XuAPI
pub fn (s $&Screen) render() bool

用途

在 $&Screen 上执行 render 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&Screen) export_xdf

XuAPI
pub fn (s $&Screen) export_xdf() string

用途

$&Screen 上的操作:执行 export xdf 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

string — 结果字符串

($&Screen) snapshot

XuAPI
pub fn (s $&Screen) snapshot(scale f64) draw.Surface

用途

在 $&Screen 上执行 snapshot 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
scale f64
scale(f64)

返回值

draw.Surface — 该类型的值

($&Screen) snapshot_node

XuAPI
pub fn (s $&Screen) snapshot_node(id int,scale f64) draw.Surface

用途

$&Screen 上的操作:执行 snapshot node 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
scale f64
scale(f64)

返回值

draw.Surface — 该类型的值

($&Screen) advance

XuAPI
pub fn (s $&Screen) advance(now time.Instant) time.Instant

用途

在 $&Screen 上执行 advance 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&Screen) dispatch

XuAPI
pub fn (s $&Screen) dispatch(input &ui.InputEvent) []Action

用途

在 $&Screen 上执行 dispatch 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

[]Action — 切片结果

($&Screen) event

XuAPI
pub fn (s $&Screen) event(event &ui.Event) []Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

[]Action — 切片结果

($&Screen) next

XuAPI
pub fn (s $&Screen) next(events chan ui.Event) []Action

用途

$&Screen 上的操作:取出下一项;没有则按本类型约定结束。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
events chan ui.Event
events(通道;类型 chan ui.Event)

返回值

[]Action — 切片结果

($&Screen) close

XuAPI
pub fn (s $&Screen) close() int

用途

$&Screen 上的操作:关闭资源。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&Screen) dispose

XuAPI
pub fn (s $&Screen) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

struct@ ScreenHandler

XuAPI
pub struct@ ScreenHandler {
    fn layout($&Screen) int
    fn update($&Screen,Action) int
}

用途

方法集契约约束 ScreenHandler,实现类型须提供其定义的方法。

要求的方法

layout fn layout($&Screen) int
在 ScreenHandler 上执行 layout 操作。
update fn update($&Screen,Action) int
ScreenHandler 上的操作:更新。

(ScreenHandler) layout

XuAPI
fn layout($&Screen) int

用途

在 ScreenHandler 上执行 layout 操作。

参数

self Self
本次调用使用的 Self 实例;按值接收。
screen $&Screen
screen(独占借用,可修改原值;类型 $&Screen)

返回值

int — 该类型的值

(ScreenHandler) update

XuAPI
fn update($&Screen,Action) int

用途

ScreenHandler 上的操作:更新。

参数

self Self
本次调用使用的 Self 实例;按值接收。
screen $&Screen
screen(独占借用,可修改原值;类型 $&Screen)
action Action
action(Action)

返回值

int — 该类型的值

run_screen

XuAPI
pub fn run_screen#H:ScreenHandler(s $&Screen,events chan ui.Event,handler $&H,tables <-> ActionDispatcher#H,Screen,Action) int

用途

执行 run screen 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
s(独占借用,可修改原值;类型 $&Screen)
events chan ui.Event
events(通道;类型 chan ui.Event)
handler $&H
handler(独占借用,可修改原值;类型 $&H)
tables <-> ActionDispatcher#H
可变参数,类型 ActionDispatcher#H,在函数体内是 []ActionDispatcher#H
screen Screen
screen(Screen)
action Action
action(Action)

返回值

int — 该类型的值

($&Screen) take_actions

XuAPI
pub fn (s $&Screen) take_actions() []Action

用途

$&Screen 上的操作:执行 take actions 操作。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

[]Action — 切片结果

($&Screen) set_tree_appearance

XuAPI
pub fn (s $&Screen) set_tree_appearance(id int,appearance &TreeAppearance) int

用途

$&Screen 上的操作:设置 tree appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &TreeAppearance
appearance(只读借用,调用方仍持有原值;类型 &TreeAppearance)

返回值

int — 该类型的值

($&Screen) set_tree_metadata

XuAPI
pub fn (s $&Screen) set_tree_metadata(id int,node int,value string) int

用途

$&Screen 上的操作:设置 tree metadata。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
node int
node(int)
value string
value(string)

返回值

int — 该类型的值

($&Screen) set_tree_action

XuAPI
pub fn (s $&Screen) set_tree_action(id int,node int,enabled bool) int

用途

$&Screen 上的操作:设置 tree action。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
node int
node(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) set_tree_filter

XuAPI
pub fn (s $&Screen) set_tree_filter(id int,query string) int

用途

$&Screen 上的操作:设置 tree filter。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
query string
query(string)

返回值

int — 该类型的值

($&Screen) set_field_invalid

XuAPI
pub fn (s $&Screen) set_field_invalid(id int,invalid bool) int

用途

$&Screen 上的操作:设置 field invalid。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
invalid bool
invalid(bool)

返回值

int — 该类型的值

($&Screen) set_field_read_only

XuAPI
pub fn (s $&Screen) set_field_read_only(id int,read_only bool) int

用途

$&Screen 上的操作:设置 field read only。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&Screen) set_task_labels

XuAPI
pub fn (s $&Screen) set_task_labels(id int,running string,success string,error string,cancelled string) int

用途

$&Screen 上的操作:设置 task labels。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
running string
running(string)
success string
success(string)
error string
error(string)
cancelled string
cancelled(string)

返回值

int — 该类型的值

($&Screen) checkbox

XuAPI
pub fn (s $&Screen) checkbox(text string,checked bool) int

用途

在 Screen 中创建 Checkbox,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)
checked bool
checked(bool)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) switch_control

XuAPI
pub fn (s $&Screen) switch_control(text string,checked bool) int

用途

在 Screen 中创建 Switch,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)
checked bool
checked(bool)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) radio

XuAPI
pub fn (s $&Screen) radio(text string,option int,checked bool) int

用途

在 Screen 中创建 Radio,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)
option int
option(int)
checked bool
checked(bool)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) slider

XuAPI
pub fn (s $&Screen) slider(minimum f64,maximum f64,value f64) int

用途

在 Screen 中创建 Slider,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
minimum f64
minimum(f64)
maximum f64
maximum(f64)
value f64
value(f64)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) stepper

XuAPI
pub fn (s $&Screen) stepper(minimum f64,maximum f64,step f64,value f64) int

用途

在 Screen 中创建 Stepper,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
minimum f64
minimum(f64)
maximum f64
maximum(f64)
step f64
step(f64)
value f64
value(f64)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) tabs

XuAPI
pub fn (s $&Screen) tabs(options &[]string,selected int) int

用途

在 Screen 中创建 Tabs,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
selected int
selected(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) select_box

XuAPI
pub fn (s $&Screen) select_box(options &[]string,selected int) int

用途

在 Screen 中创建 Select,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
selected int
selected(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) list_box

XuAPI
pub fn (s $&Screen) list_box(options &[]string,selected int) int

用途

在 Screen 中创建 ListBox,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
selected int
selected(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) progress

XuAPI
pub fn (s $&Screen) progress(value f64) int

用途

在 Screen 中创建 Progress,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) divider

XuAPI
pub fn (s $&Screen) divider(axis int) int

用途

在 Screen 中创建 Divider,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
axis int
axis(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) badge

XuAPI
pub fn (s $&Screen) badge(text string) int

用途

在 Screen 中创建 Badge,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) card

XuAPI
pub fn (s $&Screen) card() int

用途

在 Screen 中创建 Card,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) segmented

XuAPI
pub fn (s $&Screen) segmented(options &[]string,selected int) int

用途

在 Screen 中创建 Segmented,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
selected int
selected(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) toggle_value

XuAPI
pub fn (s $&Screen) toggle_value(id int) bool

用途

$&Screen 上的操作:执行 toggle value 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Screen) number_value

XuAPI
pub fn (s $&Screen) number_value(id int) f64

用途

$&Screen 上的操作:执行 number value 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

f64 — 该类型的值

($&Screen) set_toggle_value

XuAPI
pub fn (s $&Screen) set_toggle_value(id int,checked bool) int

用途

$&Screen 上的操作:设置 toggle value。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
checked bool
checked(bool)

返回值

int — 该类型的值

($&Screen) set_number_value

XuAPI
pub fn (s $&Screen) set_number_value(id int,value f64) int

用途

$&Screen 上的操作:设置 number value。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value f64
value(f64)

返回值

int — 该类型的值

($&Screen) radio_group

XuAPI
pub fn (s $&Screen) radio_group(options &[]string,selected int) int

用途

在 Screen 中创建 RadioGroup,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
selected int
selected(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_candidate_open

XuAPI
pub fn (s $&Screen) set_candidate_open(id int,open bool) int

用途

$&Screen 上的操作:设置 candidate open。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
open bool
open(bool)

返回值

int — 该类型的值

($&Screen) set_chart_series

XuAPI
pub fn (s $&Screen) set_chart_series(id int,series &[]chart.ChartSeries) int

用途

$&Screen 上的操作:设置 chart series。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
series &[]chart.ChartSeries
series(只读借用,调用方仍持有原值;类型 &[]chart.ChartSeries)

返回值

int — 该类型的值

($&Screen) set_chart_appearance

XuAPI
pub fn (s $&Screen) set_chart_appearance(id int,appearance &chart.ChartAppearance) int

用途

$&Screen 上的操作:设置 chart appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &chart.ChartAppearance
appearance(只读借用,调用方仍持有原值;类型 &chart.ChartAppearance)

返回值

int — 该类型的值

($&Screen) set_chart_domain

XuAPI
pub fn (s $&Screen) set_chart_domain(id int,domain &chart.ChartDomain) int

用途

$&Screen 上的操作:设置 chart domain。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
domain &chart.ChartDomain
domain(只读借用,调用方仍持有原值;类型 &chart.ChartDomain)

返回值

int — 该类型的值

($&Screen) set_chart_viewport

XuAPI
pub fn (s $&Screen) set_chart_viewport(id int,view &chart.ChartDomain) int

用途

$&Screen 上的操作:设置 chart viewport。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
view &chart.ChartDomain
view(只读借用,调用方仍持有原值;类型 &chart.ChartDomain)

返回值

int — 该类型的值

($&Screen) set_chart_animation

XuAPI
pub fn (s $&Screen) set_chart_animation(id int,options &AnimationOptions) int

用途

$&Screen 上的操作:设置 chart animation。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
options &AnimationOptions
options(只读借用,调用方仍持有原值;类型 &AnimationOptions)

返回值

int — 该类型的值

($&Screen) seek_chart_animation

XuAPI
pub fn (s $&Screen) seek_chart_animation(id int,progress f64) int

用途

$&Screen 上的操作:执行 seek chart animation 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
progress f64
progress(f64)

返回值

int — 该类型的值

($&Screen) pause_chart_animation

XuAPI
pub fn (s $&Screen) pause_chart_animation(id int) int

用途

$&Screen 上的操作:执行 pause chart animation 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) resume_chart_animation

XuAPI
pub fn (s $&Screen) resume_chart_animation(id int) int

用途

$&Screen 上的操作:执行 resume chart animation 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) reset_chart_viewport

XuAPI
pub fn (s $&Screen) reset_chart_viewport(id int) int

用途

$&Screen 上的操作:执行 reset chart viewport 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) use_chart_auto_domain

XuAPI
pub fn (s $&Screen) use_chart_auto_domain(id int) int

用途

$&Screen 上的操作:执行 use chart auto domain 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) select_chart_point

XuAPI
pub fn (s $&Screen) select_chart_point(id int,series_id int,point_id int) int

用途

$&Screen 上的操作:执行 select chart point 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
series_id int
series_id(int)
point_id int
point_id(int)

返回值

int — 该类型的值

($&Screen) set_chart_series_visible

XuAPI
pub fn (s $&Screen) set_chart_series_visible(id int,series_id int,visible bool) int

用途

$&Screen 上的操作:设置 chart series visible。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
series_id int
series_id(int)
visible bool
visible(bool)

返回值

int — 该类型的值

($&Screen) chart_locale

XuAPI
pub fn (s $&Screen) chart_locale(id int,locale &Locale) int

用途

$&Screen 上的操作:执行 chart locale 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Screen) chart_hovered

XuAPI
pub fn (s $&Screen) chart_hovered(id int) chart.ChartHit

用途

$&Screen 上的操作:执行 chart hovered 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

chart.ChartHit — 该类型的值

($&Screen) chart_selection

XuAPI
pub fn (s $&Screen) chart_selection(id int) chart.ChartHit

用途

$&Screen 上的操作:执行 chart selection 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

chart.ChartHit — 该类型的值

($&Screen) chart_viewport

XuAPI
pub fn (s $&Screen) chart_viewport(id int) chart.ChartDomain

用途

$&Screen 上的操作:执行 chart viewport 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

chart.ChartDomain — 该类型的值

($&Screen) chart_animation_progress

XuAPI
pub fn (s $&Screen) chart_animation_progress(id int) f64

用途

$&Screen 上的操作:执行 chart animation progress 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

f64 — 该类型的值

($&Screen) set_button_group_items

XuAPI
pub fn (s $&Screen) set_button_group_items(id int,items &[]ButtonGroupItem) int

用途

$&Screen 上的操作:设置 button group items。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
items &[]ButtonGroupItem
元素列表(只读借用,调用方仍持有原值;类型 &[]ButtonGroupItem)

返回值

int — 该类型的值

($&Screen) set_button_group_appearance

XuAPI
pub fn (s $&Screen) set_button_group_appearance(id int,appearance &ButtonGroupAppearance) int

用途

$&Screen 上的操作:设置 button group appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &ButtonGroupAppearance
appearance(只读借用,调用方仍持有原值;类型 &ButtonGroupAppearance)

返回值

int — 该类型的值

($&Screen) set_button_group_item_enabled

XuAPI
pub fn (s $&Screen) set_button_group_item_enabled(id int,key int,enabled bool) int

用途

$&Screen 上的操作:设置 button group item enabled。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) set_button_group_label

XuAPI
pub fn (s $&Screen) set_button_group_label(id int,key int,label string) int

用途

$&Screen 上的操作:设置 button group label。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)
label string
label(string)

返回值

int — 该类型的值

($&Screen) set_button_group_checked

XuAPI
pub fn (s $&Screen) set_button_group_checked(id int,key int,selected bool) int

用途

$&Screen 上的操作:设置 button group checked。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)
selected bool
selected(bool)

返回值

int — 该类型的值

($&Screen) button_group_values

XuAPI
pub fn (s $&Screen) button_group_values(id int) []int

用途

$&Screen 上的操作:执行 button group values 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

[]int — 切片结果

($&Screen) button_group_active

XuAPI
pub fn (s $&Screen) button_group_active(id int) int

用途

$&Screen 上的操作:执行 button group active 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) chart_position

XuAPI
pub fn (s $&Screen) chart_position(id int,x f64,y f64) chart.ChartCoordinate

用途

$&Screen 上的操作:执行 chart position 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
x f64
值(f64)
y f64
值(f64)

返回值

chart.ChartCoordinate — 该类型的值

($&Screen) chart_hit_test

XuAPI
pub fn (s $&Screen) chart_hit_test(id int,x f64,y f64) chart.ChartHit

用途

$&Screen 上的操作:执行 chart hit test 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
x f64
值(f64)
y f64
值(f64)

返回值

chart.ChartHit — 该类型的值

($&Screen) remember_color

XuAPI
pub fn (s $&Screen) remember_color(id int) int

用途

$&Screen 上的操作:执行 remember color 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) set_tab_behavior

XuAPI
pub fn (s $&Screen) set_tab_behavior(id int,widths &[]f64,automatic bool) int

用途

$&Screen 上的操作:设置 tab behavior。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
widths &[]f64
widths(只读借用,调用方仍持有原值;类型 &[]f64)
automatic bool
automatic(bool)

返回值

int — 该类型的值

($&Screen) set_table_column

XuAPI
pub fn (s $&Screen) set_table_column(id int,column int,width f64,alignment f64) int

用途

$&Screen 上的操作:设置 table column。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
column int
column(int)
width f64
width(f64)
alignment f64
alignment(f64)

返回值

int — 该类型的值

($&Screen) set_table_status

XuAPI
pub fn (s $&Screen) set_table_status(id int,text string) int

用途

$&Screen 上的操作:设置 table status。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
text string
文本(string)

返回值

int — 该类型的值

($&Screen) set_multi_filter

XuAPI
pub fn (s $&Screen) set_multi_filter(id int,query string) int

用途

$&Screen 上的操作:设置 multi filter。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
query string
query(string)

返回值

int — 该类型的值

($&Screen) select_all

XuAPI
pub fn (s $&Screen) select_all(id int,selected bool) int

用途

$&Screen 上的操作:执行 select all 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
selected bool
selected(bool)

返回值

int — 该类型的值

($&Screen) set_date_options

XuAPI
pub fn (s $&Screen) set_date_options(id int,today time.Time,clearable bool) int

用途

$&Screen 上的操作:设置 date options。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
today time.Time
today(time.Time)
clearable bool
clearable(bool)

返回值

int — 该类型的值

($&Screen) clear_calendar

XuAPI
pub fn (s $&Screen) clear_calendar(id int) int

用途

$&Screen 上的操作:执行 clear calendar 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) set_clock_format

XuAPI
pub fn (s $&Screen) set_clock_format(id int,twelve_hour bool,seconds bool) int

用途

$&Screen 上的操作:设置 clock format。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
twelve_hour bool
twelve_hour(bool)
seconds bool
seconds(bool)

返回值

int — 该类型的值

($&Screen) set_color_hex

XuAPI
pub fn (s $&Screen) set_color_hex(id int,value string) int

用途

$&Screen 上的操作:设置 color hex。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value string
value(string)

返回值

int — 该类型的值

($&Screen) set_color_swatches

XuAPI
pub fn (s $&Screen) set_color_swatches(id int,colors &[]draw.Color) int

用途

$&Screen 上的操作:设置 color swatches。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
colors &[]draw.Color
colors(只读借用,调用方仍持有原值;类型 &[]draw.Color)

返回值

int — 该类型的值

($&Screen) set_stepper_repeat

XuAPI
pub fn (s $&Screen) set_stepper_repeat(id int,enabled bool,delay time.Duration,interval time.Duration) int

用途

$&Screen 上的操作:设置 stepper repeat。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)
delay time.Duration
delay(time.Duration)
interval time.Duration
interval(time.Duration)

返回值

int — 该类型的值

($&Screen) set_spinner_appearance

XuAPI
pub fn (s $&Screen) set_spinner_appearance(id int,diameter f64,thickness f64,period time.Duration) int

用途

$&Screen 上的操作:设置 spinner appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
diameter f64
diameter(f64)
thickness f64
thickness(f64)
period time.Duration
period(time.Duration)

返回值

int — 该类型的值

($&Screen) set_checkbox_indeterminate

XuAPI
pub fn (s $&Screen) set_checkbox_indeterminate(id int,mixed bool) int

用途

$&Screen 上的操作:设置 checkbox indeterminate。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
mixed bool
mixed(bool)

返回值

int — 该类型的值

($&Screen) set_badge_tone

XuAPI
pub fn (s $&Screen) set_badge_tone(id int,tone int) int

用途

$&Screen 上的操作:设置 badge tone。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
tone int
tone(int)

返回值

int — 该类型的值

($&Screen) set_progress_buffer

XuAPI
pub fn (s $&Screen) set_progress_buffer(id int,value f64) int

用途

$&Screen 上的操作:设置 progress buffer。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value f64
value(f64)

返回值

int — 该类型的值

($&Screen) color_hex

XuAPI
pub fn (s $&Screen) color_hex(id int) string

用途

$&Screen 上的操作:执行 color hex 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

string — 结果字符串

($&Screen) calendar_has_value

XuAPI
pub fn (s $&Screen) calendar_has_value(id int) bool

用途

$&Screen 上的操作:执行 calendar has value 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Screen) text_field_area

XuAPI
pub fn (s $&Screen) text_field_area(value string,decoration &FieldDecoration) int

用途

在 Screen 中创建 FieldArea,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value string
value(string)
decoration &FieldDecoration
decoration(只读借用,调用方仍持有原值;类型 &FieldDecoration)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_task_feedback

XuAPI
pub fn (s $&Screen) set_task_feedback(id int,feedback &TaskFeedback) int

用途

$&Screen 上的操作:设置 task feedback。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
feedback &TaskFeedback
feedback(只读借用,调用方仍持有原值;类型 &TaskFeedback)

返回值

int — 该类型的值

($&Screen) set_select_option_enabled

XuAPI
pub fn (s $&Screen) set_select_option_enabled(id int,index int,enabled bool) int

用途

$&Screen 上的操作:设置 select option enabled。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
index int
index(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) set_combo_custom_values

XuAPI
pub fn (s $&Screen) set_combo_custom_values(id int,allowed bool) int

用途

$&Screen 上的操作:设置 combo custom values。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
allowed bool
allowed(bool)

返回值

int — 该类型的值

($&Screen) icon_button

XuAPI
pub fn (s $&Screen) icon_button(asset string,text string) int

用途

在 Screen 中创建 IconButton,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
asset string
asset(string)
text string
文本(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) button_with_icon

XuAPI
pub fn (s $&Screen) button_with_icon(asset string,text string) int

用途

$&Screen 上的操作:执行 button with icon 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
asset string
asset(string)
text string
文本(string)

返回值

int — 该类型的值

($&Screen) measure_button

XuAPI
pub fn (s $&Screen) measure_button(id int) layout.Size

用途

$&Screen 上的操作:执行 measure button 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

layout.Size — 该类型的值

($&Screen) set_label_wrapped

XuAPI
pub fn (s $&Screen) set_label_wrapped(id int,wrapped bool) int

用途

$&Screen 上的操作:设置 label wrapped。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
wrapped bool
wrapped(bool)

返回值

int — 该类型的值

($&Screen) table

XuAPI
pub fn (s $&Screen) table(headers &[]string,rows int,selected int) int

用途

在 Screen 中创建 Table,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
headers &[]string
headers(只读借用,调用方仍持有原值;类型 &[]string)
rows int
rows(int)
selected int
selected(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) tree

XuAPI
pub fn (s $&Screen) tree() int

用途

在 Screen 中创建 TreeView,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) pagination

XuAPI
pub fn (s $&Screen) pagination(pages int,current int) int

用途

在 Screen 中创建 Pagination,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
pages int
pages(int)
current int
current(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) breadcrumbs

XuAPI
pub fn (s $&Screen) breadcrumbs(items &[]string) int

用途

在 Screen 中创建 Breadcrumbs,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
items &[]string
元素列表(只读借用,调用方仍持有原值;类型 &[]string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) combo_box

XuAPI
pub fn (s $&Screen) combo_box(options &[]string,value string) int

用途

在 Screen 中创建 ComboBox,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)
value string
value(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) multi_select

XuAPI
pub fn (s $&Screen) multi_select(options &[]string) int

用途

在 Screen 中创建 MultiSelect,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]string
options(只读借用,调用方仍持有原值;类型 &[]string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) color_picker

XuAPI
pub fn (s $&Screen) color_picker(value draw.Color) int

用途

在 Screen 中创建 ColorPicker,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value draw.Color
value(draw.Color)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) date_picker

XuAPI
pub fn (s $&Screen) date_picker(value time.Time) int

用途

在 Screen 中创建 DatePicker,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value time.Time
value(time.Time)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) time_picker

XuAPI
pub fn (s $&Screen) time_picker(value time.Time) int

用途

在 Screen 中创建 TimePicker,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value time.Time
value(time.Time)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) spinner

XuAPI
pub fn (s $&Screen) spinner() int

用途

在 Screen 中创建 Spinner,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) input

XuAPI
pub fn (s $&Screen) input(value string) int

用途

在 Screen 中创建 Input,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value string
value(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) secret_input

XuAPI
pub fn (s $&Screen) secret_input(value string) int

用途

$&Screen 上的操作:执行 secret input 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value string
value(string)

返回值

int — 该类型的值

($&Screen) set_secure

XuAPI
pub fn (s $&Screen) set_secure(id int,secure bool) int

用途

$&Screen 上的操作:设置 secure。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
secure bool
secure(bool)

返回值

int — 该类型的值

($&Screen) text_area

XuAPI
pub fn (s $&Screen) text_area(value string) int

用途

在 Screen 中创建 TextArea,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value string
value(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_cell

XuAPI
pub fn (s $&Screen) set_cell(id int,row int,column int,value string) int

用途

$&Screen 上的操作:设置 cell。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
row int
row(int)
column int
column(int)
value string
value(string)

返回值

int — 该类型的值

($&Screen) sort_column

XuAPI
pub fn (s $&Screen) sort_column(id int) int

用途

$&Screen 上的操作:执行 sort column 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) sort_descending

XuAPI
pub fn (s $&Screen) sort_descending(id int) bool

用途

$&Screen 上的操作:执行 sort descending 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Screen) tree_add

XuAPI
pub fn (s $&Screen) tree_add(id int,parent int,value string) int

用途

$&Screen 上的操作:执行 tree add 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
parent int
parent(int)
value string
value(string)

返回值

int — 该类型的值

($&Screen) set_expanded

XuAPI
pub fn (s $&Screen) set_expanded(id int,index int,expanded bool) int

用途

$&Screen 上的操作:设置 expanded。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
index int
index(int)
expanded bool
expanded(bool)

返回值

int — 该类型的值

($&Screen) selected

XuAPI
pub fn (s $&Screen) selected(id int) int

用途

获取或判断当前选中的项索引、节点或文本状态。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) set_selected

XuAPI
pub fn (s $&Screen) set_selected(id int,index int) int

用途

$&Screen 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
index int
index(int)

返回值

int — 该类型的值

($&Screen) set_checked

XuAPI
pub fn (s $&Screen) set_checked(id int,index int,checked bool) int

用途

$&Screen 上的操作:设置 checked。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
index int
index(int)
checked bool
checked(bool)

返回值

int — 该类型的值

($&Screen) values

XuAPI
pub fn (s $&Screen) values(id int) []int

用途

返回当前集合、参数表或映射中所有值的切片。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

[]int — 切片结果

($&Screen) text_value

XuAPI
pub fn (s $&Screen) text_value(id int) string

用途

$&Screen 上的操作:文本值。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

string — 结果字符串

($&Screen) set_value

XuAPI
pub fn (s $&Screen) set_value(id int,value string) int

用途

$&Screen 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value string
value(string)

返回值

int — 该类型的值

($&Screen) color_value

XuAPI
pub fn (s $&Screen) color_value(id int) draw.Color

用途

$&Screen 上的操作:执行 color value 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

draw.Color — 该类型的值

($&Screen) set_color_value

XuAPI
pub fn (s $&Screen) set_color_value(id int,value draw.Color) int

用途

$&Screen 上的操作:设置 color value。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value draw.Color
value(draw.Color)

返回值

int — 该类型的值

($&Screen) calendar_value

XuAPI
pub fn (s $&Screen) calendar_value(id int) time.Time

用途

$&Screen 上的操作:执行 calendar value 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

time.Time — 该类型的值

($&Screen) set_calendar_value

XuAPI
pub fn (s $&Screen) set_calendar_value(id int,value time.Time) int

用途

$&Screen 上的操作:设置 calendar value。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value time.Time
value(time.Time)

返回值

int — 该类型的值

($&Screen) set_running

XuAPI
pub fn (s $&Screen) set_running(id int,running bool) int

用途

$&Screen 上的操作:设置 running。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
running bool
running(bool)

返回值

int — 该类型的值

($&Screen) set_page_count

XuAPI
pub fn (s $&Screen) set_page_count(id int,pages int) int

用途

$&Screen 上的操作:设置 page count。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
pages int
pages(int)

返回值

int — 该类型的值

($&Screen) set_date_range

XuAPI
pub fn (s $&Screen) set_date_range(id int,minimum time.Time,maximum time.Time) int

用途

$&Screen 上的操作:设置 date range。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
minimum time.Time
minimum(time.Time)
maximum time.Time
maximum(time.Time)

返回值

int — 该类型的值

($&Screen) set_copy_enabled

XuAPI
pub fn (s $&Screen) set_copy_enabled(id int,on bool) int

用途

$&Screen 上的操作:设置 copy enabled。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
on bool
on(bool)

返回值

int — 该类型的值

(&Screen) is_copy_enabled

XuAPI
pub fn (s &Screen) is_copy_enabled(id int) bool

用途

&Screen 上的操作:判断是否 copy enabled。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

(&Screen) selected_text

XuAPI
pub fn (s &Screen) selected_text(id int) string

用途

&Screen 上的操作:执行 selected text 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

string — 结果字符串

($&Screen) set_control_style

XuAPI
pub fn (s $&Screen) set_control_style(id int,style &ControlStyle) int

用途

$&Screen 上的操作:设置 control style。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Screen) set_button_variant

XuAPI
pub fn (s $&Screen) set_button_variant(id int,variant int) int

用途

$&Screen 上的操作:设置 button variant。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
variant int
variant(int)

返回值

int — 该类型的值

($&Screen) set_option_text

XuAPI
pub fn (s $&Screen) set_option_text(id int,index int,value string) int

用途

$&Screen 上的操作:设置 option text。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
index int
index(int)
value string
value(string)

返回值

int — 该类型的值

($&Screen) set_slider_commit_only

XuAPI
pub fn (s $&Screen) set_slider_commit_only(id int,enabled bool) int

用途

$&Screen 上的操作:设置 slider commit only。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) set_motion

XuAPI
pub fn (s $&Screen) set_motion(id int,spec &MotionSpec) int

用途

$&Screen 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Screen) set_field_text_options

XuAPI
pub fn (s $&Screen) set_field_text_options(id int,options &FieldTextOptions) int

用途

$&Screen 上的操作:设置 field text options。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
options &FieldTextOptions
options(只读借用,调用方仍持有原值;类型 &FieldTextOptions)

返回值

int — 该类型的值

($&Screen) set_slider_appearance

XuAPI
pub fn (s $&Screen) set_slider_appearance(id int,appearance &SliderAppearance,step f64) int

用途

$&Screen 上的操作:设置 slider appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &SliderAppearance
appearance(只读借用,调用方仍持有原值;类型 &SliderAppearance)
step f64
step(f64)

返回值

int — 该类型的值

($&Screen) set_list_appearance

XuAPI
pub fn (s $&Screen) set_list_appearance(id int,appearance &ListAppearance) int

用途

$&Screen 上的操作:设置 list appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &ListAppearance
appearance(只读借用,调用方仍持有原值;类型 &ListAppearance)

返回值

int — 该类型的值

struct ActionDispatcher#C, S, A

XuAPI
pub struct ActionDispatcher#C, S, A {

}

用途

ActionDispatcher#C, S, A 上下文或状态结构体。

公开字段

此类型没有公开字段。

action_dispatcher

XuAPI
pub fn action_dispatcher#C, S(ctx &C, target &S) ActionDispatcher#C, S, Action

用途

执行 action dispatcher 操作。

参数

ctx &C
ctx(只读借用,调用方仍持有原值;类型 &C)
target &S
target(只读借用,调用方仍持有原值;类型 &S)

返回值

ActionDispatcher#C, S, Action — 该类型的值

查看用法示例

($&ActionDispatcher#C, S, A) on

XuAPI
pub fn (d $&ActionDispatcher#C, S, A) on(id int, kind int, handler fn ($&C, $&S, &A) string) int

用途

$&ActionDispatcher#C, S, A 上的操作:于。失败时抛出错误,调用方需处理或继续传播。

参数

d $&ActionDispatcher#C, S, A
本次调用使用的 ActionDispatcher#C, S, A 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
kind int
类型标签(int)
handler fn ($&C, $&S, &A) string
handler(函数值;类型 fn ($&C, $&S, &A) string)

返回值

int — 该类型的值

($&ActionDispatcher#C, S, A) on_any

XuAPI
pub fn (d $&ActionDispatcher#C, S, A) on_any(id int, handler fn ($&C, $&S, &A) string) int

用途

$&ActionDispatcher#C, S, A 上的操作:执行 on any 操作。失败时抛出错误,调用方需处理或继续传播。

参数

d $&ActionDispatcher#C, S, A
本次调用使用的 ActionDispatcher#C, S, A 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
handler fn ($&C, $&S, &A) string
handler(函数值;类型 fn ($&C, $&S, &A) string)

返回值

int — 该类型的值

($&ActionDispatcher#C, S, A) set_fallback

XuAPI
pub fn (d $&ActionDispatcher#C, S, A) set_fallback(handler fn ($&C, $&S, &A) string)

用途

$&ActionDispatcher#C, S, A 上的操作:设置 fallback。

参数

d $&ActionDispatcher#C, S, A
本次调用使用的 ActionDispatcher#C, S, A 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
handler fn ($&C, $&S, &A) string
handler(函数值;类型 fn ($&C, $&S, &A) string)

返回值

不返回值。

($&ActionDispatcher#C, S, A) clear_fallback

XuAPI
pub fn (d $&ActionDispatcher#C, S, A) clear_fallback()

用途

$&ActionDispatcher#C, S, A 上的操作:执行 clear fallback 操作。

参数

d $&ActionDispatcher#C, S, A
本次调用使用的 ActionDispatcher#C, S, A 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&ActionDispatcher#C, S, A) dispatch

XuAPI
pub fn (d &ActionDispatcher#C, S, A) dispatch(action &A, ctx $&C, s $&S) bool

用途

在 &ActionDispatcher#C, S, A 上执行 dispatch 操作。失败时抛出错误,调用方需处理或继续传播。

参数

d &ActionDispatcher#C, S, A
本次调用使用的 ActionDispatcher#C, S, A 实例;以只读借用传入,调用方仍持有实例。
action &A
action(只读借用,调用方仍持有原值;类型 &A)
ctx $&C
ctx(独占借用,可修改原值;类型 $&C)
s $&S
s(独占借用,可修改原值;类型 $&S)

返回值

bool — 是否成立

(&ActionDispatcher#C, S, A) dispatch_or_fallback

XuAPI
pub fn (d &ActionDispatcher#C, S, A) dispatch_or_fallback(action &A, ctx $&C, s $&S) bool

用途

&ActionDispatcher#C, S, A 上的操作:执行 dispatch or fallback 操作。失败时抛出错误,调用方需处理或继续传播。

参数

d &ActionDispatcher#C, S, A
本次调用使用的 ActionDispatcher#C, S, A 实例;以只读借用传入,调用方仍持有实例。
action &A
action(只读借用,调用方仍持有原值;类型 &A)
ctx $&C
ctx(独占借用,可修改原值;类型 $&C)
s $&S
s(独占借用,可修改原值;类型 $&S)

返回值

bool — 是否成立

run_screen_actions

XuAPI
pub fn run_screen_actions#C(s $&Screen, events chan ui.Event, ctx $&C, layout_fn fn ($&C, $&Screen) string, dispatcher &ActionDispatcher#C, Screen, Action) int

用途

执行 run screen actions 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
s(独占借用,可修改原值;类型 $&Screen)
events chan ui.Event
events(通道;类型 chan ui.Event)
ctx $&C
ctx(独占借用,可修改原值;类型 $&C)
layout_fn fn ($&C, $&Screen) string
layout_fn(函数值;类型 fn ($&C, $&Screen) string)
dispatcher &ActionDispatcher#C
dispatcher(只读借用,调用方仍持有原值;类型 &ActionDispatcher#C)
screen Screen
screen(Screen)
action Action
action(Action)

返回值

int — 该类型的值

查看用法示例

($&Screen) clear_control_style

XuAPI
pub fn (s $&Screen) clear_control_style(id int) int

用途

$&Screen 上的操作:执行 clear control style 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

(&Screen) locale

XuAPI
pub fn (s &Screen) locale() Locale

用途

在 &Screen 上执行 locale 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

Locale — 该类型的值

($&Screen) control_locale

XuAPI
pub fn (s $&Screen) control_locale(id int) Locale

用途

$&Screen 上的操作:执行 control locale 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

Locale — 该类型的值

($&Screen) set_locale

XuAPI
pub fn (s $&Screen) set_locale(locale &Locale) int

用途

$&Screen 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Screen) set_control_locale

XuAPI
pub fn (s $&Screen) set_control_locale(id int,locale &Locale) int

用途

$&Screen 上的操作:设置 control locale。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&Screen) clear_control_locale

XuAPI
pub fn (s $&Screen) clear_control_locale(id int) int

用途

$&Screen 上的操作:执行 clear control locale 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) menu

XuAPI
pub fn (s $&Screen) menu(label string,items &[]MenuItem,mode int,primary_key int) int

用途

在 Screen 中创建 Menu / ContextMenu / SplitButton,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
label string
label(string)
items &[]MenuItem
元素列表(只读借用,调用方仍持有原值;类型 &[]MenuItem)
mode int
模式(int)
primary_key int
primary_key(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) menu_checked

XuAPI
pub fn (s $&Screen) menu_checked(id int,key int) bool

用途

$&Screen 上的操作:执行 menu checked 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)

返回值

bool — 是否成立

($&Screen) set_menu_items

XuAPI
pub fn (s $&Screen) set_menu_items(id int,items &[]MenuItem) int

用途

$&Screen 上的操作:设置 menu items。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
items &[]MenuItem
元素列表(只读借用,调用方仍持有原值;类型 &[]MenuItem)

返回值

int — 该类型的值

($&Screen) set_menu_label

XuAPI
pub fn (s $&Screen) set_menu_label(id int,label string) int

用途

$&Screen 上的操作:设置 menu label。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
label string
label(string)

返回值

int — 该类型的值

($&Screen) set_menu_item_label

XuAPI
pub fn (s $&Screen) set_menu_item_label(id int,key int,label string) int

用途

$&Screen 上的操作:设置 menu item label。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)
label string
label(string)

返回值

int — 该类型的值

($&Screen) set_menu_checked

XuAPI
pub fn (s $&Screen) set_menu_checked(id int,key int,checked bool) int

用途

$&Screen 上的操作:设置 menu checked。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)
checked bool
checked(bool)

返回值

int — 该类型的值

($&Screen) set_menu_item_enabled

XuAPI
pub fn (s $&Screen) set_menu_item_enabled(id int,key int,enabled bool) int

用途

$&Screen 上的操作:设置 menu item enabled。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
key int
键(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) set_menu_appearance

XuAPI
pub fn (s $&Screen) set_menu_appearance(id int,appearance &MenuAppearance) int

用途

$&Screen 上的操作:设置 menu appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &MenuAppearance
appearance(只读借用,调用方仍持有原值;类型 &MenuAppearance)

返回值

int — 该类型的值

($&Screen) set_menu_open

XuAPI
pub fn (s $&Screen) set_menu_open(id int,open bool) int

用途

$&Screen 上的操作:设置 menu open。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
open bool
open(bool)

返回值

int — 该类型的值

($&Screen) popover

XuAPI
pub fn (s $&Screen) popover(anchor int,text string) int

用途

在 Screen 中创建 Popover,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
anchor int
anchor(int)
text string
文本(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) tooltip

XuAPI
pub fn (s $&Screen) tooltip(anchor int,text string) int

用途

在 Screen 中创建 Tooltip,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
anchor int
anchor(int)
text string
文本(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) toast

XuAPI
pub fn (s $&Screen) toast(text string) int

用途

在 $&Screen 上执行 toast 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)

返回值

int — 该类型的值

($&Screen) notify

XuAPI
pub fn (s $&Screen) notify(text string) int

用途

$&Screen 上的操作:通知。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)

返回值

int — 该类型的值

($&Screen) modal

XuAPI
pub fn (s $&Screen) modal(title string,message string) int

用途

在 Screen 中创建 Modal,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
title string
title(string)
message string
message(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) open

XuAPI
pub fn (s $&Screen) open(id int) int

用途

$&Screen 上的操作:打开资源或建立网络连接。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) close_overlay

XuAPI
pub fn (s $&Screen) close_overlay(id int) int

用途

$&Screen 上的操作:执行 close overlay 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) show_toast

XuAPI
pub fn (s $&Screen) show_toast(id int,text string,duration time.Duration) int

用途

$&Screen 上的操作:执行 show toast 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
text string
文本(string)
duration time.Duration
duration(time.Duration)

返回值

int — 该类型的值

($&Screen) password_input

XuAPI
pub fn (s $&Screen) password_input(value string) int

用途

在 Screen 中创建 PasswordInput,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value string
value(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_password

XuAPI
pub fn (s $&Screen) set_password(id int,password bool) int

用途

$&Screen 上的操作:设置 password。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
password bool
password(bool)

返回值

int — 该类型的值

($&Screen) set_password_visible

XuAPI
pub fn (s $&Screen) set_password_visible(id int,visible bool) int

用途

$&Screen 上的操作:设置 password visible。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
visible bool
visible(bool)

返回值

int — 该类型的值

(&Screen) is_password

XuAPI
pub fn (s &Screen) is_password(id int) bool

用途

&Screen 上的操作:判断是否 password。失败时抛出错误,调用方需处理或继续传播。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

(&Screen) is_password_visible

XuAPI
pub fn (s &Screen) is_password_visible(id int) bool

用途

&Screen 上的操作:判断是否 password visible。失败时抛出错误,调用方需处理或继续传播。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Screen) set_range_values

XuAPI
pub fn (s $&Screen) set_range_values(id int,lower f64,upper f64) int

用途

$&Screen 上的操作:设置 range values。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
lower f64
lower(f64)
upper f64
upper(f64)

返回值

int — 该类型的值

($&Screen) set_range_options

XuAPI
pub fn (s $&Screen) set_range_options(id int,options &RangeSliderOptions) int

用途

$&Screen 上的操作:设置 range options。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
options &RangeSliderOptions
options(只读借用,调用方仍持有原值;类型 &RangeSliderOptions)

返回值

int — 该类型的值

($&Screen) set_range_appearance

XuAPI
pub fn (s $&Screen) set_range_appearance(id int,appearance &SliderAppearance) int

用途

$&Screen 上的操作:设置 range appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
appearance &SliderAppearance
appearance(只读借用,调用方仍持有原值;类型 &SliderAppearance)

返回值

int — 该类型的值

($&Screen) range_values

XuAPI
pub fn (s $&Screen) range_values(id int) RangeValues

用途

$&Screen 上的操作:执行 range values 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

RangeValues — 该类型的值

($&Screen) set_read_only

XuAPI
pub fn (s $&Screen) set_read_only(id int,value bool) int

用途

$&Screen 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value bool
value(bool)

返回值

int — 该类型的值

($&Screen) field

XuAPI
pub fn (s $&Screen) field(value string,decoration &FieldDecoration) int

用途

在 Screen 中创建 Field,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value string
value(string)
decoration &FieldDecoration
decoration(只读借用,调用方仍持有原值;类型 &FieldDecoration)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) task_button

XuAPI
pub fn (s $&Screen) task_button(label string) int

用途

在 Screen 中创建 TaskButton,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
label string
label(string)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_field_decoration

XuAPI
pub fn (s $&Screen) set_field_decoration(id int,decoration &FieldDecoration) int

用途

$&Screen 上的操作:设置 field decoration。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
decoration &FieldDecoration
decoration(只读借用,调用方仍持有原值;类型 &FieldDecoration)

返回值

int — 该类型的值

($&Screen) begin_task

XuAPI
pub fn (s $&Screen) begin_task(id int,task_id int) int

用途

$&Screen 上的操作:执行 begin task 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
task_id int
task_id(int)

返回值

int — 该类型的值

($&Screen) set_task_progress

XuAPI
pub fn (s $&Screen) set_task_progress(id int,task_id int,value f64) bool

用途

$&Screen 上的操作:设置 task progress。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
task_id int
task_id(int)
value f64
value(f64)

返回值

bool — 是否成立

($&Screen) complete_task

XuAPI
pub fn (s $&Screen) complete_task(id int,task_id int,state int) bool

用途

$&Screen 上的操作:执行 complete task 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
task_id int
task_id(int)
state int
state(int)

返回值

bool — 是否成立

($&Screen) set_task_progress_mode

XuAPI
pub fn (s $&Screen) set_task_progress_mode(id int,mode int) int

用途

$&Screen 上的操作:设置 task progress mode。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
mode int
模式(int)

返回值

int — 该类型的值

(&Scroll) axis

XuAPI
pub fn (scroll &Scroll) axis() int

用途

在 &Scroll 上执行 axis 操作。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Scroll) content_bounds

XuAPI
pub fn (scroll &Scroll) content_bounds() layout.Rect

用途

&Scroll 上的操作:执行 content bounds 操作。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Screen) scroll_area

XuAPI
pub fn (s $&Screen) scroll_area(axis int,content_extent f64) int

用途

在 Screen 中创建 Scroll,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
axis int
axis(int)
content_extent f64
content_extent(f64)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) set_scroll_offset

XuAPI
pub fn (s $&Screen) set_scroll_offset(id int,offset f64) int

用途

$&Screen 上的操作:设置 scroll offset。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
offset f64
偏移(f64)

返回值

int — 该类型的值

($&Screen) set_scroll_extent

XuAPI
pub fn (s $&Screen) set_scroll_extent(id int,extent f64) int

用途

$&Screen 上的操作:设置 scroll extent。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
extent f64
extent(f64)

返回值

int — 该类型的值

(&Screen) scroll_offset

XuAPI
pub fn (s &Screen) scroll_offset(id int) f64

用途

&Screen 上的操作:执行 scroll offset 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

f64 — 该类型的值

($&Screen) selectable_text

XuAPI
pub fn (s $&Screen) selectable_text(text string,size f64,muted bool) int

用途

$&Screen 上的操作:执行 selectable text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)
size f64
size(f64)
muted bool
muted(bool)

返回值

int — 该类型的值

($&Screen) selectable_label

XuAPI
pub fn (s $&Screen) selectable_label(text string,size f64,muted bool) int

用途

$&Screen 上的操作:执行 selectable label 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text string
文本(string)
size f64
size(f64)
muted bool
muted(bool)

返回值

int — 该类型的值

(&Screen) is_selectable_label

XuAPI
pub fn (s &Screen) is_selectable_label(id int) bool

用途

&Screen 上的操作:判断是否 selectable label。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

(&Screen) is_selectable

XuAPI
pub fn (s &Screen) is_selectable(id int) bool

用途

&Screen 上的操作:判断是否 selectable。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&Screen) set_label_selectable

XuAPI
pub fn (s $&Screen) set_label_selectable(id int,selectable bool) int

用途

$&Screen 上的操作:设置 label selectable。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
selectable bool
selectable(bool)

返回值

int — 该类型的值

($&Screen) set_selectable

XuAPI
pub fn (s $&Screen) set_selectable(id int,selectable bool) int

用途

$&Screen 上的操作:设置 selectable。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
selectable bool
selectable(bool)

返回值

int — 该类型的值

($&Screen) split_pane

XuAPI
pub fn (s $&Screen) split_pane(id int,pane int) int

用途

$&Screen 上的操作:执行 split pane 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
pane int
pane(int)

返回值

int — 该类型的值

($&Screen) split_layout

XuAPI
pub fn (s $&Screen) split_layout(id int) SplitLayout

用途

$&Screen 上的操作:执行 split layout 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

SplitLayout — 该类型的值

($&Screen) set_split_ratio

XuAPI
pub fn (s $&Screen) set_split_ratio(id int,ratio f64) int

用途

$&Screen 上的操作:设置 split ratio。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
ratio f64
ratio(f64)

返回值

int — 该类型的值

($&Screen) set_split_options

XuAPI
pub fn (s $&Screen) set_split_options(id int,options &SplitViewOptions) int

用途

$&Screen 上的操作:设置 split options。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
options &SplitViewOptions
options(只读借用,调用方仍持有原值;类型 &SplitViewOptions)

返回值

int — 该类型的值

($&Screen) set_split_collapsed

XuAPI
pub fn (s $&Screen) set_split_collapsed(id int,pane int,collapsed bool) int

用途

$&Screen 上的操作:设置 split collapsed。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
pane int
pane(int)
collapsed bool
collapsed(bool)

返回值

int — 该类型的值

struct Appearance

XuAPI
pub struct Appearance {
    pub styles Styles
    pub reduced_motion bool
}

用途

承载 styles、reduced_motion 等属性的结构体。

公开字段

styles Styles
字段(Styles)
reduced_motion bool
字段(bool)

screen_appearance

XuAPI
pub fn screen_appearance(styles &Styles, reduced_motion bool) Appearance

用途

执行 screen appearance 操作。失败时抛出错误,调用方需处理或继续传播。

参数

styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
reduced_motion bool
reduced_motion(bool)

返回值

Appearance — 该类型的值

查看用法示例

($&Screen) apply_appearance

XuAPI
pub fn (s $&Screen) apply_appearance(appearance &Appearance) int

用途

$&Screen 上的操作:执行 apply appearance 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
appearance &Appearance
appearance(只读借用,调用方仍持有原值;类型 &Appearance)

返回值

int — 该类型的值

($&Screen) sort_table

XuAPI
pub fn (s $&Screen) sort_table(id int,column int,descending bool) int

用途

$&Screen 上的操作:排序表。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
column int
column(int)
descending bool
descending(bool)

返回值

int — 该类型的值

($&Screen) set_table_sort_kind

XuAPI
pub fn (s $&Screen) set_table_sort_kind(id int,column int,kind int) int

用途

$&Screen 上的操作:设置 table sort kind。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
column int
column(int)
kind int
类型标签(int)

返回值

int — 该类型的值

($&Screen) set_table_local_sort

XuAPI
pub fn (s $&Screen) set_table_local_sort(id int,enabled bool) int

用途

$&Screen 上的操作:设置 table local sort。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Screen) set_table_selected_row

XuAPI
pub fn (s $&Screen) set_table_selected_row(id int,row int) int

用途

$&Screen 上的操作:设置 table selected row。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
row int
row(int)

返回值

int — 该类型的值

($&Screen) set_table_rows

XuAPI
pub fn (s $&Screen) set_table_rows(id int,count int) int

用途

$&Screen 上的操作:设置 table rows。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
count int
count(int)

返回值

int — 该类型的值

($&Screen) table_row_at

XuAPI
pub fn (s $&Screen) table_row_at(id int,row int) int

用途

$&Screen 上的操作:执行 table row at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
row int
row(int)

返回值

int — 该类型的值

($&Screen) table_view_row

XuAPI
pub fn (s $&Screen) table_view_row(id int,row int) int

用途

$&Screen 上的操作:执行 table view row 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
row int
row(int)

返回值

int — 该类型的值

($&Screen) table_selected_row

XuAPI
pub fn (s $&Screen) table_selected_row(id int) int

用途

$&Screen 上的操作:执行 table selected row 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&Screen) table_cell

XuAPI
pub fn (s $&Screen) table_cell(id int,row int,column int) string

用途

$&Screen 上的操作:执行 table cell 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
row int
row(int)
column int
column(int)

返回值

string — 结果字符串

($&Screen) table_view_cell

XuAPI
pub fn (s $&Screen) table_view_cell(id int,row int,column int) string

用途

$&Screen 上的操作:执行 table view cell 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
row int
row(int)
column int
column(int)

返回值

string — 结果字符串

($&Screen) set_invalid

XuAPI
pub fn (s $&Screen) set_invalid(id int,invalid bool) int

用途

$&Screen 上的操作:设置 invalid。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
invalid bool
invalid(bool)

返回值

int — 该类型的值

($&Screen) chart

XuAPI
pub fn (s $&Screen) chart() int

用途

在 Screen 中创建 Chart,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) button_group

XuAPI
pub fn (s $&Screen) button_group(items &[]ButtonGroupItem,mode int) int

用途

在 Screen 中创建 ButtonGroup,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
items &[]ButtonGroupItem
元素列表(只读借用,调用方仍持有原值;类型 &[]ButtonGroupItem)
mode int
模式(int)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) range_slider

XuAPI
pub fn (s $&Screen) range_slider(minimum f64,maximum f64,lower f64,upper f64) int

用途

在 Screen 中创建 RangeSlider,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
minimum f64
minimum(f64)
maximum f64
maximum(f64)
lower f64
lower(f64)
upper f64
upper(f64)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) split_view

XuAPI
pub fn (s $&Screen) split_view(ratio f64) int

用途

在 Screen 中创建 SplitView,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
ratio f64
ratio(f64)

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

const ACTION_WEB_LOADING

XuAPI
pub const ACTION_WEB_LOADING = 30

用途

常量 ACTION_WEB_LOADING,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_WEB_LOADED

XuAPI
pub const ACTION_WEB_LOADED = 31

用途

常量 ACTION_WEB_LOADED,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_WEB_FAILED

XuAPI
pub const ACTION_WEB_FAILED = 32

用途

常量 ACTION_WEB_FAILED,定义了相关的协议或算法配置参数。

查看用法示例

const ACTION_WEB_PROGRESS

XuAPI
pub const ACTION_WEB_PROGRESS = 33

用途

常量 ACTION_WEB_PROGRESS,定义了相关的协议或算法配置参数。

查看用法示例

($&Screen) webview

XuAPI
pub fn (s $&Screen) webview() int

用途

在 Screen 中创建 WebView,返回组件节点 ID;创建失败时抛出错误。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 组件节点 ID,供 place 和其他 Screen 方法使用。

($&Screen) webview_native

XuAPI
pub fn (s $&Screen) webview_native(id int) ui.NativeView

用途

$&Screen 上的操作:执行 webview native 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

ui.NativeView — 该类型的值

($&Screen) load_web_html

XuAPI
pub fn (s $&Screen) load_web_html(id int,html string) int

用途

$&Screen 上的操作:执行 load web html 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
html string
html(string)

返回值

int — 该类型的值

($&Screen) load_web_url

XuAPI
pub fn (s $&Screen) load_web_url(id int,url string) int

用途

$&Screen 上的操作:执行 load web url 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
url string
url(string)

返回值

int — 该类型的值

($&Screen) webview_command

XuAPI
pub fn (s $&Screen) webview_command(id int,command string) int

用途

$&Screen 上的操作:执行 webview command 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
command string
command(string)

返回值

int — 该类型的值

($&Screen) set_webview_radius

XuAPI
pub fn (s $&Screen) set_webview_radius(id int,radius f64) int

用途

$&Screen 上的操作:设置 webview radius。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
radius f64
radius(f64)

返回值

int — 该类型的值

($&Screen) close_webview

XuAPI
pub fn (s $&Screen) close_webview(id int) int

用途

$&Screen 上的操作:执行 close webview 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

const AXIS_VERTICAL

XuAPI
pub const AXIS_VERTICAL = 0

用途

常量 AXIS_VERTICAL,定义了相关的协议或算法配置参数。

查看用法示例

const AXIS_HORIZONTAL

XuAPI
pub const AXIS_HORIZONTAL = 1

用途

常量 AXIS_HORIZONTAL,定义了相关的协议或算法配置参数。

查看用法示例

struct Scroll

XuAPI
pub struct Scroll {

}

用途

Scroll 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

scroll

XuAPI
pub fn scroll(identity &ui.CanvasEvent,id int,bounds &layout.Rect,axis int,content_extent f64) Scroll

用途

执行 scroll 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
axis int
axis(int)
content_extent f64
content_extent(f64)

返回值

Scroll — 该类型的值

查看用法示例

(&Scroll) offset

XuAPI
pub fn (scroll &Scroll) offset() f64

用途

在 &Scroll 上执行 offset 操作。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Scroll) needs_paint

XuAPI
pub fn (scroll &Scroll) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Scroll) painted

XuAPI
pub fn (scroll $&Scroll) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Scroll) set_focus

XuAPI
pub fn (scroll $&Scroll) set_focus(focused bool)

用途

$&Scroll 上的操作:设置 focus。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Scroll) set_offset

XuAPI
pub fn (scroll $&Scroll) set_offset(offset f64) int

用途

$&Scroll 上的操作:设置 offset。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
offset f64
偏移(f64)

返回值

int — 该类型的值

($&Scroll) set_content_extent

XuAPI
pub fn (scroll $&Scroll) set_content_extent(extent f64) int

用途

$&Scroll 上的操作:设置 content extent。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
extent f64
extent(f64)

返回值

int — 该类型的值

($&Scroll) set_bounds

XuAPI
pub fn (scroll $&Scroll) set_bounds(bounds &layout.Rect) int

用途

$&Scroll 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Scroll) input

XuAPI
pub fn (scroll $&Scroll) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Scroll) event

XuAPI
pub fn (scroll $&Scroll) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Scroll) visible_items

XuAPI
pub fn (scroll &Scroll) visible_items(count int,item_extent f64,gap f64,overscan int) layout.VisibleRange

用途

&Scroll 上的操作:执行 visible items 操作。失败时抛出错误,调用方需处理或继续传播。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。
count int
count(int)
item_extent f64
item_extent(f64)
gap f64
gap(f64)
overscan int
overscan(int)

返回值

layout.VisibleRange — 该类型的值

($&Scroll) layout_items

XuAPI
pub fn (scroll $&Scroll) layout_items(count int,item_extent f64,gap f64,overscan int) layout.VisibleRange

用途

$&Scroll 上的操作:执行 layout items 操作。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
count int
count(int)
item_extent f64
item_extent(f64)
gap f64
gap(f64)
overscan int
overscan(int)

返回值

layout.VisibleRange — 该类型的值

(&Scroll) begin

XuAPI
pub fn (scroll &Scroll) begin(frame $&draw.Frame) int

用途

在 &Scroll 上执行 begin 操作。失败时抛出错误,调用方需处理或继续传播。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)

返回值

int — 该类型的值

(&Scroll) end

XuAPI
pub fn (scroll &Scroll) end(frame $&draw.Frame) int

用途

在 &Scroll 上执行 end 操作。失败时抛出错误,调用方需处理或继续传播。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)

返回值

int — 该类型的值

struct FocusGroup

XuAPI
pub struct FocusGroup {

}

用途

FocusGroup 上下文或状态结构体。

公开字段

此类型没有公开字段。

focus_group

XuAPI
pub fn focus_group(identity &ui.CanvasEvent,ids []int) FocusGroup

用途

执行 focus group 操作。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
ids []int
ids([]int)

返回值

FocusGroup — 该类型的值

(&FocusGroup) current

XuAPI
pub fn (focus &FocusGroup) current() int

用途

&FocusGroup 上的操作:当前。

参数

focus &FocusGroup
本次调用使用的 FocusGroup 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&FocusGroup) clear

XuAPI
pub fn (focus $&FocusGroup) clear()

用途

清空所有已缓冲或存储的数据项与内部状态。

参数

focus $&FocusGroup
本次调用使用的 FocusGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&FocusGroup) focus

XuAPI
pub fn (focus $&FocusGroup) focus(id int) int

用途

在 $&FocusGroup 上执行 focus 操作。失败时抛出错误,调用方需处理或继续传播。

参数

focus $&FocusGroup
本次调用使用的 FocusGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&FocusGroup) input

XuAPI
pub fn (focus $&FocusGroup) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

focus $&FocusGroup
本次调用使用的 FocusGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&FocusGroup) set_items

XuAPI
pub fn (focus $&FocusGroup) set_items(ids []int) int

用途

$&FocusGroup 上的操作:设置 items。失败时抛出错误,调用方需处理或继续传播。

参数

focus $&FocusGroup
本次调用使用的 FocusGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
ids []int
ids([]int)

返回值

int — 该类型的值

($&FocusGroup) event

XuAPI
pub fn (focus $&FocusGroup) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

focus $&FocusGroup
本次调用使用的 FocusGroup 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

(&Scroll) is_enabled

XuAPI
pub fn (scroll &Scroll) is_enabled() bool

用途

返回控件当前是否可用。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Scroll) set_enabled

XuAPI
pub fn (scroll $&Scroll) set_enabled(enabled bool)

用途

$&Scroll 上的操作:设置 enabled。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&Scroll) id

XuAPI
pub fn (scroll &Scroll) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Scroll) bounds

XuAPI
pub fn (scroll &Scroll) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Scroll) is_focused

XuAPI
pub fn (scroll &Scroll) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Scroll) is_hovered

XuAPI
pub fn (scroll &Scroll) is_hovered() bool

用途

&Scroll 上的操作:判断是否 hovered。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Scroll) is_dragging

XuAPI
pub fn (scroll &Scroll) is_dragging() bool

用途

&Scroll 上的操作:判断是否 dragging。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Scroll) is_invalid

XuAPI
pub fn (scroll &Scroll) is_invalid() bool

用途

&Scroll 上的操作:判断是否 invalid。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Scroll) set_invalid

XuAPI
pub fn (scroll $&Scroll) set_invalid(invalid bool)

用途

$&Scroll 上的操作:设置 invalid。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

(&Scroll) visual_state

XuAPI
pub fn (scroll &Scroll) visual_state() int

用途

&Scroll 上的操作:执行 visual state 操作。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Scroll) has_style

XuAPI
pub fn (scroll &Scroll) has_style() bool

用途

&Scroll 上的操作:判断是否具有 style。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Scroll) style_or

XuAPI
pub fn (scroll &Scroll) style_or(styles &Styles) ControlStyle

用途

&Scroll 上的操作:执行 style or 操作。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Scroll) set_style

XuAPI
pub fn (scroll $&Scroll) set_style(style &ControlStyle) int

用途

$&Scroll 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Scroll) clear_style

XuAPI
pub fn (scroll $&Scroll) clear_style()

用途

$&Scroll 上的操作:执行 clear style 操作。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Scroll) apply_styles

XuAPI
pub fn (scroll $&Scroll) apply_styles(styles &Styles) int

用途

应用并验证主题;指标变化时更新布局 / 几何并标记重绘。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

($&Scroll) measure_styled

XuAPI
pub fn (scroll $&Scroll) measure_styled(styles &Styles) layout.Size

用途

$&Scroll 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Scroll) scrollbar_track

XuAPI
pub fn (scroll &Scroll) scrollbar_track() layout.Rect

用途

返回与交互命中共用的滚动条轨道矩形。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

控件坐标系中的轨道

(&Scroll) scrollbar_thumb

XuAPI
pub fn (scroll &Scroll) scrollbar_thumb() layout.Rect

用途

返回按内容长度、偏移和最小滑块尺寸计算的矩形。

参数

scroll &Scroll
本次调用使用的 Scroll 实例;以只读借用传入,调用方仍持有实例。

返回值

控件坐标系中的滑块

($&Scroll) paint_scrollbar

XuAPI
pub fn (scroll $&Scroll) paint_scrollbar(frame $&draw.Frame,styles &Styles) int

用途

绘制滚动条并清除其脏标记;在 overlay_styled 中于子内容之后调用。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

struct SelectOption

XuAPI
pub struct SelectOption {
    pub label string
    pub enabled bool
    pub group bool
}

用途

承载 label、enabled、group 等属性的结构体。

公开字段

label string
字段(string)
enabled bool
字段(bool)
group bool
字段(bool)

select_option

XuAPI
pub fn select_option(label string) SelectOption

用途

执行 select option 操作。

参数

label string
label(string)

返回值

SelectOption — 该类型的值

查看用法示例

select_group

XuAPI
pub fn select_group(label string) SelectOption

用途

执行 select group 操作。

参数

label string
label(string)

返回值

SelectOption — 该类型的值

查看用法示例

($&Select) set_option_group

XuAPI
pub fn (sel $&Select) set_option_group(index int,group bool) int

用途

$&Select 上的操作:设置 option group。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
group bool
group(bool)

返回值

int — 该类型的值

(&Select) is_group

XuAPI
pub fn (sel &Select) is_group(index int) bool

用途

&Select 上的操作:判断是否 group。

参数

sel &Select
本次调用使用的 Select 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

bool — 是否成立

($&Screen) select_options

XuAPI
pub fn (s $&Screen) select_options(options &[]SelectOption,selected int) int

用途

$&Screen 上的操作:执行 select options 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
options &[]SelectOption
options(只读借用,调用方仍持有原值;类型 &[]SelectOption)
selected int
selected(int)

返回值

int — 该类型的值

struct SelectableText

XuAPI
pub struct SelectableText {

}

用途

SelectableText 上下文或状态结构体。

公开字段

此类型没有公开字段。

selectable_text

XuAPI
pub fn selectable_text(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,text &string) SelectableText

用途

执行 selectable text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

SelectableText — 该类型的值

(&SelectableText) id

XuAPI
pub fn (s &SelectableText) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&SelectableText) identity

XuAPI
pub fn (s &SelectableText) identity() ui.CanvasEvent

用途

在 &SelectableText 上执行 identity 操作。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

ui.CanvasEvent — 该类型的值

(&SelectableText) bounds

XuAPI
pub fn (s &SelectableText) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&SelectableText) text

XuAPI
pub fn (s &SelectableText) text() string

用途

&SelectableText 上的操作:返回当前文本。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&SelectableText) is_closed

XuAPI
pub fn (s &SelectableText) is_closed() bool

用途

&SelectableText 上的操作:判断是否 closed。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) is_focused

XuAPI
pub fn (s &SelectableText) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) is_selecting

XuAPI
pub fn (s &SelectableText) is_selecting() bool

用途

&SelectableText 上的操作:判断是否 selecting。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) is_hovered

XuAPI
pub fn (s &SelectableText) is_hovered() bool

用途

&SelectableText 上的操作:判断是否 hovered。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) is_enabled

XuAPI
pub fn (s &SelectableText) is_enabled() bool

用途

返回控件当前是否可用。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) is_selectable

XuAPI
pub fn (s &SelectableText) is_selectable() bool

用途

&SelectableText 上的操作:判断是否 selectable。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) needs_paint

XuAPI
pub fn (s &SelectableText) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) has_popup_open

XuAPI
pub fn (s &SelectableText) has_popup_open() bool

用途

&SelectableText 上的操作:判断是否具有 popup open。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) popup_bounds

XuAPI
pub fn (s &SelectableText) popup_bounds() layout.Rect

用途

&SelectableText 上的操作:执行 popup bounds 操作。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&SelectableText) cursor

XuAPI
pub fn (s &SelectableText) cursor() int

用途

&SelectableText 上的操作:游标。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&SelectableText) has_selection

XuAPI
pub fn (s &SelectableText) has_selection() bool

用途

&SelectableText 上的操作:判断是否具有 selection。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) selection_range

XuAPI
pub fn (s &SelectableText) selection_range() ui.TextRange

用途

&SelectableText 上的操作:执行 selection range 操作。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

ui.TextRange — 该类型的值

(&SelectableText) selected_text

XuAPI
pub fn (s &SelectableText) selected_text() string

用途

&SelectableText 上的操作:执行 selected text 操作。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&SelectableText) painted

XuAPI
pub fn (s $&SelectableText) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&SelectableText) close

XuAPI
pub fn (s $&SelectableText) close()

用途

$&SelectableText 上的操作:关闭资源。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&SelectableText) dispose

XuAPI
pub fn (s $&SelectableText) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&SelectableText) clone_widget

XuAPI
pub fn (s &SelectableText) clone_widget() SelectableText

用途

&SelectableText 上的操作:执行 clone widget 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

SelectableText — 该类型的值

($&SelectableText) set_bounds

XuAPI
pub fn (s $&SelectableText) set_bounds(bounds &layout.Rect) int

用途

$&SelectableText 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&SelectableText) set_text

XuAPI
pub fn (s $&SelectableText) set_text(text &string) int

用途

$&SelectableText 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&SelectableText) set_wrapped

XuAPI
pub fn (s $&SelectableText) set_wrapped(wrapped bool)

用途

$&SelectableText 上的操作:设置 wrapped。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
wrapped bool
wrapped(bool)

返回值

不返回值。

($&SelectableText) set_ellipsis

XuAPI
pub fn (s $&SelectableText) set_ellipsis(ellipsis bool)

用途

$&SelectableText 上的操作:设置 ellipsis。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
ellipsis bool
ellipsis(bool)

返回值

不返回值。

($&SelectableText) set_muted

XuAPI
pub fn (s $&SelectableText) set_muted(muted bool)

用途

$&SelectableText 上的操作:设置 muted。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
muted bool
muted(bool)

返回值

不返回值。

($&SelectableText) set_enabled

XuAPI
pub fn (s $&SelectableText) set_enabled(enabled bool)

用途

$&SelectableText 上的操作:设置 enabled。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&SelectableText) set_selectable

XuAPI
pub fn (s $&SelectableText) set_selectable(selectable bool)

用途

$&SelectableText 上的操作:设置 selectable。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&SelectableText) is_copy_enabled

XuAPI
pub fn (s &SelectableText) is_copy_enabled() bool

用途

&SelectableText 上的操作:判断是否 copy enabled。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&SelectableText) set_copy_enabled

XuAPI
pub fn (s $&SelectableText) set_copy_enabled(on bool)

用途

$&SelectableText 上的操作:设置 copy enabled。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
on bool
on(bool)

返回值

不返回值。

($&SelectableText) set_locale

XuAPI
pub fn (s $&SelectableText) set_locale(locale &Locale) int

用途

$&SelectableText 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&SelectableText) set_viewport

XuAPI
pub fn (s $&SelectableText) set_viewport(viewport &layout.Rect)

用途

$&SelectableText 上的操作:设置 viewport。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&SelectableText) select_all

XuAPI
pub fn (s $&SelectableText) select_all() bool

用途

$&SelectableText 上的操作:执行 select all 操作。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&SelectableText) clear_selection

XuAPI
pub fn (s $&SelectableText) clear_selection() bool

用途

$&SelectableText 上的操作:执行 clear selection 操作。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&SelectableText) set_selection

XuAPI
pub fn (s $&SelectableText) set_selection(start int,end int) bool

用途

$&SelectableText 上的操作:设置 selection。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
start int
start(int)
end int
end(int)

返回值

bool — 是否成立

(&SelectableText) copy_selection

XuAPI
pub fn (s &SelectableText) copy_selection() int

用途

&SelectableText 上的操作:执行 copy selection 操作。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&SelectableText) has_style

XuAPI
pub fn (s &SelectableText) has_style() bool

用途

&SelectableText 上的操作:判断是否具有 style。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SelectableText) style_or

XuAPI
pub fn (s &SelectableText) style_or(styles &Styles) ControlStyle

用途

&SelectableText 上的操作:执行 style or 操作。

参数

s &SelectableText
本次调用使用的 SelectableText 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&SelectableText) set_style

XuAPI
pub fn (s $&SelectableText) set_style(style &ControlStyle) int

用途

$&SelectableText 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&SelectableText) clear_style

XuAPI
pub fn (s $&SelectableText) clear_style()

用途

$&SelectableText 上的操作:执行 clear style 操作。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&SelectableText) measure_styled

XuAPI
pub fn (s $&SelectableText) measure_styled(styles &Styles) layout.Size

用途

$&SelectableText 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&SelectableText) route

XuAPI
pub fn (s $&SelectableText) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&SelectableText) input

XuAPI
pub fn (s $&SelectableText) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&SelectableText) event

XuAPI
pub fn (s $&SelectableText) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&SelectableText) paint_styled

XuAPI
pub fn (s $&SelectableText) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&SelectableText 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&SelectableText) paint_popup_styled

XuAPI
pub fn (s $&SelectableText) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&SelectableText 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&SelectableText
本次调用使用的 SelectableText 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Checkbox) set_motion

XuAPI
pub fn (control $&Checkbox) set_motion(spec &MotionSpec) int

用途

$&Checkbox 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

control $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Radio) set_motion

XuAPI
pub fn (control $&Radio) set_motion(spec &MotionSpec) int

用途

$&Radio 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

control $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&Checkbox) tick

XuAPI
pub fn (control $&Checkbox) tick(now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

control $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&Checkbox) next_tick

XuAPI
pub fn (control &Checkbox) next_tick(now time.Instant) time.Instant

用途

&Checkbox 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

control &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&Radio) tick

XuAPI
pub fn (control $&Radio) tick(now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

control $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&Radio) next_tick

XuAPI
pub fn (control &Radio) next_tick(now time.Instant) time.Instant

用途

&Radio 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

control &Radio
本次调用使用的 Radio 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

struct SliderAppearance

XuAPI
pub struct SliderAppearance {
    pub ticks int
    pub show_value bool
    pub decimals int
}

用途

承载 ticks、show_value、decimals 等属性的结构体。

公开字段

ticks int
字段(int)
show_value bool
字段(bool)
decimals int
字段(int)

slider_appearance

XuAPI
pub fn slider_appearance() SliderAppearance

用途

执行 slider appearance 操作。

参数

无需传入参数。

返回值

SliderAppearance — 该类型的值

查看用法示例

(&SliderAppearance) validate

XuAPI
pub fn (appearance &SliderAppearance) validate() int

用途

在 &SliderAppearance 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

appearance &SliderAppearance
本次调用使用的 SliderAppearance 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Slider) set_appearance

XuAPI
pub fn (s $&Slider) set_appearance(appearance &SliderAppearance) int

用途

$&Slider 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
appearance &SliderAppearance
appearance(只读借用,调用方仍持有原值;类型 &SliderAppearance)

返回值

int — 该类型的值

(&Slider) shows_value

XuAPI
pub fn (s &Slider) shows_value() bool

用途

&Slider 上的操作:执行 shows value 操作。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Slider) value_text

XuAPI
pub fn (s &Slider) value_text() string

用途

&Slider 上的操作:值文本。失败时抛出错误,调用方需处理或继续传播。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Slider) paint_value_styled

XuAPI
pub fn (s &Slider) paint_value_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Slider 上的操作:执行 paint value styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s &Slider
本次调用使用的 Slider 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Spinner

XuAPI
pub struct Spinner {

}

用途

Spinner 上下文或状态结构体。

公开字段

此类型没有公开字段。

spinner

XuAPI
pub fn spinner(bounds &layout.Rect) Spinner

用途

执行 spinner 处理。失败时抛出错误,调用方需处理或继续传播。

参数

bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Spinner — 该类型的值

(&Spinner) is_running

XuAPI
pub fn (spinner &Spinner) is_running() bool

用途

&Spinner 上的操作:判断是否 running。

参数

spinner &Spinner
本次调用使用的 Spinner 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Spinner) needs_paint

XuAPI
pub fn (spinner &Spinner) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

spinner &Spinner
本次调用使用的 Spinner 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Spinner) bounds

XuAPI
pub fn (spinner &Spinner) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

spinner &Spinner
本次调用使用的 Spinner 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Spinner) set_bounds

XuAPI
pub fn (spinner $&Spinner) set_bounds(bounds &layout.Rect) int

用途

$&Spinner 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Spinner) set_running

XuAPI
pub fn (spinner $&Spinner) set_running(running bool)

用途

$&Spinner 上的操作:设置 running。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
running bool
running(bool)

返回值

不返回值。

($&Spinner) set_enabled

XuAPI
pub fn (spinner $&Spinner) set_enabled(enabled bool)

用途

$&Spinner 上的操作:设置 enabled。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Spinner) set_style

XuAPI
pub fn (spinner $&Spinner) set_style(style &ControlStyle) int

用途

$&Spinner 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

(&Spinner) style_or

XuAPI
pub fn (spinner &Spinner) style_or(styles &Styles) ControlStyle

用途

&Spinner 上的操作:执行 style or 操作。

参数

spinner &Spinner
本次调用使用的 Spinner 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Spinner) tick

XuAPI
pub fn (spinner $&Spinner) tick(now time.Instant,reduced_motion bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

(&Spinner) next_tick

XuAPI
pub fn (spinner &Spinner) next_tick(now time.Instant,reduced_motion bool) time.Instant

用途

&Spinner 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

spinner &Spinner
本次调用使用的 Spinner 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

time.Instant — 该类型的值

(&Spinner) measure_styled

XuAPI
pub fn (spinner &Spinner) measure_styled(styles &Styles) layout.Size

用途

&Spinner 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

spinner &Spinner
本次调用使用的 Spinner 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&Spinner) paint_styled

XuAPI
pub fn (spinner $&Spinner) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Spinner 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Spinner) set_appearance

XuAPI
pub fn (spinner $&Spinner) set_appearance(diameter f64,thickness f64,period time.Duration) int

用途

$&Spinner 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

spinner $&Spinner
本次调用使用的 Spinner 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
diameter f64
diameter(f64)
thickness f64
thickness(f64)
period time.Duration
period(time.Duration)

返回值

int — 该类型的值

struct SplitViewOptions

XuAPI
pub struct SplitViewOptions {
    pub vertical bool
    pub minimum_first f64
    pub minimum_second f64
    pub handle_size f64
    pub keyboard_step f64
}

用途

Widgets 配置参数与选项集合。

公开字段

vertical bool
字段(bool)
minimum_first f64
字段(f64)
minimum_second f64
字段(f64)
handle_size f64
字段(f64)
keyboard_step f64
字段(f64)

split_view_options

XuAPI
pub fn split_view_options() SplitViewOptions

用途

执行 split view options 操作。

参数

无需传入参数。

返回值

SplitViewOptions — 该类型的值

查看用法示例

struct SplitLayout

XuAPI
pub struct SplitLayout {
    pub first layout.Rect
    pub second layout.Rect
    pub handle layout.Rect
    pub ratio f64
    pub collapsed int
}

用途

承载 first、second、handle、ratio、collapsed 等属性的结构体。

公开字段

first layout.Rect
字段(layout.Rect)
second layout.Rect
字段(layout.Rect)
handle layout.Rect
字段(layout.Rect)
ratio f64
字段(f64)
collapsed int
字段(int)

struct SplitView

XuAPI
pub struct SplitView {

}

用途

SplitView 上下文或状态结构体。

公开字段

此类型没有公开字段。

split_view

XuAPI
pub fn split_view(identity &ui.CanvasEvent,id int,bounds &layout.Rect,ratio f64) SplitView

用途

拆分视图。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
ratio f64
ratio(f64)

返回值

SplitView — 该类型的值

(&SplitView) id

XuAPI
pub fn (v &SplitView) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&SplitView) bounds

XuAPI
pub fn (v &SplitView) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&SplitView) value

XuAPI
pub fn (v &SplitView) value() f64

用途

&SplitView 上的操作:值。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&SplitView) needs_paint

XuAPI
pub fn (v &SplitView) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&SplitView) painted

XuAPI
pub fn (v $&SplitView) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&SplitView) is_enabled

XuAPI
pub fn (v &SplitView) is_enabled() bool

用途

返回控件当前是否可用。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&SplitView) geometry

XuAPI
pub fn (v &SplitView) geometry(bounds &layout.Rect,density f64) SplitLayout

用途

在 &SplitView 上执行 geometry 操作。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
density f64
density(f64)

返回值

SplitLayout — 该类型的值

(&SplitView) layout

XuAPI
pub fn (v &SplitView) layout() SplitLayout

用途

在 &SplitView 上执行 layout 操作。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。

返回值

SplitLayout — 该类型的值

($&SplitView) set_ratio

XuAPI
pub fn (v $&SplitView) set_ratio(value f64) int

用途

$&SplitView 上的操作:设置 ratio。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)

返回值

int — 该类型的值

($&SplitView) set_collapsed

XuAPI
pub fn (v $&SplitView) set_collapsed(pane int,collapsed bool) int

用途

$&SplitView 上的操作:设置 collapsed。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
pane int
pane(int)
collapsed bool
collapsed(bool)

返回值

int — 该类型的值

($&SplitView) set_options

XuAPI
pub fn (v $&SplitView) set_options(o &SplitViewOptions) int

用途

$&SplitView 上的操作:设置 options。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
o &SplitViewOptions
o(只读借用,调用方仍持有原值;类型 &SplitViewOptions)

返回值

int — 该类型的值

($&SplitView) cancel

XuAPI
pub fn (v $&SplitView) cancel()

用途

$&SplitView 上的操作:取消。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&SplitView) set_focus

XuAPI
pub fn (v $&SplitView) set_focus(value bool)

用途

$&SplitView 上的操作:设置 focus。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&SplitView) set_enabled

XuAPI
pub fn (v $&SplitView) set_enabled(value bool)

用途

$&SplitView 上的操作:设置 enabled。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&SplitView) set_read_only

XuAPI
pub fn (v $&SplitView) set_read_only(value bool)

用途

$&SplitView 上的操作:设置 read only。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

不返回值。

($&SplitView) set_bounds

XuAPI
pub fn (v $&SplitView) set_bounds(b &layout.Rect) int

用途

$&SplitView 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
b &layout.Rect
b(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&SplitView) set_style

XuAPI
pub fn (v $&SplitView) set_style(style &ControlStyle) int

用途

$&SplitView 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&SplitView) clear_style

XuAPI
pub fn (v $&SplitView) clear_style()

用途

$&SplitView 上的操作:执行 clear style 操作。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&SplitView) set_motion

XuAPI
pub fn (v $&SplitView) set_motion(spec &MotionSpec) int

用途

$&SplitView 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&SplitView) apply_styles

XuAPI
pub fn (v $&SplitView) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&SplitView) tick

XuAPI
pub fn (v $&SplitView) tick(styles &Styles,now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&SplitView) next_tick

XuAPI
pub fn (v &SplitView) next_tick(now time.Instant) time.Instant

用途

&SplitView 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

v &SplitView
本次调用使用的 SplitView 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&SplitView) dispose

XuAPI
pub fn (v $&SplitView) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&SplitView) input

XuAPI
pub fn (v $&SplitView) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&SplitView) route

XuAPI
pub fn (v $&SplitView) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&SplitView) paint_styled

XuAPI
pub fn (v $&SplitView) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&SplitView 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

v $&SplitView
本次调用使用的 SplitView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

const PAINT_BACKGROUND

XuAPI
pub const PAINT_BACKGROUND = 1

用途

常量 PAINT_BACKGROUND,定义了相关的协议或算法配置参数。

const PAINT_FOREGROUND

XuAPI
pub const PAINT_FOREGROUND = 2

用途

常量 PAINT_FOREGROUND,定义了相关的协议或算法配置参数。

查看用法示例

const PAINT_BORDER

XuAPI
pub const PAINT_BORDER = 4

用途

常量 PAINT_BORDER,定义了相关的协议或算法配置参数。

查看用法示例

const PAINT_FOCUS

XuAPI
pub const PAINT_FOCUS = 8

用途

常量 PAINT_FOCUS,定义了相关的协议或算法配置参数。

const PAINT_SELECTION

XuAPI
pub const PAINT_SELECTION = 16

用途

常量 PAINT_SELECTION,定义了相关的协议或算法配置参数。

const PAINT_SELECTION_TEXT

XuAPI
pub const PAINT_SELECTION_TEXT = 32

用途

常量 PAINT_SELECTION_TEXT,定义了相关的协议或算法配置参数。

const PAINT_PLACEHOLDER

XuAPI
pub const PAINT_PLACEHOLDER = 64

用途

常量 PAINT_PLACEHOLDER,定义了相关的协议或算法配置参数。

const PAINT_ICON_OPACITY

XuAPI
pub const PAINT_ICON_OPACITY = 128

用途

常量 PAINT_ICON_OPACITY,定义了相关的协议或算法配置参数。

struct StatePaint

XuAPI
pub struct StatePaint {
    pub when int
    pub unless int
    pub fields int
    pub background draw.Color
    pub foreground draw.Color
    pub border draw.Color
    pub focus draw.Color
    pub selection draw.Color
    pub selection_text draw.Color
    pub placeholder draw.Color
    pub icon_opacity f64
}

用途

组合状态的选择性覆盖;全部 when 位匹配且没有 unless 位时生效。按数组顺序应用,后匹配规则胜出。

公开字段

when int
必须全部存在的状态位,0–127
unless int
任一出现便排除的状态位;不能与 when 重叠
fields int
paint_* 位掩码,0–255;只覆盖声明的字段
background draw.Color
字段(draw.Color)
foreground draw.Color
字段(draw.Color)
border draw.Color
字段(draw.Color)
focus draw.Color
字段(draw.Color)
selection draw.Color
字段(draw.Color)
selection_text draw.Color
字段(draw.Color)
placeholder draw.Color
字段(draw.Color)
icon_opacity f64
匹配后的绝对透明度,0–1

state_paint

XuAPI
pub fn state_paint(when int) StatePaint

用途

创建 when 规则,初始 fields=0;设置 paint_* 位后相应覆盖才生效。

参数

when int
必须匹配的组合状态位

返回值

待配置的规则

查看用法示例

struct ResolvedStyle

XuAPI
pub struct ResolvedStyle {
    pub background draw.Color
    pub foreground draw.Color
    pub border draw.Color
    pub focus draw.Color
    pub selection draw.Color
    pub selection_text draw.Color
    pub placeholder draw.Color
    pub icon_opacity f64
}

用途

承载 background、foreground、border、focus、selection 等属性的结构体。

公开字段

background draw.Color
字段(draw.Color)
foreground draw.Color
字段(draw.Color)
border draw.Color
字段(draw.Color)
focus draw.Color
字段(draw.Color)
selection draw.Color
字段(draw.Color)
selection_text draw.Color
字段(draw.Color)
placeholder draw.Color
字段(draw.Color)
icon_opacity f64
字段(f64)

(&ControlStyle) resolve

XuAPI
pub fn (c &ControlStyle) resolve(state int) ResolvedStyle

用途

按基础调色板与顺序规则解析组合状态,不改变控件。

参数

c &ControlStyle
本次调用使用的 ControlStyle 实例;以只读借用传入,调用方仍持有实例。
state int
state(int)

返回值

已解析的颜色与图标透明度

const STATE_DISABLED

XuAPI
pub const STATE_DISABLED = 1

用途

常量 STATE_DISABLED,定义了相关的协议或算法配置参数。

查看用法示例

const STATE_HOVERED

XuAPI
pub const STATE_HOVERED = 2

用途

常量 STATE_HOVERED,定义了相关的协议或算法配置参数。

查看用法示例

const STATE_PRESSED

XuAPI
pub const STATE_PRESSED = 4

用途

常量 STATE_PRESSED,定义了相关的协议或算法配置参数。

const STATE_FOCUSED

XuAPI
pub const STATE_FOCUSED = 8

用途

常量 STATE_FOCUSED,定义了相关的协议或算法配置参数。

查看用法示例

const STATE_SELECTED

XuAPI
pub const STATE_SELECTED = 16

用途

常量 STATE_SELECTED,定义了相关的协议或算法配置参数。

const STATE_INVALID

XuAPI
pub const STATE_INVALID = 32

用途

常量 STATE_INVALID,定义了相关的协议或算法配置参数。

查看用法示例

const STATE_READ_ONLY

XuAPI
pub const STATE_READ_ONLY = 64

用途

常量 STATE_READ_ONLY,定义了相关的协议或算法配置参数。

查看用法示例

const ICON_LEADING

XuAPI
pub const ICON_LEADING = 0

用途

常量 ICON_LEADING,定义了相关的协议或算法配置参数。

查看用法示例

const ICON_TRAILING

XuAPI
pub const ICON_TRAILING = 1

用途

常量 ICON_TRAILING,定义了相关的协议或算法配置参数。

查看用法示例

const ICON_ABOVE

XuAPI
pub const ICON_ABOVE = 2

用途

常量 ICON_ABOVE,定义了相关的协议或算法配置参数。

查看用法示例

const ICON_BELOW

XuAPI
pub const ICON_BELOW = 3

用途

常量 ICON_BELOW,定义了相关的协议或算法配置参数。

查看用法示例

struct FontStyle

XuAPI
pub struct FontStyle {
    pub family string
    pub size f64
    pub weight int
    pub italic bool
    pub line_height f64
}

用途

字体配置;空 family 使用系统字体,size 与 line_height 使用逻辑像素。

公开字段

family string
UTF-8 字体族名,最多 256 字节且不含 NUL;空值用系统字体
size f64
基础字号,1–512;缩放后仍须在该范围
weight int
字重,100–900
italic bool
是否斜体
line_height f64
0 使用默认;显式值不小于 size 且不超过 1024

font_style

XuAPI
pub fn font_style(size f64) FontStyle

用途

执行 font style 操作。

参数

size f64
size(f64)

返回值

FontStyle — 该类型的值

struct Palette

XuAPI
pub struct Palette {
    pub normal draw.Color
    pub hovered draw.Color
    pub pressed draw.Color
    pub disabled draw.Color
    pub foreground draw.Color
    pub muted draw.Color
    pub accent draw.Color
    pub on_accent draw.Color
    pub focus draw.Color
    pub border draw.Color
    pub invalid draw.Color
    pub invalid_fill draw.Color
    pub read_only draw.Color
    pub selection draw.Color
    pub selection_text draw.Color
    pub placeholder draw.Color
}

用途

基础状态调色板;背景优先级:禁用、错误、只读、选中、按下、悬停、普通。

公开字段

normal draw.Color
普通背景
hovered draw.Color
悬停背景
pressed draw.Color
按下背景
disabled draw.Color
禁用背景
foreground draw.Color
普通前景
muted draw.Color
禁用前景
accent draw.Color
选中背景及进度指示条
on_accent draw.Color
选中状态前景
focus draw.Color
焦点环颜色
border draw.Color
普通边框
invalid draw.Color
错误边框及错误进度条
invalid_fill draw.Color
错误背景
read_only draw.Color
只读背景
selection draw.Color
文字选区背景
selection_text draw.Color
文字选区前景
placeholder draw.Color
占位文字

struct ControlStyle

XuAPI
pub struct ControlStyle {
    pub palette Palette
    pub font FontStyle
    pub inherit_font bool
    pub padding layout.Insets
    pub radius f64
    pub border_width f64
    pub focus_width f64
    pub focus_inset f64
    pub min_width f64
    pub min_height f64
    pub gap f64
    pub indicator_size f64
    pub mark_width f64
    pub caret_width f64
    pub preedit_width f64
    pub shadow_x f64
    pub shadow_y f64
    pub shadow_spread f64
    pub shadow_blur f64
    pub align_x f64
    pub align_y f64
    pub icon_size f64
    pub icon_placement int
    pub icon_opacity f64
    pub disabled_icon_opacity f64
    pub shadow draw.Color
    pub states []StatePaint
}

用途

控件颜色、字体和几何样式。指标为非负有限值;偏移允许负数。用 clone 深复制规则数组。

公开字段

palette Palette
基础状态颜色
font FontStyle
控件独立字体
inherit_font bool
true 继承 Styles.font;false 使用本控件 font
padding layout.Insets
内容内边距,随 density 缩放
radius f64
圆角半径,随 density 缩放
border_width f64
边框宽度,随 density 缩放
focus_width f64
焦点环宽度;0 隐藏
focus_inset f64
焦点环内缩
min_width f64
最小逻辑宽度
min_height f64
最小逻辑高度;Scroll 中作为最小滑块长度
gap f64
文字、图标或指示器间距
indicator_size f64
Checkbox 指示器尺寸或 Scroll 条宽
mark_width f64
Checkbox 标记线宽
caret_width f64
编辑器光标宽度
preedit_width f64
预编辑下划线宽度
shadow_x f64
阴影水平偏移
shadow_y f64
阴影垂直偏移
shadow_spread f64
阴影扩展半径
shadow_blur f64
至多八层近似的阴影模糊半径
align_x f64
水平对齐,0–1
align_y f64
垂直对齐,0–1
icon_size f64
图片图标方形边长;0 不留图标间距
icon_placement int
icon_leading / trailing / above / below
icon_opacity f64
图标透明度,0–1
disabled_icon_opacity f64
禁用时再乘此透明度,0–1
shadow draw.Color
阴影颜色;透明表示无阴影
states []StatePaint
最多 32 条规则;后匹配的字段覆盖先匹配值

查看用法示例

struct Styles

XuAPI
pub struct Styles {
    pub font FontStyle
    pub text_scale f64
    pub density f64
    pub background draw.Color
    pub button ControlStyle
    pub checkbox ControlStyle
    pub input ControlStyle
    pub text_area ControlStyle
    pub progress ControlStyle
    pub scroll ControlStyle
}

用途

完整控件主题;文本缩放与几何密度独立。通过工厂构造后修改,并调用 validate。

公开字段

font FontStyle
全局字体;inherit_font=true 的控件继承它
text_scale f64
文字缩放,0.5–4.0
density f64
几何缩放,0.5–4.0;不缩放文字
background draw.Color
View 的背景色;提交帧时须不透明
button ControlStyle
按钮样式
checkbox ControlStyle
复选框样式
input ControlStyle
单行编辑样式
text_area ControlStyle
多行编辑样式
progress ControlStyle
进度条样式
scroll ControlStyle
滚动条样式

查看用法示例

dark_styles

XuAPI
pub fn dark_styles() Styles

用途

创建完整的深色主题;后续主题切换由应用控制。

参数

无需传入参数。

返回值

独立 Styles 值

查看用法示例

light_styles

XuAPI
pub fn light_styles() Styles

用途

创建完整的浅色主题;后续主题切换由应用控制。

参数

无需传入参数。

返回值

独立 Styles 值

查看用法示例

contrast_styles

XuAPI
pub fn contrast_styles() Styles

用途

创建完整的高对比度主题;后续主题切换由应用控制。

参数

无需传入参数。

返回值

独立 Styles 值

(&Styles) same_as

XuAPI
pub fn (styles &Styles) same_as(other &Styles) bool

用途

比较完整主题,含状态规则。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。
other &Styles
另一侧同类型值(只读借用,调用方仍持有原值;类型 &Styles)

返回值

是否完全相同

(&Styles) same_metrics

XuAPI
pub fn (styles &Styles) same_metrics(other &Styles) bool

用途

比较影响文字与几何测量的字段;颜色与装饰不影响结果。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。
other &Styles
另一侧同类型值(只读借用,调用方仍持有原值;类型 &Styles)

返回值

测量指标是否相同

(&Styles) validate

XuAPI
pub fn (styles &Styles) validate() int

用途

校验字体、缩放、密度、几何与状态规则;无效值抛出错误。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

成功为 0;失败抛出错误

(&Styles) text_options

XuAPI
pub fn (styles &Styles) text_options(control &ControlStyle) draw.TextOptions

用途

&Styles 上的操作:执行 text options 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。
control &ControlStyle
control(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

draw.TextOptions — 该类型的值

rounded_fill

XuAPI
pub fn rounded_fill(frame $&draw.Frame,bounds &layout.Rect,radius f64,color draw.Color) int

用途

执行 rounded fill 操作。失败时抛出错误,调用方需处理或继续传播。

参数

frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
radius f64
radius(f64)
color draw.Color
color(draw.Color)

返回值

int — 该类型的值

style_box

XuAPI
pub fn style_box(frame $&draw.Frame,bounds &layout.Rect,style &ControlStyle,density f64,state int) int

用途

执行 style box 操作。失败时抛出错误,调用方需处理或继续传播。

参数

frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)
density f64
density(f64)
state int
state(int)

返回值

int — 该类型的值

(&FontStyle) validate

XuAPI
pub fn (font &FontStyle) validate() int

用途

在 &FontStyle 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

font &FontStyle
本次调用使用的 FontStyle 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ControlStyle) validate

XuAPI
pub fn (c &ControlStyle) validate() int

用途

在 &ControlStyle 上执行 validate 操作。失败时抛出错误,调用方需处理或继续传播。

参数

c &ControlStyle
本次调用使用的 ControlStyle 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ControlStyle) same_as

XuAPI
pub fn (c &ControlStyle) same_as(other &ControlStyle) bool

用途

&ControlStyle 上的操作:执行 same as 操作。

参数

c &ControlStyle
本次调用使用的 ControlStyle 实例;以只读借用传入,调用方仍持有实例。
other &ControlStyle
另一侧同类型值(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

bool — 是否成立

(&ControlStyle) same_metrics

XuAPI
pub fn (c &ControlStyle) same_metrics(other &ControlStyle) bool

用途

&ControlStyle 上的操作:执行 same metrics 操作。

参数

c &ControlStyle
本次调用使用的 ControlStyle 实例;以只读借用传入,调用方仍持有实例。
other &ControlStyle
另一侧同类型值(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

bool — 是否成立

paint_box_styled

XuAPI
pub fn paint_box_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,control &ControlStyle,state int) int

用途

执行 paint box styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
control &ControlStyle
control(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)

返回值

int — 该类型的值

struct StyledLabel

XuAPI
pub struct StyledLabel {

}

用途

拥有文字与原生排版缓存的标签;改色复用排版,字体变化重新排版,用完 dispose。

公开字段

此类型没有公开字段。

查看用法示例

styled_label

XuAPI
pub fn styled_label(context &draw.Context,value &string) StyledLabel

用途

执行 styled label 操作。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

StyledLabel — 该类型的值

查看用法示例

($&StyledLabel) set_font_stack

XuAPI
pub fn (label $&StyledLabel) set_font_stack(stack font.FontStack)

用途

$&StyledLabel 上的操作:设置 font stack。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
stack font.FontStack
stack(font.FontStack)

返回值

不返回值。

($&StyledLabel) add_ttf_bytes

XuAPI
pub fn (label $&StyledLabel) add_ttf_bytes(ttf_bytes &[]u8,font_index int,face_id int) int

用途

$&StyledLabel 上的操作:执行 add ttf bytes 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
ttf_bytes &[]u8
ttf_bytes(只读借用,调用方仍持有原值;类型 &[]u8)
font_index int
font_index(int)
face_id int
face_id(int)

返回值

int — 该类型的值

(&StyledLabel) paint_layout_at

XuAPI
pub fn (label &StyledLabel) paint_layout_at(frame $&draw.Frame,shaped &draw.TextLayout,x f64,y f64,color draw.Color) int

用途

&StyledLabel 上的操作:执行 paint layout at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label &StyledLabel
本次调用使用的 StyledLabel 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
shaped &draw.TextLayout
shaped(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
x f64
值(f64)
y f64
值(f64)
color draw.Color
color(draw.Color)

返回值

int — 该类型的值

(&StyledLabel) text

XuAPI
pub fn (label &StyledLabel) text() string

用途

&StyledLabel 上的操作:返回当前文本。

参数

label &StyledLabel
本次调用使用的 StyledLabel 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&StyledLabel) has_style

XuAPI
pub fn (label &StyledLabel) has_style() bool

用途

&StyledLabel 上的操作:判断是否具有 style。

参数

label &StyledLabel
本次调用使用的 StyledLabel 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&StyledLabel) style_or

XuAPI
pub fn (label &StyledLabel) style_or(fallback &ControlStyle) ControlStyle

用途

&StyledLabel 上的操作:执行 style or 操作。

参数

label &StyledLabel
本次调用使用的 StyledLabel 实例;以只读借用传入,调用方仍持有实例。
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

ControlStyle — 该类型的值

($&StyledLabel) set_style

XuAPI
pub fn (label $&StyledLabel) set_style(style &ControlStyle) int

用途

$&StyledLabel 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&StyledLabel) clear_style

XuAPI
pub fn (label $&StyledLabel) clear_style()

用途

$&StyledLabel 上的操作:执行 clear style 操作。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&StyledLabel) set_text

XuAPI
pub fn (label $&StyledLabel) set_text(value &string)

用途

替换拥有的文字;接入 View 时还需 mark_measure。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &string
value(只读借用,调用方仍持有原值;类型 &string)

返回值

不返回值。

($&StyledLabel) measure_styled

XuAPI
pub fn (label $&StyledLabel) measure_styled(styles &Styles,control &ControlStyle) layout.Size

用途

按有效字体、密度、内容和最小尺寸测量StyledLabel。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
control &ControlStyle
control(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

固有逻辑尺寸;原生排版失败时抛出错误

($&StyledLabel) measure_wrapped

XuAPI
pub fn (label $&StyledLabel) measure_wrapped(styles &Styles,control &ControlStyle,width f64) layout.Size

用途

$&StyledLabel 上的操作:执行 measure wrapped 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
control &ControlStyle
control(只读借用,调用方仍持有原值;类型 &ControlStyle)
width f64
width(f64)

返回值

layout.Size — 该类型的值

($&StyledLabel) measure_box_styled

XuAPI
pub fn (label $&StyledLabel) measure_box_styled(styles &Styles,fallback &ControlStyle) layout.Size

用途

$&StyledLabel 上的操作:执行 measure box styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

layout.Size — 该类型的值

($&StyledLabel) paint_text_styled

XuAPI
pub fn (label $&StyledLabel) paint_text_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int) int

用途

$&StyledLabel 上的操作:执行 paint text styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)

返回值

int — 该类型的值

($&StyledLabel) paint_styled

XuAPI
pub fn (label $&StyledLabel) paint_styled(frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int) int

用途

$&StyledLabel 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)

返回值

int — 该类型的值

($&StyledLabel) dispose

XuAPI
pub fn (label $&StyledLabel) dispose()

用途

释放标签的原生排版缓存。

参数

label $&StyledLabel
本次调用使用的 StyledLabel 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

copy_font

XuAPI
pub fn copy_font(font &FontStyle) FontStyle

用途

执行 copy font 操作。

参数

font &FontStyle
font(只读借用,调用方仍持有原值;类型 &FontStyle)

返回值

FontStyle — 该类型的值

(&ControlStyle) clone

XuAPI
pub fn (c &ControlStyle) clone() ControlStyle

用途

深复制控件样式及状态规则数组。

参数

c &ControlStyle
本次调用使用的 ControlStyle 实例;以只读借用传入,调用方仍持有实例。

返回值

独立 ControlStyle

(&Styles) clone

XuAPI
pub fn (s &Styles) clone() Styles

用途

深复制主题,包括各控件的状态规则数组。

参数

s &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

独立 Styles

(&Styles) switch_style

XuAPI
pub fn (styles &Styles) switch_style() ControlStyle

用途

&Styles 上的操作:执行 switch style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) radio_style

XuAPI
pub fn (styles &Styles) radio_style() ControlStyle

用途

&Styles 上的操作:执行 radio style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) slider_style

XuAPI
pub fn (styles &Styles) slider_style() ControlStyle

用途

&Styles 上的操作:执行 slider style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) tabs_style

XuAPI
pub fn (styles &Styles) tabs_style() ControlStyle

用途

&Styles 上的操作:执行 tabs style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) select_style

XuAPI
pub fn (styles &Styles) select_style() ControlStyle

用途

&Styles 上的操作:执行 select style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) divider_style

XuAPI
pub fn (styles &Styles) divider_style() ControlStyle

用途

&Styles 上的操作:执行 divider style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) badge_style

XuAPI
pub fn (styles &Styles) badge_style() ControlStyle

用途

&Styles 上的操作:执行 badge style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) card_style

XuAPI
pub fn (styles &Styles) card_style() ControlStyle

用途

&Styles 上的操作:执行 card style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) stepper_style

XuAPI
pub fn (styles &Styles) stepper_style() ControlStyle

用途

&Styles 上的操作:执行 stepper style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) list_box_style

XuAPI
pub fn (styles &Styles) list_box_style() ControlStyle

用途

&Styles 上的操作:执行 list box style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Styles) menu_style

XuAPI
pub fn (styles &Styles) menu_style() ControlStyle

用途

&Styles 上的操作:执行 menu style 操作。

参数

styles &Styles
本次调用使用的 Styles 实例;以只读借用传入,调用方仍持有实例。

返回值

ControlStyle — 该类型的值

(&Button) visual_state

XuAPI
pub fn (button &Button) visual_state() int

用途

&Button 上的操作:执行 visual state 操作。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Button) has_style

XuAPI
pub fn (button &Button) has_style() bool

用途

&Button 上的操作:判断是否具有 style。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) style_or

XuAPI
pub fn (button &Button) style_or(styles &Styles) ControlStyle

用途

&Button 上的操作:执行 style or 操作。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Button) set_style

XuAPI
pub fn (button $&Button) set_style(style &ControlStyle) int

用途

$&Button 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Button) clear_style

XuAPI
pub fn (button $&Button) clear_style()

用途

$&Button 上的操作:执行 clear style 操作。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Button) is_invalid

XuAPI
pub fn (button &Button) is_invalid() bool

用途

&Button 上的操作:判断是否 invalid。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_selected

XuAPI
pub fn (button &Button) is_selected() bool

用途

&Button 上的操作:判断是否 selected。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_read_only

XuAPI
pub fn (button &Button) is_read_only() bool

用途

&Button 上的操作:判断是否 read only。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_hovered

XuAPI
pub fn (button &Button) is_hovered() bool

用途

&Button 上的操作:判断是否 hovered。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Button) is_pressed

XuAPI
pub fn (button &Button) is_pressed() bool

用途

&Button 上的操作:判断是否 pressed。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Button) set_read_only

XuAPI
pub fn (button $&Button) set_read_only(read_only bool)

用途

$&Button 上的操作:设置 read only。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

(&Button) measure_styled

XuAPI
pub fn (button &Button) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

按有效字体、密度、内容和最小尺寸测量Button。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

固有逻辑尺寸;原生排版失败时抛出错误

(&Button) paint_styled

XuAPI
pub fn (button &Button) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

使用当前完整主题绘制Button;控件边界与 Frame 使用相同的局部坐标。

参数

button &Button
本次调用使用的 Button 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

(&Checkbox) id

XuAPI
pub fn (checkbox &Checkbox) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Checkbox) bounds

XuAPI
pub fn (checkbox &Checkbox) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Checkbox) is_focused

XuAPI
pub fn (checkbox &Checkbox) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Checkbox) is_enabled

XuAPI
pub fn (checkbox &Checkbox) is_enabled() bool

用途

返回控件当前是否可用。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Checkbox) is_invalid

XuAPI
pub fn (checkbox &Checkbox) is_invalid() bool

用途

&Checkbox 上的操作:判断是否 invalid。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Checkbox) is_read_only

XuAPI
pub fn (checkbox &Checkbox) is_read_only() bool

用途

&Checkbox 上的操作:判断是否 read only。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Checkbox) set_read_only

XuAPI
pub fn (checkbox $&Checkbox) set_read_only(read_only bool)

用途

$&Checkbox 上的操作:设置 read only。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

不返回值。

(&Checkbox) visual_state

XuAPI
pub fn (checkbox &Checkbox) visual_state() int

用途

&Checkbox 上的操作:执行 visual state 操作。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Checkbox) has_style

XuAPI
pub fn (checkbox &Checkbox) has_style() bool

用途

&Checkbox 上的操作:判断是否具有 style。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Checkbox) style_or

XuAPI
pub fn (checkbox &Checkbox) style_or(styles &Styles) ControlStyle

用途

&Checkbox 上的操作:执行 style or 操作。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Checkbox) set_style

XuAPI
pub fn (checkbox $&Checkbox) set_style(style &ControlStyle) int

用途

$&Checkbox 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Checkbox) clear_style

XuAPI
pub fn (checkbox $&Checkbox) clear_style()

用途

$&Checkbox 上的操作:执行 clear style 操作。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Checkbox) measure_styled

XuAPI
pub fn (checkbox &Checkbox) measure_styled(label $&StyledLabel,styles &Styles) layout.Size

用途

按有效字体、密度、内容和最小尺寸测量Checkbox。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

固有逻辑尺寸;原生排版失败时抛出错误

(&Checkbox) paint_styled

XuAPI
pub fn (checkbox &Checkbox) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

使用当前完整主题绘制Checkbox;控件边界与 Frame 使用相同的局部坐标。

参数

checkbox &Checkbox
本次调用使用的 Checkbox 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

(&Progress) bounds

XuAPI
pub fn (progress &Progress) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Progress) is_enabled

XuAPI
pub fn (progress &Progress) is_enabled() bool

用途

返回控件当前是否可用。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Progress) is_invalid

XuAPI
pub fn (progress &Progress) is_invalid() bool

用途

&Progress 上的操作:判断是否 invalid。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Progress) is_focused

XuAPI
pub fn (progress &Progress) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Progress) is_selected

XuAPI
pub fn (progress &Progress) is_selected() bool

用途

&Progress 上的操作:判断是否 selected。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Progress) set_focus

XuAPI
pub fn (progress $&Progress) set_focus(focused bool)

用途

$&Progress 上的操作:设置 focus。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Progress) set_selected

XuAPI
pub fn (progress $&Progress) set_selected(selected bool)

用途

$&Progress 上的操作:设置 selected。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
selected(bool)

返回值

不返回值。

(&Progress) visual_state

XuAPI
pub fn (progress &Progress) visual_state() int

用途

&Progress 上的操作:执行 visual state 操作。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Progress) has_style

XuAPI
pub fn (progress &Progress) has_style() bool

用途

&Progress 上的操作:判断是否具有 style。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Progress) style_or

XuAPI
pub fn (progress &Progress) style_or(styles &Styles) ControlStyle

用途

&Progress 上的操作:执行 style or 操作。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Progress) set_style

XuAPI
pub fn (progress $&Progress) set_style(style &ControlStyle) int

用途

$&Progress 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Progress) clear_style

XuAPI
pub fn (progress $&Progress) clear_style()

用途

$&Progress 上的操作:执行 clear style 操作。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Progress) measure_styled

XuAPI
pub fn (progress &Progress) measure_styled(styles &Styles) layout.Size

用途

&Progress 上的操作:执行 measure styled 操作。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(&Progress) paint_styled

XuAPI
pub fn (progress &Progress) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

使用当前完整主题绘制Progress;控件边界与 Frame 使用相同的局部坐标。

参数

progress &Progress
本次调用使用的 Progress 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

($&Button) set_invalid

XuAPI
pub fn (button $&Button) set_invalid(invalid bool)

用途

$&Button 上的操作:设置 invalid。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&Button) set_selected

XuAPI
pub fn (button $&Button) set_selected(selected bool)

用途

设置按钮的持续选中外观,适合工具栏模式开关;选中与短暂按下是不同状态。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selected bool
是否显示为选中;这不会模拟一次点击或发出激活动作。

返回值

不返回值;状态改变时标记需要重绘。

($&Checkbox) set_invalid

XuAPI
pub fn (checkbox $&Checkbox) set_invalid(invalid bool)

用途

$&Checkbox 上的操作:设置 invalid。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&Progress) set_enabled

XuAPI
pub fn (progress $&Progress) set_enabled(enabled bool)

用途

$&Progress 上的操作:设置 enabled。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Progress) set_invalid

XuAPI
pub fn (progress $&Progress) set_invalid(invalid bool)

用途

$&Progress 上的操作:设置 invalid。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&Progress) set_buffer

XuAPI
pub fn (progress $&Progress) set_buffer(value f64) int

用途

$&Progress 上的操作:设置 buffer。失败时抛出错误,调用方需处理或继续传播。

参数

progress $&Progress
本次调用使用的 Progress 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value f64
value(f64)

返回值

int — 该类型的值

struct Table

XuAPI
pub struct Table {

}

用途

等宽单行数据表格控件,支持多列排版与行选中。

公开字段

此类型没有公开字段。

table

XuAPI
pub fn table(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,headers &[]string,rows int,selected int) Table

用途

表。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
headers &[]string
headers(只读借用,调用方仍持有原值;类型 &[]string)
rows int
rows(int)
selected int
selected(int)

返回值

Table — 该类型的值

(&Table) id

XuAPI
pub fn (t &Table) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) bounds

XuAPI
pub fn (t &Table) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Table) count

XuAPI
pub fn (t &Table) count() int

用途

返回该控件当前包含的项目数量。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) column_count

XuAPI
pub fn (t &Table) column_count() int

用途

&Table 上的操作:执行 column count 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) selected

XuAPI
pub fn (t &Table) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) sort_column

XuAPI
pub fn (t &Table) sort_column() int

用途

&Table 上的操作:执行 sort column 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) sort_descending

XuAPI
pub fn (t &Table) sort_descending() bool

用途

&Table 上的操作:执行 sort descending 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Table) scroll_offset

XuAPI
pub fn (t &Table) scroll_offset() f64

用途

&Table 上的操作:执行 scroll offset 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Table) needs_paint

XuAPI
pub fn (t &Table) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Table) painted

XuAPI
pub fn (t $&Table) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Table) is_selectable

XuAPI
pub fn (t &Table) is_selectable() bool

用途

&Table 上的操作:判断是否 selectable。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Table) set_selectable

XuAPI
pub fn (t $&Table) set_selectable(selectable bool)

用途

$&Table 上的操作:设置 selectable。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&Table) has_popup_open

XuAPI
pub fn (t &Table) has_popup_open() bool

用途

&Table 上的操作:判断是否具有 popup open。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Table) popup_bounds

XuAPI
pub fn (t &Table) popup_bounds() layout.Rect

用途

&Table 上的操作:执行 popup bounds 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Table) set_viewport

XuAPI
pub fn (t $&Table) set_viewport(viewport &layout.Rect)

用途

$&Table 上的操作:设置 viewport。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&Table) paint_popup_styled

XuAPI
pub fn (t $&Table) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Table 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Table) cursor

XuAPI
pub fn (t &Table) cursor() int

用途

&Table 上的操作:游标。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) is_enabled

XuAPI
pub fn (t &Table) is_enabled() bool

用途

返回控件当前是否可用。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Table) is_focused

XuAPI
pub fn (t &Table) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Table) is_read_only

XuAPI
pub fn (t &Table) is_read_only() bool

用途

&Table 上的操作:判断是否 read only。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Table) cancel

XuAPI
pub fn (t $&Table) cancel()

用途

$&Table 上的操作:取消。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Table) set_focus

XuAPI
pub fn (t $&Table) set_focus(focused bool)

用途

$&Table 上的操作:设置 focus。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&Table) set_enabled

XuAPI
pub fn (t $&Table) set_enabled(enabled bool)

用途

$&Table 上的操作:设置 enabled。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&Table) set_read_only

XuAPI
pub fn (t $&Table) set_read_only(value bool) int

用途

$&Table 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

int — 该类型的值

($&Table) set_cell

XuAPI
pub fn (t $&Table) set_cell(row int,column int,text &string) int

用途

$&Table 上的操作:设置 cell。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
row int
row(int)
column int
column(int)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

(&Table) cell

XuAPI
pub fn (t &Table) cell(row int,column int) string

用途

在 &Table 上执行 cell 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
row int
row(int)
column int
column(int)

返回值

string — 结果字符串

($&Table) set_rows

XuAPI
pub fn (t $&Table) set_rows(count int) int

用途

$&Table 上的操作:设置 rows。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
count int
count(int)

返回值

int — 该类型的值

($&Table) set_selected

XuAPI
pub fn (t $&Table) set_selected(index int) int

用途

$&Table 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&Table) set_scroll_offset

XuAPI
pub fn (t $&Table) set_scroll_offset(offset f64) int

用途

$&Table 上的操作:设置 scroll offset。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
offset f64
偏移(f64)

返回值

int — 该类型的值

($&Table) set_bounds

XuAPI
pub fn (t $&Table) set_bounds(bounds &layout.Rect) int

用途

$&Table 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&Table) style_or

XuAPI
pub fn (t &Table) style_or(styles &Styles) ControlStyle

用途

&Table 上的操作:执行 style or 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Table) set_style

XuAPI
pub fn (t $&Table) set_style(style &ControlStyle) int

用途

$&Table 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Table) clear_style

XuAPI
pub fn (t $&Table) clear_style()

用途

$&Table 上的操作:执行 clear style 操作。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Table) apply_styles

XuAPI
pub fn (t $&Table) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Table) row_bounds

XuAPI
pub fn (t &Table) row_bounds(row int) layout.Rect

用途

&Table 上的操作:执行 row bounds 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
row int
row(int)

返回值

layout.Rect — 该类型的值

(&Table) header_bounds

XuAPI
pub fn (t &Table) header_bounds(column int) layout.Rect

用途

&Table 上的操作:执行 header bounds 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
column int
column(int)

返回值

layout.Rect — 该类型的值

(&Table) row_text

XuAPI
pub fn (t &Table) row_text(source_row int) string

用途

&Table 上的操作:执行 row text 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
source_row int
source_row(int)

返回值

string — 结果字符串

($&Table) input

XuAPI
pub fn (t $&Table) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Table) route

XuAPI
pub fn (t $&Table) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Table) event

XuAPI
pub fn (t $&Table) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Table) measure_styled

XuAPI
pub fn (t $&Table) measure_styled(styles &Styles) layout.Size

用途

$&Table 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&Table) dispose

XuAPI
pub fn (t $&Table) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Table) selected_text

XuAPI
pub fn (t &Table) selected_text() string

用途

&Table 上的操作:执行 selected text 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Table) column_width

XuAPI
pub fn (t &Table) column_width(column int) f64

用途

&Table 上的操作:执行 column width 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
column int
column(int)

返回值

f64 — 该类型的值

($&Table) set_column_width

XuAPI
pub fn (t $&Table) set_column_width(column int,width f64) int

用途

$&Table 上的操作:设置 column width。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
column int
column(int)
width f64
width(f64)

返回值

int — 该类型的值

($&Table) set_column_alignment

XuAPI
pub fn (t $&Table) set_column_alignment(column int,alignment f64) int

用途

$&Table 上的操作:设置 column alignment。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
column int
column(int)
alignment f64
alignment(f64)

返回值

int — 该类型的值

($&Table) set_horizontal_offset

XuAPI
pub fn (t $&Table) set_horizontal_offset(offset f64) int

用途

$&Table 上的操作:设置 horizontal offset。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
offset f64
偏移(f64)

返回值

int — 该类型的值

(&Table) horizontal_offset

XuAPI
pub fn (t &Table) horizontal_offset() f64

用途

&Table 上的操作:执行 horizontal offset 操作。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

($&Table) set_status

XuAPI
pub fn (t $&Table) set_status(text &string) int

用途

$&Table 上的操作:设置 status。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&Table) paint_styled

XuAPI
pub fn (t $&Table) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Table 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Table) set_column_min_width

XuAPI
pub fn (t $&Table) set_column_min_width(column int,width f64) int

用途

$&Table 上的操作:设置 column min width。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
column int
column(int)
width f64
width(f64)

返回值

int — 该类型的值

($&Screen) set_table_column_min_width

XuAPI
pub fn (s $&Screen) set_table_column_min_width(id int,column int,width f64) int

用途

$&Screen 上的操作:设置 table column min width。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
column int
column(int)
width f64
width(f64)

返回值

int — 该类型的值

const TABLE_SORT_TEXT

XuAPI
pub const TABLE_SORT_TEXT = 0

用途

常量 TABLE_SORT_TEXT,定义了相关的协议或算法配置参数。

const TABLE_SORT_NUMBER

XuAPI
pub const TABLE_SORT_NUMBER = 1

用途

常量 TABLE_SORT_NUMBER,定义了相关的协议或算法配置参数。

查看用法示例

(&Table) row_at

XuAPI
pub fn (t &Table) row_at(view_row int) int

用途

&Table 上的操作:执行 row at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
view_row int
view_row(int)

返回值

int — 该类型的值

(&Table) view_row

XuAPI
pub fn (t &Table) view_row(source_row int) int

用途

&Table 上的操作:执行 view row 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
source_row int
source_row(int)

返回值

int — 该类型的值

(&Table) selected_row

XuAPI
pub fn (t &Table) selected_row() int

用途

&Table 上的操作:执行 selected row 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Table) view_cell

XuAPI
pub fn (t &Table) view_cell(row int,column int) string

用途

&Table 上的操作:执行 view cell 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Table
本次调用使用的 Table 实例;以只读借用传入,调用方仍持有实例。
row int
row(int)
column int
column(int)

返回值

string — 结果字符串

($&Table) set_selected_row

XuAPI
pub fn (t $&Table) set_selected_row(source_row int) int

用途

$&Table 上的操作:设置 selected row。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
source_row int
source_row(int)

返回值

int — 该类型的值

($&Table) sort_by

XuAPI
pub fn (t $&Table) sort_by(column int,descending bool) int

用途

$&Table 上的操作:排序按。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
column int
column(int)
descending bool
descending(bool)

返回值

int — 该类型的值

($&Table) refresh_sort

XuAPI
pub fn (t $&Table) refresh_sort() int

用途

$&Table 上的操作:执行 refresh sort 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&Table) set_sort_kind

XuAPI
pub fn (t $&Table) set_sort_kind(column int,kind int) int

用途

$&Table 上的操作:设置 sort kind。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
column int
column(int)
kind int
类型标签(int)

返回值

int — 该类型的值

($&Table) set_local_sort

XuAPI
pub fn (t $&Table) set_local_sort(enabled bool) int

用途

$&Table 上的操作:设置 local sort。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Table
本次调用使用的 Table 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

const TASK_IDLE

XuAPI
pub const TASK_IDLE = 0

用途

常量 TASK_IDLE,定义了相关的协议或算法配置参数。

const TASK_RUNNING

XuAPI
pub const TASK_RUNNING = 1

用途

常量 TASK_RUNNING,定义了相关的协议或算法配置参数。

const TASK_SUCCESS

XuAPI
pub const TASK_SUCCESS = 2

用途

常量 TASK_SUCCESS,定义了相关的协议或算法配置参数。

查看用法示例

const TASK_ERROR

XuAPI
pub const TASK_ERROR = 3

用途

常量 TASK_ERROR,定义了相关的协议或算法配置参数。

查看用法示例

const TASK_CANCELLED

XuAPI
pub const TASK_CANCELLED = 4

用途

常量 TASK_CANCELLED,定义了相关的协议或算法配置参数。

查看用法示例

const TASK_PROGRESS_LINE

XuAPI
pub const TASK_PROGRESS_LINE = 0

用途

常量 TASK_PROGRESS_LINE,定义了相关的协议或算法配置参数。

const TASK_PROGRESS_FILL

XuAPI
pub const TASK_PROGRESS_FILL = 1

用途

常量 TASK_PROGRESS_FILL,定义了相关的协议或算法配置参数。

const TASK_PROGRESS_ICON

XuAPI
pub const TASK_PROGRESS_ICON = 2

用途

常量 TASK_PROGRESS_ICON,定义了相关的协议或算法配置参数。

const ACTION_CANCEL_TASK

XuAPI
pub const ACTION_CANCEL_TASK = 7

用途

常量 ACTION_CANCEL_TASK,定义了相关的协议或算法配置参数。

struct TaskButton

XuAPI
pub struct TaskButton {

}

用途

TaskButton 上下文或状态结构体。

公开字段

此类型没有公开字段。

task_button

XuAPI
pub fn task_button(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,label &string) TaskButton

用途

执行 task button 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
label &string
label(只读借用,调用方仍持有原值;类型 &string)

返回值

TaskButton — 该类型的值

(&TaskButton) id

XuAPI
pub fn (task &TaskButton) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TaskButton) bounds

XuAPI
pub fn (task &TaskButton) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&TaskButton) state

XuAPI
pub fn (task &TaskButton) state() int

用途

在 &TaskButton 上执行 state 操作。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TaskButton) task_id

XuAPI
pub fn (task &TaskButton) task_id() int

用途

&TaskButton 上的操作:执行 task id 操作。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TaskButton) is_running

XuAPI
pub fn (task &TaskButton) is_running() bool

用途

&TaskButton 上的操作:判断是否 running。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TaskButton) is_determinate

XuAPI
pub fn (task &TaskButton) is_determinate() bool

用途

&TaskButton 上的操作:判断是否 determinate。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TaskButton) progress

XuAPI
pub fn (task &TaskButton) progress() f64

用途

在 &TaskButton 上执行 progress 操作。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&TaskButton) is_enabled

XuAPI
pub fn (task &TaskButton) is_enabled() bool

用途

返回控件当前是否可用。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TaskButton) is_selectable

XuAPI
pub fn (task &TaskButton) is_selectable() bool

用途

&TaskButton 上的操作:判断是否 selectable。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TaskButton) set_selectable

XuAPI
pub fn (task $&TaskButton) set_selectable(selectable bool)

用途

$&TaskButton 上的操作:设置 selectable。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&TaskButton) is_focused

XuAPI
pub fn (task &TaskButton) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TaskButton) needs_paint

XuAPI
pub fn (task &TaskButton) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TaskButton) painted

XuAPI
pub fn (task $&TaskButton) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&TaskButton) cancel

XuAPI
pub fn (task $&TaskButton) cancel()

用途

$&TaskButton 上的操作:取消。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&TaskButton) set_focus

XuAPI
pub fn (task $&TaskButton) set_focus(focused bool)

用途

$&TaskButton 上的操作:设置 focus。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&TaskButton) set_enabled

XuAPI
pub fn (task $&TaskButton) set_enabled(enabled bool)

用途

$&TaskButton 上的操作:设置 enabled。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&TaskButton) set_bounds

XuAPI
pub fn (task $&TaskButton) set_bounds(bounds &layout.Rect) int

用途

$&TaskButton 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&TaskButton) set_style

XuAPI
pub fn (task $&TaskButton) set_style(style &ControlStyle) int

用途

$&TaskButton 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&TaskButton) set_motion

XuAPI
pub fn (task $&TaskButton) set_motion(spec &MotionSpec) int

用途

$&TaskButton 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&TaskButton) set_progress_mode

XuAPI
pub fn (task $&TaskButton) set_progress_mode(mode int) int

用途

$&TaskButton 上的操作:设置 progress mode。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
mode int
模式(int)

返回值

int — 该类型的值

($&TaskButton) set_labels

XuAPI
pub fn (task $&TaskButton) set_labels(running &string,success &string,error &string,cancelled &string) int

用途

$&TaskButton 上的操作:设置 labels。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
running &string
running(只读借用,调用方仍持有原值;类型 &string)
success &string
success(只读借用,调用方仍持有原值;类型 &string)
error &string
error(只读借用,调用方仍持有原值;类型 &string)
cancelled &string
cancelled(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&TaskButton) set_cancellable

XuAPI
pub fn (task $&TaskButton) set_cancellable(enabled bool)

用途

$&TaskButton 上的操作:设置 cancellable。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&TaskButton) begin

XuAPI
pub fn (task $&TaskButton) begin(id int,now time.Instant) int

用途

在 $&TaskButton 上执行 begin 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

($&TaskButton) set_progress

XuAPI
pub fn (task $&TaskButton) set_progress(id int,value f64) bool

用途

$&TaskButton 上的操作:设置 progress。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
value f64
value(f64)

返回值

bool — 是否成立

($&TaskButton) complete

XuAPI
pub fn (task $&TaskButton) complete(id int,state int) bool

用途

在 $&TaskButton 上执行 complete 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
state int
state(int)

返回值

bool — 是否成立

($&TaskButton) reset

XuAPI
pub fn (task $&TaskButton) reset() int

用途

$&TaskButton 上的操作:清空内部状态,可再写入或读取。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&TaskButton) input

XuAPI
pub fn (task $&TaskButton) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TaskButton) route

XuAPI
pub fn (task $&TaskButton) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TaskButton) event

XuAPI
pub fn (task $&TaskButton) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TaskButton) tick

XuAPI
pub fn (task $&TaskButton) tick(now time.Instant,reduced bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced bool
reduced(bool)

返回值

bool — 是否成立

(&TaskButton) next_tick

XuAPI
pub fn (task &TaskButton) next_tick(now time.Instant) time.Instant

用途

&TaskButton 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task &TaskButton
本次调用使用的 TaskButton 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

($&TaskButton) measure_styled

XuAPI
pub fn (task $&TaskButton) measure_styled(styles &Styles) layout.Size

用途

$&TaskButton 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&TaskButton) paint_styled

XuAPI
pub fn (task $&TaskButton) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&TaskButton 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&TaskButton) dispose

XuAPI
pub fn (task $&TaskButton) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

struct TaskFeedback

XuAPI
pub struct TaskFeedback {
    pub delay time.Duration
    pub success_hold time.Duration
    pub percentage bool
    pub thickness f64
}

用途

承载 delay、success_hold、percentage、thickness 等属性的结构体。

公开字段

delay time.Duration
字段(time.Duration)
success_hold time.Duration
字段(time.Duration)
percentage bool
字段(bool)
thickness f64
字段(f64)

task_feedback

XuAPI
pub fn task_feedback() TaskFeedback

用途

执行 task feedback 操作。

参数

无需传入参数。

返回值

TaskFeedback — 该类型的值

($&TaskButton) set_feedback

XuAPI
pub fn (task $&TaskButton) set_feedback(feedback &TaskFeedback) int

用途

$&TaskButton 上的操作:设置 feedback。失败时抛出错误,调用方需处理或继续传播。

参数

task $&TaskButton
本次调用使用的 TaskButton 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
feedback &TaskFeedback
feedback(只读借用,调用方仍持有原值;类型 &TaskFeedback)

返回值

int — 该类型的值

struct TextCache

XuAPI
pub struct TextCache {

}

用途

TextCache 上下文或状态结构体。

公开字段

此类型没有公开字段。

text_cache

XuAPI
pub fn text_cache(context &draw.Context) TextCache

用途

执行 text cache 操作。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)

返回值

TextCache — 该类型的值

($&TextCache) dispose

XuAPI
pub fn (cache $&TextCache) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

cache $&TextCache
本次调用使用的 TextCache 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&TextCache) measure

XuAPI
pub fn (cache $&TextCache) measure(index int,value &string,styles &Styles,c &ControlStyle) layout.Size

用途

在 $&TextCache 上执行 measure 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cache $&TextCache
本次调用使用的 TextCache 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
c &ControlStyle
字节或字符码(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

layout.Size — 该类型的值

($&TextCache) paint_text

XuAPI
pub fn (cache $&TextCache) paint_text(index int,value &string,frame $&draw.Frame,bounds &layout.Rect,styles &Styles,c &ControlStyle,state int) int

用途

$&TextCache 上的操作:执行 paint text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cache $&TextCache
本次调用使用的 TextCache 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
c &ControlStyle
字节或字符码(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)

返回值

int — 该类型的值

const TEXT_MENU_NONE

XuAPI
pub const TEXT_MENU_NONE = 0

用途

常量 TEXT_MENU_NONE,定义了相关的协议或算法配置参数。

const TEXT_MENU_COPY

XuAPI
pub const TEXT_MENU_COPY = 1

用途

常量 TEXT_MENU_COPY,定义了相关的协议或算法配置参数。

const TEXT_MENU_CUT

XuAPI
pub const TEXT_MENU_CUT = 2

用途

常量 TEXT_MENU_CUT,定义了相关的协议或算法配置参数。

const TEXT_MENU_PASTE

XuAPI
pub const TEXT_MENU_PASTE = 3

用途

常量 TEXT_MENU_PASTE,定义了相关的协议或算法配置参数。

const TEXT_MENU_SELECT_ALL

XuAPI
pub const TEXT_MENU_SELECT_ALL = 4

用途

常量 TEXT_MENU_SELECT_ALL,定义了相关的协议或算法配置参数。

const TEXT_MENU_COPY_ROW

XuAPI
pub const TEXT_MENU_COPY_ROW = 5

用途

常量 TEXT_MENU_COPY_ROW,定义了相关的协议或算法配置参数。

const TEXT_KEY_NONE

XuAPI
pub const TEXT_KEY_NONE = 0

用途

常量 TEXT_KEY_NONE,定义了相关的协议或算法配置参数。

const TEXT_KEY_CHANGED

XuAPI
pub const TEXT_KEY_CHANGED = 1

用途

常量 TEXT_KEY_CHANGED,定义了相关的协议或算法配置参数。

const TEXT_KEY_COPY

XuAPI
pub const TEXT_KEY_COPY = 2

用途

常量 TEXT_KEY_COPY,定义了相关的协议或算法配置参数。

struct TextRange

XuAPI
pub struct TextRange {
    pub start int
    pub end int
}

用途

承载 start、end 等属性的结构体。

公开字段

start int
字段(int)
end int
字段(int)

text_range

XuAPI
pub fn text_range(a int,b int) TextRange

用途

执行 text range 操作。

参数

a int
值(int)
b int
b(int)

返回值

TextRange — 该类型的值

(&TextRange) empty

XuAPI
pub fn (range &TextRange) empty() bool

用途

判断几何区域是否为空(dx <= 0 或 dy <= 0)。

参数

range &TextRange
本次调用使用的 TextRange 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TextRange) length

XuAPI
pub fn (range &TextRange) length() int

用途

&TextRange 上的操作:返回当前长度。

参数

range &TextRange
本次调用使用的 TextRange 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

selection_prev_boundary

XuAPI
pub fn selection_prev_boundary(value &string,index int) int

用途

执行 selection prev boundary 操作。

参数

value &string
value(只读借用,调用方仍持有原值;类型 &string)
index int
index(int)

返回值

int — 该类型的值

selection_next_boundary

XuAPI
pub fn selection_next_boundary(value &string,index int) int

用途

执行 selection next boundary 操作。

参数

value &string
value(只读借用,调用方仍持有原值;类型 &string)
index int
index(int)

返回值

int — 该类型的值

word_range_at

XuAPI
pub fn word_range_at(value &string,index int) TextRange

用途

执行 word range at 操作。

参数

value &string
value(只读借用,调用方仍持有原值;类型 &string)
index int
index(int)

返回值

TextRange — 该类型的值

line_range_at

XuAPI
pub fn line_range_at(value &string,index int) TextRange

用途

执行 line range at 操作。

参数

value &string
value(只读借用,调用方仍持有原值;类型 &string)
index int
index(int)

返回值

TextRange — 该类型的值

struct TextMenuSpec

XuAPI
pub struct TextMenuSpec {
    pub show_cut bool
    pub cut_enabled bool
    pub show_copy bool
    pub copy_enabled bool
    pub show_paste bool
    pub paste_enabled bool
    pub show_select_all bool
    pub select_all_enabled bool
    pub show_copy_row bool
    pub copy_row_enabled bool
}

用途

承载 show_cut、cut_enabled、show_copy、copy_enabled、show_paste 等属性的结构体。

公开字段

show_cut bool
字段(bool)
cut_enabled bool
字段(bool)
show_copy bool
字段(bool)
copy_enabled bool
字段(bool)
show_paste bool
字段(bool)
paste_enabled bool
字段(bool)
show_select_all bool
字段(bool)
select_all_enabled bool
字段(bool)
show_copy_row bool
字段(bool)
copy_row_enabled bool
字段(bool)

text_menu_spec_readonly

XuAPI
pub fn text_menu_spec_readonly(has_selection bool,has_text bool) TextMenuSpec

用途

执行 text menu spec readonly 操作。

参数

has_selection bool
has_selection(bool)
has_text bool
has_text(bool)

返回值

TextMenuSpec — 该类型的值

text_menu_spec_editable

XuAPI
pub fn text_menu_spec_editable(has_selection bool,has_text bool,can_paste bool) TextMenuSpec

用途

执行 text menu spec editable 操作。

参数

has_selection bool
has_selection(bool)
has_text bool
has_text(bool)
can_paste bool
can_paste(bool)

返回值

TextMenuSpec — 该类型的值

struct TextContextMenuItem

XuAPI
pub struct TextContextMenuItem {
    pub cmd int
    pub enabled bool
}

用途

承载 cmd、enabled 等属性的结构体。

公开字段

cmd int
字段(int)
enabled bool
字段(bool)

struct TextMenuResult

XuAPI
pub struct TextMenuResult {
    pub consumed bool
    pub closed bool
    pub cmd int
    pub dirty bool
}

用途

承载 consumed、closed、cmd、dirty 等属性的结构体。

公开字段

consumed bool
字段(bool)
closed bool
字段(bool)
cmd int
字段(int)
dirty bool
字段(bool)

try_copy_clipboard

XuAPI
pub fn try_copy_clipboard(identity &ui.CanvasEvent,text &string) int

用途

执行 try copy clipboard 操作。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

paint_text_selection

XuAPI
pub fn paint_text_selection(frame $&draw.Frame,shaped &draw.TextLayout,origin_x f64,origin_y f64,anchor int,focus int,bg draw.Color,fg draw.Color,text_len int) int

用途

执行 paint text selection 操作。失败时抛出错误,调用方需处理或继续传播。

参数

frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
shaped &draw.TextLayout
shaped(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
origin_x f64
origin_x(f64)
origin_y f64
origin_y(f64)
anchor int
anchor(int)
focus int
focus(int)
bg draw.Color
bg(draw.Color)
fg draw.Color
fg(draw.Color)
text_len int
text_len(int)

返回值

int — 该类型的值

($&TextCache) ensure_layout_for

XuAPI
pub fn (cache $&TextCache) ensure_layout_for(index int,value &string,bounds &layout.Rect,styles &Styles,c &ControlStyle,wrapped bool) draw.TextLayout

用途

$&TextCache 上的操作:执行 ensure layout for 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cache $&TextCache
本次调用使用的 TextCache 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
c &ControlStyle
字节或字符码(只读借用,调用方仍持有原值;类型 &ControlStyle)
wrapped bool
wrapped(bool)

返回值

draw.TextLayout — 该类型的值

($&TextCache) hit_test_at

XuAPI
pub fn (cache $&TextCache) hit_test_at(index int,value &string,bounds &layout.Rect,styles &Styles,c &ControlStyle,wrapped bool,x f64,y f64) int

用途

$&TextCache 上的操作:执行 hit test at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cache $&TextCache
本次调用使用的 TextCache 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
c &ControlStyle
字节或字符码(只读借用,调用方仍持有原值;类型 &ControlStyle)
wrapped bool
wrapped(bool)
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

($&TextCache) paint_text_selected

XuAPI
pub fn (cache $&TextCache) paint_text_selected(index int,value &string,frame $&draw.Frame,bounds &layout.Rect,styles &Styles,c &ControlStyle,state int,sel_anchor int,sel_focus int,wrapped bool) int

用途

$&TextCache 上的操作:执行 paint text selected 操作。失败时抛出错误,调用方需处理或继续传播。

参数

cache $&TextCache
本次调用使用的 TextCache 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
value &string
value(只读借用,调用方仍持有原值;类型 &string)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
c &ControlStyle
字节或字符码(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)
sel_anchor int
sel_anchor(int)
sel_focus int
sel_focus(int)
wrapped bool
wrapped(bool)

返回值

int — 该类型的值

styled_label_ensure

XuAPI
pub fn styled_label_ensure(label $&StyledLabel,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,wrapped bool) layout.Size

用途

执行 styled label ensure 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)
wrapped bool
wrapped(bool)

返回值

layout.Size — 该类型的值

styled_label_hit_test

XuAPI
pub fn styled_label_hit_test(label $&StyledLabel,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,wrapped bool,x f64,y f64) int

用途

执行 styled label hit test 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)
wrapped bool
wrapped(bool)
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

paint_styled_label_selected

XuAPI
pub fn paint_styled_label_selected(label $&StyledLabel,frame $&draw.Frame,bounds &layout.Rect,styles &Styles,fallback &ControlStyle,state int,sel_anchor int,sel_focus int,wrapped bool,ellipsis bool) int

用途

执行 paint styled label selected 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
fallback &ControlStyle
fallback(只读借用,调用方仍持有原值;类型 &ControlStyle)
state int
state(int)
sel_anchor int
sel_anchor(int)
sel_focus int
sel_focus(int)
wrapped bool
wrapped(bool)
ellipsis bool
ellipsis(bool)

返回值

int — 该类型的值

paint_styled_label_at_origin

XuAPI
pub fn paint_styled_label_at_origin(label &StyledLabel,frame $&draw.Frame,tx f64,ty f64,resolved &ResolvedStyle,sel_anchor int,sel_focus int) int

用途

执行 paint styled label at origin 操作。失败时抛出错误,调用方需处理或继续传播。

参数

label &StyledLabel
label(只读借用,调用方仍持有原值;类型 &StyledLabel)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
tx f64
tx(f64)
ty f64
ty(f64)
resolved &ResolvedStyle
resolved(只读借用,调用方仍持有原值;类型 &ResolvedStyle)
sel_anchor int
sel_anchor(int)
sel_focus int
sel_focus(int)

返回值

int — 该类型的值

hit_test_styled_label_at_origin

XuAPI
pub fn hit_test_styled_label_at_origin(label &StyledLabel,tx f64,ty f64,x f64,y f64) int

用途

执行 hit test styled label at origin 操作。

参数

label &StyledLabel
label(只读借用,调用方仍持有原值;类型 &StyledLabel)
tx f64
tx(f64)
ty f64
ty(f64)
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

struct TextSelectionEngine

XuAPI
pub struct TextSelectionEngine {
    pub selectable bool
    pub anchor int
    pub focus int
    pub selecting bool
}

用途

承载 selectable、anchor、focus、selecting 等属性的结构体。

公开字段

selectable bool
字段(bool)
anchor int
字段(int)
focus int
字段(int)
selecting bool
字段(bool)

text_selection_engine

XuAPI
pub fn text_selection_engine(selectable bool) TextSelectionEngine

用途

执行 text selection engine 操作。

参数

selectable bool
selectable(bool)

返回值

TextSelectionEngine — 该类型的值

(&TextSelectionEngine) has_selection

XuAPI
pub fn (e &TextSelectionEngine) has_selection() bool

用途

&TextSelectionEngine 上的操作:判断是否具有 selection。

参数

e &TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TextSelectionEngine) is_drag_char

XuAPI
pub fn (e &TextSelectionEngine) is_drag_char() bool

用途

&TextSelectionEngine 上的操作:判断是否 drag char。

参数

e &TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TextSelectionEngine) reset_clicks

XuAPI
pub fn (e $&TextSelectionEngine) reset_clicks()

用途

$&TextSelectionEngine 上的操作:执行 reset clicks 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&TextSelectionEngine) range

XuAPI
pub fn (e &TextSelectionEngine) range(text_len int) ui.TextRange

用途

在 &TextSelectionEngine 上执行 range 操作。

参数

e &TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以只读借用传入,调用方仍持有实例。
text_len int
text_len(int)

返回值

ui.TextRange — 该类型的值

(&TextSelectionEngine) selected_text

XuAPI
pub fn (e &TextSelectionEngine) selected_text(text &string) string

用途

&TextSelectionEngine 上的操作:执行 selected text 操作。

参数

e &TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以只读借用传入,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

string — 结果字符串

($&TextSelectionEngine) clear

XuAPI
pub fn (e $&TextSelectionEngine) clear() bool

用途

清空所有已缓冲或存储的数据项与内部状态。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&TextSelectionEngine) set_selectable

XuAPI
pub fn (e $&TextSelectionEngine) set_selectable(selectable bool) bool

用途

$&TextSelectionEngine 上的操作:设置 selectable。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

bool — 是否成立

($&TextSelectionEngine) select_all

XuAPI
pub fn (e $&TextSelectionEngine) select_all(text &string) bool

用途

$&TextSelectionEngine 上的操作:执行 select all 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

bool — 是否成立

($&TextSelectionEngine) set_range

XuAPI
pub fn (e $&TextSelectionEngine) set_range(text &string,start int,end int) bool

用途

$&TextSelectionEngine 上的操作:设置 range。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
start int
start(int)
end int
end(int)

返回值

bool — 是否成立

($&TextSelectionEngine) begin_pointer_down

XuAPI
pub fn (e $&TextSelectionEngine) begin_pointer_down(text &string,idx int,event &ui.InputEvent) bool

用途

$&TextSelectionEngine 上的操作:执行 begin pointer down 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
idx int
idx(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

bool — 是否成立

($&TextSelectionEngine) drag_pointer

XuAPI
pub fn (e $&TextSelectionEngine) drag_pointer(text &string,idx int) bool

用途

$&TextSelectionEngine 上的操作:执行 drag pointer 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
idx int
idx(int)

返回值

bool — 是否成立

($&TextSelectionEngine) end_pointer

XuAPI
pub fn (e $&TextSelectionEngine) end_pointer() bool

用途

$&TextSelectionEngine 上的操作:执行 end pointer 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&TextSelectionEngine) key_navigation

XuAPI
pub fn (e $&TextSelectionEngine) key_navigation(text &string,event &ui.InputEvent) int

用途

$&TextSelectionEngine 上的操作:执行 key navigation 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

int — 该类型的值

($&TextSelectionEngine) key_navigation_layout

XuAPI
pub fn (e $&TextSelectionEngine) key_navigation_layout(text &string,shaped &draw.TextLayout,event &ui.InputEvent) int

用途

$&TextSelectionEngine 上的操作:执行 key navigation layout 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
shaped &draw.TextLayout
shaped(只读借用,调用方仍持有原值;类型 &draw.TextLayout)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

int — 该类型的值

font_vertical_step_focus

XuAPI
pub fn font_vertical_step_focus(shaped &font.TextLayout,text &string,cur_focus int,key int) int

用途

执行 font vertical step focus 操作。

参数

shaped &font.TextLayout
shaped(只读借用,调用方仍持有原值;类型 &font.TextLayout)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
cur_focus int
cur_focus(int)
key int
键(int)

返回值

int — 该类型的值

($&TextSelectionEngine) key_navigation_font_layout

XuAPI
pub fn (e $&TextSelectionEngine) key_navigation_font_layout(text &string,shaped &font.TextLayout,event &ui.InputEvent) int

用途

$&TextSelectionEngine 上的操作:执行 key navigation font layout 操作。

参数

e $&TextSelectionEngine
本次调用使用的 TextSelectionEngine 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
shaped &font.TextLayout
shaped(只读借用,调用方仍持有原值;类型 &font.TextLayout)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

int — 该类型的值

text_menu_item_label

XuAPI
pub fn text_menu_item_label(locale &Locale,cmd int) string

用途

执行 text menu item label 操作。

参数

locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)
cmd int
cmd(int)

返回值

string — 结果字符串

text_menu_shortcut_label

XuAPI
pub fn text_menu_shortcut_label(cmd int) string

用途

执行 text menu shortcut label 操作。

参数

cmd int
cmd(int)

返回值

string — 结果字符串

is_context_trigger

XuAPI
pub fn is_context_trigger(event &ui.InputEvent) bool

用途

判断是否 context trigger。

参数

event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

bool — 是否成立

struct TextContextMenu

XuAPI
pub struct TextContextMenu {

}

用途

TextContextMenu 上下文或状态结构体。

公开字段

此类型没有公开字段。

text_context_menu

XuAPI
pub fn text_context_menu(context &draw.Context,identity &ui.CanvasEvent,id int) TextContextMenu

用途

执行 text context menu 操作。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)

返回值

TextContextMenu — 该类型的值

(&TextContextMenu) is_open

XuAPI
pub fn (m &TextContextMenu) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

m &TextContextMenu
本次调用使用的 TextContextMenu 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TextContextMenu) needs_paint

XuAPI
pub fn (m &TextContextMenu) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

m &TextContextMenu
本次调用使用的 TextContextMenu 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TextContextMenu) painted

XuAPI
pub fn (m $&TextContextMenu) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&TextContextMenu) popup_bounds

XuAPI
pub fn (m &TextContextMenu) popup_bounds() layout.Rect

用途

&TextContextMenu 上的操作:执行 popup bounds 操作。

参数

m &TextContextMenu
本次调用使用的 TextContextMenu 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&TextContextMenu) dispose

XuAPI
pub fn (m $&TextContextMenu) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&TextContextMenu) clone_menu

XuAPI
pub fn (m &TextContextMenu) clone_menu() TextContextMenu

用途

&TextContextMenu 上的操作:执行 clone menu 操作。

参数

m &TextContextMenu
本次调用使用的 TextContextMenu 实例;以只读借用传入,调用方仍持有实例。

返回值

TextContextMenu — 该类型的值

($&TextContextMenu) set_locale

XuAPI
pub fn (m $&TextContextMenu) set_locale(locale &Locale) int

用途

$&TextContextMenu 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&TextContextMenu) set_zh

XuAPI
pub fn (m $&TextContextMenu) set_zh(zh bool)

用途

$&TextContextMenu 上的操作:设置 zh。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
zh bool
zh(bool)

返回值

不返回值。

($&TextContextMenu) set_viewport

XuAPI
pub fn (m $&TextContextMenu) set_viewport(viewport &layout.Rect)

用途

$&TextContextMenu 上的操作:设置 viewport。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&TextContextMenu) open

XuAPI
pub fn (m $&TextContextMenu) open(x f64,y f64,spec &TextMenuSpec,density f64) bool

用途

$&TextContextMenu 上的操作:打开资源或建立网络连接。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)
spec &TextMenuSpec
spec(只读借用,调用方仍持有原值;类型 &TextMenuSpec)
density f64
density(f64)

返回值

bool — 是否成立

($&TextContextMenu) close

XuAPI
pub fn (m $&TextContextMenu) close() bool

用途

$&TextContextMenu 上的操作:关闭资源。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&TextContextMenu) input

XuAPI
pub fn (m $&TextContextMenu) input(event &ui.InputEvent,density f64) TextMenuResult

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)
density f64
density(f64)

返回值

TextMenuResult — 该类型的值

($&TextContextMenu) paint_styled

XuAPI
pub fn (m $&TextContextMenu) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&TextContextMenu 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m $&TextContextMenu
本次调用使用的 TextContextMenu 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

paint_text_context_menu_err

XuAPI
pub fn paint_text_context_menu_err(m $&TextContextMenu,frame $&draw.Frame,styles &Styles) string

用途

执行 paint text context menu err 操作。

参数

m $&TextContextMenu
m(独占借用,可修改原值;类型 $&TextContextMenu)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

string — 结果字符串

struct ListTextAux

XuAPI
pub struct ListTextAux {
    pub drag_start_x f64
    pub drag_start_y f64
    pub drag_moved bool
    pub sel_row int
    pub sel_col int
    pub active_text string
    pub row_text string
    pub viewport layout.Rect
    pub zh bool
    pub selection TextSelectionEngine
    pub menus map[int]TextContextMenu
    pub cached_styles []Styles
}

用途

承载 drag_start_x、drag_start_y、drag_moved、sel_row、sel_col 等属性的结构体。

公开字段

drag_start_x f64
字段(f64)
drag_start_y f64
字段(f64)
drag_moved bool
字段(bool)
sel_row int
字段(int)
sel_col int
字段(int)
active_text string
字段(string)
row_text string
字段(string)
viewport layout.Rect
字段(layout.Rect)
zh bool
字段(bool)
selection TextSelectionEngine
字段(TextSelectionEngine)
menus map[int]TextContextMenu
字段(map[int]TextContextMenu)
cached_styles []Styles
字段([]Styles)

list_text_aux_new

XuAPI
pub fn list_text_aux_new(selectable bool) ListTextAux

用途

执行 list text aux new 操作。

参数

selectable bool
selectable(bool)

返回值

ListTextAux — 该类型的值

(&ListTextAux) has_menu

XuAPI
pub fn (aux &ListTextAux) has_menu() bool

用途

&ListTextAux 上的操作:判断是否具有 menu。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListTextAux) is_menu_open

XuAPI
pub fn (aux &ListTextAux) is_menu_open() bool

用途

&ListTextAux 上的操作:判断是否 menu open。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListTextAux) menu_bounds

XuAPI
pub fn (aux &ListTextAux) menu_bounds() layout.Rect

用途

&ListTextAux 上的操作:执行 menu bounds 操作。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&ListTextAux) menu_needs_paint

XuAPI
pub fn (aux &ListTextAux) menu_needs_paint() bool

用途

&ListTextAux 上的操作:执行 menu needs paint 操作。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListTextAux) has_selection_for

XuAPI
pub fn (aux &ListTextAux) has_selection_for(row int,col int) bool

用途

&ListTextAux 上的操作:判断是否具有 selection for。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。
row int
row(int)
col int
col(int)

返回值

bool — 是否成立

(&ListTextAux) sel_anchor

XuAPI
pub fn (aux &ListTextAux) sel_anchor() int

用途

&ListTextAux 上的操作:执行 sel anchor 操作。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListTextAux) sel_focus

XuAPI
pub fn (aux &ListTextAux) sel_focus() int

用途

&ListTextAux 上的操作:执行 sel focus 操作。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListTextAux) get_sel_row

XuAPI
pub fn (aux &ListTextAux) get_sel_row() int

用途

&ListTextAux 上的操作:读取 sel row。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListTextAux) get_sel_col

XuAPI
pub fn (aux &ListTextAux) get_sel_col() int

用途

&ListTextAux 上的操作:读取 sel col。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&ListTextAux) has_active_text

XuAPI
pub fn (aux &ListTextAux) has_active_text() bool

用途

&ListTextAux 上的操作:判断是否具有 active text。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&ListTextAux) get_active_text

XuAPI
pub fn (aux &ListTextAux) get_active_text() string

用途

&ListTextAux 上的操作:读取 active text。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&ListTextAux) get_row_text

XuAPI
pub fn (aux &ListTextAux) get_row_text() string

用途

&ListTextAux 上的操作:读取 row text。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&ListTextAux) selected_text

XuAPI
pub fn (aux &ListTextAux) selected_text() string

用途

&ListTextAux 上的操作:执行 selected text 操作。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&ListTextAux) style_snapshot

XuAPI
pub fn (aux &ListTextAux) style_snapshot() Styles

用途

&ListTextAux 上的操作:执行 style snapshot 操作。

参数

aux &ListTextAux
本次调用使用的 ListTextAux 实例;以只读借用传入,调用方仍持有实例。

返回值

Styles — 该类型的值

($&ListTextAux) set_styles_cache

XuAPI
pub fn (aux $&ListTextAux) set_styles_cache(styles &Styles)

用途

$&ListTextAux 上的操作:设置 styles cache。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

不返回值。

($&ListTextAux) ensure_menu

XuAPI
pub fn (aux $&ListTextAux) ensure_menu(context &draw.Context,identity &ui.CanvasEvent,id int)

用途

$&ListTextAux 上的操作:执行 ensure menu 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)

返回值

不返回值。

($&ListTextAux) set_zh

XuAPI
pub fn (aux $&ListTextAux) set_zh(zh bool)

用途

$&ListTextAux 上的操作:设置 zh。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
zh bool
zh(bool)

返回值

不返回值。

($&ListTextAux) set_viewport

XuAPI
pub fn (aux $&ListTextAux) set_viewport(viewport &layout.Rect,context &draw.Context,identity &ui.CanvasEvent,id int)

用途

$&ListTextAux 上的操作:设置 viewport。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)

返回值

不返回值。

($&ListTextAux) painted

XuAPI
pub fn (aux $&ListTextAux) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&ListTextAux) close_menu

XuAPI
pub fn (aux $&ListTextAux) close_menu() bool

用途

$&ListTextAux 上的操作:执行 close menu 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&ListTextAux) paint_menu_styled

XuAPI
pub fn (aux $&ListTextAux) paint_menu_styled(frame $&draw.Frame,styles &Styles) int

用途

$&ListTextAux 上的操作:执行 paint menu styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&ListTextAux) route_menu

XuAPI
pub fn (aux $&ListTextAux) route_menu(event &ui.InputEvent,density f64) TextMenuResult

用途

$&ListTextAux 上的操作:执行 route menu 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)
density f64
density(f64)

返回值

TextMenuResult — 该类型的值

($&ListTextAux) open_menu

XuAPI
pub fn (aux $&ListTextAux) open_menu(context &draw.Context,identity &ui.CanvasEvent,id int,x f64,y f64,show_row bool,density f64) bool

用途

$&ListTextAux 上的操作:执行 open menu 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
x f64
值(f64)
y f64
值(f64)
show_row bool
show_row(bool)
density f64
density(f64)

返回值

bool — 是否成立

($&ListTextAux) open_cached_menu

XuAPI
pub fn (aux $&ListTextAux) open_cached_menu(x f64,y f64,show_row bool,density f64) bool

用途

$&ListTextAux 上的操作:执行 open cached menu 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)
show_row bool
show_row(bool)
density f64
density(f64)

返回值

bool — 是否成立

($&ListTextAux) handle_menu_cmd

XuAPI
pub fn (aux $&ListTextAux) handle_menu_cmd(cmd int,identity &ui.CanvasEvent) bool

用途

$&ListTextAux 上的操作:执行 handle menu cmd 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
cmd int
cmd(int)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)

返回值

bool — 是否成立

($&ListTextAux) begin_pointer

XuAPI
pub fn (aux $&ListTextAux) begin_pointer(text &string,row_text &string,idx int,row int,col int,event &ui.InputEvent) bool

用途

$&ListTextAux 上的操作:执行 begin pointer 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
text &string
文本(只读借用,调用方仍持有原值;类型 &string)
row_text &string
row_text(只读借用,调用方仍持有原值;类型 &string)
idx int
idx(int)
row int
row(int)
col int
col(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

bool — 是否成立

($&ListTextAux) should_begin_drag

XuAPI
pub fn (aux $&ListTextAux) should_begin_drag(x f64,y f64,density f64) bool

用途

$&ListTextAux 上的操作:执行 should begin drag 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)
density f64
density(f64)

返回值

bool — 是否成立

($&ListTextAux) drag_to

XuAPI
pub fn (aux $&ListTextAux) drag_to(idx int) bool

用途

$&ListTextAux 上的操作:执行 drag to 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
idx int
idx(int)

返回值

bool — 是否成立

($&ListTextAux) end_pointer

XuAPI
pub fn (aux $&ListTextAux) end_pointer() bool

用途

$&ListTextAux 上的操作:执行 end pointer 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&ListTextAux) clear_selection

XuAPI
pub fn (aux $&ListTextAux) clear_selection() bool

用途

$&ListTextAux 上的操作:执行 clear selection 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

bool — 是否成立

($&ListTextAux) key_action

XuAPI
pub fn (aux $&ListTextAux) key_action(event &ui.InputEvent,identity &ui.CanvasEvent) int

用途

$&ListTextAux 上的操作:执行 key action 操作。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)

返回值

int — 该类型的值

($&ListTextAux) dispose

XuAPI
pub fn (aux $&ListTextAux) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

aux $&ListTextAux
本次调用使用的 ListTextAux 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

struct TimePicker

XuAPI
pub struct TimePicker {

}

用途

24 小时制时间分段选择与编辑控件。

公开字段

此类型没有公开字段。

time_picker

XuAPI
pub fn time_picker(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect,value time.Time) TimePicker

用途

执行 time picker 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
value time.Time
value(time.Time)

返回值

TimePicker — 该类型的值

(&TimePicker) id

XuAPI
pub fn (picker &TimePicker) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TimePicker) bounds

XuAPI
pub fn (picker &TimePicker) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&TimePicker) value

XuAPI
pub fn (picker &TimePicker) value() time.Time

用途

&TimePicker 上的操作:值。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

time.Time — 该类型的值

(&TimePicker) selected_part

XuAPI
pub fn (picker &TimePicker) selected_part() int

用途

&TimePicker 上的操作:执行 selected part 操作。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TimePicker) is_selectable

XuAPI
pub fn (picker &TimePicker) is_selectable() bool

用途

&TimePicker 上的操作:判断是否 selectable。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TimePicker) set_selectable

XuAPI
pub fn (picker $&TimePicker) set_selectable(selectable bool)

用途

$&TimePicker 上的操作:设置 selectable。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&TimePicker) needs_paint

XuAPI
pub fn (picker &TimePicker) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TimePicker) visual_state

XuAPI
pub fn (picker &TimePicker) visual_state() int

用途

&TimePicker 上的操作:执行 visual state 操作。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TimePicker) style_or

XuAPI
pub fn (picker &TimePicker) style_or(styles &Styles) ControlStyle

用途

&TimePicker 上的操作:执行 style or 操作。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&TimePicker) set_style

XuAPI
pub fn (picker $&TimePicker) set_style(style &ControlStyle) int

用途

$&TimePicker 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&TimePicker) set_value

XuAPI
pub fn (picker $&TimePicker) set_value(value time.Time) int

用途

$&TimePicker 上的操作:设置 value。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value time.Time
value(time.Time)

返回值

int — 该类型的值

($&TimePicker) set_show_seconds

XuAPI
pub fn (picker $&TimePicker) set_show_seconds(show bool)

用途

$&TimePicker 上的操作:设置 show seconds。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
show bool
show(bool)

返回值

不返回值。

($&TimePicker) set_enabled

XuAPI
pub fn (picker $&TimePicker) set_enabled(enabled bool)

用途

$&TimePicker 上的操作:设置 enabled。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&TimePicker) set_read_only

XuAPI
pub fn (picker $&TimePicker) set_read_only(read_only bool) int

用途

$&TimePicker 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
read_only bool
read_only(bool)

返回值

int — 该类型的值

($&TimePicker) set_invalid

XuAPI
pub fn (picker $&TimePicker) set_invalid(invalid bool)

用途

$&TimePicker 上的操作:设置 invalid。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
invalid bool
invalid(bool)

返回值

不返回值。

($&TimePicker) set_focus

XuAPI
pub fn (picker $&TimePicker) set_focus(focused bool)

用途

$&TimePicker 上的操作:设置 focus。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&TimePicker) set_bounds

XuAPI
pub fn (picker $&TimePicker) set_bounds(bounds &layout.Rect) int

用途

$&TimePicker 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

(&TimePicker) part_bounds

XuAPI
pub fn (picker &TimePicker) part_bounds(part int) layout.Rect

用途

&TimePicker 上的操作:执行 part bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。
part int
part(int)

返回值

layout.Rect — 该类型的值

($&TimePicker) input

XuAPI
pub fn (picker $&TimePicker) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TimePicker) route

XuAPI
pub fn (picker $&TimePicker) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TimePicker) measure_styled

XuAPI
pub fn (picker $&TimePicker) measure_styled(styles &Styles) layout.Size

用途

$&TimePicker 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&TimePicker) paint_styled

XuAPI
pub fn (picker $&TimePicker) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&TimePicker 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&TimePicker) dispose

XuAPI
pub fn (picker $&TimePicker) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&TimePicker) set_12_hour

XuAPI
pub fn (picker $&TimePicker) set_12_hour(enabled bool)

用途

$&TimePicker 上的操作:设置 12 hour。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

(&TimePicker) period_bounds

XuAPI
pub fn (picker &TimePicker) period_bounds() layout.Rect

用途

&TimePicker 上的操作:执行 period bounds 操作。

参数

picker &TimePicker
本次调用使用的 TimePicker 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&TimePicker) apply_styles

XuAPI
pub fn (picker $&TimePicker) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

picker $&TimePicker
本次调用使用的 TimePicker 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct Toast

XuAPI
pub struct Toast {

}

用途

轻量浮动消息提示通知框,支持自动倒计时与堆叠显示。

公开字段

此类型没有公开字段。

toast

XuAPI
pub fn toast(identity &ui.CanvasEvent,id int,bounds &layout.Rect) Toast

用途

执行 toast 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Toast — 该类型的值

(&Toast) id

XuAPI
pub fn (t &Toast) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Toast) bounds

XuAPI
pub fn (t &Toast) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Toast) is_enabled

XuAPI
pub fn (t &Toast) is_enabled() bool

用途

返回控件当前是否可用。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Toast) is_selectable

XuAPI
pub fn (t &Toast) is_selectable() bool

用途

&Toast 上的操作:判断是否 selectable。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Toast) set_selectable

XuAPI
pub fn (t $&Toast) set_selectable(selectable bool)

用途

$&Toast 上的操作:设置 selectable。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Toast) set_action_width

XuAPI
pub fn (t $&Toast) set_action_width(width f64)

用途

$&Toast 上的操作:设置 action width。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
width f64
width(f64)

返回值

不返回值。

(&Toast) text_bounds

XuAPI
pub fn (t &Toast) text_bounds() layout.Rect

用途

&Toast 上的操作:执行 text bounds 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Toast) set_text

XuAPI
pub fn (t $&Toast) set_text(context &draw.Context,text &string) int

用途

$&Toast 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&Toast) set_viewport

XuAPI
pub fn (t $&Toast) set_viewport(viewport &layout.Rect)

用途

$&Toast 上的操作:设置 viewport。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&Toast) set_locale

XuAPI
pub fn (t $&Toast) set_locale(locale &Locale) int

用途

$&Toast 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

(&Toast) has_popup_open

XuAPI
pub fn (t &Toast) has_popup_open() bool

用途

&Toast 上的操作:判断是否具有 popup open。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Toast) popup_bounds

XuAPI
pub fn (t &Toast) popup_bounds() layout.Rect

用途

&Toast 上的操作:执行 popup bounds 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Toast) selected_text

XuAPI
pub fn (t &Toast) selected_text() string

用途

&Toast 上的操作:执行 selected text 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Toast) copy_selection

XuAPI
pub fn (t &Toast) copy_selection() int

用途

&Toast 上的操作:执行 copy selection 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Toast) cursor

XuAPI
pub fn (t &Toast) cursor() int

用途

&Toast 上的操作:游标。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Toast) is_open

XuAPI
pub fn (t &Toast) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Toast) is_visible

XuAPI
pub fn (t &Toast) is_visible() bool

用途

&Toast 上的操作:判断是否 visible。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Toast) opacity

XuAPI
pub fn (t &Toast) opacity() f64

用途

在 &Toast 上执行 opacity 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Toast) needs_paint

XuAPI
pub fn (t &Toast) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Toast) painted

XuAPI
pub fn (t $&Toast) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&Toast) close_bounds

XuAPI
pub fn (t &Toast) close_bounds() layout.Rect

用途

&Toast 上的操作:执行 close bounds 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

($&Toast) set_bounds

XuAPI
pub fn (t $&Toast) set_bounds(bounds &layout.Rect) int

用途

$&Toast 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Toast) show

XuAPI
pub fn (t $&Toast) show(now time.Instant,lifetime time.Duration,reduced_motion bool) int

用途

在 $&Toast 上执行 show 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
lifetime time.Duration
lifetime(time.Duration)
reduced_motion bool
reduced_motion(bool)

返回值

int — 该类型的值

($&Toast) dismiss

XuAPI
pub fn (t $&Toast) dismiss(now time.Instant,reduced_motion bool) int

用途

在 $&Toast 上执行 dismiss 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

int — 该类型的值

($&Toast) set_enabled

XuAPI
pub fn (t $&Toast) set_enabled(enabled bool) int

用途

$&Toast 上的操作:设置 enabled。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Toast) set_focus

XuAPI
pub fn (t $&Toast) set_focus(focused bool,now time.Instant) int

用途

$&Toast 上的操作:设置 focus。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

($&Toast) input

XuAPI
pub fn (t $&Toast) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Toast) route

XuAPI
pub fn (t $&Toast) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Toast) tick

XuAPI
pub fn (t $&Toast) tick(now time.Instant,reduced_motion bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

(&Toast) next_tick

XuAPI
pub fn (t &Toast) next_tick(now time.Instant) time.Instant

用途

&Toast 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

(&Toast) paint_styled

XuAPI
pub fn (t &Toast) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Toast 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Toast) paint_content_styled

XuAPI
pub fn (t $&Toast) paint_content_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Toast 上的操作:执行 paint content styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Toast) paint_aux_text

XuAPI
pub fn (t $&Toast) paint_aux_text(frame $&draw.Frame,bounds &layout.Rect,styles &Styles) int

用途

$&Toast 上的操作:执行 paint aux text 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Toast) paint_popup_styled

XuAPI
pub fn (t $&Toast) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Toast 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&Toast) style_or

XuAPI
pub fn (t &Toast) style_or(styles &Styles) ControlStyle

用途

&Toast 上的操作:执行 style or 操作。

参数

t &Toast
本次调用使用的 Toast 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&Toast) set_style

XuAPI
pub fn (t $&Toast) set_style(style &ControlStyle) int

用途

$&Toast 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Toast) set_motion

XuAPI
pub fn (t $&Toast) set_motion(spec &MotionSpec) int

用途

$&Toast 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Toast
本次调用使用的 Toast 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

const NOTICE_NORMAL

XuAPI
pub const NOTICE_NORMAL = 0

用途

常量 NOTICE_NORMAL,定义了相关的协议或算法配置参数。

const NOTICE_IMPORTANT

XuAPI
pub const NOTICE_IMPORTANT = 1

用途

常量 NOTICE_IMPORTANT,定义了相关的协议或算法配置参数。

const ACTION_NOTICE_ACTION

XuAPI
pub const ACTION_NOTICE_ACTION = 9

用途

常量 ACTION_NOTICE_ACTION,定义了相关的协议或算法配置参数。

查看用法示例

struct Notice

XuAPI
pub struct Notice {
    pub key string
    pub text string
    pub action string
    pub lifetime time.Duration
    pub priority int
}

用途

承载 key、text、action、lifetime、priority 等属性的结构体。

公开字段

key string
键
text string
文本
action string
字段(string)
lifetime time.Duration
字段(time.Duration)
priority int
字段(int)

notice

XuAPI
pub fn notice(text &string) Notice

用途

执行 notice 处理。

参数

text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

Notice — 该类型的值

查看用法示例

struct NoticeRecord

XuAPI
pub struct NoticeRecord {
    pub token int
    pub key string
    pub text string
    pub action string
    pub lifetime time.Duration
    pub priority int
}

用途

承载 token、key、text、action、lifetime 等属性的结构体。

公开字段

token int
字段(int)
key string
键
text string
文本
action string
字段(string)
lifetime time.Duration
字段(time.Duration)
priority int
字段(int)

struct ToastHost

XuAPI
pub struct ToastHost {

}

用途

ToastHost 上下文或状态结构体。

公开字段

此类型没有公开字段。

toast_host

XuAPI
pub fn toast_host() ToastHost

用途

执行 toast host 操作。

参数

无需传入参数。

返回值

ToastHost — 该类型的值

(&ToastHost) pending_count

XuAPI
pub fn (host &ToastHost) pending_count() int

用途

&ToastHost 上的操作:执行 pending count 操作。

参数

host &ToastHost
本次调用使用的 ToastHost 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&ToastHost) set_capacity

XuAPI
pub fn (host $&ToastHost) set_capacity(capacity int) int

用途

$&ToastHost 上的操作:设置 capacity。失败时抛出错误,调用方需处理或继续传播。

参数

host $&ToastHost
本次调用使用的 ToastHost 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
capacity int
capacity(int)

返回值

int — 该类型的值

($&ToastHost) enqueue

XuAPI
pub fn (host $&ToastHost) enqueue(value &Notice) int

用途

在 $&ToastHost 上执行 enqueue 操作。失败时抛出错误,调用方需处理或继续传播。

参数

host $&ToastHost
本次调用使用的 ToastHost 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &Notice
value(只读借用,调用方仍持有原值;类型 &Notice)

返回值

int — 该类型的值

($&ToastHost) next_notice

XuAPI
pub fn (host $&ToastHost) next_notice() NoticeRecord

用途

$&ToastHost 上的操作:执行 next notice 操作。失败时抛出错误,调用方需处理或继续传播。

参数

host $&ToastHost
本次调用使用的 ToastHost 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

NoticeRecord — 该类型的值

($&Screen) enqueue_notice

XuAPI
pub fn (s $&Screen) enqueue_notice(value &Notice) int

用途

$&Screen 上的操作:执行 enqueue notice 操作。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Screen
本次调用使用的 Screen 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value &Notice
value(只读借用,调用方仍持有原值;类型 &Notice)

返回值

int — 该类型的值

(&Screen) notice_ids

XuAPI
pub fn (s &Screen) notice_ids() []int

用途

&Screen 上的操作:执行 notice ids 操作。

参数

s &Screen
本次调用使用的 Screen 实例;以只读借用传入,调用方仍持有实例。

返回值

[]int — 切片结果

struct Tooltip

XuAPI
pub struct Tooltip {

}

用途

浮动提示框控件,跟随鼠标悬停显示补充说明。

公开字段

此类型没有公开字段。

tooltip

XuAPI
pub fn tooltip(identity &ui.CanvasEvent,id int,anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) Tooltip

用途

执行 tooltip 处理。失败时抛出错误,调用方需处理或继续传播。

参数

identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
anchor &layout.Rect
anchor(只读借用,调用方仍持有原值;类型 &layout.Rect)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

Tooltip — 该类型的值

(&Tooltip) id

XuAPI
pub fn (t &Tooltip) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tooltip) bounds

XuAPI
pub fn (t &Tooltip) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Tooltip) is_enabled

XuAPI
pub fn (t &Tooltip) is_enabled() bool

用途

返回控件当前是否可用。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Tooltip) is_selectable

XuAPI
pub fn (t &Tooltip) is_selectable() bool

用途

&Tooltip 上的操作:判断是否 selectable。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tooltip) set_selectable

XuAPI
pub fn (t $&Tooltip) set_selectable(selectable bool)

用途

$&Tooltip 上的操作:设置 selectable。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

($&Tooltip) set_text

XuAPI
pub fn (t $&Tooltip) set_text(context &draw.Context,text &string) int

用途

$&Tooltip 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

(&Tooltip) has_popup_open

XuAPI
pub fn (t &Tooltip) has_popup_open() bool

用途

&Tooltip 上的操作:判断是否具有 popup open。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Tooltip) popup_bounds

XuAPI
pub fn (t &Tooltip) popup_bounds() layout.Rect

用途

&Tooltip 上的操作:执行 popup bounds 操作。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&Tooltip) selected_text

XuAPI
pub fn (t &Tooltip) selected_text() string

用途

&Tooltip 上的操作:执行 selected text 操作。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&Tooltip) copy_selection

XuAPI
pub fn (t &Tooltip) copy_selection() int

用途

&Tooltip 上的操作:执行 copy selection 操作。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Tooltip) cursor

XuAPI
pub fn (t &Tooltip) cursor() int

用途

&Tooltip 上的操作:游标。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&Tooltip) set_viewport

XuAPI
pub fn (t $&Tooltip) set_viewport(viewport &layout.Rect)

用途

$&Tooltip 上的操作:设置 viewport。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&Tooltip) set_locale

XuAPI
pub fn (t $&Tooltip) set_locale(locale &Locale) int

用途

$&Tooltip 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

(&Tooltip) is_open

XuAPI
pub fn (t &Tooltip) is_open() bool

用途

返回浮层、菜单或对话框当前是否打开。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Tooltip) is_visible

XuAPI
pub fn (t &Tooltip) is_visible() bool

用途

&Tooltip 上的操作:判断是否 visible。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Tooltip) opacity

XuAPI
pub fn (t &Tooltip) opacity() f64

用途

在 &Tooltip 上执行 opacity 操作。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&Tooltip) needs_paint

XuAPI
pub fn (t &Tooltip) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&Tooltip) painted

XuAPI
pub fn (t $&Tooltip) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&Tooltip) set_delay

XuAPI
pub fn (t $&Tooltip) set_delay(delay time.Duration) int

用途

$&Tooltip 上的操作:设置 delay。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
delay time.Duration
delay(time.Duration)

返回值

int — 该类型的值

($&Tooltip) set_geometry

XuAPI
pub fn (t $&Tooltip) set_geometry(anchor &layout.Rect,size &layout.Size,viewport &layout.Rect) int

用途

$&Tooltip 上的操作:设置 geometry。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
anchor &layout.Rect
anchor(只读借用,调用方仍持有原值;类型 &layout.Rect)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&Tooltip) set_placement

XuAPI
pub fn (t $&Tooltip) set_placement(placement &OverlayPlacement) int

用途

$&Tooltip 上的操作:设置 placement。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
placement &OverlayPlacement
placement(只读借用,调用方仍持有原值;类型 &OverlayPlacement)

返回值

int — 该类型的值

($&Tooltip) set_enabled

XuAPI
pub fn (t $&Tooltip) set_enabled(enabled bool) int

用途

$&Tooltip 上的操作:设置 enabled。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&Tooltip) set_blocked

XuAPI
pub fn (t $&Tooltip) set_blocked(blocked bool,now time.Instant) int

用途

$&Tooltip 上的操作:设置 blocked。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
blocked bool
blocked(bool)
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

($&Tooltip) set_focus

XuAPI
pub fn (t $&Tooltip) set_focus(focused bool,now time.Instant) int

用途

$&Tooltip 上的操作:设置 focus。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)
now time.Instant
now(time.Instant)

返回值

int — 该类型的值

($&Tooltip) dismiss

XuAPI
pub fn (t $&Tooltip) dismiss(now time.Instant,reduced_motion bool) int

用途

在 $&Tooltip 上执行 dismiss 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

int — 该类型的值

($&Tooltip) input

XuAPI
pub fn (t $&Tooltip) input(event &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Tooltip) route

XuAPI
pub fn (t $&Tooltip) route(kind int,event &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
event &ui.InputEvent
event(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Tooltip) tick

XuAPI
pub fn (t $&Tooltip) tick(now time.Instant,reduced_motion bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

(&Tooltip) next_tick

XuAPI
pub fn (t &Tooltip) next_tick(now time.Instant) time.Instant

用途

&Tooltip 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

(&Tooltip) paint_styled

XuAPI
pub fn (t &Tooltip) paint_styled(frame $&draw.Frame,label $&StyledLabel,styles &Styles) int

用途

&Tooltip 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &Tooltip
本次调用使用的 Tooltip 实例;以只读借用传入,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
label $&StyledLabel
label(独占借用,可修改原值;类型 $&StyledLabel)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Tooltip) paint_content_styled

XuAPI
pub fn (t $&Tooltip) paint_content_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Tooltip 上的操作:执行 paint content styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Tooltip) paint_popup_styled

XuAPI
pub fn (t $&Tooltip) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&Tooltip 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&Tooltip) set_style

XuAPI
pub fn (t $&Tooltip) set_style(style &ControlStyle) int

用途

$&Tooltip 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&Tooltip) set_motion

XuAPI
pub fn (t $&Tooltip) set_motion(spec &MotionSpec) int

用途

$&Tooltip 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tooltip
本次调用使用的 Tooltip 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

const ACTION_ITEM_ACTION

XuAPI
pub const ACTION_ITEM_ACTION = 6

用途

常量 ACTION_ITEM_ACTION,定义了相关的协议或算法配置参数。

查看用法示例

($&TreeView) set_appearance

XuAPI
pub fn (t $&TreeView) set_appearance(a &TreeAppearance) int

用途

$&TreeView 上的操作:设置 appearance。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
a &TreeAppearance
值(只读借用,调用方仍持有原值;类型 &TreeAppearance)

返回值

int — 该类型的值

($&TreeView) set_motion

XuAPI
pub fn (t $&TreeView) set_motion(spec &MotionSpec) int

用途

$&TreeView 上的操作:设置 motion。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
spec &MotionSpec
spec(只读借用,调用方仍持有原值;类型 &MotionSpec)

返回值

int — 该类型的值

($&TreeView) set_metadata

XuAPI
pub fn (t $&TreeView) set_metadata(node int,text &string) int

用途

$&TreeView 上的操作:设置 metadata。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
node int
node(int)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&TreeView) set_icon

XuAPI
pub fn (t $&TreeView) set_icon(node int,icon int) int

用途

$&TreeView 上的操作:设置 icon。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
node int
node(int)
icon int
icon(int)

返回值

int — 该类型的值

($&TreeView) set_action

XuAPI
pub fn (t $&TreeView) set_action(node int,enabled bool) int

用途

$&TreeView 上的操作:设置 action。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
node int
node(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&TreeView) begin_update

XuAPI
pub fn (t $&TreeView) begin_update() int

用途

$&TreeView 上的操作:执行 begin update 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&TreeView) end_update

XuAPI
pub fn (t $&TreeView) end_update() int

用途

$&TreeView 上的操作:执行 end update 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&TreeView) set_filter

XuAPI
pub fn (t $&TreeView) set_filter(query &string) int

用途

$&TreeView 上的操作:设置 filter。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
query &string
query(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&TreeView) reveal_selected

XuAPI
pub fn (t $&TreeView) reveal_selected() int

用途

$&TreeView 上的操作:执行 reveal selected 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&TreeView) find_next

XuAPI
pub fn (t $&TreeView) find_next(prefix &string) bool

用途

$&TreeView 上的操作:执行 find next 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
prefix &string
前缀(只读借用,调用方仍持有原值;类型 &string)

返回值

bool — 是否成立

($&TreeView) tick

XuAPI
pub fn (t $&TreeView) tick(now time.Instant,reduced_motion bool) bool

用途

推进动画时间戳与状态过渡动画步进。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
now time.Instant
now(time.Instant)
reduced_motion bool
reduced_motion(bool)

返回值

bool — 是否成立

(&TreeView) next_tick

XuAPI
pub fn (t &TreeView) next_tick(now time.Instant) time.Instant

用途

&TreeView 上的操作:执行 next tick 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
now time.Instant
now(time.Instant)

返回值

time.Instant — 该类型的值

(&TreeView) action_bounds

XuAPI
pub fn (t &TreeView) action_bounds(row int) layout.Rect

用途

&TreeView 上的操作:执行 action bounds 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
row int
row(int)

返回值

layout.Rect — 该类型的值

($&TreeView) row_label_rect

XuAPI
pub fn (t $&TreeView) row_label_rect(row int,c &ControlStyle,styles &Styles) layout.Rect

用途

$&TreeView 上的操作:执行 row label rect 操作。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
row int
row(int)
c &ControlStyle
字节或字符码(只读借用,调用方仍持有原值;类型 &ControlStyle)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Rect — 该类型的值

($&TreeView) paint_styled

XuAPI
pub fn (t $&TreeView) paint_styled(frame $&draw.Frame,styles &Styles) int

用途

$&TreeView 上的操作:执行 paint styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

struct TreeView

XuAPI
pub struct TreeView {

}

用途

树形折叠层级列表控件,支持多层节点展开收起与选中。

公开字段

此类型没有公开字段。

tree_view

XuAPI
pub fn tree_view(context &draw.Context,identity &ui.CanvasEvent,id int,bounds &layout.Rect) TreeView

用途

执行 tree view 操作。失败时抛出错误,调用方需处理或继续传播。

参数

context &draw.Context
context(只读借用,调用方仍持有原值;类型 &draw.Context)
identity &ui.CanvasEvent
identity(只读借用,调用方仍持有原值;类型 &ui.CanvasEvent)
id int
id(int)
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

TreeView — 该类型的值

(&TreeView) id

XuAPI
pub fn (t &TreeView) id() int

用途

返回当前控件、元素或节点的唯一标识 ID。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TreeView) bounds

XuAPI
pub fn (t &TreeView) bounds() layout.Rect

用途

返回当前控件或几何对象的有效外接矩形边界(Rectangle)。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&TreeView) count

XuAPI
pub fn (t &TreeView) count() int

用途

返回该控件当前包含的项目数量。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TreeView) visible_count

XuAPI
pub fn (t &TreeView) visible_count() int

用途

&TreeView 上的操作:执行 visible count 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TreeView) selected

XuAPI
pub fn (t &TreeView) selected() int

用途

获取或判断当前选中的项索引、节点或文本状态。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TreeView) is_expanded

XuAPI
pub fn (t &TreeView) is_expanded(node int) bool

用途

&TreeView 上的操作:判断是否 expanded。失败时抛出错误,调用方需处理或继续传播。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
node int
node(int)

返回值

bool — 是否成立

(&TreeView) parent

XuAPI
pub fn (t &TreeView) parent(node int) int

用途

在 &TreeView 上执行 parent 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
node int
node(int)

返回值

int — 该类型的值

(&TreeView) text

XuAPI
pub fn (t &TreeView) text(node int) string

用途

&TreeView 上的操作:返回当前文本。失败时抛出错误,调用方需处理或继续传播。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
node int
node(int)

返回值

string — 结果字符串

(&TreeView) visible_node

XuAPI
pub fn (t &TreeView) visible_node(index int) int

用途

&TreeView 上的操作:执行 visible node 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

(&TreeView) needs_paint

XuAPI
pub fn (t &TreeView) needs_paint() bool

用途

返回控件是否需要重新绘制;绘制完成后调用 painted 清除标记。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TreeView) painted

XuAPI
pub fn (t $&TreeView) painted()

用途

确认当前帧已绘制,清除重绘标记;不是状态查询。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

(&TreeView) is_selectable

XuAPI
pub fn (t &TreeView) is_selectable() bool

用途

&TreeView 上的操作:判断是否 selectable。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&TreeView) set_selectable

XuAPI
pub fn (t $&TreeView) set_selectable(selectable bool)

用途

$&TreeView 上的操作:设置 selectable。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
selectable bool
selectable(bool)

返回值

不返回值。

(&TreeView) has_popup_open

XuAPI
pub fn (t &TreeView) has_popup_open() bool

用途

&TreeView 上的操作:判断是否具有 popup open。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TreeView) popup_bounds

XuAPI
pub fn (t &TreeView) popup_bounds() layout.Rect

用途

&TreeView 上的操作:执行 popup bounds 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

layout.Rect — 该类型的值

(&TreeView) selected_text

XuAPI
pub fn (t &TreeView) selected_text() string

用途

&TreeView 上的操作:执行 selected text 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

($&TreeView) set_locale

XuAPI
pub fn (t $&TreeView) set_locale(locale &Locale) int

用途

$&TreeView 上的操作:设置 locale。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
locale &Locale
locale(只读借用,调用方仍持有原值;类型 &Locale)

返回值

int — 该类型的值

($&TreeView) set_viewport

XuAPI
pub fn (t $&TreeView) set_viewport(viewport &layout.Rect)

用途

$&TreeView 上的操作:设置 viewport。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
viewport &layout.Rect
viewport(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

不返回值。

($&TreeView) paint_popup_styled

XuAPI
pub fn (t $&TreeView) paint_popup_styled(frame $&draw.Frame,styles &Styles) int

用途

$&TreeView 上的操作:执行 paint popup styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&TreeView) cursor

XuAPI
pub fn (t &TreeView) cursor() int

用途

&TreeView 上的操作:游标。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&TreeView) is_enabled

XuAPI
pub fn (t &TreeView) is_enabled() bool

用途

返回控件当前是否可用。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TreeView) is_focused

XuAPI
pub fn (t &TreeView) is_focused() bool

用途

返回控件当前是否拥有输入焦点。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TreeView) is_read_only

XuAPI
pub fn (t &TreeView) is_read_only() bool

用途

&TreeView 上的操作:判断是否 read only。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&TreeView) scroll_offset

XuAPI
pub fn (t &TreeView) scroll_offset() f64

用途

&TreeView 上的操作:执行 scroll offset 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

($&TreeView) cancel

XuAPI
pub fn (t $&TreeView) cancel()

用途

$&TreeView 上的操作:取消。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&TreeView) set_focus

XuAPI
pub fn (t $&TreeView) set_focus(focused bool)

用途

$&TreeView 上的操作:设置 focus。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
focused bool
focused(bool)

返回值

不返回值。

($&TreeView) set_enabled

XuAPI
pub fn (t $&TreeView) set_enabled(enabled bool)

用途

$&TreeView 上的操作:设置 enabled。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
enabled bool
enabled(bool)

返回值

不返回值。

($&TreeView) set_read_only

XuAPI
pub fn (t $&TreeView) set_read_only(value bool) int

用途

$&TreeView 上的操作:设置 read only。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
value bool
value(bool)

返回值

int — 该类型的值

($&TreeView) add

XuAPI
pub fn (t $&TreeView) add(parent int,text &string) int

用途

$&TreeView 上的操作:相加。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
parent int
parent(int)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&TreeView) set_text

XuAPI
pub fn (t $&TreeView) set_text(node int,text &string) int

用途

$&TreeView 上的操作:设置 text。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
node int
node(int)
text &string
文本(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&TreeView) set_expanded

XuAPI
pub fn (t $&TreeView) set_expanded(node int,expanded bool) int

用途

$&TreeView 上的操作:设置 expanded。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
node int
node(int)
expanded bool
expanded(bool)

返回值

int — 该类型的值

($&TreeView) set_selected

XuAPI
pub fn (t $&TreeView) set_selected(node int) int

用途

$&TreeView 上的操作:设置 selected。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
node int
node(int)

返回值

int — 该类型的值

($&TreeView) clear

XuAPI
pub fn (t $&TreeView) clear() int

用途

清空所有已缓冲或存储的数据项与内部状态。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&TreeView) set_bounds

XuAPI
pub fn (t $&TreeView) set_bounds(bounds &layout.Rect) int

用途

$&TreeView 上的操作:设置 bounds。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
bounds &layout.Rect
bounds(只读借用,调用方仍持有原值;类型 &layout.Rect)

返回值

int — 该类型的值

($&TreeView) set_scroll_offset

XuAPI
pub fn (t $&TreeView) set_scroll_offset(offset f64) int

用途

$&TreeView 上的操作:设置 scroll offset。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
offset f64
偏移(f64)

返回值

int — 该类型的值

(&TreeView) style_or

XuAPI
pub fn (t &TreeView) style_or(styles &Styles) ControlStyle

用途

&TreeView 上的操作:执行 style or 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

ControlStyle — 该类型的值

($&TreeView) set_style

XuAPI
pub fn (t $&TreeView) set_style(style &ControlStyle) int

用途

$&TreeView 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
style &ControlStyle
style(只读借用,调用方仍持有原值;类型 &ControlStyle)

返回值

int — 该类型的值

($&TreeView) clear_style

XuAPI
pub fn (t $&TreeView) clear_style()

用途

$&TreeView 上的操作:执行 clear style 操作。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&TreeView) apply_styles

XuAPI
pub fn (t $&TreeView) apply_styles(styles &Styles) int

用途

根据当前主题样式表解析并应用几何与视觉度量。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&TreeView) row_bounds

XuAPI
pub fn (t &TreeView) row_bounds(index int) layout.Rect

用途

&TreeView 上的操作:执行 row bounds 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
index int
index(int)

返回值

layout.Rect — 该类型的值

(&TreeView) node_row_text

XuAPI
pub fn (t &TreeView) node_row_text(node int) string

用途

&TreeView 上的操作:执行 node row text 操作。

参数

t &TreeView
本次调用使用的 TreeView 实例;以只读借用传入,调用方仍持有实例。
node int
node(int)

返回值

string — 结果字符串

($&TreeView) input

XuAPI
pub fn (t $&TreeView) input(input &ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TreeView) route

XuAPI
pub fn (t $&TreeView) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TreeView) event

XuAPI
pub fn (t $&TreeView) event(event &ui.Event) Action

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&TreeView) measure_styled

XuAPI
pub fn (t $&TreeView) measure_styled(styles &Styles) layout.Size

用途

$&TreeView 上的操作:执行 measure styled 操作。失败时抛出错误,调用方需处理或继续传播。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

($&TreeView) dispose

XuAPI
pub fn (t $&TreeView) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

t $&TreeView
本次调用使用的 TreeView 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

struct@ Painter

XuAPI
pub struct@ Painter {
    fn paint(int,&layout.Rect,$&draw.Frame) bool
}

用途

方法集契约约束 Painter,实现类型须提供其定义的方法。

要求的方法

paint fn paint(int,&layout.Rect,$&draw.Frame) bool
在目标画布或渲染目标上执行控件的视觉绘制。

(Painter) paint

XuAPI
fn paint(int,&layout.Rect,$&draw.Frame) bool

用途

在目标画布或渲染目标上执行控件的视觉绘制。

参数

self Self
本次调用使用的 Self 实例;按值接收。
int int
int(int)
rect &layout.Rect
rect(只读借用,调用方仍持有原值;类型 &layout.Rect)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)

返回值

bool — 是否成立

struct ViewStats

XuAPI
pub struct ViewStats {
    pub measured int
    pub reused_layouts int
    pub painted_nodes int
    pub recorded_boundaries int
    pub reused_boundaries int
    pub frame_commands int
}

用途

承载 measured、reused_layouts、painted_nodes、recorded_boundaries、reused_boundaries 等属性的结构体。

公开字段

measured int
字段(int)
reused_layouts int
字段(int)
painted_nodes int
字段(int)
recorded_boundaries int
字段(int)
reused_boundaries int
字段(int)
frame_commands int
字段(int)

struct View

XuAPI
pub struct View {

}

用途

保留模式画布场景容器,管理控件树排版、绘制与事件分发。

公开字段

此类型没有公开字段。

查看用法示例

(&Host) view

XuAPI
pub fn (host &Host) view(root_style &layout.BoxStyle,background draw.Color) View

用途

&Host 上的操作:视图。失败时抛出错误,调用方需处理或继续传播。

参数

host &Host
本次调用使用的 Host 实例;以只读借用传入,调用方仍持有实例。
root_style &layout.BoxStyle
root_style(只读借用,调用方仍持有原值;类型 &layout.BoxStyle)
background draw.Color
background(draw.Color)

返回值

View — 该类型的值

(&View) root

XuAPI
pub fn (view &View) root() int

用途

在 &View 上执行 root 操作。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&View) add

XuAPI
pub fn (view $&View) add(parent int,style &layout.BoxStyle,intrinsic &layout.Size) int

用途

$&View 上的操作:相加。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
parent int
parent(int)
style &layout.BoxStyle
style(只读借用,调用方仍持有原值;类型 &layout.BoxStyle)
intrinsic &layout.Size
intrinsic(只读借用,调用方仍持有原值;类型 &layout.Size)

返回值

int — 该类型的值

(&View) contains

XuAPI
pub fn (view &View) contains(id int) bool

用途

&View 上的操作:判断是否包含给定片段。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

(&View) style

XuAPI
pub fn (view &View) style(id int) layout.BoxStyle

用途

在 &View 上执行 style 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

layout.BoxStyle — 该类型的值

($&View) set_style

XuAPI
pub fn (view $&View) set_style(id int,style &layout.BoxStyle) int

用途

$&View 上的操作:设置 style。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
style &layout.BoxStyle
style(只读借用,调用方仍持有原值;类型 &layout.BoxStyle)

返回值

int — 该类型的值

($&View) set_intrinsic

XuAPI
pub fn (view $&View) set_intrinsic(id int,size &layout.Size) int

用途

$&View 上的操作:设置 intrinsic。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
size &layout.Size
size(只读借用,调用方仍持有原值;类型 &layout.Size)

返回值

int — 该类型的值

($&View) mark_paint

XuAPI
pub fn (view $&View) mark_paint(id int) int

用途

$&View 上的操作:执行 mark paint 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&View) set_offset

XuAPI
pub fn (view $&View) set_offset(id int,x f64,y f64) int

用途

$&View 上的操作:设置 offset。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

($&View) set_scroll

XuAPI
pub fn (view $&View) set_scroll(id int,x f64,y f64) int

用途

$&View 上的操作:设置 scroll。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

($&View) set_boundary

XuAPI
pub fn (view $&View) set_boundary(id int,enabled bool) int

用途

$&View 上的操作:设置 boundary。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

($&View) remove

XuAPI
pub fn (view $&View) remove(id int) int

用途

$&View 上的操作:删除。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

($&View) dispose

XuAPI
pub fn (view $&View) dispose()

用途

释放并清理对象所持有的系统原生资源与底层句柄。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

不返回值。

($&View) event

XuAPI
pub fn (view $&View) event(event &ui.Event) bool

用途

处理并响应窗口与系统的交互及生命周期事件。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)

返回值

bool — 是否成立

($&View) set_background

XuAPI
pub fn (view $&View) set_background(color draw.Color)

用途

$&View 上的操作:设置 background。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
color draw.Color
color(draw.Color)

返回值

不返回值。

(&View) needs_frame

XuAPI
pub fn (view &View) needs_frame() bool

用途

&View 上的操作:执行 needs frame 操作。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

($&View) layout

XuAPI
pub fn (view $&View) layout(constraints &layout.Constraints) layout.Size

用途

在 $&View 上执行 layout 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
constraints &layout.Constraints
constraints(只读借用,调用方仍持有原值;类型 &layout.Constraints)

返回值

layout.Size — 该类型的值

(&View) node_bounds

XuAPI
pub fn (view &View) node_bounds(id int) layout.Rect

用途

&View 上的操作:执行 node bounds 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

layout.Rect — 该类型的值

(&View) hit_test

XuAPI
pub fn (view &View) hit_test(x f64,y f64) int

用途

&View 上的操作:执行 hit test 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
x f64
值(f64)
y f64
值(f64)

返回值

int — 该类型的值

(&View) local_input

XuAPI
pub fn (view &View) local_input(id int,input &ui.InputEvent) ui.InputEvent

用途

&View 上的操作:执行 local input 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

ui.InputEvent — 该类型的值

(&View) stats

XuAPI
pub fn (view &View) stats() ViewStats

用途

在 &View 上执行 stats 操作。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

ViewStats — 该类型的值

present

XuAPI
pub fn present#P:Painter(view $&View,constraints &layout.Constraints,painter $&P) bool

用途

执行 present 处理。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
constraints &layout.Constraints
constraints(只读借用,调用方仍持有原值;类型 &layout.Constraints)
painter $&P
painter(独占借用,可修改原值;类型 $&P)

返回值

bool — 是否成立

查看用法示例

snapshot

XuAPI
pub fn snapshot#P:Painter(view $&View,constraints &layout.Constraints,scale f64,painter $&P) draw.Surface

用途

执行 snapshot 处理。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
constraints &layout.Constraints
constraints(只读借用,调用方仍持有原值;类型 &layout.Constraints)
scale f64
scale(f64)
painter $&P
painter(独占借用,可修改原值;类型 $&P)

返回值

draw.Surface — 该类型的值

const ROUTE_INPUT

XuAPI
pub const ROUTE_INPUT = 0

用途

常量 ROUTE_INPUT,定义了相关的协议或算法配置参数。

const ROUTE_FOCUS

XuAPI
pub const ROUTE_FOCUS = 1

用途

常量 ROUTE_FOCUS,定义了相关的协议或算法配置参数。

const ROUTE_BLUR

XuAPI
pub const ROUTE_BLUR = 2

用途

常量 ROUTE_BLUR,定义了相关的协议或算法配置参数。

const ROUTE_CANCEL

XuAPI
pub const ROUTE_CANCEL = 3

用途

常量 ROUTE_CANCEL,定义了相关的协议或算法配置参数。

struct@ InputHandler

XuAPI
pub struct@ InputHandler {
    fn input(int,int,&ui.InputEvent) Action
}

用途

方法集契约约束 InputHandler,实现类型须提供其定义的方法。

要求的方法

input fn input(int,int,&ui.InputEvent) Action
接收并处理分发的鼠标、键盘或触摸交互输入事件。

(InputHandler) input

XuAPI
fn input(int,int,&ui.InputEvent) Action

用途

接收并处理分发的鼠标、键盘或触摸交互输入事件。

参数

self Self
本次调用使用的 Self 实例;按值接收。
int int
int(int)
int int
int(int)
inputEvent &ui.InputEvent
inputEvent(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Button) route

XuAPI
pub fn (button $&Button) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

button $&Button
本次调用使用的 Button 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Checkbox) route

XuAPI
pub fn (checkbox $&Checkbox) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

checkbox $&Checkbox
本次调用使用的 Checkbox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Scroll) route

XuAPI
pub fn (scroll $&Scroll) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

scroll $&Scroll
本次调用使用的 Scroll 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Switch) route

XuAPI
pub fn (sw $&Switch) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

sw $&Switch
本次调用使用的 Switch 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Radio) route

XuAPI
pub fn (r $&Radio) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

r $&Radio
本次调用使用的 Radio 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Slider) route

XuAPI
pub fn (s $&Slider) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

s $&Slider
本次调用使用的 Slider 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Tabs) route

XuAPI
pub fn (t $&Tabs) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

t $&Tabs
本次调用使用的 Tabs 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Select) route

XuAPI
pub fn (sel $&Select) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

sel $&Select
本次调用使用的 Select 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&Stepper) route

XuAPI
pub fn (st $&Stepper) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

st $&Stepper
本次调用使用的 Stepper 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&ListBox) route

XuAPI
pub fn (lb $&ListBox) route(kind int,input &ui.InputEvent) Action

用途

路由并分发交互事件至命中的子节点或处理器。失败时抛出错误,调用方需处理或继续传播。

参数

lb $&ListBox
本次调用使用的 ListBox 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
kind int
类型标签(int)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)

返回值

Action — 输入处理结果,包含 kind、id、重绘与焦点请求。

($&View) set_input

XuAPI
pub fn (view $&View) set_input(id int,enabled bool,focusable bool) int

用途

$&View 上的操作:设置 input。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)
focusable bool
focusable(bool)

返回值

int — 该类型的值

($&View) set_capture_outside

XuAPI
pub fn (view $&View) set_capture_outside(id int,enabled bool) int

用途

$&View 上的操作:设置 capture outside。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
enabled bool
enabled(bool)

返回值

int — 该类型的值

(&View) focused

XuAPI
pub fn (view &View) focused() int

用途

在 &View 上执行 focused 操作。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&View) captured

XuAPI
pub fn (view &View) captured() int

用途

在 &View 上执行 captured 操作。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&View) pointer_cursor

XuAPI
pub fn (view &View) pointer_cursor() int

用途

&View 上的操作:执行 pointer cursor 操作。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

($&View) set_cursor

XuAPI
pub fn (view $&View) set_cursor(id int,cursor int) int

用途

$&View 上的操作:设置 cursor。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
cursor int
cursor(int)

返回值

int — 该类型的值

($&View) set_pointer_cursor

XuAPI
pub fn (view $&View) set_pointer_cursor(cursor int) int

用途

$&View 上的操作:设置 pointer cursor。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
cursor int
cursor(int)

返回值

int — 该类型的值

flush_input

XuAPI
pub fn flush_input#H:InputHandler(view $&View,handler $&H) int

用途

执行 flush input 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
handler $&H
handler(独占借用,可修改原值;类型 $&H)

返回值

int — 该类型的值

cancel_input

XuAPI
pub fn cancel_input#H:InputHandler(view $&View,handler $&H) int

用途

执行 cancel input 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
handler $&H
handler(独占借用,可修改原值;类型 $&H)

返回值

int — 该类型的值

dispatch

XuAPI
pub fn dispatch#H:InputHandler(view $&View,input &ui.InputEvent,handler $&H) []Action

用途

执行 dispatch 处理。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
input &ui.InputEvent
input(只读借用,调用方仍持有原值;类型 &ui.InputEvent)
handler $&H
handler(独占借用,可修改原值;类型 $&H)

返回值

[]Action — 切片结果

查看用法示例

dispatch_event

XuAPI
pub fn dispatch_event#H:InputHandler(view $&View,event &ui.Event,handler $&H) []Action

用途

执行 dispatch event 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
event &ui.Event
event(只读借用,调用方仍持有原值;类型 &ui.Event)
handler $&H
handler(独占借用,可修改原值;类型 $&H)

返回值

[]Action — 切片结果

查看用法示例

const THEME_DARK

XuAPI
pub const THEME_DARK = 0

用途

常量 THEME_DARK,定义了相关的协议或算法配置参数。

查看用法示例

const THEME_LIGHT

XuAPI
pub const THEME_LIGHT = 1

用途

常量 THEME_LIGHT,定义了相关的协议或算法配置参数。

查看用法示例

const THEME_CONTRAST

XuAPI
pub const THEME_CONTRAST = 2

用途

常量 THEME_CONTRAST,定义了相关的协议或算法配置参数。

查看用法示例

preset_styles

XuAPI
pub fn preset_styles(preset int) Styles

用途

执行 preset styles 操作。失败时抛出错误,调用方需处理或继续传播。

参数

preset int
preset(int)

返回值

Styles — 该类型的值

查看用法示例

preset_name

XuAPI
pub fn preset_name(preset int) string

用途

执行 preset name 操作。失败时抛出错误,调用方需处理或继续传播。

参数

preset int
preset(int)

返回值

string — 结果字符串

next_preset

XuAPI
pub fn next_preset(preset int) int

用途

执行 next preset 操作。失败时抛出错误,调用方需处理或继续传播。

参数

preset int
preset(int)

返回值

int — 该类型的值

struct StyleSwitcher

XuAPI
pub struct StyleSwitcher {

}

用途

StyleSwitcher 上下文或状态结构体。

公开字段

此类型没有公开字段。

查看用法示例

style_switcher

XuAPI
pub fn style_switcher() StyleSwitcher

用途

执行 style switcher 操作。

参数

无需传入参数。

返回值

StyleSwitcher — 该类型的值

查看用法示例

(&StyleSwitcher) current

XuAPI
pub fn (switcher &StyleSwitcher) current() int

用途

&StyleSwitcher 上的操作:当前。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&StyleSwitcher) name

XuAPI
pub fn (switcher &StyleSwitcher) name() string

用途

&StyleSwitcher 上的操作:名称。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。

返回值

string — 结果字符串

(&StyleSwitcher) count

XuAPI
pub fn (switcher &StyleSwitcher) count() int

用途

返回该控件当前包含的项目数量。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&StyleSwitcher) text_scale

XuAPI
pub fn (switcher &StyleSwitcher) text_scale() f64

用途

&StyleSwitcher 上的操作:执行 text scale 操作。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&StyleSwitcher) density

XuAPI
pub fn (switcher &StyleSwitcher) density() f64

用途

在 &StyleSwitcher 上执行 density 操作。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。

返回值

f64 — 该类型的值

(&StyleSwitcher) styles

XuAPI
pub fn (switcher &StyleSwitcher) styles() Styles

用途

在 &StyleSwitcher 上执行 styles 操作。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。

返回值

Styles — 该类型的值

($&StyleSwitcher) use_preset

XuAPI
pub fn (switcher $&StyleSwitcher) use_preset(index int) int

用途

$&StyleSwitcher 上的操作:执行 use preset 操作。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)

返回值

int — 该类型的值

($&StyleSwitcher) use_name

XuAPI
pub fn (switcher $&StyleSwitcher) use_name(name &string) int

用途

$&StyleSwitcher 上的操作:执行 use name 操作。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
name &string
名字(只读借用,调用方仍持有原值;类型 &string)

返回值

int — 该类型的值

($&StyleSwitcher) next

XuAPI
pub fn (switcher $&StyleSwitcher) next() int

用途

$&StyleSwitcher 上的操作:取出下一项;没有则按本类型约定结束。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值

($&StyleSwitcher) set_text_scale

XuAPI
pub fn (switcher $&StyleSwitcher) set_text_scale(scale f64) int

用途

$&StyleSwitcher 上的操作:设置 text scale。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
scale f64
scale(f64)

返回值

int — 该类型的值

($&StyleSwitcher) set_density

XuAPI
pub fn (switcher $&StyleSwitcher) set_density(density f64) int

用途

$&StyleSwitcher 上的操作:设置 density。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
density f64
density(f64)

返回值

int — 该类型的值

($&StyleSwitcher) set_preset

XuAPI
pub fn (switcher $&StyleSwitcher) set_preset(index int,styles &Styles) int

用途

$&StyleSwitcher 上的操作:设置 preset。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
index int
index(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

($&StyleSwitcher) add_preset

XuAPI
pub fn (switcher $&StyleSwitcher) add_preset(name &string,styles &Styles) int

用途

$&StyleSwitcher 上的操作:执行 add preset 操作。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
name &string
名字(只读借用,调用方仍持有原值;类型 &string)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

int — 该类型的值

(&StyleSwitcher) apply

XuAPI
pub fn (switcher &StyleSwitcher) apply(view $&View) int

用途

在 &StyleSwitcher 上执行 apply 操作。失败时抛出错误,调用方需处理或继续传播。

参数

switcher &StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以只读借用传入,调用方仍持有实例。
view $&View
view(独占借用,可修改原值;类型 $&View)

返回值

int — 该类型的值

($&StyleSwitcher) cycle

XuAPI
pub fn (switcher $&StyleSwitcher) cycle(view $&View) int

用途

在 $&StyleSwitcher 上执行 cycle 操作。失败时抛出错误,调用方需处理或继续传播。

参数

switcher $&StyleSwitcher
本次调用使用的 StyleSwitcher 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
view $&View
view(独占借用,可修改原值;类型 $&View)

返回值

int — 该类型的值

struct@ StyledPainter

XuAPI
pub struct@ StyledPainter {
    fn measure_styled(int,&Styles) layout.Size
    fn paint_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool
    fn overlay_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool
}

用途

保留场景的样式感知回调。借用有效主题,绘制坐标为节点局部坐标;回调内不能修改 View 或拓扑。overlay 在子节点之后执行。

要求的方法

measure_styled fn measure_styled(int,&Styles) layout.Size
StyledPainter 上的操作:执行 measure styled 操作。
paint_styled fn paint_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool
StyledPainter 上的操作:执行 paint styled 操作。
overlay_styled fn overlay_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool
StyledPainter 上的操作:执行 overlay styled 操作。

(StyledPainter) measure_styled

XuAPI
fn measure_styled(int,&Styles) layout.Size

用途

StyledPainter 上的操作:执行 measure styled 操作。

参数

self Self
本次调用使用的 Self 实例;按值接收。
int int
int(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

layout.Size — 该类型的值

(StyledPainter) paint_styled

XuAPI
fn paint_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool

用途

StyledPainter 上的操作:执行 paint styled 操作。

参数

self Self
本次调用使用的 Self 实例;按值接收。
int int
int(int)
rect &layout.Rect
rect(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)

返回值

bool — 是否成立

(StyledPainter) overlay_styled

XuAPI
fn overlay_styled(int,&layout.Rect,&Styles,$&draw.Frame) bool

用途

StyledPainter 上的操作:执行 overlay styled 操作。

参数

self Self
本次调用使用的 Self 实例;按值接收。
int int
int(int)
rect &layout.Rect
rect(只读借用,调用方仍持有原值;类型 &layout.Rect)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)
frame $&draw.Frame
frame(独占借用,可修改原值;类型 $&draw.Frame)

返回值

bool — 是否成立

(&View) styles

XuAPI
pub fn (view &View) styles() Styles

用途

在 &View 上执行 styles 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。

返回值

Styles — 该类型的值

(&View) has_style_scope

XuAPI
pub fn (view &View) has_style_scope(id int) bool

用途

&View 上的操作:判断是否具有 style scope。失败时抛出错误,调用方需处理或继续传播。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

bool — 是否成立

($&View) invalidate_control

XuAPI
pub fn (view $&View) invalidate_control(id int) int

用途

$&View 上的操作:执行 invalidate control 操作。失败时抛出错误,调用方需处理或继续传播。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

int — 该类型的值

(&View) styles_for

XuAPI
pub fn (view &View) styles_for(id int) Styles

用途

读取节点继承的完整主题并返回独立克隆。

参数

view &View
本次调用使用的 View 实例;以只读借用传入,调用方仍持有实例。
id int
id(int)

返回值

独立 Styles;无效节点抛出错误

($&View) set_styles

XuAPI
pub fn (view $&View) set_styles(styles &Styles) int

用途

设置根主题。颜色变化只重绘;测量指标变化还使已注册节点重新测量,相同值不失效。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

($&View) set_style_scope

XuAPI
pub fn (view $&View) set_style_scope(id int,styles &Styles) int

用途

为非根节点保存完整主题快照,后代继承到下一作用域;后续全局变化保留此快照。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
styles &Styles
styles(只读借用,调用方仍持有原值;类型 &Styles)

返回值

成功为 0;失败抛出错误

($&View) clear_style_scope

XuAPI
pub fn (view $&View) clear_style_scope(id int) int

用途

移除显式局部主题并恢复继承,使受影响缓存失效。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

成功为 0;失败抛出错误

($&View) set_style_measure

XuAPI
pub fn (view $&View) set_style_measure(id int,on bool) int

用途

选择节点是否使用 StyledPainter.measure_styled;启用时标记需要测量。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)
on bool
on(bool)

返回值

成功为 0;失败抛出错误

($&View) mark_measure

XuAPI
pub fn (view $&View) mark_measure(id int) int

用途

文字或固有尺寸改变后调用;标记绘制,并让已注册的节点重新测量。

参数

view $&View
本次调用使用的 View 实例;以独占借用传入,方法可修改它,调用方仍持有实例。
id int
id(int)

返回值

成功为 0;失败抛出错误

layout_styled

XuAPI
pub fn layout_styled#P:StyledPainter(view $&View,constraints &layout.Constraints,painter $&P) layout.Size

用途

测量已注册的脏节点并执行布局;布局后同步编辑器位置。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
constraints &layout.Constraints
constraints(只读借用,调用方仍持有原值;类型 &layout.Constraints)
painter $&P
painter(独占借用,可修改原值;类型 $&P)

返回值

布局后的根尺寸;失败抛出错误

查看用法示例

present_styled

XuAPI
pub fn present_styled#P:StyledPainter(view $&View,constraints &layout.Constraints,painter $&P) bool

用途

布局并提交脏场景,复用未失效的重绘边界;空闲时不提交。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
constraints &layout.Constraints
constraints(只读借用,调用方仍持有原值;类型 &layout.Constraints)
painter $&P
painter(独占借用,可修改原值;类型 $&P)

返回值

提交为 true;场景干净为 false;失败抛出错误

查看用法示例

snapshot_styled

XuAPI
pub fn snapshot_styled#P:StyledPainter(view $&View,constraints &layout.Constraints,scale f64,painter $&P) draw.Surface

用途

布局并绘制到离屏 Surface,scale 决定栅格分辨率;调用者负责释放结果。

参数

view $&View
view(独占借用,可修改原值;类型 $&View)
constraints &layout.Constraints
constraints(只读借用,调用方仍持有原值;类型 &layout.Constraints)
scale f64
scale(f64)
painter $&P
painter(独占借用,可修改原值;类型 $&P)

返回值

拥有的 Surface;失败抛出错误