@@ -36,34 +36,34 @@ static PyObject *py_ue_swidget_set_visibility(ue_PySWidget *self, PyObject * arg
3636 return nullptr ;
3737 }
3838
39- if (!PyNumber_Check (py_object))
40- {
41- return PyErr_Format (PyExc_Exception, " argument is not a ESlateVisibility" );
42- }
43-
44- PyObject *py_value = PyNumber_Long (py_object);
45- ESlateVisibility slateVisibility = (ESlateVisibility)PyLong_AsLong (py_value);
46- Py_DECREF (py_value);
47-
48- EVisibility visibility;
49- switch (slateVisibility)
50- {
51- case ESlateVisibility::Visible:
52- visibility = EVisibility::Visible;
53- break ;
54- case ESlateVisibility::Collapsed:
55- visibility = EVisibility::Collapsed;
56- break ;
57- case ESlateVisibility::Hidden:
58- visibility = EVisibility::Hidden;
59- break ;
60- case ESlateVisibility::HitTestInvisible:
61- visibility = EVisibility::HitTestInvisible;
62- break ;
63- case ESlateVisibility::SelfHitTestInvisible:
64- visibility = EVisibility::SelfHitTestInvisible;
65- break ;
66- }
39+ if (!PyNumber_Check (py_object))
40+ {
41+ return PyErr_Format (PyExc_Exception, " argument is not a ESlateVisibility" );
42+ }
43+
44+ PyObject *py_value = PyNumber_Long (py_object);
45+ ESlateVisibility slateVisibility = (ESlateVisibility)PyLong_AsLong (py_value);
46+ Py_DECREF (py_value);
47+
48+ EVisibility visibility;
49+ switch (slateVisibility)
50+ {
51+ case ESlateVisibility::Visible:
52+ visibility = EVisibility::Visible;
53+ break ;
54+ case ESlateVisibility::Collapsed:
55+ visibility = EVisibility::Collapsed;
56+ break ;
57+ case ESlateVisibility::Hidden:
58+ visibility = EVisibility::Hidden;
59+ break ;
60+ case ESlateVisibility::HitTestInvisible:
61+ visibility = EVisibility::HitTestInvisible;
62+ break ;
63+ case ESlateVisibility::SelfHitTestInvisible:
64+ visibility = EVisibility::SelfHitTestInvisible;
65+ break ;
66+ }
6767
6868 self->s_widget ->SetVisibility (visibility);
6969
@@ -258,6 +258,36 @@ static PyObject *py_ue_swidget_invalidate(ue_PySWidget *self, PyObject * args)
258258 Py_RETURN_NONE;
259259}
260260
261+ static PyObject *py_ue_swidget_on_mouse_button_down (ue_PySWidget *self, PyObject * args)
262+ {
263+ PyObject *py_geometry;
264+ PyObject *py_pointer_event;
265+ if (!PyArg_ParseTuple (args, " OO:on_mouse_button_down" , &py_geometry, &py_pointer_event))
266+ {
267+ return nullptr ;
268+ }
269+
270+ ue_PyFGeometry *geometry = py_ue_is_fgeometry (py_geometry);
271+ if (!geometry)
272+ {
273+ return PyErr_Format (PyExc_Exception, " argument is not a FGeomtry" );
274+ }
275+
276+ ue_PyFPointerEvent *pointer = py_ue_is_fpointer_event (py_pointer_event);
277+ if (!pointer)
278+ {
279+ return PyErr_Format (PyExc_Exception, " argument is not a FPointerEvent" );
280+ }
281+
282+ FReply reply = self->s_widget ->OnMouseButtonDown (geometry->geometry , pointer->pointer );
283+
284+ if (reply.IsEventHandled ())
285+ {
286+ Py_RETURN_TRUE;
287+ }
288+
289+ Py_RETURN_FALSE;
290+ }
261291
262292static PyMethodDef ue_PySWidget_methods[] = {
263293 { " get_shared_reference_count" , (PyCFunction)py_ue_swidget_get_shared_reference_count, METH_VARARGS , " " },
@@ -276,6 +306,7 @@ static PyMethodDef ue_PySWidget_methods[] = {
276306 { " bind_on_mouse_double_click" , (PyCFunction)py_ue_swidget_bind_on_mouse_double_click, METH_VARARGS , " " },
277307 { " bind_on_mouse_move" , (PyCFunction)py_ue_swidget_bind_on_mouse_move, METH_VARARGS , " " },
278308#endif
309+ { " on_mouse_button_down" , (PyCFunction)py_ue_swidget_on_mouse_button_down, METH_VARARGS , " " },
279310 { NULL } /* Sentinel */
280311};
281312
0 commit comments