feat: improve MTK input boxes, right-click context menus
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <gui/standalone.hpp>
|
||||
#include <gui/truetype.hpp>
|
||||
#include <gui/svg.hpp>
|
||||
#include <gui/mtk/widgets.hpp>
|
||||
|
||||
extern "C" {
|
||||
#include <string.h>
|
||||
@@ -239,6 +240,18 @@ inline bool wp_left_released(uint8_t buttons, uint8_t prev_buttons) {
|
||||
return !(buttons & 0x01) && (prev_buttons & 0x01);
|
||||
}
|
||||
|
||||
inline bool wp_right_pressed(uint8_t buttons, uint8_t prev_buttons) {
|
||||
return (buttons & 0x02) && !(prev_buttons & 0x02);
|
||||
}
|
||||
|
||||
enum WpContextItem : int {
|
||||
WP_CTX_CUT = 0,
|
||||
WP_CTX_COPY,
|
||||
WP_CTX_PASTE,
|
||||
WP_CTX_DELETE,
|
||||
WP_CTX_COUNT,
|
||||
};
|
||||
|
||||
struct WpScrollbar {
|
||||
Rect bounds;
|
||||
int content_height;
|
||||
@@ -370,6 +383,7 @@ struct WordProcessorState {
|
||||
bool line_spacing_dropdown_open;
|
||||
bool divider_flyout_open;
|
||||
bool special_char_flyout_open;
|
||||
mtk::ContextMenuState context_menu;
|
||||
bool page_view_mode;
|
||||
bool pending_page_view_toggle;
|
||||
|
||||
@@ -462,6 +476,9 @@ bool wp_redo(WordProcessorState* wp);
|
||||
|
||||
bool wp_print_document(WordProcessorState* wp, char* out_status, int out_status_len);
|
||||
bool wp_export_pdf_document(WordProcessorState* wp, const char* path, char* out_status, int out_status_len);
|
||||
bool wp_context_item_enabled(WordProcessorState* wp, int item);
|
||||
void wp_build_context_items(WordProcessorState* wp,
|
||||
mtk::ContextMenuItem items[WP_CTX_COUNT]);
|
||||
|
||||
void wp_render();
|
||||
void wp_handle_mouse(const Montauk::WinEvent& ev);
|
||||
|
||||
Reference in New Issue
Block a user