}
- public void Initialize(object source, AUIApplicationInitEventArgs e)
+ public void Initialize(object source, NUIApplicationInitEventArgs e)
{
CreateScrollView();
}
private void CreateScrollView()
{
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE;
+ stage.BackgroundColor = Color.White;
// Create a scroll view
_scrollView = new ScrollView();
- Vector2 stageSize = stage.Size;
- _scrollView.Size = new Vector3(stageSize.x, stageSize.y, 0.0f);
+ Size2D stageSize = stage.Size;
+ _scrollView.Size = new Position(stageSize.Width, stageSize.Height, 0.0f);
_scrollView.ParentOrigin = NDalic.ParentOriginCenter;
_scrollView.AnchorPoint = NDalic.AnchorPointCenter;
stage.Add(_scrollView);
pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
pageActor.ParentOrigin = NDalic.ParentOriginCenter;
pageActor.AnchorPoint = NDalic.AnchorPointCenter;
- pageActor.Position = new Vector3(pageColumn * stageSize.x, pageRow * stageSize.y, 0.0f);
+ pageActor.Position = new Position(pageColumn * stageSize.Width, pageRow * stageSize.Height, 0.0f);
// Add images in a 3x4 grid layout for each page
int imageRows = 4;
int imageColumns = 3;
float margin = 10.0f;
- Vector3 imageSize = new Vector3((stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0f);
+ Position imageSize = new Position((stageSize.Width / imageColumns) - margin, (stageSize.Height/ imageRows) - margin, 0.0f);
for(int row = 0; row < imageRows; row++)
{
imageView.ParentOrigin = NDalic.ParentOriginCenter;
imageView.AnchorPoint = NDalic.AnchorPointCenter;
imageView.Size = imageSize;
- imageView.Position = new Vector3( margin * 0.5f + (imageSize.x + margin) * column - stageSize.x * 0.5f + imageSize.x * 0.5f,
- margin * 0.5f + (imageSize.y + margin) * row - stageSize.y * 0.5f + imageSize.y * 0.5f, 0.0f );
+ imageView.Position = new Position( margin * 0.5f + (imageSize.X + margin) * column - stageSize.Width * 0.5f + imageSize.X * 0.5f,
+ margin * 0.5f + (imageSize.Y + margin) * row - stageSize.Height * 0.5f + imageSize.Y * 0.5f, 0.0f );
pageActor.Add(imageView);
}
}
// Set scroll view to have 3 pages in X axis and allow page snapping,
// and also disable scrolling in Y axis.
- RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.width));
+ RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.Width));
RulerPtr scrollRulerY = new RulerPtr(new DefaultRuler());
- scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.width * pageColumns, true));
+ scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.Width * pageColumns, true));
scrollRulerY.Disable();
_scrollView.SetRulerX(scrollRulerX);
_scrollView.SetRulerY(scrollRulerY);
_scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
_scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
_scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
- _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
+ _scrollBar.Orientation = new Rotation( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
_scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
_scrollView.Add(_scrollBar);
_scrollView.WheelMoved += Onwheel;
_scrollView.KeyInputFocusGained += OnKey;
_text = new TextLabel("View Touch Event Handler Test");
- _text.ParentOrigin = NDalic.ParentOriginCenter;
- _text.AnchorPoint = NDalic.AnchorPointCenter;
+ _text.AnchorPoint = NDalic.AnchorPointTopLeft;
_text.HorizontalAlignment = "CENTER";
_text.PointSize = 48.0f;
}
// Callback for _animation finished signal handling
- public void AnimationFinished(object source, Animation.FinishedEventArgs e)
+ public void AnimationFinished(object sender, EventArgs e)
{
Console.WriteLine("Customized Animation Finished Event handler");
- Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
}
private void OnKey(object source, View.KeyInputFocusGainedEventArgs e)
{
Console.WriteLine("View TOUCH EVENT callback....");
// Only animate the _text label when touch down happens
- if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ if( e.Touch.GetState(0) == PointStateType.DOWN )
{
Console.WriteLine("Customized Stage Touch event handler");
// Create a new _animation
_animation = new Animation(1.0f); // 1 second of duration
- _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f));
- _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Rotation( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Rotation( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
// Connect the signal callback for animaiton finished signal
_animation.Finished += AnimationFinished;
Console.WriteLine("View OnRelayoutEventArgs EVENT callback....");
// Set the correct scroll bar size after size negotiation of scroll view is done
- _scrollBar.Size = new Vector3(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
+ _scrollBar.Size = new Position(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
}
public void MainLoop()