mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Test pagenav gestures
This commit is contained in:
parent
9aa880c761
commit
79294a2e85
@ -305,6 +305,24 @@ void wakeup_event_handler(lv_obj_t* obj, lv_event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
void page_event_handler(lv_obj_t* obj, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_GESTURE) {
|
||||
lv_gesture_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act());
|
||||
switch(dir) {
|
||||
case LV_GESTURE_DIR_LEFT:
|
||||
haspPages.next(LV_SCR_LOAD_ANIM_NONE);
|
||||
break;
|
||||
case LV_GESTURE_DIR_RIGHT:
|
||||
haspPages.prev(LV_SCR_LOAD_ANIM_NONE);
|
||||
break;
|
||||
case LV_GESTURE_DIR_BOTTOM:
|
||||
haspPages.back(LV_SCR_LOAD_ANIM_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button-style object is clicked
|
||||
* @param obj pointer to a button object
|
||||
|
@ -78,10 +78,11 @@ void hasp_process_attribute(uint8_t pageid, uint8_t objid, const char* attr, con
|
||||
|
||||
void object_set_normalized_group_value(uint8_t groupid, lv_obj_t* src_obj, int16_t val, int16_t min, int16_t max);
|
||||
|
||||
void wakeup_event_handler(lv_obj_t* obj, lv_event_t event);
|
||||
void page_event_handler(lv_obj_t* obj, lv_event_t event);
|
||||
void generic_event_handler(lv_obj_t* obj, lv_event_t event);
|
||||
void toggle_event_handler(lv_obj_t* obj, lv_event_t event);
|
||||
void slider_event_handler(lv_obj_t* obj, lv_event_t event);
|
||||
void wakeup_event_handler(lv_obj_t* obj, lv_event_t event);
|
||||
|
||||
#define HASP_OBJ_BAR 1971
|
||||
#define HASP_OBJ_BTN 3164
|
||||
|
@ -22,6 +22,7 @@ void Page::init(uint8_t start_page)
|
||||
{
|
||||
for(int i = 0; i < count(); i++) {
|
||||
_pages[i] = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_event_cb(_pages[i], page_event_handler);
|
||||
|
||||
uint16_t thispage = i + PAGE_START_INDEX;
|
||||
_meta_data[i].prev = thispage == PAGE_START_INDEX ? HASP_NUM_PAGES : thispage - PAGE_START_INDEX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user