From 824ab611402700f922a15a08451b665141ee63a8 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Mar 2026 21:22:16 +0900 Subject: [PATCH] Add Navigation --- dali-ui-components/internal/app-bar-impl.cpp | 57 ++++ dali-ui-components/internal/app-bar-impl.h | 88 +++++ .../internal/content-page-impl.cpp | 57 ++++ .../internal/content-page-impl.h | 88 +++++ .../internal/dialog-page-impl.cpp | 57 ++++ .../internal/dialog-page-impl.h | 88 +++++ .../internal/navigator-impl.cpp | 146 +++++++++ dali-ui-components/internal/navigator-impl.h | 120 +++++++ dali-ui-components/internal/page-impl.cpp | 63 ++++ dali-ui-components/internal/page-impl.h | 106 ++++++ .../public-api/app-bar.autogen.h | 5 + dali-ui-components/public-api/app-bar.cpp | 98 ++++++ dali-ui-components/public-api/app-bar.h | 112 +++++++ .../public-api/content-page.autogen.h | 5 + .../public-api/content-page.cpp | 98 ++++++ dali-ui-components/public-api/content-page.h | 112 +++++++ .../public-api/dialog-page.autogen.h | 5 + dali-ui-components/public-api/dialog-page.cpp | 98 ++++++ dali-ui-components/public-api/dialog-page.h | 112 +++++++ .../public-api/navigator.autogen.h | 5 + dali-ui-components/public-api/navigator.cpp | 128 ++++++++ dali-ui-components/public-api/navigator.h | 174 ++++++++++ dali-ui-components/public-api/page.autogen.h | 5 + dali-ui-components/public-api/page.cpp | 98 ++++++ dali-ui-components/public-api/page.h | 134 ++++++++ samples/navigation/CMakeLists.txt | 60 ++++ samples/navigation/navigation-example.cpp | 304 ++++++++++++++++++ 27 files changed, 2423 insertions(+) create mode 100644 dali-ui-components/internal/app-bar-impl.cpp create mode 100644 dali-ui-components/internal/app-bar-impl.h create mode 100644 dali-ui-components/internal/content-page-impl.cpp create mode 100644 dali-ui-components/internal/content-page-impl.h create mode 100644 dali-ui-components/internal/dialog-page-impl.cpp create mode 100644 dali-ui-components/internal/dialog-page-impl.h create mode 100644 dali-ui-components/internal/navigator-impl.cpp create mode 100644 dali-ui-components/internal/navigator-impl.h create mode 100644 dali-ui-components/internal/page-impl.cpp create mode 100644 dali-ui-components/internal/page-impl.h create mode 100644 dali-ui-components/public-api/app-bar.autogen.h create mode 100644 dali-ui-components/public-api/app-bar.cpp create mode 100644 dali-ui-components/public-api/app-bar.h create mode 100644 dali-ui-components/public-api/content-page.autogen.h create mode 100644 dali-ui-components/public-api/content-page.cpp create mode 100644 dali-ui-components/public-api/content-page.h create mode 100644 dali-ui-components/public-api/dialog-page.autogen.h create mode 100644 dali-ui-components/public-api/dialog-page.cpp create mode 100644 dali-ui-components/public-api/dialog-page.h create mode 100644 dali-ui-components/public-api/navigator.autogen.h create mode 100644 dali-ui-components/public-api/navigator.cpp create mode 100644 dali-ui-components/public-api/navigator.h create mode 100644 dali-ui-components/public-api/page.autogen.h create mode 100644 dali-ui-components/public-api/page.cpp create mode 100644 dali-ui-components/public-api/page.h create mode 100644 samples/navigation/CMakeLists.txt create mode 100644 samples/navigation/navigation-example.cpp diff --git a/dali-ui-components/internal/app-bar-impl.cpp b/dali-ui-components/internal/app-bar-impl.cpp new file mode 100644 index 00000000..09034221 --- /dev/null +++ b/dali-ui-components/internal/app-bar-impl.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2026 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 +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +UI::AppBar AppBarImpl::New() +{ + IntrusivePtr impl = new Internal::AppBarImpl(); + UI::AppBar handle = UI::AppBar(*impl); + impl->Initialize(); + return handle; +} + +AppBarImpl::AppBarImpl() + : ViewImpl() +{ +} + +AppBarImpl::~AppBarImpl() +{ +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/app-bar-impl.h b/dali-ui-components/internal/app-bar-impl.h new file mode 100644 index 00000000..b8d4cf52 --- /dev/null +++ b/dali-ui-components/internal/app-bar-impl.h @@ -0,0 +1,88 @@ +#pragma once + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +/** + * @brief This is the internal implementation class for AppBar. + */ +class AppBarImpl : public Integration::ViewImpl +{ +public: + + // Creation & Destruction + + static UI::AppBar New(); + +protected: + + virtual ~AppBarImpl(); + +public: + + // API + +protected: + + // Construction + AppBarImpl(); + +private: + + // Not copyable or movable + AppBarImpl(const AppBarImpl&) = delete; + AppBarImpl(AppBarImpl&&) = delete; + AppBarImpl& operator=(const AppBarImpl&) = delete; + AppBarImpl& operator=(AppBarImpl&&) = delete; +}; + +// Helpers for public-api forwarding methods + +inline Internal::AppBarImpl& GetImpl(UI::AppBar& view) +{ + DALI_ASSERT_ALWAYS(view); + Dali::RefObject& handle = view.GetImplementation(); + return static_cast(handle); +} + +inline const Internal::AppBarImpl& GetImpl(const UI::AppBar& view) +{ + DALI_ASSERT_ALWAYS(view); + const Dali::RefObject& handle = view.GetImplementation(); + return static_cast(handle); +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/content-page-impl.cpp b/dali-ui-components/internal/content-page-impl.cpp new file mode 100644 index 00000000..aa411b88 --- /dev/null +++ b/dali-ui-components/internal/content-page-impl.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2026 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 +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +UI::ContentPage ContentPageImpl::New() +{ + IntrusivePtr impl = new Internal::ContentPageImpl(); + UI::ContentPage handle = UI::ContentPage(*impl); + impl->Initialize(); + return handle; +} + +ContentPageImpl::ContentPageImpl() + : PageImpl() +{ +} + +ContentPageImpl::~ContentPageImpl() +{ +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/content-page-impl.h b/dali-ui-components/internal/content-page-impl.h new file mode 100644 index 00000000..6ebf77c0 --- /dev/null +++ b/dali-ui-components/internal/content-page-impl.h @@ -0,0 +1,88 @@ +#pragma once + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +/** + * @brief This is the internal implementation class for ContentPage. + */ +class ContentPageImpl : public PageImpl +{ +public: + + // Creation & Destruction + + static UI::ContentPage New(); + +protected: + + virtual ~ContentPageImpl(); + +public: + + // API + +protected: + + // Construction + ContentPageImpl(); + +private: + + // Not copyable or movable + ContentPageImpl(const ContentPageImpl&) = delete; + ContentPageImpl(ContentPageImpl&&) = delete; + ContentPageImpl& operator=(const ContentPageImpl&) = delete; + ContentPageImpl& operator=(ContentPageImpl&&) = delete; +}; + +// Helpers for public-api forwarding methods + +inline Internal::ContentPageImpl& GetImpl(UI::ContentPage& view) +{ + DALI_ASSERT_ALWAYS(view); + Dali::RefObject& handle = view.GetImplementation(); + return static_cast(handle); +} + +inline const Internal::ContentPageImpl& GetImpl(const UI::ContentPage& view) +{ + DALI_ASSERT_ALWAYS(view); + const Dali::RefObject& handle = view.GetImplementation(); + return static_cast(handle); +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/dialog-page-impl.cpp b/dali-ui-components/internal/dialog-page-impl.cpp new file mode 100644 index 00000000..d9c32df4 --- /dev/null +++ b/dali-ui-components/internal/dialog-page-impl.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2026 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 +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +UI::DialogPage DialogPageImpl::New() +{ + IntrusivePtr impl = new Internal::DialogPageImpl(); + UI::DialogPage handle = UI::DialogPage(*impl); + impl->Initialize(); + return handle; +} + +DialogPageImpl::DialogPageImpl() + : PageImpl() +{ +} + +DialogPageImpl::~DialogPageImpl() +{ +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/dialog-page-impl.h b/dali-ui-components/internal/dialog-page-impl.h new file mode 100644 index 00000000..61601074 --- /dev/null +++ b/dali-ui-components/internal/dialog-page-impl.h @@ -0,0 +1,88 @@ +#pragma once + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +/** + * @brief This is the internal implementation class for DialogPage. + */ +class DialogPageImpl : public PageImpl +{ +public: + + // Creation & Destruction + + static UI::DialogPage New(); + +protected: + + virtual ~DialogPageImpl(); + +public: + + // API + +protected: + + // Construction + DialogPageImpl(); + +private: + + // Not copyable or movable + DialogPageImpl(const DialogPageImpl&) = delete; + DialogPageImpl(DialogPageImpl&&) = delete; + DialogPageImpl& operator=(const DialogPageImpl&) = delete; + DialogPageImpl& operator=(DialogPageImpl&&) = delete; +}; + +// Helpers for public-api forwarding methods + +inline Internal::DialogPageImpl& GetImpl(UI::DialogPage& view) +{ + DALI_ASSERT_ALWAYS(view); + Dali::RefObject& handle = view.GetImplementation(); + return static_cast(handle); +} + +inline const Internal::DialogPageImpl& GetImpl(const UI::DialogPage& view) +{ + DALI_ASSERT_ALWAYS(view); + const Dali::RefObject& handle = view.GetImplementation(); + return static_cast(handle); +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/navigator-impl.cpp b/dali-ui-components/internal/navigator-impl.cpp new file mode 100644 index 00000000..9c222a1c --- /dev/null +++ b/dali-ui-components/internal/navigator-impl.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2026 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 +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +UI::Navigator NavigatorImpl::New() +{ + // Create the implementation, temporarily owned on stack + IntrusivePtr impl = new Internal::NavigatorImpl(); + + // Pass ownership to CustomActor handle + UI::Navigator handle = UI::Navigator(*impl); + + // Second-phase initialization + impl->Initialize(); + + return handle; +} + +NavigatorImpl::NavigatorImpl() + : ViewImpl() +{ +} + +NavigatorImpl::~NavigatorImpl() +{ +} + +void NavigatorImpl::Push(UI::Page page) +{ + if (!page) + { + return; + } + + if (!mPages.empty()) + { + // Hide or process transition for the top page if necessary + auto topPage = mPages.back(); + // For simple stacking, we might just hide the old top or put the new one over it + } + + mPages.push_back(page); + + // Add child to the Navigator View + Self().Add(page); +} + +UI::Page NavigatorImpl::Pop() +{ + if (mPages.empty()) + { + return UI::Page(); + } + + UI::Page topPage = mPages.back(); + mPages.pop_back(); + + // Remove from Navigator View + Self().Remove(topPage); + + return topPage; +} + +void NavigatorImpl::Insert(UI::Page page, uint32_t index) +{ + if (!page) + { + return; + } + if (index > mPages.size()) + { + return; + } + + mPages.insert(mPages.begin() + index, page); + // Add child to Navigator view + Self().Add(page); + // We may need to reorder the Dali::Actor hierarchy, e.g. using LowerToBottom / RaiseToTop + // but for now simple Addition is done. +} + +void NavigatorImpl::Remove(UI::Page page) +{ + if (!page) + { + return; + } + + auto it = std::find(mPages.begin(), mPages.end(), page); + if (it != mPages.end()) + { + mPages.erase(it); + Self().Remove(page); + } +} + +UI::Page NavigatorImpl::GetPage(uint32_t index) const +{ + if (index < mPages.size()) + { + return mPages[index]; + } + return UI::Page(); +} + +uint32_t NavigatorImpl::GetPageCount() const +{ + return static_cast(mPages.size()); +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/navigator-impl.h b/dali-ui-components/internal/navigator-impl.h new file mode 100644 index 00000000..bac1697a --- /dev/null +++ b/dali-ui-components/internal/navigator-impl.h @@ -0,0 +1,120 @@ +#pragma once + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +/** + * @brief This is the internal implementation class for Navigator. + */ +class NavigatorImpl : public Integration::ViewImpl +{ +public: + + // Creation & Destruction + + /** + * @brief Creates a new NavigatorImpl. + */ + static UI::Navigator New(); + +protected: + + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~NavigatorImpl(); + +public: + + // API + + void Push(UI::Page page); + + UI::Page Pop(); + + void Insert(UI::Page page, uint32_t index); + + void Remove(UI::Page page); + + UI::Page GetPage(uint32_t index) const; + + uint32_t GetPageCount() const; + +protected: + + // Construction + + /** + * @brief NavigatorImpl constructor. + */ + NavigatorImpl(); + +private: + + // Not copyable or movable + NavigatorImpl(const NavigatorImpl&) = delete; + NavigatorImpl(NavigatorImpl&&) = delete; + NavigatorImpl& operator=(const NavigatorImpl&) = delete; + NavigatorImpl& operator=(NavigatorImpl&&) = delete; + +private: + + // Data + std::vector mPages; +}; + +// Helpers for public-api forwarding methods + +inline Internal::NavigatorImpl& GetImpl(UI::Navigator& navigator) +{ + DALI_ASSERT_ALWAYS(navigator); + + Dali::RefObject& handle = navigator.GetImplementation(); + + return static_cast(handle); +} + +inline const Internal::NavigatorImpl& GetImpl(const UI::Navigator& navigator) +{ + DALI_ASSERT_ALWAYS(navigator); + + const Dali::RefObject& handle = navigator.GetImplementation(); + + return static_cast(handle); +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/page-impl.cpp b/dali-ui-components/internal/page-impl.cpp new file mode 100644 index 00000000..16dd058f --- /dev/null +++ b/dali-ui-components/internal/page-impl.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2026 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 +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +UI::Page PageImpl::New() +{ + // Create the implementation, temporarily owned on stack + IntrusivePtr impl = new Internal::PageImpl(); + + // Pass ownership to CustomActor handle + UI::Page handle = UI::Page(*impl); + + // Second-phase initialization + impl->Initialize(); + + return handle; +} + +PageImpl::PageImpl() + : ViewImpl() +{ +} + +PageImpl::~PageImpl() +{ +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/internal/page-impl.h b/dali-ui-components/internal/page-impl.h new file mode 100644 index 00000000..8a0f8a54 --- /dev/null +++ b/dali-ui-components/internal/page-impl.h @@ -0,0 +1,106 @@ +#pragma once + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +namespace Internal +{ + +/** + * @brief This is the internal implementation class for Page. + */ +class PageImpl : public Integration::ViewImpl +{ +public: + + // Creation & Destruction + + /** + * @brief Creates a new PageImpl. + */ + static UI::Page New(); + +protected: + + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~PageImpl(); + +public: + + // API + +protected: + + // Construction + + /** + * @brief PageImpl constructor. + */ + PageImpl(); + +private: + + // Not copyable or movable + PageImpl(const PageImpl&) = delete; + PageImpl(PageImpl&&) = delete; + PageImpl& operator=(const PageImpl&) = delete; + PageImpl& operator=(PageImpl&&) = delete; + +private: + + // Data +}; + +// Helpers for public-api forwarding methods + +inline Internal::PageImpl& GetImpl(UI::Page& page) +{ + DALI_ASSERT_ALWAYS(page); + + Dali::RefObject& handle = page.GetImplementation(); + + return static_cast(handle); +} + +inline const Internal::PageImpl& GetImpl(const UI::Page& page) +{ + DALI_ASSERT_ALWAYS(page); + + const Dali::RefObject& handle = page.GetImplementation(); + + return static_cast(handle); +} + +} // namespace Internal + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/app-bar.autogen.h b/dali-ui-components/public-api/app-bar.autogen.h new file mode 100644 index 00000000..36c4860d --- /dev/null +++ b/dali-ui-components/public-api/app-bar.autogen.h @@ -0,0 +1,5 @@ +// Generated by dali-ui preprocessor. Do not modify. +#pragma once + +#define DALI_UI_CHAIN_APPBAR_METHODS(ChildClass) \ + DALI_UI_CHAIN_VIEW_METHODS(ChildClass) diff --git a/dali-ui-components/public-api/app-bar.cpp b/dali-ui-components/public-api/app-bar.cpp new file mode 100644 index 00000000..d46c5c6f --- /dev/null +++ b/dali-ui-components/public-api/app-bar.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2026 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 UI +{ + +AppBar::AppBar() +{ +} + +AppBar AppBar::New() +{ + return Internal::AppBarImpl::New(); +} + +AppBar::AppBar(const AppBar& appBar) + : View(appBar) +{ +} + +AppBar::AppBar(AppBar&& rhs) noexcept + : View(std::move(rhs)) +{ +} + +AppBar::~AppBar() +{ +} + +AppBar& AppBar::operator=(const AppBar& handle) +{ + if (&handle != this) + { + Toolkit::Control::operator=(handle); + } + return *this; +} + +AppBar& AppBar::operator=(AppBar&& rhs) noexcept +{ + Toolkit::Control::operator=(std::move(rhs)); + return *this; +} + +AppBar AppBar::DownCast(BaseHandle handle) +{ + AppBar result; + Toolkit::Control control = Toolkit::Control::DownCast(handle); + if (control) + { + CustomActorImpl& customImpl = control.GetImplementation(); + Internal::AppBarImpl* impl = dynamic_cast(&customImpl); + if (impl) + { + result = AppBar(customImpl.GetOwner()); + } + } + return result; +} + +AppBar::AppBar(Internal::AppBarImpl& implementation) + : View(implementation) +{ +} + +AppBar::AppBar(Dali::Internal::CustomActor* internal) + : View(internal) +{ + VerifyCustomActorPointer(internal); +} + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/app-bar.h b/dali-ui-components/public-api/app-bar.h new file mode 100644 index 00000000..18dfd2d4 --- /dev/null +++ b/dali-ui-components/public-api/app-bar.h @@ -0,0 +1,112 @@ +#pragma once + +// --- DALI_UI_CHAIN_MACROS_START --- +// Generated by dali-ui preprocessor. Do not modify. +#define DALI_UI_CHAIN_APPBAR_METHODS(ChildClass) DALI_UI_CHAIN_VIEW_METHODS(ChildClass) + +// --- DALI_UI_CHAIN_MACROS_END --- + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +// Forward declarations +namespace Internal +{ +class AppBarImpl; +} + +#include "app-bar.autogen.h" +/** + * @brief AppBar shows title text and provides navigation and action functions on Page. + */ +class DALI_UI_API AppBar : public View +{ +public: + + // Typedefs + +public: // Creation & Destruction + + /** + * @brief Creates an uninitialized AppBar handle. + */ + AppBar(); + + /** + * @brief Creates an initialized AppBar. + */ + static AppBar New(); + + /** + * @brief Copy constructor. + */ + AppBar(const AppBar& appBar); + + /** + * @brief Move constructor. + */ + AppBar(AppBar&& rhs) noexcept; + + /** + * @brief Virtual destructor. + */ + ~AppBar(); + +public: // Operators + + AppBar& operator=(const AppBar& handle); + AppBar& operator=(AppBar&& rhs) noexcept; + +public: // Static Methods + + /** + * @brief Downcasts a handle to AppBar handle. + */ + static AppBar DownCast(BaseHandle handle); + +public: // Setters for chaining + + // @CHAIN_START(AppBar, View) + // @CHAIN_END + +public: // Signals + +public: // Not intended for application developers + + /// @cond internal + DALI_INTERNAL AppBar(Internal::AppBarImpl& implementation); + explicit DALI_INTERNAL AppBar(Dali::Internal::CustomActor* internal); + /// @endcond + +public: + DALI_UI_CHAIN_VIEW_METHODS(AppBar) +}; + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/content-page.autogen.h b/dali-ui-components/public-api/content-page.autogen.h new file mode 100644 index 00000000..30c0d3bd --- /dev/null +++ b/dali-ui-components/public-api/content-page.autogen.h @@ -0,0 +1,5 @@ +// Generated by dali-ui preprocessor. Do not modify. +#pragma once + +#define DALI_UI_CHAIN_CONTENTPAGE_METHODS(ChildClass) \ + DALI_UI_CHAIN_PAGE_METHODS(ChildClass) diff --git a/dali-ui-components/public-api/content-page.cpp b/dali-ui-components/public-api/content-page.cpp new file mode 100644 index 00000000..9d718a95 --- /dev/null +++ b/dali-ui-components/public-api/content-page.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2026 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 UI +{ + +ContentPage::ContentPage() +{ +} + +ContentPage ContentPage::New() +{ + return Internal::ContentPageImpl::New(); +} + +ContentPage::ContentPage(const ContentPage& contentPage) + : Page(contentPage) +{ +} + +ContentPage::ContentPage(ContentPage&& rhs) noexcept + : Page(std::move(rhs)) +{ +} + +ContentPage::~ContentPage() +{ +} + +ContentPage& ContentPage::operator=(const ContentPage& handle) +{ + if (&handle != this) + { + Toolkit::Control::operator=(handle); + } + return *this; +} + +ContentPage& ContentPage::operator=(ContentPage&& rhs) noexcept +{ + Toolkit::Control::operator=(std::move(rhs)); + return *this; +} + +ContentPage ContentPage::DownCast(BaseHandle handle) +{ + ContentPage result; + Toolkit::Control control = Toolkit::Control::DownCast(handle); + if (control) + { + CustomActorImpl& customImpl = control.GetImplementation(); + Internal::ContentPageImpl* impl = dynamic_cast(&customImpl); + if (impl) + { + result = ContentPage(customImpl.GetOwner()); + } + } + return result; +} + +ContentPage::ContentPage(Internal::ContentPageImpl& implementation) + : Page(implementation) +{ +} + +ContentPage::ContentPage(Dali::Internal::CustomActor* internal) + : Page(internal) +{ + VerifyCustomActorPointer(internal); +} + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/content-page.h b/dali-ui-components/public-api/content-page.h new file mode 100644 index 00000000..276cdc12 --- /dev/null +++ b/dali-ui-components/public-api/content-page.h @@ -0,0 +1,112 @@ +#pragma once + +// --- DALI_UI_CHAIN_MACROS_START --- +// Generated by dali-ui preprocessor. Do not modify. +#define DALI_UI_CHAIN_CONTENTPAGE_METHODS(ChildClass) DALI_UI_CHAIN_PAGE_METHODS(ChildClass) + +// --- DALI_UI_CHAIN_MACROS_END --- + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +// Forward declarations +namespace Internal +{ +class ContentPageImpl; +} + +#include "content-page.autogen.h" +/** + * @brief ContentPage is a formatted full-screen page containing an AppBar and content. + */ +class DALI_UI_API ContentPage : public Page +{ +public: + + // Typedefs + +public: // Creation & Destruction + + /** + * @brief Creates an uninitialized ContentPage handle. + */ + ContentPage(); + + /** + * @brief Creates an initialized ContentPage. + */ + static ContentPage New(); + + /** + * @brief Copy constructor. + */ + ContentPage(const ContentPage& contentPage); + + /** + * @brief Move constructor. + */ + ContentPage(ContentPage&& rhs) noexcept; + + /** + * @brief Virtual destructor. + */ + ~ContentPage(); + +public: // Operators + + ContentPage& operator=(const ContentPage& handle); + ContentPage& operator=(ContentPage&& rhs) noexcept; + +public: // Static Methods + + /** + * @brief Downcasts a handle to ContentPage handle. + */ + static ContentPage DownCast(BaseHandle handle); + +public: // Setters for chaining + + // @CHAIN_START(ContentPage, Page) + // @CHAIN_END + +public: // Signals + +public: // Not intended for application developers + + /// @cond internal + DALI_INTERNAL ContentPage(Internal::ContentPageImpl& implementation); + explicit DALI_INTERNAL ContentPage(Dali::Internal::CustomActor* internal); + /// @endcond + +public: + DALI_UI_CHAIN_PAGE_METHODS(ContentPage) +}; + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/dialog-page.autogen.h b/dali-ui-components/public-api/dialog-page.autogen.h new file mode 100644 index 00000000..e64f734f --- /dev/null +++ b/dali-ui-components/public-api/dialog-page.autogen.h @@ -0,0 +1,5 @@ +// Generated by dali-ui preprocessor. Do not modify. +#pragma once + +#define DALI_UI_CHAIN_DIALOGPAGE_METHODS(ChildClass) \ + DALI_UI_CHAIN_PAGE_METHODS(ChildClass) diff --git a/dali-ui-components/public-api/dialog-page.cpp b/dali-ui-components/public-api/dialog-page.cpp new file mode 100644 index 00000000..68e5b881 --- /dev/null +++ b/dali-ui-components/public-api/dialog-page.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2026 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 UI +{ + +DialogPage::DialogPage() +{ +} + +DialogPage DialogPage::New() +{ + return Internal::DialogPageImpl::New(); +} + +DialogPage::DialogPage(const DialogPage& dialogPage) + : Page(dialogPage) +{ +} + +DialogPage::DialogPage(DialogPage&& rhs) noexcept + : Page(std::move(rhs)) +{ +} + +DialogPage::~DialogPage() +{ +} + +DialogPage& DialogPage::operator=(const DialogPage& handle) +{ + if (&handle != this) + { + Toolkit::Control::operator=(handle); + } + return *this; +} + +DialogPage& DialogPage::operator=(DialogPage&& rhs) noexcept +{ + Toolkit::Control::operator=(std::move(rhs)); + return *this; +} + +DialogPage DialogPage::DownCast(BaseHandle handle) +{ + DialogPage result; + Toolkit::Control control = Toolkit::Control::DownCast(handle); + if (control) + { + CustomActorImpl& customImpl = control.GetImplementation(); + Internal::DialogPageImpl* impl = dynamic_cast(&customImpl); + if (impl) + { + result = DialogPage(customImpl.GetOwner()); + } + } + return result; +} + +DialogPage::DialogPage(Internal::DialogPageImpl& implementation) + : Page(implementation) +{ +} + +DialogPage::DialogPage(Dali::Internal::CustomActor* internal) + : Page(internal) +{ + VerifyCustomActorPointer(internal); +} + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/dialog-page.h b/dali-ui-components/public-api/dialog-page.h new file mode 100644 index 00000000..59a251dd --- /dev/null +++ b/dali-ui-components/public-api/dialog-page.h @@ -0,0 +1,112 @@ +#pragma once + +// --- DALI_UI_CHAIN_MACROS_START --- +// Generated by dali-ui preprocessor. Do not modify. +#define DALI_UI_CHAIN_DIALOGPAGE_METHODS(ChildClass) DALI_UI_CHAIN_PAGE_METHODS(ChildClass) + +// --- DALI_UI_CHAIN_MACROS_END --- + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +// Forward declarations +namespace Internal +{ +class DialogPageImpl; +} + +#include "dialog-page.autogen.h" +/** + * @brief DialogPage shows a dialog on the page with a dimmed scrim. + */ +class DALI_UI_API DialogPage : public Page +{ +public: + + // Typedefs + +public: // Creation & Destruction + + /** + * @brief Creates an uninitialized DialogPage handle. + */ + DialogPage(); + + /** + * @brief Creates an initialized DialogPage. + */ + static DialogPage New(); + + /** + * @brief Copy constructor. + */ + DialogPage(const DialogPage& dialogPage); + + /** + * @brief Move constructor. + */ + DialogPage(DialogPage&& rhs) noexcept; + + /** + * @brief Virtual destructor. + */ + ~DialogPage(); + +public: // Operators + + DialogPage& operator=(const DialogPage& handle); + DialogPage& operator=(DialogPage&& rhs) noexcept; + +public: // Static Methods + + /** + * @brief Downcasts a handle to DialogPage handle. + */ + static DialogPage DownCast(BaseHandle handle); + +public: // Setters for chaining + + // @CHAIN_START(DialogPage, Page) + // @CHAIN_END + +public: // Signals + +public: // Not intended for application developers + + /// @cond internal + DALI_INTERNAL DialogPage(Internal::DialogPageImpl& implementation); + explicit DALI_INTERNAL DialogPage(Dali::Internal::CustomActor* internal); + /// @endcond + +public: + DALI_UI_CHAIN_PAGE_METHODS(DialogPage) +}; + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/navigator.autogen.h b/dali-ui-components/public-api/navigator.autogen.h new file mode 100644 index 00000000..4c2bc15b --- /dev/null +++ b/dali-ui-components/public-api/navigator.autogen.h @@ -0,0 +1,5 @@ +// Generated by dali-ui preprocessor. Do not modify. +#pragma once + +#define DALI_UI_CHAIN_NAVIGATOR_METHODS(ChildClass) \ + DALI_UI_CHAIN_VIEW_METHODS(ChildClass) diff --git a/dali-ui-components/public-api/navigator.cpp b/dali-ui-components/public-api/navigator.cpp new file mode 100644 index 00000000..ec5fc2fb --- /dev/null +++ b/dali-ui-components/public-api/navigator.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2026 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 UI +{ + +Navigator::Navigator() +{ +} + +Navigator Navigator::New() +{ + return Internal::NavigatorImpl::New(); +} + +Navigator::Navigator(const Navigator& navigator) + : View(navigator) +{ +} + +Navigator::Navigator(Navigator&& rhs) noexcept + : View(std::move(rhs)) +{ +} + +Navigator::~Navigator() +{ +} + +Navigator& Navigator::operator=(const Navigator& handle) +{ + if (&handle != this) + { + Toolkit::Control::operator=(handle); + } + return *this; +} + +Navigator& Navigator::operator=(Navigator&& rhs) noexcept +{ + Toolkit::Control::operator=(std::move(rhs)); + return *this; +} + +Navigator Navigator::DownCast(BaseHandle handle) +{ + Navigator result; + Toolkit::Control control = Toolkit::Control::DownCast(handle); + if (control) + { + CustomActorImpl& customImpl = control.GetImplementation(); + Internal::NavigatorImpl* impl = dynamic_cast(&customImpl); + if (impl) + { + result = Navigator(customImpl.GetOwner()); + } + } + return result; +} + +void Navigator::Push(Page page) +{ + Internal::GetImpl(*this).Push(page); +} + +Page Navigator::Pop() +{ + return Internal::GetImpl(*this).Pop(); +} + +void Navigator::Insert(Page page, uint32_t index) +{ + Internal::GetImpl(*this).Insert(page, index); +} + +void Navigator::Remove(Page page) +{ + Internal::GetImpl(*this).Remove(page); +} + +Page Navigator::GetPage(uint32_t index) const +{ + return Internal::GetImpl(*this).GetPage(index); +} + +uint32_t Navigator::GetPageCount() const +{ + return Internal::GetImpl(*this).GetPageCount(); +} + +Navigator::Navigator(Internal::NavigatorImpl& implementation) + : View(implementation) +{ +} + +Navigator::Navigator(Dali::Internal::CustomActor* internal) + : View(internal) +{ + VerifyCustomActorPointer(internal); +} + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/navigator.h b/dali-ui-components/public-api/navigator.h new file mode 100644 index 00000000..d6c78b5f --- /dev/null +++ b/dali-ui-components/public-api/navigator.h @@ -0,0 +1,174 @@ +#pragma once + +// --- DALI_UI_CHAIN_MACROS_START --- +// Generated by dali-ui preprocessor. Do not modify. +#define DALI_UI_CHAIN_NAVIGATOR_METHODS(ChildClass) DALI_UI_CHAIN_VIEW_METHODS(ChildClass) + +// --- DALI_UI_CHAIN_MACROS_END --- + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +// Forward declarations +namespace Internal +{ +class NavigatorImpl; +} + +#include "navigator.autogen.h" +/** + * @brief Navigator navigates pages with stack methods. + */ +class DALI_UI_API Navigator : public View +{ +public: + + // Typedefs + +public: // Creation & Destruction + + /** + * @brief Creates an uninitialized Navigator handle. + */ + Navigator(); + + /** + * @brief Creates an initialized Navigator. + * + * @return A handle to a newly allocated Dali resource + */ + static Navigator New(); + + /** + * @brief Copy constructor. + * + * @param[in] navigator Handle to copy + */ + Navigator(const Navigator& navigator); + + /** + * @brief Move constructor. + * + * @param[in] rhs Handle to move + */ + Navigator(Navigator&& rhs) noexcept; + + /** + * @brief Virtual destructor. + */ + ~Navigator(); + +public: // Operators + + /** + * @brief Copy assignment operator. + */ + Navigator& operator=(const Navigator& handle); + + /** + * @brief Move assignment operator. + */ + Navigator& operator=(Navigator&& rhs) noexcept; + +public: // Static Methods + + /** + * @brief Downcasts a handle to Navigator handle. + */ + static Navigator DownCast(BaseHandle handle); + +public: // Methods + + /** + * @brief Pushes a page to the navigator. + * @param page The page to push. + */ + void Push(Page page); + + /** + * @brief Pops the top page from the navigator. + * @return The popped page. + */ + Page Pop(); + + /** + * @brief Inserts a page into the navigator at the specified index. + * @param page The page to insert. + * @param index The index to insert at. + */ + void Insert(Page page, uint32_t index); + + /** + * @brief Removes a page from the navigator. + * @param page The page to remove. + */ + void Remove(Page page); + + /** + * @brief Gets the page at the specified index. + * @param index The index of the page. + * @return The page at the index. + */ + Page GetPage(uint32_t index) const; + + /** + * @brief Gets the number of pages in the navigator. + * @return The page count. + */ + uint32_t GetPageCount() const; + +public: // Setters for chaining + + // @CHAIN_START(Navigator, View) + // @CHAIN_END + +public: // Signals + +public: // Not intended for application developers + + /// @cond internal + /** + * @brief Creates a handle using the Internal implementation. + */ + DALI_INTERNAL Navigator(Internal::NavigatorImpl& implementation); + + /** + * @brief Allows the creation of this Control from an Internal::CustomActor pointer. + */ + explicit DALI_INTERNAL Navigator(Dali::Internal::CustomActor* internal); + /// @endcond + +public: + DALI_UI_CHAIN_VIEW_METHODS(Navigator) +}; + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/page.autogen.h b/dali-ui-components/public-api/page.autogen.h new file mode 100644 index 00000000..c3809709 --- /dev/null +++ b/dali-ui-components/public-api/page.autogen.h @@ -0,0 +1,5 @@ +// Generated by dali-ui preprocessor. Do not modify. +#pragma once + +#define DALI_UI_CHAIN_PAGE_METHODS(ChildClass) \ + DALI_UI_CHAIN_VIEW_METHODS(ChildClass) diff --git a/dali-ui-components/public-api/page.cpp b/dali-ui-components/public-api/page.cpp new file mode 100644 index 00000000..90725c64 --- /dev/null +++ b/dali-ui-components/public-api/page.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2026 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 UI +{ + +Page::Page() +{ +} + +Page Page::New() +{ + return Internal::PageImpl::New(); +} + +Page::Page(const Page& page) + : View(page) +{ +} + +Page::Page(Page&& rhs) noexcept + : View(std::move(rhs)) +{ +} + +Page::~Page() +{ +} + +Page& Page::operator=(const Page& handle) +{ + if (&handle != this) + { + Toolkit::Control::operator=(handle); + } + return *this; +} + +Page& Page::operator=(Page&& rhs) noexcept +{ + Toolkit::Control::operator=(std::move(rhs)); + return *this; +} + +Page Page::DownCast(BaseHandle handle) +{ + Page result; + Toolkit::Control control = Toolkit::Control::DownCast(handle); + if (control) + { + CustomActorImpl& customImpl = control.GetImplementation(); + Internal::PageImpl* impl = dynamic_cast(&customImpl); + if (impl) + { + result = Page(customImpl.GetOwner()); + } + } + return result; +} + +Page::Page(Internal::PageImpl& implementation) + : View(implementation) +{ +} + +Page::Page(Dali::Internal::CustomActor* internal) + : View(internal) +{ + VerifyCustomActorPointer(internal); +} + +} // namespace UI + +} // namespace Dali diff --git a/dali-ui-components/public-api/page.h b/dali-ui-components/public-api/page.h new file mode 100644 index 00000000..b3139eb5 --- /dev/null +++ b/dali-ui-components/public-api/page.h @@ -0,0 +1,134 @@ +#pragma once + +// --- DALI_UI_CHAIN_MACROS_START --- +// Generated by dali-ui preprocessor. Do not modify. +#define DALI_UI_CHAIN_PAGE_METHODS(ChildClass) DALI_UI_CHAIN_VIEW_METHODS(ChildClass) + +// --- DALI_UI_CHAIN_MACROS_END --- + +/* + * Copyright (c) 2026 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 + +namespace Dali +{ + +namespace UI +{ + +// Forward declarations +namespace Internal +{ +class PageImpl; +} + +#include "page.autogen.h" +/** + * @brief Page is an element of navigation. + */ +class DALI_UI_API Page : public View +{ +public: + + // Typedefs + +public: // Creation & Destruction + + /** + * @brief Creates an uninitialized Page handle. + */ + Page(); + + /** + * @brief Creates an initialized Page. + * + * @return A handle to a newly allocated Dali resource + */ + static Page New(); + + /** + * @brief Copy constructor. + * + * Creates another handle that points to the same real object. + * @param[in] page Handle to copy + */ + Page(const Page& page); + + /** + * @brief Move constructor. + * + * @param[in] rhs Handle to move + */ + Page(Page&& rhs) noexcept; + + /** + * @brief Virtual destructor. + */ + ~Page(); + +public: // Operators + + /** + * @brief Copy assignment operator. + */ + Page& operator=(const Page& handle); + + /** + * @brief Move assignment operator. + */ + Page& operator=(Page&& rhs) noexcept; + +public: // Static Methods + + /** + * @brief Downcasts a handle to Page handle. + */ + static Page DownCast(BaseHandle handle); + +public: // Setters for chaining + + // @CHAIN_START(Page, View) + // @CHAIN_END + +public: // Signals + +public: // Not intended for application developers + + /// @cond internal + /** + * @brief Creates a handle using the Internal implementation. + */ + DALI_INTERNAL Page(Internal::PageImpl& implementation); + + /** + * @brief Allows the creation of this Control from an Internal::CustomActor pointer. + */ + explicit DALI_INTERNAL Page(Dali::Internal::CustomActor* internal); + /// @endcond + +public: + DALI_UI_CHAIN_VIEW_METHODS(Page) +}; + +} // namespace UI + +} // namespace Dali diff --git a/samples/navigation/CMakeLists.txt b/samples/navigation/CMakeLists.txt new file mode 100644 index 00000000..3aca9632 --- /dev/null +++ b/samples/navigation/CMakeLists.txt @@ -0,0 +1,60 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.8.2) + +PROJECT(navigation.example) + +SET(CMAKE_CXX_STANDARD 17) +SET(CMAKE_C_STANDARD 99) + +# Find required packages +FIND_PACKAGE(PkgConfig REQUIRED) +PKG_CHECK_MODULES(DALICORE REQUIRED dali2-core) +PKG_CHECK_MODULES(DALIADAPTOR REQUIRED dali2-adaptor) +PKG_CHECK_MODULES(DALITOOLKIT REQUIRED dali2-toolkit) +PKG_CHECK_MODULES(DALI_UI_FOUNDATION REQUIRED dali2-ui-foundation) +PKG_CHECK_MODULES(DALI_UI_ELEMENTS REQUIRED dali2-ui-elements) +PKG_CHECK_MODULES(DALI_UI_COMPONENTS REQUIRED dali2-ui-components) + +# Add executable +SET(EXE_NAME navigation.example) +ADD_EXECUTABLE(${EXE_NAME} navigation-example.cpp) + +# Set output directory +SET_TARGET_PROPERTIES(${EXE_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") + +INSTALL(TARGETS ${EXE_NAME} RUNTIME DESTINATION) + +# Link libraries +TARGET_LINK_LIBRARIES(${EXE_NAME} + ${DALICORE_LIBRARIES} + ${DALIADAPTOR_LIBRARIES} + ${DALITOOLKIT_LIBRARIES} + ${DALI_UI_FOUNDATION_LIBRARIES} + ${DALI_UI_ELEMENTS_LIBRARIES} + ${DALI_UI_COMPONENTS_LIBRARIES} +) + +# Add link directories +TARGET_LINK_DIRECTORIES(${EXE_NAME} PRIVATE + $ENV{DESKTOP_PREFIX}/lib +) + +# Include directories +TARGET_INCLUDE_DIRECTORIES(${EXE_NAME} PRIVATE + ${DALICORE_INCLUDE_DIRS} + ${DALIADAPTOR_INCLUDE_DIRS} + ${DALITOOLKIT_INCLUDE_DIRS} + ${DALI_UI_FOUNDATION_INCLUDE_DIRS} + ${DALI_UI_ELEMENTS_INCLUDE_DIRS} + ${DALI_UI_COMPONENTS_INCLUDE_DIRS} +) + +# Compiler flags +TARGET_COMPILE_OPTIONS(${EXE_NAME} PRIVATE + ${DALICORE_CFLAGS_OTHER} + ${DALIADAPTOR_CFLAGS_OTHER} + ${DALITOOLKIT_CFLAGS_OTHER} + ${DALI_UI_FOUNDATION_CFLAGS_OTHER} + ${DALI_UI_ELEMENTS_CFLAGS_OTHER} + ${DALI_UI_COMPONENTS_CFLAGS_OTHER} +) diff --git a/samples/navigation/navigation-example.cpp b/samples/navigation/navigation-example.cpp new file mode 100644 index 00000000..c5b462ad --- /dev/null +++ b/samples/navigation/navigation-example.cpp @@ -0,0 +1,304 @@ +/* Copyright (c) 2026 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 +#include +#include + +#include +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace Dali::UI; +using Dali::UI::View; + +/** + * This example demonstrates the Navigation API using Navigator, ContentPage, AppBar, and DialogPage. + */ +class NavigationController : public ConnectionTracker +{ +public: + + NavigationController(Application& application) + : mApplication(application) + { + mApplication.InitSignal().Connect(this, &NavigationController::Create); + } + + ~NavigationController() = default; + + void Create(Dali::Application& application) + { + Dali::Window window = application.GetWindow(); + window.SetBackgroundColor(Dali::Color::WHITE); + + // Create the main Navigator + mNavigator = + UI::Navigator::New().SetSizeWidth(window.GetSize().GetWidth()).SetSizeHeight(window.GetSize().GetHeight()); + + window.Add(mNavigator); + + // Push the initial page + mNavigator.Push(CreateMainPage()); + } + + // Create the Main ContentPage + UI::ContentPage CreateMainPage() + { + DALI_LOG_ERROR("[CreateMainPage] Called\n"); + UI::ContentPage mainPage = UI::ContentPage::New(); + mainPage.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + mainPage.SetSizeWidth(mNavigator.GetSizeWidth()); + mainPage.SetSizeHeight(mNavigator.GetSizeHeight()); + + UI::AppBar appBar = UI::AppBar::New() + .BackgroundColor(Dali::Color::BLUE) + .SetSizeHeight(60_spx) + .SetSizeWidth(mNavigator.GetSizeWidth()); + appBar.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + + // In a real implementation this would tie into an AppBar Title property + View titleText = View::New().BackgroundColor(Dali::Color::CYAN).SetSizeWidth(200_spx).SetSizeHeight(40_spx); + appBar.Add(titleText); + + UI::FlexLayout contentArea = UI::FlexLayout::New() + .Direction(UI::FlexDirection::Column) + .AlignItems(UI::FlexAlign::Center) + .JustifyContent(UI::FlexJustify::Center); + contentArea.SetSizeWidth(mNavigator.GetSizeWidth()); + contentArea.SetSizeHeight(mNavigator.GetSizeHeight() - 60_spx); + contentArea.SetPositionY(60_spx); + contentArea.SetBackgroundColor(Dali::Color::LIGHT_GRAY); // Added to visualize ContentArea bounds + contentArea.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + + // Button to Push Next Page + View pushButton = View::New() + .BackgroundColor(Dali::Color::GREEN) + .SetSizeWidth(200_spx) + .SetSizeHeight(80_spx) + .AsClickable(this, + [this](View view, const UI::InputEvent& inputEvent) + { + if (inputEvent.GetInputEventType() == UI::InputEventType::TOUCH_EVENT) + { + const Dali::TouchEvent& event = inputEvent.GetTouchEvent(); + DALI_LOG_ERROR("[pushButton] Touch State: %d\n", event.GetState(0)); + if (event.GetPointCount() > 0 && event.GetState(0) == Dali::PointState::DOWN) + { + DALI_LOG_ERROR("[pushButton] Pushing SecondPage\n"); + mNavigator.Push(CreateSecondPage()); + return true; + } + } + return false; + }); + + // Button to show Dialog Page + View dialogButton = + View::New() + .BackgroundColor(Dali::Color::YELLOW) + .SetSizeWidth(200_spx) + .SetSizeHeight(80_spx) + .AsClickable(this, + [this](View view, const UI::InputEvent& inputEvent) + { + if (inputEvent.GetInputEventType() == UI::InputEventType::TOUCH_EVENT) + { + const Dali::TouchEvent& event = inputEvent.GetTouchEvent(); + DALI_LOG_ERROR("[dialogButton] Touch State: %d\n", event.GetState(0)); + if (event.GetPointCount() > 0 && event.GetState(0) == Dali::PointState::DOWN) + { + DALI_LOG_ERROR("[dialogButton] Pushing DialogPage\n"); + mNavigator.Push(CreateDialogPage()); + return true; + } + } + return false; + }); + + contentArea.Contents({pushButton, dialogButton}); + + mainPage.Add(appBar); + mainPage.Add(contentArea); + + return mainPage; + } + + // Create a Second ContentPage + UI::ContentPage CreateSecondPage() + { + DALI_LOG_ERROR("[CreateSecondPage] Called\n"); + UI::ContentPage secondPage = UI::ContentPage::New(); + secondPage.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + secondPage.SetSizeWidth(mNavigator.GetSizeWidth()); + secondPage.SetSizeHeight(mNavigator.GetSizeHeight()); + + UI::AppBar appBar = UI::AppBar::New() + .BackgroundColor(Dali::Color::MAGENTA) + .SetSizeHeight(60_spx) + .SetSizeWidth(mNavigator.GetSizeWidth()); + appBar.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + + UI::FlexLayout contentArea = UI::FlexLayout::New() + .Direction(UI::FlexDirection::Column) + .AlignItems(UI::FlexAlign::Center) + .JustifyContent(UI::FlexJustify::Center); + contentArea.SetSizeWidth(mNavigator.GetSizeWidth()); + contentArea.SetSizeHeight(mNavigator.GetSizeHeight() - 60_spx); + contentArea.SetPositionY(60_spx); + contentArea.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + + // Button to Pop back + View popButton = View::New() + .BackgroundColor(Dali::Color::RED) + .SetSizeWidth(200_spx) + .SetSizeHeight(80_spx) + .AsClickable(this, + [this](View view, const UI::InputEvent& inputEvent) + { + if (inputEvent.GetInputEventType() == UI::InputEventType::TOUCH_EVENT) + { + const Dali::TouchEvent& event = inputEvent.GetTouchEvent(); + DALI_LOG_ERROR("[popButton] Touch State: %d\n", event.GetState(0)); + if (event.GetPointCount() > 0 && event.GetState(0) == Dali::PointState::DOWN) + { + DALI_LOG_ERROR("[popButton] Popping Nav\n"); + mNavigator.Pop(); + return true; + } + } + return false; + }); + + contentArea.AddView(popButton); + + secondPage.Add(appBar); + secondPage.Add(contentArea); + + return secondPage; + } + + // Create a DialogPage + UI::DialogPage CreateDialogPage() + { + DALI_LOG_ERROR("[CreateDialogPage] Called\n"); + UI::DialogPage dialogPage = UI::DialogPage::New(); + dialogPage.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + dialogPage.SetSizeWidth(mNavigator.GetSizeWidth()); + dialogPage.SetSizeHeight(mNavigator.GetSizeHeight()); + + // Scrim (dark transparent background) + View scrim = View::New() + .BackgroundColor(Dali::Vector4(0.0f, 0.0f, 0.0f, 0.5f)) // Half transparent black + .SetSizeWidth(mNavigator.GetSizeWidth()) + .SetSizeHeight(mNavigator.GetSizeHeight()); + scrim.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + scrim.AsClickable(this, + [this](View view, const UI::InputEvent& inputEvent) + { + if (inputEvent.GetInputEventType() == UI::InputEventType::TOUCH_EVENT) + { + const Dali::TouchEvent& event = inputEvent.GetTouchEvent(); + DALI_LOG_ERROR("[scrim] Touch State: %d\n", event.GetState(0)); + if (event.GetPointCount() > 0 && event.GetState(0) == Dali::PointState::DOWN) + { + DALI_LOG_ERROR("[scrim] Popping Dialog\n"); + // Touching outside the dialog pops it + mNavigator.Pop(); + return true; + } + } + return false; + }); + + // The actual dialog box + UI::FlexLayout dialogBox = UI::FlexLayout::New() + .Direction(UI::FlexDirection::Column) + .AlignItems(UI::FlexAlign::Center) + .JustifyContent(UI::FlexJustify::Center); + dialogBox.SetBackgroundColor(Dali::Color::WHITE); + dialogBox.SetSizeWidth(300_spx); + dialogBox.SetSizeHeight(200_spx); + dialogBox.SetPositionX((mNavigator.GetSizeWidth() - 300_spx) / 2.0f); + dialogBox.SetPositionY((mNavigator.GetSizeHeight() - 200_spx) / 2.0f); + dialogBox.SetParentOrigin(Dali::ParentOrigin::TOP_LEFT); + + View okButton = View::New() + .BackgroundColor(Dali::Color::BLUE) + .SetSizeWidth(150_spx) + .SetSizeHeight(50_spx) + .AsClickable(this, + [this](View view, const UI::InputEvent& inputEvent) + { + if (inputEvent.GetInputEventType() == UI::InputEventType::TOUCH_EVENT) + { + const Dali::TouchEvent& event = inputEvent.GetTouchEvent(); + DALI_LOG_ERROR("[okButton] Touch State: %d\n", event.GetState(0)); + if (event.GetPointCount() > 0 && event.GetState(0) == Dali::PointState::DOWN) + { + DALI_LOG_ERROR("[okButton] Popping Dialog\n"); + mNavigator.Pop(); + return true; + } + } + return false; + }); + + dialogBox.AddView(okButton); + + dialogPage.Add(scrim); + dialogPage.Add(dialogBox); + + return dialogPage; + } + + void OnKeyEvent(const Dali::KeyEvent& event) + { + DALI_LOG_ERROR("[OnKeyEvent] %s state: %d\n", event.GetKeyName().c_str(), event.GetState()); + if (event.GetState() == Dali::KeyEvent::DOWN) + { + if (IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK)) + { + if (mNavigator.GetPageCount() > 1) + { + mNavigator.Pop(); + } + else + { + mApplication.Quit(); + } + } + } + } + +private: + Dali::Application& mApplication; + UI::Navigator mNavigator; +}; + +int DALI_EXPORT_API main(int argc, char** argv) +{ + Dali::Application application = Dali::Application::New(&argc, &argv); + NavigationController test(application); + application.MainLoop(); + return 0; +}