/**
   * One-time setup in response to Application InitSignal.
   */
  void Create( Application& application )
  {
    Stage stage = Stage::GetCurrent();

    stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
    stage.SetBackgroundColor( Color::WHITE );

    mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 );
    mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
    mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
    mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
    mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    mTableView.TouchSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouch );
    stage.Add( mTableView );

    for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index )
    {
      const Language& language = LANGUAGES[index];

      TextLabel label = TextLabel::New();
      label.SetProperty( TextLabel::Property::MULTI_LINE, true );

      const std::string text = language.languageName + " " + language.languageRomanName + " " + language.text;
      label.SetProperty( TextLabel::Property::TEXT, text );

      mTableView.SetFitHeight( index );
      mTableView.AddChild( label, Toolkit::TableView::CellPosition( index, 0 ) );
    }
  }
Example #2
0
  // The Init signal is received once (only) during the Application lifetime
  void Create( Application& application )
  {
    Stage stage = Stage::GetCurrent();
    stage.SetBackgroundColor( Color::WHITE );
    stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent);

    mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 );
    mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
    mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
    mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
    mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    mTableView.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent );
    stage.Add( mTableView );

    for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index )
    {
      const Emoji& emoji = EMOJIS[index];
      const std::string text = emoji.mUTF8 + " " + emoji.mDescription;

      TextLabel label = TextLabel::New( text );
      label.SetParentOrigin( ParentOrigin::TOP_CENTER );
      label.SetAnchorPoint( AnchorPoint::TOP_CENTER );
      label.SetProperty( TextLabel::Property::MULTI_LINE, true );

      mTableView.SetFitHeight( index );
      mTableView.AddChild( label, Toolkit::TableView::CellPosition( index, 0 ) );
    }
  }
Example #3
0
int UtcDaliStageSetBackgroundColorP(void)
{
  TestApplication application;

  Stage stage = Stage::GetCurrent();

  Vector4 testColor( 0.1f, 0.2f, 0.3f, 1.0f );
  stage.SetBackgroundColor( testColor );

  DALI_TEST_EQUALS( testColor, stage.GetBackgroundColor(), TEST_LOCATION );
  END_TEST;
}
void EffectsViewApp::OnAppInitialize( Application& application )
{
  // The Init signal is received once (only) during the Application lifetime

  Stage stage = Stage::GetCurrent();
  stage.KeyEventSignal().Connect(this, &EffectsViewApp::OnKeyEvent);
  stage.SetBackgroundColor( Color::WHITE );

  mStageSize = stage.GetSize();

  // Creates a default view with a default tool bar.
  // The view is added to the stage.
  mContents = DemoHelper::CreateView( application, mView, mToolBar, "", TOOLBAR_IMAGE, "" );

  // Creates view change button.
  Toolkit::PushButton viewButton = Toolkit::PushButton::New();
  viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE );
  viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE );
  // Connects the view change button clicked signal to the OnView method.
  viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize );
  mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING  );

  Vector2 effectsViewSize( mStageSize.width, mStageSize.height * 0.25f );
  mDropShadowView = CreateEffectsView( EffectsView::DROP_SHADOW, effectsViewSize, mEffectSize );
  mDropShadowView.SetParentOrigin( ParentOrigin::CENTER );
  mDropShadowView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  mDropShadowView.SetZ( -mStageSize.height * 0.1f );
  mContents.Add( mDropShadowView );

  mEmbossView = CreateEffectsView( EffectsView::EMBOSS, effectsViewSize, mEffectSize );
  mEmbossView.SetParentOrigin( ParentOrigin::CENTER );
  mEmbossView.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  mEmbossView.SetZ( mStageSize.height * 0.1f );
  mContents.Add( mEmbossView );

  SetTitle( mEffectSize );
}
Example #5
0
  void Create( Application& application )
  {
    // Get a handle to the stage
    Stage stage = Stage::GetCurrent();
    stage.SetBackgroundColor(Color::YELLOW);

    // Respond to a click anywhere on the stage
    stage.KeyEventSignal().Connect(this, &AtlasController::OnKeyEvent);

    mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );

    mContentLayer = DemoHelper::CreateView( mApplication,
        mView,
        mToolBar,
        BACKGROUND_IMAGE,
        TOOLBAR_IMAGE,
        "Atlas" );

    mLoseContextButton = Toolkit::PushButton::New();
    mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE );
    mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED );
    mLoseContextButton.ClickedSignal().Connect( this, &AtlasController::OnLoseContextButtonClicked );
    mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING );

    mAtlas = Atlas::New( 400,300, Pixel::RGBA8888);
    mAtlas.Clear(Vector4(0.f,0.5f,0.5f,0.5f));
    mAtlas.Upload( DALI_IMAGE_DIR "icon-change.png", 50, 30 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-cluster-carousel.png", 100, 30 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effects-on.png", 150, 30 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-cross.png", 100, 80 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-fold.png", 150, 80 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-effect-wave.png", 200, 80 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-depth.png", 150, 130 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-grid.png", 200, 130 );
    mAtlas.Upload( DALI_IMAGE_DIR "icon-item-view-layout-spiral.png", 250, 130 );
    UploadBufferImages();

    Toolkit::ImageView imageActor1 = Toolkit::ImageView::New( mAtlas );
    imageActor1.SetY(-170.f);
    imageActor1.SetParentOrigin(ParentOrigin::CENTER);
    mContentLayer.Add( imageActor1 );

    Atlas atlas2 = Atlas::New( 400,400, Pixel::RGB888);
    atlas2.Clear( Color::RED );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-1.jpg", 4, 4 );
    atlas2.Clear( Color::BLUE );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-2.jpg", 136, 4 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-3.jpg", 268, 4 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-4.jpg", 4, 136 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-5.jpg", 136, 136 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-6.jpg", 268, 135 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 4, 268 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 136, 268 );
    atlas2.Upload( DALI_IMAGE_DIR "gallery-small-7.jpg", 268, 268 );


    Toolkit::ImageView imageView = Toolkit::ImageView::New( DALI_IMAGE_DIR "gallery-small-1.jpg" );

    imageView.SetY(200.f);
    imageView.SetZ(-1.f);
    imageView.SetParentOrigin(ParentOrigin::CENTER);
    mContentLayer.Add( imageView );

    mPanGestureDetector = PanGestureDetector::New();
    mPanGestureDetector.DetectedSignal().Connect( this, &AtlasController::OnPanGesture );
    mPanGestureDetector.Attach( imageActor1 );
    mPanGestureDetector.Attach( imageView );

    stage.ContextLostSignal().Connect( this, &AtlasController::OnContextLost );
    stage.ContextRegainedSignal().Connect( this, &AtlasController::OnContextRegained );
  }