-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Widget traits #9
Comments
Additional widget properties (via data common to all widgets) are easily integrated into the Properties exposed based on the class may be integrated into the I believe this suffices for the trait design (though obviously more methods will be required). |
Currently we have the following widget traits:
Design ideas in #16 require a user-implemented and ideally parameterised trait for size and drawing: trait Drawable {
type Draw;
fn size_rules(&self, draw: &mut Self::Draw, axis: layout::AxisInfo) -> layout::SizeRules;
fn draw(&self, draw: &mut Self::Draw, ev_mgr: &event::Manager);
} Additionally, a few other details (e.g.
Plan:
|
The recent trait redesign has landed as follows:
To avoid making The result? Widget sizing and drawing now involves a few dynamic method dispatches, but also allows slightly more efficient code here. More significantly, all widget implementation details can now be made local to the widget. |
This may see some adjustment but the basics are there:
Core
data traitLayout
helper trait [could be merged intoWidget
, but little reason to do so]Widget
master traitClass
es, with class-specific propertiesAdditionally, we have a trait for windows and dialogs which may see revision (or be removed):
Window
traitThe text was updated successfully, but these errors were encountered: