Commit 8d340ec58c16b97556054c21170120003e01244a

Authored by Kingsley Stephens
1 parent f6dac5b4

Size negotiation patch 2: Fix builder example scripts

Change-Id: I6f9e0583cb67a3297039d76759db5ab0ddec18b6
demo/dali-demo.cpp
@@ -39,7 +39,7 @@ int main(int argc, char **argv) @@ -39,7 +39,7 @@ int main(int argc, char **argv)
39 demo.AddExample(Example("refraction-effect.example", "Refraction")); 39 demo.AddExample(Example("refraction-effect.example", "Refraction"));
40 demo.AddExample(Example("scroll-view.example", "Scroll View")); 40 demo.AddExample(Example("scroll-view.example", "Scroll View"));
41 demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows")); 41 demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows"));
42 -// demo.AddExample(Example("builder.example", "Script Based UI")); 42 + demo.AddExample(Example("builder.example", "Script Based UI"));
43 demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes")); 43 demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes"));
44 demo.AddExample(Example("text-view.example", "Text View")); 44 demo.AddExample(Example("text-view.example", "Text View"));
45 demo.AddExample(Example("animated-shapes.example", "Animated Shapes")); 45 demo.AddExample(Example("animated-shapes.example", "Animated Shapes"));
examples/size-negotiation/size-negotiation-example.cpp
@@ -341,9 +341,6 @@ public: @@ -341,9 +341,6 @@ public:
341 { 341 {
342 mPopup = CreatePopup(); 342 mPopup = CreatePopup();
343 343
344 - // The popup is not yet on the stage so needs to be flaged as dirty  
345 - mPopup.MarkDirtyForRelayout();  
346 -  
347 mPopup.Show(); 344 mPopup.Show();
348 } 345 }
349 else if( button.GetName() == POPUP_BUTTON_TITLE_ID ) 346 else if( button.GetName() == POPUP_BUTTON_TITLE_ID )
@@ -351,9 +348,6 @@ public: @@ -351,9 +348,6 @@ public:
351 mPopup = CreatePopup(); 348 mPopup = CreatePopup();
352 mPopup.SetTitle( "Popup!" ); 349 mPopup.SetTitle( "Popup!" );
353 350
354 - // The popup is not yet on the stage so needs to be flaged as dirty  
355 - mPopup.MarkDirtyForRelayout();  
356 -  
357 mPopup.Show(); 351 mPopup.Show();
358 } 352 }
359 else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID ) 353 else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
@@ -370,9 +364,6 @@ public: @@ -370,9 +364,6 @@ public:
370 364
371 mPopup.AddButton( okayButton ); 365 mPopup.AddButton( okayButton );
372 366
373 - // The popup is not yet on the stage so needs to be flaged as dirty  
374 - mPopup.MarkDirtyForRelayout();  
375 -  
376 mPopup.Show(); 367 mPopup.Show();
377 } 368 }
378 else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID ) 369 else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
@@ -399,9 +390,6 @@ public: @@ -399,9 +390,6 @@ public:
399 390
400 mPopup.AddButton( okayButton ); 391 mPopup.AddButton( okayButton );
401 392
402 - // The popup is not yet on the stage so needs to be flaged as dirty  
403 - mPopup.MarkDirtyForRelayout();  
404 -  
405 mPopup.Show(); 393 mPopup.Show();
406 } 394 }
407 else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID ) 395 else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID )
@@ -429,9 +417,6 @@ public: @@ -429,9 +417,6 @@ public:
429 417
430 mPopup.AddButton( okayButton ); 418 mPopup.AddButton( okayButton );
431 419
432 - // The popup is not yet on the stage so needs to be flaged as dirty  
433 - mPopup.MarkDirtyForRelayout();  
434 -  
435 mPopup.Show(); 420 mPopup.Show();
436 } 421 }
437 else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID ) 422 else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
@@ -450,9 +435,6 @@ public: @@ -450,9 +435,6 @@ public:
450 435
451 mPopup.Add( text ); 436 mPopup.Add( text );
452 437
453 - // The popup is not yet on the stage so needs to be flaged as dirty  
454 - mPopup.MarkDirtyForRelayout();  
455 -  
456 mPopup.Show(); 438 mPopup.Show();
457 } 439 }
458 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID ) 440 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
@@ -466,9 +448,6 @@ public: @@ -466,9 +448,6 @@ public:
466 448
467 mPopup.Add( image ); 449 mPopup.Add( image );
468 450
469 - // The popup is not yet on the stage so needs to be flaged as dirty  
470 - mPopup.MarkDirtyForRelayout();  
471 -  
472 mPopup.Show(); 451 mPopup.Show();
473 } 452 }
474 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID ) 453 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
@@ -483,9 +462,6 @@ public: @@ -483,9 +462,6 @@ public:
483 462
484 mPopup.Add( image ); 463 mPopup.Add( image );
485 464
486 - // The popup is not yet on the stage so needs to be flaged as dirty  
487 - mPopup.MarkDirtyForRelayout();  
488 -  
489 mPopup.Show(); 465 mPopup.Show();
490 } 466 }
491 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID ) 467 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
@@ -501,9 +477,6 @@ public: @@ -501,9 +477,6 @@ public:
501 477
502 mPopup.Add( image ); 478 mPopup.Add( image );
503 479
504 - // The popup is not yet on the stage so needs to be flaged as dirty  
505 - mPopup.MarkDirtyForRelayout();  
506 -  
507 mPopup.Show(); 480 mPopup.Show();
508 } 481 }
509 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID ) 482 else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
@@ -519,9 +492,6 @@ public: @@ -519,9 +492,6 @@ public:
519 492
520 mPopup.Add( image ); 493 mPopup.Add( image );
521 494
522 - // The popup is not yet on the stage so needs to be flaged as dirty  
523 - mPopup.MarkDirtyForRelayout();  
524 -  
525 mPopup.Show(); 495 mPopup.Show();
526 } 496 }
527 else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID ) 497 else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
@@ -541,9 +511,6 @@ public: @@ -541,9 +511,6 @@ public:
541 511
542 mPopup.Add( text ); 512 mPopup.Add( text );
543 513
544 - // The popup is not yet on the stage so needs to be flaged as dirty  
545 - mPopup.MarkDirtyForRelayout();  
546 -  
547 mPopup.Show(); 514 mPopup.Show();
548 } 515 }
549 else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID ) 516 else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
@@ -583,9 +550,6 @@ public: @@ -583,9 +550,6 @@ public:
583 550
584 mPopup.AddButton( okayButton ); 551 mPopup.AddButton( okayButton );
585 552
586 - // The popup is not yet on the stage so needs to be flaged as dirty  
587 - mPopup.MarkDirtyForRelayout();  
588 -  
589 mPopup.Show(); 553 mPopup.Show();
590 } 554 }
591 else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID ) 555 else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
@@ -651,7 +615,7 @@ public: @@ -651,7 +615,7 @@ public:
651 615
652 root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) ); 616 root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
653 617
654 - content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) ); // Column span 2 618 + content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0 ) );
655 } 619 }
656 620
657 mPopup.Add( content ); 621 mPopup.Add( content );
@@ -677,9 +641,6 @@ public: @@ -677,9 +641,6 @@ public:
677 641
678 mPopup.AddButton( okayButton ); 642 mPopup.AddButton( okayButton );
679 643
680 - // The popup is not yet on the stage so needs to be flaged as dirty  
681 - mPopup.MarkDirtyForRelayout();  
682 -  
683 mPopup.Show(); 644 mPopup.Show();
684 } 645 }
685 else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID ) 646 else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
@@ -694,9 +655,6 @@ public: @@ -694,9 +655,6 @@ public:
694 655
695 mPopup.Add( table ); 656 mPopup.Add( table );
696 657
697 - // The popup is not yet on the stage so needs to be flaged as dirty  
698 - mPopup.MarkDirtyForRelayout();  
699 -  
700 mPopup.Show(); 658 mPopup.Show();
701 } 659 }
702 else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID ) 660 else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
@@ -716,9 +674,6 @@ public: @@ -716,9 +674,6 @@ public:
716 674
717 mPopup.Add( table ); 675 mPopup.Add( table );
718 676
719 - // The popup is not yet on the stage so needs to be flaged as dirty  
720 - mPopup.MarkDirtyForRelayout();  
721 -  
722 mPopup.Show(); 677 mPopup.Show();
723 } 678 }
724 else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID ) 679 else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
@@ -749,9 +704,6 @@ public: @@ -749,9 +704,6 @@ public:
749 704
750 mPopup.Add( table ); 705 mPopup.Add( table );
751 706
752 - // The popup is not yet on the stage so needs to be flaged as dirty  
753 - mPopup.MarkDirtyForRelayout();  
754 -  
755 mPopup.Show(); 707 mPopup.Show();
756 } 708 }
757 else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID ) 709 else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
@@ -817,9 +769,6 @@ public: @@ -817,9 +769,6 @@ public:
817 769
818 mPopup.Add( table ); 770 mPopup.Add( table );
819 771
820 - // The popup is not yet on the stage so needs to be flaged as dirty  
821 - mPopup.MarkDirtyForRelayout();  
822 -  
823 mPopup.Show(); 772 mPopup.Show();
824 } 773 }
825 else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID ) 774 else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
@@ -863,9 +812,6 @@ public: @@ -863,9 +812,6 @@ public:
863 812
864 mPopup.Add( table ); 813 mPopup.Add( table );
865 814
866 - // The popup is not yet on the stage so needs to be flaged as dirty  
867 - mPopup.MarkDirtyForRelayout();  
868 -  
869 mPopup.Show(); 815 mPopup.Show();
870 } 816 }
871 else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID ) 817 else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
@@ -910,9 +856,6 @@ public: @@ -910,9 +856,6 @@ public:
910 856
911 mPopup.Add( table ); 857 mPopup.Add( table );
912 858
913 - // The popup is not yet on the stage so needs to be flaged as dirty  
914 - mPopup.MarkDirtyForRelayout();  
915 -  
916 mPopup.Show(); 859 mPopup.Show();
917 } 860 }
918 else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID ) 861 else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
@@ -965,9 +908,6 @@ public: @@ -965,9 +908,6 @@ public:
965 908
966 mPopup.Add( table ); 909 mPopup.Add( table );
967 910
968 - // The popup is not yet on the stage so needs to be flaged as dirty  
969 - mPopup.MarkDirtyForRelayout();  
970 -  
971 mPopup.Show(); 911 mPopup.Show();
972 } 912 }
973 else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID ) 913 else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
@@ -1017,9 +957,6 @@ public: @@ -1017,9 +957,6 @@ public:
1017 957
1018 mPopup.Add( table ); 958 mPopup.Add( table );
1019 959
1020 - // The popup is not yet on the stage so needs to be flaged as dirty  
1021 - mPopup.MarkDirtyForRelayout();  
1022 -  
1023 mPopup.Show(); 960 mPopup.Show();
1024 } 961 }
1025 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID ) 962 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
@@ -1075,9 +1012,6 @@ public: @@ -1075,9 +1012,6 @@ public:
1075 1012
1076 mPopup.Add( table ); 1013 mPopup.Add( table );
1077 1014
1078 - // The popup is not yet on the stage so needs to be flaged as dirty  
1079 - mPopup.MarkDirtyForRelayout();  
1080 -  
1081 mPopup.Show(); 1015 mPopup.Show();
1082 } 1016 }
1083 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID ) 1017 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
@@ -1121,9 +1055,6 @@ public: @@ -1121,9 +1055,6 @@ public:
1121 1055
1122 mPopup.Add( table ); 1056 mPopup.Add( table );
1123 1057
1124 - // The popup is not yet on the stage so needs to be flaged as dirty  
1125 - mPopup.MarkDirtyForRelayout();  
1126 -  
1127 mPopup.Show(); 1058 mPopup.Show();
1128 } 1059 }
1129 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID ) 1060 else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
@@ -1165,9 +1096,6 @@ public: @@ -1165,9 +1096,6 @@ public:
1165 1096
1166 mPopup.Add( table ); 1097 mPopup.Add( table );
1167 1098
1168 - // The popup is not yet on the stage so needs to be flaged as dirty  
1169 - mPopup.MarkDirtyForRelayout();  
1170 -  
1171 mPopup.Show(); 1099 mPopup.Show();
1172 } 1100 }
1173 else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID ) 1101 else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
resources/scripts/button.json
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 "parent-origin": "TOP_CENTER", 25 "parent-origin": "TOP_CENTER",
26 "anchor-point": "TOP_CENTER", 26 "anchor-point": "TOP_CENTER",
27 "position": [0, 0, 0], 27 "position": [0, 0, 0],
28 - "size": [0, 200, 0], 28 + "size": [400, 200, 0],
29 "normal-state-actor": { 29 "normal-state-actor": {
30 "type": "ImageActor", 30 "type": "ImageActor",
31 "image": { 31 "image": {
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 "parent-origin": "CENTER", 50 "parent-origin": "CENTER",
51 "anchor-point": "CENTER", 51 "anchor-point": "CENTER",
52 "position": [0, 0, 0], 52 "position": [0, 0, 0],
53 - "size": [0, 200, 0], 53 + "size": [400, 200, 0],
54 "label-actor": { 54 "label-actor": {
55 "type": "TextView", 55 "type": "TextView",
56 "text": "Disabled" 56 "text": "Disabled"
@@ -83,7 +83,7 @@ @@ -83,7 +83,7 @@
83 "parent-origin": "BOTTOM_CENTER", 83 "parent-origin": "BOTTOM_CENTER",
84 "anchor-point": "BOTTOM_CENTER", 84 "anchor-point": "BOTTOM_CENTER",
85 "position": [0, 0, 0], 85 "position": [0, 0, 0],
86 - "size": [0, 200, 0], 86 + "size": [400, 200, 0],
87 "label-actor": { 87 "label-actor": {
88 "type": "TextView", 88 "type": "TextView",
89 "text": "Toggle" 89 "text": "Toggle"
resources/scripts/super-blur-view.json
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 "parent-origin": "BOTTOM_CENTER", 65 "parent-origin": "BOTTOM_CENTER",
66 "anchor-point": "BOTTOM_CENTER", 66 "anchor-point": "BOTTOM_CENTER",
67 "position": [0, 0, 0], 67 "position": [0, 0, 0],
68 - "size": [0, 100, 0], 68 + "size": [200, 100, 0],
69 "label-actor": { 69 "label-actor": {
70 "type": "TextView", 70 "type": "TextView",
71 "text": "Blur" 71 "text": "Blur"
resources/scripts/table-view.json
@@ -22,8 +22,6 @@ @@ -22,8 +22,6 @@
22 "background-color": [0.5,0.5,0,1], 22 "background-color": [0.5,0.5,0,1],
23 "parent-origin": "CENTER", 23 "parent-origin": "CENTER",
24 "size":[400,500,1], 24 "size":[400,500,1],
25 - "rows": 4,  
26 - "columns":4,  
27 "cell-padding": [10, 5], 25 "cell-padding": [10, 5],
28 "layout-rows": { // set the height of the rows 26 "layout-rows": { // set the height of the rows
29 "0": { "policy": "fixed", "value": 40 }, 27 "0": { "policy": "fixed", "value": 40 },
@@ -38,17 +36,21 @@ @@ -38,17 +36,21 @@
38 "actors": [{ 36 "actors": [{
39 "name":"gallery-1", 37 "name":"gallery-1",
40 "type":"ImageActor", 38 "type":"ImageActor",
  39 + "width-resize-policy":"FILL_TO_PARENT",
  40 + "height-resize-policy":"FILL_TO_PARENT",
41 "image": { 41 "image": {
42 "filename": "{DALI_IMAGE_DIR}gallery-large-1.jpg" 42 "filename": "{DALI_IMAGE_DIR}gallery-large-1.jpg"
43 }, 43 },
44 "custom-properties": { // properties registered dynamically 44 "custom-properties": { // properties registered dynamically
45 - "cell-indices": [0,0],// property to specify the top-left cell this child occupies 45 + "cell-indices": [0,0], // property to specify the top-left cell this child occupies
46 "row-span":4, // property to specify how many rows this child occupies, if not set, default value is 1 46 "row-span":4, // property to specify how many rows this child occupies, if not set, default value is 1
47 - "column-spam":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1 47 + "column-span":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1
48 } 48 }
49 },{ 49 },{
50 "name":"gallery-2", 50 "name":"gallery-2",
51 "type":"ImageActor", 51 "type":"ImageActor",
  52 + "width-resize-policy":"FILL_TO_PARENT",
  53 + "height-resize-policy":"FILL_TO_PARENT",
52 "image": { 54 "image": {
53 "filename": "{DALI_IMAGE_DIR}gallery-large-2.jpg" 55 "filename": "{DALI_IMAGE_DIR}gallery-large-2.jpg"
54 }, 56 },
@@ -59,6 +61,8 @@ @@ -59,6 +61,8 @@
59 }, { 61 }, {
60 "name":"gallery-3", 62 "name":"gallery-3",
61 "type":"ImageActor", 63 "type":"ImageActor",
  64 + "width-resize-policy":"FILL_TO_PARENT",
  65 + "height-resize-policy":"FILL_TO_PARENT",
62 "image": { 66 "image": {
63 "filename": "{DALI_IMAGE_DIR}gallery-large-3.jpg" 67 "filename": "{DALI_IMAGE_DIR}gallery-large-3.jpg"
64 }, 68 },
@@ -68,6 +72,8 @@ @@ -68,6 +72,8 @@
68 }, { 72 }, {
69 "name":"gallery-4", 73 "name":"gallery-4",
70 "type":"ImageActor", 74 "type":"ImageActor",
  75 + "width-resize-policy":"FILL_TO_PARENT",
  76 + "height-resize-policy":"FILL_TO_PARENT",
71 "image": { 77 "image": {
72 "filename": "{DALI_IMAGE_DIR}gallery-large-4.jpg" 78 "filename": "{DALI_IMAGE_DIR}gallery-large-4.jpg"
73 }, 79 },
resources/scripts/timing.json
@@ -91,6 +91,8 @@ @@ -91,6 +91,8 @@
91 "name": "ControlBack", 91 "name": "ControlBack",
92 "parent-origin": "CENTER", 92 "parent-origin": "CENTER",
93 "anchor-point": "CENTER", 93 "anchor-point": "CENTER",
  94 + "width-resize-policy": "FILL_TO_PARENT",
  95 + "height-resize-policy": "FILL_TO_PARENT",
94 "position": [ 96 "position": [
95 0, 97 0,
96 0, 98 0,