-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bugfix/469 overlay stack interface #720
Bugfix/469 overlay stack interface #720
Conversation
… one This does not introduce the overlay stack yet.
Is there a way to do this without adding the long list of methods to the Canvas interface? One more specific concern is that PopOverlay looks dangerous - for example something that pushes and later pops may be popping the wrong item. I like that RemoveOverlay removes all the child ones too, which makes me think that perhaps AddOverlay and RemoveOverlay is sufficient. Back to the point above maybe Overlays() returns an OverlayStack or something? That is basically how it's implemented under the hood and would mean a single new method added to the interface. Just a thought. Or even further outside of the box... Is it a ContentStack? The lowest level is the real content and the rest are overlays... but I just wondered are they not really the same thing? |
I'm not sure about the Regarding Regarding |
Yeah ContentStack was a bit of a curve ball - SetContent() would basically be like ContentStack().Remove(oldContent); ContentStack().Add(newContent) - causing all overlays open to be dismissed like your current RemoveOverlay(). For some reason I imagined it could make some driver code simpler as it would remove the divide between content and overlay content. Maybe I was just getting carried away here :). Yes, the Overlays() *OverlayStack would indeed then have the Push/Remove etc methods on it. I don't know why I thought of it, probably just to reduce the number of new calls on Canvas() when they would probably all be implemented by the same stack code anyway... Your thoughts on PopOverlay make sense, but I think in this instance bigger changes to the existing widgets allow for a cleaner and less ambiguous API, so let's do that :) |
This will be needed if the overlay management is extracted into the stack and the glfw driver will have an extended stack which manages the render cache trees.
Is it intended that this version of the stack only has 1 element? (or maybe I am reading it wrong?) Also, and I'm not sure about this: Given the methods on StackOverlay refers to overlays should they be just Add(), Remove() and Top()? The code using them can seem quite repetitive otherwise? (a bit more of an open question here). |
Yes, the real stack implementation will follow in a separate PR. I can put the the stack implementation deeper but not into I'll do the method name length reduction. |
Thanks. I guess the file can stay where it is until we get a solution to the circular dep, or find a nice sub-package for such things. I had not thought about "All()" instead of "Overlays()" - I wonder if that implies an unsorted collection though, would "List()" be more explicit? (Maybe this is not an issue with Go where there is no "set" primitive?) |
Description:
In preparation for a fix of #469 this PR introduces a new overlay interface to
fyne.Canvas
. The old methods (Overlay
,SetOverlay
) are deprecated.Checklist:
[ ] Tests included.Where applicable: