Skip to content

Commit 66430a4

Browse files
author
Roberto De Ioris
committed
Added padding and h/v align to SPadding
1 parent 588f187 commit 66430a4

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

Source/UnrealEnginePython/Private/Slate/UEPySBorder.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,59 @@ static PyObject *py_ue_sborder_set_content(ue_PySBorder *self, PyObject * args)
3838
return (PyObject *)self;
3939
}
4040

41+
static PyObject *py_ue_sborder_set_padding(ue_PySBorder *self, PyObject * args) {
42+
PyObject *py_padding;
43+
if (!PyArg_ParseTuple(args, "O:set_padding", &py_padding)) {
44+
return NULL;
45+
}
46+
47+
FMargin *margin = ue_py_check_struct<FMargin>(py_padding);
48+
if (!margin) {
49+
if (!PyNumber_Check(py_padding)) {
50+
return PyErr_Format(PyExc_Exception, "argument is not a FMargin or a number");
51+
}
52+
PyObject *py_float = PyNumber_Float(py_padding);
53+
FMargin new_margin(PyFloat_AsDouble(py_float));
54+
margin = &new_margin;
55+
Py_DECREF(py_float);
56+
}
57+
58+
GET_s_border;
59+
60+
s_border->SetPadding(*margin);
61+
62+
Py_INCREF(self);
63+
return (PyObject *)self;
64+
}
65+
66+
static PyObject *py_ue_sborder_set_h_align(ue_PySBorder *self, PyObject * args) {
67+
int align;
68+
if (!PyArg_ParseTuple(args, "i:set_h_align", &align)) {
69+
return NULL;
70+
}
71+
72+
GET_s_border;
73+
74+
s_border->SetHAlign((EHorizontalAlignment)align);
75+
76+
Py_INCREF(self);
77+
return (PyObject *)self;
78+
}
79+
80+
static PyObject *py_ue_sborder_set_v_align(ue_PySBorder *self, PyObject * args) {
81+
int align;
82+
if (!PyArg_ParseTuple(args, "i:set_v_align", &align)) {
83+
return NULL;
84+
}
85+
86+
GET_s_border;
87+
88+
s_border->SetVAlign((EVerticalAlignment)align);
89+
90+
Py_INCREF(self);
91+
return (PyObject *)self;
92+
}
93+
4194
static PyObject *ue_PySBorder_str(ue_PySBorder *self)
4295
{
4396
return PyUnicode_FromFormat("<unreal_engine.SBorder '%p'>",
@@ -47,6 +100,9 @@ static PyObject *ue_PySBorder_str(ue_PySBorder *self)
47100
static PyMethodDef ue_PySBorder_methods[] = {
48101
{ "clear_content", (PyCFunction)py_ue_sborder_clear_content, METH_VARARGS, "" },
49102
{ "set_content", (PyCFunction)py_ue_sborder_set_content, METH_VARARGS, "" },
103+
{ "set_padding", (PyCFunction)py_ue_sborder_set_padding, METH_VARARGS, "" },
104+
{ "set_h_align", (PyCFunction)py_ue_sborder_set_h_align, METH_VARARGS, "" },
105+
{ "set_v_align", (PyCFunction)py_ue_sborder_set_v_align, METH_VARARGS, "" },
50106
{ NULL } /* Sentinel */
51107
};
52108

0 commit comments

Comments
 (0)