mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
ImVector: Added find_index() helper.
This commit is contained in:
parent
44a6b493ee
commit
7812039402
@ -60,6 +60,7 @@ Other changes:
|
||||
register contents size in a way that would affect the scrolling layer.
|
||||
Was most often noticable when using an horizontal scrollbar. (#6789)
|
||||
- ImDrawList: Added AddEllipse(), AddEllipseFilled(), PathEllipticalArcTo(). (#2743) [@Doohl]
|
||||
- ImVector: Added find_index() helper.
|
||||
- Backends: GLFW: Clear emscripten's MouseWheel callback before shutdown. (#6790, #6096, #4019) [@halx99]
|
||||
- Backends: Win32: Added support for keyboard codepage conversion for when application
|
||||
is compiled in MBCS mode and using a non-Unicode window. (#6785, #6782, #5725, #5961) [@sneakyevil]
|
||||
|
@ -2698,8 +2698,6 @@ void ImGuiTextIndex::append(const char* base, int old_size, int new_size)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// [SECTION] ImGuiListClipper
|
||||
// This is currently not as flexible/powerful as it should be and really confusing/spaghetti, mostly because we changed
|
||||
// the API mid-way through development and support two ways to using the clipper, needs some rework (see TODO)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// FIXME-TABLE: This prevents us from using ImGuiListClipper _inside_ a table cell.
|
||||
|
1
imgui.h
1
imgui.h
@ -1868,6 +1868,7 @@ struct ImVector
|
||||
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
||||
inline T* find(const T& v) { T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
|
||||
inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
|
||||
inline int find_index(const T& v) const { const T* data_end = Data + Size; const T* it = find(v); if (it == data_end) return -1; const ptrdiff_t off = it - Data; return (int)off; }
|
||||
inline bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }
|
||||
inline bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }
|
||||
inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; return (int)off; }
|
||||
|
Loading…
Reference in New Issue
Block a user