Clean up NativeButton

Eliminate native_button_enabled
This commit is contained in:
Simon Hausmann 2020-10-30 16:28:06 +01:00
parent cd75556ab1
commit c3ba5a0808
3 changed files with 4 additions and 5 deletions

View file

@ -408,7 +408,7 @@ impl TypeRegister {
("text", Type::String),
("pressed", Type::Bool),
("clicked", Type::Signal { args: vec![] }),
("native_button_enabled", Type::Bool),
("enabled", Type::Bool),
],
&[],
);

View file

@ -12,7 +12,6 @@ LICENSE END */
export Button := NativeButton {
property<length> font_size;
enabled: true;
native_button_enabled: self.enabled;
}
export CheckBox := NativeCheckBox { }
export SpinBox := NativeSpinBox { property<length> font_size; }

View file

@ -97,7 +97,7 @@ pub struct NativeButton {
pub width: Property<f32>,
pub height: Property<f32>,
pub text: Property<SharedString>,
pub native_button_enabled: Property<bool>,
pub enabled: Property<bool>,
pub pressed: Property<bool>,
pub clicked: Signal<()>,
pub cached_rendering_data: CachedRenderingData,
@ -120,7 +120,7 @@ impl Item for NativeButton {
) -> HighLevelRenderingPrimitive {
let down: bool = Self::FIELD_OFFSETS.pressed.apply_pin(self).get();
let text: qttypes::QString = Self::FIELD_OFFSETS.text.apply_pin(self).get().as_str().into();
let enabled = Self::FIELD_OFFSETS.native_button_enabled.apply_pin(self).get();
let enabled = Self::FIELD_OFFSETS.enabled.apply_pin(self).get();
let size: qttypes::QSize = get_size!(self);
let dpr = window.scale_factor();
@ -183,7 +183,7 @@ impl Item for NativeButton {
_window: &ComponentWindow,
_app_component: ComponentRefPin,
) -> InputEventResult {
let enabled = Self::FIELD_OFFSETS.native_button_enabled.apply_pin(self).get();
let enabled = Self::FIELD_OFFSETS.enabled.apply_pin(self).get();
if !enabled {
return InputEventResult::EventIgnored;
}