// The collection of contacts
static class ContactsList
{
- private const string resources = "/home/owner/apps_rw/NUISamples.TizenTV/res";
+ private const string resources = "/home/SERILOCAL/david.steele/Git/Tizen/nui/NUISamples/NUISamples/NUISamples.TizenTV/res";
public static readonly ContactItem[] s_contactData = new ContactItem[]
{
new ContactItem ("Emmett Yates", resources + "/images/gallery-small-43.jpg",
+ resources + "/images/mask.png",
new Color((73.0f/255.0f),(182.0f/255.0f), (245.0f/255.0f), 1.0f),
(int)PrimitiveVisualShapeType.Cone),
new ContactItem ("Leslie Wong", resources+ "/images/gallery-2.jpg",
+ resources + "/images/mask.png",
new Color((51.0f/255.0f), (51.0f/255.0f), (102.0f/255.0f), 1.0f),
(int)PrimitiveVisualShapeType.Sphere),
new ContactItem ("Walter Jensen", resources+ "/images/gallery-0.jpg",
+ resources + "/images/mask.png",
new Color((151.0f/255.0f), (214.0f/255.0f), (240.0f/255.0f), 1.0f),
(int)PrimitiveVisualShapeType.Cylinder),
new ContactItem ("Dan Haynes", resources+"/images/gallery-1.jpg",
+ resources + "/images/mask.png",
new Color((102.0f/255.0f), (251.0f/255.0f), (102.0f/255.0f), 1.0f),
(int)PrimitiveVisualShapeType.ConicalFrustrum),
new ContactItem ("Mable Hodges", resources+"/images/gallery-3.jpg",
+ resources + "/images/mask.png",
new Color((255.0f/255.0f), (102.0f/255.0f), (102.0f/255.0f), 1.0f),
(int)PrimitiveVisualShapeType.Cube)
};
private string _imageURL;
private Color _color;
private int _shape;
+ private string _maskURL;
- public ContactItem(string name, string imageURL, Color color, int shape)
+ public ContactItem(string name, string imageURL, string maskURL, Color color, int shape)
{
_name = name;
_imageURL = imageURL;
+ _maskURL = maskURL;
_color = color;
_shape = shape;
}
_imageURL = value;
}
}
+ public string MaskURL
+ {
+ get
+ {
+ return _maskURL;
+ }
+ set
+ {
+ _maskURL = value;
+ }
+ }
public string Name
{
}
}
}
-}
\ No newline at end of file
+}
{
public class ContactView : CustomView
{
- private const int ColorVisualPropertyIndex = 0;
- private const int PrimitiveVisualPropertyIndex = 1;
- private const int ImageVisualPropertyIndex = 2;
- private const int TextVisualPropertyIndex = 3;
+ private const int PROPERTY_REGISTRATION_START_INDEX = 10001000;
+ private const int ColorVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+1 ;
+ private const int PrimitiveVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+2;
+ private const int ImageVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+3;
+ private const int TextVisualPropertyIndex = PROPERTY_REGISTRATION_START_INDEX+4;
private VisualBase _imageVisual;
private VisualBase _colorVisual;
private VisualBase _primitiveVisual;
private VisualBase _textVisual;
private int _shape;
private string _imageURL;
+ private string _maskURL;
private string _name;
private Color _color;
+ static CustomView CreateInstance()
+ {
+ return new ContactView();
+ }
+
+ static ContactView()
+ {
+ ViewRegistry.Instance.Register( CreateInstance, typeof(ContactView));
+ }
+
public ContactView() : base(typeof(ContactView).Name, CustomViewBehaviour.RequiresKeyboardNavigationSupport)
{
}
+ public string MaskURL
+ {
+ get { return _maskURL; }
+ set { _maskURL=value; }
+ }
+
+ [ScriptableProperty()]
public string ImageURL
{
get
// Create and Register Image Visual
PropertyMap imageVisual = new PropertyMap();
imageVisual.Add( Visual.Property.Type, new PropertyValue( (int)Visual.Type.Image ))
- .Add( ImageVisualProperty.URL, new PropertyValue( _imageURL ));
+ .Add( ImageVisualProperty.URL, new PropertyValue( _imageURL ) )
+ .Add( ImageVisualProperty.AlphaMaskURL, new PropertyValue( _maskURL ));
_imageVisual = VisualFactory.Get().CreateVisual( imageVisual );
- RegisterVisual( ImageVisualPropertyIndex, _imageVisual );
+
+ RegisterVisual( GetPropertyIndex("ImageURL"), _imageVisual );
// Set the depth index for Image visual
_imageVisual.DepthIndex = ImageVisualPropertyIndex;
}
}
+ [ScriptableProperty()]
public string Name
{
get
.Add( TextVisualProperty.HorizontalAlignment, new PropertyValue("CENTER"))
.Add( TextVisualProperty.VerticalAlignment, new PropertyValue("CENTER"));
_textVisual = VisualFactory.Get().CreateVisual( textVisual );
- RegisterVisual( TextVisualPropertyIndex, _textVisual );
+
+ RegisterVisual( GetPropertyIndex("Name"), _textVisual );
// Set the depth index for Text visual
_textVisual.DepthIndex = TextVisualPropertyIndex;
}
}
+ [ScriptableProperty()]
public Color Color
{
get
set
{
_color = value;
-
- // Create and Register Color Visual
- PropertyMap colorVisual = new PropertyMap();
- colorVisual.Add( Visual.Property.Type, new PropertyValue( (int)Visual.Type.Color ))
- .Add( ColorVisualProperty.MixColor, new PropertyValue( _color ));
- _colorVisual = VisualFactory.Get().CreateVisual( colorVisual );
- RegisterVisual( ColorVisualPropertyIndex, _colorVisual );
-
- // Set the depth index for Color visual
- _colorVisual.DepthIndex = ColorVisualPropertyIndex;
+ BackgroundColor = value;
}
}
+ [ScriptableProperty()]
public int Shape
{
get
.Add( PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(new Vector3(1.0f,1.0f,0.3f)))
.Add( PrimitiveVisualProperty.MixColor, new PropertyValue(new Vector4((245.0f/255.0f), (188.0f/255.0f), (73.0f/255.0f), 1.0f)));
_primitiveVisual = VisualFactory.Get().CreateVisual( primitiveVisual );
- RegisterVisual( PrimitiveVisualPropertyIndex, _primitiveVisual );
+ RegisterVisual( GetPropertyIndex("Shape"), _primitiveVisual );
// Set the depth index for Primitive visual
_primitiveVisual.DepthIndex = PrimitiveVisualPropertyIndex;
{
// Change the Color visual of ContactView with some random color
Random random = new Random();
- Color = new Color((random.Next(0, 256) / 255.0f), (random.Next(0, 256) / 255.0f), (random.Next(0, 256) / 255.0f), 1.0f);
+ float nextRed = (random.Next(0, 256) / 255.0f);
+ float nextGreen = (random.Next(0, 256) / 255.0f);
+ float nextBlue = (random.Next(0, 256) / 255.0f);
+ Animation anim = AnimateBackgroundColor( new Color( nextRed, nextGreen, nextBlue, 1.0f), 0, 2000 );
+ anim.Play();
}
public override void OnRelayout(Vector2 size, RelayoutContainer container)
.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.CenterBegin))
.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.CenterBegin));
_primitiveVisual.SetTransformAndSize(primitiveVisualTransform, size);
-
- // Configure the transform and size of Color visual. This is also the default value.
- PropertyMap colorVisualTransform = new PropertyMap();
- colorVisualTransform.Add( (int)VisualTransformPropertyType.Offset, new PropertyValue(new Vector2(0.0f,0.0f)))
- .Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Relative, (int)VisualTransformPolicyType.Relative)))
- .Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(new Vector2((int)VisualTransformPolicyType.Relative, (int)VisualTransformPolicyType.Relative)))
- .Add( (int)VisualTransformPropertyType.Size, new PropertyValue(new Vector2(1.0f, 1.0f)) )
- .Add( (int)VisualTransformPropertyType.Origin, new PropertyValue((int)Visual.AlignType.TopBegin) )
- .Add( (int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)Visual.AlignType.TopBegin) );
- _colorVisual.SetTransformAndSize(colorVisualTransform, size);
}
}
-}
\ No newline at end of file
+}
contentLayout.Name = "ContentLayout";
//contentLayout.WidthResizePolicy = ResizePolicyType.FillToParent;
//contentLayout.HeightResizePolicy = ResizePolicyType.FillToParent;
- contentLayout.PivotPoint = PivotPoint.Center;
- contentLayout.ParentOrigin = ParentOrigin.Center;
- contentLayout.Size = new Vector3(window.Size.Width, window.Size.Height, 0.0f);
+ contentLayout.PivotPoint = PivotPoint.TopLeft;
+ contentLayout.ParentOrigin = ParentOrigin.TopLeft;
+ contentLayout.Size2D = new Vector2(window.Size.Width, window.Size.Height);
contentLayout.SetCellPadding(new Size2D(5, 5));
contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f);
// Configure visuals of ContactView via properties
contactView.Name = contact.Name;
+ contactView.MaskURL = contact.MaskURL;
contactView.ImageURL = contact.ImageURL;
contactView.Color = contact.Color;
contactView.Shape = contact.Shape;
/// The main entry point for the application.
/// </summary>
[STAThread]
- static void _Main(string[] args)
+ static void Main(string[] args)
{
VisualsExample visualsExample = new VisualsExample();
visualsExample.Run(args);
[global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_CreateTransition")]
public static extern global::System.IntPtr ViewWrapperImpl_CreateTransition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+ [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_CreateTransition")]
+ public static extern global::System.IntPtr View_CreateTransition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
[global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_EmitKeyInputFocusSignal")]
public static extern void ViewWrapperImpl_EmitKeyInputFocusSignal(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2);
Bezier
}
+ internal static string BuiltinToPropertyKey(BuiltinFunctions? alphaFunction)
+ {
+ string propertyKey = null;
+ if (alphaFunction != null)
+ {
+ switch (alphaFunction)
+ {
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
+ {
+ propertyKey = "LINEAR";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
+ {
+ propertyKey = "REVERSE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
+ {
+ propertyKey = "EASE_IN_SQUARE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
+ {
+ propertyKey = "EASE_OUT_SQUARE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
+ {
+ propertyKey = "EASE_IN";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
+ {
+ propertyKey = "EASE_OUT";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
+ {
+ propertyKey = "EASE_IN_OUT";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
+ {
+ propertyKey = "EASE_IN_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
+ {
+ propertyKey = "EASE_OUT_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
+ {
+ propertyKey = "EASE_IN_OUT_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
+ {
+ propertyKey = "BOUNCE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
+ {
+ propertyKey = "SIN";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
+ {
+ propertyKey = "EASE_OUT_BACK";
+ break;
+ }
+ default:
+ {
+ propertyKey = "DEFAULT";
+ break;
+ }
+ }
+ }
+ return propertyKey;
+ }
}
-
}
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
- //you can override it to clean-up your own resources.
+ // you can override it to clean-up your own resources.
protected override void Dispose(DisposeTypes type)
{
if(disposed)
internal static readonly int CLIPPING_MODE = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get();
}
-
/// <summary>
/// Describes the direction to move the focus towards.
/// </summary>
}
/// <summary>
+ /// Create an Animation to animate the background color visual. If there is no
+ /// background visual, creates one with transparent black as it's mixColor.
+ /// </summary>
+ public Animation AnimateBackgroundColor( object destinationValue,
+ int startTime,
+ int endTime,
+ AlphaFunction.BuiltinFunctions? alphaFunction = null,
+ object initialValue = null)
+ {
+ Tizen.NUI.PropertyMap background = Background;
+
+ if( background.Empty() )
+ {
+ // If there is no background yet, ensure there is a transparent
+ // color visual
+ BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
+ background = Background;
+ }
+ return AnimateColor( "background", destinationValue, startTime, endTime, alphaFunction, initialValue );
+ }
+
+ /// <summary>
+ /// Create an Animation to animate the mixColor of the named visual.
+ /// </summary>
+ public Animation AnimateColor( string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null )
+ {
+ Animation animation = null;
+ {
+ PropertyMap _animator = new PropertyMap();
+ if( alphaFunction != null )
+ {
+ _animator.Add("alphaFunction", new PropertyValue( AlphaFunction.BuiltinToPropertyKey(alphaFunction) ) );
+ }
+
+ PropertyMap _timePeriod = new PropertyMap();
+ _timePeriod.Add( "duration", new PropertyValue((endTime-startTime)/1000.0f) );
+ _timePeriod.Add( "delay", new PropertyValue( startTime/1000.0f ) );
+ _animator.Add( "timePeriod", new PropertyValue( _timePeriod ) );
+
+ PropertyMap _transition = new PropertyMap();
+ _transition.Add( "animator", new PropertyValue( _animator ) );
+ _transition.Add( "target", new PropertyValue( targetVisual ) );
+ _transition.Add( "property", new PropertyValue( "mixColor" ) );
+
+ if( initialColor != null )
+ {
+ PropertyValue initValue = PropertyValue.CreateFromObject( initialColor );
+ _transition.Add( "initialValue", initValue );
+ }
+
+ PropertyValue destValue = PropertyValue.CreateFromObject( destinationColor );
+ _transition.Add( "targetValue", destValue );
+ TransitionData _transitionData = new TransitionData( _transition );
+
+ animation = new Animation( NDalicManualPINVOKE.View_CreateTransition(swigCPtr, TransitionData.getCPtr(_transitionData)), true );
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ return animation;
+ }
+
+ /// <summary>
/// mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map.
/// </summary>
public string BackgroundImage
}
}
- /// <summary>
- /// mutually exclusive with BACKGROUND_COLOR & BACKGROUND_IMAGE, type Map or string for URL.
- /// </summary>
public Tizen.NUI.PropertyMap Background
{
get
{
Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
- GetProperty(View.Property.BACKGROUND).Get(temp);
+ GetProperty( View.Property.BACKGROUND ).Get(temp);
return temp;
}
set
}
}
+
/// <summary>
/// The current state of the view.
/// </summary>