Keyboard improvements (#240)
- Renamed various keyboard functions so it's easier to differentiate hardware versus software keyboard functionality - Created `Tactility/lvgl/Keyboard.h` as a proxy for the internal `Gui` service. - Implemented `tt_lvgl_keyboard.h` in `TactilityC`.
This commit is contained in:
committed by
GitHub
parent
13d7e84ef3
commit
85a6ad3bbe
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Show the on-screen keyboard.
|
||||
* @param[in] textarea the textarea to focus the input for
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_show(lv_obj_t* textarea);
|
||||
|
||||
/**
|
||||
* Hide the on-screen keyboard.
|
||||
* Has no effect when the keyboard is not visible.
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_hide();
|
||||
|
||||
/**
|
||||
* The on-screen keyboard is only shown when both of these conditions are true:
|
||||
* - there is no hardware keyboard
|
||||
* - TT_CONFIG_FORCE_ONSCREEN_KEYBOARD is set to true in tactility_config.h
|
||||
* @return if we should show a on-screen keyboard for text input inside our apps
|
||||
*/
|
||||
bool tt_lvgl_software_keyboard_is_enabled();
|
||||
|
||||
/**
|
||||
* Activate the keypad for a widget group.
|
||||
* @param group
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_activate(lv_group_t* group);
|
||||
|
||||
/**
|
||||
* Deactivate the keypad for the current widget group (if any).
|
||||
* You don't have to call this after calling _activate() because widget
|
||||
* cleanup automatically removes itself from the group it belongs to.
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_deactivate();
|
||||
|
||||
/**
|
||||
* @return true if LVGL is configured with a keypad
|
||||
*/
|
||||
bool tt_lvgl_hardware_keyboard_is_available();
|
||||
|
||||
/**
|
||||
* Set the keypad.
|
||||
* @param device the keypad device
|
||||
*/
|
||||
void tt_lvgl_hardware_keyboard_set_indev(lv_indev_t* device);
|
||||
|
||||
/**
|
||||
* Glue code for the on-screen keyboard and the hardware keyboard:
|
||||
* - Attach automatic hide/show parameters for the on-screen keyboard.
|
||||
* - Registers the textarea to the default lv_group_t for hardware keyboards.
|
||||
* @param[in] textarea
|
||||
*/
|
||||
void tt_lvgl_keyboard_add_textarea(lv_obj_t* textarea);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "tt_app_selectiondialog.h"
|
||||
#include "tt_bundle.h"
|
||||
#include "tt_hal_i2c.h"
|
||||
#include "tt_lvgl_keyboard.h"
|
||||
#include "tt_lvgl_spinner.h"
|
||||
#include "tt_lvgl_toolbar.h"
|
||||
#include "tt_message_queue.h"
|
||||
@@ -49,6 +50,14 @@ const struct esp_elfsym elf_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_master_has_device_at_address),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_lock),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_unlock),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_show),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_hide),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_is_enabled),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_activate),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_deactivate),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_hardware_keyboard_is_available),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_hardware_keyboard_set_indev),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_keyboard_add_textarea),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_create),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_create_for_app),
|
||||
ESP_ELFSYM_EXPORT(tt_message_queue_alloc),
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "Tactility/lvgl/Keyboard.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void tt_lvgl_software_keyboard_show(lv_obj_t* textarea) {
|
||||
tt::lvgl::software_keyboard_show(textarea);
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_hide() {
|
||||
tt::lvgl::software_keyboard_hide();
|
||||
}
|
||||
|
||||
bool tt_lvgl_software_keyboard_is_enabled() {
|
||||
return tt::lvgl::software_keyboard_is_enabled();
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_activate(lv_group_t* group) {
|
||||
tt::lvgl::software_keyboard_activate(group);
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_deactivate() {
|
||||
tt::lvgl::software_keyboard_deactivate();
|
||||
}
|
||||
|
||||
bool tt_lvgl_hardware_keyboard_is_available() {
|
||||
return tt::lvgl::hardware_keyboard_is_available();
|
||||
}
|
||||
|
||||
void tt_lvgl_hardware_keyboard_set_indev(lv_indev_t* device) {
|
||||
tt::lvgl::hardware_keyboard_set_indev(device);
|
||||
}
|
||||
|
||||
void tt_lvgl_keyboard_add_textarea(lv_obj_t* textarea) {
|
||||
tt::lvgl::keyboard_add_textarea(textarea);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user