}\r
\r
\r
-//! Writes attributes of the element.\r
-void GUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const\r
-{\r
- IGUIButton::serializeAttributes(out,options);\r
-\r
- out->addBool ("PushButton", IsPushButton );\r
- if (IsPushButton)\r
- out->addBool("Pressed", Pressed);\r
-\r
- for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )\r
- {\r
- if ( ButtonImages[i].Texture )\r
- {\r
- core::stringc name( GUIButtonImageStateNames[i] );\r
- out->addTexture(name.c_str(), ButtonImages[i].Texture);\r
- name += "Rect";\r
- out->addRect(name.c_str(), ButtonImages[i].SourceRect);\r
- }\r
- }\r
-\r
- out->addBool ("UseAlphaChannel", UseAlphaChannel);\r
- out->addBool ("Border", DrawBorder);\r
- out->addBool ("ScaleImage", ScaleImage);\r
-\r
- for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )\r
- {\r
- if ( ButtonSprites[i].Index >= 0 )\r
- {\r
- core::stringc nameIndex( GUIButtonStateNames[i] );\r
- nameIndex += "Index";\r
- out->addInt(nameIndex.c_str(), ButtonSprites[i].Index );\r
-\r
- core::stringc nameColor( GUIButtonStateNames[i] );\r
- nameColor += "Color";\r
- out->addColor(nameColor.c_str(), ButtonSprites[i].Color );\r
-\r
- core::stringc nameLoop( GUIButtonStateNames[i] );\r
- nameLoop += "Loop";\r
- out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop );\r
-\r
- core::stringc nameScale( GUIButtonStateNames[i] );\r
- nameScale += "Scale";\r
- out->addBool(nameScale.c_str(), ButtonSprites[i].Scale );\r
- }\r
- }\r
-\r
- // out->addString ("OverrideFont", OverrideFont);\r
-}\r
-\r
-\r
-//! Reads attributes of the element\r
-void GUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)\r
-{\r
- IGUIButton::deserializeAttributes(in,options);\r
-\r
- IsPushButton = in->getAttributeAsBool("PushButton");\r
- Pressed = IsPushButton ? in->getAttributeAsBool("Pressed") : false;\r
-\r
- core::rect<s32> rec = in->getAttributeAsRect("ImageRect");\r
- if (rec.isValid())\r
- setImage( in->getAttributeAsTexture("Image"), rec);\r
- else\r
- setImage( in->getAttributeAsTexture("Image") );\r
-\r
- rec = in->getAttributeAsRect("PressedImageRect");\r
- if (rec.isValid())\r
- setPressedImage( in->getAttributeAsTexture("PressedImage"), rec);\r
- else\r
- setPressedImage( in->getAttributeAsTexture("PressedImage") );\r
-\r
- setDrawBorder(in->getAttributeAsBool("Border"));\r
- setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel"));\r
- setScaleImage(in->getAttributeAsBool("ScaleImage"));\r
-\r
- // setOverrideFont(in->getAttributeAsString("OverrideFont"));\r
-\r
- updateAbsolutePosition();\r
-}\r
-\r
// PATCH\r
GUIButton* GUIButton::addButton(IGUIEnvironment *environment,\r
const core::rect<s32>& rectangle, ISimpleTextureSource *tsrc,\r
return ClickControlState;\r
}\r
\r
- //! Writes attributes of the element.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const override;\r
-\r
- //! Reads attributes of the element\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) override;\r
-\r
-\r
-\r
void setColor(video::SColor color);\r
// PATCH\r
//! Set element properties from a StyleSpec corresponding to the button state\r
}
}
}
-
-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);
-}
//! 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:
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) { }
//! 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);
}\r
\r
\r
-//! Writes attributes of the object.\r
-//! Implement this to expose the attributes of your scene node animator for\r
-//! scripting languages, editors, debuggers or xml serialization purposes.\r
-void GUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- u32 i;\r
- for (i=0; i<EGDC_COUNT; ++i)\r
- out->addColor(GUISkinColorNames[i], Colors[i]);\r
-\r
- for (i=0; i<EGDS_COUNT; ++i)\r
- out->addInt(GUISkinSizeNames[i], Sizes[i]);\r
-\r
- for (i=0; i<EGDT_COUNT; ++i)\r
- out->addString(GUISkinTextNames[i], Texts[i].c_str());\r
-\r
- for (i=0; i<EGDI_COUNT; ++i)\r
- out->addInt(GUISkinIconNames[i], Icons[i]);\r
-}\r
-\r
-\r
-//! Reads attributes of the object.\r
-//! Implement this to set the attributes of your scene node animator for\r
-//! scripting languages, editors, debuggers or xml deserialization purposes.\r
-void GUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- // TODO: This is not nice code for downward compatibility, whenever new values are added and users\r
- // load an old skin the corresponding values will be set to 0.\r
- u32 i;\r
- for (i=0; i<EGDC_COUNT; ++i)\r
- Colors[i] = in->getAttributeAsColor(GUISkinColorNames[i]);\r
-\r
- for (i=0; i<EGDS_COUNT; ++i)\r
- Sizes[i] = in->getAttributeAsInt(GUISkinSizeNames[i]);\r
-\r
- for (i=0; i<EGDT_COUNT; ++i)\r
- Texts[i] = in->getAttributeAsStringW(GUISkinTextNames[i]);\r
-\r
- for (i=0; i<EGDI_COUNT; ++i)\r
- Icons[i] = in->getAttributeAsInt(GUISkinIconNames[i]);\r
-}\r
-\r
-\r
//! gets the colors\r
// PATCH\r
void GUISkin::getColors(video::SColor* colors)\r
//! get the type of this skin\r
virtual EGUI_SKIN_TYPE getType() const;\r
\r
- //! Writes attributes of the object.\r
- //! Implement this to expose the attributes of your scene node animator for\r
- //! scripting languages, editors, debuggers or xml serialization purposes.\r
- virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;\r
-\r
- //! Reads attributes of the object.\r
- //! Implement this to set the attributes of your scene node animator for\r
- //! scripting languages, editors, debuggers or xml deserialization purposes.\r
- virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);\r
-\r
//! gets the colors\r
virtual void getColors(video::SColor* colors); // ::PATCH:\r
\r
}
-//! 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
//! 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);
};