#define DALI_GL_WINDOW_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
// EXTERNAL INCLUDES
-#include <string>
+#include <dali/public-api/adaptor-framework/window-enumerations.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/uint-16-pair.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/any.h>
+#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/signals/dali-signal.h>
+#include <string>
// INTERNAL INCLUDES
#include <dali/public-api/dali-adaptor-common.h>
{
class GlWindow;
}
-}
+} // namespace DALI_INTERNAL
class TouchEvent;
class KeyEvent;
class DALI_ADAPTOR_API GlWindow : public BaseHandle
{
public:
+ using WindowSize = Uint16Pair;
- using WindowSize = Uint16Pair ;
-
- typedef Signal< void ( const KeyEvent& ) > KeyEventSignalType; ///< GlWindow Key Event signal type
- typedef Signal< void ( const TouchEvent& ) > TouchEventSignalType; ///< GlWindow Touch Event signal type
- typedef Signal< void ( GlWindow, bool ) > FocusChangeSignalType; ///< GlWindow Focus signal type
- typedef Signal< void ( WindowSize ) > ResizeSignalType; ///< GlWindow resize signal type
- typedef Signal< void ( GlWindow, bool ) > VisibilityChangedSignalType; ///< GlWindow visibility change signal type
+ typedef Signal<void(const KeyEvent&)> KeyEventSignalType; ///< GlWindow Key Event signal type
+ typedef Signal<void(const TouchEvent&)> TouchEventSignalType; ///< GlWindow Touch Event signal type
+ typedef Signal<void(GlWindow, bool)> FocusChangeSignalType; ///< GlWindow Focus signal type
+ typedef Signal<void(WindowSize)> ResizeSignalType; ///< GlWindow resize signal type
+ typedef Signal<void(GlWindow, bool)> VisibilityChangedSignalType; ///< GlWindow visibility change signal type
public:
-
// Enumerations
/**
- * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
+ * @brief Enumeration for GLES verion
*
- * This Enumeration is used the available orientation APIs and the preferred orientation.
+ * This Enumeration is used the GLES version for EGL configuration.
+ * If the device can not support GLES version 3.0 over, the version will be chosen with GLES version 2.0
*
*/
- enum class GlWindowOrientation
+ enum class GlesVersion
{
- PORTRAIT = 0, ///< Portrait orientation. The height of the display area is greater than the width.
- LANDSCAPE = 1, ///< Landscape orientation. A wide view area is needed.
- PORTRAIT_INVERSE = 2, ///< Portrait inverse orientation
- LANDSCAPE_INVERSE = 3, ///< Landscape inverse orientation
- NO_ORIENTATION_PREFERENCE = -1 ///< Invalid angle value. It is used to initialize or unset the preferred orientation.
+ VERSION_2_0 = 0, ///< GLES version 2.0
+ VERSION_3_0, ///< GLES version 3.0
};
- /**
- * @brief Enumeration for GLES verion
- *
- * This Enumeration is used the GLES version for EGL configuration.
- * If the device can not support GLES version 3.0 over, the version will be chosen with GLES version 2.0
+ /**
+ * @brief Enumeration for rendering mode
*
+ * This Enumeration is used to choose the rendering mode.
+ * It has two options.
+ * One of them is continuous mode. It is rendered continuously.
+ * The other is on demand mode. It is rendered by application.
*/
- enum class GlesVersion
+ enum class RenderingMode
{
- VERSION_2_0 = 0, ///< GLES version 2.0
- VERSION_3_0, ///< GLES version 3.0
+ CONTINUOUS, ///< continuous mode
+ ON_DEMAND ///< on demand by application
};
/**
* @note This creates an extra GlWindow in addition to the default main GlWindow
* @return A new GlWindow
*/
- static GlWindow New( PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent = false );
+ static GlWindow New(PositionSize positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
/**
* @brief Creates an uninitialized handle.
*/
GlWindow& operator=(const GlWindow& rhs);
- /**
+ /**
* @brief Move constructor.
*
* @param[in] rhs A reference to the moved handle
GlWindow& operator=(GlWindow&& rhs);
/**
- * @brief Sets egl configuration for GlWindow
+ * @brief Sets graphics configuration for GlWindow
*
* @param[in] depth the flag of depth buffer. If true is set, 24bit depth buffer is enabled.
* @param[in] stencil the flag of stencil. it true is set, 8bit stencil buffer is enabled.
* @param[in] version the GLES version
*
*/
- void SetEglConfig( bool depth, bool stencil, int msaa, GlesVersion version );
+ void SetGraphicsConfig(bool depth, bool stencil, int msaa, GlesVersion version);
/**
* @brief Raises GlWindow to the top of GlWindow stack.
*
* @param[in] positionSize The new GlWindow position
*/
- void SetPositionSize( PositionSize positionSize );
+ void SetPositionSize(PositionSize positionSize);
/**
* @brief Gets a position of the GlWindow.
* @note The window auxiliary hint is the value which is used to decide which actions should be made available to the user by the window manager.
* If you want to set specific hint to your window, then you should check whether it exists in the supported auxiliary hints.
*/
- std::string GetSupportedAuxiliaryHint( unsigned int index ) const;
+ std::string GetSupportedAuxiliaryHint(unsigned int index) const;
/**
* @brief Creates an auxiliary hint of the window.
* @param[in] value The value string.
* @return The ID of created auxiliary hint, or @c 0 on failure.
*/
- unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value );
+ unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value);
/**
* @brief Removes an auxiliary hint of the window.
* @param[in] id The ID of the auxiliary hint.
* @return True if no error occurred, false otherwise.
*/
- bool RemoveAuxiliaryHint( unsigned int id );
+ bool RemoveAuxiliaryHint(unsigned int id);
/**
* @brief Changes a value of the auxiliary hint.
* @param[in] value The value string to be set.
* @return True if no error occurred, false otherwise.
*/
- bool SetAuxiliaryHintValue( unsigned int id, const std::string& value );
+ bool SetAuxiliaryHintValue(unsigned int id, const std::string& value);
/**
* @brief Gets a value of the auxiliary hint.
* @param[in] id The auxiliary hint ID.
* @return The string value of the auxiliary hint ID, or an empty string if none exists.
*/
- std::string GetAuxiliaryHintValue( unsigned int id ) const;
+ std::string GetAuxiliaryHintValue(unsigned int id) const;
/**
* @brief Gets a ID of the auxiliary hint string.
* @param[in] hint The auxiliary hint string.
* @return The ID of the auxiliary hint string, or @c 0 if none exists.
*/
- unsigned int GetAuxiliaryHintId( const std::string& hint ) const;
+ unsigned int GetAuxiliaryHintId(const std::string& hint) const;
/**
* @brief Sets a region to accept input events.
*
* @param[in] inputRegion The region to accept input events.
*/
- void SetInputRegion( const Rect< int >& inputRegion );
+ void SetInputRegion(const Rect<int>& inputRegion);
/**
* @brief Sets a transparent window's visual state to opaque.
* @remarks This will have no effect on an opaque window.
* It doesn't change transparent window to opaque window but lets the window manager know the visual state of the window.
*/
- void SetOpaqueState( bool opaque );
+ void SetOpaqueState(bool opaque);
/**
* @brief Returns whether a transparent window's visual state is opaque or not.
*
* @return The current GlWindow rotation angle if previously set, or none
*/
- Dali::GlWindow::GlWindowOrientation GetCurrentOrientation() const;
+ WindowOrientation GetCurrentOrientation() const;
- /**
+ /**
* @brief Sets available orientations of the window.
*
* This API is for setting several orientations one time.
*
* @param[in] orientations The available orientations list to add
*/
- void SetAvailableOrientations( const Dali::Vector<Dali::GlWindow::GlWindowOrientation>& orientations );
+ void SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations);
/**
* @brief Sets a preferred orientation.
*
* @note To unset the preferred orientation, angle should be set NO_ORIENTATION_PREFERENCE.
*/
- void SetPreferredOrientation( Dali::GlWindow::GlWindowOrientation orientation );
+ void SetPreferredOrientation(WindowOrientation orientation);
/**
* @brief Registers a GL callback function for application.
* @endcode
* This callback is called when GlWindow is deleted.
*/
- void RegisterGlCallback( CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback );
+ void RegisterGlCallbacks(CallbackBase* initCallback, CallbackBase* renderFrameCallback, CallbackBase* terminateCallback);
/**
* @brief Renders once more even if GL render functions are not added to idler.
*/
void RenderOnce();
-public: // Signals
+ /**
+ * @brief Sets rendering mode.
+ *
+ * @param[in] mode the rendering mode for GlWindow
+ *
+ * @note The default Rendering mode is continuous.
+ * If OnDemand mode is set, it is rendered by RenderOnce()
+ */
+ void SetRenderingMode(RenderingMode mode);
/**
+ * @brief Gets rendering mode.
+ *
+ * @return current rendering mode in this GlWindow
+ *
+ * @note The default Rendering mode is continuous.
+ * If OnDemand mode is set, it is rendered by RenderOnce()
+ */
+ RenderingMode GetRenderingMode() const;
+
+public: // Signals
+ /**
* @brief The user should connect to this signal to get a timing when GlWindow gains focus or loses focus.
*
* A callback of the following type may be connected:
* @brief This constructor is used by Dali::Application::GetGlWindow().
* @param[in] GlWindow A pointer to the GlWindow
*/
- explicit DALI_INTERNAL GlWindow( Internal::Adaptor::GlWindow* GlWindow );
+ explicit DALI_INTERNAL GlWindow(Internal::Adaptor::GlWindow* GlWindow);
/// @endcond
};