utc-Dali-Application.cpp
utc-Dali-EncodedImageBuffer.cpp
utc-Dali-Capture.cpp
+ utc-Dali-WindowData.cpp
utc-Dali-FileLoader.cpp
utc-Dali-GifLoading.cpp
utc-Dali-Gl-Window.cpp
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
END_TEST;
}
+int UtcDaliApplicationNew08P(void)
+{
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
+ WindowData windowData;
+
+ Application application = Application::New(&argc, &argv, "stylesheet", false, windowData);
+
+ MyTestApp testApp(application);
+
+ DALI_TEST_CHECK(application);
+
+ END_TEST;
+}
+
int UtcDaliApplicationCopyAndAssignment(void)
{
Application application = Application::New();
--- /dev/null
+/*
+ * Copyright (c) 2023 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 <dali-test-suite-utils.h>
+#include <dali/public-api/adaptor-framework/window-data.h>
+
+using namespace Dali;
+
+int UtcDaliWindowData01(void)
+{
+ // Test default values
+ WindowData windowData;
+
+ DALI_TEST_CHECK(windowData.GetWindowType() == WindowType::NORMAL);
+ DALI_TEST_CHECK(windowData.GetTransparency() == true);
+ DALI_TEST_CHECK(windowData.GetPositionSize().x == 0);
+ DALI_TEST_CHECK(windowData.GetPositionSize().y == 0);
+ DALI_TEST_CHECK(windowData.GetPositionSize().width == 0);
+ DALI_TEST_CHECK(windowData.GetPositionSize().height == 0);
+
+ END_TEST;
+}
+
+int UtcDaliWindowData02(void)
+{
+ // Test SetTransparency and GetTransparency
+ WindowData windowData;
+ windowData.SetTransparency(false);
+
+ DALI_TEST_CHECK(windowData.GetTransparency() == false);
+
+ END_TEST;
+}
+
+int UtcDaliWindowData03(void)
+{
+ // Test SetWindowType and GetWindowType
+ WindowData windowData;
+ windowData.SetWindowType(WindowType::UTILITY);
+
+ DALI_TEST_CHECK(windowData.GetWindowType() == WindowType::UTILITY);
+
+ END_TEST;
+}
+
+int UtcDaliWindowData04(void)
+{
+ // Test SetPositionSize and GetPositionSize
+ WindowData windowData;
+ Dali::Rect<int> rect(100, 200, 300, 400);
+ windowData.SetPositionSize(rect);
+
+ DALI_TEST_CHECK(windowData.GetPositionSize().x == 100);
+ DALI_TEST_CHECK(windowData.GetPositionSize().y == 200);
+ DALI_TEST_CHECK(windowData.GetPositionSize().width == 300);
+ DALI_TEST_CHECK(windowData.GetPositionSize().height == 400);
+
+ END_TEST;
+}
#define DALI_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/adaptor-framework/widget-application.h>
#include <dali/public-api/adaptor-framework/widget-impl.h>
#include <dali/public-api/adaptor-framework/widget.h>
+#include <dali/public-api/adaptor-framework/window-data.h>
#include <dali/public-api/dali-adaptor-version.h>
-#endif //DALI_H
+#endif // DALI_H
return Application(internal.Get());
}
+Application Application::New(int* argc, char** argv[], const std::string& stylesheet, bool useUiThread, WindowData& windowData)
+{
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+ if(internal)
+ {
+ // pre-initialized application
+ internal->SetCommandLineOptions(argc, argv);
+ internal->SetStyleSheet(stylesheet);
+
+ // Set defaut Window type
+ internal->SetDefaultWindowType(windowData.GetWindowType());
+ internal->GetWindow().SetTransparency(windowData.GetTransparency());
+
+ // Store only the value before adaptor is created
+ internal->StoreWindowPositionSize(windowData.GetPositionSize());
+ }
+ else
+ {
+ // clang-format off
+ internal = Internal::Adaptor::Application::New(argc, argv, stylesheet,
+ windowData.GetTransparency() ? WINDOW_MODE::TRANSPARENT : WINDOW_MODE::OPAQUE,
+ windowData.GetPositionSize(), Internal::Adaptor::Framework::NORMAL,
+ windowData.GetWindowType(), useUiThread);
+ // clang-format on
+ }
+ return Application(internal.Get());
+}
+
Application::~Application()
{
}
#define DALI_APPLICATION_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
// INTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/device-status.h>
+#include <dali/public-api/adaptor-framework/window-data.h>
#include <dali/public-api/adaptor-framework/window.h>
namespace Dali
static Application New(int* argc, char** argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize, bool useUiThread);
/**
+ * @brief This is the constructor for applications.
+ *
+ * @SINCE_2_2.23
+ * @PRIVLEVEL_PUBLIC
+ * @PRIVILEGE_DISPLAY
+ * @param[in,out] argc A pointer to the number of arguments
+ * @param[in,out] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] useUiThread True if the application would create a UI thread
+ * @param[in] windowData The window data for the application
+ * @return A handle to the Application
+ * @note If the stylesheet is not specified, then the library's default stylesheet will not be overridden.<BR>
+ * UI thread is an additional thread that DALi creates for UI events.
+ * The UI thread isn't blocked from the system events(AppControl, LanguageChanged, RegionChanged, LowMemory, LowBattery task signals).
+ */
+ static Application New(int* argc, char** argv[], const std::string& stylesheet, bool useUiThread, WindowData& windowData);
+
+ /**
* @brief Constructs an empty handle.
* @SINCE_1_0.0
*/
--- /dev/null
+/*
+ * Copyright (c) 2023 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 <dali/public-api/adaptor-framework/window-data.h>
+
+namespace Dali
+{
+struct WindowData::Impl
+{
+ Impl()
+ : mPositionSize(0, 0, 0, 0),
+ mIsTransparent(true),
+ mWindowType(WindowType::NORMAL)
+ {
+ }
+
+ Dali::Rect<int> mPositionSize; ///< The position and size of the Window
+ bool mIsTransparent; ///< The transparency of the Window
+ WindowType mWindowType; ///< The window type of the Window
+};
+
+WindowData::WindowData()
+: mImpl(std::make_unique<Impl>())
+{
+}
+
+WindowData::~WindowData() = default;
+
+void WindowData::SetPositionSize(Dali::Rect<int>& positionSize)
+{
+ mImpl->mPositionSize = positionSize;
+}
+
+Dali::Rect<int> WindowData::GetPositionSize() const
+{
+ return mImpl->mPositionSize;
+}
+
+void WindowData::SetTransparency(bool transparent)
+{
+ mImpl->mIsTransparent = transparent;
+}
+
+bool WindowData::GetTransparency() const
+{
+ return mImpl->mIsTransparent;
+}
+
+void WindowData::SetWindowType(WindowType type)
+{
+ mImpl->mWindowType = type;
+}
+
+WindowType WindowData::GetWindowType() const
+{
+ return mImpl->mWindowType;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_WINDOW_DATA_H
+#define DALI_WINDOW_DATA_H
+
+/*
+ * Copyright (c) 2023 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 <dali/public-api/adaptor-framework/window-enumerations.h>
+#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/public-api/math/rect.h>
+#include <memory>
+
+namespace Dali
+{
+/**
+ * The WindowData class is used as a parameter for the constructors of the Application class.
+ * The data from the WindowData object is used to customize the default window created by the Application class.
+ *
+ * The default values are below:
+ * PositionSize : x:0, y:0, w:0, h:0 (full-screen window)
+ * Transparency : true (Window is created with 32-bit color depth)
+ * WindowType : NORMAL
+ *
+ * If you want to customize the window, you can modify the values of the WindowData object as needed.
+ * @SINCE_2_2.23
+ */
+class DALI_ADAPTOR_API WindowData
+{
+public:
+ /**
+ * @brief Creates a WindowData object.
+ */
+ WindowData();
+
+ /**
+ * @brief Destructor.
+ */
+ ~WindowData();
+
+ /**
+ * @brief Sets the position and size
+ *
+ * @SINCE_2_2.23
+ * @param[in] positionSize Position and Size
+ */
+ void SetPositionSize(Dali::Rect<int>& positionSize);
+
+ /**
+ * @brief Gets the PositionSize
+ *
+ * @SINCE_2_2.23
+ * @return The position and size
+ */
+ Dali::Rect<int> GetPositionSize() const;
+
+ /**
+ * @brief Sets the transparency
+ *
+ * @SINCE_2_2.23
+ * @param[in] transparent transparency
+ */
+ void SetTransparency(bool transparent);
+
+ /**
+ * @brief Gets the transparency
+ *
+ * @SINCE_2_2.23
+ * @return whether transparency
+ */
+ bool GetTransparency() const;
+
+ /**
+ * @brief Sets the window type
+ *
+ * @SINCE_2_2.23
+ * @param[in] type the window type
+ */
+ void SetWindowType(WindowType type);
+
+ /**
+ * @brief Gets the window type
+ *
+ * @SINCE_2_2.23
+ * @return the window type
+ */
+ WindowType GetWindowType() const;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> mImpl;
+};
+
+} // namespace Dali
+
+#endif // DALI_WINDOW_DATA_H
${adaptor_public_api_dir}/adaptor-framework/widget-application.cpp
${adaptor_public_api_dir}/adaptor-framework/widget-impl.cpp
${adaptor_public_api_dir}/adaptor-framework/async-task-manager.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/window-data.cpp
${adaptor_public_api_dir}/capture/capture.cpp
${adaptor_public_api_dir}/dali-adaptor-version.cpp
)
${adaptor_public_api_dir}/adaptor-framework/window-enumerations.h
${adaptor_public_api_dir}/adaptor-framework/round-robin-container-view.h
${adaptor_public_api_dir}/adaptor-framework/async-task-manager.h
+ ${adaptor_public_api_dir}/adaptor-framework/window-data.h
)
SET( public_dali_capture_header_files