Supporting Device orientation and Window Orienation event when device orientation is changed or window orientation is changed.
Window orientation event is emitted by display server.
To emit the Window Orientation event, AddAvailableOrientation() or SetPreferredOrientation() should be called before the device is rotated.
Otherwise, Device Orientation event is emitted by Application framework and any condition is not needed.
Change-Id: I78e8854e74810f31e7aa7403b8e913f50b67f3d2
{
}
+void OnDeviceOrientationChangedSignalCallback(DeviceStatus::Orientation::Status status)
+{
+}
+
int UtcDaliApplicationNew01(void)
{
Application application = Application::New();
END_TEST;
}
+int UtcDaliApplicationOrientationChangedSignalP(void)
+{
+ Application application = Application::New();
+ application.DeviceOrientationChangedSignal().Connect(&OnDeviceOrientationChangedSignalCallback);
+ DALI_TEST_CHECK(application);
+
+ END_TEST;
+}
+
+int UtcDaliApplicationOrientationChangedSignalN(void)
+{
+ Application application;
+
+ try
+ {
+ application.DeviceOrientationChangedSignal().Connect(&OnDeviceOrientationChangedSignalCallback);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true);
+ }
+
+ END_TEST;
+}
+
int UtcDaliApplicationGetResourcePathP(void)
{
Application application = Application::New();
{
try
{
- Dali::Window instance;
+ Dali::Window instance;
DevelWindow::Maximize(instance, true);
DALI_TEST_CHECK(false); // Should not reach here!
}
{
try
{
- Dali::Window instance;
+ Dali::Window instance;
DevelWindow::IsMaximized(instance);
DALI_TEST_CHECK(false); // Should not reach here!
}
{
try
{
- Dali::Window instance;
+ Dali::Window instance;
Dali::Window::WindowSize size(100, 100);
DevelWindow::SetMaximumSize(instance, size);
DALI_TEST_CHECK(false); // Should not reach here!
{
try
{
- Dali::Window instance;
+ Dali::Window instance;
DevelWindow::Minimize(instance, true);
DALI_TEST_CHECK(false); // Should not reach here!
}
{
try
{
- Dali::Window instance;
+ Dali::Window instance;
DevelWindow::IsMinimized(instance);
DALI_TEST_CHECK(false); // Should not reach here!
}
{
try
{
- Dali::Window instance;
+ Dali::Window instance;
Dali::Window::WindowSize size(100, 100);
DevelWindow::SetMimimumSize(instance, size);
DALI_TEST_CHECK(false); // Should not reach here!
Dali::Window instance;
try
{
- Rect<int> includedInputRegion(0,0,720,640);
+ Rect<int> includedInputRegion(0, 0, 720, 640);
DevelWindow::IncludeInputRegion(instance, includedInputRegion);
DALI_TEST_CHECK(false); // Should not get here
}
Dali::Window instance;
try
{
- Rect<int> includedInputRegion(0,0,720,1280);
+ Rect<int> includedInputRegion(0, 0, 720, 1280);
DevelWindow::IncludeInputRegion(instance, includedInputRegion);
- Rect<int> excludedInputRegion(0,641,720,640);
+ Rect<int> excludedInputRegion(0, 641, 720, 640);
DevelWindow::ExcludeInputRegion(instance, excludedInputRegion);
DALI_TEST_CHECK(false); // Should not get here
END_TEST;
}
-
int UtcDaliWindowSetNeedsRotationCompletedAcknowledgementNegative(void)
{
try
}
END_TEST;
}
+
+int UtcDaliWindowMovedSignalNegative(void)
+{
+ Dali::Window instance;
+ try
+ {
+ DevelWindow::MovedSignal(instance);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
+
+int UtcDaliWindowOrientationChangedSignalNegative(void)
+{
+ Dali::Window instance;
+ try
+ {
+ DevelWindow::OrientationChangedSignal(instance);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
return GetImplementation(window).MovedSignal();
}
+OrientationChangedSignalType& OrientationChangedSignal(Window window)
+{
+ return GetImplementation(window).OrientationChangedSignal();
+}
+
void SetParent(Window window, Window parent)
{
GetImplementation(window).SetParent(parent);
typedef Signal<void(Window, bool)> AccessibilityHighlightSignalType; ///< Accessibility Highlight signal type
typedef Signal<bool(const KeyEvent&)> InterceptKeyEventSignalType; ///< Intercept Key event signal type
typedef Signal<void(Window, Dali::Window::WindowPosition)> MovedSignalType; ///< Window Moved signal type
+typedef Signal<void(Window, Dali::WindowOrientation)> OrientationChangedSignalType; ///< Window orientation changed signal type
/**
* @brief Creates an initialized handle to a new Window.
* @param[in] isTransparent Whether Window is transparent
* @return A new window
* @note This creates an extra window in addition to the default main window
-*/
+ */
DALI_ADAPTOR_API Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent = false);
/**
*/
DALI_ADAPTOR_API MovedSignalType& MovedSignal(Window window);
+/**
+ * @brief This signal is emitted when the window orientation is changed.
+ *
+ * To emit Window Orientation signal, AddAvailableOrientation() or SetPreferredOrientation() should be called before device is rotated.
+ * Most of cases, AddAvailableOrientation() or SetPreferredOrientation() is callled in onCreate().
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( Window window, Dali::WindowOrientation orientation );
+ * @endcode
+ * The parameter is the changed window orientation.
+ * and window means this signal was called from what window
+ *
+ * @param[in] window The window instance.
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API OrientationChangedSignalType& OrientationChangedSignal(Window window);
+
} // namespace DevelWindow
} // namespace Dali
mLowMemorySignal.Emit(status);
}
+void Application::OnDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status)
+{
+ Dali::Application application(this);
+ mDeviceOrientationChangedSignal.Emit(status);
+}
+
void Application::OnSurfaceCreated(Any newSurface)
{
void* newWindow = AnyCast<void*>(newSurface);
mTaskLowMemorySignal.Emit(status);
}
+void Application::OnTaskDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status)
+{
+ Dali::Application application(this);
+ mTaskDeviceOrientationChangedSignal.Emit(status);
+}
+
bool Application::AddIdle(CallbackBase* callback, bool hasReturnValue)
{
return mAdaptor->AddIdle(callback, hasReturnValue);
class Application : public BaseObject, public Framework::Observer, public Framework::TaskObserver
{
public:
- typedef Dali::Application::LowBatterySignalType LowBatterySignalType;
- typedef Dali::Application::LowMemorySignalType LowMemorySignalType;
- typedef Dali::Application::AppSignalType AppSignalType;
- typedef Dali::Application::AppControlSignalType AppControlSignalType;
- typedef Dali::Application::WINDOW_MODE WINDOW_MODE;
+ typedef Dali::Application::LowBatterySignalType LowBatterySignalType;
+ typedef Dali::Application::LowMemorySignalType LowMemorySignalType;
+ typedef Dali::Application::DeviceOrientationChangedSignalType DeviceOrientationChangedSignalType;
+ typedef Dali::Application::AppSignalType AppSignalType;
+ typedef Dali::Application::AppControlSignalType AppControlSignalType;
+ typedef Dali::Application::WINDOW_MODE WINDOW_MODE;
/**
* Create a new application
void OnMemoryLow(Dali::DeviceStatus::Memory::Status status) override;
/**
+ * Called when the framework informs the application that device orientation is changed.
+ */
+ void OnDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status) override;
+
+ /**
* Called when the framework informs the application that the platform surface is created.
*/
void OnSurfaceCreated(Any newSurface) override;
*/
void OnTaskMemoryLow(Dali::DeviceStatus::Memory::Status status) override;
+ /**
+ * Called when the framework informs the application that the device orientation is changed.
+ *
+ * Device orientation changed event is from Application Framework(Sensor Framework), it means it is system event.
+ * If UIThreading is enable, DALI application has the main thread and UI thread.
+ * This event is emitted in main thread, then it is posted to the UI thread in this callback function.
+ */
+ void OnTaskDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status) override;
+
public:
/**
* Sets a user defined theme file.
}
/**
+ * @copydoc Dali::Application:::DeviceOrientationChangedSignalType()
+ */
+ Dali::Application::DeviceOrientationChangedSignalType& DeviceOrientationChangedSignal()
+ {
+ return mDeviceOrientationChangedSignal;
+ }
+
+ /**
* @copydoc Dali::Application::TaskInitSignal()
*/
Dali::Application::AppSignalType& TaskInitSignal()
return mTaskLowMemorySignal;
}
+ /**
+ * @copydoc Dali::Application::TaskDeviceOrientationChangedSignal()
+ */
+ Dali::Application::DeviceOrientationChangedSignalType& TaskDeviceOrientationChangedSignal()
+ {
+ return mTaskDeviceOrientationChangedSignal;
+ }
+
protected:
/**
* Private Constructor
void ChangePreInitializedWindowSize();
private:
- AppSignalType mInitSignal;
- AppSignalType mTerminateSignal;
- AppSignalType mPauseSignal;
- AppSignalType mResumeSignal;
- AppSignalType mResetSignal;
- AppControlSignalType mAppControlSignal;
- AppSignalType mLanguageChangedSignal;
- AppSignalType mRegionChangedSignal;
- LowBatterySignalType mLowBatterySignal;
- LowMemorySignalType mLowMemorySignal;
-
- AppSignalType mTaskInitSignal;
- AppSignalType mTaskTerminateSignal;
- AppControlSignalType mTaskAppControlSignal;
- AppSignalType mTaskLanguageChangedSignal;
- AppSignalType mTaskRegionChangedSignal;
- LowBatterySignalType mTaskLowBatterySignal;
- LowMemorySignalType mTaskLowMemorySignal;
+ AppSignalType mInitSignal;
+ AppSignalType mTerminateSignal;
+ AppSignalType mPauseSignal;
+ AppSignalType mResumeSignal;
+ AppSignalType mResetSignal;
+ AppControlSignalType mAppControlSignal;
+ AppSignalType mLanguageChangedSignal;
+ AppSignalType mRegionChangedSignal;
+ LowBatterySignalType mLowBatterySignal;
+ LowMemorySignalType mLowMemorySignal;
+ DeviceOrientationChangedSignalType mDeviceOrientationChangedSignal;
+
+ AppSignalType mTaskInitSignal;
+ AppSignalType mTaskTerminateSignal;
+ AppControlSignalType mTaskAppControlSignal;
+ AppSignalType mTaskLanguageChangedSignal;
+ AppSignalType mTaskRegionChangedSignal;
+ LowBatterySignalType mTaskLowBatterySignal;
+ LowMemorySignalType mTaskLowMemorySignal;
+ DeviceOrientationChangedSignalType mTaskDeviceOrientationChangedSignal;
EventLoop* mEventLoop;
Framework* mFramework;
}
/**
+ * Invoked when the device orientation is changed.
+ */
+ virtual void OnDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status)
+ {
+ }
+
+ /**
* Invoked when the platform surface is created.
*/
virtual void OnSurfaceCreated(Any newSurface)
virtual void OnTaskMemoryLow(Dali::DeviceStatus::Memory::Status status)
{
}
+
+ /**
+ * Invoked when the device orientation is changed.
+ *
+ * Device orientation changed event is from Application Framework(Sensor Framework), it means it is system event.
+ * If UIThreading is enable, DALI application has the main thread and UI thread.
+ * This event is emitted in main thread, then it is posted to the UI thread in this callback function.
+ */
+ virtual void OnTaskDeviceOrientationChanged(Dali::DeviceStatus::Orientation::Status status)
+ {
+ }
};
public:
}
}
+DeviceStatus::Orientation::Status GetOrientationStatus(app_device_orientation_e orientationStatus)
+{
+ switch(orientationStatus)
+ {
+ case APP_DEVICE_ORIENTATION_0:
+ {
+ return Dali::DeviceStatus::Orientation::Status::ORIENTATION_0;
+ }
+ case APP_DEVICE_ORIENTATION_90:
+ {
+ return Dali::DeviceStatus::Orientation::Status::ORIENTATION_90;
+ }
+ case APP_DEVICE_ORIENTATION_180:
+ {
+ return Dali::DeviceStatus::Orientation::Status::ORIENTATION_180;
+ }
+ case APP_DEVICE_ORIENTATION_270:
+ {
+ return Dali::DeviceStatus::Orientation::Status::ORIENTATION_270;
+ }
+ default:
+ {
+ return Dali::DeviceStatus::Orientation::Status::ORIENTATION_0;
+ }
+ }
+}
+
} // namespace AppCore
/**
explicit Task(Framework* framework)
: mFramework(framework),
mNewBatteryStatus(Dali::DeviceStatus::Battery::Status::NORMAL),
- mNewMemoryStatus(Dali::DeviceStatus::Memory::NORMAL)
+ mNewMemoryStatus(Dali::DeviceStatus::Memory::NORMAL),
+ mNewDeviceOrientationStatus(Dali::DeviceStatus::Orientation::ORIENTATION_0)
{
}
mNewMemoryStatus = AppCore::GetMemoryStatus(static_cast<app_event_low_memory_status_e>(state));
PostToUiThread(
- [](gpointer userData) -> gboolean {
+ [](gpointer userData) -> gboolean
+ {
auto* task = static_cast<Task*>(userData);
auto* framework = static_cast<Framework*>(task->mFramework);
framework->mObserver.OnMemoryLow(task->mNewMemoryStatus);
AppCoreTaskBase::OnLowMemory(state);
}
+ void OnDeviceOrientationChanged(AppCoreTaskBase::DeviceOrientationState state) override
+ {
+ print_log(DLOG_INFO, "DALI", "%s: %s(%d) > OnDeviceOrientationChanged() emitted, orientation :%d", __MODULE__, __func__, __LINE__, state);
+
+ mNewDeviceOrientationStatus = AppCore::GetOrientationStatus(static_cast<app_device_orientation_e>(state));
+
+ PostToUiThread(
+ [](gpointer userData) -> gboolean
+ {
+ auto* task = static_cast<Task*>(userData);
+ auto* framework = static_cast<Framework*>(task->mFramework);
+ framework->mObserver.OnDeviceOrientationChanged(task->mNewDeviceOrientationStatus);
+ return G_SOURCE_REMOVE;
+ });
+
+ mFramework->mTaskObserver.OnTaskDeviceOrientationChanged(mNewDeviceOrientationStatus);
+
+ AppCoreTaskBase::OnDeviceOrientationChanged(state);
+ }
void OnLowBattery(AppCoreTaskBase::LowBatteryState state) override
{
print_log(DLOG_INFO, "DALI", "%s: %s(%d) > OnLowBattery() emitted", __MODULE__, __func__, __LINE__);
mNewBatteryStatus = AppCore::GetBatteryStatus(static_cast<app_event_low_battery_status_e>(state));
PostToUiThread(
- [](gpointer userData) -> gboolean {
+ [](gpointer userData) -> gboolean
+ {
auto* task = static_cast<Task*>(userData);
auto* framework = static_cast<Framework*>(task->mFramework);
framework->mObserver.OnBatteryLow(task->mNewBatteryStatus);
mFramework->SetLanguage(mNewLanguage);
PostToUiThread(
- [](gpointer userData) -> gboolean {
+ [](gpointer userData) -> gboolean
+ {
auto* task = static_cast<Task*>(userData);
auto* framework = static_cast<Framework*>(task->mFramework);
framework->mObserver.OnLanguageChanged();
mFramework->SetRegion(mNewRegion);
PostToUiThread(
- [](gpointer userData) -> gboolean {
+ [](gpointer userData) -> gboolean
+ {
auto* task = static_cast<Task*>(userData);
auto* framework = static_cast<Framework*>(task->mFramework);
framework->mObserver.OnRegionChanged();
AppCoreTaskBase::OnRegionChanged(mNewRegion);
}
- void OnDeviceOrientationChanged(AppCoreTaskBase::DeviceOrientationState state) override
- {
- print_log(DLOG_INFO, "DALI", "%s: %s(%d) > OnDeviceOrientationChanged() emitted", __MODULE__, __func__, __LINE__);
- // Note: This isn't emitted to the App.
- AppCoreTaskBase::OnDeviceOrientationChanged(state);
- }
-
private:
GMainContext* GetTizenGlibContext()
{
}
private:
- Framework* mFramework;
- std::string mNewLanguage;
- std::string mNewRegion;
- Dali::DeviceStatus::Battery::Status mNewBatteryStatus;
- Dali::DeviceStatus::Memory::Status mNewMemoryStatus;
+ Framework* mFramework;
+ std::string mNewLanguage;
+ std::string mNewRegion;
+ Dali::DeviceStatus::Battery::Status mNewBatteryStatus;
+ Dali::DeviceStatus::Memory::Status mNewMemoryStatus;
+ Dali::DeviceStatus::Orientation::Status mNewDeviceOrientationStatus;
};
explicit UiAppContext(unsigned int hint, Framework* framework)
}
}
- static void OnDeviceOrientationChanged(app_event_info_h event_info, void* user_data)
- {
- }
-
static void OnRegionFormatChanged(app_event_info_h event_info, void* user_data)
{
auto* context = static_cast<UiAppContext*>(user_data);
observer->OnMemoryLow(result);
}
+ static void OnDeviceOrientationChanged(app_event_info_h event_info, void* user_data)
+ {
+ auto* context = static_cast<UiAppContext*>(user_data);
+ auto* framework = context->mFramework;
+ Observer* observer = &framework->mObserver;
+
+ app_device_orientation_e status;
+ app_event_get_device_orientation(event_info, &status);
+ Dali::DeviceStatus::Orientation::Status result = AppCore::GetOrientationStatus(status);
+ observer->OnDeviceOrientationChanged(result);
+ }
+
void ProcessBundle(Framework* framework, bundle* bundleData)
{
if(bundleData == nullptr)
}
}
- static void AppDeviceRotated(AppCore::AppEventInfoPtr event_info, void* data)
- {
- }
-
static void AppRegionChanged(AppCore::AppEventInfoPtr event, void* data)
{
Framework* framework = static_cast<Framework*>(data);
{
Observer* observer = &static_cast<Framework*>(data)->mObserver;
int status = *static_cast<int*>(event->value);
- Dali::DeviceStatus::Battery::Status result = Dali::DeviceStatus::Battery::NORMAL;
+ Dali::DeviceStatus::Battery::Status result = Dali::DeviceStatus::Battery::Status::NORMAL;
// convert to dali battery status
switch(status)
{
Observer* observer = &static_cast<Framework*>(data)->mObserver;
int status = *static_cast<int*>(event->value);
- Dali::DeviceStatus::Memory::Status result = Dali::DeviceStatus::Memory::NORMAL;
+ Dali::DeviceStatus::Memory::Status result = Dali::DeviceStatus::Memory::Status::NORMAL;
// convert to dali memmory status
switch(status)
observer->OnMemoryLow(result);
}
+ static void AppDeviceOrientationChanged(AppCore::AppEventInfoPtr event, void* data)
+ {
+ Observer* observer = &static_cast<Framework*>(data)->mObserver;
+ int status = *static_cast<int*>(event->value);
+ Dali::DeviceStatus::Orientation::Status result = Dali::DeviceStatus::Orientation::Status::ORIENTATION_0;
+
+ switch(status)
+ {
+ case APP_DEVICE_ORIENTATION_0:
+ {
+ result = Dali::DeviceStatus::Orientation::Status::ORIENTATION_0;
+ break;
+ }
+ case APP_DEVICE_ORIENTATION_90:
+ {
+ result = Dali::DeviceStatus::Orientation::Status::ORIENTATION_90;
+ break;
+ }
+ case APP_DEVICE_ORIENTATION_180:
+ {
+ result = Dali::DeviceStatus::Orientation::Status::ORIENTATION_180;
+ break;
+ }
+ case APP_DEVICE_ORIENTATION_270:
+ {
+ result = Dali::DeviceStatus::Orientation::Status::ORIENTATION_270;
+ break;
+ }
+
+ default:
+ break;
+ }
+ observer->OnDeviceOrientationChanged(result);
+ }
+
int AppNormalMain()
{
if(mUiAppContext.get() == nullptr)
AppCore::AppAddEventHandler(&handlers[AppCore::LOW_BATTERY], AppCore::LOW_BATTERY, AppBatteryLow, mFramework);
AppCore::AppAddEventHandler(&handlers[AppCore::LOW_MEMORY], AppCore::LOW_MEMORY, AppMemoryLow, mFramework);
- AppCore::AppAddEventHandler(&handlers[AppCore::DEVICE_ORIENTATION_CHANGED], AppCore::DEVICE_ORIENTATION_CHANGED, AppDeviceRotated, mFramework);
+ AppCore::AppAddEventHandler(&handlers[AppCore::DEVICE_ORIENTATION_CHANGED], AppCore::DEVICE_ORIENTATION_CHANGED, AppDeviceOrientationChanged, mFramework);
AppCore::AppAddEventHandler(&handlers[AppCore::LANGUAGE_CHANGED], AppCore::LANGUAGE_CHANGED, AppLanguageChanged, mFramework);
AppCore::AppAddEventHandler(&handlers[AppCore::REGION_FORMAT_CHANGED], AppCore::REGION_FORMAT_CHANGED, AppRegionChanged, mFramework);
mKeyboardRepeatSettingsChangedSignal(),
mAuxiliaryMessageSignal(),
mMovedSignal(),
+ mOrientationChangedSignal(),
mLastKeyEvent(),
mLastTouchEvent(),
mIsTransparent(false),
Dali::Window handle(this);
mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
+ mOrientationChangedSignal.Emit(handle, GetCurrentOrientation());
mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
}
typedef Dali::DevelWindow::AuxiliaryMessageSignalType AuxiliaryMessageSignalType;
typedef Dali::DevelWindow::AccessibilityHighlightSignalType AccessibilityHighlightSignalType;
typedef Dali::DevelWindow::MovedSignalType MovedSignalType;
+ typedef Dali::DevelWindow::OrientationChangedSignalType OrientationChangedSignalType;
typedef Signal<void()> SignalType;
/**
return mMovedSignal;
}
+ /**
+ * @copydoc Dali::DevelWindow::OrientationChangedSignal()
+ */
+ OrientationChangedSignalType& OrientationChangedSignal()
+ {
+ return mOrientationChangedSignal;
+ }
+
private:
WindowRenderSurface* mWindowSurface; ///< The window rendering surface
WindowBase* mWindowBase;
AuxiliaryMessageSignalType mAuxiliaryMessageSignal;
AccessibilityHighlightSignalType mAccessibilityHighlightSignal;
MovedSignalType mMovedSignal;
+ OrientationChangedSignalType mOrientationChangedSignal;
Dali::KeyEvent mLastKeyEvent;
Dali::TouchEvent mLastTouchEvent;
return Internal::Adaptor::GetImplementation(*this).LowMemorySignal();
}
+Application::DeviceOrientationChangedSignalType& Application::DeviceOrientationChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).DeviceOrientationChangedSignal();
+}
+
Application::AppSignalType& Application::TaskInitSignal()
{
return Internal::Adaptor::GetImplementation(*this).TaskInitSignal();
return Internal::Adaptor::GetImplementation(*this).TaskLowMemorySignal();
}
+Application::DeviceOrientationChangedSignalType& Application::TaskDeviceOrientationChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).TaskDeviceOrientationChangedSignal();
+}
+
Application::Application(Internal::Adaptor::Application* application)
: BaseHandle(application)
{
class DALI_ADAPTOR_API Application : public BaseHandle
{
public:
- typedef Signal<void(DeviceStatus::Battery::Status)> LowBatterySignalType; ///< Application device signal type @SINCE_1_2.62
- typedef Signal<void(DeviceStatus::Memory::Status)> LowMemorySignalType; ///< Application device signal type @SINCE_1_2.62
- typedef Signal<void(Application&)> AppSignalType; ///< Application lifecycle signal and system signal callback type @SINCE_1_0.0
- typedef Signal<void(Application&, void*)> AppControlSignalType; ///< Application control signal callback type @SINCE_1_0.0
+ typedef Signal<void(DeviceStatus::Battery::Status)> LowBatterySignalType; ///< Application device signal type @SINCE_1_2.62
+ typedef Signal<void(DeviceStatus::Memory::Status)> LowMemorySignalType; ///< Application device signal type @SINCE_1_2.62
+ typedef Signal<void(DeviceStatus::Orientation::Status)> DeviceOrientationChangedSignalType; ///< Application device orientation changed signal type @SINCE_2_2.1
+ typedef Signal<void(Application&)> AppSignalType; ///< Application lifecycle signal and system signal callback type @SINCE_1_0.0
+ typedef Signal<void(Application&, void*)> AppControlSignalType; ///< Application control signal callback type @SINCE_1_0.0
/**
* @brief Enumeration for deciding whether a Dali application window is opaque or transparent.
/**
* @brief The user should connect to this signal to determine when they should initialize
* their application.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief The user should connect to this signal to determine when they should terminate
* their application.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief The user should connect to this signal if they need to perform any special
* activities when the application is about to be paused.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief The user should connect to this signal if they need to perform any special
* activities when the application has resumed.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief This signal is sent when the system requires the user to reinitialize itself.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
*
* When the application is launched, this signal is emitted after the main loop of the application starts up.
* The passed parameter describes the launch request and contains the information about why the application is launched.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief This signal is emitted when the language is changed on the device.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief This signal is emitted when the region of the device is changed.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_0.0
* @return The signal to connect to
/**
* @brief This signal is emitted when the battery level of the device is low.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_2.62
* @return The signal to connect to
/**
* @brief This signal is emitted when the memory level of the device is low.
- * Only when the user uses the UiThread, this signal is emitted on the UI thread.
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
* Otherwise, it is emitted on the main thread.
* @SINCE_1_2.62
* @return The signal to connect to
*/
LowMemorySignalType& LowMemorySignal();
+ /**
+ * @brief This signal is emitted when the device orientation is changed
+ * Only when the user uses the UI thread, this signal is emitted on the UI thread.
+ * Otherwise, it is emitted on the main thread.
+ *
+ * This signal is only used in Application, it is different to Window's orientation signal.
+ * @SINCE_2_2.1
+ * @return The signal to connect to
+ */
+ DeviceOrientationChangedSignalType& DeviceOrientationChangedSignal();
+
// TaskSignal
/**
* @brief The user should connect to this signal to determine when they should initialize
* their application.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
* @return The signal to connect to
*/
/**
* @brief The user should connect to this signal to determine when they should terminate
* their application.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
* @return The signal to connect to
*/
*
* When the application is launched, this signal is emitted after the main loop of the application starts up.
* The passed parameter describes the launch request and contains the information about why the application is launched.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
* @return The signal to connect to
*/
/**
* @brief This signal is emitted when the language is changed on the device.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
* @return The signal to connect to
*/
/**
* @brief This signal is emitted when the region of the device is changed.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
* @return The signal to connect to
*/
/**
* @brief This signal is emitted when the battery level of the device is low.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
* @return The signal to connect to
*/
/**
* @brief This signal is emitted when the memory level of the device is low.
- * Only when the user uses the UiThread, this signal is emitted on the main thread.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
+ * Otherwise, it is not emitted at all.
+ * @return The signal to connect to
+ */
+ LowMemorySignalType& TaskLowMemorySignal();
+
+ /**
+ * @brief This signal is emitted when the device orientation is changed.
+ * Only when the user uses the UI thread, this signal is emitted on the main thread.
* Otherwise, it is not emitted at all.
+ * @SINCE_2_2.1
* @return The signal to connect to
*/
- LowMemorySignalType& TaskLowMemorySignal();
+ DeviceOrientationChangedSignalType& TaskDeviceOrientationChangedSignal();
public: // Not intended for application developers
/// @cond internal
};
};
+/**
+ * @brief Struct for orientation of the device.
+ * @SINCE_2_2.1
+ */
+struct Orientation
+{
+ /**
+ * @brief Enumeration for orientation status.
+ * @SINCE_2_2.1
+ */
+ enum Status
+ {
+ ORIENTATION_0 = 0, ///< The device is oriented in a natural position @SINCE_2_2.1
+ ORIENTATION_90 = 90, ///< The device's left side is at the top @SINCE_2_2.1
+ ORIENTATION_180 = 180, ///< The device is upside down @SINCE_2_2.1
+ ORIENTATION_270 = 270 ///< The device's right side is at the top @SINCE_2_2.1
+ };
+};
+
} // namespace DeviceStatus
/**