wgui: component callbacks refactoring

This commit is contained in:
Aleksander
2025-09-16 20:35:28 +02:00
parent 0fdc0e3828
commit dfec935388
7 changed files with 24 additions and 64 deletions

View File

@@ -7,7 +7,7 @@ use std::{
use crate::{
animation::Animations,
components::{Component, InitData},
event::{self, EventAlterables, EventListenerCollection},
event::{self, CallbackDataCommon, EventAlterables, EventListenerCollection},
globals::WguiGlobals,
transform_stack::Transform,
widget::{self, EventParams, WidgetObj, WidgetState, div::WidgetDiv},
@@ -203,10 +203,12 @@ impl Layout {
let mut alterables = EventAlterables::default();
while let Some(c) = self.components_to_init.pop_front() {
c.0.init(&mut InitData {
let mut common = CallbackDataCommon {
state: &self.state,
alterables: &mut alterables,
});
};
c.0.init(&mut InitData { common: &mut common });
}
self.process_alterables(alterables)?;