Need event for theme change #10
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Something like
Because objects should be able to request a re-application when the theme is changed. Additionally, objects that grab icons from the theme need to be able to reload those.
Whenever theme.SetTheme is called, the backend should recurse through all active boxes and fire this event.
Of course the only problem with this is when a Box isn't inside of a window, it wouldn't have its theme set. Therefore, it might be a good idea for the backend to have some sort of theme change counter that is incremented whenever the theme is changed, and store a copy of that in each Box. When a Box is added as a child, it and its children should be recursively checked to see if the theme has changed while they were orphaned and if it did, the event should be fired. Perhaps the internal method to recursively fire the event should be the thing that updates the Box's theme counter.
Another thing for consideration:
All of this would require notifying the backend about the theme change. Why not have the backend be in charge of applying themes, and have Box store its Role?
This would move more responsibility away from objects, and we wouldn't have to trust each individual object to implement this logic in a non-fragile manner, because it would be implemented once (in the backend).
Additionally, in the future the theming system could be extended to support advanced, css-like selectors.
Going this route