diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp index d130747..9f91ad5 100644 --- a/addons/godot_xterm/native/src/terminal.cpp +++ b/addons/godot_xterm/native/src/terminal.cpp @@ -30,12 +30,7 @@ void Terminal::_bind_methods() 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); - ClassDB::add_property("Terminal", PropertyInfo(Variant::INT, "cols"), "set_cols", "get_cols"); - ClassDB::bind_method(D_METHOD("get_rows"), &Terminal::get_rows); - ClassDB::bind_method(D_METHOD("set_rows", "rows"), &Terminal::set_rows); - ClassDB::add_property("Terminal", PropertyInfo(Variant::INT, "rows"), "set_rows", "get_rows"); ClassDB::bind_method(D_METHOD("get_max_scrollback"), &Terminal::get_max_scrollback); ClassDB::bind_method(D_METHOD("set_max_scrollback", "max_scrollback"), &Terminal::set_max_scrollback); @@ -119,21 +114,11 @@ Terminal::~Terminal() cleanup_rendering(); } -void Terminal::set_cols(const int p_cols) -{ - cols = p_cols; -} - int Terminal::get_cols() const { return cols; } -void Terminal::set_rows(const int p_rows) -{ - rows = p_rows; -} - int Terminal::get_rows() const { return rows; @@ -369,8 +354,23 @@ bool Terminal::_set(const StringName &property, const Variant &value) return false; } +bool Terminal::_get(const StringName &p_name, Variant &r_value) { + if (p_name == String("cols")) { + r_value = cols; + return true; + } + if (p_name == String("rows")) { + r_value = rows; + return true; + } + return false; +} + void Terminal::_get_property_list(List *p_list) const { + p_list->push_back(PropertyInfo(Variant::INT, "cols", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY)); + p_list->push_back(PropertyInfo(Variant::INT, "rows", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_READ_ONLY)); + p_list->push_back(PropertyInfo(Variant::NIL, "Theme Overrides", PROPERTY_HINT_NONE, "theme_override_", PROPERTY_USAGE_GROUP)); p_list->push_back(PropertyInfo(Variant::NIL, "Colors", PROPERTY_HINT_NONE, "theme_override_colors/", PROPERTY_USAGE_SUBGROUP)); for (int i = 0; i < TSM_COLOR_NUM; ++i) diff --git a/addons/godot_xterm/native/src/terminal.h b/addons/godot_xterm/native/src/terminal.h index 1ba7f28..b875c2a 100644 --- a/addons/godot_xterm/native/src/terminal.h +++ b/addons/godot_xterm/native/src/terminal.h @@ -50,10 +50,7 @@ namespace godot Terminal(); ~Terminal(); - void set_cols(const int p_cols); int get_cols() const; - - void set_rows(const int p_rows); int get_rows() const; Vector2i get_cursor_pos() const; @@ -150,6 +147,7 @@ namespace godot void cleanup_rendering(); bool _set(const StringName &p_name, const Variant &p_value); + bool _get(const StringName &p_name, Variant &r_value); void _get_property_list(List *p_list) const; bool _is_valid_color_name(const String &p_name); bool _is_valid_font_type(const String &p_name);