.ract
FrameworkType
"gen_ui"
"makepad"
1#[derive(Debug, Clone, Copy, Default)]
2pub enum FrameworkType {
3 #[default]
4 GenUI,
5 Makepad,
6}
Member
{
source = "需要编译的源项目",
target = "编译后的项目"
}
1#[derive(Debug, Clone)]
2pub struct Member {
3 pub source: PathBuf,
4 pub target: PathBuf,
5}
gen_ui.toml
1#[derive(Debug)]
2pub struct CompilerConf {
3 pub target: Underlayer,
4 pub logo: bool,
5 pub log_level: LogLevel,
6 pub excludes: Excludes,
7}
"makepad"
1#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
2pub enum Underlayer {
3 #[default]
4 Makepad,
5}
"info"
"debug"
"error"
"warn"
"trace"
"off"
1#[derive(Debug, Clone, Copy, Default)]
2pub enum LogLevel {
3 #[default]
4 Info,
5 Debug,
6 Error,
7 Warn,
8 Trace,
9 Off,
10}
1/// # Gen Excludes
2/// These files and directories are excludesd by the compiler(watcher)
3/// Which need to write in `gen_ui.toml` file
4/// ## Example
5/// ```toml
6/// [compiler]
7/// excludes: ["Cargo.toml", "Cargo.lock", "src/main.rs", "target", ".gen_ui_cache"]
8/// ```
9/// ## Default Excludes
10/// ["Cargo.toml", "Cargo.lock", "target", ".gen_ui_cache", "gen_ui.toml", ".plugins"]
11#[derive(Debug, Clone)]
12pub struct Excludes(pub Vec<PathBuf>);
1#[derive(Debug, Clone)]
2pub struct Config {
3 /// entry file name, default is app
4 pub entry: Option<String>,
5 /// root path of the project
6 pub root: RootConf,
7 /// rust dependencies in Cargo.toml
8 /// it depends on the target
9 /// - makepad: makepad-widgets
10 /// > **you can add more other dependencies which you need**
11 pub dependencies: Option<Vec<RustDependence>>,
12 /// use wasm to run ?
13 /// makepad wasm
14 pub wasm: Option<WasmConf>,
15}
1#[derive(Debug, Clone)]
2pub struct RootConf {
3 // pub name: String,
4 pub path: PathBuf,
5 pub window: Prop<WindowProps>,
6}
也许对于您来说源码过于复杂,您可以直接看如下配置示例,这是最常用的配置:
{
os_type = "mac",
show_title = true,
window_size = {
inner_size = {x = 1080.0, y = 720.0}
}
}
我们隐藏了一些您不该配置的属性
1#[derive(Debug, Clone)]
2pub enum Props {
3 OsType(GOsType),
4 DerefWidget(ViewProps),
5 ShowTitle(bool),
6 ShowIcon(bool),
7 HideCaptionOnFullscreen(bool),
8 WindowSize(WindowSize),
9}
10
11#[derive(Debug, Clone)]
12pub struct WindowSize {
13 pub inner_size: DVec2,
14}
15
16#[derive(Clone, Copy, PartialEq, Debug, Default)]
17pub enum GOsType {
18 Windows,
19 Mac,
20 #[default]
21 Linux,
22 Other,
23}
24
25#[derive(Debug, Clone)]
26pub struct DVec2 {
27 pub x: f64,
28 pub y: f64,
29}
30
31#[derive(Debug, Clone)]
32pub enum Props {
33 Theme(Themes),
34 BackgroundColor(MakepadColor),
35 HoverColor(MakepadColor),
36 FocusColor(MakepadColor),
37 BorderColor(MakepadColor),
38 BorderWidth(F32),
39 BorderRadius(F32),
40 Visible(bool),
41 BackgroundVisible(bool),
42 ShadowColor(MakepadColor),
43 SpreadRadius(F32),
44 BlurRadius(F32),
45 ShadowOffset(Vec2),
46 Cursor(MouseCursor),
47 AnimationKey(bool),
48 GrabKeyFocus(bool),
49 BlockSignalEvent(bool),
50 Walk(Walk),
51 Layout(Layout),
52 EventOrder(EventOrder),
53 DpiFactor(F64),
54 Optimize(ViewOptimize),
55 CaptureOverload(bool),
56 EventKey(bool),
57 BlockChildEvents(bool),
58}