Size negotiation patch 3: Scope size negotiation enums
[platform/core/uifw/dali-demo.git] / examples / builder / examples.cpp
index 90bb1b6..5578d7c 100644 (file)
 #include <fstream>
 #include <streambuf>
 #include <sstream>
-#include <boost/scoped_ptr.hpp>
 #include <dirent.h>
 #include <stdio.h>
 #include <iostream>
 
-//#include <boost/regex.hpp>
 #include "sys/stat.h"
 #include <ctime>
 
 #include <dali/integration-api/debug.h>
-#include "../shared/view.h"
+#include "shared/view.h"
 
 #define TOKEN_STRING(x) #x
 
@@ -61,7 +59,7 @@ std::string JSON_BROKEN("                                      \
   'stage':                                                     \
   [                                                            \
     {                                                          \
-      'type':'TextView',                                       \
+      'type':'TextLabel',                                      \
       'size': [50,50,1],                                       \
       'parent-origin': 'CENTER',                               \
       'text':'COULD NOT LOAD JSON FILE'                        \
@@ -243,7 +241,14 @@ public:
 
   void SetTitle(const std::string& title)
   {
-    // TODO
+    if(!mTitleActor)
+    {
+      mTitleActor = DemoHelper::CreateToolBarLabel( "" );
+      // Add title to the tool bar.
+      mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
+    }
+
+    mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
   }
 
   bool OnToolSelectLayout( Toolkit::Button button )
@@ -282,6 +287,7 @@ public:
     mFiles.clear();
 
     mItemView = ItemView::New(*this);
+    mItemView.SetRelayoutEnabled( false );
     stage.Add( mItemView );
     mItemView.SetParentOrigin(ParentOrigin::CENTER);
     mItemView.SetAnchorPoint(AnchorPoint::CENTER);
@@ -387,7 +393,14 @@ public:
 
   Actor MenuItem(const std::string& text)
   {
-    return Actor();
+    TextLabel label = TextLabel::New( ShortName( text ) );
+    label.SetProperty( Dali::Toolkit::Control::Property::STYLE_NAME, "builderlabel" );
+    label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+
+    // Hook up tap detector
+    mTapDetector.Attach( label );
+
+    return label;
   }
 
   bool OnTimer()
@@ -457,6 +470,8 @@ public:
 
     builder.AddActors( layer );
 
+    // Force relayout on layer
+    layer.RelayoutRequestTree();
   }
 
 
@@ -489,6 +504,8 @@ public:
 
   void Create(Application& app)
   {
+    DemoHelper::RequestThemeChange();
+
     Stage stage = Stage::GetCurrent();
 
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleApp::OnKeyEvent);
@@ -578,6 +595,7 @@ private:
   unsigned int mOrientation;
 
   Toolkit::ToolBar mToolBar;
+  TextLabel mTitleActor;             ///< The Toolbar's Title.
 
   Layer mBuilderLayer;