This commit is contained in:
galister
2026-01-05 20:52:34 +09:00
parent fd9becc398
commit 164e9764eb
22 changed files with 115 additions and 68 deletions

View File

@@ -1,9 +1,9 @@
use crate::{
components::{checkbox, radio_group::ComponentRadioGroup, Component},
components::{Component, checkbox, radio_group::ComponentRadioGroup},
i18n::Translation,
layout::WidgetID,
parser::{
parse_check_f32, parse_check_i32, process_component, style::parse_style, AttribPair, Fetchable, ParserContext,
AttribPair, Fetchable, ParserContext, parse_check_f32, parse_check_i32, process_component, style::parse_style,
},
};

View File

@@ -1,7 +1,7 @@
use crate::{
components::{radio_group, Component},
components::{Component, radio_group},
layout::WidgetID,
parser::{parse_children, process_component, style::parse_style, AttribPair, ParserContext, ParserFile},
parser::{AttribPair, ParserContext, ParserFile, parse_children, process_component, style::parse_style},
};
pub fn parse_component_radio_group<'a>(

View File

@@ -10,9 +10,24 @@ mod widget_rectangle;
mod widget_sprite;
use crate::{
assets::{normalize_path, AssetPath, AssetPathOwned}, components::{Component, ComponentWeak}, drawing::{self}, globals::WguiGlobals, layout::{Layout, LayoutParams, LayoutState, Widget, WidgetID, WidgetMap, WidgetPair}, log::LogErr, parser::{
component_button::parse_component_button, component_checkbox::{parse_component_checkbox, CheckboxKind}, component_radio_group::parse_component_radio_group, component_slider::parse_component_slider, widget_div::parse_widget_div, widget_image::parse_widget_image, widget_label::parse_widget_label, widget_rectangle::parse_widget_rectangle, widget_sprite::parse_widget_sprite
}, widget::ConstructEssentials
assets::{AssetPath, AssetPathOwned, normalize_path},
components::{Component, ComponentWeak},
drawing::{self},
globals::WguiGlobals,
layout::{Layout, LayoutParams, LayoutState, Widget, WidgetID, WidgetMap, WidgetPair},
log::LogErr,
parser::{
component_button::parse_component_button,
component_checkbox::{CheckboxKind, parse_component_checkbox},
component_radio_group::parse_component_radio_group,
component_slider::parse_component_slider,
widget_div::parse_widget_div,
widget_image::parse_widget_image,
widget_label::parse_widget_label,
widget_rectangle::parse_widget_rectangle,
widget_sprite::parse_widget_sprite,
},
widget::ConstructEssentials,
};
use anyhow::Context;
use ouroboros::self_referencing;
@@ -903,10 +918,20 @@ fn parse_child<'a>(
new_widget_id = Some(parse_component_slider(ctx, parent_id, &attribs)?);
}
"CheckBox" => {
new_widget_id = Some(parse_component_checkbox(ctx, parent_id, &attribs, CheckboxKind::CheckBox)?);
new_widget_id = Some(parse_component_checkbox(
ctx,
parent_id,
&attribs,
CheckboxKind::CheckBox,
)?);
}
"RadioBox" => {
new_widget_id = Some(parse_component_checkbox(ctx, parent_id, &attribs, CheckboxKind::RadioBox)?);
new_widget_id = Some(parse_component_checkbox(
ctx,
parent_id,
&attribs,
CheckboxKind::RadioBox,
)?);
}
"RadioGroup" => {
new_widget_id = Some(parse_component_radio_group(file, ctx, child_node, parent_id, &attribs)?);
@@ -1104,7 +1129,10 @@ fn get_doc_from_asset_path(
allow_dtd: true,
..Default::default()
};
roxmltree::Document::parse_with_options(xml, opt).context("Unable to parse XML").log_err_with(&asset_path).unwrap()
roxmltree::Document::parse_with_options(xml, opt)
.context("Unable to parse XML")
.log_err_with(&asset_path)
.unwrap()
}));
let root = document.borrow_doc().root();

View File

@@ -6,8 +6,8 @@ use taffy::{
use crate::{
drawing,
parser::{
is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val, print_invalid_attrib,
print_invalid_value, AttribPair,
AttribPair, is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val,
print_invalid_attrib, print_invalid_value,
},
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
widget::util::WLength,

View File

@@ -2,9 +2,8 @@ use crate::{
assets::AssetPath,
layout::WidgetID,
parser::{
parse_children, parse_widget_universal, print_invalid_attrib,
AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, print_invalid_attrib,
style::{parse_color, parse_round, parse_style},
AttribPair, ParserContext, ParserFile,
},
renderer_vk::text::custom_glyph::CustomGlyphData,
widget::image::{WidgetImage, WidgetImageParams},

View File

@@ -2,9 +2,8 @@ use crate::{
drawing::GradientMode,
layout::WidgetID,
parser::{
parse_children, parse_widget_universal, print_invalid_attrib,
AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, print_invalid_attrib,
style::{parse_color, parse_round, parse_style},
AttribPair, ParserContext, ParserFile,
},
widget::rectangle::{WidgetRectangle, WidgetRectangleParams},
};

View File

@@ -1,7 +1,7 @@
use crate::{
assets::AssetPath,
layout::WidgetID,
parser::{parse_children, parse_widget_universal, style::parse_style, AttribPair, ParserContext, ParserFile},
parser::{AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, style::parse_style},
renderer_vk::text::custom_glyph::CustomGlyphData,
widget::sprite::{WidgetSprite, WidgetSpriteParams},
};