Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kayak UI
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Bevy Forks
Kayak UI
Commits
e013fb9e
Unverified
Commit
e013fb9e
authored
3 years ago
by
Ygg01
Browse files
Options
Downloads
Patches
Plain Diff
Fix proc macro
parent
2571f642
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
kayak_render_macros/src/widget_props.rs
+8
-0
8 additions, 0 deletions
kayak_render_macros/src/widget_props.rs
src/widgets/button.rs
+6
-1
6 additions, 1 deletion
src/widgets/button.rs
src/widgets/text_box.rs
+6
-1
6 additions, 1 deletion
src/widgets/text_box.rs
with
20 additions
and
2 deletions
kayak_render_macros/src/widget_props.rs
+
8
−
0
View file @
e013fb9e
...
@@ -13,6 +13,7 @@ const PROPS_HELPER_IDENT: &str = "prop_field";
...
@@ -13,6 +13,7 @@ const PROPS_HELPER_IDENT: &str = "prop_field";
const
PROP_CHILDREN
:
&
str
=
"Children"
;
const
PROP_CHILDREN
:
&
str
=
"Children"
;
const
PROP_STYLE
:
&
str
=
"Styles"
;
const
PROP_STYLE
:
&
str
=
"Styles"
;
const
PROP_ON_EVENT
:
&
str
=
"OnEvent"
;
const
PROP_ON_EVENT
:
&
str
=
"OnEvent"
;
const
PROP_ON_LAYOUT
:
&
str
=
"OnLayout"
;
const
PROP_FOCUSABLE
:
&
str
=
"Focusable"
;
const
PROP_FOCUSABLE
:
&
str
=
"Focusable"
;
#[derive(Default)]
#[derive(Default)]
...
@@ -20,6 +21,7 @@ struct PropsHelpers {
...
@@ -20,6 +21,7 @@ struct PropsHelpers {
children_ident
:
Option
<
Ident
>
,
children_ident
:
Option
<
Ident
>
,
styles_ident
:
Option
<
Ident
>
,
styles_ident
:
Option
<
Ident
>
,
on_event_ident
:
Option
<
Ident
>
,
on_event_ident
:
Option
<
Ident
>
,
on_layout_ident
:
Option
<
Ident
>
,
focusable_ident
:
Option
<
Ident
>
,
focusable_ident
:
Option
<
Ident
>
,
}
}
...
@@ -43,6 +45,7 @@ pub(crate) fn impl_widget_props(input: TokenStream) -> TokenStream {
...
@@ -43,6 +45,7 @@ pub(crate) fn impl_widget_props(input: TokenStream) -> TokenStream {
let
children_return
=
quote_clone_field
(
helpers
.children_ident
);
let
children_return
=
quote_clone_field
(
helpers
.children_ident
);
let
styles_return
=
quote_clone_field
(
helpers
.styles_ident
);
let
styles_return
=
quote_clone_field
(
helpers
.styles_ident
);
let
on_event_return
=
quote_clone_field
(
helpers
.on_event_ident
);
let
on_event_return
=
quote_clone_field
(
helpers
.on_event_ident
);
let
on_layout_return
=
quote_clone_field
(
helpers
.on_layout_ident
);
let
focusable_return
=
quote_clone_field
(
helpers
.focusable_ident
);
let
focusable_return
=
quote_clone_field
(
helpers
.focusable_ident
);
let
kayak_core
=
get_core_crate
();
let
kayak_core
=
get_core_crate
();
...
@@ -65,6 +68,10 @@ pub(crate) fn impl_widget_props(input: TokenStream) -> TokenStream {
...
@@ -65,6 +68,10 @@ pub(crate) fn impl_widget_props(input: TokenStream) -> TokenStream {
#
on_event_return
#
on_event_return
}
}
fn
get_on_layout
(
&
self
)
->
Option
<
#
kayak_core
::
OnLayout
>
{
#
on_layout_return
}
fn
get_focusable
(
&
self
)
->
Option
<
bool
>
{
fn
get_focusable
(
&
self
)
->
Option
<
bool
>
{
#
focusable_return
#
focusable_return
}
}
...
@@ -125,6 +132,7 @@ fn process_field(field: Field, props: &mut PropsHelpers) {
...
@@ -125,6 +132,7 @@ fn process_field(field: Field, props: &mut PropsHelpers) {
PROP_CHILDREN
=>
props
.children_ident
=
field
.ident
.clone
(),
PROP_CHILDREN
=>
props
.children_ident
=
field
.ident
.clone
(),
PROP_STYLE
=>
props
.styles_ident
=
field
.ident
.clone
(),
PROP_STYLE
=>
props
.styles_ident
=
field
.ident
.clone
(),
PROP_ON_EVENT
=>
props
.on_event_ident
=
field
.ident
.clone
(),
PROP_ON_EVENT
=>
props
.on_event_ident
=
field
.ident
.clone
(),
PROP_ON_LAYOUT
=>
props
.on_layout_ident
=
field
.ident
.clone
(),
PROP_FOCUSABLE
=>
props
.focusable_ident
=
field
.ident
.clone
(),
PROP_FOCUSABLE
=>
props
.focusable_ident
=
field
.ident
.clone
(),
err
=>
emit_error!
(
err
.span
(),
"Invalid attribute: {}"
,
err
),
err
=>
emit_error!
(
err
.span
(),
"Invalid attribute: {}"
,
err
),
}
}
...
...
This diff is collapsed.
Click to expand it.
src/widgets/button.rs
+
6
−
1
View file @
e013fb9e
...
@@ -2,7 +2,7 @@ use crate::core::{
...
@@ -2,7 +2,7 @@ use crate::core::{
render_command
::
RenderCommand
,
render_command
::
RenderCommand
,
rsx
,
rsx
,
styles
::{
Corner
,
Style
,
StyleProp
,
Units
},
styles
::{
Corner
,
Style
,
StyleProp
,
Units
},
widget
,
Children
,
Color
,
Fragment
,
OnEvent
,
WidgetProps
,
widget
,
Children
,
Color
,
Fragment
,
OnEvent
,
OnLayout
,
WidgetProps
,
};
};
use
kayak_core
::
CursorIcon
;
use
kayak_core
::
CursorIcon
;
...
@@ -17,6 +17,7 @@ pub struct ButtonProps {
...
@@ -17,6 +17,7 @@ pub struct ButtonProps {
pub
styles
:
Option
<
Style
>
,
pub
styles
:
Option
<
Style
>
,
pub
children
:
Option
<
Children
>
,
pub
children
:
Option
<
Children
>
,
pub
on_event
:
Option
<
OnEvent
>
,
pub
on_event
:
Option
<
OnEvent
>
,
pub
on_layout
:
Option
<
OnLayout
>
,
pub
focusable
:
Option
<
bool
>
,
pub
focusable
:
Option
<
bool
>
,
}
}
...
@@ -37,6 +38,10 @@ impl WidgetProps for ButtonProps {
...
@@ -37,6 +38,10 @@ impl WidgetProps for ButtonProps {
self
.on_event
.clone
()
self
.on_event
.clone
()
}
}
fn
get_on_layout
(
&
self
)
->
Option
<
OnLayout
>
{
self
.on_layout
.clone
()
}
fn
get_focusable
(
&
self
)
->
Option
<
bool
>
{
fn
get_focusable
(
&
self
)
->
Option
<
bool
>
{
Some
(
!
self
.disabled
)
Some
(
!
self
.disabled
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/widgets/text_box.rs
+
6
−
1
View file @
e013fb9e
...
@@ -4,7 +4,7 @@ use crate::core::{
...
@@ -4,7 +4,7 @@ use crate::core::{
styles
::{
Corner
,
Style
,
Units
},
styles
::{
Corner
,
Style
,
Units
},
widget
,
Bound
,
Children
,
Color
,
EventType
,
MutableBound
,
OnEvent
,
WidgetProps
,
widget
,
Bound
,
Children
,
Color
,
EventType
,
MutableBound
,
OnEvent
,
WidgetProps
,
};
};
use
kayak_core
::
CursorIcon
;
use
kayak_core
::
{
CursorIcon
,
OnLayout
}
;
use
std
::
sync
::{
Arc
,
RwLock
};
use
std
::
sync
::{
Arc
,
RwLock
};
use
crate
::
widgets
::{
Background
,
Clip
,
Text
};
use
crate
::
widgets
::{
Background
,
Clip
,
Text
};
...
@@ -26,6 +26,7 @@ pub struct TextBoxProps {
...
@@ -26,6 +26,7 @@ pub struct TextBoxProps {
pub
styles
:
Option
<
Style
>
,
pub
styles
:
Option
<
Style
>
,
pub
children
:
Option
<
Children
>
,
pub
children
:
Option
<
Children
>
,
pub
on_event
:
Option
<
OnEvent
>
,
pub
on_event
:
Option
<
OnEvent
>
,
pub
on_layout
:
Option
<
OnLayout
>
,
pub
focusable
:
Option
<
bool
>
,
pub
focusable
:
Option
<
bool
>
,
}
}
...
@@ -46,6 +47,10 @@ impl WidgetProps for TextBoxProps {
...
@@ -46,6 +47,10 @@ impl WidgetProps for TextBoxProps {
self
.on_event
.clone
()
self
.on_event
.clone
()
}
}
fn
get_on_layout
(
&
self
)
->
Option
<
OnLayout
>
{
self
.on_layout
.clone
()
}
fn
get_focusable
(
&
self
)
->
Option
<
bool
>
{
fn
get_focusable
(
&
self
)
->
Option
<
bool
>
{
Some
(
!
self
.disabled
)
Some
(
!
self
.disabled
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment