X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fbuilder%2Fexamples.cpp;h=79f50a17e64d87ee17efd7311235f2ccdc1b6d3e;hb=0727b27d000e0ce5968846b51a55311592f04655;hp=90bb1b6244d9f4fd1801f75229163f118a5c461a;hpb=1e8cf4e9b7b912503aee6bc3494217e88d13ef52;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index 90bb1b6..79f50a1 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -20,27 +20,27 @@ // //------------------------------------------------------------------------------ -#include "dali.h" +#include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include -#include #include #include #include -//#include #include "sys/stat.h" #include +#include #include -#include "../shared/view.h" +#include "shared/view.h" #define TOKEN_STRING(x) #x @@ -61,7 +61,7 @@ std::string JSON_BROKEN(" \ 'stage': \ [ \ { \ - 'type':'TextView', \ + 'type':'TextLabel', \ 'size': [50,50,1], \ 'parent-origin': 'CENTER', \ 'text':'COULD NOT LOAD JSON FILE' \ @@ -143,11 +143,6 @@ const std::string ShortName( const std::string& name ) } } -static Vector3 SetItemSize(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing) -{ - return Vector3(layoutWidth, 50, 1); -} - //------------------------------------------------------------------------------ // // @@ -243,7 +238,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 ) @@ -270,6 +272,7 @@ public: void EnterSelection() { Stage stage = Stage::GetCurrent(); + stage.SetBackgroundColor( Color::WHITE ); mTapDetector = TapGestureDetector::New(); mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); @@ -285,17 +288,12 @@ public: stage.Add( mItemView ); mItemView.SetParentOrigin(ParentOrigin::CENTER); mItemView.SetAnchorPoint(AnchorPoint::CENTER); - mGridLayout = GridLayout::New(); - mGridLayout->SetNumberOfColumns(1); + mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST ); - mGridLayout->SetItemSizeFunction(SetItemSize); + mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) ); - mGridLayout->SetTopMargin(DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight); + mItemView.AddLayout( *mLayout ); - mItemView.AddLayout(*mGridLayout); - - Vector3 size(stage.GetSize()); - mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); mItemView.SetKeyboardFocusable( true ); mFiles.clear(); @@ -363,9 +361,9 @@ public: SetTitle("Select"); - // Itemview renderes the previous items unless its scrolled. Not sure why at the moment so we force a scroll - mItemView.ScrollToItem(0, 0); - + // Activate the layout + Vector3 size(stage.GetSize()); + mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); } void ExitSelection() @@ -387,7 +385,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() @@ -456,7 +461,6 @@ public: } builder.AddActors( layer ); - } @@ -571,13 +575,14 @@ public: private: Application& mApp; - GridLayoutPtr mGridLayout; + ItemLayoutPtr mLayout; ItemView mItemView; - Toolkit::View mView; + Toolkit::Control mView; unsigned int mOrientation; Toolkit::ToolBar mToolBar; + TextLabel mTitleActor; ///< The Toolbar's Title. Layer mBuilderLayer; @@ -611,7 +616,7 @@ int main(int argc, char **argv) } } - Application app = Application::New(&argc, &argv); + Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH); ExampleApp dali_app(app);