diff --git a/README.md b/README.md index 5d5fc62..8f03677 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,63 @@ Then run the `demo` example: ```shell $ DEP_LV_CONFIG_PATH=`pwd`/examples/include cargo run --example demo ``` + +## Feature Support + +The bindings are still in development. There are many features of LVGL that needs to be exposed by `lvgl-rs`. In +this section you can check what is implemented at the moment. + +### Features + +List of LVGL features that impacts the library usage in general. +- [x] Displays: We use [`embedded_graphics`](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/) library to + draw to the display. You can use `lvgl-rs` with any of the + [`embedded_graphics` supported displays](https://docs.rs/embedded-graphics/0.6.2/embedded_graphics/#supported-displays). +- [x] Events: You can listen and trigger events in widget objects. +- [x] Styles: Partially supported. You can set styles in any exposed object. We are still missing the + possibility of defining base styles. +- [ ] Input Devices +- [ ] Fonts +- [ ] Images +- [ ] File system +- [ ] Animations +- [ ] Tasks + +### Widgets + +- [x] Base object (lv_obj) +- [ ] Arc (lv_arc) +- [x] Bar (lv_bar) +- [x] Button (lv_btn) +- [ ] Button matrix (lv_btnm) +- [ ] Calendar (lv_calendar) +- [ ] Canvas (lv_canvas) +- [ ] Checkbox (lv_cb) +- [ ] Chart (lv_chart) +- [ ] Container (lv_cont) +- [ ] Color picker (lv_cpicker) +- [ ] Drop-down list (lv_ddlist) +- [ ] Gauge (lv_gauge) +- [ ] Image (lv_img) +- [ ] Image button (lv_imgbtn) +- [ ] Keyboard (lv_kb) +- [x] Label (lv_label) +- [ ] LED (lv_led) +- [ ] Line (lv_line) +- [ ] List (lv_list) +- [ ] Line meter (lv_lmeter) +- [ ] Message box (lv_mbox) +- [ ] Page (lv_page) +- [ ] Preloader (lv_preload) +- [ ] Roller (lv_roller) +- [ ] Slider (lv_slider) +- [ ] Spinbox (lv_spinbox) +- [ ] Switch (lv_sw) +- [ ] Table (lv_table) +- [ ] Tabview (lv_tabview) +- [ ] Text area (lv_ta) +- [ ] Tile view (lv_tileview) +- [ ] Window (lv_win) + +Widgets currently implemented might have some missing features. If the widget you want to use is not exposed or +is missing a feature you want to make use, please send a Pull Request or open an issue. diff --git a/lvgl/src/support.rs b/lvgl/src/support.rs index 125539f..55eaef0 100644 --- a/lvgl/src/support.rs +++ b/lvgl/src/support.rs @@ -14,16 +14,16 @@ pub trait NativeObject { fn raw(&self) -> ptr::NonNull; } -/// Stores the native LittlevGL raw pointer. +/// Generic LVGL object. /// -/// This is the parent object of all widget objects in `lvgl-rs`. +/// This is the parent object of all widget types. It stores the native LVGL raw pointer. /// /// # Panics /// -/// Panics if LittlevGL internally deallocated the original object. +/// Panics if LVGL internally freed the original object. pub struct ObjectX { // We use a raw pointer here because we do not control this memory address, it is controlled - // by LittlevGL's C code. + // by LVGL's global state. raw: *mut lvgl_sys::lv_obj_t, } @@ -125,6 +125,14 @@ impl Object for ObjectX { } } +impl Default for ObjectX { + fn default() -> Self { + Self { + raw: unsafe { lvgl_sys::lv_obj_create(ptr::null_mut(), ptr::null_mut()) }, + } + } +} + macro_rules! define_object { ($item:ident) => { pub struct $item {