*
* @see DevelControl::State
*/
- SUB_STATE = BACKGROUND + 3
+ SUB_STATE = BACKGROUND + 3,
+
+ /**
+ * @brief The actor ID of the left focusable control.
+ * @details Name "leftFocusableActorId", type Property::INTEGER.
+ *
+ */
+ LEFT_FOCUSABLE_ACTOR_ID = BACKGROUND + 4,
+
+ /**
+ * @brief The actor ID of the right focusable control.
+ * @details Name "rightFocusableActorId", type Property::INTEGER.
+ *
+ */
+ RIGHT_FOCUSABLE_ACTOR_ID = BACKGROUND + 5,
+
+ /**
+ * @brief The actor ID of the up focusable control.
+ * @details Name "upFocusableActorId", type Property::INTEGER.
+ *
+ */
+ UP_FOCUSABLE_ACTOR_ID = BACKGROUND + 6,
+
+ /**
+ * @brief The actor ID of the down focusable control.
+ * @details Name "downFocusableActorId", type Property::INTEGER.
+ *
+ */
+ DOWN_FOCUSABLE_ACTOR_ID = BACKGROUND + 7
};
} // namespace Property
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/integration-api/debug.h>
void FlexContainer::OnChildAdd( Actor& child )
{
- // Anchor actor to top left of the container
- child.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- child.SetParentOrigin( ParentOrigin::TOP_LEFT );
-
// Create a new node for the child.
FlexItemNode childNode;
childNode.actor = child;
Actor child = mChildrenNodes[i].actor.GetHandle();
if( child )
{
+ // Anchor actor to top left of the container
+ if( child.GetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >() )
+ {
+ child.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ }
+ child.SetParentOrigin( ParentOrigin::TOP_LEFT );
+
float negotiatedWidth = child.GetRelayoutSize(Dimension::WIDTH);
float negotiatedHeight = child.GetRelayoutSize(Dimension::HEIGHT);
#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/integration-api/debug.h>
if( actor && position.rowIndex == row && position.columnIndex == column )
{
// Anchor actor to top left of the cell
- actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ if( actor.GetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >() )
+ {
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ }
actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
Padding padding;
namespace Dali
{
-extern bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b );
namespace Toolkit
{
: mControlImpl( controlImpl ),
mState( Toolkit::DevelControl::NORMAL ),
mSubStateName(""),
+ mLeftFocusableActorId( -1 ),
+ mRightFocusableActorId( -1 ),
+ mUpFocusableActorId( -1 ),
+ mDownFocusableActorId( -1 ),
mStyleName(""),
mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale( NULL ),
}
break;
+ case Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID:
+ {
+ int focusId;
+ if( value.Get( focusId ) )
+ {
+ controlImpl.mImpl->mLeftFocusableActorId = focusId;
+ }
+ }
+ break;
+
+ case Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID:
+ {
+ int focusId;
+ if( value.Get( focusId ) )
+ {
+ controlImpl.mImpl->mRightFocusableActorId = focusId;
+ }
+ }
+ break;
+
+ case Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID:
+ {
+ int focusId;
+ if( value.Get( focusId ) )
+ {
+ controlImpl.mImpl->mUpFocusableActorId = focusId;
+ }
+ }
+ break;
+
+ case Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID:
+ {
+ int focusId;
+ if( value.Get( focusId ) )
+ {
+ controlImpl.mImpl->mDownFocusableActorId = focusId;
+ }
+ }
+ break;
+
case Toolkit::Control::Property::BACKGROUND_COLOR:
{
DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
break;
}
+ case Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID:
+ {
+ value = controlImpl.mImpl->mLeftFocusableActorId;
+ break;
+ }
+
+ case Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID:
+ {
+ value = controlImpl.mImpl->mRightFocusableActorId;
+ break;
+ }
+
+ case Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID:
+ {
+ value = controlImpl.mImpl->mUpFocusableActorId;
+ break;
+ }
+
+ case Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID:
+ {
+ value = controlImpl.mImpl->mDownFocusableActorId;
+ break;
+ }
+
case Toolkit::Control::Property::BACKGROUND_COLOR:
{
DALI_LOG_WARNING( "BACKGROUND_COLOR property is deprecated. Use BACKGROUND property instead\n" );
DevelControl::State mState;
std::string mSubStateName;
+ int mLeftFocusableActorId; ///< Actor ID of Left focusable control.
+ int mRightFocusableActorId; ///< Actor ID of Right focusable control.
+ int mUpFocusableActorId; ///< Actor ID of Up focusable control.
+ int mDownFocusableActorId; ///< Actor ID of Down focusable control.
+
RegisteredVisualContainer mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
std::string mStyleName;
Vector4 mBackgroundColor; ///< The color of the background visual
static const PropertyRegistration PROPERTY_6;
static const PropertyRegistration PROPERTY_7;
static const PropertyRegistration PROPERTY_8;
+ static const PropertyRegistration PROPERTY_9;
+ static const PropertyRegistration PROPERTY_10;
+ static const PropertyRegistration PROPERTY_11;
+ static const PropertyRegistration PROPERTY_12;
};
// Properties registered without macro to use specific member variables.
-const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "backgroundColor", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "state", Toolkit::DevelControl::Property::STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
-const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "subState", Toolkit::DevelControl::Property::SUB_STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_1( typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_2( typeRegistration, "backgroundColor", Toolkit::Control::Property::BACKGROUND_COLOR, Property::VECTOR4, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_3( typeRegistration, "backgroundImage", Toolkit::Control::Property::BACKGROUND_IMAGE, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_4( typeRegistration, "keyInputFocus", Toolkit::Control::Property::KEY_INPUT_FOCUS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_5( typeRegistration, "background", Toolkit::Control::Property::BACKGROUND, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_6( typeRegistration, "tooltip", Toolkit::DevelControl::Property::TOOLTIP, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_7( typeRegistration, "state", Toolkit::DevelControl::Property::STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_8( typeRegistration, "subState", Toolkit::DevelControl::Property::SUB_STATE, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_9( typeRegistration, "leftFocusableActorId", Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_10( typeRegistration, "rightFocusableActorId", Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID,Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_11( typeRegistration, "upFocusableActorId", Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
+const PropertyRegistration Control::Impl::PROPERTY_12( typeRegistration, "downFocusableActorId", Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty );
Toolkit::Control Control::New()
{
public void Initialize(object source, NUIApplicationInitEventArgs e)
{
+ NavigationPropertiesTests();
+
OperatorTests();
CustomViewPropertyTest();
}
}
+ public void NavigationPropertiesTests()
+ {
+ View view = new View();
+ View leftView, rightView, upView, downView, tmpView;
+
+ leftView = new View();
+ leftView.Name = "leftView";
+ rightView = new View();
+ rightView.Name = "rightView";
+ upView = new View();
+ upView.Name = "upView";
+ downView = new View();
+ downView.Name = "downView";
+
+ Stage.Instance.Add(leftView);
+ Stage.Instance.Add(rightView);
+ Stage.Instance.Add(upView);
+ Stage.Instance.Add(downView);
+
+ view.LeftFocusableView = leftView;
+ tmpView = view.LeftFocusableView;
+ if (string.Compare(tmpView.Name, "leftView") == 0)
+ {
+ Console.WriteLine("Passed: LeftFocusedView = " + tmpView.Name);
+ }
+ else
+ {
+ Console.WriteLine("Failed: LeftFocusedView = " + tmpView.Name);
+ }
+
+ view.RightFocusableView = rightView;
+ tmpView = view.RightFocusableView;
+ if (string.Compare(tmpView.Name, "rightView") == 0)
+ {
+ Console.WriteLine("Passed: RightFocusedView = " + tmpView.Name);
+ }
+ else
+ {
+ Console.WriteLine("Failed: RightFocusedView = " + tmpView.Name);
+ }
+
+ Stage.Instance.Add(view);
+
+ view.UpFocusableView = upView;
+ tmpView = view.UpFocusableView;
+ if (string.Compare(tmpView.Name, "upView") == 0)
+ {
+ Console.WriteLine("Passed: UpFocusedView = " + tmpView.Name);
+ }
+ else
+ {
+ Console.WriteLine("Failed: UpFocusedView = " + tmpView.Name);
+ }
+
+ view.DownFocusableView = downView;
+ tmpView = view.DownFocusableView;
+ if (string.Compare(tmpView.Name, "downView") == 0)
+ {
+ Console.WriteLine("Passed: DownFocusedView = " + tmpView.Name);
+ }
+ else
+ {
+ Console.WriteLine("Failed: DownFocusedView = " + tmpView.Name);
+ }
+
+ Stage.Instance.Remove(leftView);
+ tmpView = view.LeftFocusableView;
+ if (!tmpView)
+ {
+ Console.WriteLine("Passed: NULL LeftFocusedView");
+ }
+ else
+ {
+ Console.WriteLine("Failed: LeftFocusedView = " + tmpView.Name);
+ }
+ }
+
public void OperatorTests()
{
Actor actor = new Actor();
return jresult;
}
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_LEFT_FOCUSABLE_ACTOR_ID_get() {
+ return Dali::Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get() {
+ return Dali::Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_UP_FOCUSABLE_ACTOR_ID_get() {
+ return Dali::Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID;
+}
+
+SWIGEXPORT int SWIGSTDCALL CSharp_View_Property_DOWN_FOCUSABLE_ACTOR_ID_get() {
+ return Dali::Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID;
+}
+
SWIGEXPORT int SWIGSTDCALL CSharp_ItemView_Property_LAYOUT_get() {
int jresult ;
int result;
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_SUB_STATE_get")]
public static extern int View_Property_SUB_STATE_get();
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_LEFT_FOCUSABLE_ACTOR_ID_get")]
+ public static extern int View_Property_LEFT_FOCUSABLE_ACTOR_ID_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get")]
+ public static extern int View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_UP_FOCUSABLE_ACTOR_ID_get")]
+ public static extern int View_Property_UP_FOCUSABLE_ACTOR_ID_get();
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_View_Property_DOWN_FOCUSABLE_ACTOR_ID_get")]
+ public static extern int View_Property_DOWN_FOCUSABLE_ACTOR_ID_get();
+
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_ItemView_Property_LAYOUT_get")]
public static extern int ItemView_Property_LAYOUT_get();
public static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get();
public static readonly int STATE = NDalicManualPINVOKE.View_Property_STATE_get();
public static readonly int SUB_STATE = NDalicManualPINVOKE.View_Property_SUB_STATE_get();
+ public static readonly int LEFT_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_LEFT_FOCUSABLE_ACTOR_ID_get();
+ public static readonly int RIGHT_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get();
+ public static readonly int UP_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_UP_FOCUSABLE_ACTOR_ID_get();
+ public static readonly int DOWN_FOCUSABLE_ACTOR_ID = NDalicManualPINVOKE.View_Property_DOWN_FOCUSABLE_ACTOR_ID_get();
public Property() : this(NDalicPINVOKE.new_View_Property(), true) {
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return (T)( ViewRegistry.GetViewFromActor( actor ) );
}
+ private View ConvertIdToView(uint id)
+ {
+ Actor actor = null;
+
+ if (Parent)
+ {
+ actor = Parent.FindChildById(id);
+ }
+
+ if (!actor)
+ {
+ actor = Stage.Instance.GetRootLayer().FindChildById(id);
+ }
+
+ return View.DownCast<View>(actor);
+ }
+
public void SetKeyInputFocus() {
NDalicPINVOKE.View_SetKeyInputFocus(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
+ private int LeftFocusableActorId
+ {
+ get
+ {
+ int temp = 0;
+ GetProperty( View.Property.LEFT_FOCUSABLE_ACTOR_ID).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.LEFT_FOCUSABLE_ACTOR_ID, new Dali.Property.Value( value ) );
+ }
+ }
+
+ private int RightFocusableActorId
+ {
+ get
+ {
+ int temp = 0;
+ GetProperty( View.Property.RIGHT_FOCUSABLE_ACTOR_ID).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.RIGHT_FOCUSABLE_ACTOR_ID, new Dali.Property.Value( value ) );
+ }
+ }
+
+ private int UpFocusableActorId
+ {
+ get
+ {
+ int temp = 0;
+ GetProperty( View.Property.UP_FOCUSABLE_ACTOR_ID).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.UP_FOCUSABLE_ACTOR_ID, new Dali.Property.Value( value ) );
+ }
+ }
+
+ private int DownFocusableActorId
+ {
+ get
+ {
+ int temp = 0;
+ GetProperty( View.Property.DOWN_FOCUSABLE_ACTOR_ID).Get( ref temp );
+ return temp;
+ }
+ set
+ {
+ SetProperty( View.Property.DOWN_FOCUSABLE_ACTOR_ID, new Dali.Property.Value( value ) );
+ }
+ }
+
public float Flex
{
get
SetProperty( TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Dali.Property.Value( value ) );
}
}
+
+ /**
+ * @brief The left focusable view.
+ * @note This will return NULL if not set.
+ * This will also return NULL if the specified left focusable view is not on stage.
+ *
+ */
+ public View LeftFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ if (LeftFocusableActorId >= 0)
+ {
+ return ConvertIdToView((uint)LeftFocusableActorId);
+ }
+ return null;
+ }
+ set
+ {
+ LeftFocusableActorId = (int)value.GetId();
+ }
+ }
+
+ /**
+ * @brief The right focusable view.
+ * @note This will return NULL if not set.
+ * This will also return NULL if the specified right focusable view is not on stage.
+ *
+ */
+ public View RightFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ if (RightFocusableActorId >= 0)
+ {
+ return ConvertIdToView((uint)RightFocusableActorId);
+ }
+ return null;
+ }
+ set
+ {
+ RightFocusableActorId = (int)value.GetId();
+ }
+ }
+
+ /**
+ * @brief The up focusable view.
+ * @note This will return NULL if not set.
+ * This will also return NULL if the specified up focusable view is not on stage.
+ *
+ */
+ public View UpFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ if (UpFocusableActorId >= 0)
+ {
+ return ConvertIdToView((uint)UpFocusableActorId);
+ }
+ return null;
+ }
+ set
+ {
+ UpFocusableActorId = (int)value.GetId();
+ }
+ }
+
+ /**
+ * @brief The down focusable view.
+ * @note This will return NULL if not set.
+ * This will also return NULL if the specified down focusable view is not on stage.
+ *
+ */
+ public View DownFocusableView
+ {
+ // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
+ get
+ {
+ if (DownFocusableActorId >= 0)
+ {
+ return ConvertIdToView((uint)DownFocusableActorId);
+ }
+ return null;
+ }
+ set
+ {
+ DownFocusableActorId = (int)value.GetId();
+ }
+ }
}
}