//
//------------------------------------------------------------------------------
-#include "dali.h"
+#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/public-api/builder/builder.h>
-#include <dali-toolkit/public-api/builder/tree-node.h>
-#include <dali-toolkit/public-api/builder/json-parser.h>
+#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/builder/tree-node.h>
+#include <dali-toolkit/devel-api/builder/json-parser.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
#include <map>
#include <string>
#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 <cstring>
#include <dali/integration-api/debug.h>
#include "shared/view.h"
{
const char* BACKGROUND_IMAGE( "" );
-const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
-const char* EDIT_IMAGE( DALI_IMAGE_DIR "icon-change.png" );
+const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
+const char* EDIT_IMAGE( DEMO_IMAGE_DIR "icon-change.png" );
+const char* EDIT_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-change-selected.png" );
std::string USER_DIRECTORY;
'stage': \
[ \
{ \
- 'type':'TextView', \
+ 'type':'TextLabel', \
'size': [50,50,1], \
- 'parent-origin': 'CENTER', \
+ 'parentOrigin': 'CENTER', \
'text':'COULD NOT LOAD JSON FILE' \
} \
] \
}
}
-static Vector3 SetItemSize(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing)
-{
- return Vector3(layoutWidth, 50, 1);
-}
-
//------------------------------------------------------------------------------
//
//
{
if(!mTitleActor)
{
- mTitleActor = TextView::New();
+ mTitleActor = DemoHelper::CreateToolBarLabel( "" );
// Add title to the tool bar.
mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Alignment::HorizontalCenter );
}
- Font font = Font::New();
- mTitleActor.SetText( title );
- mTitleActor.SetSize( font.MeasureText( title ) );
- mTitleActor.SetStyleToCurrentText(DemoHelper::GetDefaultTextStyle());
+ mTitleActor.SetProperty( TextLabel::Property::TEXT, title );
}
bool OnToolSelectLayout( Toolkit::Button button )
void EnterSelection()
{
Stage stage = Stage::GetCurrent();
+ stage.SetBackgroundColor( Color::WHITE );
mTapDetector = TapGestureDetector::New();
mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
stage.Add( mItemView );
mItemView.SetParentOrigin(ParentOrigin::CENTER);
mItemView.SetAnchorPoint(AnchorPoint::CENTER);
- mGridLayout = GridLayout::New();
- mGridLayout->SetNumberOfColumns(1);
-
- mGridLayout->SetItemSizeFunction(SetItemSize);
+ mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
- mGridLayout->SetTopMargin(DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight);
+ mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) );
- mItemView.AddLayout(*mGridLayout);
+ mItemView.AddLayout( *mLayout );
- Vector3 size(stage.GetSize());
- mItemView.ActivateLayout(0, size, 0.0f/*immediate*/);
mItemView.SetKeyboardFocusable( true );
mFiles.clear();
}
else
{
- DirectoryFilesByType( DALI_SCRIPT_DIR, "json", files );
+ DirectoryFilesByType( DEMO_SCRIPT_DIR, "json", files );
}
std::sort(files.begin(), files.end());
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()
Actor MenuItem(const std::string& text)
{
- TextView t = TextView::New();
- t.SetMarkupProcessingEnabled(true);
-
- int size = static_cast<int>(DemoHelper::ScalePointSize(6));
-
- std::ostringstream fontString;
- fontString << "<font size="<< size <<">"<< ShortName( text ) << "</font>";
-
- t.SetText( fontString.str() );
-
- t.SetTextAlignment( Alignment::HorizontalLeft );
+ TextLabel label = TextLabel::New( ShortName( text ) );
+ label.SetStyleName( "BuilderLabel" );
+ label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
// Hook up tap detector
- mTapDetector.Attach( t );
+ mTapDetector.Attach( label );
- return t;
+ return label;
}
bool OnTimer()
builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit );
Property::Map defaultDirs;
- defaultDirs[ TOKEN_STRING(DALI_IMAGE_DIR) ] = DALI_IMAGE_DIR;
- defaultDirs[ TOKEN_STRING(DALI_MODEL_DIR) ] = DALI_MODEL_DIR;
- defaultDirs[ TOKEN_STRING(DALI_SCRIPT_DIR) ] = DALI_SCRIPT_DIR;
+ defaultDirs[ TOKEN_STRING(DEMO_IMAGE_DIR) ] = DEMO_IMAGE_DIR;
+ defaultDirs[ TOKEN_STRING(DEMO_MODEL_DIR) ] = DEMO_MODEL_DIR;
+ defaultDirs[ TOKEN_STRING(DEMO_SCRIPT_DIR) ] = DEMO_SCRIPT_DIR;
builder.AddConstants( defaultDirs );
}
builder.AddActors( layer );
-
}
{
ReloadJsonFile( name, mBuilder, mBuilderLayer );
- // do this here as GetCurrentSize()
- mBuilderLayer.SetParentOrigin(ParentOrigin::CENTER);
- mBuilderLayer.SetAnchorPoint(AnchorPoint::CENTER);
+ mBuilderLayer.SetParentOrigin(ParentOrigin::BOTTOM_CENTER);
+ mBuilderLayer.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
Dali::Vector3 size = Stage::GetCurrent().GetRootLayer().GetCurrentSize();
size.y -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
mBuilderLayer.SetSize( size );
// Create an edit mode button. (left of toolbar)
Toolkit::PushButton editButton = Toolkit::PushButton::New();
- editButton.SetBackgroundImage( ResourceImage::New( EDIT_IMAGE ) );
+ editButton.SetUnselectedImage( EDIT_IMAGE );
+ editButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
editButton.ClickedSignal().Connect( this, &ExampleApp::OnToolSelectLayout);
editButton.SetLeaveRequired( true );
mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
private:
Application& mApp;
- GridLayoutPtr mGridLayout;
+ ItemLayoutPtr mLayout;
ItemView mItemView;
- Toolkit::View mView;
+ Toolkit::Control mView;
unsigned int mOrientation;
Toolkit::ToolBar mToolBar;
- TextView mTitleActor; ///< The Toolbar's Title.
+ TextLabel mTitleActor; ///< The Toolbar's Title.
Layer mBuilderLayer;
//
//
//------------------------------------------------------------------------------
-int main(int argc, char **argv)
+int DALI_EXPORT_API main(int argc, char **argv)
{
if(argc > 2)
{
}
}
- Application app = Application::New(&argc, &argv);
+ Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
ExampleApp dali_app(app);