X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fstage-impl.h;h=4ce80b02f66a38ba0f2f92d1636ac743e41be21b;hb=18d0590e199b1bd47d5335eb9f196ec268b91466;hp=b276cc4e809ac9359784145194236f28f1ed51c4;hpb=ce20e9f082e811130930d13c9e9edc1da4ce1013;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/stage-impl.h b/dali/internal/event/common/stage-impl.h index b276cc4..4ce80b0 100644 --- a/dali/internal/event/common/stage-impl.h +++ b/dali/internal/event/common/stage-impl.h @@ -1,36 +1,40 @@ -#ifndef __DALI_INTERNAL_STAGE_H__ -#define __DALI_INTERNAL_STAGE_H__ - -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.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://floralicense.org/license/ -// -// 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. -// +#ifndef DALI_INTERNAL_STAGE_H +#define DALI_INTERNAL_STAGE_H + +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // INTERNAL INCLUDES +#include #include -#include #include +#include +#include +#include +#include +#include #include #include +#include #include #include -#include #include #include -#include -#include -#include +#include namespace Dali { @@ -39,8 +43,7 @@ struct Vector2; namespace Integration { -class SystemOverlay; -class DynamicsFactory; +class RenderController; } namespace Internal @@ -55,42 +58,32 @@ class AnimationPlaylist; class PropertyNotificationManager; class Layer; class LayerList; -class SystemOverlay; class CameraActor; class RenderTaskList; +class Scene; /** * Implementation of Stage */ -class Stage : public BaseObject, public RenderTaskDefaults +class Stage : public BaseObject, public RenderTaskDefaults, public Integration::ContextNotifierInterface, public ConnectionTracker { public: /** * Create the stage - * @param playlist for animations - * @param dynamicsNotifier - * @param updateManager - * @param notificationManager + * @param[in] updateManager */ - static StagePtr New( AnimationPlaylist& playlist, - PropertyNotificationManager& propertyNotificationManager, - DynamicsNotifier& dynamicsNotifier, - SceneGraph::UpdateManager& updateManager, - NotificationManager& notificationManager ); + static StagePtr New( SceneGraph::UpdateManager& updateManager ); /** * Initialize the stage. + * @param[in] scene The default scene (for main window). */ - void Initialize(); - - /** - * Uninitialize the stage. - */ - void Uninitialize(); + void Initialize( Scene& scene ); /** * @copydoc Dali::Stage::GetCurrent() + * @note this version is for internal usage so it does not assert */ static StagePtr GetCurrent(); @@ -110,46 +103,6 @@ public: */ Layer& GetRootActor(); - /** - * Retrieve the UpdateManager associated with this Stage - * @return The UpdateManager. - */ - SceneGraph::UpdateManager& GetUpdateManager(); - - /** - * Helper for actors, to retrieve the current Event buffer index. - * @return The buffer index. - */ - BufferIndex GetEventBufferIndex() const - { - // inlined as its called often from event thread - return mUpdateManager.GetEventBufferIndex(); - } - - /** - * Retrieve the interface for accessing update-thread data. - * @return The EventToUpdate interface. - */ - EventToUpdate& GetUpdateInterface(); - - /** - * Returns the animation playlist. - * @return reference to the animation playlist. - */ - AnimationPlaylist& GetAnimationPlaylist(); - - /** - * Returns the property notification manager. - * @return reference to the property notification manager. - */ - PropertyNotificationManager& GetPropertyNotificationManager(); - - /** - * Return the Dynamics Simulation Notifier object - * @return The Dynamics Simulation Notifier object - */ - DynamicsNotifier& GetDynamicsNotifier(); - // Root actor accessors /** @@ -163,13 +116,6 @@ public: void Remove( Actor& actor ); /** - * Sets the size of the stage and indirectly, the root actor. - * @param [in] width The new width. - * @param [in] height The new height. - */ - void SetSize( float width, float height ); - - /** * Returns the size of the Stage in pixels as a Vector. * The x component will be the width of the Stage in pixels * The y component will be the height of the Stage in pixels @@ -183,11 +129,6 @@ public: RenderTaskList& GetRenderTaskList() const; /** - * Create a default camera actor - */ - void CreateDefaultCameraActor(); - - /** * From RenderTaskDefaults; retrieve the default root actor. * @return The default root actor. */ @@ -204,12 +145,12 @@ public: /** * @copydoc Dali::Stage::GetLayerCount() */ - unsigned int GetLayerCount() const; + uint32_t GetLayerCount() const; /** * @copydoc Dali::Stage::GetLayer() */ - Dali::Layer GetLayer( unsigned int depth ) const; + Dali::Layer GetLayer( uint32_t depth ) const; /** * @copydoc Dali::Stage::GetRootLayer() @@ -222,40 +163,6 @@ public: */ LayerList& GetLayerList(); - // System-level overlay actors - - /** - * @copydoc Dali::Integration::Core::GetSystemOverlay() - */ - Integration::SystemOverlay& GetSystemOverlay(); - - /** - * Retrieve the internal implementation of the SystemOverlay. - * @return The implementation, or NULL if this has never been requested from Integration API. - */ - SystemOverlay* GetSystemOverlayInternal(); - - // Keyboard stuff - - /** - * As one virtual keyboard per stage, the stage will hold a pointer to the Actor currently - * set to receive keyboard input. - * @param[in] actor to receive keyboard input - */ - void SetKeyboardFocusActor( Actor* actor ); - - /** - * Get the actor that is currently set to receive keyboard inputs - * @return Pointer to the actor set to receive keyboard inputs. - */ - Actor* GetKeyboardFocusActor() const; - - /** - * Removes the given actor from keyboard focus so it will no longer receive key events from keyboard. - * @param [in] actor which should be removed from focus. - */ - void RemoveActorFromKeyFocus( Actor* actor ); - // Misc /** @@ -274,35 +181,39 @@ public: Vector2 GetDpi() const; /** - * Sets horizontal and vertical pixels per inch value that is used by the display - * @param[in] dpi Horizontal and vertical dpi value + * @copydoc Dali::Stage::KeepRendering() + */ + void KeepRendering( float durationSeconds ); + + /** + * @copydoc Dali::DevelStage::SetRenderingBehavior() */ - void SetDpi( Vector2 dpi ); + void SetRenderingBehavior( DevelStage::Rendering renderingBehavior ); /** - * @copydoc Dali::Stage::InitializeDynamics + * @copydoc Dali::DevelStage::GetRenderingBehavior() */ - DynamicsWorldPtr InitializeDynamics(DynamicsWorldConfigPtr config); + DevelStage::Rendering GetRenderingBehavior() const; /** - * @copydoc Dali::Stage::GetDynamicsWorld + * Callback for Internal::Scene EventProcessingFinished signal */ - DynamicsWorldPtr GetDynamicsWorld(); + void OnEventProcessingFinished(); /** - * @copydoc Dali::Stage::TerminateDynamics + * Callback for Internal::Scene KeyEventSignal signal */ - void TerminateDynamics(); + void OnKeyEvent( const Dali::KeyEvent& event ); - NotificationManager& GetNotificationManager() - { - return mNotificationManager; - } + /** + * Callback for Internal::Scene TouchSignal signal + */ + void OnTouchEvent( const Dali::TouchEvent& touch ); /** - * @copydoc Dali::Stage::KeepRendering() + * Callback for Internal::Scene WheelEventSignal signal */ - void KeepRendering( float durationSeconds ); + void OnWheelEvent( const Dali::WheelEvent& event ); /** * Used by the EventProcessor to emit key event signals. @@ -311,6 +222,13 @@ public: void EmitKeyEventSignal(const KeyEvent& event); /** + * Used by the KeyEventProcessor to emit KeyEventGenerated signals. + * @param[in] event The key event. + * @return The return is true if KeyEvent is consumed, otherwise false. + */ + bool EmitKeyEventGeneratedSignal(const KeyEvent& event); + + /** * Emits the event processing finished signal. * * @see Dali::Stage::SignalEventProcessingFinished() @@ -321,87 +239,129 @@ public: * Emits the touched signal. * @param[in] touch The touch event details. */ - void EmitTouchedSignal( const TouchEvent& touch ); + void EmitTouchedSignal( const Dali::TouchEvent& touch ); + + /** + * Used by the EventProcessor to emit wheel event signals. + * @param[in] event The wheel event. + */ + void EmitWheelEventSignal( const WheelEvent& event ); + + /** + * Emits the scene created. + */ + void EmitSceneCreatedSignal(); /** * @copydoc Dali::Stage::KeyEventSignal() */ - Dali::Stage::KeyEventSignalV2& KeyEventSignal(); + Dali::Stage::KeyEventSignalType& KeyEventSignal(); /** * @copydoc Dali::Stage::SignalEventProcessingFinished() */ - Dali::Stage::EventProcessingFinishedSignalV2& EventProcessingFinishedSignal(); + Dali::Stage::EventProcessingFinishedSignalType& EventProcessingFinishedSignal(); /** - * @copydoc Dali::Stage::TouchedSignal() + * @copydoc Dali::Stage::TouchSignal() */ - Dali::Stage::TouchedSignalV2& TouchedSignal(); - -private: + Dali::Stage::TouchSignalType& TouchSignal(); /** - * Protected constructor; see also Stage::New() + * @copydoc Dali::Stage::WheelEventSignal() */ - Stage( AnimationPlaylist& playlist, - PropertyNotificationManager& propertyNotificationManager, - DynamicsNotifier& dynamicsNotifier, - SceneGraph::UpdateManager& updateManager, - NotificationManager& notificationManager ); + Dali::Stage::WheelEventSignalType& WheelEventSignal(); /** - * A reference counted object may only be deleted by calling Unreference() + * @copydoc Dali::Stage::ContextLostSignal() */ - virtual ~Stage(); + Dali::Stage::ContextStatusSignal& ContextLostSignal(); -private: - - // For 'Fire and forget' animation support - AnimationPlaylist& mAnimationPlaylist; + /** + * @copydoc Dali::Stage::ContextRegainedSignal() + */ + Dali::Stage::ContextStatusSignal& ContextRegainedSignal(); - PropertyNotificationManager& mPropertyNotificationManager; + /** + * @copydoc Dali::Stage::SceneCreatedSignal() + */ + Dali::Stage::SceneCreatedSignalType& SceneCreatedSignal(); - DynamicsNotifier& mDynamicsNotifier; + /** + * @copydoc Dali::DevelStage::KeyEventGeneratedSignal() + */ + Dali::DevelStage::KeyEventGeneratedSignalType& KeyEventGeneratedSignal(); - SceneGraph::UpdateManager& mUpdateManager; + /** + * @copydoc Dali::DevelStage::AddFrameCallback() + */ + void AddFrameCallback( FrameCallbackInterface& frameCallback, Actor& rootActor ); - NotificationManager& mNotificationManager; + /** + * @copydoc Dali::DevelStage::RemoveFrameCallback() + */ + void RemoveFrameCallback( FrameCallbackInterface& frameCallback ); - // The Actual size of the stage. - Vector2 mSize; + /** + * Connects a callback function with the object's signals. + * @param[in] object The object providing the signal. + * @param[in] tracker Used to disconnect the signal. + * @param[in] signalName The signal to connect to. + * @param[in] functor A newly allocated FunctorDelegate. + * @return True if the signal was connected. + * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. + */ + static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); - // Cached for public GetBackgroundColor() - Vector4 mBackgroundColor; +private: // Implementation of ContextNotificationInterface: - LayerPtr mRootLayer; + /** + * @copydoc Dali::Integration::NotifyContextLost(); + */ + virtual void NotifyContextLost(); - // Ordered list of currently on-stage layers - OwnerPointer mLayerList; + /** + * @copydoc Dali::Integration::NotifyContextRegained(); + */ + virtual void NotifyContextRegained(); - IntrusivePtr mDefaultCamera; +private: - Vector2 mDpi; + /** + * Protected constructor; see also Stage::New() + */ + Stage( SceneGraph::UpdateManager& updateManager ); - // The object registry - ObjectRegistryPtr mObjectRegistry; + /** + * A reference counted object may only be deleted by calling Unreference() + */ + virtual ~Stage(); - // The Dynamics simulation world object - Integration::DynamicsFactory* mDynamicsFactory; // Not owned pointer to DynamicsFactory (PlatformAbstraction will clean up) - DynamicsWorldPtr mDynamicsWorld; +private: - // The list of render-tasks - IntrusivePtr mRenderTaskList; + SceneGraph::UpdateManager& mUpdateManager; - Integration::SystemOverlay* mSystemOverlay; ///< SystemOverlay stage access + IntrusivePtr mScene; // The key event signal - Dali::Stage::KeyEventSignalV2 mKeyEventSignalV2; + Dali::Stage::KeyEventSignalType mKeyEventSignal; + Dali::DevelStage::KeyEventGeneratedSignalType mKeyEventGeneratedSignal; // The event processing finished signal - Dali::Stage::EventProcessingFinishedSignalV2 mEventProcessingFinishedSignalV2; + Dali::Stage::EventProcessingFinishedSignalType mEventProcessingFinishedSignal; // The touched signal - Dali::Stage::TouchedSignalV2 mTouchedSignalV2; + Dali::Stage::TouchSignalType mTouchSignal; + + // The wheel event signal + Dali::Stage::WheelEventSignalType mWheelEventSignal; + + Dali::Stage::ContextStatusSignal mContextLostSignal; + Dali::Stage::ContextStatusSignal mContextRegainedSignal; + + Dali::Stage::SceneCreatedSignalType mSceneCreatedSignal; + + DevelStage::Rendering mRenderingBehavior; ///< The rendering behavior }; } // namespace Internal @@ -428,4 +388,4 @@ inline const Internal::Stage& GetImplementation(const Dali::Stage& stage) } // namespace Dali -#endif // __DALI_INTERNAL_STAGE_H__ +#endif // DALI_INTERNAL_STAGE_H