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

Extended pick_list::Handle to be more flexible #1675

Merged
merged 6 commits into from
Feb 14, 2023

Conversation

casperstorm
Copy link
Member

I have extended the pick_list::Handle slightly:

{
    Arrow,
    Static({ .. }),
    Dynamic {
        closed: { .. },
        open: { .. },
    },
    None,
}

This was done because I felt the previous solution was too limited by not allowing the user to choose different content depending on the state of the pick_list. The main use case is to display a different icon, like ▲ and ▼, depending on the open/close state.

Below is a small gif show casing the different states.

pick_list_handle

@hecrj hecrj added feature New feature or request widget styling labels Jan 28, 2023
@hecrj hecrj added this to the 0.8.0 milestone Jan 28, 2023
We can avoid downcasting `state` :^)
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks.

I have simplified some stuff here and there:

  • Renamed HandleContent to Icon and made the text be a code_point instead.
  • Changed the generic type to be the Font type directly.
  • Inlined the Handle::content helper since it's only used in draw once.

Let's merge! 🚢

@hecrj hecrj enabled auto-merge February 14, 2023 06:12
@hecrj hecrj merged commit 8c5996c into iced-rs:master Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request styling widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants