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

Foreground function for Container Widget and WidgetExt #2346

Merged
merged 11 commits into from
Feb 3, 2023

Conversation

giannissc
Copy link
Contributor

No description provided.

@jaredoconnell
Copy link
Contributor

I left a comment about a test failure.

There are also some formatting problems that need to be fixed. There is some valuable information here: https://github.com/linebender/druid/blob/master/CONTRIBUTING.md

Lastly, don't forget to add your PR to the changelog. You can also add yourself to the authors file.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Generally looks fine, but I've got some inline comments.

Also, when you're done with the changes don't forget to run cargo fmt.

@@ -77,6 +79,36 @@ impl<T: Data> Container<T> {
self.background = None;
}

/// Builder-style method for setting the foreground for this widget.
///
/// This can be passed anything which can be represented by a [`BackgroundBrush`];
Copy link
Member

Choose a reason for hiding this comment

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

I guess BackgroundBrush is no longer a great name. Not a change we need to worry about in this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was thinking the same since I was preparing the PR. Since this didn't make it in time should I prepare another PR for the BackgroundBrush change?

Copy link
Member

Choose a reason for hiding this comment

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

If you wish, sure. After we merge this one here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I just rename it to Brush? I am also thinking PrimitivesBrush

Copy link
Member

Choose a reason for hiding this comment

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

Brush sort-of clashes with Piet's Brush so perhaps not. Given that it is defined in painter.rs I'm also thinking maybe PaintBrush. Although we could maybe go with something non-brush even, given that it supports a full Painter widget as a variant. 🤔

druid/src/widget/container.rs Outdated Show resolved Hide resolved
druid/src/widget/widget_ext.rs Outdated Show resolved Hide resolved
@giannissc giannissc requested review from jaredoconnell and xStrom and removed request for jaredoconnell January 28, 2023 13:03
Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Please add a CHANGELOG.md entry for these changes. You probably need to rebase on master first to avoid merge conflicts.

The main entry in the unreleased version's added section at the top of the file:

### Added

- `foreground`, `set_foreground`, and `clear_foreground` methods to `Container` and `WidgetExt::foreground` method for convenience. ([#2346] by [@giannissc])

Then also define your profile link and the PR link at the very bottom of the file.

[@giannissc]: https://github.com/giannissc

[...]

[#2346]: https://github.com/linebender/druid/pull/2346

druid/src/widget/widget_ext.rs Show resolved Hide resolved
@xStrom xStrom added widget concerns a particular widget S-waiting-on-author waits for changes from the submitter labels Jan 31, 2023
@giannissc
Copy link
Contributor Author

Ready to be merged! @xStrom

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

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

Thanks!

@xStrom xStrom removed the S-waiting-on-author waits for changes from the submitter label Feb 2, 2023
@xStrom xStrom merged commit f9d4a1a into linebender:master Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
widget concerns a particular widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants