#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
void SetTitle(const std::string& title)
{
- if(!mTitleActor)
- {
- mTitleActor = TextView::New();
- // 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());
+ // TODO
}
bool OnToolSelectLayout( Toolkit::Button button )
{
Stage stage = Stage::GetCurrent();
+ mTapDetector = TapGestureDetector::New();
+ mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
+
if( mItemView )
{
stage.Remove( mItemView );
}
}
- mTapDetector = TapGestureDetector::New();
-
- for( unsigned int i = 0u; i < mItemView.GetChildCount(); ++i )
- {
- mTapDetector.Attach( mItemView.GetChildAt(i) );
- }
-
- mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap );
-
// Display item view on the stage
stage.Add( mItemView );
SetTitle("View");
}
- void OnTap( Actor actor, TapGesture tap )
+ void OnTap( Actor actor, const TapGesture& tap )
{
ItemId id = mItemView.GetItemId( actor );
Actor MenuItem(const std::string& text)
{
- TextView t = TextView::New();
- t.SetMarkupProcessingEnabled(true);
- t.SetText( std::string("<font size=6>") + ShortName( text ) + std::string("</font>") );
- t.SetTextAlignment( Alignment::HorizontalLeft );
- return t;
+ return Actor();
}
bool OnTimer()
Stage stage = Stage::GetCurrent();
builder = Builder::New();
+ builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit );
- PropertyValueMap defaultDirs;
+ 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;
// Create an edit mode button. (left of toolbar)
Toolkit::PushButton editButton = Toolkit::PushButton::New();
- editButton.SetBackgroundImage( Image::New( EDIT_IMAGE ) );
+ editButton.SetBackgroundImage( ResourceImage::New( EDIT_IMAGE ) );
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 );
{
if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
{
- mApp.Quit();
+ if ( mItemView.IsVisible() )
+ {
+ mApp.Quit();
+ }
+ else
+ {
+ EnterSelection();
+ }
}
}
}
+ /**
+ * Event handler when Builder wants to quit (we only want to close the shown json unless we're at the top-level)
+ */
+ void OnBuilderQuit()
+ {
+ if ( mItemView.IsVisible() )
+ {
+ mApp.Quit();
+ }
+ else
+ {
+ EnterSelection();
+ }
+ }
+
private:
Application& mApp;
unsigned int mOrientation;
Toolkit::ToolBar mToolBar;
- TextView mTitleActor; ///< The Toolbar's Title.
Layer mBuilderLayer;