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

feature: programmatically hide/show or expand/collapse windows #4835

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Norlock
Copy link

@Norlock Norlock commented Jul 16, 2024

Programmatically hide/show or expand/collapse windows

Will add a new function call: Window::window_action(mut self, action: &mut Option<WindowAction>)
Also add a new function call to let the user determine if the window has a close/hide button, this is because behaviour can be done programmatically so it doesn't always require a closing button.

The actions are:

pub enum WindowAction {
    Expand,
    Collapse,
    Show,
    Hide,
    /// Toggles between show and hide
    ToggleShow,
    /// Toggles between expand and collapse
    ToggleExpand,
}

After each frame the action is consumed and executed. This way the function doesn't need to borrow,

Testing

There have been 2 new buttons added for the demo_demo_app which can be used to test the functionality.

@Norlock Norlock force-pushed the feat/dynamic-open-close-windows branch 3 times, most recently from 341faf4 to 1bab9e6 Compare July 16, 2024 23:31
Because this is programmable now, pass the closing button as a value.

Change some of the 'open' naming to 'show/hide' because the open keyword
was used both for expanded and for shown. This makes a better
distinction
Fix collapse action
@Norlock Norlock force-pushed the feat/dynamic-open-close-windows branch from 1bab9e6 to 6d5e2ac Compare July 16, 2024 23:35
@Norlock Norlock marked this pull request as ready for review July 16, 2024 23:36
@Norlock Norlock force-pushed the feat/dynamic-open-close-windows branch 2 times, most recently from 539ac54 to fd663fe Compare July 17, 2024 08:15
@Norlock Norlock force-pushed the feat/dynamic-open-close-windows branch from fd663fe to 4dab4af Compare July 17, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add methods to collapse a window
1 participant