ultimatepp/bazaar/Form/FormObject.hpp
koldo ac7821deb8 Form: Form core package, Editor and sample from Sc0rch
git-svn-id: svn://ultimatepp.org/upp/trunk@2412 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2010-05-19 18:38:45 +00:00

35 lines
932 B
C++

#ifndef FORM_EDITOR_HPP
#define FORM_EDITOR_HPP
#include <CtrlCore/CtrlCore.h>
using namespace Upp;
#include "XMLConfig.h"
#include "Macro.hpp"
class FormObject : public XMLConfig, Moveable<FormObject>
{
typedef FormObject CLASSNAME;
PARAMETER(Rect, Rect);
PARAMETER(dword, State);
PARAMETER(dword, HAlign);
PARAMETER(dword, VAlign);
public:
FormObject();
FormObject(const FormObject& other);
FormObject(const Rect& r);
FormObject(int x, int y, int cx, int cy);
void Xmlize(XmlIO xml);
Size GetSize() const { return _Rect.GetSize(); }
bool Intersects(const FormObject& obj) { return _Rect.Intersects(obj.GetRect()); }
int GetCenterX() const { return _Rect.left + _Rect.Width() / 2; }
int GetCenterY() const { return _Rect.top + _Rect.Height() / 2; }
bool IsSelected() { return _State == FormObject::SELECTED; }
enum { NONE, SELECTED };
};
#endif // .. FORM_EDITOR_HPP