pub struct Component {Show 16 fields
pub node: Option<Component>,
pub id: SmolStr,
pub root_element: ElementRc,
pub parent_element: RefCell<ElementWeak>,
pub optimized_elements: RefCell<Vec<ElementRc>>,
pub root_constraints: RefCell<LayoutConstraints>,
pub child_insertion_point: RefCell<Option<ChildrenInsertionPoint>>,
pub init_code: RefCell<InitCode>,
pub popup_windows: RefCell<Vec<PopupWindow>>,
pub timers: RefCell<Vec<Timer>>,
pub menu_item_tree: RefCell<Vec<Rc<Component>>>,
pub inherits_popup_window: Cell<bool>,
pub exported_global_names: RefCell<Vec<ExportedName>>,
pub used: Cell<bool>,
pub private_properties: RefCell<Vec<(SmolStr, Type)>>,
pub from_library: Cell<bool>,
}Expand description
A component is a type in the language which can be instantiated, Or is materialized for repeated expression.
Fields§
§node: Option<Component>§id: SmolStr§root_element: ElementRc§parent_element: RefCell<ElementWeak>The parent element within the parent component if this component represents a repeated element
optimized_elements: RefCell<Vec<ElementRc>>List of elements that are not attached to the root anymore because they have been optimized away, but their properties may still be in use
root_constraints: RefCell<LayoutConstraints>The layout constraints of the root item
child_insertion_point: RefCell<Option<ChildrenInsertionPoint>>When creating this component and inserting “children”, append them to the children of the element pointer to by this field.
init_code: RefCell<InitCode>§popup_windows: RefCell<Vec<PopupWindow>>§timers: RefCell<Vec<Timer>>§inherits_popup_window: Cell<bool>This component actually inherits PopupWindow (although that has been changed to a Window by the lower_popups pass)
exported_global_names: RefCell<Vec<ExportedName>>The names under which this component should be accessible if it is a global singleton and exported.
used: Cell<bool>True if this component is used as a sub-component by at least one other component.
private_properties: RefCell<Vec<(SmolStr, Type)>>The list of properties (name and type) declared as private in the component. This is used to issue better error in the generated code if the property is used.
from_library: Cell<bool>True if this component is imported from an external library.
Implementations§
Source§impl Component
impl Component
pub fn from_node( node: Component, diag: &mut BuildDiagnostics, tr: &TypeRegister, ) -> Rc<Self>
Sourcepub fn is_global(&self) -> bool
pub fn is_global(&self) -> bool
This component is a global component introduced with the “global” keyword
Sourcepub fn is_interface(&self) -> bool
pub fn is_interface(&self) -> bool
This is an interface introduced with the “interface” keyword
Sourcepub fn inherits_system_tray_icon(&self) -> bool
pub fn inherits_system_tray_icon(&self) -> bool
True if this component’s root resolves to the SystemTrayIcon native
class. Uses native_class() rather than builtin_type() so the check
still matches once the root has been resolved to Native(SystemTrayIcon)
after resolve_native_classes.
Sourcepub fn global_aliases(&self) -> Vec<SmolStr>
pub fn global_aliases(&self) -> Vec<SmolStr>
Returns the names of aliases to global singletons, exactly as specified in the .slint markup (not normalized).
pub fn repeater_count(&self) -> u32
Sourcepub fn parent_element(&self) -> Option<ElementRc>
pub fn parent_element(&self) -> Option<ElementRc>
Convenience accessor to get the parent element if this component is a repeated component, or None otherwise.
§Panics
Panics if the Self::parent_element member is currently mutably borrowed
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Component
impl !RefUnwindSafe for Component
impl !Send for Component
impl !Sync for Component
impl !UnwindSafe for Component
impl Unpin for Component
impl UnsafeUnpin for Component
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().