#include "FUi_WindowImpl.h"
#include "FUiAnim_VisualElement.h"
#include "FUiAnim_VisualElementImpl.h"
+#include "FUiCtrl_Popup.h"
//#define _TC_PASS
using namespace Tizen::Ui::Animations;
using namespace Tizen::App;
using namespace Tizen::Base::Utility;
+using namespace Tizen::Ui::Controls;
namespace Tizen { namespace Ui {
return GetCore().GetSizeF();
}
-void
-_ControlImpl::UpdateBuilderBounds(const Tizen::Graphics::FloatRectangle& bounds)
+_ControlOrientation
+_ControlImpl::GetUiBuilderOrientation(void) const
{
- FloatRectangle builderBounds;
_ControlOrientation controlOrientation = _CONTROL_ORIENTATION_PORTRAIT;
- bool exist = GetBuilderBoundsF(controlOrientation, builderBounds);
- if (exist)
+
+ _Window* pWindow = GetCore().GetRootWindow();
+ if (!pWindow)
{
- if (IsAttachedToMainTree())
+ return controlOrientation;
+ }
+
+ _ControlImplManager* pControlImplManager = _ControlImplManager::GetInstance();
+ if (!pControlImplManager)
+ {
+ return controlOrientation;
+ }
+
+ if (pWindow->IsOrientationRoot())
+ {
+ // Frame
+ OrientationStatus status = pControlImplManager->GetFormOrientationStatus(this);
+
+ if ((status == ORIENTATION_STATUS_LANDSCAPE) || (status == ORIENTATION_STATUS_LANDSCAPE_REVERSE))
{
- _Window* pWindow = GetCore().GetRootWindow();
- if (pWindow->IsOrientationRoot())
- {
- // Frame
- _ControlImplManager* pControlImplManager = _ControlImplManager::GetInstance();
- OrientationStatus orientationStatus = pControlImplManager->GetFormOrientationStatus(this);
+ controlOrientation = _CONTROL_ORIENTATION_LANDSCAPE;
+ }
+ else
+ {
+ controlOrientation = _CONTROL_ORIENTATION_PORTRAIT;
+ }
+ }
+ else
+ {
+ // Ownee Window
+ bool owner = false;
- if ((orientationStatus == ORIENTATION_STATUS_LANDSCAPE) || (orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE))
- {
- controlOrientation = _CONTROL_ORIENTATION_LANDSCAPE;
- }
- else
- {
- controlOrientation = _CONTROL_ORIENTATION_PORTRAIT;
- }
- }
- else
+ Tizen::Ui::Controls::_Popup* pPopup = dynamic_cast<Tizen::Ui::Controls::_Popup*>(pWindow);
+ if (pPopup)
+ {
+ if (pWindow->IsOrientationCallbackModeEnabled() == false)
{
- // Window
- controlOrientation = GetCore().GetOrientation();
+ owner = true;
}
+ }
- if (controlOrientation == _CONTROL_ORIENTATION_LANDSCAPE)
- {
- SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, bounds);
- }
- else
+ if (owner)
+ {
+ _Control* pOwner = pWindow->GetOwner();
+ if (pOwner)
{
- SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, bounds);
+ _ControlImpl* pControlImpl = static_cast<_ControlImpl*>(pOwner->GetUserData());
+ if (pControlImpl)
+ {
+ OrientationStatus status = pControlImplManager->GetFormOrientationStatus(pControlImpl);
+ if ((status == ORIENTATION_STATUS_LANDSCAPE) || (status == ORIENTATION_STATUS_LANDSCAPE_REVERSE))
+ {
+ controlOrientation = _CONTROL_ORIENTATION_LANDSCAPE;
+ }
+ else
+ {
+ controlOrientation = _CONTROL_ORIENTATION_PORTRAIT;
+ }
+ }
}
}
else
{
+ controlOrientation = GetCore().GetOrientation();
+ }
+ }
+
+ return controlOrientation;
+}
+
+void
+_ControlImpl::UpdateBuilderBounds(const Tizen::Graphics::FloatRectangle& bounds)
+{
+ FloatRectangle builderBounds;
+ _ControlOrientation controlOrientation = GetUiBuilderOrientation();
+ bool exist = GetBuilderBoundsF(controlOrientation, builderBounds);
+ if (exist)
+ {
+ if (IsAttachedToMainTree())
+ {
+ SetBuilderBounds(controlOrientation, bounds);
+ }
+ else
+ {
SetBuilderBounds(_CONTROL_ORIENTATION_PORTRAIT, bounds);
SetBuilderBounds(_CONTROL_ORIENTATION_LANDSCAPE, bounds);
}
_ControlImpl::UpdateBuilderSize(const Tizen::Graphics::FloatDimension& dimension)
{
FloatRectangle builderBounds;
- _ControlOrientation controlOrientation = GetCore().GetOrientation();
+ _ControlOrientation controlOrientation = GetUiBuilderOrientation();
bool exist = GetBuilderBoundsF(controlOrientation, builderBounds);
if (exist)
}
}
+void
+_ControlImpl::UpdateBuilderPosition(const FloatPoint& position)
+{
+ FloatRectangle builderBounds;
+ _ControlOrientation controlOrientation = GetUiBuilderOrientation();
+
+ bool exist = GetBuilderBoundsF(controlOrientation, builderBounds);
+ if (exist)
+ {
+ builderBounds.x = position.x;
+ builderBounds.y = position.y;
+ UpdateBuilderBounds(builderBounds);
+ }
+}
+
result
_ControlImpl::SetBounds(const Rectangle& bounds, bool callBoundsChangeCallbacks)
{
result
_ControlImpl::SetPosition(const Point& position)
{
+ UpdateBuilderPosition(_CoordinateSystemUtils::ConvertToFloat(position));
return GetCore().SetPosition(position);
}
result
_ControlImpl::SetPosition(const FloatPoint& position)
{
+ UpdateBuilderPosition(position);
return GetCore().SetPosition(position);
}
virtual result OnDetachingFromMainTree(void);
virtual void OnFocusableStateChanged(bool focusalbeState);
#if defined(WINDOW_BASE_ROTATE)
- void OnWindowStateChanged(void);
+ virtual void OnWindowStateChanged(void);
void SetPreferredRotation(bool enable);
bool GetPreferredRotation(void) const;
#if defined(WINDOW_OWNEE_PREFERRED)
void SetDimmingLayer(_DimmingLayer* pLayer);
_DimmingLayer* GetDimmingLayer(void);
+ void SetOrientationCallbackModeEnabled(bool enable);
+ bool IsOrientationCallbackModeEnabled(void) const;
+
protected:
_Window(void);
_IWindowDelegate& GetWindowDelegate(void) const;
bool __preferredRotation;
#endif
+ bool __orientationCallbackMode;
+
friend class _ControlManager;
}; // _Window