mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Merge BuiltinItem and GeneratePropertyAccessors derive macros
... into the new SixtyFPSElement macro. This generates getters for all properties.
This commit is contained in:
parent
a48f4253a2
commit
65dcb2cb33
6 changed files with 60 additions and 97 deletions
|
@ -71,7 +71,7 @@ const DEFAULT_FONT_WEIGHT: i32 = 400;
|
|||
|
||||
/// The implementation of the `Text` element
|
||||
#[repr(C)]
|
||||
#[derive(FieldOffsets, Default, BuiltinItem)]
|
||||
#[derive(FieldOffsets, Default, SixtyFPSElement)]
|
||||
#[pin]
|
||||
pub struct Text {
|
||||
pub text: Property<SharedString>,
|
||||
|
@ -139,14 +139,6 @@ impl ItemConsts for Text {
|
|||
}
|
||||
|
||||
impl Text {
|
||||
fn font_family(self: Pin<&Self>) -> SharedString {
|
||||
Self::FIELD_OFFSETS.font_family.apply_pin(self).get()
|
||||
}
|
||||
|
||||
fn font_weight(self: Pin<&Self>) -> i32 {
|
||||
Self::FIELD_OFFSETS.font_weight.apply_pin(self).get()
|
||||
}
|
||||
|
||||
pub fn font_pixel_size(self: Pin<&Self>, scale_factor: f32) -> f32 {
|
||||
let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get();
|
||||
if font_size == 0.0 {
|
||||
|
@ -180,7 +172,7 @@ impl Text {
|
|||
|
||||
/// The implementation of the `TextInput` element
|
||||
#[repr(C)]
|
||||
#[derive(FieldOffsets, Default, BuiltinItem)]
|
||||
#[derive(FieldOffsets, Default, SixtyFPSElement)]
|
||||
#[pin]
|
||||
pub struct TextInput {
|
||||
pub text: Property<SharedString>,
|
||||
|
@ -562,14 +554,6 @@ impl TextInput {
|
|||
}
|
||||
}
|
||||
|
||||
fn font_family(self: Pin<&Self>) -> SharedString {
|
||||
Self::FIELD_OFFSETS.font_family.apply_pin(self).get()
|
||||
}
|
||||
|
||||
fn font_weight(self: Pin<&Self>) -> i32 {
|
||||
Self::FIELD_OFFSETS.font_weight.apply_pin(self).get()
|
||||
}
|
||||
|
||||
fn font_pixel_size(self: Pin<&Self>, scale_factor: f32) -> f32 {
|
||||
let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get();
|
||||
if font_size == 0.0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue