forked from tickbh/VisualUIEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtListView.js
More file actions
96 lines (81 loc) · 2.42 KB
/
ExtListView.js
File metadata and controls
96 lines (81 loc) · 2.42 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
let ExtListView = {}
ExtListView.name = 'UIListView'
ExtListView.icon = 'app://res/control/listview.png'
ExtListView.tag = 9
ExtListView.GenEmptyNode = function() {
node = new ccui.ListView()
node.setContentSize(cc.size(200, 100))
node._className = ExtListView.name
return node
}
ExtListView.GenNodeByData = function(data, parent) {
node = new ccui.ListView()
node.setContentSize(cc.size(data.width || 200, data.height || 100))
ExtListView.SetNodePropByData(node, data, parent)
node._className = ExtListView.name
return node
}
ExtListView.SetNodePropByData = function(node, data, parent) {
(isValue(data['gravity'])) && (node.setGravity(data['gravity']));
(isValue(data['itemsMargin'])) && (node.setItemsMargin(data['itemsMargin']))
ExtScrollView.SetNodePropByData(node, data, parent)
}
ExtListView.ExportNodeData = function(node, data) {
data['gravity'] = node._gravity
data['itemsMargin'] = node._itemsMargin
ExtScrollView.ExportNodeData(node, data)
}
ExtListView.SetPropChange = function(control, path, value) {
SetDefaultPropChange(control, path, value)
}
ExtListView.NodifyPropChange = function(control) {
SetNodifyPropChange(control)
}
ExtListView.ExportData = function(node) {
this._node = node
}
ExtListView.ExportData.prototype = {
__displayName__: 'ListView',
get gravity() {
return {
path: 'gravity',
type: 'select',
name: 'gravity',
attrs: {
selects: {
0: 'LEFT',
1: 'RIGHT',
2: 'CENTER_HORIZONTAL',
3: 'TOP',
4: 'BOTTOM',
5: 'CENTER_VERTICAL'
}
},
value: this._node._gravity
}
},
get itemsMargin() {
return {
path: 'itemsMargin',
type: 'unit-input',
name: 'itemsMargin',
attrs: {},
value: this._node._itemsMargin
}
},
get __props__() {
return [
this.gravity,
this.itemsMargin
]
}
}
ExtListView.PropComps = function(node) {
let datas = [new WidgetData(node)]
datas.push(new TouchData(node))
datas.push(new ExtListView.ExportData(node))
datas.push(new ExtScrollView.ExportData(node))
return datas
}
module.exports = ExtListView
RegisterExtNodeControl(ExtListView.name, ExtListView)