/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <cstring>
#include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/file-loader.h>
#include "shared/view.h"
#define TOKEN_STRING(x) #x
std::string GetFileContents(const std::string &fn)
{
- std::ifstream t(fn.c_str());
- return std::string((std::istreambuf_iterator<char>(t)),
- std::istreambuf_iterator<char>());
+ std::streampos bufferSize = 0;
+ Dali::Vector<char> fileBuffer;
+ if( !Dali::FileLoader::ReadFile( fn, bufferSize, fileBuffer, FileLoader::FileType::BINARY ) )
+ {
+ return std::string();
+ }
+
+ return std::string( &fileBuffer[0], bufferSize );
};
typedef std::vector<std::string> FileList;
mItemView = ItemView::New(*this);
- mItemView.SetParentOrigin(ParentOrigin::CENTER);
- mItemView.SetAnchorPoint(AnchorPoint::CENTER);
+ mItemView.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+ mItemView.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST );
mLayout->SetItemSize( Vector3( stage.GetSize().width, 50, 1 ) );
mItemView.AddLayout( *mLayout );
- mItemView.SetKeyboardFocusable( true );
+ mItemView.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
mFiles.clear();
FileList files;
RenderTask defaultTask = taskList.GetTask(0);
defaultTask.SetSourceActor( stage.GetRootLayer() );
- defaultTask.SetTargetFrameBuffer( FrameBufferImage() );
+ defaultTask.SetFrameBuffer( FrameBuffer() );
}
unsigned int numChildren = layer.GetChildCount();
{
ReloadJsonFile( name, mBuilder, mBuilderLayer );
- mBuilderLayer.SetParentOrigin(ParentOrigin::BOTTOM_CENTER);
- mBuilderLayer.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
- Dali::Vector3 size = Stage::GetCurrent().GetRootLayer().GetCurrentSize();
+ mBuilderLayer.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_CENTER);
+ mBuilderLayer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_CENTER);
+ Dali::Vector3 size = Stage::GetCurrent().GetRootLayer().GetCurrentProperty< Vector3 >( Actor::Property::SIZE );
size.y -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
- mBuilderLayer.SetSize( size );
+ mBuilderLayer.SetProperty( Actor::Property::SIZE, size );
mNavigationView.Push( mBuilderLayer );
}
// Create an edit mode button. (left of toolbar)
Toolkit::PushButton backButton = Toolkit::PushButton::New();
- backButton.SetUnselectedImage( EDIT_IMAGE );
- backButton.SetSelectedImage( EDIT_IMAGE_SELECTED );
+ backButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE );
+ backButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED );
backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed);
- backButton.SetLeaveRequired( true );
+ backButton.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
mNavigationView = Toolkit::NavigationView::New();
mNavigationView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mNavigationView.SetAnchorPoint( AnchorPoint::TOP_LEFT);
+ mNavigationView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
stage.Add( mNavigationView );
*/
void OnQuitOrBack()
{
- if ( mItemView.OnStage() )
+ if ( mItemView.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
{
mApp.Quit();
}
Toolkit::NavigationView mNavigationView;
Toolkit::Control mView;
- unsigned int mOrientation;
Toolkit::ToolBar mToolBar;
TextLabel mTitleActor;
Layer mBuilderLayer;
- Toolkit::Popup mMenu;
-
TapGestureDetector mTapDetector;
// builder
FileWatcher mFileWatcher;
Timer mTimer;
-
-
};
//------------------------------------------------------------------------------