Repository navigation
Expand file tree
/
Copy pathUEPySPythonMultiColumnTableRow.h
More file actions
105 lines (86 loc) · 2.99 KB
/
Copy pathUEPySPythonMultiColumnTableRow.h
File metadata and controls
105 lines (86 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#pragma once
#include "UEPySCompoundWidget.h"
extern PyTypeObject ue_PySCompoundWidgetType;
extern PyTypeObject ue_PySTableViewBaseType;
class SPythonMultiColumnTableRow : public SMultiColumnTableRow<TSharedPtr<struct FPythonItem>>
{
public:
SLATE_BEGIN_ARGS(SPythonMultiColumnTableRow) {}
SLATE_END_ARGS();
void Construct(const FArguments& InArgs, const TSharedRef<STableViewBase>& InOwnerTableView, PyObject *in_py_self)
{
SetPyObject(in_py_self);
SMultiColumnTableRow<TSharedPtr<struct FPythonItem>>::Construct(FSuperRowType::FArguments(), InOwnerTableView);
}
TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName)
{
FScopePythonGIL gil;
if (!PyObject_HasAttrString(self, (char *)"generate_widget_for_column"))
return SNullWidget::NullWidget;
PyObject *py_callable_generate_widget_for_column = PyObject_GetAttrString(self, (char *)"generate_widget_for_column");
if (!PyCallable_Check(py_callable_generate_widget_for_column))
{
UE_LOG(LogPython, Error, TEXT("generate_widget_for_column is not a callable"));
return SNullWidget::NullWidget;
}
PyObject *ret = PyObject_CallFunction(py_callable_generate_widget_for_column, (char *)"s", TCHAR_TO_UTF8(*ColumnName.ToString()));
if (!ret)
{
unreal_engine_py_log_error();
return SNullWidget::NullWidget;
}
TSharedPtr<SWidget> Widget = py_ue_is_swidget<SWidget>(ret);
if (!Widget.IsValid())
{
Py_DECREF(ret);
UE_LOG(LogPython, Error, TEXT("returned value is not a SWidget"));
return SNullWidget::NullWidget;
}
Py_DECREF(ret);
return Widget.ToSharedRef();
}
FReply OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent)
{
FScopePythonGIL gil;
if (PyObject_HasAttrString(self, (char *)"on_mouse_button_double_click"))
{
PyObject *py_callable_on_mouse_button_double_click = PyObject_GetAttrString(self, (char *)"on_mouse_button_double_click");
if (!PyCallable_Check(py_callable_on_mouse_button_double_click))
{
UE_LOG(LogPython, Error, TEXT("on_mouse_button_double_click is not a callable"));
return FReply::Unhandled();
}
PyObject *ret = PyObject_CallFunction(py_callable_on_mouse_button_double_click, (char *)"OO", py_ue_new_fgeometry(InMyGeometry), py_ue_new_fpointer_event(InMouseEvent));
if (!ret)
{
unreal_engine_py_log_error();
return FReply::Unhandled();
}
if (ret == Py_False)
{
Py_DECREF(ret);
return FReply::Unhandled();
}
Py_DECREF(ret);
return FReply::Handled();
}
else
{
return SPythonMultiColumnTableRow::OnMouseButtonDoubleClick(InMyGeometry, InMouseEvent);
}
}
void SetPyObject(PyObject *py_obj)
{
self = py_obj;
}
private:
PyObject * self = nullptr;
TSharedPtr<struct FPythonItem> RowPythonObject;
};
typedef struct
{
ue_PySCompoundWidget s_compound_widget;
/* Type-specific fields go here. */
} ue_PySPythonMultiColumnTableRow;
void ue_python_init_spython_multicolumn_table_row(PyObject *);
ue_PySPythonMultiColumnTableRow *py_ue_is_spython_multicolumn_table_row(PyObject *);