mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-21 17:20:25 +01:00
feat(term): add "size_changed" signal
Will be emitted when the number of cols or rows changes.
This commit is contained in:
parent
ee920a45fd
commit
1da42501af
1 changed files with 4 additions and 0 deletions
|
@ -27,6 +27,7 @@ void Terminal::_bind_methods()
|
|||
{
|
||||
ADD_SIGNAL(MethodInfo("data_sent", PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data")));
|
||||
ADD_SIGNAL(MethodInfo("key_pressed", PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data"), PropertyInfo(Variant::OBJECT, "event")));
|
||||
ADD_SIGNAL(MethodInfo("size_changed", PropertyInfo(Variant::VECTOR2I, "new_size")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_cols"), &Terminal::get_cols);
|
||||
ClassDB::bind_method(D_METHOD("set_cols", "cols"), &Terminal::set_cols);
|
||||
|
@ -444,6 +445,9 @@ void Terminal::update_sizes(bool force)
|
|||
update_shader_parameters(back_material);
|
||||
update_shader_parameters(fore_material);
|
||||
|
||||
if (prev_cols != cols || prev_rows != rows)
|
||||
emit_signal("size_changed", Vector2i(cols, rows));
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue