@@ -374,6 +374,96 @@ void Widget_GenerateHash(LCUI_Widget w)
374
374
}
375
375
}
376
376
377
+ size_t Widget_SetHashList (LCUI_Widget w , unsigned * hash_list , size_t len )
378
+ {
379
+ size_t count = 0 ;
380
+ LCUI_Widget child ;
381
+
382
+ child = w ;
383
+ if (hash_list ) {
384
+ child -> hash = hash_list [count ];
385
+ }
386
+ ++ count ;
387
+ if (len > 0 && count >= len ) {
388
+ return count ;
389
+ }
390
+ while (child -> children .length > 0 ) {
391
+ child = child -> children .head .next -> data ;
392
+ }
393
+ while (child != w ) {
394
+ while (child -> children .length > 0 ) {
395
+ child = child -> children .head .next -> data ;
396
+ }
397
+ if (hash_list ) {
398
+ child -> hash = hash_list [count ];
399
+ }
400
+ ++ count ;
401
+ if (len > 0 && count >= len ) {
402
+ break ;
403
+ }
404
+ if (child -> node .next ) {
405
+ child = child -> node .next -> data ;
406
+ continue ;
407
+ }
408
+ do {
409
+ child = child -> parent ;
410
+ if (child == w ) {
411
+ break ;
412
+ }
413
+ if (child -> node .next ) {
414
+ child = child -> node .next -> data ;
415
+ break ;
416
+ }
417
+ } while (1 );
418
+ }
419
+ return count ;
420
+ }
421
+
422
+ size_t Widget_GetHashList (LCUI_Widget w , unsigned * hash_list , size_t maxlen )
423
+ {
424
+ size_t count = 0 ;
425
+ LCUI_Widget child ;
426
+
427
+ child = w ;
428
+ if (hash_list ) {
429
+ hash_list [count ] = child -> hash ;
430
+ }
431
+ ++ count ;
432
+ if (maxlen > 0 && count >= maxlen ) {
433
+ return count ;
434
+ }
435
+ while (child -> children .length > 0 ) {
436
+ child = child -> children .head .next -> data ;
437
+ }
438
+ while (child != w ) {
439
+ while (child -> children .length > 0 ) {
440
+ child = child -> children .head .next -> data ;
441
+ }
442
+ if (hash_list ) {
443
+ hash_list [count ] = child -> hash ;
444
+ }
445
+ ++ count ;
446
+ if (maxlen > 0 && count >= maxlen ) {
447
+ break ;
448
+ }
449
+ if (child -> node .next ) {
450
+ child = child -> node .next -> data ;
451
+ continue ;
452
+ }
453
+ do {
454
+ child = child -> parent ;
455
+ if (child == w ) {
456
+ break ;
457
+ }
458
+ if (child -> node .next ) {
459
+ child = child -> node .next -> data ;
460
+ break ;
461
+ }
462
+ } while (1 );
463
+ }
464
+ return count ;
465
+ }
466
+
377
467
int Widget_SetRules (LCUI_Widget w , const LCUI_WidgetRulesRec * rules )
378
468
{
379
469
LCUI_WidgetRulesData data ;
0 commit comments