2023-07-12 16:28:32 +02:00
|
|
|
/// @description
|
2023-11-22 15:25:36 +01:00
|
|
|
active = textbox != noone && array_length(data);
|
2023-07-12 16:28:32 +02:00
|
|
|
if(textbox == noone) exit;
|
2023-07-31 20:06:44 +02:00
|
|
|
if(textbox != WIDGET_CURRENT) exit;
|
2023-11-17 12:33:25 +01:00
|
|
|
if(array_empty(data)) exit;
|
2023-07-12 16:28:32 +02:00
|
|
|
|
|
|
|
#region
|
|
|
|
dialog_x = clamp(dialog_x, 0, WIN_W - dialog_w - 1);
|
|
|
|
dialog_y = clamp(dialog_y, 0, WIN_H - dialog_h - 1);
|
|
|
|
|
|
|
|
var _w = 300;
|
|
|
|
var _h = array_length(data) * line_get_height(f_p0, 8);
|
|
|
|
|
2023-07-25 20:12:40 +02:00
|
|
|
for( var i = 0, n = array_length(data); i < n; i++ ) {
|
2023-07-12 16:28:32 +02:00
|
|
|
var _dat = data[i];
|
|
|
|
var __w = ui(40 + 32);
|
|
|
|
|
|
|
|
draw_set_font(f_p2);
|
|
|
|
__w += string_width(_dat[2]);
|
|
|
|
|
|
|
|
draw_set_font(f_p0);
|
|
|
|
__w += string_width(_dat[1]);
|
|
|
|
|
|
|
|
_w = max(_w, __w);
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog_w = _w;
|
|
|
|
dialog_h = min(_h, 160);
|
|
|
|
|
|
|
|
sc_content.resize(dialog_w, dialog_h);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region draw
|
|
|
|
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dialog_y, dialog_w, dialog_h);
|
2023-09-29 02:13:17 +02:00
|
|
|
sc_content.setFocusHover(sFOCUS, sHOVER);
|
2023-07-12 16:28:32 +02:00
|
|
|
sc_content.draw(dialog_x, dialog_y);
|
|
|
|
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
if(keyboard_check_pressed(vk_escape))
|
2023-11-08 08:38:04 +01:00
|
|
|
textbox = noone;
|