From 0c65a9df41b5b40beae17acb372e3051cf9f3816 Mon Sep 17 00:00:00 2001 From: Zeenobit Date: Sun, 3 Jul 2022 08:57:42 -0400 Subject: [PATCH] Add `body_unindented` to `HeaderResponse` (#1731) --- egui/src/containers/collapsing_header.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/egui/src/containers/collapsing_header.rs b/egui/src/containers/collapsing_header.rs index 8896eee0..ba757bb8 100644 --- a/egui/src/containers/collapsing_header.rs +++ b/egui/src/containers/collapsing_header.rs @@ -287,6 +287,23 @@ impl<'ui, HeaderRet> HeaderResponse<'ui, HeaderRet> { body_response, ) } + + /// Returns the response of the collapsing button, the custom header, and the custom body, without indentation. + pub fn body_unindented( + mut self, + add_body: impl FnOnce(&mut Ui) -> BodyRet, + ) -> ( + Response, + InnerResponse, + Option>, + ) { + let body_response = self.state.show_body_unindented(self.ui, add_body); + ( + self.toggle_button_response, + self.header_response, + body_response, + ) + } } // ----------------------------------------------------------------------------