MCPcopy Create free account
hub / github.com/angular-rust/ux-components / init

Method init

src/rendering/backend/native/backdrop.rs:82–146  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

80 }
81
82 fn init(&self) {
83 println!("INIT BACKDROP");
84
85 self.inner.set_reactive(true);
86
87 // g_signal_connect (button, "style-changed",
88 // G_CALLBACK (button_style_changed), NULL);
89 // g_signal_connect (button, "actor-added",
90 // G_CALLBACK (button_actor_added), NULL);
91 // g_signal_connect (button, "actor-removed",
92 // G_CALLBACK (button_actor_removed), NULL);
93
94 let mut props = self.props.borrow_mut();
95 props.icon_visible = true;
96 props.label_visible = true;
97 props.icon_position = Position::Left;
98
99 // take an extra reference to the hbox
100 // priv->hbox = g_object_ref (box_layout_new ());
101 // clutter_actor_add_child (CLUTTER_ACTOR (button), priv->hbox);
102
103 if let Some(name) = &props.icon_name {
104 println!("ADD ICON TO BACKDROP [{}]", name);
105 let icon = Icon::new();
106 // priv->icon = icon_new ();
107 // clutter_actor_add_child (priv->hbox, priv->icon);
108
109 self.inner.add_child(&icon);
110 }
111
112 if let Some(text) = &props.text {
113 println!("ADD TEXT TO BACKDROP [{}]", text);
114 let style = Theme::global().get(StyleClass::MdcButton).unwrap();
115 let fontfamily = if let Some(fontfamily) = style.fontfamily {
116 fontfamily
117 } else {
118 "Roboto".into()
119 };
120
121 let label = Text::with_text(Some(fontfamily.as_str()), text.as_str());
122 // priv->label = g_object_new (CLUTTER_TYPE_TEXT,
123 // "line-alignment", PANGO_ALIGN_CENTER,
124 // "ellipsize", PANGO_ELLIPSIZE_END,
125 // NULL);
126 // clutter_actor_add_child (priv->hbox, priv->label);
127 // let actor: &Actor = label.as_ref();
128 // self.inner.add_child(&label);
129 }
130
131 // box_layout_child_set_expand (BOX_LAYOUT (priv->hbox),
132 // priv->label, TRUE);
133 // box_layout_child_set_y_fill (BOX_LAYOUT (priv->hbox),
134 // priv->label, FALSE);
135 // box_layout_child_set_x_fill (BOX_LAYOUT (priv->hbox),
136 // priv->label, FALSE);
137
138 // box_layout_child_set_expand (BOX_LAYOUT (priv->hbox),
139 // priv->icon, TRUE);

Callers 3

newMethod · 0.45
with_labelMethod · 0.45
with_iconMethod · 0.45

Calls 2

add_childMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected