ui: increase keyboard buttons font size
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details

simply make the keyboard buttons text larger.
makes it easier to type.
master v0.8.1
alex 8 months ago
parent e55471e48c
commit 285cff1d51
Signed by: x1ddos
GPG Key ID: FDEFB4A63CBD8460

@ -102,6 +102,11 @@ extern lv_style_t *nm_style_title()
return &style_title; return &style_title;
} }
extern const lv_font_t *nm_font_large()
{
return font_large;
}
/** /**
* a hack to prevent tabview from switching to the next tab * a hack to prevent tabview from switching to the next tab
* on a scroll event, for example coming from a top layer window. * on a scroll event, for example coming from a top layer window.
@ -361,6 +366,7 @@ extern int nm_ui_init_main_tabview(lv_obj_t *scr)
if (virt_keyboard == NULL) { if (virt_keyboard == NULL) {
return -1; return -1;
} }
lv_obj_set_style_text_font(virt_keyboard, font_large, LV_PART_ITEMS);
lv_obj_set_style_max_height(virt_keyboard, NM_DISP_HOR * 2 / 3, 0); lv_obj_set_style_max_height(virt_keyboard, NM_DISP_HOR * 2 / 3, 0);
lv_obj_add_flag(virt_keyboard, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(virt_keyboard, LV_OBJ_FLAG_HIDDEN);

@ -213,6 +213,9 @@ pub const LvStyle = opaque {
}; };
}; };
/// represents lv_font_t in C.
pub const LvFont = opaque {};
/// a simplified color type compatible with LVGL which defines lv_color_t /// a simplified color type compatible with LVGL which defines lv_color_t
/// as a union containing an bit-fields struct unsupported in zig cImport. /// as a union containing an bit-fields struct unsupported in zig cImport.
pub const Color = u16; // originally c.lv_color_t; TODO: comptime switch for u32 pub const Color = u16; // originally c.lv_color_t; TODO: comptime switch for u32
@ -981,6 +984,8 @@ pub const Keyboard = struct {
pub fn new(parent: anytype, mode: Mode) !Keyboard { pub fn new(parent: anytype, mode: Mode) !Keyboard {
const kb = lv_keyboard_create(parent.lvobj) orelse return error.OutOfMemory; const kb = lv_keyboard_create(parent.lvobj) orelse return error.OutOfMemory;
lv_keyboard_set_mode(kb, @intFromEnum(mode)); lv_keyboard_set_mode(kb, @intFromEnum(mode));
const sel = LvStyle.Selector{ .part = .item };
lv_obj_set_style_text_font(kb, nm_font_large(), sel.value());
return .{ .lvobj = kb }; return .{ .lvobj = kb };
} }
@ -1126,6 +1131,8 @@ pub const PosAlign = enum(c.lv_align_t) {
pub extern fn nm_style_btn_red() *LvStyle; // TODO: make it private pub extern fn nm_style_btn_red() *LvStyle; // TODO: make it private
/// returns a title style with a larger font. /// returns a title style with a larger font.
pub extern fn nm_style_title() *LvStyle; // TODO: make it private pub extern fn nm_style_title() *LvStyle; // TODO: make it private
/// returns default font of large size.
pub extern fn nm_font_large() *const LvFont; // TODO: make it private
// the "native" lv_obj_set/get user_data are static inline, so make our own funcs. // the "native" lv_obj_set/get user_data are static inline, so make our own funcs.
extern "c" fn nm_obj_userdata(obj: *LvObj) ?*anyopaque; extern "c" fn nm_obj_userdata(obj: *LvObj) ?*anyopaque;
@ -1198,6 +1205,7 @@ extern fn lv_obj_remove_style(obj: *LvObj, style: ?*LvStyle, sel: c.lv_style_sel
extern fn lv_obj_remove_style_all(obj: *LvObj) void; extern fn lv_obj_remove_style_all(obj: *LvObj) void;
extern fn lv_obj_set_style_bg_color(obj: *LvObj, val: Color, sel: c.lv_style_selector_t) void; extern fn lv_obj_set_style_bg_color(obj: *LvObj, val: Color, sel: c.lv_style_selector_t) void;
extern fn lv_obj_set_style_text_color(obj: *LvObj, val: Color, sel: c.lv_style_selector_t) void; extern fn lv_obj_set_style_text_color(obj: *LvObj, val: Color, sel: c.lv_style_selector_t) void;
extern fn lv_obj_set_style_text_font(obj: *LvObj, font: *const LvFont, sel: c.lv_style_selector_t) void;
extern fn lv_obj_set_style_pad_left(obj: *LvObj, val: c.lv_coord_t, sel: c.lv_style_selector_t) void; extern fn lv_obj_set_style_pad_left(obj: *LvObj, val: c.lv_coord_t, sel: c.lv_style_selector_t) void;
extern fn lv_obj_set_style_pad_right(obj: *LvObj, val: c.lv_coord_t, sel: c.lv_style_selector_t) void; extern fn lv_obj_set_style_pad_right(obj: *LvObj, val: c.lv_coord_t, sel: c.lv_style_selector_t) void;
extern fn lv_obj_set_style_pad_top(obj: *LvObj, val: c.lv_coord_t, sel: c.lv_style_selector_t) void; extern fn lv_obj_set_style_pad_top(obj: *LvObj, val: c.lv_coord_t, sel: c.lv_style_selector_t) void;