/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
return GetImplementation( window ).EventProcessingFinishedSignal();
}
-KeyEventSignalType& KeyEventSignal( Window window )
-{
- return GetImplementation( window ).KeyEventSignal();
-}
-
-TouchSignalType& TouchSignal( Window window )
-{
- return GetImplementation( window ).TouchSignal();
-}
-
WheelEventSignalType& WheelEventSignal( Window window )
{
return GetImplementation( window ).WheelEventSignal();
DALI_ADAPTOR_API EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window );
/**
- * @brief This signal is emitted when key event is received.
- *
- * A callback of the following type may be connected:
- * @code
- * void YourCallbackName(const KeyEvent& event);
- * @endcode
- * @param[in] window The window instance
- * @return The signal to connect to
- */
-DALI_ADAPTOR_API KeyEventSignalType& KeyEventSignal( Window window );
-
-/**
- * @brief This signal is emitted when the screen is touched and when the touch ends
- * (i.e. the down & up touch events only).
- *
- * If there are multiple touch points, then this will be emitted when the first touch occurs and
- * then when the last finger is lifted.
- * An interrupted event will also be emitted (if it occurs).
- * A callback of the following type may be connected:
- * @code
- * void YourCallbackName( TouchData event );
- * @endcode
- *
- * @param[in] window The window instance
- * @return The touch signal to connect to
- * @note Motion events are not emitted.
- */
-DALI_ADAPTOR_API TouchSignalType& TouchSignal( Window window );
-
-/**
* @brief This signal is emitted when wheel event is received.
*
* A callback of the following type may be connected:
// EXTERNAL INCLUDES
#include <sys/time.h>
+#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/layer.h>
#include <dali/integration-api/debug.h>
mId( mSceneHolderCounter++ ),
mSurface( nullptr ),
mAdaptor( nullptr ),
+ mDpi(),
mIsBeingDeleted( false ),
mAdaptorStarted( false ),
mVisible( true )
return mScene;
}
+Uint16Pair SceneHolder::GetDpi() const
+{
+ return mDpi;
+}
+
void SceneHolder::SetSurface(Dali::RenderSurfaceInterface* surface)
{
mSurface.reset( surface );
SurfaceResized();
- unsigned int dpiHorizontal, dpiVertical;
- dpiHorizontal = dpiVertical = 0;
-
- mSurface->GetDpi( dpiHorizontal, dpiVertical );
- mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+ InitializeDpi();
mSurface->SetAdaptor( *mAdaptor );
mSurface->SetScene( mScene );
return;
}
+ DALI_ASSERT_DEBUG(mSurface && "Surface needs to be set before calling this method\n");
+
mAdaptorStarted = true;
// Create the scene
// Create an observer for the adaptor lifecycle
mAdaptor->AddObserver( *mLifeCycleObserver );
- if ( mSurface )
- {
- unsigned int dpiHorizontal, dpiVertical;
- dpiHorizontal = dpiVertical = 0;
-
- mSurface->GetDpi( dpiHorizontal, dpiVertical );
- mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+ InitializeDpi();
- mSurface->SetAdaptor( *mAdaptor );
- mSurface->SetScene( mScene );
- }
+ mSurface->SetAdaptor( *mAdaptor );
+ mSurface->SetScene( mScene );
OnAdaptorSet( adaptor );
}
mAdaptor->ProcessCoreEvents();
}
+void SceneHolder::InitializeDpi()
+{
+ unsigned int dpiHorizontal, dpiVertical;
+ dpiHorizontal = dpiVertical = 0;
+
+ mSurface->GetDpi( dpiHorizontal, dpiVertical );
+ mScene.SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
+
+ mDpi.SetX( dpiHorizontal );
+ mDpi.SetY( dpiVertical );
+}
}// Adaptor
#define DALI_INTEGRATION_INTERNAL_SCENEHOLDER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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 <atomic>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/common/intrusive-ptr.h>
+#include <dali/public-api/math/uint-16-pair.h>
#include <dali/integration-api/scene.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/point.h>
Dali::Integration::Scene GetScene();
/**
+ * @brief Retrieves the DPI of this sceneholder.
+ * @return The DPI.
+ */
+ Uint16Pair GetDpi() const;
+
+ /**
* @brief Set the render surface
* @param[in] surface The render surface
*/
*/
void Reset();
+ /**
+ * Initializes the DPI for this object.
+ */
+ void InitializeDpi();
+
private:
static uint32_t mSceneHolderCounter; ///< A counter to track the SceneHolder creation
Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events.
+
+ Uint16Pair mDpi; ///< The DPI for this SceneHolder.
+
std::atomic<bool> mIsBeingDeleted; ///< This is set only from the event thread and read only from the render thread
bool mAdaptorStarted:1; ///< Whether the adaptor has started or not
return GetImplementation( *this ).GetLayer( depth );
}
+Uint16Pair Window::GetDpi() const
+{
+ return GetImplementation(*this).GetDpi();
+}
+
void Window::SetClass( std::string name, std::string klass )
{
GetImplementation(*this).SetClass( name, klass );
GetImplementation(*this).SetTransparency( transparent );
}
+Dali::RenderTaskList Window::GetRenderTaskList()
+{
+ return GetImplementation(*this).GetRenderTaskList();
+}
+
+Window::KeyEventSignalType& Window::KeyEventSignal()
+{
+ return GetImplementation(*this).KeyEventSignal();
+}
+
+Window::TouchSignalType& Window::TouchSignal()
+{
+ return GetImplementation(*this).TouchSignal();
+}
+
Window::Window( Internal::Adaptor::Window* window )
: BaseHandle( window )
{
class Orientation;
class Actor;
class Layer;
+class RenderTaskList;
+class TouchData;
+struct KeyEvent;
/**
* @brief The window class is used internally for drawing.
{
public:
- typedef Uint16Pair WindowSize; ///< Window size type @SINCE_1_2.60
- typedef Uint16Pair WindowPosition; ///< Window position type @SINCE_1_2.60
+ using WindowSize = Uint16Pair ; ///< Window size type @SINCE_1_2.60
+ using WindowPosition = Uint16Pair; ///< Window position type @SINCE_1_2.60
+
+ using ResizedSignalType = Signal< void (WindowSize) >; ///< @DEPRECATED_1_4.35 @brief Window resized signal type @SINCE_1_2.60
+ using FocusChangeSignalType = Signal< void (Window,bool) >; ///< Window focus signal type @SINCE_1_4.35
+ using ResizeSignalType = Signal< void (Window,WindowSize) >; ///< Window resized signal type @SINCE_1_4.35
+ using KeyEventSignalType = Signal< void (const KeyEvent&) >; ///< Key event signal type
+ using TouchSignalType = Signal< void (const TouchData&) >; ///< Touch signal type
- typedef Signal< void (WindowSize) > ResizedSignalType; ///< @DEPRECATED_1_4.35 @brief Window resized signal type @SINCE_1_2.60
- typedef Signal< void (Window,bool) > FocusChangeSignalType; ///< Window focus signal type @SINCE_1_4.35
- typedef Signal< void (Window,WindowSize) > ResizeSignalType; ///< Window resized signal type @SINCE_1_4.35
public:
// Enumerations
Layer GetLayer( uint32_t depth ) const;
/**
+ * @brief Retrieves the DPI of the window.
+ *
+ * @SINCE_1_9.21
+ * @return The DPI of the window
+ */
+ Uint16Pair GetDpi() const;
+
+ /**
* @brief Sets the window name and class string.
* @SINCE_1_0.0
* @param[in] name The name of the window
*/
void SetTransparency( bool transparent );
+ /**
+ * @brief Retrieves the list of render-tasks in the window.
+ *
+ * @SINCE_1_9.21
+ * @return A valid handle to a RenderTaskList
+ */
+ RenderTaskList GetRenderTaskList();
+
public: // Signals
/**
*/
ResizeSignalType& ResizeSignal();
+ /**
+ * @brief This signal is emitted when key event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const KeyEvent& event);
+ * @endcode
+ *
+ * @SINCE_1_9.21
+ * @return The signal to connect to
+ */
+ KeyEventSignalType& KeyEventSignal();
+
+ /**
+ * @brief This signal is emitted when the screen is touched and when the touch ends
+ * (i.e. the down & up touch events only).
+ *
+ * If there are multiple touch points, then this will be emitted when the first touch occurs and
+ * then when the last finger is lifted.
+ * An interrupted event will also be emitted (if it occurs).
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(const TouchData& event);
+ * @endcode
+ *
+ * @SINCE_1_9.21
+ * @return The touch signal to connect to
+ *
+ * @note Motion events are not emitted.
+ */
+ TouchSignalType& TouchSignal();
+
public: // Not intended for application developers
/// @cond internal
/**