feat: improve MTK input boxes, right-click context menus
This commit is contained in:
@@ -35,6 +35,21 @@ static void wp_draw_ui_icon_button(Canvas& c, int x, int y, int w, int h,
|
||||
wp_draw_ui_button(c, x, y, w, h, fallback, bg, fg, radius);
|
||||
}
|
||||
|
||||
static void wp_draw_context_menu(Canvas& c, WordProcessorState* wp) {
|
||||
if (!wp || !wp->context_menu.open) return;
|
||||
|
||||
mtk::Theme theme = mtk::make_theme(colors::ACCENT);
|
||||
theme.border = colors::BORDER;
|
||||
theme.text = colors::TEXT_COLOR;
|
||||
|
||||
mtk::ContextMenuItem items[WP_CTX_COUNT];
|
||||
wp_build_context_items(wp, items);
|
||||
mtk::draw_context_menu(c, wp->context_menu, items, WP_CTX_COUNT, theme,
|
||||
mtk::CONTEXT_MENU_DEFAULT_W,
|
||||
mtk::CONTEXT_MENU_ITEM_H,
|
||||
g_ui_font, fonts::UI_SIZE);
|
||||
}
|
||||
|
||||
static int wp_special_char_flyout_x() {
|
||||
int dx = WP_BTN_SECTION_X + 24 - WP_SPECIAL_CHAR_FLYOUT_W;
|
||||
if (dx + WP_SPECIAL_CHAR_FLYOUT_W > g_win_w) dx = g_win_w - WP_SPECIAL_CHAR_FLYOUT_W;
|
||||
@@ -666,4 +681,6 @@ void wp_render() {
|
||||
WP_SPECIAL_CHAR_OPTIONS[i].label, colors::TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
wp_draw_context_menu(c, wp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user