Giter Site home page Giter Site logo

lv_style_compat's Introduction

lv_style_compat

lv_style_compat is a simple external module for LittlevGL 7, designed to help users of 6.x migrate to the new style system.

Note that:

  • There may be certain style combinations which don't work like they did in 6.x.
  • Using lv_style_compat will hinder your ability to make use of the new style optimizations that LittlevGL 7 has. What this means in practical terms is that using a "legacy" style with this module will likely consume more memory than rewriting the code in question to use v7 styles.

Example

lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);

static lv_style_t style;
lv_style_init(&style);

static lv_legacy_style_t v6_style;

lv_legacy_style_init();
lv_legacy_style_convert(&style, LV_STATE_DEFAULT, &v6_style);
lv_legacy_style_convert(&style, LV_STATE_DEFAULT, &lv_style_btn_rel);
lv_legacy_style_convert(&style, LV_STATE_PRESSED, &lv_style_btn_pr);
lv_legacy_style_convert(&style, LV_STATE_CHECKED, &lv_style_btn_tgl_rel);
lv_legacy_style_convert(&style, LV_STATE_CHECKED | LV_STATE_PRESSED, &lv_style_btn_tgl_pr);

lv_obj_add_style(btn, LV_BTN_PART_MAIN, &style);
lv_btn_set_checkable(btn, true);

lv_obj_t * label = lv_label_create(btn, NULL);
lv_label_set_text(label, "Button");

lv_obj_align(btn, NULL, LV_ALIGN_CENTER, 0, 0);

API description

Because LittlevGL 7 has reused the type name lv_style_t for the new style system, the classic styles now use the type name lv_legacy_style_t.

The APIs have also been updated to match. For example, lv_legacy_style_copy can be used to copy one legacy style to another.

lv_legacy_style_convert can be used to convert a legacy style into a new one.

Bug reporting

Please open an issue on this repository if a legacy style doesn't convert the way you expected.

lv_style_compat's People

Contributors

embeddedt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.