summaryrefslogtreecommitdiff
path: root/meta/3rd/Cocos4.0/library/ccui.Widget.lua
blob: 44c79f9bd14500fa6ca52c999f3c8d464bb2c4bc (plain)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
---@meta

---@class ccui.Widget :cc.ProtectedNode@all parent class: ProtectedNode,LayoutParameterProtocol
local Widget={ }
ccui.Widget=Widget




---* Toggle layout component enable.<br>
---* param enable Layout Component of a widget
---@param enable boolean
---@return self
function Widget:setLayoutComponentEnabled (enable) end
---* Changes the percent that is widget's percent size<br>
---* param percent that is widget's percent size
---@param percent vec2_table
---@return self
function Widget:setSizePercent (percent) end
---* Get the user defined widget size.<br>
---* return User defined size.
---@return size_table
function Widget:getCustomSize () end
---* Gets the left boundary position of this widget in parent's coordination system.<br>
---* return The left boundary position of this widget.
---@return float
function Widget:getLeftBoundary () end
---* Sets whether the widget should be flipped horizontally or not.<br>
---* param flippedX true if the widget should be flipped horizontally, false otherwise.
---@param flippedX boolean
---@return self
function Widget:setFlippedX (flippedX) end
---* Set callback name.<br>
---* param callbackName A string representation of callback name.
---@param callbackName string
---@return self
function Widget:setCallbackName (callbackName) end
---* Gets the inner Renderer node of widget.<br>
---* For example, a button's Virtual Renderer is it's texture renderer.<br>
---* return Node pointer.
---@return cc.Node
function Widget:getVirtualRenderer () end
---* brief Allow widget touch events to propagate to its parents. Set false will disable propagation<br>
---* param isPropagate  True to allow propagation, false otherwise.<br>
---* since v3.3
---@param isPropagate boolean
---@return self
function Widget:setPropagateTouchEvents (isPropagate) end
---* Query whether unify size enable state. <br>
---* return true represent the widget use Unify Size, false represent the widget couldn't use Unify Size
---@return boolean
function Widget:isUnifySizeEnabled () end
---* Get size percent of widget.<br>
---* return Percent size.
---@return vec2_table
function Widget:getSizePercent () end
---* Set the percent(x,y) of the widget in OpenGL coordinates<br>
---* param percent  The percent (x,y) of the widget in OpenGL coordinates
---@param percent vec2_table
---@return self
function Widget:setPositionPercent (percent) end
---* Toggle widget swallow touch option.<br>
---* brief Specify widget to swallow touches or not<br>
---* param swallow True to swallow touch, false otherwise.<br>
---* since v3.3
---@param swallow boolean
---@return self
function Widget:setSwallowTouches (swallow) end
---* Get the content size of widget.<br>
---* warning This API exists mainly for keeping back compatibility.<br>
---* return 
---@return size_table
function Widget:getLayoutSize () end
---* Sets whether the widget is highlighted<br>
---* The default value is false, a widget is default to not highlighted<br>
---* param highlight   true if the widget is highlighted, false if the widget is not highlighted.
---@param highlight boolean
---@return self
function Widget:setHighlighted (highlight) end
---* Changes the position type of the widget<br>
---* see `PositionType`<br>
---* param type  the position type of widget
---@param type int
---@return self
function Widget:setPositionType (type) end
---* Query whether the widget ignores user defined content size or not<br>
---* return True means ignore user defined content size, false otherwise.
---@return boolean
function Widget:isIgnoreContentAdaptWithSize () end
---* Get the virtual renderer's size<br>
---* return Widget virtual renderer size.
---@return size_table
function Widget:getVirtualRendererSize () end
---* Determines if the widget is highlighted<br>
---* return true if the widget is highlighted, false if the widget is not highlighted.
---@return boolean
function Widget:isHighlighted () end
---* Gets LayoutParameter of widget.<br>
---* see LayoutParameter<br>
---* return LayoutParameter
---@return ccui.LayoutParameter
function Widget:getLayoutParameter () end
---* Gets the position type of the widget<br>
---* see `PositionType`<br>
---* return type  the position type of widget
---@return int
function Widget:getPositionType () end
---* Gets the top boundary position of this widget in parent's coordination system.<br>
---* return The top boundary position of this widget.
---@return float
function Widget:getTopBoundary () end
---* Toggle whether ignore user defined content size for widget.<br>
---* Set true will ignore user defined content size which means <br>
---* the widget size is always equal to the return value of `getVirtualRendererSize`.<br>
---* param ignore set member variable _ignoreSize to ignore
---@param ignore boolean
---@return self
function Widget:ignoreContentAdaptWithSize (ignore) end
---* When a widget is in a layout, you could call this method to get the next focused widget within a specified direction. <br>
---* If the widget is not in a layout, it will return itself<br>
---* param direction the direction to look for the next focused widget in a layout<br>
---* param current  the current focused widget<br>
---* return the next focused widget in a layout
---@param direction int
---@param current ccui.Widget
---@return self
function Widget:findNextFocusedWidget (direction,current) end
---* Determines if the widget is enabled or not.<br>
---* return true if the widget is enabled, false if the widget is disabled.
---@return boolean
function Widget:isEnabled () end
---* Query whether widget is focused or not.<br>
---* return  whether the widget is focused or not
---@return boolean
function Widget:isFocused () end
---* Gets the touch began point of widget when widget is selected.<br>
---* return the touch began point.
---@return vec2_table
function Widget:getTouchBeganPosition () end
---* Determines if the widget is touch enabled<br>
---* return true if the widget is touch enabled, false if the widget is touch disabled.
---@return boolean
function Widget:isTouchEnabled () end
---* Query callback name.<br>
---* return The callback name.
---@return string
function Widget:getCallbackName () end
---* Get the action tag.<br>
---* return Action tag.
---@return int
function Widget:getActionTag () end
---* Gets position of widget in world space.<br>
---* return Position of widget in world space.
---@return vec2_table
function Widget:getWorldPosition () end
---* Query widget's focus enable state.<br>
---* return true represent the widget could accept focus, false represent the widget couldn't accept focus
---@return boolean
function Widget:isFocusEnabled () end
---* Toggle widget focus status.<br>
---* param focus  pass true to let the widget get focus or pass false to let the widget lose focus
---@param focus boolean
---@return self
function Widget:setFocused (focus) end
---* Set the tag of action.<br>
---* param tag  A integer tag value.
---@param tag int
---@return self
function Widget:setActionTag (tag) end
---* Sets whether the widget is touch enabled.<br>
---* The default value is false, a widget is default to touch disabled.<br>
---* param enabled   True if the widget is touch enabled, false if the widget is touch disabled.
---@param enabled boolean
---@return self
function Widget:setTouchEnabled (enabled) end
---* Sets whether the widget should be flipped vertically or not.<br>
---* param flippedY true if the widget should be flipped vertically, false otherwise.
---@param flippedY boolean
---@return self
function Widget:setFlippedY (flippedY) end
---* Sets whether the widget is enabled<br>
---* true if the widget is enabled, widget may be touched , false if the widget is disabled, widget cannot be touched.<br>
---* Note: If you want to change the widget's appearance  to disabled state, you should also call  `setBright(false)`.<br>
---* The default value is true, a widget is default to enable touch.<br>
---* param enabled Set to true to enable touch, false otherwise.
---@param enabled boolean
---@return self
function Widget:setEnabled (enabled) end
---* Gets the right boundary position of this widget in parent's coordination system.<br>
---* return The right boundary position of this widget.
---@return float
function Widget:getRightBoundary () end
---* To set the bright style of widget.<br>
---* see BrightStyle<br>
---* param style   BrightStyle::NORMAL means the widget is in normal state, BrightStyle::HIGHLIGHT means the widget is in highlight state.
---@param style int
---@return self
function Widget:setBrightStyle (style) end
---* Sets a LayoutParameter to widget.<br>
---* see LayoutParameter<br>
---* param parameter LayoutParameter pointer
---@param parameter ccui.LayoutParameter
---@return self
function Widget:setLayoutParameter (parameter) end
---* Create a new widget copy of the original one.<br>
---* return A cloned widget copy of original.
---@return self
function Widget:clone () end
---* Allow widget to accept focus.<br>
---* param enable pass true/false to enable/disable the focus ability of a widget
---@param enable boolean
---@return self
function Widget:setFocusEnabled (enable) end
---* Gets the bottom boundary position of this widget in parent's coordination system.<br>
---* return The bottom boundary position of this widget.
---@return float
function Widget:getBottomBoundary () end
---* Determines if the widget is bright<br>
---* return true if the widget is bright, false if the widget is dark.
---@return boolean
function Widget:isBright () end
---* Dispatch a EventFocus through a EventDispatcher<br>
---* param widgetLoseFocus  The widget which lose its focus<br>
---* param widgetGetFocus he widget which get its focus
---@param widgetLoseFocus ccui.Widget
---@param widgetGetFocus ccui.Widget
---@return self
function Widget:dispatchFocusEvent (widgetLoseFocus,widgetGetFocus) end
---* Toggle use unify size.<br>
---* param enable True to use unify size, false otherwise.
---@param enable boolean
---@return self
function Widget:setUnifySizeEnabled (enable) end
---* Return whether the widget is propagate touch events to its parents or not<br>
---* return whether touch event propagation is allowed or not.<br>
---* since v3.3
---@return boolean
function Widget:isPropagateTouchEvents () end
---* Checks a point is in widget's content space.<br>
---* This function is used for determining touch area of widget.<br>
---* param pt        The point in `Vec2`.<br>
---* param camera    The camera look at widget, used to convert GL screen point to near/far plane.<br>
---* param p         Point to a Vec3 for store the intersect point, if don't need them set to nullptr.<br>
---* return true if the point is in widget's content space, false otherwise.
---@param pt vec2_table
---@param camera cc.Camera
---@param p vec3_table
---@return boolean
function Widget:hitTest (pt,camera,p) end
---* Query whether layout component is enabled or not. <br>
---* return true represent the widget use Layout Component, false represent the widget couldn't use Layout Component.
---@return boolean
function Widget:isLayoutComponentEnabled () end
---* when a widget calls this method, it will get focus immediately.
---@return self
function Widget:requestFocus () end
---@overload fun(size_table:size_table):self
---@overload fun():self
---@param parentSize size_table
---@return self
function Widget:updateSizeAndPosition (parentSize) end
---* This method is called when a focus change event happens<br>
---* param widgetLostFocus  The widget which lose its focus<br>
---* param widgetGetFocus  The widget which get its focus
---@param widgetLostFocus ccui.Widget
---@param widgetGetFocus ccui.Widget
---@return self
function Widget:onFocusChange (widgetLostFocus,widgetGetFocus) end
---* 
---@return vec2_table
function Widget:getTouchMovePosition () end
---* Gets the size type of widget.<br>
---* see `SizeType`
---@return int
function Widget:getSizeType () end
---* Query callback type.<br>
---* return Callback type string.
---@return string
function Widget:getCallbackType () end
---* 
---@return vec2_table
function Widget:getTouchEndPosition () end
---* Gets the percent (x,y) of the widget in OpenGL coordinates<br>
---* see setPosition(const Vec2&)<br>
---* return The percent (x,y) of the widget in OpenGL coordinates
---@return vec2_table
function Widget:getPositionPercent () end
---* brief Propagate touch events to its parents
---@param event int
---@param sender ccui.Widget
---@param touch cc.Touch
---@return self
function Widget:propagateTouchEvent (event,sender,touch) end
---* Returns the flag which indicates whether the widget is flipped horizontally or not.<br>
---* It not only flips the texture of the widget, but also the texture of the widget's children.<br>
---* Also, flipping relies on widget's anchor point.<br>
---* Internally, it just use setScaleX(-1) to flip the widget.<br>
---* return true if the widget is flipped horizontally, false otherwise.
---@return boolean
function Widget:isFlippedX () end
---* Return the flag which indicates whether the widget is flipped vertically or not.<br>
---* It not only flips the texture of the widget, but also the texture of the widget's children.<br>
---* Also, flipping relies on widget's anchor point.<br>
---* Internally, it just use setScaleY(-1) to flip the widget.<br>
---* return true if the widget is flipped vertically, false otherwise.
---@return boolean
function Widget:isFlippedY () end
---* Checks a point if in parent's area.<br>
---* param pt A point in `Vec2`.<br>
---* return true if the point is in parent's area, false otherwise.
---@param pt vec2_table
---@return boolean
function Widget:isClippingParentContainsPoint (pt) end
---* Changes the size type of widget.<br>
---* see `SizeType`<br>
---* param type that is widget's size type
---@param type int
---@return self
function Widget:setSizeType (type) end
---* 
---@param event int
---@param sender ccui.Widget
---@param touch cc.Touch
---@return self
function Widget:interceptTouchEvent (event,sender,touch) end
---* Sets whether the widget is bright<br>
---* The default value is true, a widget is default to bright<br>
---* param bright   true if the widget is bright, false if the widget is dark.
---@param bright boolean
---@return self
function Widget:setBright (bright) end
---* Set callback type.<br>
---* param callbackType A string representation of callback type.
---@param callbackType string
---@return self
function Widget:setCallbackType (callbackType) end
---* Return whether the widget is swallowing touch or not<br>
---* return Whether touch is swallowed.<br>
---* since v3.3
---@return boolean
function Widget:isSwallowTouches () end
---* 
---@param enable boolean
---@return self
function Widget:enableDpadNavigation (enable) end
---* Return a current focused widget in your UI scene.<br>
---* No matter what widget object you call this method on , it will return you the exact one focused widget.
---@return self
function Widget:getCurrentFocusedWidget () end
---* Create and return a empty Widget instance pointer.
---@return self
function Widget:create () end
---* 
---@param scaleY float
---@return self
function Widget:setScaleY (scaleY) end
---* 
---@param scaleX float
---@return self
function Widget:setScaleX (scaleX) end
---* 
---@return float
function Widget:getScaleY () end
---* 
---@return float
function Widget:getScaleX () end
---* Returns the string representation of widget class name<br>
---* return get the class description.
---@return string
function Widget:getDescription () end
---@overload fun(float:float,float:float):self
---@overload fun(float:float):self
---@param scalex float
---@param scaley float
---@return self
function Widget:setScale (scalex,scaley) end
---* 
---@return boolean
function Widget:init () end
---* Changes the position (x,y) of the widget in OpenGL coordinates<br>
---* Usually we use p(x,y) to compose a Vec2 object.<br>
---* The original point (0,0) is at the left-bottom corner of screen.<br>
---* param pos  The position (x,y) of the widget in OpenGL coordinates
---@param pos vec2_table
---@return self
function Widget:setPosition (pos) end
---* Changes the size that is widget's size<br>
---* param contentSize A content size in `Size`.
---@param contentSize size_table
---@return self
function Widget:setContentSize (contentSize) end
---* 
---@return float
function Widget:getScale () end
---* Default constructor<br>
---* js ctor<br>
---* lua new
---@return self
function Widget:Widget () end