Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose state override for HeaderResponse #4200

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/egui/src/containers/collapsing_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,18 @@ pub struct HeaderResponse<'ui, HeaderRet> {
}

impl<'ui, HeaderRet> HeaderResponse<'ui, HeaderRet> {
pub fn is_open(&self) -> bool {
self.state.is_open()
}

pub fn set_open(&mut self, open: bool) {
self.state.set_open(open);
}

pub fn toggle(&mut self) {
self.state.toggle(self.ui);
}

/// Returns the response of the collapsing button, the custom header, and the custom body.
pub fn body<BodyRet>(
mut self,
Expand Down
Loading