1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

implement textinput_cancel and refactor textinput event calls

This commit is contained in:
IntelOrca
2015-05-28 01:15:58 +01:00
parent 101fed0dd9
commit 6f1cd77f3c
6 changed files with 42 additions and 5 deletions

View File

@@ -112,7 +112,7 @@ void viewport_init_all()
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16) = -1;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, sint16) = 0;
RCT2_GLOBAL(0x009DEA50, sint16) = -1;
RCT2_CALLPROC_EBPSAFE(0x006EE3C3);
textinput_cancel();
format_string((char*)0x0141FA44, STR_CANCEL, NULL);
format_string((char*)0x0141F944, STR_OK, NULL);
}

View File

@@ -2141,3 +2141,34 @@ int window_can_resize(rct_window *w)
{
return (w->flags & WF_RESIZABLE) && (w->min_width != w->max_width || w->min_height != w->max_height);
}
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TEXT_INPUT], 0, 0, text != NULL, widgetIndex, (int)w, (int)text, 0);
}
/**
*
* rct2: 0x006EE3C3
*/
void textinput_cancel()
{
rct_window *w;
// Close the new text input window
window_close_by_class(WC_TEXTINPUT);
// The following code is only necessary for the old Windows text input dialog. In theory this isn't used anymore, but can
// still be triggered via original code paths.
RCT2_CALLPROC_EBPSAFE(0x0040701D);
if (RCT2_GLOBAL(0x009DEB8C, uint8) != 255) {
RCT2_CALLPROC_EBPSAFE(0x006EE4E2);
w = window_find_by_number(
RCT2_GLOBAL(RCT2_ADDRESS_TEXTINPUT_WINDOWCLASS, rct_windowclass),
RCT2_GLOBAL(RCT2_ADDRESS_TEXTINPUT_WINDOWNUMBER, rct_windownumber)
);
if (w != NULL) {
window_event_textinput_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TEXTINPUT_WIDGETINDEX, uint16), NULL);
}
}
}

View File

@@ -590,8 +590,10 @@ void window_event_resize_call(rct_window* w);
void window_event_mouse_down_call(rct_window* w, int widgetIndex);
void window_event_invalidate_call(rct_window* w);
void window_event_update_call(rct_window *w);
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text);
void sub_6EA73F();
void textinput_cancel();
void window_move_and_snap(rct_window *w, int newWindowX, int newWindowY, int snapProximity);
int window_can_resize(rct_window *w);