const content_none
pub const content_none = 0用途
公开常量 `content_none`。 值为 `0`
参数
无
API
#ui窗口/菜单/托盘。host 未接时 run 会报 host not available。
const content_nonepub const content_none = 0公开常量 `content_none`。 值为 `0`
无
const content_webviewpub const content_webview = 1公开常量 `content_webview`。 值为 `1`
无
const content_drawpub const content_draw = 2公开常量 `content_draw`。 值为 `2`
无
const content_nativepub const content_native = 3公开常量 `content_native`。 值为 `3`
无
struct ContentPluginpub struct ContentPlugin {
pub kind int
pub bootstrap string
pub macos_src string
pub macos_frameworks string
pub linux_src string
pub linux_libs string
pub windows_src string
pub windows_libs string
}公开结构体 `ContentPlugin`。
kind intbootstrap stringmacos_src stringmacos_frameworks stringlinux_src stringlinux_libs stringwindows_src stringwindows_libs stringconst os_macospub const os_macos = 0公开常量 `os_macos`。 值为 `0`
无
const os_linuxpub const os_linux = 1公开常量 `os_linux`。 值为 `1`
无
const os_windowspub const os_windows = 2公开常量 `os_windows`。 值为 `2`
无
const os_nonepub const os_none = 3公开常量 `os_none`。 值为 `3`
无
const ev_nonepub const ev_none = 0公开常量 `ev_none`。 值为 `0`
无
const ev_readypub const ev_ready = 1公开常量 `ev_ready`。 值为 `1`
无
const ev_exitpub const ev_exit = 2公开常量 `ev_exit`。 值为 `2`
无
const ev_before_exitpub const ev_before_exit = 3公开常量 `ev_before_exit`。 值为 `3`
无
const ev_close_requestedpub const ev_close_requested = 10公开常量 `ev_close_requested`。 值为 `10`
无
const ev_closedpub const ev_closed = 11公开常量 `ev_closed`。 值为 `11`
无
const ev_focusedpub const ev_focused = 12公开常量 `ev_focused`。 值为 `12`
无
const ev_blurredpub const ev_blurred = 13公开常量 `ev_blurred`。 值为 `13`
无
const ev_resizedpub const ev_resized = 14公开常量 `ev_resized`。 值为 `14`
无
const ev_movedpub const ev_moved = 15公开常量 `ev_moved`。 值为 `15`
无
const ev_menu_clickedpub const ev_menu_clicked = 20公开常量 `ev_menu_clicked`。 值为 `20`
无
const ev_tray_clickedpub const ev_tray_clicked = 30公开常量 `ev_tray_clicked`。 值为 `30`
无
const ev_tray_menu_clickedpub const ev_tray_menu_clicked = 31公开常量 `ev_tray_menu_clicked`。 值为 `31`
无
const ev_loadingpub const ev_loading = 40公开常量 `ev_loading`。 值为 `40`
无
const ev_loadedpub const ev_loaded = 41公开常量 `ev_loaded`。 值为 `41`
无
const ev_load_failedpub const ev_load_failed = 42公开常量 `ev_load_failed`。 值为 `42`
无
const ev_progresspub const ev_progress = 43公开常量 `ev_progress`。 值为 `43`
无
const ev_file_droppub const ev_file_drop = 50公开常量 `ev_file_drop`。 值为 `50`
无
const ev_file_pickedpub const ev_file_picked = 51公开常量 `ev_file_picked`。 值为 `51`
无
const ev_file_savedpub const ev_file_saved = 52公开常量 `ev_file_saved`。 值为 `52`
无
const ev_external_navpub const ev_external_nav = 53公开常量 `ev_external_nav`。 值为 `53`
无
const ev_screenshotpub const ev_screenshot = 54公开常量 `ev_screenshot`。 值为 `54`
无
const ev_folder_pickedpub const ev_folder_picked = 55公开常量 `ev_folder_picked`。 值为 `55`
无
const ev_alertpub const ev_alert = 56公开常量 `ev_alert`。 值为 `56`
无
const ev_confirmpub const ev_confirm = 57公开常量 `ev_confirm`。 值为 `57`
无
const ev_notifypub const ev_notify = 58公开常量 `ev_notify`。 值为 `58`
无
const ev_close_rejectedpub const ev_close_rejected = 59公开常量 `ev_close_rejected`。 值为 `59`
无
const ev_cache_clearedpub const ev_cache_cleared = 60公开常量 `ev_cache_cleared`。 值为 `60`
无
const ev_downloadpub const ev_download = 61公开常量 `ev_download`。 值为 `61`
无
const ev_download_failedpub const ev_download_failed = 62公开常量 `ev_download_failed`。 值为 `62`
无
const ev_cookies_clearedpub const ev_cookies_cleared = 63公开常量 `ev_cookies_cleared`。 值为 `63`
无
const ev_cookie_setpub const ev_cookie_set = 64公开常量 `ev_cookie_set`。 值为 `64`
无
const ev_clipboardpub const ev_clipboard = 65公开常量 `ev_clipboard`。 值为 `65`
无
const ev_boundspub const ev_bounds = 66公开常量 `ev_bounds`。 值为 `66`
无
const ev_statepub const ev_state = 67公开常量 `ev_state`。 值为 `67`
无
const ev_clickpub const ev_click = 68公开常量 `ev_click`。 值为 `68`
无
const ev_promptpub const ev_prompt = 69公开常量 `ev_prompt`。 值为 `69`
无
const ev_scrollpub const ev_scroll = 70公开常量 `ev_scroll`。 值为 `70`
无
const ev_dragpub const ev_drag = 71公开常量 `ev_drag`。 值为 `71`
无
struct Eventpub struct Event {
pub kind int
pub window_id int
pub menu_id string
pub width int
pub height int
}公开结构体 `Event`。
kind intwindow_id intmenu_id stringwidth intheight intstruct Iconpub struct Icon {
pub path string
}公开结构体 `Icon`。
path stringstruct MenuItempub struct MenuItem {
pub id string
pub label string
}公开结构体 `MenuItem`。
id stringlabel stringstruct Menupub struct Menu {
pub items []MenuItem
}公开结构体 `Menu`。
items []MenuItemstruct WindowOptspub struct WindowOpts {
pub title string
pub width int
pub height int
}公开结构体 `WindowOpts`。
title stringwidth intheight intstruct Windowpub struct Window {
pub id int
pub title string
pub width int
pub height int
pub content_kind int
pub content_backend_id int
pub closed int
}公开结构体 `Window`。
id inttitle stringwidth intheight intcontent_kind intcontent_backend_id intclosed intstruct TrayOptspub struct TrayOpts {
pub tip string
pub icon Icon
pub menu Menu
}公开结构体 `TrayOpts`。
tip stringicon Iconmenu Menustruct Traypub struct Tray {
pub id int
pub tip string
}公开结构体 `Tray`。
id inttip stringstruct Apppub struct App {
pub next_id int
pub icon Icon
pub quit_flag int
pub sim int
pub event_ch chan Event
pub post_ch chan int
pub menu_ids []string
pub win_title string
pub win_w int
pub win_h int
}公开结构体 `App`。
next_id inticon Iconquit_flag intsim intevent_ch chan Eventpost_ch chan intmenu_ids []stringwin_title stringwin_w intwin_h intnew_apppub fn new_app() App构造 app。
无
App — 该类型的值
new_app_eventspub fn new_app_events(ech chan Event) App构造 app events。
ech chan EventApp — 该类型的值
icon_defaultpub fn icon_default() Iconicondefault。
无
Icon — 该类型的值
icon_from_filepub fn icon_from_file(path string) Iconicon从文件。
path stringIcon — 该类型的值
menu_itempub fn menu_item(id string, label string) MenuItemmenuitem。
id stringlabel stringMenuItem — 该类型的值
menupub fn menu(items []MenuItem) Menumenu,返回 Menu。
items []MenuItemMenu — 该类型的值
target_ospub fn target_os() inttargetos。
无
int — 该类型的值
platform_supportedpub fn platform_supported() boolplatformsupported。
无
bool — 是否成立
(&mut App) alloc_idpub fn (a &mut App) alloc_id() int`&mut App` 上的方法:allocid。
a &mut Appint — 该类型的值
(&mut App) set_iconpub fn (a &mut App) set_icon(icon Icon)`&mut App` 上的方法:设置 icon。
a &mut Appicon Iconinstall_tray_iconpub fn install_tray_icon(path string) intinstalltrayicon。失败时 throw。
path stringint — 该类型的值
(&mut App) new_windowpub fn (a &mut App) new_window(opts WindowOpts) Window`&mut App` 上的方法:构造 window。
a &mut Appopts WindowOptsWindow — 该类型的值
install_menupub fn install_menu(m Menu) intinstallmenu。失败时 throw。
m Menuint — 该类型的值
native_set_menu_visiblepub fn native_set_menu_visible(on int) intnativesetmenuvisible。失败时 throw。
on intint — 该类型的值
install_traypub fn install_tray(tip string, m Menu) intinstalltray。失败时 throw。
tip stringm Menuint — 该类型的值
(&mut Window) set_menupub fn (w &mut Window) set_menu(m Menu)`&mut Window` 上的方法:设置 menu。
w &mut Windowm Menu(&mut App) new_traypub fn (a &mut App) new_tray(opts TrayOpts) Tray`&mut App` 上的方法:构造 tray。
a &mut Appopts TrayOptsTray — 该类型的值
(&mut Window) set_titlepub fn (w &mut Window) set_title(title string)`&mut Window` 上的方法:设置 title。
w &mut Windowtitle stringnative_set_titlepub fn native_set_title(title string) intnativesettitle。失败时 throw。
title stringint — 该类型的值
native_set_sizepub fn native_set_size(width int, height int) intnativeset尺寸。失败时 throw。
width intheight intint — 该类型的值
append_shell_cmdpub fn append_shell_cmd(line string) intappendshellcmd。失败时 throw。
line stringint — 该类型的值
append_content_cmdpub fn append_content_cmd(line string) intappendcontentcmd。失败时 throw。
line stringint — 该类型的值
append_wv_cmdpub fn append_wv_cmd(line string) intappendwvcmd。失败时 throw。
line stringint — 该类型的值
host_enabledpub fn host_enabled() bool主机enabled。
无
bool — 是否成立
host_tmppub fn host_tmp() string主机tmp。
无
string — 结果字符串
native_showpub fn native_show() intnativeshow。失败时 throw。
无
int — 该类型的值
native_hidepub fn native_hide() intnativehide。失败时 throw。
无
int — 该类型的值
native_minimizepub fn native_minimize() intnativeminimize。失败时 throw。
无
int — 该类型的值
native_set_positionpub fn native_set_position(x int, y int) intnativesetposition。失败时 throw。
x inty intint — 该类型的值
native_set_fullscreenpub fn native_set_fullscreen(on int) intnativesetfullscreen。失败时 throw。
on intint — 该类型的值
native_set_floatingpub fn native_set_floating(on int) intnativesetfloating。失败时 throw。
on intint — 该类型的值
native_centerpub fn native_center() intnativecenter。失败时 throw。
无
int — 该类型的值
native_open_externalpub fn native_open_external(url string) intnative打开external。失败时 throw。
url stringint — 该类型的值
native_clipboard_setpub fn native_clipboard_set(text string) intnativeclipboardset。失败时 throw。
text stringint — 该类型的值
native_clipboard_getpub fn native_clipboard_get() stringnativeclipboardget。
无
string — 结果字符串
native_set_maximizedpub fn native_set_maximized(on int) intnativesetmaximized。失败时 throw。
on intint — 该类型的值
native_bouncepub fn native_bounce() intnativebounce。失败时 throw。
无
int — 该类型的值
native_pick_filepub fn native_pick_file() stringnativepick文件。
无
string — 结果字符串
native_set_opacitypub fn native_set_opacity(percent int) intnativesetopacity。失败时 throw。
percent intint — 该类型的值
native_save_filepub fn native_save_file(suggested_name string) stringnativesave文件。
suggested_name stringstring — 结果字符串
native_screenshotpub fn native_screenshot() stringnativescreenshot。
无
string — 结果字符串
native_alertpub fn native_alert(title string, message string) intnativealert。
title stringmessage stringint — 该类型的值
native_confirmpub fn native_confirm(title string, message string) intnativeconfirm。
title stringmessage stringint — 该类型的值
native_notifypub fn native_notify(title string, body string) intnative通知。
title stringbody stringint — 该类型的值
native_pick_folderpub fn native_pick_folder() stringnativepickfolder。
无
string — 结果字符串
native_set_min_sizepub fn native_set_min_size(width int, height int) intnativeset最小尺寸。失败时 throw。
width intheight intint — 该类型的值
native_set_resizablepub fn native_set_resizable(on int) intnativesetresizable。失败时 throw。
on intint — 该类型的值
native_get_boundspub fn native_get_bounds() stringnativegetbounds。
无
string — 结果字符串
native_set_titlebar_visiblepub fn native_set_titlebar_visible(on int) intnativesettitlebarvisible。
on intint — 该类型的值
native_set_close_guardpub fn native_set_close_guard(on int) intnativeset关闭guard。
on intint — 该类型的值
native_accept_closepub fn native_accept_close() int关闭native接受。
无
int — 该类型的值
native_reject_closepub fn native_reject_close() int关闭nativereject。
无
int — 该类型的值
native_set_visible_on_all_spacespub fn native_set_visible_on_all_spaces(on int) intnativesetvisible于allspaces。
on intint — 该类型的值
native_get_statepub fn native_get_state() stringnativegetstate。
无
string — 结果字符串
native_open_pathpub fn native_open_path(path string) intnative打开path。
path stringint — 该类型的值
native_reveal_pathpub fn native_reveal_path(path string) intnativerevealpath。
path stringint — 该类型的值
native_set_appearancepub fn native_set_appearance(mode string) intnativesetappearance。
mode stringint — 该类型的值
native_set_dock_badgepub fn native_set_dock_badge(text string) intnativesetdockbadge。
text stringint — 该类型的值
native_screenshot_to_clipboardpub fn native_screenshot_to_clipboard() intnativescreenshot到clipboard。
无
int — 该类型的值
native_set_shadowpub fn native_set_shadow(on int) intnativesetshadow。
on intint — 该类型的值
native_set_framelesspub fn native_set_frameless(on int) intnativesetframeless。
on intint — 该类型的值
native_set_transparentpub fn native_set_transparent(on int) intnativesettransparent。
on intint — 该类型的值
native_set_window_maskpub fn native_set_window_mask(path string) intnativesetwindowmask。失败时 throw。
path stringint — 该类型的值
native_clear_window_maskpub fn native_clear_window_mask() intnativeclearwindowmask。
无
int — 该类型的值
native_quitpub fn native_quit() intnativequit。失败时 throw。
无
int — 该类型的值
unsupported_msgpub fn unsupported_msg() stringunsupportedmsg。
无
string — 结果字符串
(&mut App) remember_menupub fn (a &mut App) remember_menu(m Menu)`&mut App` 上的方法:remembermenu。
a &mut Appm Menu(&mut Window) set_content_slotpub fn (w &mut Window) set_content_slot(kind int, backend_id int)`&mut Window` 上的方法:设置 content slot。
w &mut Windowkind intbackend_id int(Window) content_slot_kindpub fn (w Window) content_slot_kind() int`Window` 上的方法:contentslotkind。
w Windowint — 该类型的值
(Window) content_slot_backend_idpub fn (w Window) content_slot_backend_id() int`Window` 上的方法:contentslotbackendid。
w Windowint — 该类型的值
(&mut Window) closepub fn (w &mut Window) close()`&mut Window` 上的方法:关闭资源。
w &mut Window(&mut App) quitpub fn (a &mut App) quit()在 `&mut App` 上调用 `quit`。
a &mut App(&mut App) push_eventpub fn (a &mut App) push_event(ev Event)`&mut App` 上的方法:压入event。
a &mut Appev Event(&mut App) poll_eventpub fn (a &mut App) poll_event() Event`&mut App` 上的方法:pollevent。
a &mut AppEvent — 该类型的值
(&mut App) postpub fn (a &mut App) post(token int)在 `&mut App` 上调用 `post`。
a &mut Apptoken int(&mut App) try_recv_postpub fn (a &mut App) try_recv_post() int`&mut App` 上的方法:tryrecvpost。
a &mut Appint — 该类型的值
content_plugin_webviewpub fn content_plugin_webview() ContentPlugincontentpluginwebview。
无
ContentPlugin — 该类型的值
content_plugin_drawpub fn content_plugin_draw() ContentPlugincontentplugindraw。
无
ContentPlugin — 该类型的值
use_draw_contentpub fn use_draw_content(w &mut Window) intusedrawcontent。
w &mut Windowint — 该类型的值
native_draw_set_bgpub fn native_draw_set_bg(hex string) intnativedrawsetbg。失败时 throw。
hex stringint — 该类型的值
native_draw_clearpub fn native_draw_clear() intnativedrawclear。失败时 throw。
无
int — 该类型的值
native_draw_set_labelpub fn native_draw_set_label(text string) intnativedrawsetlabel。失败时 throw。
text stringint — 该类型的值
register_content_pluginpub fn register_content_plugin(p ContentPlugin) intregistercontentplugin。
p ContentPluginint — 该类型的值
(&mut App) runpub fn (a &mut App) run() int`&mut App` 上的方法:运行。失败时 throw。
a &mut Appint — 该类型的值
load_assetpub fn load_asset(path string) string读asset。失败时 throw。
path stringstring — 结果字符串
push_host_eventpub fn push_host_event(ech chan Event, pl0 string)压入主机event。
ech chan Eventpl0 stringdrain_host_eventspub fn drain_host_events(ech chan Event)drain主机events。
ech chan Eventpoll_chanpub fn poll_chan(ech chan Event) Eventpollchan。
ech chan EventEvent — 该类型的值