mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-22 13:17:36 -06:00
Form: Form core package, Editor and sample from Sc0rch
git-svn-id: svn://ultimatepp.org/upp/trunk@2412 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0fb04dddb0
commit
ac7821deb8
57 changed files with 66478 additions and 0 deletions
53
bazaar/Form/FormObject.cpp
Normal file
53
bazaar/Form/FormObject.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include "FormObject.hpp"
|
||||
|
||||
FormObject::FormObject() : _Rect(Rect(Point(10, 10), Size(120, 30))), _HAlign(Ctrl::LEFT),
|
||||
_VAlign(Ctrl::TOP), _State(FormObject::NONE)
|
||||
{
|
||||
Name = "Noname";
|
||||
Set("Variable", "None");
|
||||
Set("Frame", "Default frame");
|
||||
}
|
||||
|
||||
FormObject::FormObject(const FormObject& other)
|
||||
{
|
||||
*this = other;
|
||||
_Rect = other.GetRect();
|
||||
_State = other.GetState();
|
||||
_HAlign = other.GetHAlign();
|
||||
_VAlign = other.GetVAlign();
|
||||
}
|
||||
|
||||
FormObject::FormObject(const Rect& r)
|
||||
: _Rect(r), _HAlign(Ctrl::LEFT), _VAlign(Ctrl::TOP), _State(FormObject::NONE)
|
||||
{
|
||||
Name = "Noname";
|
||||
Set("Variable", "None");
|
||||
Set("Frame", "Default frame");
|
||||
}
|
||||
|
||||
FormObject::FormObject(int x, int y, int cx, int cy) : _Rect(Rect(Point(x, y), Size(cx, cy))),
|
||||
_HAlign(Ctrl::LEFT), _VAlign(Ctrl::TOP), _State(FormObject::NONE)
|
||||
{
|
||||
Name = "Noname";
|
||||
Set("Variable", "None");
|
||||
Set("Frame", "Default frame");
|
||||
}
|
||||
|
||||
void FormObject::Xmlize(XmlIO xml)
|
||||
{
|
||||
xml.Attr("x", _Rect.left).Attr("y", _Rect.top);
|
||||
|
||||
int cx = _Rect.Width();
|
||||
int cy = _Rect.Height();
|
||||
|
||||
xml.Attr("cx", cx).Attr("cy", cy);
|
||||
|
||||
if (xml.IsLoading())
|
||||
{
|
||||
_Rect.right = _Rect.left + cx;
|
||||
_Rect.bottom = _Rect.top + cy;
|
||||
}
|
||||
|
||||
xml.Attr("align", _HAlign).Attr("valign", _VAlign);
|
||||
XMLConfig::Xmlize(xml);
|
||||
}
|
||||
Loading…
Reference in a new issue