diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 14:29:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:54:55 +0200 |
commit | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (patch) | |
tree | 43cdc7cfe8239c23065616a931de3769d2db1e86 /scene/gui/item_list.cpp | |
parent | 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (diff) | |
download | redot-engine-07bc4e2f96f8f47991339654ff4ab16acc19d44f.tar.gz |
Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
-o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
-o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```
This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.
This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.
Part of #33027.
Diffstat (limited to 'scene/gui/item_list.cpp')
-rw-r--r-- | scene/gui/item_list.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 86daa47c36..06a4534e22 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -190,6 +190,7 @@ void ItemList::set_item_tag_icon(int p_idx, const Ref<Texture2D> &p_tag_icon) { update(); shape_changed = true; } + Ref<Texture2D> ItemList::get_item_tag_icon(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), Ref<Texture2D>()); @@ -231,6 +232,7 @@ Variant ItemList::get_item_metadata(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, items.size(), Variant()); return items[p_idx].metadata; } + void ItemList::select(int p_idx, bool p_single) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -252,6 +254,7 @@ void ItemList::select(int p_idx, bool p_single) { } update(); } + void ItemList::unselect(int p_idx) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -315,6 +318,7 @@ void ItemList::move_item(int p_from_idx, int p_to_idx) { int ItemList::get_item_count() const { return items.size(); } + void ItemList::remove_item(int p_idx) { ERR_FAIL_INDEX(p_idx, items.size()); @@ -339,6 +343,7 @@ void ItemList::set_fixed_column_width(int p_size) { update(); shape_changed = true; } + int ItemList::get_fixed_column_width() const { return fixed_column_width; } @@ -348,6 +353,7 @@ void ItemList::set_same_column_width(bool p_enable) { update(); shape_changed = true; } + bool ItemList::is_same_column_width() const { return same_column_width; } @@ -358,6 +364,7 @@ void ItemList::set_max_text_lines(int p_lines) { update(); shape_changed = true; } + int ItemList::get_max_text_lines() const { return max_text_lines; } @@ -368,6 +375,7 @@ void ItemList::set_max_columns(int p_amount) { update(); shape_changed = true; } + int ItemList::get_max_columns() const { return max_columns; } @@ -400,6 +408,7 @@ void ItemList::set_fixed_icon_size(const Size2 &p_size) { Size2 ItemList::get_fixed_icon_size() const { return fixed_icon_size; } + Size2 ItemList::Item::get_icon_size() const { if (icon.is_null()) return Size2(); |