public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View(); frontView = new TextLabel { Size = new Size(300, 300), Text = "Front View", Position = new Position(150, 170), PointSize = 11, BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f), }; frontView.TouchEvent += OnFrontTouchEvent; backView = new TextLabel { Size = new Size(300, 300), Text = "Back View", Position = new Position(50, 70), PointSize = 11, BackgroundColor = new Color(1.0f, 1.0f, 0.0f, 1.0f), }; mGestureDetector = new GestureDetectorManager(backView, new MyGestureListener()); backView.TouchEvent += OnBackTouchEvent; backView.Add(frontView); root.Add(backView); window.Add(root); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View(); frontView = new View { Size = new Size(300, 300), Position = new Position(150, 170), BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f), }; frontView.TouchEvent += OnFrontTouchEvent; // The default the maximum allowed time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetDoubleTapTimeout(300); tapGestureDetector = new TapGestureDetector(); tapGestureDetector.Attach(frontView); tapGestureDetector.SetMaximumTapsRequired(2); tapGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnTap {e.TapGesture.NumberOfTaps}\n"); }; backView = new TextLabel { Size = new Size(300, 300), Text = "Back View", Position = new Position(50, 70), PointSize = 11, BackgroundColor = new Color(1.0f, 1.0f, 0.0f, 1.0f), }; backView.TouchEvent += OnBackTouchEvent; // The default the minimum holding time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetLongPressMinimumHoldingTime(300); longPressGestureDetector = new LongPressGestureDetector(); longPressGestureDetector.Attach(backView); longPressGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnLongPress\n"); }; backView.Add(frontView); root.Add(backView); window.Add(root); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); // If this is set to true, all views are created with GrabTouchAfterLeave set to true. View.SetDefaultGrabTouchAfterLeave(true); root = new View { Layout = new AbsoluteLayout(), WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, }; var textLabel = new TextLabel { Size = new Size(300, 300), MultiLine = true, BackgroundColor = Color.Grey, WidthSpecification = LayoutParamPolicies.MatchParent, }; // greenView is created with the size 250x250 and GrabTouchAfterLeave=true var greenView = new View() { Size = new Size(300, 300), Position = new Position(50, 320), BackgroundColor = Color.Green, }; textLabel.Text = "greenView GrabTouchAfterLeave : " + greenView.GrabTouchAfterLeave; greenView.TouchEvent += (s, e) => { Tizen.Log.Error("NUI", $"greenView {e.Touch.GetState(0)}\n"); return(true); }; // If userTheme is applied, Theme userTheme = new Theme(); userTheme.AddStyle("Tizen.NUI.BaseComponents.TextLabel", new TextLabelStyle() { Size = new Size(500, 500), }); ThemeManager.ApplyTheme(userTheme); // BlueView is created with size 500x500 defined in userTheme and GrabTouchAfterLeave=true var blueView = new TextLabel (new TextLabelStyle { Size = new Size(300, 300), Text = "BlueView", }) { Position = new Position(10, 100), BackgroundColor = Color.Blue, }; textLabel.Text += "\nblueView GrabTouchAfterLeave : " + blueView.GrabTouchAfterLeave; blueView.TouchEvent += (s, e) => { Tizen.Log.Error("NUI", $"blueView {e.Touch.GetState(0)}\n"); return(true); }; // BlueView is created with size 100x100 defined in userStyle and GrabTouchAfterLeave=true var redView = new TextLabel (new TextLabelStyle { PixelSize = 24, Size = new Size(100, 100), }) { Text = "RedView", Position = new Position(50, 120), BackgroundColor = Color.Red, }; textLabel.Text += "\redView GrabTouchAfterLeave : " + redView.GrabTouchAfterLeave; redView.TouchEvent += (s, e) => { Tizen.Log.Error("NUI", $"redView {e.Touch.GetState(0)}\n"); return(true); }; greenView.Add(blueView); blueView.Add(redView); root.Add(textLabel); root.Add(greenView); window.Add(root); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View(); window.WheelEvent += (s, e) => { Tizen.Log.Error("NUI", $"window WheelEvent!!!!{e.Wheel.Type}\n"); }; frontView = new View { Size = new Size(300, 300), Position = new Position(150, 170), BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f), Focusable = true, FocusableInTouch = true, }; frontView.TouchEvent += OnFrontTouchEvent; frontView.WheelEvent += (s, e) => { Tizen.Log.Error("NUI", $"frontView WheelEvent!!!!{e.Wheel.Type}\n"); if (e.Wheel.Type == Wheel.WheelType.CustomWheel) { // rotary event } else if (e.Wheel.Type == Wheel.WheelType.MouseWheel) { // mouse wheel event } return(false); }; var middleView = new View { Size = new Size(300, 300), Position = new Position(110, 120), BackgroundColor = new Color(0.0f, 1.0f, 0.0f, 1.0f), Focusable = true, FocusableInTouch = true, }; // The default the maximum allowed time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetDoubleTapTimeout(300); tapGestureDetector = new TapGestureDetector(); tapGestureDetector.Attach(frontView); tapGestureDetector.SetMaximumTapsRequired(2); tapGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnTap {e.TapGesture.NumberOfTaps}\n"); }; backView = new TextLabel { Size = new Size(300, 300), Text = "Back View", Position = new Position(50, 70), PointSize = 11, BackgroundColor = new Color(1.0f, 1.0f, 0.0f, 1.0f), Focusable = true, FocusableInTouch = true, }; backView.TouchEvent += OnBackTouchEvent; backView.WheelEvent += (s, e) => { Tizen.Log.Error("NUI", $"backView WheelEvent!!!!{e.Wheel.Type}\n"); return(true); }; // The default the minimum holding time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetLongPressMinimumHoldingTime(300); longPressGestureDetector = new LongPressGestureDetector(); longPressGestureDetector.Attach(backView); longPressGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnLongPress\n"); }; backView.Add(middleView); backView.Add(frontView); root.Add(backView); window.Add(root); }