From: Olaf Wintermann Date: Thu, 21 May 2026 17:36:08 +0000 (+0200) Subject: extend UiSourceList API X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=b64f58998fe20d77454ff8010a500d3b816a9dc1;p=note.git extend UiSourceList API --- diff --git a/ui-rs/src/ui/toolkit.rs b/ui-rs/src/ui/toolkit.rs index fdbdc5e..60c08e8 100644 --- a/ui-rs/src/ui/toolkit.rs +++ b/ui-rs/src/ui/toolkit.rs @@ -718,6 +718,18 @@ impl UiSourceList { } } + pub fn len(&self) -> usize { + self.sublists.len() + } + + pub fn get(&self, index: usize) -> Option<&SubList> { + self.sublists.get(index) + } + + pub fn get_mut(&mut self, index: usize) -> Option<&mut SubList> { + self.sublists.get_mut(index) + } + pub fn push(&mut self, sublist: SubList) { unsafe { ui_list_append(self.ptr, sublist.handle as *mut c_void); @@ -759,6 +771,19 @@ impl UiSourceList { } } +impl std::ops::Index for UiSourceList { + type Output = SubList; + + fn index(&self, index: usize) -> &Self::Output { + &self.sublists[index] + } +} + +impl std::ops::IndexMut for UiSourceList { + fn index_mut(&mut self, index: usize) -> &mut Self::Output { + &mut self.sublists[index] + } +} /* -------------------------------- List -------------------------------- */