Remove unused (de)serializeAttributes() methods

This commit is contained in:
ROllerozxa 2021-12-29 23:00:16 +01:00 committed by GitHub
parent 9b650b9efb
commit 05573d6d8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 0 additions and 274 deletions

View File

@ -632,85 +632,6 @@ bool GUIButton::isDrawingBorder() const
}
//! Writes attributes of the element.
void GUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIButton::serializeAttributes(out,options);
out->addBool ("PushButton", IsPushButton );
if (IsPushButton)
out->addBool("Pressed", Pressed);
for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )
{
if ( ButtonImages[i].Texture )
{
core::stringc name( GUIButtonImageStateNames[i] );
out->addTexture(name.c_str(), ButtonImages[i].Texture);
name += "Rect";
out->addRect(name.c_str(), ButtonImages[i].SourceRect);
}
}
out->addBool ("UseAlphaChannel", UseAlphaChannel);
out->addBool ("Border", DrawBorder);
out->addBool ("ScaleImage", ScaleImage);
for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )
{
if ( ButtonSprites[i].Index >= 0 )
{
core::stringc nameIndex( GUIButtonStateNames[i] );
nameIndex += "Index";
out->addInt(nameIndex.c_str(), ButtonSprites[i].Index );
core::stringc nameColor( GUIButtonStateNames[i] );
nameColor += "Color";
out->addColor(nameColor.c_str(), ButtonSprites[i].Color );
core::stringc nameLoop( GUIButtonStateNames[i] );
nameLoop += "Loop";
out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop );
core::stringc nameScale( GUIButtonStateNames[i] );
nameScale += "Scale";
out->addBool(nameScale.c_str(), ButtonSprites[i].Scale );
}
}
// out->addString ("OverrideFont", OverrideFont);
}
//! Reads attributes of the element
void GUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIButton::deserializeAttributes(in,options);
IsPushButton = in->getAttributeAsBool("PushButton");
Pressed = IsPushButton ? in->getAttributeAsBool("Pressed") : false;
core::rect<s32> rec = in->getAttributeAsRect("ImageRect");
if (rec.isValid())
setImage( in->getAttributeAsTexture("Image"), rec);
else
setImage( in->getAttributeAsTexture("Image") );
rec = in->getAttributeAsRect("PressedImageRect");
if (rec.isValid())
setPressedImage( in->getAttributeAsTexture("PressedImage"), rec);
else
setPressedImage( in->getAttributeAsTexture("PressedImage") );
setDrawBorder(in->getAttributeAsBool("Border"));
setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel"));
setScaleImage(in->getAttributeAsBool("ScaleImage"));
// setOverrideFont(in->getAttributeAsString("OverrideFont"));
updateAbsolutePosition();
}
// PATCH
GUIButton* GUIButton::addButton(IGUIEnvironment *environment,
const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc,

View File

@ -221,14 +221,6 @@ public:
return ClickControlState;
}
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const override;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) override;
void setColor(video::SColor color);
// PATCH
//! Set element properties from a StyleSpec corresponding to the button state

View File

@ -846,54 +846,3 @@ void GUIEditBox::updateVScrollBar()
}
}
}
void GUIEditBox::deserializeAttributes(
io::IAttributes *in, io::SAttributeReadWriteOptions *options = 0)
{
IGUIEditBox::deserializeAttributes(in, options);
setOverrideColor(in->getAttributeAsColor("OverrideColor"));
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
setMax(in->getAttributeAsInt("MaxChars"));
setWordWrap(in->getAttributeAsBool("WordWrap"));
setMultiLine(in->getAttributeAsBool("MultiLine"));
setAutoScroll(in->getAttributeAsBool("AutoScroll"));
core::stringw ch = in->getAttributeAsStringW("PasswordChar");
if (ch.empty())
setPasswordBox(in->getAttributeAsBool("PasswordBox"));
else
setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]);
setTextAlignment((EGUI_ALIGNMENT)in->getAttributeAsEnumeration(
"HTextAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration(
"VTextAlign", GUIAlignmentNames));
setWritable(in->getAttributeAsBool("Writable"));
// setOverrideFont(in->getAttributeAsFont("OverrideFont"));
}
//! Writes attributes of the element.
void GUIEditBox::serializeAttributes(
io::IAttributes *out, io::SAttributeReadWriteOptions *options = 0) const
{
// IGUIEditBox::serializeAttributes(out,options);
out->addBool("OverrideColorEnabled", m_override_color_enabled);
out->addColor("OverrideColor", m_override_color);
// out->addFont("OverrideFont",m_override_font);
out->addInt("MaxChars", m_max);
out->addBool("WordWrap", m_word_wrap);
out->addBool("MultiLine", m_multiline);
out->addBool("AutoScroll", m_autoscroll);
out->addBool("PasswordBox", m_passwordbox);
core::stringw ch = L" ";
ch[0] = m_passwordchar;
out->addString("PasswordChar", ch.c_str());
out->addEnum("HTextAlign", m_halign, GUIAlignmentNames);
out->addEnum("VTextAlign", m_valign, GUIAlignmentNames);
out->addBool("Writable", m_writable);
IGUIEditBox::serializeAttributes(out, options);
}

View File

