From 93403793d6b650920e154bced5ede8e5e776cedf Mon Sep 17 00:00:00 2001 From: Nick Holland Date: Tue, 12 May 2015 14:14:53 +0100 Subject: [PATCH] Remove navigation frame control Change-Id: Ice4b22f3153f2e4a4c7ae98debfa223cee9d8b1b --- automated-tests/src/dali-toolkit/CMakeLists.txt | 2 - .../dali-toolkit/utc-Dali-NavigationControl.cpp | 354 ---------------- automated-tests/src/dali-toolkit/utc-Dali-Page.cpp | 228 ---------- dali-toolkit/dali-toolkit.h | 2 - .../controls/navigation-frame/navigation-bar.cpp | 123 ------ .../controls/navigation-frame/navigation-bar.h | 139 ------ .../navigation-frame/navigation-control-impl.cpp | 468 --------------------- .../navigation-frame/navigation-control-impl.h | 267 ------------ .../navigation-frame/navigation-title-bar.cpp | 169 -------- .../navigation-frame/navigation-title-bar.h | 96 ----- .../navigation-frame/navigation-tool-bar.cpp | 183 -------- .../navigation-frame/navigation-tool-bar.h | 101 ----- .../controls/navigation-frame/page-impl.cpp | 218 ---------- .../internal/controls/navigation-frame/page-impl.h | 182 -------- dali-toolkit/internal/file.list | 5 - .../navigation-frame/navigation-bar-style.h | 146 ------- .../navigation-frame/navigation-control.cpp | 138 ------ .../controls/navigation-frame/navigation-control.h | 247 ----------- .../public-api/controls/navigation-frame/page.cpp | 133 ------ .../public-api/controls/navigation-frame/page.h | 227 ---------- dali-toolkit/public-api/file.list | 7 - 21 files changed, 3435 deletions(-) delete mode 100644 automated-tests/src/dali-toolkit/utc-Dali-NavigationControl.cpp delete mode 100644 automated-tests/src/dali-toolkit/utc-Dali-Page.cpp delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-bar.cpp delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-bar.h delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.cpp delete mode 100644 dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.h delete mode 100644 dali-toolkit/internal/controls/navigation-frame/page-impl.cpp delete mode 100644 dali-toolkit/internal/controls/navigation-frame/page-impl.h delete mode 100644 dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h delete mode 100644 dali-toolkit/public-api/controls/navigation-frame/navigation-control.cpp delete mode 100644 dali-toolkit/public-api/controls/navigation-frame/navigation-control.h delete mode 100644 dali-toolkit/public-api/controls/navigation-frame/page.cpp delete mode 100644 dali-toolkit/public-api/controls/navigation-frame/page.h diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index e522f31..67e0ddb 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -22,9 +22,7 @@ SET(TC_SOURCES utc-Dali-GaussianBlurView.cpp utc-Dali-JsonParser.cpp utc-Dali-KeyInputFocusManager.cpp - utc-Dali-NavigationControl.cpp utc-Dali-OverlayEffect.cpp - utc-Dali-Page.cpp utc-Dali-PageTurnEffect.cpp utc-Dali-PageTurnView.cpp utc-Dali-ScrollView.cpp diff --git a/automated-tests/src/dali-toolkit/utc-Dali-NavigationControl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-NavigationControl.cpp deleted file mode 100644 index 4e81bf6..0000000 --- a/automated-tests/src/dali-toolkit/utc-Dali-NavigationControl.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include - - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ - -static bool gObjectCreatedCallBackCalled; -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -} - - -void navigation_control_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void navigation_control_cleanup(void) -{ - test_return_value = TET_PASS; -} - -int UtcDaliNavigationControlNew(void) -{ - ToolkitTestApplication application; - tet_infoline("UtcDaliNavigationControlNew"); - - NavigationControl naviControl; - // Check that this handle is uninitialized - DALI_TEST_CHECK( !naviControl ); - - naviControl = NavigationControl::New(); - // Check that the Dali resource is successfully created - DALI_TEST_CHECK( naviControl ); - - NavigationControl naviControl2( naviControl ); - DALI_TEST_CHECK( naviControl2 == naviControl ); - - //Additional check to ensure object is created by checking whether it is registered - ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); - gObjectCreatedCallBackCalled = false; - registry.ObjectCreatedSignal().Connect( TestCallback ); - { - NavigationControl naviControl = NavigationControl::New(); - } - DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); - END_TEST; -} - -int UtcDaliNavigationControlDownCast(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlDownCast" ); - - NavigationControl naviControl = NavigationControl::New(); - BaseHandle handle( naviControl ); - - NavigationControl newNaviControl = NavigationControl::DownCast( handle ); - DALI_TEST_CHECK( naviControl ); - DALI_TEST_CHECK( newNaviControl == naviControl ); - END_TEST; -} - -int UtcDaliNavigationControlPushItem(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlPushItem" ); - - // Create a NavigationControl object, and add it to stage - NavigationControl naviControl = NavigationControl::New(); - Stage::GetCurrent().Add(naviControl); - // Check there is no item in the stack - DALI_TEST_CHECK( naviControl.GetItemCount() == 0 ); - - // Create two NavigationItem objects - Page firstItem = Page::New(); - Page secondItem = Page::New(); - - // Push the first item into stack - naviControl.PushItem( firstItem ); - // Check the item count in stack - DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); - // Check the current item - DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem ); - // Check that the newly pushed item is displayed on stage - DALI_TEST_CHECK( firstItem.OnStage() ); - - // Push the second item into stack - naviControl.PushItem( secondItem ); - // Check the item count in stack - DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); - // Check the current item - DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); - // Check the bottom item in the stack - DALI_TEST_CHECK( naviControl.GetItem(0) == firstItem ); - // Check that the previous item is off stage - DALI_TEST_CHECK( !firstItem.OnStage() ); - // Check that the newly pushed item is displayed on stage - DALI_TEST_CHECK( secondItem.OnStage() ); - - Page thirdItem; - Page fourthItem(secondItem); - naviControl.PushItem( thirdItem ); - // Check that an uninitialized item cannot be pushed into the stack - DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); - naviControl.PushItem( fourthItem ); - // Check that an duplicated item with the current item cannot be pushed into the stack - DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); - // Check that the current item and the item on the stage is still the secondItem - DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); - DALI_TEST_CHECK( secondItem.OnStage() ); - END_TEST; -} - -int UtcDaliNavigationControlPopItem(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlPopItem" ); - - // Create a NavigationControl object, and add it to stage - NavigationControl naviControl = NavigationControl::New(); - Stage::GetCurrent().Add(naviControl); - // Create three NavigationItem objects - Page firstItem = Page::New(); - Page secondItem = Page::New(); - Page thirdItem = Page::New(); - naviControl.PushItem( firstItem ); - naviControl.PushItem( secondItem ); - naviControl.PushItem( thirdItem ); - - DALI_TEST_CHECK( naviControl.GetItemCount() == 3 ); - - // pop an item out from the stack - Page poppedItem = naviControl.PopItem(); - // check that the item count is decrease by one - DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); - // check that the item popped out is the thirdItem - DALI_TEST_CHECK( poppedItem == thirdItem ); - // check that the item popped out is disappeared from the stage - DALI_TEST_CHECK( !poppedItem.OnStage() ); - // check that the new top item is displayed on the stage - DALI_TEST_CHECK( secondItem.OnStage() ); - - // repeat the above steps again - poppedItem = naviControl.PopItem(); - DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); - DALI_TEST_CHECK( poppedItem == secondItem ); - DALI_TEST_CHECK( !poppedItem.OnStage() ); - DALI_TEST_CHECK( firstItem.OnStage() ); - - // check that the bottom-most item can not be popped out from the stack - poppedItem = naviControl.PopItem(); - // when trying to pop the bottom-most item, it returns an uninitialized handle and does nothing else - DALI_TEST_CHECK( !poppedItem ); - DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); - DALI_TEST_CHECK( firstItem.OnStage() ); - END_TEST; -} - -int UtcDaliNavigationControlGetItemCount(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlGetItemCount" ); - - // Create a NavigationControl object - NavigationControl naviControl = NavigationControl::New(); - // Create three NavigationItem objects - Page firstItem = Page::New(); - Page secondItem = Page::New(); - Page thirdItem = Page::New(); - - DALI_TEST_CHECK( naviControl.GetItemCount() == 0 ); - naviControl.PushItem( firstItem ); - DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); - naviControl.PushItem( secondItem ); - DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); - naviControl.PushItem( thirdItem ); - DALI_TEST_CHECK( naviControl.GetItemCount() == 3 ); - naviControl.PopItem(); - DALI_TEST_CHECK( naviControl.GetItemCount() == 2 ); - naviControl.PopItem(); - DALI_TEST_CHECK( naviControl.GetItemCount() == 1 ); - END_TEST; -} - -int UtcDaliNavigationControlGetItem(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlGetItem" ); - - // Create a NavigationControl object - NavigationControl naviControl = NavigationControl::New(); - // Create three NavigationItem objects and push them into stack - Page firstItem = Page::New(); - Page secondItem = Page::New(); - Page thirdItem = Page::New(); - naviControl.PushItem( firstItem ); - naviControl.PushItem( secondItem ); - naviControl.PushItem( thirdItem ); - - // check every item by get it by index - DALI_TEST_CHECK( naviControl.GetItem(0) == firstItem ); - DALI_TEST_CHECK( naviControl.GetItem(1) == secondItem ); - DALI_TEST_CHECK( naviControl.GetItem(2) == thirdItem); - END_TEST; -} - -int UtcDaliNavigationControlGetCurrentItem(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlGetCurrentItem" ); - - // Create a NavigationControl object - NavigationControl naviControl = NavigationControl::New(); - // Create three NavigationItem objects - Page firstItem = Page::New(); - Page secondItem = Page::New(); - Page thirdItem = Page::New(); - - naviControl.PushItem( firstItem ); - DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem ); - naviControl.PushItem( secondItem ); - DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); - naviControl.PushItem( thirdItem ); - DALI_TEST_CHECK( naviControl.GetCurrentItem() == thirdItem ); - naviControl.PopItem(); - DALI_TEST_CHECK( naviControl.GetCurrentItem() == secondItem ); - naviControl.PopItem(); - DALI_TEST_CHECK( naviControl.GetCurrentItem() == firstItem ); - END_TEST; -} - -int UtcDaliNavigationControlSetBackground(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlSetBackground" ); - - try - { - NavigationControl naviControl = NavigationControl::New(); - Stage::GetCurrent().Add( naviControl ); - - ImageActor background = CreateSolidColorActor( Color::RED ); - naviControl.SetBackground( background ); - } - catch (Dali::DaliException& e) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_EQUALS(e.condition, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION); - tet_result(TET_FAIL); - } - - tet_result(TET_PASS); - END_TEST; -} - -int UtcDaliNavigationControlCreateNavigationToolBar(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlCreateNavigationToolBar" ); - - ImageActor background = CreateSolidColorActor( Color::RED ); - Stage stage = Stage::GetCurrent(); - - NavigationControl naviControl = NavigationControl::New(); - stage.Add( naviControl ); - - Toolkit::NaviToolBarStyle toolbarStyle( background, 720, 98, 496, 182, 72, 16, 63, 26); - - naviControl.CreateNavigationToolBar( toolbarStyle, toolbarStyle); - - Page naviItem = Page::New(); - PushButton firstControl = PushButton::New(); - naviItem.AddControlToToolBar(firstControl, Alignment::HorizontalLeft); - PushButton secondControl = PushButton::New(); - naviItem.AddControlToToolBar(secondControl, Alignment::HorizontalCenter); - PushButton thirdControl = PushButton::New(); - naviItem.AddControlToToolBar(thirdControl, Alignment::HorizontalCenter); - PushButton fourthControl = PushButton::New(); - naviItem.AddControlToToolBar(fourthControl, Alignment::HorizontalRight); - PushButton fifthControl = PushButton::New(); - naviItem.AddControlToToolBar(fifthControl, Alignment::HorizontalRight); - - naviControl.PushItem( naviItem ); - - DALI_TEST_CHECK( firstControl.OnStage() ); - // Can add multiple controls to the central group - DALI_TEST_CHECK( secondControl.OnStage() ); - DALI_TEST_CHECK( thirdControl.OnStage() ); - // Can only have one control in the side groups - DALI_TEST_CHECK( !fourthControl.OnStage() ); - DALI_TEST_CHECK( fifthControl.OnStage() ); - - END_TEST; -} - -int UtcDaliNavigationControlCreateNavigationTitleBar(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliNavigationControlCreateNavigationTitleBar" ); - - ImageActor background = CreateSolidColorActor( Color::RED ); - Stage stage = Stage::GetCurrent(); - - NavigationControl naviControl = NavigationControl::New(); - stage.Add( naviControl ); - - Toolkit::NaviTitleBarStyle titleBarStyle( background, 720, 111, 68, 48, 34, 16, 11, 45, 63, 26, 14, 22 ); - naviControl.CreateNavigationTitleBar( titleBarStyle, titleBarStyle ); - - Page naviItem = Page::New(); - - PushButton firstControl = PushButton::New(); - naviItem.AddControlToTitleBar( firstControl ); - PushButton secondControl = PushButton::New(); - naviItem.AddControlToTitleBar( secondControl ); - - Actor titleIcon = Actor::New(); - naviItem.SetTitleIcon( titleIcon ); - - naviControl.PushItem( naviItem ); - - DALI_TEST_CHECK( firstControl.OnStage() ); - DALI_TEST_CHECK( secondControl.OnStage() ); - DALI_TEST_CHECK( titleIcon.OnStage() ); - END_TEST; -} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Page.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Page.cpp deleted file mode 100644 index 93f2293..0000000 --- a/automated-tests/src/dali-toolkit/utc-Dali-Page.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include - -using namespace Dali; -using namespace Dali::Toolkit; - -void dali_page_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void dali_page_cleanup(void) -{ - test_return_value = TET_PASS; -} - -namespace -{ -static bool gObjectCreatedCallBackCalled; -static void TestCallback(BaseHandle handle) -{ - gObjectCreatedCallBackCalled = true; -} - -} - - - -int UtcDaliPageNew(void) -{ - ToolkitTestApplication application; - tet_infoline("UtcDaliPageNew"); - - Page naviItem; - // Check that this handle is uninitialized - DALI_TEST_CHECK( !naviItem ); - - naviItem = Page::New(); - // Check that the Dali resource is successfully created - DALI_TEST_CHECK( naviItem ); - - Page naviItem2( naviItem ); - DALI_TEST_CHECK( naviItem2 == naviItem ); - - // Additional check to ensure the object is created by checking whether it is registered - ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry(); - DALI_TEST_CHECK( registry ); - gObjectCreatedCallBackCalled = false; - registry.ObjectCreatedSignal().Connect( TestCallback ); - { - Page naviItem = Page::New(); - } - DALI_TEST_CHECK( gObjectCreatedCallBackCalled ); - END_TEST; -} - -int UtcDaliPageDownCast(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageDownCast" ); - - Page naviItem = Page::New(); - BaseHandle handle( naviItem ); - - Page newNaviItem = Page::DownCast( handle ); - DALI_TEST_CHECK( naviItem ); - DALI_TEST_CHECK( newNaviItem == naviItem ); - END_TEST; -} - -int UtcDaliPageSetGetTitle(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageSetGetTitle" ); - - Page naviItem = Page::New(); - DALI_TEST_CHECK( naviItem.GetTitle().empty() ); - - std::string str( "ItemTitle" ); - naviItem.SetTitle( str ); - DALI_TEST_CHECK( naviItem.GetTitle() == str ); - END_TEST; -} - -int UtcDaliPageSetGetSubTitle(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageSetGetSubTitle" ); - - Page naviItem = Page::New(); - DALI_TEST_CHECK( naviItem.GetSubTitle().empty() ); - - std::string str( "ItemSubTitle" ); - naviItem.SetSubTitle( str ); - DALI_TEST_CHECK( naviItem.GetSubTitle() == str ); - END_TEST; -} - -int UtcDaliPageSetGetTitleIcon(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageSetGetTitleIcon" ); - - Page naviItem = Page::New(); - DALI_TEST_CHECK( !naviItem.GetTitleIcon() ); - - Actor titleIcon = Actor::New(); - naviItem.SetTitleIcon( titleIcon ); - DALI_TEST_CHECK( naviItem.GetTitleIcon() == titleIcon ); - END_TEST; -} - -int UtcDaliPageAddGetToolBarControl(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageAddGetToolBarControl" ); - - Page naviItem = Page::New(); - Page::ControlOnBarContainer container = naviItem.GetControlsOnToolBar(); - // Check that the container is empty in the beginning - DALI_TEST_CHECK( container.empty() ); - - // Add control, check whether adding successfully, also check the container size - PushButton firstControl = PushButton::New(); - DALI_TEST_CHECK( naviItem.AddControlToToolBar(firstControl, Alignment::HorizontalLeft) ); - container = naviItem.GetControlsOnToolBar(); - DALI_TEST_CHECK( container.size() == 1 ); - - // Add control, check whether adding successfully, also check the container size - PushButton secondControl = PushButton::New(); - DALI_TEST_CHECK( naviItem.AddControlToToolBar(secondControl, Alignment::HorizontalCenter) ); - container = naviItem.GetControlsOnToolBar(); - DALI_TEST_CHECK( container.size() == 2 ); - - // The control adding fails, as the alignment is not HorizontalLeft/HorizontalCenter/HorizontalRight - PushButton thirdControl = PushButton::New(); - DALI_TEST_CHECK( !naviItem.AddControlToToolBar(thirdControl, Alignment::VerticalCenter) ); - container = naviItem.GetControlsOnToolBar(); - DALI_TEST_CHECK( container.size() == 2 ); - - // Add control, check whether adding successfully, also check the container size - PushButton fourthControl = PushButton::New(); - DALI_TEST_CHECK( naviItem.AddControlToToolBar(fourthControl, Alignment::HorizontalRight) ); - container = naviItem.GetControlsOnToolBar(); - DALI_TEST_CHECK( container.size() == 3 ); - - // The control adding fails, as the control itself is uninitialized - PushButton fifthControl; - DALI_TEST_CHECK( !naviItem.AddControlToToolBar(fifthControl, Alignment::HorizontalCenter) ); - container = naviItem.GetControlsOnToolBar(); - DALI_TEST_CHECK( container.size() == 3 ); - - // check the content of the three successfully added ControlOnBar objects - DALI_TEST_CHECK( container[0]->control == firstControl ); - DALI_TEST_CHECK( container[0]->alignment == Alignment::HorizontalLeft ); - DALI_TEST_CHECK( container[1]->control == secondControl ); - DALI_TEST_CHECK( container[1]->alignment == Alignment::HorizontalCenter ); - DALI_TEST_CHECK( container[2]->control == fourthControl ); - DALI_TEST_CHECK( container[2]->alignment == Alignment::HorizontalRight ); - END_TEST; -} - -int UtcDaliPageAddGetTitleBarControl(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageAddGetTitleBarControl" ); - - Page naviItem = Page::New(); - ActorContainer container = naviItem.GetControlsOnTitleBar(); - // Check that the container is empty in the beginning - DALI_TEST_CHECK( container.empty() ); - - // Add control, check whether adding successfully, also check the container size - PushButton firstControl = PushButton::New(); - DALI_TEST_CHECK( naviItem.AddControlToTitleBar(firstControl) ); - container = naviItem.GetControlsOnTitleBar(); - DALI_TEST_CHECK( container.size() == 1 ); - - // The control adding fails, as the control itself is uninitialized - PushButton secondControl; - DALI_TEST_CHECK( !naviItem.AddControlToTitleBar(secondControl) ); - container = naviItem.GetControlsOnTitleBar(); - DALI_TEST_CHECK( container.size() == 1 ); - - // Add control, check whether adding successfully, also check the container size - PushButton thirdControl = PushButton::New(); - DALI_TEST_CHECK( naviItem.AddControlToTitleBar(thirdControl) ); - container = naviItem.GetControlsOnTitleBar(); - DALI_TEST_CHECK( container.size() == 2 ); - - // check the content of the three successfully added Controls - DALI_TEST_CHECK( container[0] == firstControl ); - DALI_TEST_CHECK( container[1] == thirdControl ); - END_TEST; -} - -int UtcDaliPageSetGetPopupMenu(void) -{ - ToolkitTestApplication application; - tet_infoline( "UtcDaliPageSetGetPopupMenu" ); - - Page naviItem = Page::New(); - DALI_TEST_CHECK( !naviItem.GetPopupMenu() ); - - Toolkit::Popup menu = Toolkit::Popup::New(); - naviItem.SetPopupMenu( menu ); - DALI_TEST_CHECK( menu == naviItem.GetPopupMenu() ); - END_TEST; -} diff --git a/dali-toolkit/dali-toolkit.h b/dali-toolkit/dali-toolkit.h index f9bdac1..36d50c8 100644 --- a/dali-toolkit/dali-toolkit.h +++ b/dali-toolkit/dali-toolkit.h @@ -39,8 +39,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-bar.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-bar.cpp deleted file mode 100644 index 6e34571..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-bar.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "navigation-bar.h" - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES - - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -NavigationBar::NavigationBar(NavigationControl& naviControl, - Toolkit::BasicNaviBarStyle barStylePortrait, - Toolkit::BasicNaviBarStyle barStyleLandscape ) -:mInternalNavigationControl( naviControl ), - mBasicStylePortrait( barStylePortrait ), - mBasicStyleLandscape( barStyleLandscape ), - mBasicCurrentStyle( &mBasicStylePortrait ), - mIsPortrait( true ), - mVisible( true ) -{ - mInternalNavigationControl.ItemPushedSignal().Connect( this, &NavigationBar::OnItemPushed ); - mInternalNavigationControl.ItemPoppedSignal().Connect( this, &NavigationBar::OnItemPopped ); - - mLayout = Toolkit::TableView::New(1,3); - mInternalNavigationControl.GetBarLayer().Add(mLayout); - mLayout.SetSize(mBasicCurrentStyle->referenceWidth, mBasicCurrentStyle->height); - mLayout.SetFixedHeight(0, mBasicCurrentStyle->height); - mLayout.SetDrawMode(DrawMode::OVERLAY); - - SetBackground( mBasicCurrentStyle->background ); -} - -NavigationBar::~NavigationBar() -{ -} - -void NavigationBar::ScaleStyleUpdate( Vector2 naviControlSize, int orientation ) -{ - bool isPortrait( orientation == 0 || orientation == 180 ); - // change in orientation. - if(mIsPortrait != isPortrait) - { - mIsPortrait = isPortrait; - mBasicCurrentStyle = isPortrait ? &mBasicStylePortrait : &mBasicStyleLandscape; - OrientationUpdate( isPortrait ); - mLayout.SetSize(mBasicCurrentStyle->referenceWidth, mBasicCurrentStyle->height); - mLayout.SetFixedHeight(0, mBasicCurrentStyle->height); - if(mBackground) - { - mBackground.SetSize(mBasicCurrentStyle->referenceWidth, mBasicCurrentStyle->height); - } - } - - mRelativeScale = naviControlSize.x / static_cast( mBasicCurrentStyle->referenceWidth); - mLayout.SetScale(mRelativeScale); - mBarHeight = mBasicCurrentStyle->height * mRelativeScale; - if(mBackground) - { - mBackground.SetScale(mRelativeScale); - } -} - -float NavigationBar::GetBarHeight() const -{ - if( mVisible ) - { - return mBarHeight; - } - else - { - return 0.0f; - } -} - -void NavigationBar::SetBackground( Actor background ) -{ - mBackground = background; - mBackground.SetSize(mBasicCurrentStyle->referenceWidth, mBasicCurrentStyle->height); - mInternalNavigationControl.GetBarLayer().Add( mBackground ); - mBackground.SetScale(mRelativeScale); -} - -void NavigationBar::OnItemPushed( Toolkit::NavigationControl naviControl, Toolkit::Page naviItem ) -{ - mCurrentItem = naviItem; - Update( mCurrentItem ); -} - -void NavigationBar::OnItemPopped( Toolkit::NavigationControl naviControl, Toolkit::Page naviItem ) -{ - mCurrentItem = mInternalNavigationControl.GetCurrentItem(); - Update( mCurrentItem ); -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-bar.h b/dali-toolkit/internal/controls/navigation-frame/navigation-bar.h deleted file mode 100644 index 0a30fdd..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-bar.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_NAVIGATION_BAR_H__ -#define __DALI_TOOLKIT_INTERNAL_NAVIGATION_BAR_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -/** - * Base class for different navigation bars such as tool bar, title bar. - */ -class NavigationBar : public Dali::RefObject, public ConnectionTracker -{ - -public: - /** - * Constructor - * Pass in the navigationControl with which the bar associates and its style. - */ - NavigationBar( NavigationControl& naviControl, - Toolkit::BasicNaviBarStyle barStylePortrait, - Toolkit::BasicNaviBarStyle barStyleLandscape); - - /** - * Update the bar scale when the size of the navigation control is set / reset - * Also Update the style when the orientation( portrait/landscape) is changed - * @param[in] naviControlSize The size of the navigation control - * @param[in] orientation The angle of the current orientation - */ - void ScaleStyleUpdate( Vector2 naviControlSize, int orientation ); - - /** - * Retrieve the height of the bar - * @return The height of the bar - */ - float GetBarHeight() const; - -private: - - /** - * Set a background image and add it onto the NavigaionControl's bar layer. - * - */ - void SetBackground( Actor background ); - - /** - * Call the update function when it receives the page pushed signal. - */ - void OnItemPushed( Toolkit::NavigationControl naviControl, Toolkit::Page naviItem ); - - /** - * Call the update function when it receives the page popped signal. - */ - void OnItemPopped( Toolkit::NavigationControl naviControl, Toolkit::Page naviItem ); - -protected: - - /** - * virtual destructor - */ - virtual ~NavigationBar(); - - /** - * Given the current page, update the bar content. - * @param[in] naviItem the item on the top of the navigation stack - */ - virtual void Update( Toolkit::Page naviItem ) = 0; - - /** - * update the bar style when the orientation is changed - * @param[in] isPortrait Whether the current orientation is portrait mode - */ - virtual void OrientationUpdate( bool isPortrait ) = 0; - -private: - - // Undefined - NavigationBar(const NavigationBar&); - - // Undefined - NavigationBar& operator=(const NavigationBar& rhs); - - -protected: - NavigationControl& mInternalNavigationControl; - Toolkit::BasicNaviBarStyle mBasicStylePortrait; - Toolkit::BasicNaviBarStyle mBasicStyleLandscape; - const Toolkit::BasicNaviBarStyle* mBasicCurrentStyle; - float mRelativeScale; - float mBarHeight; - - Toolkit::TableView mLayout; - Actor mBackground; - - bool mIsPortrait; - Toolkit::Page mCurrentItem; - - bool mVisible; -}; - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali - - -#endif /* __DALI_TOOLKIT_INTERNAL_NAVIGATION_BAR_H__ */ diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp deleted file mode 100644 index 042fe35..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "navigation-control-impl.h" - -// EXTERNAL INCLUDES -#include // for strcmp -#include -#include -#include -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace // to register type -{ - -BaseHandle Create() -{ - return Toolkit::NavigationControl::New(); -} - -// Setup properties, signals and actions using the type-registry. -DALI_TYPE_REGISTRATION_BEGIN( Toolkit::NavigationControl, Toolkit::Control, Create ) - -DALI_ACTION_REGISTRATION( Toolkit, NavigationControl, "push", ACTION_PUSH ) -DALI_ACTION_REGISTRATION( Toolkit, NavigationControl, "pop", ACTION_POP ) - -DALI_TYPE_REGISTRATION_END() - -} - -NavigationControl::NavigationControl() -: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ), - mToolBar(NULL), - mTitleBar(NULL), - mOrientationAngle( 0 ), - mOrientationAnimationDuration( 1.0f ), - mOrientationAnimationAlphaFunc( AlphaFunction::EASE_OUT ), - mItemPositionCoefficient( Vector3( 0.0f, 1.0f, 0.0f) ), - mItemPushedSignal( ), - mItemPoppedSignal( ) -{ -} - -NavigationControl::~NavigationControl() -{ - // Clear all the items in the stack, forces their destruction before NavigationControl is destroyed. - mItemStack.clear(); -} - -void NavigationControl::OnInitialize() -{ - //create layers for display background, current item, and bars respectively - mBackgroundLayer = CreateLayer(); - mContentLayer = CreateLayer(); - mBarLayer = CreateLayer(); - mPopupLayer = CreateLayer(); -} - -void NavigationControl::OnControlChildAdd( Actor& child ) -{ - Toolkit::Page page = Toolkit::Page::DownCast(child); - - // If it's a page then store it locally, Off stage. - if(page) - { - mUnpushedItems.push_back(page); - - // Orphan it until needed later during "push". - Self().Remove( child ); - } -} - -Toolkit::NavigationControl NavigationControl::New() -{ - // Create the implementation, temporarily owned by this handle on stack - IntrusivePtr< NavigationControl > internalNavigationControl = new NavigationControl(); - - // Pass ownership to CustomActor handle - Toolkit::NavigationControl navigationControl( *internalNavigationControl ); - - // Second-phase init of the implementation - // This can only be done after the CustomActor connection has been made... - internalNavigationControl->Initialize(); - - return navigationControl; -} - -void NavigationControl::OnStageConnection() -{ - //only works when navigation control is already on stage! - mContentLayer.RaiseAbove( mBackgroundLayer ); - mBarLayer.RaiseAbove( mContentLayer ); - mPopupLayer.RaiseAbove( mBarLayer ); - Self().SetSensitive(true); - SetKeyInputFocus(); -} - -void NavigationControl::PushItem( Toolkit::Page page ) -{ - // check the uninitialized item - // check the duplicated push for the top item - if(!page || page == mCurrentItem) - { - return; - } - - if( mCurrentItem ) - { - mContentLayer.Remove( mCurrentItem ); - } - - //push the new item into the stack and show it - mItemStack.push_back(page); - mCurrentItem = page; - mContentLayer.Add(page); - mCurrentItem.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); - - //set up the popup menu which would response to the KEY_MENU - SetupPopupMenu(); - - //Emit singal - Toolkit::NavigationControl handle( GetOwner() ); - mItemPushedSignal.Emit(handle, page); -} - -Toolkit::Page NavigationControl::PopItem() -{ - // cannot pop out the bottom-most item - Toolkit::Page poppedItem; - if(mItemStack.size() > 1) - { - // pop out the top item of the stack and show the new item right under the old one. - mContentLayer.Remove(mCurrentItem); - poppedItem = mItemStack.back(); - mItemStack.pop_back(); - mCurrentItem = mItemStack.back(); - mContentLayer.Add(mCurrentItem); - - //set up the popup menu which would response to the KEY_MENU - SetupPopupMenu(); - } - - //Emit signal - Toolkit::NavigationControl handle( GetOwner() ); - mItemPoppedSignal.Emit(handle, poppedItem); - - return poppedItem; -} - -size_t NavigationControl::GetItemCount() const -{ - return mItemStack.size(); -} - -Toolkit::Page NavigationControl::GetItem(std::size_t index) const -{ - DALI_ASSERT_ALWAYS( index < mItemStack.size() ); - return mItemStack[index]; -} - -Toolkit::Page NavigationControl::GetCurrentItem() const -{ - return mCurrentItem; -} - -void NavigationControl::SetBackground( Actor background) -{ - // It removes the old background - if( mBackground ) - { - mBackgroundLayer.Remove( mBackground ); - } - mBackgroundLayer.Add( background ); - mBackground = background; - mBackground.SetSize( mControlSize ); -} - -void NavigationControl::CreateNavigationToolBar(Toolkit::NaviToolBarStyle toolBarStylePortrait, - Toolkit::NaviToolBarStyle toolBarStyleLandscape ) -{ - // Set a navigation tool bar at the bottom of the navigation frame - // the controls on the tool bar will update automatically when item is pushed or popped by responding to the signals - mToolBar = new NavigationToolBar(*this, toolBarStylePortrait, toolBarStyleLandscape); -} - -void NavigationControl::CreateNavigationTitleBar(Toolkit::NaviTitleBarStyle titleBarStylePortrait, - Toolkit::NaviTitleBarStyle titleBarStyleLandscape) -{ - // Set a navigation title bar at the top of the navigation frame - // the tile/subtitle/titl icon/buttons will update automatically when item is pushed or popped by responding to the signals - mTitleBar = new NavigationTitleBar(*this, titleBarStylePortrait, titleBarStyleLandscape); -} - -void NavigationControl::OrientationChanged( int angle ) -{ - if( mOrientationAngle != angle ) - { - Vector2 targetSize = Vector2(GetSizeSet()); - - // checking to see if changing from landscape -> portrait, or portrait -> landscape - if( mOrientationAngle%180 != angle%180 ) - { - targetSize = Vector2( targetSize.height, targetSize.width ); - } - - mOrientationAngle = angle; - - switch(angle) - { - case 0: - { - mItemPositionCoefficient = Vector3(0.0f, 1.0f, 0.0f); - break; - } - case 90: - { - mItemPositionCoefficient = Vector3(1.0f, 0.0f, 0.0f); - break; - } - case 180: - { - mItemPositionCoefficient = Vector3(0.0f, -1.0f, 0.0f); - break; - } - case 270: - { - mItemPositionCoefficient = Vector3(-1.0f, 0.0f, 0.0f); - break; - } - default: - { - DALI_ASSERT_ALWAYS(false); - break; - } - } - - Actor self = Self(); - Animation animation = Animation::New( mOrientationAnimationDuration ); - animation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -angle ) ), Vector3::ZAXIS ), mOrientationAnimationAlphaFunc ); - animation.Play(); - - self.SetSize( targetSize ); - - RelayoutRequest(); - } -} - -void NavigationControl::SetOrientationRotateAnimation( float duration, AlphaFunction alphaFunc) -{ - mOrientationAnimationDuration = duration; - mOrientationAnimationAlphaFunc = alphaFunc; -} - -Layer NavigationControl::GetBarLayer() const -{ - return mBarLayer; -} - -void NavigationControl::OnRelayout( const Vector2& size, RelayoutContainer& container ) -{ - const Vector2 setSize( size ); - - if( mCurrentItem ) - { - // always set the current item to fully occupy navigationControl space apart from the bars, - // here the bars might be hidden if the current item does not need them - float positionOffset = 0.0f; - float sizeShrink = 0.0f; - if(mTitleBar) - { - positionOffset += mTitleBar->GetBarHeight()*0.5f; - sizeShrink += mTitleBar->GetBarHeight(); - } - if(mToolBar) - { - positionOffset -= mToolBar->GetBarHeight()*0.5f; - sizeShrink += mToolBar->GetBarHeight(); - } - mCurrentItem.SetPosition( mItemPositionCoefficient * positionOffset); - Vector2 itemSize( setSize.x, setSize.y-sizeShrink ); - - container.Add( mCurrentItem, itemSize ); - } - - container.Add( mBarLayer, setSize ); - container.Add( mPopupLayer, setSize ); -} - -void NavigationControl::OnControlSizeSet( const Vector3& size ) -{ - if( mControlSize == Vector2(size) ) - { - return; - } - mControlSize = Vector2(size); - - mBarLayer.SetSize(mControlSize); - mPopupLayer.SetSize(mControlSize); - - if( mBackground ) - { - mBackground.SetSize( mControlSize ); - } - if( mToolBar ) - { - mToolBar->ScaleStyleUpdate( mControlSize, mOrientationAngle ); - } - if( mTitleBar ) - { - mTitleBar->ScaleStyleUpdate( mControlSize, mOrientationAngle ); - } -} - -bool NavigationControl::OnKeyEvent( const KeyEvent& event ) -{ - bool consumed = false; - - if(event.state == KeyEvent::Down) - { - if(event.keyCode == 96 ) // F12 == for test - //if( event.keyCode == Dali::DALI_KEY_BACK || event.keyCode == Dali::DALI_KEY_ESCAPE ) - { - if( mPopupMenu && mPopupMenu.IsSensitive() ) // State:POPUP_SHOW - { - mPopupMenu.Hide(); - consumed = true; - } - else if(PopItem()) - { - consumed = true; - } - } - - if( mPopupMenu && event.keyCode == 9) - //if( mPopupMenu && ( event.keyCode == Dali::DALI_KEY_MENU || event.keyCode == Dali::DALI_KEY_SEND ) ) - //Todo: replace with dali key enum after the mapping between X key definition and dali key enum is implemented in dali-adapto - //if( mPopupMenu && event.keyPressedName == "XF86Send" ) - { - if( !mPopupMenu.IsSensitive() ) // State: POPUP_HIDE - { - mPopupMenu.Show(); - } - else // State:POPUP_SHOW - { - mPopupMenu.Hide(); - } - consumed = true; - } - } - - return consumed; -} - -Layer NavigationControl::CreateLayer() -{ - Layer layer = Layer::New(); - layer.SetPositionInheritanceMode(USE_PARENT_POSITION); - Self().Add(layer); - return layer; -} - -void NavigationControl::SetupPopupMenu() -{ - if(mPopupMenu) - { - mPopupLayer.Remove( mPopupMenu ); - } - mPopupMenu = mCurrentItem.GetPopupMenu(); - if( mPopupMenu ) - { - mPopupLayer.Add( mPopupMenu ); - mPopupMenu.OutsideTouchedSignal().Connect(this, &NavigationControl::OnPopupTouchedOutside); - } -} - -void NavigationControl::OnPopupTouchedOutside() -{ - if( mPopupMenu ) - { - mPopupMenu.Hide(); - } -} - -Toolkit::NavigationControl::ItemPushedSignalType& NavigationControl::ItemPushedSignal() -{ - return mItemPushedSignal; -} - -Toolkit::NavigationControl::ItemPoppedSignalType& NavigationControl::ItemPoppedSignal() -{ - return mItemPoppedSignal; -} - -bool NavigationControl::DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes ) -{ - bool ret = false; - - Dali::BaseHandle handle( object ); - Toolkit::NavigationControl control = Toolkit::NavigationControl::DownCast( handle ); - DALI_ASSERT_ALWAYS( control ); - - if( 0 == strcmp( actionName.c_str(), ACTION_PUSH ) ) - { - for( PropertyValueConstIter iter = attributes.begin(); iter != attributes.end(); ++iter ) - { - const Property::Value& value = *iter; - - DALI_ASSERT_ALWAYS( value.GetType() == Property::STRING ); - std::string itemName = value.Get(); - - for( std::list::iterator itemsIter = GetImpl( control ).mUnpushedItems.begin(); itemsIter != GetImpl( control ).mUnpushedItems.end(); ++itemsIter ) - { - Toolkit::Page page = *itemsIter; - if( page.GetName() == itemName ) - { - GetImpl( control ).PushItem( page ); - ret = true; - break; - } - } - } - } - else if( 0 == strcmp( actionName.c_str(), ACTION_POP ) ) - { - GetImpl( control ).PopItem(); - - ret = true; - } - - return ret; -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h b/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h deleted file mode 100644 index 1e7f0a2..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.h +++ /dev/null @@ -1,267 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_NAVIGATION_CONTROL_H__ -#define __DALI_TOOLKIT_INTERNAL_NAVIGATION_CONTROL_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -class NavigationControl; -class Page; - -namespace Internal -{ - -class NavigationBar; - -/** - * NavigationControl implements a controller than manages the navigation of hierarchical contents. - * @see Dali::Toolkit::NavigationControl for more details. - */ -class NavigationControl : public Control -{ -public: - - /** - * Create an initialized NavigationControl. - * @return A handle to a newly allocated Dali resource - */ - static Toolkit::NavigationControl New(); - - /** - * @copydoc Dali::Toolkit::NavigationControl::PushItem() - */ - void PushItem( Toolkit::Page page ); - - /** - * @copydoc Dali::Toolkit::NavigationControl::PopItem() - */ - Toolkit::Page PopItem(); - - /** - * @copydoc Dali::Toolkit::NavigationControl::GetItemCount() - */ - size_t GetItemCount() const; - - /** - * @copydoc Dali::Toolkit::NavigationControl::GetItem() - */ - Toolkit::Page GetItem(std::size_t index) const; - - /** - * @copydoc Dali::Toolkit::NavigationControl::GetCurrentItem() - */ - Toolkit::Page GetCurrentItem() const; - - /** - * @copydoc Dali::Toolkit::NavigationControl::SetBackground() - */ - void SetBackground( Actor background); - - /** - * @copydoc Dali::Toolkit::NavigationControl::CreateNavigationToolBar() - */ - void CreateNavigationToolBar( Toolkit::NaviToolBarStyle toolBarStylePortrait, - Toolkit::NaviToolBarStyle toolBarStyleLandscape ); - - /** - * @copydoc Dali::Toolkit::NavigationControl::CreateNavigationTitleBar() - */ - void CreateNavigationTitleBar( Toolkit::NaviTitleBarStyle titleBarStylePortrait, - Toolkit::NaviTitleBarStyle titleBarStyleLandscape ); - - /** - * @copydoc Dali::Toolkit::NavigationControl::OrientationChanged() - */ - void OrientationChanged( int angle ); - - /** - * @copydoc Dali::Toolkit::NavigationControl::SetOrientationRotateAnimation() - */ - void SetOrientationRotateAnimation( float duration, AlphaFunction alphaFunc); - - /** - * Retrieve the layer for displaying navigation bar - * @return The layer for navigation bar - */ - Layer GetBarLayer() const; - - /** - * Performs actions as requested using the action name. - * @param[in] object The object on which to perform the action. - * @param[in] actionName The action to perform. - * @param[in] attributes The attributes with which to perfrom this action. - * @return true if action has been accepted by this control - */ - static bool DoAction(BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes); - -public: - - /** - * @copydoc Dali::Toolkit::NavigatinControl::ItemPushedSignal() - */ - Toolkit::NavigationControl::ItemPushedSignalType& ItemPushedSignal(); - - /** - * @copydoc Dali::Toolkit::NavigatinControl::ItemPoppedSignal() - */ - Toolkit::NavigationControl::ItemPoppedSignalType& ItemPoppedSignal(); - -private: // override functions from Control - - /** - * @copydoc Control::OnInitialize() - */ - virtual void OnInitialize(); - - /** - * From Control; called after a child has been added to the owning actor. - * @param[in] child The child which has been added. - */ - virtual void OnControlChildAdd( Actor& child ); - - /** - * @copydoc Control::OnStageConnection() - */ - virtual void OnStageConnection(); - - /** - * @copydoc Control::OnRelayout() - */ - virtual void OnRelayout( const Vector2& size, RelayoutContainer& container ); - - /** - * @copydoc Control::OnControlSizeSet - */ - virtual void OnControlSizeSet( const Vector3& size ); - - /** - * @copydoc Control::OnKeyEvent() - */ - virtual bool OnKeyEvent( const KeyEvent& event ); - -protected: - - /** - * Constructor. - * It initializes the NavigationControl members - */ - NavigationControl(); - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~NavigationControl(); - -private: - - // Undefined - NavigationControl(const NavigationControl&); - - // Undefined - NavigationControl& operator=(const NavigationControl& rhs); - - /** - * Create a Layer and add it to the navigation control - * @return The newly created layer - */ - Layer CreateLayer(); - - /** - * Setup the pop up menu which would show when KEY_MENU is pressed - * This function is called when pushing/popping item - */ - void SetupPopupMenu(); - - /** - * Signal handler called when the user touches outside of pop up menu. - */ - void OnPopupTouchedOutside(); - -public: - std::list< Toolkit::Page > mUnpushedItems; - -private: - - std::vector< Toolkit::Page > mItemStack; - Toolkit::Page mCurrentItem; - Vector2 mControlSize; - - Layer mBackgroundLayer; - Layer mBarLayer; - Layer mContentLayer; - Layer mPopupLayer; - - Actor mBackground; - - NavigationBar* mToolBar; - NavigationBar* mTitleBar; - - int mOrientationAngle; - float mOrientationAnimationDuration; - AlphaFunction mOrientationAnimationAlphaFunc; - Vector3 mItemPositionCoefficient; - - Toolkit::Popup mPopupMenu; - -private: - Toolkit::NavigationControl::ItemPushedSignalType mItemPushedSignal; ///< The signal to notify the item push - Toolkit::NavigationControl::ItemPoppedSignalType mItemPoppedSignal; ///< The signal to notify the item pop -}; - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Toolkit::Internal::NavigationControl& GetImpl( Toolkit::NavigationControl& navigationControl ) -{ - DALI_ASSERT_ALWAYS( navigationControl ); - - Dali::RefObject& handle = navigationControl.GetImplementation(); - - return static_cast( handle ); -} - -inline const Toolkit::Internal::NavigationControl& GetImpl( const Toolkit::NavigationControl& navigationControl ) -{ - DALI_ASSERT_ALWAYS( navigationControl ); - - const Dali::RefObject& handle = navigationControl.GetImplementation(); - - return static_cast( handle ); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif /* __DALI_TOOLKIT_INTERNAL_NAVIGATION_CONTROL_H__ */ diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp deleted file mode 100644 index e8ce9e0..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "navigation-title-bar.h" - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -//ToDo: use const variables instead of magic numbers - -NavigationTitleBar::NavigationTitleBar(NavigationControl& naviControl, - Toolkit::NaviTitleBarStyle titleBarStylePortrait, - Toolkit::NaviTitleBarStyle titleBarStyleLandscape ) -: NavigationBar(naviControl, titleBarStylePortrait, titleBarStyleLandscape ), - mStylePortrait( titleBarStylePortrait ), - mStyleLandscape( titleBarStyleLandscape ), - mCurrentStyle( &mStylePortrait ) -{ - // title bar is located at the top of the frame - mLayout.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); - mLayout.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); - if(mBackground) - { - mBackground.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); - mBackground.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); - } - - // button layout: three rows, controls will be put in the middle row, the top and bottom rows are just for margins - mButtonLayout = Toolkit::TableView::New(3, 1); - // title layout: fours rows, the top and bottom rows are just for margins - // if subtitle exists, title in the second row and subtitle in the third row - // if no subtitle, title will occupy both second and third row - mTitleLayout= Toolkit::TableView::New( 4,1 ); - // title icon layout: the top row, the bottom row and the left column are all for margins - mTitleIconLayout= Toolkit::TableView::New( 3,2 ); - SetFixedSizes(); - - mTitle = Toolkit::TextLabel::New(); - mSubTitle = Toolkit::TextLabel::New(); -} - -void NavigationTitleBar::Update( Toolkit::Page page ) -{ - const std::vector& controls = page.GetControlsOnTitleBar(); - - // if there is no control to place on the bar ano no title is set, hide the bar - if(controls.empty() && page.GetTitle().empty()) - { - mVisible = false; - mLayout.SetVisible(false); - mBackground.SetVisible(false); - return; - } - - if(mLayout.GetColumns() == 4)// | leftMargin | titleLayout(may have icon and subtitle) | buttonLayout | rightMargin | - { - //remove buttonLayout - mLayout.DeleteColumn(2); - } - // remove titleLayout - mLayout.RemoveChildAt( Toolkit::TableView::CellPosition(0,1) ); - //Remove the controls in the buttonLayout - mButtonLayout.Resize(3,1); - //remove titleIcon - if(mTitleLayout.GetColumns() == 2) - { - mTitleLayout.DeleteColumn( 0 ); - } - // remove title and subtitle - mTitleLayout.RemoveChildAt( Toolkit::TableView::CellPosition(2,0) ); - mTitleLayout.RemoveChildAt( Toolkit::TableView::CellPosition(1,0) ); - - // add controls at the right part of the bar(if exist) - if(!controls.empty()) - { - int numControls = controls.size(); - - for( int index = 0; index < numControls; index++) - { - mButtonLayout.AddChild( controls[index], Toolkit::TableView::CellPosition(1, 2*index + 1) ); - mButtonLayout.SetFixedWidth (2*index, mCurrentStyle->gapBetweenButtons); - mButtonLayout.SetFixedWidth (2*index+1, mCurrentStyle->buttonSize); - } - - mLayout.InsertColumn(2); - mLayout.SetFixedWidth(2, numControls * ( mCurrentStyle->buttonSize + mCurrentStyle->gapBetweenButtons) ); - mLayout.AddChild(mButtonLayout, Toolkit::TableView::CellPosition(0,2)); - } - - // add title and subtitle(if exist) - mTitle.SetProperty( Toolkit::TextLabel::Property::TEXT, page.GetTitle() ); - if( page.GetSubTitle().empty() ) //display title - { - mTitleLayout.SetFixedHeight( 1,mCurrentStyle->titleHeightWithoutSubtitle - mCurrentStyle->subtitleHeight ); - mTitleLayout.AddChild( mTitle, Toolkit::TableView::CellPosition(1,0,2,1) ); - } - else //display title and subtitle - { - mTitleLayout.SetFixedHeight( 1, mCurrentStyle->titleHeightWithSubtitle ); - mTitleLayout.AddChild( mTitle, Toolkit::TableView::CellPosition(1,0) ); - mSubTitle.SetProperty( Toolkit::TextLabel::Property::TEXT, page.GetSubTitle() ); - mTitleLayout.AddChild( mSubTitle, Toolkit::TableView::CellPosition(2,0) ); - } - - // insert title icon to the left of the title(if exist) - if( page.GetTitleIcon() ) - { - mTitleIconLayout.RemoveChildAt(Toolkit::TableView::CellPosition(1,0) ); - mTitleIconLayout.AddChild( page.GetTitleIcon(), Toolkit::TableView::CellPosition(1,0) ); - mTitleLayout.InsertColumn( 0 ); - mTitleLayout.SetFixedWidth( 0, mCurrentStyle->titleLeftMargin + mCurrentStyle->titleIconSize); - mTitleLayout.AddChild( mTitleIconLayout, Toolkit::TableView::CellPosition(1,0,2,1) ); - } - - mLayout.AddChild( mTitleLayout, Toolkit::TableView::CellPosition(0,1) ); - - mVisible = true; - mLayout.SetVisible(true); - mBackground.SetVisible(true); -} - -void NavigationTitleBar::OrientationUpdate( bool isPortrait ) -{ - mCurrentStyle = isPortrait ? &mStylePortrait : &mStyleLandscape; - SetFixedSizes(); - Update( mCurrentItem ); -} - -void NavigationTitleBar::SetFixedSizes() -{ - mLayout.SetFixedWidth(0, mCurrentStyle->titleLeftMargin); - mLayout.SetFixedWidth(2, mCurrentStyle->buttonRightMargin); - - mButtonLayout.SetFixedHeight(2, mCurrentStyle->buttonBottomMargin); - mButtonLayout.SetFixedHeight(1, mCurrentStyle->buttonSize); - - mTitleLayout.SetFixedHeight( 3,mCurrentStyle->titleBottomMargin ); - mTitleLayout.SetFixedHeight( 2,mCurrentStyle->subtitleHeight ); - - mTitleIconLayout.SetFixedWidth( 0, mCurrentStyle->titleIconSize ); - mTitleIconLayout.SetFixedHeight( 1, mCurrentStyle->titleIconSize ); -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h b/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h deleted file mode 100644 index c8200ed..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-title-bar.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_NAVIGATION_TITLE_BAR_H__ -#define __DALI_TOOLKIT_INTERNAL_NAVIGATION_TITLE_BAR_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -/** - * The title bar locates in the top of the frame where title, subtitle, title icon and other controls could be placed. - * The title bar contains two groups: the left group includes title icon, title and subtitle (subtitle and title icon are not must); - * while the right group can have multiple controls placed on, and it is also fine to have no control on it. - * If the current NavigationOtem provides no control for the bar at all and also has not set a title, the bar is hidden. - * +----------------------------------------+ - * | +-+ Title +-+ +-+ | - * | +-+ Subtitle +-+ +-+ | - * +----------------------------------------+ - */ -class NavigationTitleBar : public NavigationBar -{ -public: - - NavigationTitleBar(NavigationControl& naviControl, - Toolkit::NaviTitleBarStyle titleBarStylePortrait, - Toolkit::NaviTitleBarStyle titleBarStyleLandscape ); - -protected: - - /** - * @copydoc Toolkit::Internal::NavigationBar::Update - */ - void Update( Toolkit::Page page ); - - /** - * @copydoc Toolkit::Internal::NavigationBar::OrientationUpdate - */ - void OrientationUpdate( bool isPortrait ); - -private: - /** - * Set the fixed width and height to the cells of the layout - * These sizes need to be updated when the orientation is changing. - */ - void SetFixedSizes(); - -private: - - Toolkit::NaviTitleBarStyle mStylePortrait; - Toolkit::NaviTitleBarStyle mStyleLandscape; - const Toolkit::NaviTitleBarStyle* mCurrentStyle; - - Toolkit::TableView mButtonLayout; - Toolkit::TableView mTitleLayout; - Toolkit::TableView mTitleIconLayout; - - Toolkit::TextLabel mTitle; - Toolkit::TextLabel mSubTitle; - -}; - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali - - -#endif /* __DALI_TOOLKIT_INTERNAL_NAVIGATION_TITLE_BAR_H__ */ diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.cpp deleted file mode 100644 index aad04b7..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "navigation-tool-bar.h" - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ -//ToDo: use const variables instead of magic numbers - -NavigationToolBar::NavigationToolBar( NavigationControl& naviControl, - Toolkit::NaviToolBarStyle toolBarStylePortrait, - Toolkit::NaviToolBarStyle toolBarStyleLandscape ) -: NavigationBar(naviControl, toolBarStylePortrait, toolBarStyleLandscape), - mStylePortrait( toolBarStylePortrait ), - mStyleLandscape( toolBarStyleLandscape ), - mCurrentStyle( &mStylePortrait), - mNumCentralActor( 0 ) -{ - // tool bar is located at the bottom of the frame - mLayout.SetParentOrigin( Dali::ParentOrigin::BOTTOM_CENTER ); - mLayout.SetAnchorPoint( Dali::AnchorPoint::BOTTOM_CENTER ); - if(mBackground) - { - mBackground.SetParentOrigin( Dali::ParentOrigin::BOTTOM_CENTER ); - mBackground.SetAnchorPoint( Dali::AnchorPoint::BOTTOM_CENTER ); - } - - // layout of the left part, which contains only one control at CellPosition(1,1) - mLeftLayout = Toolkit::TableView::New(3,3); - mLayout.AddChild(mLeftLayout, Toolkit::TableView::CellPosition(0,0)); - - // layout of the right part, which contains only one control at CellPosition(1,1) - mRightLayout = Toolkit::TableView::New(3,3); - mLayout.AddChild(mRightLayout, Toolkit::TableView::CellPosition(0,2)); - - // layout of the central part, which contains multiples control, will add cells dynamically - mCentralLayout = Toolkit::TableView::New(3,2); - mLayout.AddChild(mCentralLayout, Toolkit::TableView::CellPosition(0,1)); - - SetFixedSizes(); -} - -void NavigationToolBar::AddControl(Actor actor, Toolkit::Alignment::Type alignment) -{ - switch( alignment ) - { - case Toolkit::Alignment::HorizontalLeft: // can only have one control on the left side of the bar - { - mLeftLayout.RemoveChildAt(Toolkit::TableView::CellPosition(1,1)); - mLeftLayout.AddChild(actor, Toolkit::TableView::CellPosition(1,1)); - break; - } - case Toolkit::Alignment::HorizontalRight: // can only have one control on the right side of the bar - { - mRightLayout.RemoveChildAt(Toolkit::TableView::CellPosition(1,1)); - mRightLayout.AddChild(actor, Toolkit::TableView::CellPosition(1,1)); - break; - } - case Toolkit::Alignment::HorizontalCenter: // can only have multiple controls on the central part of the bar - { - // already have button in central part - if( mCentralLayout.GetChildAt(Toolkit::TableView::CellPosition(1,1))) - { - unsigned int columnIndex = mCentralLayout.GetColumns() ; - mCentralLayout.InsertColumn( columnIndex-1 ); - mCentralLayout.SetFixedWidth( columnIndex-1, mCurrentStyle->centralButtonGap ); - - mCentralLayout.InsertColumn( columnIndex ); - mCentralLayout.AddChild(actor, Toolkit::TableView::CellPosition( 1, columnIndex ) ); - } - else // have no button in central part - { - mCentralLayout.InsertColumn( 1 ); - mCentralLayout.AddChild(actor, Toolkit::TableView::CellPosition(1,1)); - } - mNumCentralActor++; - break; - } - default: - DALI_ASSERT_ALWAYS( false ); - } - -} - -void NavigationToolBar::Update( Toolkit::Page page ) -{ - const Toolkit::Page::ControlOnBarContainer& controls = page.GetControlsOnToolBar(); - - // if there is no control to place on the bar, hide the bar - if( controls.empty() ) - { - mVisible = false; - mLayout.SetVisible(false); - mBackground.SetVisible(false); - return; - } - - //clear central controls - unsigned int numColumns = mCentralLayout.GetColumns() ; - unsigned int idx = numColumns-2; - while(idx > 0) - { - mCentralLayout.DeleteColumn(idx); - idx--; - } - mNumCentralActor = 0; - mLeftLayout.RemoveChildAt(Toolkit::TableView::CellPosition(1,1)); - mRightLayout.RemoveChildAt(Toolkit::TableView::CellPosition(1,1)); - - Toolkit::Page::ControlOnBarContainer::const_iterator iter; - - for( iter = controls.begin(); iter != controls.end(); iter++ ) - { - AddControl( (*iter)->control, (*iter)->alignment ); - } - - float buttonWidth = static_cast( mCurrentStyle->centralMinimum ); - int length = mNumCentralActor * (mCurrentStyle->centralMinimum + mCurrentStyle->centralButtonGap) - mCurrentStyle->centralButtonGap; - if( length > mCurrentStyle->centralMaximum ) // shrink the width to make sure all the controls can be fit in - { - buttonWidth = static_cast( mCurrentStyle->centralMaximum - (mNumCentralActor - 1) * mCurrentStyle->centralButtonGap ) - / static_cast( mNumCentralActor ); - } - numColumns = mCentralLayout.GetColumns(); - idx = 1; - while(idx < numColumns-1 ) - { - mCentralLayout.SetFixedWidth( idx, buttonWidth ); - idx += 2; - } - mVisible = true; - mLayout.SetVisible(true); - mBackground.SetVisible(true); -} - -void NavigationToolBar::OrientationUpdate( bool isPortrait ) -{ - mCurrentStyle = isPortrait ? &mStylePortrait : &mStyleLandscape; - SetFixedSizes(); - Update( mCurrentItem ); -} - -void NavigationToolBar::SetFixedSizes() -{ - mLayout.SetFixedWidth(1, mCurrentStyle->centralMaximum); - - mLeftLayout.SetFixedWidth(0,mCurrentStyle->hotizontalMargin); - mLeftLayout.SetFixedWidth(1,mCurrentStyle->sideButtonSize ); - mLeftLayout.SetFixedHeight(1,mCurrentStyle->sideButtonSize ); - - mRightLayout.SetFixedWidth(2,mCurrentStyle->hotizontalMargin); - mRightLayout.SetFixedWidth(1,mCurrentStyle->sideButtonSize ); - mRightLayout.SetFixedHeight(1,mCurrentStyle->sideButtonSize ); - - mCentralLayout.SetFixedHeight(1,mCurrentStyle->centralButtonHeight ); -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.h b/dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.h deleted file mode 100644 index 80603d8..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-tool-bar.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_NAVIGATION_TOOL_BAR_H__ -#define __DALI_TOOLKIT_INTERNAL_NAVIGATION_TOOL_BAR_H__ - -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -/** - * The tool bar locates in the bottom of the frame where other controls (such as PushButton ) could be placed. - * Controls could be added into three groups: HorizontalLeft, HorizontalCenter or HorizontalRight. - * The left and right groups can only have one control maximum each, while the central group can have multiple controls. - * It is also fine to have no control in each group. - * If the current NavigationOtem provides no control for the bar at all, the bar is hidden. - * +----------------------------------------+ - * | +-+ +-----+ +-----+ +-+ | - * | +-+ +-----+ +-----+ +-+ | - * +----------------------------------------+ - */ -class NavigationToolBar : public NavigationBar -{ -public: - - NavigationToolBar(NavigationControl& naviControl, - Toolkit::NaviToolBarStyle toolBarStylePortrait, - Toolkit::NaviToolBarStyle toolBarStyleLandscape ); - -protected: - - /** - * @copydoc Toolkit::Internal::NavigationBar::Update - */ - void Update( Toolkit::Page page ); - - /** - * @copydoc Toolkit::Internal::NavigationBar::OrientationUpdate - */ - void OrientationUpdate( bool isPortrait ); - -private: - - /** - * Set a control onto the navigation tool bar when the page is on the top. - * @param[in] control The control on the navigation tool bar. - * @param[in] alignment The position of the control, can be HorizontalLeft/HorizontalRight/HorizontalCenter. - */ - void AddControl(Actor actor, Toolkit::Alignment::Type alignment); - - /** - * Set the fixed width and height to the cells of the layout - * These sizes need to be updated when the orientation is changing. - */ - void SetFixedSizes(); - -private: - - Toolkit::NaviToolBarStyle mStylePortrait; - Toolkit::NaviToolBarStyle mStyleLandscape; - const Toolkit::NaviToolBarStyle* mCurrentStyle; - - Toolkit::TableView mLeftLayout; - Toolkit::TableView mRightLayout; - Toolkit::TableView mCentralLayout; - - int mNumCentralActor; -}; - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali - -#endif /* __DALI_TOOLKIT_INTERNAL_NAVIGATION_TOOL_BAR_H__ */ diff --git a/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp b/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp deleted file mode 100644 index 82fb886..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "page-impl.h" - -// EXTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace -{ - -BaseHandle Create() -{ - return Toolkit::Page::New(); -} - -DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Page, Toolkit::Control, Create ) -DALI_PROPERTY_REGISTRATION( Toolkit, Page, "title", STRING, TITLE ) -DALI_PROPERTY_REGISTRATION( Toolkit, Page, "sub-title", STRING, SUB_TITLE ) -DALI_TYPE_REGISTRATION_END() - -} // unnamed namespace - -Page::Page() -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ), - mTitle(""), - mSubTitle("") -{ -} - -Page::~Page() -{ - Toolkit::Page::ControlOnBarContainer::const_iterator iter; - - if( !mToolBarControls.empty() ) - { - for( iter = mToolBarControls.begin(); iter != mToolBarControls.end(); iter++ ) - { - delete( *iter ); - } - } - -} - -Toolkit::Page Page::New() -{ - // Create the implementation, temporarily owned by this handle on stack - IntrusivePtr< Page > internalpage = new Page(); - - // Pass ownership to CustomActor handle - Toolkit::Page page( *internalpage ); - - // Second-phase init of the implementation - // This can only be done after the CustomActor connection has been made... - internalpage->Initialize(); - - return page; - -} - -void Page::SetTitle(const std::string& title) -{ - mTitle = title; -} - -const std::string& Page::GetTitle() const -{ - return mTitle; -} - -void Page::SetSubTitle(const std::string& subtitle) -{ - mSubTitle = subtitle; -} - -const std::string& Page::GetSubTitle() const -{ - return mSubTitle; -} - -void Page::SetTitleIcon( Actor titleIcon) -{ - mTitleIcon = titleIcon; -} - -Actor Page::GetTitleIcon() const -{ - return mTitleIcon; -} - -bool Page::AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment) -{ - if( !control || ( alignment!=Toolkit::Alignment::HorizontalLeft - && alignment!=Toolkit::Alignment::HorizontalCenter - && alignment!=Toolkit::Alignment::HorizontalRight ) ) - { - return false; - } - else - { - mToolBarControls.push_back(new Toolkit::Page::ControlOnBar(control, alignment)); - return true; - } -} - -const Toolkit::Page::ControlOnBarContainer& Page::GetControlsOnToolBar() const -{ - return mToolBarControls; -} - -bool Page::AddControlToTitleBar(Actor control) -{ - if( !control ) - { - return false; - } - else - { - mTitleBarControls.push_back(control); - return true; - } -} - -const ActorContainer& Page::GetControlsOnTitleBar() const -{ - return mTitleBarControls; -} - -void Page::SetPopupMenu( Toolkit::Popup popupMenu ) -{ - mPopupMenu = popupMenu; -} - -Toolkit::Popup Page::GetPopupMenu() const -{ - return mPopupMenu; -} - -void Page::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) -{ - Toolkit::Page page = Toolkit::Page::DownCast( Dali::BaseHandle( object ) ); - - if ( page ) - { - switch ( index ) - { - case Toolkit::Page::Property::TITLE: - { - GetImpl( page ).SetTitle( value.Get< std::string >() ); - break; - } - - case Toolkit::Page::Property::SUB_TITLE: - { - GetImpl( page ).SetSubTitle( value.Get< std::string >() ); - break; - } - } - } -} - -Property::Value Page::GetProperty( BaseObject* object, Property::Index propertyIndex ) -{ - Property::Value value; - - Toolkit::Page page = Toolkit::Page::DownCast( Dali::BaseHandle( object ) ); - - if ( page ) - { - switch ( propertyIndex ) - { - case Toolkit::Page::Property::TITLE: - { - value = GetImpl( page ).mTitle; - break; - } - - case Toolkit::Page::Property::SUB_TITLE: - { - value = GetImpl( page ).mSubTitle; - break; - } - } - } - - return value; -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/internal/controls/navigation-frame/page-impl.h b/dali-toolkit/internal/controls/navigation-frame/page-impl.h deleted file mode 100644 index 8d2711d..0000000 --- a/dali-toolkit/internal/controls/navigation-frame/page-impl.h +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__ -#define __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__ -/* - * Copyright (c) 2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -class Page; - -namespace Internal -{ - -/** - * Page object is a custom control which can be pushed into the stack of navigation control. - * @see Dali::Toolkit::Page for more details - */ - -class Page : public Control -{ - -public: - - /** - * destructor - */ - virtual ~Page(); - - /** - * Create an initialized Page. - * @return A handle to a newly allocated Dali resource - */ - static Toolkit::Page New(); - - /** - * @copydoc Dali::Toolkit::Page::SetTitle - */ - void SetTitle(const std::string& title); - - /** - * @copydoc Dali::Toolkit::Page::GetTitle - */ - const std::string& GetTitle() const; - - /** - * @copydoc Dali::Toolkit::Page::SetSubTitle - */ - void SetSubTitle(const std::string& subtitle); - - /** - * @copydoc Dali::Toolkit::Page::GetSubTitle - */ - const std::string& GetSubTitle() const; - - /** - * @copydoc Dali::Toolkit::Page::SetTitleIcon - */ - void SetTitleIcon( Actor titleIcon); - - /** - * @copydoc Dali::Toolkit::Page::GetTitleIcon - */ - Actor GetTitleIcon() const; - - /** - * @copydoc Dali::Toolkit::Page::AddControlToToolBar - */ - bool AddControlToToolBar(Actor control, Toolkit::Alignment::Type alignment); - - /** - * @copydoc Dali::Toolkit::Page::GetControlsOnToolBar - */ - const Toolkit::Page::ControlOnBarContainer& GetControlsOnToolBar() const; - - /** - * @copydoc Dali::Toolkit::Page::AddControlToTitleBar - */ - bool AddControlToTitleBar(Actor control); - - /** - * @copydoc Dali::Toolkit::Page::GetControlsOnTitleBar - */ - const ActorContainer& GetControlsOnTitleBar() const; - - /** - * @copydoc Dali::Toolkit::Page::SetPopupMenu - */ - void SetPopupMenu( Toolkit::Popup popupMenu ); - - /** - * @copydoc Dali::Toolkit::Page::GetPopupMenu - */ - Toolkit::Popup GetPopupMenu() const; - - // Properties - - /** - * Called when a property of an object of this type is set. - * @param[in] object The object whose property is set. - * @param[in] index The property index. - * @param[in] value The new property value. - */ - static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ); - - /** - * Called to retrieve a property of an object of this type. - * @param[in] object The object whose property is to be retrieved. - * @param[in] index The property index. - * @return The current value of the property. - */ - static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex ); - -private: - - /** - * Constructor. - * It initializes the Page members - */ - Page(); - -private: - std::string mTitle; - std::string mSubTitle; - Actor mTitleIcon; - Toolkit::Popup mPopupMenu; - - ActorContainer mTitleBarControls; - Toolkit::Page::ControlOnBarContainer mToolBarControls; -}; - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Toolkit::Internal::Page& GetImpl( Toolkit::Page& page ) -{ - DALI_ASSERT_ALWAYS( page ); - - Dali::RefObject& handle = page.GetImplementation(); - - return static_cast( handle ); -} - -inline const Toolkit::Internal::Page& GetImpl( const Toolkit::Page& page ) -{ - DALI_ASSERT_ALWAYS( page ); - - const Dali::RefObject& handle = page.GetImplementation(); - - return static_cast( handle ); -} - -}// namespace Toolkit - -} // namespace Dali - - -#endif /* __DALI_TOOLKIT_INTERNAL_PAGE_IMPL_H__*/ diff --git a/dali-toolkit/internal/file.list b/dali-toolkit/internal/file.list index a6b0fb1..2c7ae13 100644 --- a/dali-toolkit/internal/file.list +++ b/dali-toolkit/internal/file.list @@ -23,11 +23,6 @@ toolkit_src_files = \ $(toolkit_src_dir)/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp \ $(toolkit_src_dir)/controls/image-view/masked-image-view-impl.cpp \ $(toolkit_src_dir)/controls/magnifier/magnifier-impl.cpp \ - $(toolkit_src_dir)/controls/navigation-frame/navigation-bar.cpp \ - $(toolkit_src_dir)/controls/navigation-frame/navigation-control-impl.cpp \ - $(toolkit_src_dir)/controls/navigation-frame/navigation-title-bar.cpp \ - $(toolkit_src_dir)/controls/navigation-frame/navigation-tool-bar.cpp \ - $(toolkit_src_dir)/controls/navigation-frame/page-impl.cpp \ $(toolkit_src_dir)/controls/popup/popup-impl.cpp \ $(toolkit_src_dir)/controls/popup/popup-style-impl.cpp \ $(toolkit_src_dir)/controls/page-turn-view/page-turn-portrait-view-impl.cpp \ diff --git a/dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h b/dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h deleted file mode 100644 index 52f1d07..0000000 --- a/dali-toolkit/public-api/controls/navigation-frame/navigation-bar-style.h +++ /dev/null @@ -1,146 +0,0 @@ -#ifndef __DALI_TOOLKIT_NAVIGATION_BAR_STYLE_H__ -#define __DALI_TOOLKIT_NAVIGATION_BAR_STYLE_H__ - -/* - * Copyright (c) 2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace Dali -{ - -namespace Toolkit -{ - - /** - * The basic information of a navigation bar style: background and size. - * All the style metrics for tool bar and title bar are in pixels referring to a bar width of 'referenceWidth'. - * To fit the bars into different window size, the NavigationControl scales the bar by the ratio of windowWidth and referenceWidth. - */ - struct BasicNaviBarStyle - { - /** - * Constructor - */ - BasicNaviBarStyle ( Actor background, - int referenceWidth, - int height ) - : background( background ), - referenceWidth( referenceWidth ), - height( height ) - { - } - - Actor background; ///< bar background - int referenceWidth; ///< the width of the bar, this value also used to calculate the scale to fit the bar into windows of different sizes - int height; ///< the height of the bar - }; - - /** - * The tool bar locates in the bottom of the frame where other controls (such as PushButton ) could be placed. - * NaviToolBarStyle provides the tool bar layout style, which customize the position and size of the controls placed on it. - * Controls could be added into three groups: HorizontalLeft, HorizontalCenter or HorizontalRight. - * The left and right groups can only have one control maximum each, while the central group can have multiple controls. - * It is fine to have no control in every group. - * +----------------------------------------+ - * | +-+ +-----+ +-----+ +-+ | - * | +-+ +-----+ +-----+ +-+ | - * +----------------------------------------+ - */ - struct NaviToolBarStyle : BasicNaviBarStyle - { - /** - * Constructor - */ - NaviToolBarStyle ( Actor background, - int referenceWidth, - int height, - int centralMaximum, - int centralMinimum, - int centralButtonHeight, - int centralButtonGap, - int sideButtonSize, - int hotizontalMargin ) - : BasicNaviBarStyle( background, referenceWidth, height), - centralMaximum( centralMaximum ), centralMinimum( centralMinimum ), - centralButtonHeight( centralButtonHeight ), centralButtonGap( centralButtonGap ), - sideButtonSize( sideButtonSize ), hotizontalMargin( hotizontalMargin ) - { - } - - int centralMaximum; ///< the maximum width of central button - int centralMinimum; ///< the minimum width of central button - int centralButtonHeight; ///< the height of the central button - int centralButtonGap; ///< the gap width between central buttons - int sideButtonSize; ///< the size of side buttons in the left and right groups: sideButtonSize*sideButtonSize - int hotizontalMargin; ///< the horizontal margin width - }; - - /** - * The title bar locates in the top of the frame where title, subtitle, title icon and other controls could be placed. - * NaviTitleBarStyle provides the title bar layout style, - * which customize the position and size of the components placed on it and the text style of the titles. - * The title bar contains two groups: the left group includes title icon, title and subtitle (subtitle and title icon are not must); - * while the right group can have multiple controls placed on, and it is also fine to have no control on it. - * +----------------------------------------+ - * | +-+ Title +-+ +-+ | - * | +-+ Subtitle +-+ +-+ | - * +----------------------------------------+ - */ - struct NaviTitleBarStyle : BasicNaviBarStyle - { - /** - * Constructor - */ - NaviTitleBarStyle( Actor background, - int referenceWidth, - int height, - int titleHeightWithoutSubtitle, - int titleHeightWithSubtitle, - int subtitleHeight, - int titleLeftMargin, - int titleBottomMargin, - int titleIconSize, - int buttonSize, - int buttonRightMargin, - int buttonBottomMargin, - int gapBetweenButtons ) - : BasicNaviBarStyle( background, referenceWidth, height), - titleHeightWithoutSubtitle( titleHeightWithoutSubtitle ), - titleHeightWithSubtitle( titleHeightWithSubtitle ), subtitleHeight( subtitleHeight ), - titleLeftMargin( titleLeftMargin ), titleBottomMargin( titleBottomMargin ), - titleIconSize( titleIconSize ), buttonSize( buttonSize ), - buttonRightMargin( buttonRightMargin ), buttonBottomMargin( buttonBottomMargin ), - gapBetweenButtons( gapBetweenButtons ) - { - } - - int titleHeightWithoutSubtitle; ///< the height of the title when no subtitle exists - int titleHeightWithSubtitle; ///< the height of the title when there is subtitle below - int subtitleHeight; ///< the height of the subtitle - int titleLeftMargin; ///< the Margin between title and the left edge of the bar - int titleBottomMargin; ///< the Margin between title and the bottom edge of the bar - int titleIconSize; ///< the size of the title icon: titleIconSize*titleIconSize - int buttonSize; ///< the size of the buttons in the right group: buttonSize*buttonSize - int buttonRightMargin; ///< the Margin between the button and the right edge of the bar - int buttonBottomMargin; ///< the Margin between the button and the bottom edge of the bar - int gapBetweenButtons; ///< the gap width between buttons - }; - -} // namespace Toolkit -} // namespace Dali - - -#endif /* __DALI_TOOLKIT_NAVIGATION_BAR_STYLE_H__ */ diff --git a/dali-toolkit/public-api/controls/navigation-frame/navigation-control.cpp b/dali-toolkit/public-api/controls/navigation-frame/navigation-control.cpp deleted file mode 100644 index 747847a..0000000 --- a/dali-toolkit/public-api/controls/navigation-frame/navigation-control.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "navigation-control.h" - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -NavigationControl::NavigationControl() -{ -} - -NavigationControl::NavigationControl( const NavigationControl& handle ) -: Control(handle) -{ -} - -NavigationControl& NavigationControl::operator=( const NavigationControl& handle) -{ - if( &handle != this ) - { - Control::operator=( handle ); - } - return *this; -} - -NavigationControl::~NavigationControl() -{ -} - -NavigationControl NavigationControl::New() -{ - return Internal::NavigationControl::New(); -} - -NavigationControl NavigationControl::DownCast( BaseHandle handle ) -{ - return Control::DownCast(handle); -} - -NavigationControl::NavigationControl( Internal::NavigationControl& implementation ) -: Control( implementation ) -{ -} - -NavigationControl::NavigationControl( Dali::Internal::CustomActor* internal ) -: Control( internal) -{ - VerifyCustomActorPointer(internal); -} - - -void NavigationControl::PushItem( Page item ) -{ - GetImpl( *this ).PushItem( item ); -} - -Page NavigationControl::PopItem() -{ - return GetImpl( *this ).PopItem(); -} - -size_t NavigationControl::GetItemCount() const -{ - return GetImpl( *this ).GetItemCount(); -} - -Page NavigationControl::GetItem(std::size_t index) const -{ - return GetImpl( *this ).GetItem( index ); -} - -Page NavigationControl::GetCurrentItem() const -{ - return GetImpl(*this ).GetCurrentItem(); -} - -void NavigationControl::SetBackground( Actor background) -{ - GetImpl( *this ).SetBackground( background ); -} - -void NavigationControl::CreateNavigationToolBar( NaviToolBarStyle toolBarStylePortrait, NaviToolBarStyle toolBarStyleLandscape ) -{ - GetImpl( *this ).CreateNavigationToolBar( toolBarStylePortrait, toolBarStyleLandscape ); -} - -void NavigationControl::CreateNavigationTitleBar( NaviTitleBarStyle titleBarStylePortrait, NaviTitleBarStyle titleBarStyleLandscape ) -{ - GetImpl( *this ).CreateNavigationTitleBar( titleBarStylePortrait, titleBarStyleLandscape ); -} - -void NavigationControl::OrientationChanged( int angle ) -{ - GetImpl( *this ).OrientationChanged( angle ); -} - -void NavigationControl::SetOrientationRotateAnimation( float duration, AlphaFunction alphaFunc) -{ - GetImpl( *this ).SetOrientationRotateAnimation( duration, alphaFunc ); -} - -NavigationControl::ItemPushedSignalType& NavigationControl::ItemPushedSignal() -{ - return GetImpl( *this ).ItemPushedSignal(); -} - -NavigationControl::ItemPoppedSignalType& NavigationControl::ItemPoppedSignal() -{ - return GetImpl( *this ).ItemPoppedSignal(); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/public-api/controls/navigation-frame/navigation-control.h b/dali-toolkit/public-api/controls/navigation-frame/navigation-control.h deleted file mode 100644 index 00cab60..0000000 --- a/dali-toolkit/public-api/controls/navigation-frame/navigation-control.h +++ /dev/null @@ -1,247 +0,0 @@ -#ifndef __DALI_TOOLKIT_NAVIGATION_CONTROL_H__ -#define __DALI_TOOLKIT_NAVIGATION_CONTROL_H__ - -/* - * Copyright (c) 2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal DALI_INTERNAL -{ -// Forward declarations -class NavigationControl; -} - -/** - * NavigationControl implements a controller than manages the navigation of hierarchical contents. - * NavigationControl holds views as its item which are organized in a stack. - * New items get pushed on the top of the old. Only the topmost item is displayed in the view area at one time. - * Its layout contains a title bar on the top, a tool bar in the bottom, and the content of top item in the middle. - * The top item carries title/subtitle/buttons/icon information, - * so with new item on the top, the NavigationControl will update the bars accordingly. - * if no component is needed to place on the bar for the current item, the bar is hidden - * +----------------------------------------+ - * | | - * | +-+ Title +-+ +-+ | title bar - * | +-+ Subtitle +-+ +-+ | - * +----------------------------------------+ - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | View Area | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * +----------------------------------------+ - * | +-+ +-----+ +-----+ +-+ | - * | +-+ +-----+ +-----+ +-+ | tool bar - * +----------------------------------------+ - * - * Actions - * | %Action Name | %NavigationControl method called | - * |-------------------|----------------------------------| - * | push | %PushItem() | - * | pop | %PopItem() | - */ -class DALI_IMPORT_API NavigationControl : public Control -{ - -public: - - /** - * Create a NavigationControl handle; this can be initialize with NavigationControl::New(). - * Calling member function with an uninitialized handle is not allowed. - */ - NavigationControl(); - - /** - * Copy Constructor. - */ - NavigationControl( const NavigationControl& handle ); - - /** - * Assignment operator. - */ - NavigationControl& operator=( const NavigationControl& handle ); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~NavigationControl(); - - /** - * Create an initialized NavigationControl. - * @return A handle to a newly allocated Dali resource. - */ - static NavigationControl New(); - - /** - * Downcast an object handle to NavigationControl. - * If handle points to a NavigationControl, the downcast produces valid handle. - * If not, the returned handle is left uninitialized. - * @param[in] handle Handle to an object. - * @return handle to a NavigationControl of an uninitialized handle. - */ - static NavigationControl DownCast( BaseHandle handle ); - - /** - * Push a new item to the top of the NavigationControl stack and show it. - * @param[in] item A Page object. - */ - void PushItem( Page item ); - - /** - * Pop an item that is on the top of the NavigationControl stack and make it disappear. - * It doesnot pop out the last item in the stack. - * It returns an uninitialized item handle if there is no item or only one item in the stack. - * @return The Page popped out. - */ - Page PopItem(); - - /** - * Query the number of items in the stack. - * @return the number of items in the stack. - */ - std::size_t GetItemCount() const; - - /** - * Retrieve the index-th item in the stack - * Here, the index is from zero to stack size minus one, the bottom-most item is with index zero - * @pre There are more items in the stack than the parameter index plus one - * @param[in] index The location index of the item in the stack - * @return The index-th item in the navigation stack - */ - Page GetItem(std::size_t index) const; - - /** - * Retrieve the current top item. - * @return the Page object which is on the top of the stack. - */ - Page GetCurrentItem() const; - - /** - * Sets a background image. - * @param[in] background Actor with the navigation control background. - */ - void SetBackground( Actor background); - - /** - *Create a tool bar at the bottom of the navigation control. - *@param[in] toolBarStylePortrait the given navigation tool bar style of Portrait orientation. - *@param[in] toolBarStyleLandscape the given navigation tool bar style of Landscape orientation. - */ - void CreateNavigationToolBar( NaviToolBarStyle toolBarStylePortrait, NaviToolBarStyle toolBarStyleLandscape ); - - /** - * Create a title bar at the top of the navigation control. - * @param[in] titleBarStylePortrait the given navigation title bar style of Portrait orientation. - * @param[in] titleBarStyleLandscape the given navigation title bar style of Landscape orientation. - */ - void CreateNavigationTitleBar( NaviTitleBarStyle titleBarStylePortrait, NaviTitleBarStyle titleBarStyleLandscape); - - /** - * Rotate all the contents to the new given orientation. This rotation is animated. - * Also change the bar style from portrait to landscape style, or vice versa. - * The application should invoke this function in call back of the orientation change signal if different orientations are required. - * @param[in] angle The angle degree of the new orientation, this is one of four discrete values, in degrees clockwise: 0, 90, 180, & 270 - */ - void OrientationChanged( int angle ); - - /** - * Set the duration and the alpha function for the rotating animation in OrientationChanged function above. - * Without calling this function, the default values are 1.0 and EaseOut respectively. - * @param[in] duration The duration of the rotating animation when orientation changed. - * @param[in] alphaFunc The alpha function of the rotating animation when orientation changed. - */ - void SetOrientationRotateAnimation( float duration, AlphaFunction alphaFunc); - -public: //Signal - - typedef Signal< void( NavigationControl, Page ) > ItemPushedSignalType; - typedef Signal< void( NavigationControl, Page ) > ItemPoppedSignalType; - - /** - * Signal emitted right after a new item is pushed into the navigation stack. - * A callback of the following type may be connected: - * @code - * void YourCallBackName(NavigationControl controller, Page pushedItem); - * @endcode - * @return The signal to connect to. - */ - ItemPushedSignalType& ItemPushedSignal(); - - /** - * Signal emitted right after an item is popped out from the navigation stack. - * A callback of the following type may be connected: - * @code - * void YourCallBackName(NavigationControl controller, Page poppedItem); - * @endcode - * If attempt to pop the bottom-most item, the poppedItem in the callback will receive an uninitialized handle - * The app can use this signal and check the poppedItem to be uninitialized to know the app window should be lower - * @return The signal to connect to. - */ - ItemPoppedSignalType& ItemPoppedSignal(); - - - -public: // Not intended for application developers - - /** - * Creates a handle using the Toolkit::Internal implementation. - * @param[in] implementation The Control implementation. - */ - DALI_INTERNAL NavigationControl( Internal::NavigationControl& implementation ); - - /** - * Allows the creation of this Control from an Internal::CustomActor pointer. - * @param[in] internal A pointer to the internal CustomActor. - */ - explicit DALI_INTERNAL NavigationControl( Dali::Internal::CustomActor* internal ); - -}; // class NavigationControl - -} // namespace Toolkit - -} // namespace Dali - -#endif /* __DALI_TOOLKIT_NAVIGATION_CONTROL_H__ */ diff --git a/dali-toolkit/public-api/controls/navigation-frame/page.cpp b/dali-toolkit/public-api/controls/navigation-frame/page.cpp deleted file mode 100644 index 46287a4..0000000 --- a/dali-toolkit/public-api/controls/navigation-frame/page.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include "page.h" - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -Page::Page() -{ -} - -Page::Page( const Page& handle ) -: Control(handle) -{ -} - -Page& Page::operator=( const Page& handle ) -{ - if( &handle != this ) - { - CustomActor::operator=( handle ); - } - return *this; -} - -Page Page::New() -{ - return Internal::Page::New(); -} - -Page Page::DownCast( BaseHandle handle ) -{ - return Control::DownCast(handle); -} - -Page::Page(Internal::Page& impl) -: Control(impl) -{ -} - -Page::Page( Dali::Internal::CustomActor* internal ) -: Control( internal) -{ - VerifyCustomActorPointer(internal); -} - -void Page::SetTitle(const std::string& title) -{ - GetImpl( *this ).SetTitle(title); -} - -const std::string& Page::GetTitle() const -{ - return GetImpl( *this ).GetTitle(); -} - -void Page::SetSubTitle(const std::string& subtitle) -{ - GetImpl( *this ).SetSubTitle(subtitle); -} - -const std::string& Page::GetSubTitle() const -{ - return GetImpl( *this ).GetSubTitle(); -} - -void Page::SetTitleIcon( Actor titleIcon) -{ - GetImpl( *this ).SetTitleIcon(titleIcon); -} - -Actor Page::GetTitleIcon() const -{ - return GetImpl( *this ).GetTitleIcon(); -} - -bool Page::AddControlToToolBar(Actor control, Alignment::Type alignment) -{ - return GetImpl( *this ).AddControlToToolBar(control, alignment); -} - -const Page::ControlOnBarContainer Page::GetControlsOnToolBar() const -{ - return GetImpl( *this ).GetControlsOnToolBar(); -} - -bool Page::AddControlToTitleBar(Actor control) -{ - return GetImpl( *this ).AddControlToTitleBar(control); -} - -const ActorContainer Page::GetControlsOnTitleBar() const -{ - return GetImpl( *this ).GetControlsOnTitleBar(); -} - -void Page::SetPopupMenu( Toolkit::Popup popupMenu ) -{ - GetImpl( *this ).SetPopupMenu( popupMenu ); -} - -Toolkit::Popup Page::GetPopupMenu() const -{ - return GetImpl( *this ).GetPopupMenu(); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/dali-toolkit/public-api/controls/navigation-frame/page.h b/dali-toolkit/public-api/controls/navigation-frame/page.h deleted file mode 100644 index e0cf616..0000000 --- a/dali-toolkit/public-api/controls/navigation-frame/page.h +++ /dev/null @@ -1,227 +0,0 @@ -#ifndef __DALI_TOOLKIT_PAGE_H__ -#define __DALI_TOOLKIT_PAGE_H__ - -/* - * Copyright (c) 2015 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal DALI_INTERNAL -{ -// Forward declarations -class Page; -} - -/** - * A Page is a custom control which can be pushed into the stack of navigation control. - * It serves as the root of a navigation view. - * It also carries the title/subtitle/buttons/icons information which would be shown on the navigation bars when the item is on the top of the stack. - */ -class DALI_IMPORT_API Page : public Control -{ - -public: - - /** - * @brief The start and end property ranges for this control. - */ - enum PropertyRange - { - PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, - PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices - }; - - /** - * @brief An enumeration of properties belonging to the Page class. - */ - struct Property - { - enum - { - TITLE = PROPERTY_START_INDEX, ///< name "title", @see SetTitle(), type string - SUB_TITLE, ///< name "sub-title", @see SetSubTitle(), type string - }; - }; - - /** - * Structure to indicate a control on the navigation tool bar and its group (HorizontalLeft, HorizontalRight or HorizontalCenter) - */ - struct ControlOnBar - { - /** - * Constructor - */ - ControlOnBar(Actor actor, Toolkit::Alignment::Type alignment) - : control( actor ), - alignment( alignment ) - { - } - - Actor control; ///< The control actor - Toolkit::Alignment::Type alignment; ///< The alignment of the control actor - }; - - typedef std::vector< const ControlOnBar* > ControlOnBarContainer; - -public: - - /** - * Create a Page handle; this can be initialized with Page::New(). - * Calling member function with an uninitialized handle is not allowed. - */ - Page(); - - /** - * Copy Constructor. - */ - Page( const Page& handle ); - - /** - * Assignment operator. - * Change this handle to point to another real object. - */ - Page& operator=( const Page& handle ); - - /** - * Create an initialized Page. - * @return A handle to a newly allocated Dali resource. - */ - static Page New(); - - /** - * Downcast an object handle to Page. - * If handle points to a Page, the downcast produces valid handle. - * If not, the returned handle is left uninitialized. - * @param[in] handle Handle to an object. - * @return handle to a Page of an uninitialized handle. - */ - static Page DownCast( BaseHandle handle ); - - /** - * Sets the Page's title. - * The title will be displayed on the navigation title bar when the item is on the top of the stack. - * @param[in] title The Page's title. - */ - void SetTitle(const std::string& title); - - /** - * Retrieve the title of the page. - * @return The Page's title or "" when the item does not have a title. - */ - const std::string& GetTitle() const; - - /** - * Sets the Page's subtitle. - * The subtitle will be displayed on the navigation title bar when the item is on the top of the stack. - * @param[in] subtitle The Page's subtitle. - */ - void SetSubTitle(const std::string& subtitle); - - /** - * Retrieve the subtitle of the page. - * @return The Page's subtitle or "" when the subtitle does not have a subtitle. - */ - const std::string& GetSubTitle() const; - - /** - * Sets the Page's title icon. - * The icon will be displayed in front of the title on the navigation item bar when the item is on the top. - * @param[in] titleIcon The Page's icon - */ - void SetTitleIcon( Actor titleIcon); - - /** - * Retrieve the title icon of the page. - * @return The Page's icon or an empty handle when the item does not have title icon. - */ - Actor GetTitleIcon() const; - - /** - * Set a control onto the navigation tool bar when the item is on the top. - * Only one control (the last set one) is valid for HorizontalLeft and HorizontalRight each. - * Can have multiple controls for HorizontalCenter. - * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added. - * @param[in] control The control on the navigation tool bar. - * @param[in] alignment The position of the control, can be HorizontalLeft/HorizontalRight/HorizontalCenter. - * @return true if add control successfully, false if fail to add the control - */ - bool AddControlToToolBar(Actor control, Alignment::Type alignment); - - /** - * Retrieve the controls that would be displayed on the navigation tool bar when the item is on the top. - * @return the vector of tool bar controls associated with the current item. - */ - const ControlOnBarContainer GetControlsOnToolBar() const; - - /** - * Set a control onto the right part of the navigation title bar when the item is on the top. - * If the control is uninitialized or if the alignment has a value other from HorizontalLeft/HorizontalRight/HorizontalCenter, the control is not added. - * @param[in] control The control on the navigation title bar. - * @return true if add control successfully, false if fail to add the control - */ - bool AddControlToTitleBar(Actor control); - - /** - * Retrieve the controls that would be displayed on the navigation title bar when the item is on the top. - * @return the vector of title bar controls associate with the current item. - */ - const ActorContainer GetControlsOnTitleBar() const; - - /** - * Set the menu which would pop up when the KEY_MENU is pressed. - * @param[in] popupMenu the popup menu connected to the KEY_MENU event - */ - void SetPopupMenu( Toolkit::Popup popupMenu ); - - /** - * Get the menu which would pop up when the KEY_MENU is pressed. - * @return The popup menu connected to the KEY_MENU event - */ - Toolkit::Popup GetPopupMenu() const; - -public: // Not intended for application developers - - /** - * Creates a handle using the Toolkit::Internal implementation. - * @param[in] impl The Page implementation. - */ - DALI_INTERNAL Page(Internal::Page& impl); - - /** - * Allows the creation of this Control from an Internal::CustomActor pointer. - * @param[in] internal A pointer to the internal CustomActor. - */ - explicit DALI_INTERNAL Page( Dali::Internal::CustomActor* internal ); -}; - -} // namespace Toolkit - -} // namespace Dali - -#endif /* __DALI_TOOLKIT_PAGE_H__ */ diff --git a/dali-toolkit/public-api/file.list b/dali-toolkit/public-api/file.list index 3eea93c..67486ff 100755 --- a/dali-toolkit/public-api/file.list +++ b/dali-toolkit/public-api/file.list @@ -15,8 +15,6 @@ public_api_src_files = \ $(public_api_src_dir)/controls/default-controls/check-button-factory.cpp \ $(public_api_src_dir)/controls/default-controls/push-button-factory.cpp \ $(public_api_src_dir)/controls/default-controls/solid-color-actor.cpp \ - $(public_api_src_dir)/controls/navigation-frame/navigation-control.cpp \ - $(public_api_src_dir)/controls/navigation-frame/page.cpp \ $(public_api_src_dir)/controls/magnifier/magnifier.cpp \ $(public_api_src_dir)/controls/page-turn-view/page-factory.cpp \ $(public_api_src_dir)/controls/page-turn-view/page-turn-landscape-view.cpp \ @@ -204,11 +202,6 @@ public_api_text_controls_header_files = \ public_api_tool_bar_header_files = \ $(public_api_src_dir)/controls/tool-bar/tool-bar.h -public_api_navigation_frame_header_files = \ - $(public_api_src_dir)/controls/navigation-frame/navigation-bar-style.h \ - $(public_api_src_dir)/controls/navigation-frame/navigation-control.h \ - $(public_api_src_dir)/controls/navigation-frame/page.h - public_api_focus_manager_header_files = \ $(public_api_src_dir)/focus-manager/focus-manager.h \ $(public_api_src_dir)/focus-manager/keyboard-focus-manager.h \ -- 2.7.4