🧑💻 Major update to enhance Handle usage
This commit is contained in:
parent
255fb393a9
commit
d9f3561832
56 changed files with 201 additions and 353 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::prelude::*;
|
||||
use crate::CrateHandle;
|
||||
|
||||
#[derive(SmartDefault)]
|
||||
pub enum ButtonType {
|
||||
|
|
@ -28,7 +29,7 @@ pub enum ButtonTarget {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(SmartDefault)]
|
||||
#[derive(ComponentClasses, CrateHandle, SmartDefault)]
|
||||
pub struct Button {
|
||||
id : OptionId,
|
||||
weight : Weight,
|
||||
|
|
@ -43,8 +44,6 @@ pub struct Button {
|
|||
target : ButtonTarget,
|
||||
}
|
||||
|
||||
impl_handle!(COMPONENT_BASE_BUTTON for Button);
|
||||
|
||||
impl ComponentTrait for Button {
|
||||
fn new() -> Self {
|
||||
Button::default()
|
||||
|
|
@ -92,17 +91,6 @@ impl ComponentTrait for Button {
|
|||
}
|
||||
}
|
||||
|
||||
impl ComponentClasses for Button {
|
||||
fn alter_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
|
||||
self.classes.alter_value(op, classes);
|
||||
self
|
||||
}
|
||||
|
||||
fn classes(&self) -> &OptionClasses {
|
||||
&self.classes
|
||||
}
|
||||
}
|
||||
|
||||
impl Button {
|
||||
pub fn link(href: impl Into<String>, html: L10n) -> Self {
|
||||
Button::default()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue