当前位置:网站首页>Rush's fluid usage (fltk UI Designer)
Rush's fluid usage (fltk UI Designer)
2022-07-21 07:05:00 【Good at learning】
fl2rust
usage
$ cargo install fl2rust
And then run :
$ fl2rust <fl file>.fl > <output file>.rs
To pass the cargo Automation , We can do this by fl2rust Add to build dependencies to use as libraries :
# Cargo.toml
[dependencies]
fltk = "1"
[build-dependencies]
fl2rust = "0.4"
// build.rs
fn main() {
use std::path::PathBuf;
use std::env;
println!("cargo:rerun-if-changed=src/myuifile.fl");
let g = fl2rust::Generator::default();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
g.in_out("src/myuifile.fl", out_path.join("myuifile.rs").to_str().unwrap()).expect("Failed to generate rust from fl file!");
}
# src/myuifile.fl -> generated via fluid
# data file for the Fltk User Interface Designer (fluid)
version 1.0400
header_name {.h}
code_name {.cxx}
class UserInterface {open
} {
Function {make_window()} {open
} {
Fl_Window {} {open selected
xywh {138 161 440 355} type Double visible
} {
Fl_Button but {
label {Click me}
xywh {175 230 95 45}
}
}
}
}
// src/myuifile.rs
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_imports)]
#![allow(clippy::needless_update)]
include!(concat!(env!("OUT_DIR"), "/myuifile.rs"));
// src/main.rs
use fltk::{prelude::*, *};
mod myuifile;
fn main() {
let app = app::App::default();
let mut ui = myuifile::UserInterface::make_window();
ui.but.set_callback(move |_| {
println!("Works!");
});
app.run().unwrap();
}
obtain FLUID In several ways :
cargo install fltk-fluid
- Through the package manager .
- By using cmake Build yourself fltk library .
- Fluid In the build fltk-rs Time to build , It will be located at OUT_DIR in .
i18n Support
tr!
0.4.4 Version passed tr crate Macros in add i18n Support . To enable it :
- stay
fluid
in ,Edit->Project Settings...->Internationalization.. - Change the drop-down menu to use GNU gettext(tr crate Support gettext-rs and gettext Two forms ).
- take tr Add to Cargo.toml Dependencies in .
- Add to our main.rs file :
#[macro_use]
extern crate tr;
- according to tr crate Initialization as described in the documentation of tr.
Known limitations
- Adding arbitrary code or declaring global... Is not supported / Member variables .
- Only construction methods are supported .
- fl2rust The generated Rust The correctness of the code .
course
- take FLUID(RAD Tools ) And Rust Use it together
边栏推荐
- ARM 如果通过笔记本机上外网?
- 《网络安全测试实验室搭建指南》—第1章1.5节关键术语
- Huawei computer test: Student matrix
- opencv 基本操作
- DeiT:注意力也能蒸馏
- Global location number Gln application introduction
- 全球位置编号GLN申请攻略
- Wallys/DR882/QCA9882/ AC/AN MiniPCIE/2×2.4GHz 2x5GHz MT7915 MT7975
- What can testers do when there is an online bug?
- [shutter -- basic component] use of AppBar
猜你喜欢
14 mental models in the encryption Market
【Flutter -- 基础组件】图片组件 Image & Icon
深入理解Mysql事务隔离级别与锁机制
6-10漏洞利用-Smtp实验环境搭建
京准电钟北斗时钟服务器,GPS网络时间服务器,NTP卫星授时系统
【Flutter -- 基础组件】文本组件 Text & TextStyle & TextSpan
Tensorflow network model migration based on tensorflow gpu2ascend tool
解析「Web3悖论」的内在机理与突破路径
阿里云负载均衡实验 2022年7月11日
国内外知名源码商城系统盘点
随机推荐
Eolink ——通过文档驱动,快速开发接口
CV (2)- image classification
Pyspark:DataFrame的转化操作及行动操作
AWD思路
历史上的今天:Kotlin 语言首次被公开;IMAP 协议之父出生;CT 成像实现新突破...
(note) CIE chromaticity diagram
常用的函数式接口_Predicate接口_默认方法and和Predicate接口练习_集合接口筛选
Wallys/3×3/2×2 MIMO/ 802.11ac/ Mini PCIe /2,4GHz / 5GHz QCA 9880
Alibaba cloud load balancing experiment July 11, 2022
NC | chenghuan Institute zhuyongguan team - potential of marine plastic circles in the process of nitrogen geochemical cycle
霸榜MS MARCO!基于Transformer的混合列表感知排序模型
Deit: attention can also be distilled
【Flutter -- 基础组件】图片组件 Image & Icon
EasyGBS切换分辨率出现花屏和播放失败的原因分析及解决方法
NAT 的几种应用场景
【LeetCode】2. 两数相加 - Go 语言题解
ARM 如果通过笔记本机上外网?
动态内存管理(malloc,free,calloc,realloc,柔性数组)
【技术干货】工业触摸屏之驱动开发及异常分析(连载)
Jackson 动态过滤属性,编程式过滤对象中的属性