pub struct WindowDesc {
pub id: &'static str,
pub title: &'static str,
pub icon: &'static str,
pub order: i32,
pub size: [f32; 2],
pub min_size: [f32; 2],
pub maximized: bool,
pub always: bool,
}Expand description
一个模块窗的自描述(纯数据,零 egui)。
字段与 ek-ui::mount::ModDesc 一一对应;界面层拿到本类型后直接映射,
不做二次推断(避免“两处各有一套默认值“的老病)。
ⓘ
fn window(&self) -> Option<WindowDesc> {
Some(WindowDesc {
id: "strategy",
title: "策略交易",
icon: "🎯",
order: 50,
size: [1180.0, 620.0],
min_size: [820.0, 420.0],
maximized: false,
always: false,
})
}Fields§
§id: &'static str模块名(必须等于 Plugin::kind)。
界面层用它做去重键:同一 kind 出现多份描述时以静态表为准
(静态表是“复核过的老模块“,自报是“新插件“),并记一次诊断。
title: &'static str菜单项标题。
icon: &'static str菜单项图标(单个 emoji 或短字形;空串 = 无图标)。
order: i32菜单排序位(小的在前;与静态表共用同一坐标系)。
size: [f32; 2]首次打开的建议尺寸(像素)。
min_size: [f32; 2]最小尺寸(像素)。
maximized: bool打开即最大化。
always: bool未装配也常驻菜单。
true 只适用于“没有实例也能配置/仍有意义“的模块(全局面、连接档案等);
依赖实例内容才有意义的模块必须给 false —— 因为 Self::always 为真时,
界面层要在没有任何插件实例的场合建窗,那时没有对象可供自报描述,
只能靠静态兜底表。两者是互斥的,别同时指望。
Implementations§
Trait Implementations§
Source§impl Clone for WindowDesc
impl Clone for WindowDesc
impl Copy for WindowDesc
Source§impl Debug for WindowDesc
impl Debug for WindowDesc
Source§impl PartialEq for WindowDesc
impl PartialEq for WindowDesc
impl StructuralPartialEq for WindowDesc
Auto Trait Implementations§
impl Freeze for WindowDesc
impl RefUnwindSafe for WindowDesc
impl Send for WindowDesc
impl Sync for WindowDesc
impl Unpin for WindowDesc
impl UnsafeUnpin for WindowDesc
impl UnwindSafe for WindowDesc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more