@@ -145,6 +145,7 @@ The derive macro would have some associated macros, which will be used to mark c
...
@@ -145,6 +145,7 @@ The derive macro would have some associated macros, which will be used to mark c
*`#[props(OnEvent)]` - Used to mark a field as the `OnEvent` prop
*`#[props(OnEvent)]` - Used to mark a field as the `OnEvent` prop
*`#[props(Styles)]` - Used to mark a field as the `Styles` prop
*`#[props(Styles)]` - Used to mark a field as the `Styles` prop
*`#[props(Focusable)]` - Used to mark a field as the `Focusable` prop
*`#[props(Focusable)]` - Used to mark a field as the `Focusable` prop
*`#[props(Children)]` - Used to mark a field as the `Children` prop
There may be more added to this list in the future, but for now this is the main assortment.
There may be more added to this list in the future, but for now this is the main assortment.
...
@@ -161,6 +162,8 @@ struct MyWidgetProps {
...
@@ -161,6 +162,8 @@ struct MyWidgetProps {
event_handler:OnEvent
event_handler:OnEvent
#[props(Focusable)]
#[props(Focusable)]
focusable:Optional<bool>,
focusable:Optional<bool>,
#[props(Children)]
children:Children,
// Defined without the marker attribute:
// Defined without the marker attribute:
styles:Styles,
styles:Styles,
}
}
...
@@ -179,6 +182,11 @@ impl WidgetProps {
...
@@ -179,6 +182,11 @@ impl WidgetProps {
self.focusable
self.focusable
}
}
// Children is an alias for an Option so it doesn't need to return Option<Children>
fnget_children(&self)->Children{
self.children.clone()
}
// ...
// ...
}
}
```
```
...
@@ -188,7 +196,7 @@ impl WidgetProps {
...
@@ -188,7 +196,7 @@ impl WidgetProps {
Another addition to `Widget` would be the constructor method. This associated method will allow widgets to be generated with a set of props in a more controlled and freeform way. The method looks like this:
Another addition to `Widget` would be the constructor method. This associated method will allow widgets to be generated with a set of props in a more controlled and freeform way. The method looks like this: