mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Remove unused attribute saving and loading (#86)
This commit is contained in:
@ -685,86 +685,6 @@ bool CGUIListBox::getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::str
|
||||
}
|
||||
|
||||
|
||||
//! Writes attributes of the element.
|
||||
void CGUIListBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
|
||||
{
|
||||
IGUIListBox::serializeAttributes(out,options);
|
||||
|
||||
// todo: out->addString ("IconBank", IconBank->getName?);
|
||||
out->addBool ("DrawBack", DrawBack);
|
||||
out->addBool ("MoveOverSelect", MoveOverSelect);
|
||||
out->addBool ("AutoScroll", AutoScroll);
|
||||
|
||||
out->addInt("ItemCount", Items.size());
|
||||
for (u32 i=0;i<Items.size(); ++i)
|
||||
{
|
||||
core::stringc label("text");
|
||||
label += i;
|
||||
out->addString(label.c_str(), Items[i].Text.c_str() );
|
||||
|
||||
for ( s32 c=0; c < (s32)EGUI_LBC_COUNT; ++c )
|
||||
{
|
||||
core::stringc useColorLabel, colorLabel;
|
||||
if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) )
|
||||
return;
|
||||
label = useColorLabel; label += i;
|
||||
if ( Items[i].OverrideColors[c].Use )
|
||||
{
|
||||
out->addBool(label.c_str(), true );
|
||||
label = colorLabel; label += i;
|
||||
out->addColor(label.c_str(), Items[i].OverrideColors[c].Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
out->addBool(label.c_str(), false );
|
||||
}
|
||||
}
|
||||
}
|
||||
out->addInt("Selected", Selected);
|
||||
}
|
||||
|
||||
|
||||
//! Reads attributes of the element
|
||||
void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
|
||||
{
|
||||
clear();
|
||||
|
||||
DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);
|
||||
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);
|
||||
AutoScroll = in->getAttributeAsBool("AutoScroll", AutoScroll);
|
||||
|
||||
IGUIListBox::deserializeAttributes(in,options);
|
||||
|
||||
const s32 count = in->getAttributeAsInt("ItemCount");
|
||||
for (s32 i=0; i<count; ++i)
|
||||
{
|
||||
core::stringc label("text");
|
||||
ListItem item;
|
||||
|
||||
label += i;
|
||||
item.Text = in->getAttributeAsStringW(label.c_str());
|
||||
|
||||
addItem(item.Text.c_str(), item.Icon);
|
||||
|
||||
for ( u32 c=0; c < EGUI_LBC_COUNT; ++c )
|
||||
{
|
||||
core::stringc useColorLabel, colorLabel;
|
||||
if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) )
|
||||
return;
|
||||
label = useColorLabel; label += i;
|
||||
Items[i].OverrideColors[c].Use = in->getAttributeAsBool(label.c_str());
|
||||
if ( Items[i].OverrideColors[c].Use )
|
||||
{
|
||||
label = colorLabel; label += i;
|
||||
Items[i].OverrideColors[c].Color = in->getAttributeAsColor(label.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
Selected = in->getAttributeAsInt("Selected", Selected);
|
||||
recalculateScrollPos();
|
||||
}
|
||||
|
||||
|
||||
void CGUIListBox::recalculateItemWidth(s32 icon)
|
||||
{
|
||||
if (IconBank && icon > -1 &&
|
||||
|
Reference in New Issue
Block a user