Size negotiation patch 2: Fix builder example scripts 36/37936/3
authorKingsley Stephens <k.stephens@samsung.com>
Wed, 8 Apr 2015 13:13:18 +0000 (14:13 +0100)
committerKingsley Stephens <k.stephens@samsung.com>
Thu, 9 Apr 2015 10:51:32 +0000 (11:51 +0100)
Change-Id: I6f9e0583cb67a3297039d76759db5ab0ddec18b6

demo/dali-demo.cpp
examples/size-negotiation/size-negotiation-example.cpp
resources/scripts/button.json
resources/scripts/super-blur-view.json
resources/scripts/table-view.json
resources/scripts/timing.json

index 31ddbd0..c88dd8c 100644 (file)
@@ -39,7 +39,7 @@ int main(int argc, char **argv)
   demo.AddExample(Example("refraction-effect.example", "Refraction"));
   demo.AddExample(Example("scroll-view.example", "Scroll View"));
   demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows"));
-//  demo.AddExample(Example("builder.example", "Script Based UI"));
+  demo.AddExample(Example("builder.example", "Script Based UI"));
   demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes"));
   demo.AddExample(Example("text-view.example", "Text View"));
   demo.AddExample(Example("animated-shapes.example", "Animated Shapes"));
index 473f16a..4e6aa16 100644 (file)
@@ -341,9 +341,6 @@ public:
     {
       mPopup = CreatePopup();
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_TITLE_ID )
@@ -351,9 +348,6 @@ public:
       mPopup = CreatePopup();
       mPopup.SetTitle( "Popup!" );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID )
@@ -370,9 +364,6 @@ public:
 
       mPopup.AddButton( okayButton );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID )
@@ -399,9 +390,6 @@ public:
 
       mPopup.AddButton( okayButton );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID )
@@ -429,9 +417,6 @@ public:
 
       mPopup.AddButton( okayButton );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID )
@@ -450,9 +435,6 @@ public:
 
       mPopup.Add( text );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID )
@@ -466,9 +448,6 @@ public:
 
       mPopup.Add( image );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID )
@@ -483,9 +462,6 @@ public:
 
       mPopup.Add( image );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID )
@@ -501,9 +477,6 @@ public:
 
       mPopup.Add( image );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID )
@@ -519,9 +492,6 @@ public:
 
       mPopup.Add( image );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID )
@@ -541,9 +511,6 @@ public:
 
       mPopup.Add( text );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID )
@@ -583,9 +550,6 @@ public:
 
       mPopup.AddButton( okayButton );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID )
@@ -651,7 +615,7 @@ public:
 
         root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) );
 
-        content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) );  // Column span 2
+        content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0 ) );
       }
 
       mPopup.Add( content );
@@ -677,9 +641,6 @@ public:
 
       mPopup.AddButton( okayButton );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID )
@@ -694,9 +655,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID )
@@ -716,9 +674,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID )
@@ -749,9 +704,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID )
@@ -817,9 +769,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID )
@@ -863,9 +812,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID )
@@ -910,9 +856,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID )
@@ -965,9 +908,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID )
@@ -1017,9 +957,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID )
@@ -1075,9 +1012,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID )
@@ -1121,9 +1055,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID )
@@ -1165,9 +1096,6 @@ public:
 
       mPopup.Add( table );
 
-      // The popup is not yet on the stage so needs to be flaged as dirty
-      mPopup.MarkDirtyForRelayout();
-
       mPopup.Show();
     }
     else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID )
index 392f97d..1ce7c91 100644 (file)
@@ -25,7 +25,7 @@
       "parent-origin": "TOP_CENTER",
       "anchor-point": "TOP_CENTER",
       "position": [0, 0, 0],
-      "size": [0, 200, 0],
+      "size": [400, 200, 0],
       "normal-state-actor": {
         "type": "ImageActor",
         "image": {
@@ -50,7 +50,7 @@
       "parent-origin": "CENTER",
       "anchor-point": "CENTER",
       "position": [0, 0, 0],
-      "size": [0, 200, 0],
+      "size": [400, 200, 0],
       "label-actor": {
         "type": "TextView",
         "text": "Disabled"
@@ -83,7 +83,7 @@
       "parent-origin": "BOTTOM_CENTER",
       "anchor-point": "BOTTOM_CENTER",
       "position": [0, 0, 0],
-      "size": [0, 200, 0],
+      "size": [400, 200, 0],
       "label-actor": {
         "type": "TextView",
         "text": "Toggle"
index dd31564..7351b85 100644 (file)
@@ -65,7 +65,7 @@
       "parent-origin": "BOTTOM_CENTER",
       "anchor-point": "BOTTOM_CENTER",
       "position": [0, 0, 0],
-      "size": [0, 100, 0],
+      "size": [200, 100, 0],
       "label-actor": {
         "type": "TextView",
         "text": "Blur"
index 85940fa..0a9fdca 100644 (file)
@@ -22,8 +22,6 @@
       "background-color": [0.5,0.5,0,1],
       "parent-origin": "CENTER",
       "size":[400,500,1],
-      "rows": 4,
-      "columns":4,
       "cell-padding": [10, 5],
       "layout-rows": {  // set the height of the rows
         "0": { "policy": "fixed", "value": 40 },
       "actors": [{
           "name":"gallery-1",
           "type":"ImageActor",
+          "width-resize-policy":"FILL_TO_PARENT",
+          "height-resize-policy":"FILL_TO_PARENT",
           "image": {
             "filename": "{DALI_IMAGE_DIR}gallery-large-1.jpg"
           },
           "custom-properties": { // properties registered dynamically
-            "cell-indices": [0,0],// property to specify the top-left cell this child occupies
+            "cell-indices": [0,0], // property to specify the top-left cell this child occupies
             "row-span":4, // property to specify how many rows this child occupies, if not set, default value is 1
-            "column-spam":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1
+            "column-span":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1
           }
         },{
           "name":"gallery-2",
           "type":"ImageActor",
+          "width-resize-policy":"FILL_TO_PARENT",
+          "height-resize-policy":"FILL_TO_PARENT",
           "image": {
             "filename": "{DALI_IMAGE_DIR}gallery-large-2.jpg"
           },
@@ -59,6 +61,8 @@
         }, {
           "name":"gallery-3",
           "type":"ImageActor",
+          "width-resize-policy":"FILL_TO_PARENT",
+          "height-resize-policy":"FILL_TO_PARENT",
           "image": {
             "filename": "{DALI_IMAGE_DIR}gallery-large-3.jpg"
           },
@@ -68,6 +72,8 @@
         }, {
           "name":"gallery-4",
           "type":"ImageActor",
+          "width-resize-policy":"FILL_TO_PARENT",
+          "height-resize-policy":"FILL_TO_PARENT",
           "image": {
             "filename": "{DALI_IMAGE_DIR}gallery-large-4.jpg"
           },
index 74344c3..a5d8024 100644 (file)
@@ -91,6 +91,8 @@
       "name": "ControlBack",
       "parent-origin": "CENTER",
       "anchor-point": "CENTER",
+      "width-resize-policy": "FILL_TO_PARENT",
+      "height-resize-policy": "FILL_TO_PARENT",
       "position": [
         0,
         0,