switch to WidgetRef
This commit is contained in:
@@ -32,8 +32,8 @@ pub struct Client {
|
||||
dir: DataDir,
|
||||
data: ClientData,
|
||||
state: ClientState,
|
||||
main_ui: WidgetId<WidgetPtr>,
|
||||
notif: WidgetId<WidgetPtr>,
|
||||
main_ui: WidgetRef<WidgetPtr>,
|
||||
notif: WidgetRef<WidgetPtr>,
|
||||
proxy: Proxy<ClientEvent>,
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ impl DefaultAppState for Client {
|
||||
WindowAttributes::default().with_title("OPENWORM")
|
||||
}
|
||||
|
||||
fn new(ui: &mut Ui, state: &UiState, proxy: Proxy<Self::Event>) -> Self {
|
||||
fn new(ui: &mut Ui, _state: &UiState, proxy: Proxy<Self::Event>) -> Self {
|
||||
let dir = DataDir::default();
|
||||
let notif = WidgetPtr::default().add(ui);
|
||||
let main_ui = WidgetPtr::default().add(ui);
|
||||
@@ -94,7 +94,7 @@ impl DefaultAppState for Client {
|
||||
&& let Some(msg_area) = &state.channel
|
||||
{
|
||||
let msg = msg_widget(&msg.user, &msg.content).add(ui);
|
||||
ui[msg_area].children.push(msg.any());
|
||||
msg_area.get_mut().children.push(msg.any());
|
||||
}
|
||||
}
|
||||
ServerMsg::LoadMsgs(msgs) => {
|
||||
@@ -104,7 +104,7 @@ impl DefaultAppState for Client {
|
||||
for msg in msgs {
|
||||
state.msgs.push(msg.clone());
|
||||
let msg = msg_widget(&msg.user, &msg.content).add(ui);
|
||||
ui[msg_area].children.push(msg.any());
|
||||
msg_area.get_mut().children.push(msg.any());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,11 +123,11 @@ impl DefaultAppState for Client {
|
||||
}
|
||||
ServerMsg::Error(error) => {
|
||||
let msg = format!("{error:?}");
|
||||
ui[&self.notif].inner = Some(werror(ui, &msg));
|
||||
self.notif.get_mut().inner = Some(werror(ui, &msg));
|
||||
}
|
||||
},
|
||||
ClientEvent::Err(msg) => {
|
||||
ui[&self.notif].inner = Some(werror(ui, &msg));
|
||||
self.notif.get_mut().inner = Some(werror(ui, &msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user