#pragma once #include "Common.h" #include "Python.h" #include "structmember.h" #include "IndexTexture.h" #include "Resources.h" #include #include "PyCallable.h" #include "PyColor.h" #include "PyVector.h" #include "UIDrawable.h" #include "UIBase.h" //class UIFrame; // //typedef struct { // PyObject_HEAD // std::shared_ptr data; //} PyUIFrameObject; class UIFrame: public UIDrawable { public: UIFrame(float, float, float, float); UIFrame(); ~UIFrame(); sf::RectangleShape box; float outline; std::shared_ptr>> children; void render(sf::Vector2f) override final; void move(sf::Vector2f); PyObjectsEnum derived_type() override final; virtual UIDrawable* click_at(sf::Vector2f point) override final; static PyObject* get_children(PyUIFrameObject* self, void* closure); static PyObject* get_float_member(PyUIFrameObject* self, void* closure); static int set_float_member(PyUIFrameObject* self, PyObject* value, void* closure); static PyObject* get_color_member(PyUIFrameObject* self, void* closure); static int set_color_member(PyUIFrameObject* self, PyObject* value, void* closure); static PyGetSetDef getsetters[]; static PyObject* repr(PyUIFrameObject* self); static int init(PyUIFrameObject* self, PyObject* args, PyObject* kwds); }; namespace mcrfpydef { static PyTypeObject PyUIFrameType = { //PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "mcrfpy.Frame", .tp_basicsize = sizeof(PyUIFrameObject), .tp_itemsize = 0, .tp_dealloc = (destructor)[](PyObject* self) { PyUIFrameObject* obj = (PyUIFrameObject*)self; obj->data.reset(); Py_TYPE(self)->tp_free(self); }, .tp_repr = (reprfunc)UIFrame::repr, //.tp_hash = NULL, //.tp_iter //.tp_iternext .tp_flags = Py_TPFLAGS_DEFAULT, .tp_doc = PyDoc_STR("docstring"), //.tp_methods = PyUIFrame_methods, //.tp_members = PyUIFrame_members, .tp_getset = UIFrame::getsetters, //.tp_base = NULL, .tp_init = (initproc)UIFrame::init, .tp_new = [](PyTypeObject* type, PyObject* args, PyObject* kwds) -> PyObject* { PyUIFrameObject* self = (PyUIFrameObject*)type->tp_alloc(type, 0); if (self) self->data = std::make_shared(); return (PyObject*)self; } }; }