#include "CtrlCore.h" using namespace boost::python; NAMESPACE_UPP void export_Logc() { ONCELOCK { enum_("choice") .value("center", Ctrl::CENTER) .value("middle", Ctrl::MIDDLE) .value("left", Ctrl::LEFT) .value("right", Ctrl::RIGHT) .value("top", Ctrl::TOP) .value("bottom", Ctrl::BOTTOM) .value("size", Ctrl::SIZE) .value("minsize", Ctrl::MINSIZE) .value("maxsize", Ctrl::MAXSIZE) .value("stdsize", Ctrl::STDSIZE) ; class_("Logc", "Upp Ctrl::Logc") .def(init()) .add_property("align", &Ctrl::Logc::GetAlign, &Ctrl::Logc::SetAlign) .add_property("a", &Ctrl::Logc::GetA, &Ctrl::Logc::SetA) .add_property("b", &Ctrl::Logc::GetB, &Ctrl::Logc::SetB) .def("isempty", &Ctrl::Logc::IsEmpty) // .def("__str__", &AsString) ; } } void export_LogPos() { ONCELOCK { export_Logc(); class_("LogPos", "Upp Ctrl::LogPos") .def(init()) .def_readwrite("x", &Ctrl::LogPos::x) .def_readwrite("y", &Ctrl::LogPos::y) // .def("__str__", &AsString) //FIXME LogPosCtrl ; } } //virtuals bool CtrlAccept(Ctrl& c) { return c.Accept(); } void CtrlReject(Ctrl& c) { c.Reject(); } void CtrlSetModify(Ctrl& c, bool b) { if (b) c.SetModify(); else c.ClearModify(); } bool CtrlIsModified(const Ctrl& c) { return c.IsModified(); } Value CtrlGetData(const Ctrl& c) { return c.GetData(); } void CtrlSetData(Ctrl& c, const Value& data) { c.SetData(data); } //return ignorers void CtrlWantFocus(Ctrl& c, bool b) { c.WantFocus(b); } void CtrlInitFocus(Ctrl& c, bool b) { c.InitFocus(b); } void CtrlSetEditable(Ctrl& c, bool b) { c.SetEditable(b); } void CtrlSetPos(Ctrl& c, const Ctrl::LogPos& p) { c.SetPos(p); } void CtrlSetTip(Ctrl& c, const String& s) { c.Tip(s); } void CtrlTransparent(Ctrl& c, bool b) { c.Transparent(b); } //other void CtrlSetFocus(Ctrl& c, bool b) { if(b) c.SetFocus(); else if(c.GetParent()) c.GetParent()->SetFocus(); } void CtrlSetBackPaint(Ctrl& c, bool b) { c.BackPaint(b?(Ctrl::FULLBACKPAINT):(Ctrl::NOBACKPAINT)); } bool CtrlIsBackPaint(const Ctrl& c) { return (c.GetBackPaint()!=Ctrl::NOBACKPAINT); } String CtrlToString(const Ctrl& c) { return String().Cat() << String(typeid(c).name()) << ": " << AsString(c.GetData()); } // void export_CtrlCore() { ONCELOCK { export_Core(); export_LogPos(); class_("Ctrl", "Upp Ctrl", no_init) .def("posleft", &Ctrl::PosLeft) .staticmethod("posleft") .def("posright", &Ctrl::PosRight) .staticmethod("posright") .def("postop", &Ctrl::PosTop) .staticmethod("postop") .def("posbottom", &Ctrl::PosBottom) .staticmethod("posbottom") .def("possize", &Ctrl::PosSize) .staticmethod("possize") .def("poscenter", (Ctrl::Logc (*)(int, int))&Ctrl::PosCenter) .staticmethod("poscenter") .def("accept", &CtrlAccept) .def("reject", &CtrlReject) .add_property("data", &CtrlGetData, &CtrlSetData) .add_property("modify", &CtrlIsModified, &CtrlSetModify) .def("resetmodify", &Ctrl::ResetModify) .add_property("pos", &Ctrl::GetPos, &CtrlSetPos) .add_property("rect", &Ctrl::GetRect, (void (Ctrl::*)(const Rect&))&Ctrl::SetRect) .add_property("size", &Ctrl::GetSize) //FIXME pos stuff .add_property("focus", &Ctrl::HasFocus, &CtrlSetFocus) .add_property("wantfocus", &CtrlWantFocus, &Ctrl::IsWantFocus) .add_property("initfocus", &Ctrl::IsInitFocus, &CtrlInitFocus) .add_property("show", &Ctrl::IsVisible, &Ctrl::Show) .add_property("shown", &Ctrl::IsShown) .add_property("enable", &Ctrl::IsEnabled, &Ctrl::Enable) .add_property("edit", &Ctrl::IsEditable, &CtrlSetEditable) .def("update", &Ctrl::Update) .def("action", &Ctrl::Action) .def("refresh", (void (Ctrl::*)(void))&Ctrl::Refresh) .add_property("backpaint", &CtrlIsBackPaint, &CtrlSetBackPaint) .add_property("transparent", &Ctrl::IsTransparent, &CtrlTransparent) .add_property("tip", &Ctrl::GetTip, &CtrlSetTip) .def("__str__", &CtrlToString) ; } } END_UPP_NAMESPACE