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

Method init

src/rendering/backend/native/sheet.rs:80–144  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

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