@ -130,14 +130,6 @@ public:
//! called if an event happened.
virtual bool OnEvent(const SEvent &event);
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes *out,
io::SAttributeReadWriteOptions *options) const;
//! Reads attributes of the element
virtual void deserializeAttributes(
io::IAttributes *in, io::SAttributeReadWriteOptions *options);
virtual bool acceptsIME() { return isEnabled() && m_writable; };
protected:

View File

@ -652,26 +652,6 @@ void GUIEditBoxWithScrollBar::setBackgroundColor(const video::SColor &bg_color)
m_bg_color_used = true;
}
//! Writes attributes of the element.
void GUIEditBoxWithScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options = 0) const
{
out->addBool("Border", m_border);
out->addBool("Background", m_background);
// out->addFont("OverrideFont", OverrideFont);
GUIEditBox::serializeAttributes(out, options);
}
//! Reads attributes of the element
void GUIEditBoxWithScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options = 0)
{
GUIEditBox::deserializeAttributes(in, options);
setDrawBorder(in->getAttributeAsBool("Border"));
setDrawBackground(in->getAttributeAsBool("Background"));
}
bool GUIEditBoxWithScrollBar::isDrawBackgroundEnabled() const { return false; }
bool GUIEditBoxWithScrollBar::isDrawBorderEnabled() const { return false; }
void GUIEditBoxWithScrollBar::setCursorChar(const wchar_t cursorChar) { }

View File

@ -31,12 +31,6 @@ public:
//! Change the background color
virtual void setBackgroundColor(const video::SColor &bg_color);
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
virtual bool isDrawBackgroundEnabled() const;
virtual bool isDrawBorderEnabled() const;
virtual void setCursorChar(const wchar_t cursorChar);

View File

@ -1024,48 +1024,6 @@ void GUISkin::draw2DRectangle(IGUIElement* element,
}
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
void GUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
u32 i;
for (i=0; i<EGDC_COUNT; ++i)
out->addColor(GUISkinColorNames[i], Colors[i]);
for (i=0; i<EGDS_COUNT; ++i)
out->addInt(GUISkinSizeNames[i], Sizes[i]);
for (i=0; i<EGDT_COUNT; ++i)
out->addString(GUISkinTextNames[i], Texts[i].c_str());
for (i=0; i<EGDI_COUNT; ++i)
out->addInt(GUISkinIconNames[i], Icons[i]);
}
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
void GUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
// TODO: This is not nice code for downward compatibility, whenever new values are added and users
// load an old skin the corresponding values will be set to 0.
u32 i;
for (i=0; i<EGDC_COUNT; ++i)
Colors[i] = in->getAttributeAsColor(GUISkinColorNames[i]);
for (i=0; i<EGDS_COUNT; ++i)
Sizes[i] = in->getAttributeAsInt(GUISkinSizeNames[i]);
for (i=0; i<EGDT_COUNT; ++i)
Texts[i] = in->getAttributeAsStringW(GUISkinTextNames[i]);
for (i=0; i<EGDI_COUNT; ++i)
Icons[i] = in->getAttributeAsInt(GUISkinIconNames[i]);
}
//! gets the colors
// PATCH
void GUISkin::getColors(video::SColor* colors)

View File

@ -290,16 +290,6 @@ namespace gui
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const;
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
//! gets the colors
virtual void getColors(video::SColor* colors); // ::PATCH:

View File

@ -588,50 +588,6 @@ s32 StaticText::getTextWidth() const
}
//! Writes attributes of the element.
//! Implement this to expose the attributes of your element for
//! scripting languages, editors, debuggers or xml serialization purposes.
void StaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIStaticText::serializeAttributes(out,options);
out->addBool ("Border", Border);
out->addBool ("OverrideColorEnabled",true);
out->addBool ("OverrideBGColorEnabled",ColoredText.hasBackground());
out->addBool ("WordWrap", WordWrap);
out->addBool ("Background", Background);
out->addBool ("RightToLeft", RightToLeft);
out->addBool ("RestrainTextInside", RestrainTextInside);
out->addColor ("OverrideColor", ColoredText.getDefaultColor());
out->addColor ("BGColor", ColoredText.getBackground());
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
// out->addFont ("OverrideFont", OverrideFont);
}
//! Reads attributes of the element
void StaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIStaticText::deserializeAttributes(in,options);
Border = in->getAttributeAsBool("Border");
setWordWrap(in->getAttributeAsBool("WordWrap"));
Background = in->getAttributeAsBool("Background");
RightToLeft = in->getAttributeAsBool("RightToLeft");
RestrainTextInside = in->getAttributeAsBool("RestrainTextInside");
if (in->getAttributeAsBool("OverrideColorEnabled"))
ColoredText.setDefaultColor(in->getAttributeAsColor("OverrideColor"));
if (in->getAttributeAsBool("OverrideBGColorEnabled"))
ColoredText.setBackground(in->getAttributeAsColor("BGColor"));
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
// OverrideFont = in->getAttributeAsFont("OverrideFont");
}
} // end namespace gui
#endif // USE_FREETYPE

View File

@ -184,12 +184,6 @@ namespace gui
//! Checks if the text should be interpreted as right-to-left text
virtual bool isRightToLeft() const;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
virtual bool hasType(EGUI_ELEMENT_TYPE t) const {
return (t == EGUIET_ENRICHED_STATIC_TEXT) || (t == EGUIET_STATIC_TEXT);
};