lvgl / lv_apps

Ready to use UIs and high level components for applications
MIT License
11 stars 12 forks source link

Make provision menu placement on RHS #3

Closed DeonMarais64 closed 5 years ago

DeonMarais64 commented 5 years ago

Hi, I have changed the settings module to allow for menu placement on the right hand side os the screen. The default behaviour will not change, but If the settings button is placed on the right hand side of the screen then menu is also placed there. In this case the animations occur from outside right inward on page creation, and vice versa on deletion.

Also, is there a case for being able to set the settings container width ?, instead of

#define LV_SETTINGS_MAX_WIDTH 250

static void create_page(lv_settings_item_t * parent_item, lv_event_cb_t event_cb)
{
    lv_coord_t w = LV_MATH_MIN(lv_obj_get_width(lv_scr_act()), LV_SETTINGS_MAX_WIDTH);
    ....
}

You have,

#define LV_SETTINGS_MAX_WIDTH 250
lv_coord_t settings_max_width = LV_SETTINGS_MAX_WIDTH;

/**
 * Change the maximum width of settings dialog object
 * @param settings pointer to settings object
 * @param max_width maximum width of the settings container page
 */
void lv_settings_set_max_width(lv_obj_t * settings, lv_coord_t max_width)
{
    settings_max_width = max_width;
}

static void create_page(lv_settings_item_t * parent_item, lv_event_cb_t event_cb)
{
    lv_coord_t w = LV_MATH_MIN(lv_obj_get_width(lv_scr_act()), settings_max_width);
    ....
}

settings

kisvegabor commented 5 years ago

Good idea, thank you!

lv_settings_set_max_width can be also useful. Could you add it too?

DeonMarais64 commented 5 years ago

Done, is that ok ?

kisvegabor commented 5 years ago

Merged, thank you for this update!