You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of the discussion around the Data widget being "hard" to access (see #230) the contained data really stems from how interfaces in Cushy are built by composing many widgets and there being no way to find a specific instance of a widget in the hierarchy without having a reference to it.
Ultimately I think that it's a mistake for application data to be stored and queried this way. However, in designing widgets that are supposed to work with other widgets, it is very beneficial to be able to generically interact with a widget. To me, the Rust way to do this is with traits.
I want to design a system where dyn SomeTrait downcast can be done via a plugin id. Widgets would need to implement a function that would resolve self to a specific trait implementation based on the plugin id. The Any type would be used to ensure that the downcast is a valid downcast.
The main case where Cushy might use this is with how the Stack widget hardcodes several types to handle the layout operations directly (#127). While that could be solved another way, it might be a good opportunity for a system like this.
The text was updated successfully, but these errors were encountered:
A related idea to the the plugin system --- The concept of a port on a widget would be a great help when attempting to connect widgets, say like in a 2d drawing application where one wanted to connect multiple widgets and the have a variable amount of input ports and output ports. A generic connector widget that would have straight line, orthogonal, and bezier options would be extremely awesome too. The generic Widget trait could perhaps be modified to include a Vec of Ports, where the Ports Type is a HaspMap of Input, Port or Output, Port.
Part of the discussion around the
Data
widget being "hard" to access (see #230) the contained data really stems from how interfaces in Cushy are built by composing many widgets and there being no way to find a specific instance of a widget in the hierarchy without having a reference to it.Ultimately I think that it's a mistake for application data to be stored and queried this way. However, in designing widgets that are supposed to work with other widgets, it is very beneficial to be able to generically interact with a widget. To me, the Rust way to do this is with traits.
I want to design a system where
dyn SomeTrait
downcast can be done via a plugin id. Widgets would need to implement a function that would resolveself
to a specific trait implementation based on the plugin id. TheAny
type would be used to ensure that the downcast is a valid downcast.The main case where Cushy might use this is with how the
Stack
widget hardcodes several types to handle the layout operations directly (#127). While that could be solved another way, it might be a good opportunity for a system like this.The text was updated successfully, but these errors were encountered: