예제 #1
0
        private void UpdateActiveState()
        {
            PseudoClasses.Remove(PseudoClass_Inactive);
            PseudoClasses.Remove(PseudoClass_Active);
            Action action;

            PseudoClasses.Set(PseudoClass_Active, IsActive);
            PseudoClasses.Set(PseudoClass_Inactive, IsActive == false);

            //if (IsActive)
            //{  /*action = () =>*/
            //    this.PseudoClasses.Add(PseudoClass_Active);

            //}
            //else
            ///*action = () =>*/
            //{
            //    this.PseudoClasses.Add(PseudoClass_Inactive);

            //}

            //if (_deferredActions != null)
            //    _deferredActions.Add(action);
            //else
            //    action();
        }
예제 #2
0
        internal void SelectSingleItem(object item)
        {
            if (SelectedItem != item)
            {
                PseudoClasses.Remove(":normal");
                PseudoClasses.Add(":normal");
            }

            (SelectedItem as ISelectable).IsSelected = false;

            SelectedItems.Clear();
            SelectedItems.Add(item);

            (item as ISelectable).IsSelected = true;

            var item_parents = (item as ILogical).GetLogicalAncestors().OfType <NavigationViewItem>();

            foreach (NavigationViewItem n in item_parents)
            {
                n.IsExpanded = true;
            }

            Debug.WriteLine($"{item_parents.Count()}");

            SelectedItem = item;

//Sets the items of AutoCompleteBox
        }
예제 #3
0
        protected override void OnSelectionChanged(object sender, AvaloniaPropertyChangedEventArgs e)
        {
            base.OnSelectionChanged(sender, e);

            PseudoClasses.Remove(":normal");
            PseudoClasses.Add(":normal");
        }
예제 #4
0
        private void UpdatePseudoClasses()
        {
            PseudoClasses.Remove(PseudoClass_Active);
            PseudoClasses.Remove(PseudoClass_Inactive);

            PseudoClasses.Add(IsActive ? PseudoClass_Active : PseudoClass_Inactive);
        }
예제 #5
0
 protected virtual void OnDragLeave(object sender, RoutedEventArgs e)
 {
     if (Parent is AuraTabView atw && atw.ImmediateDrag)
     {
         PseudoClasses.Remove(":dragging");
     }
 }
예제 #6
0
        protected virtual void OnDrop(object sender, DragEventArgs e)
        {
            PseudoClasses.Remove(":dragging");


            if (true) //TODO: check if theirs parent are the same
            {
                ItemsControlOperations.MoveItemOnDrop <AuraTabView, AuraTabItem>(
                    sender,
                    e,
                    (view, src, item) =>
                {
                    int h = (view.Items as IList).IndexOf(item);


                    item.PseudoClasses.Remove(":dragging");
                    view.lastselectindex = view.SelectedIndex;
                    view.SelectedIndex   = h;
                    view.SelectedItem    = (view.Items as IList)[view.SelectedIndex];
                    var it = view.Items as IList <AuraTabItem>;
                });
                Debug.WriteLine("Drag completed");
                Debug.WriteLine($"Selected Index: {this.GetParentTOfLogical<AuraTabView>().SelectedIndex}");
                Debug.WriteLine($"Tab Index: {(this.GetParentTOfLogical<AuraTabView>().Items as IList).IndexOf(this)}");
            }
        }
예제 #7
0
        internal void SelectSingleItemCore(object item)
        {
            if (SelectedItem != item)
            {
                PseudoClasses.Remove(":normal");
                PseudoClasses.Add(":normal");
            }

            if (SelectedItem is not null)
            {
                (SelectedItem as ISelectable).IsSelected = false;
            }

            (item as ISelectable).IsSelected = true;

            SelectedItems.Clear();
            SelectedItems.Add(item);

            var item_parents = (item as ILogical).GetLogicalAncestors().OfType <NavigationViewItem>();

            if (this.IsOpen)
            {
                foreach (NavigationViewItem n in item_parents)
                {
                    n.IsExpanded = true;
                }
            }
            // Debug.WriteLine($"{item_parents.Count()}");

            SelectedItem = item;
        }
예제 #8
0
        public void Pause()
        {
            if (soundStream != null)
            {
                soundStream.Play();
            }

            PseudoClasses.Remove(":playing");
            PseudoClasses.Add(":paused");
        }
예제 #9
0
 protected void OnCanDraggablePropertyChanged(object sender, AvaloniaPropertyChangedEventArgs e)
 {
     if (CanBeDragged == true)
     {
         PseudoClasses.Add(":lockdrag");
     }
     else if (CanBeDragged == false)
     {
         PseudoClasses.Remove(":lockdrag");
     }
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScrollThumb"/> class.
 /// </summary>
 public ScrollThumb() : base()
 {
     GetScrollState().State.Subscribe(s =>
     {
         if (!s)
         {
             lastPoint = null;
             PseudoClasses.Remove(":pressed");
         }
     });
 }
예제 #11
0
        /// <inheritdoc/>
        protected override void OnPointerReleased(PointerReleasedEventArgs e)
        {
            base.OnPointerReleased(e);

            e.Device.Capture(null);
            PseudoClasses.Remove(":pressed");
            e.Handled = true;

            if (ClickMode == ClickMode.Release && new Rect(Bounds.Size).Contains(e.GetPosition(this)))
            {
                RaiseClickEvent();
            }
        }
예제 #12
0
 private void UpdatePseudoClasses(bool isOpen)
 {
     if (isOpen)
     {
         PseudoClasses.Remove(":closed");
         PseudoClasses.Add(":opened");
     }
     else
     {
         PseudoClasses.Remove(":opened");
         PseudoClasses.Add(":closed");
     }
 }
예제 #13
0
        /// <inheritdoc/>
        protected override void OnPointerReleased(PointerEventArgs e)
        {
            base.OnPointerReleased(e);

            e.Device.Capture(null);
            PseudoClasses.Remove(":pressed");
            e.Handled = true;

            if (ClickMode == ClickMode.Release && Classes.Contains(":pointerover"))
            {
                RaiseClickEvent();
            }
        }
예제 #14
0
        private void UpdatePseudoClasses(bool isCompact)
        {
            switch (isCompact)
            {
            case true:
                PseudoClasses.Add(":compact");
                break;

            case false:
                PseudoClasses.Remove("compact");
                break;
            }
        }
예제 #15
0
        /// <inheritdoc/>
        protected override void OnPointerReleased(PointerReleasedEventArgs e)
        {
            base.OnPointerReleased(e);
            if (LinkTo != null & e.InitialPressMouseButton == MouseButton.Left)
            {
                var parent = this.GetParentTOfVisual <NavigationView>();

                if (parent != null & this.PointerEffectivelyOver(e))
                {
                    parent.SelectSingleItem(LinkTo);
                }
            }

            PseudoClasses.Remove(":pressed");
        }
예제 #16
0
        protected virtual void OnClosed(object sender, RoutedEventArgs e)
        {
            PseudoClasses.Remove(":opened");
            PseudoClasses.Add(":closed");

            /*if (this.GetParentTOfLogical<Control>() is SuperNavigationView)
             * {
             *  return;
             * }
             * else if(this.GetParentTOfLogical<Control>() is SuperNavigationViewItem s)
             * {
             *  var p = this.GetParentTOfLogical<SuperNavigationView>();
             *
             *  s.IsSelected = true;
             *  p.SelectedItem = s;
             * }*/
        }
예제 #17
0
        private void ToggleWindowState()
        {
            switch (WindowState)
            {
            case WindowState.Maximized:
                WindowState = WindowState.Normal;
                //Restore to normal size
                PseudoClasses.Remove(":maximized");
                break;

            case WindowState.Normal:
                WindowState = WindowState.Maximized;
                //TODO: Make this not fullscreen
                //Maximize the window
                PseudoClasses.Add(":maximized");
                break;
            }
        }
예제 #18
0
        protected override void OnPointerReleased(PointerReleasedEventArgs e)
        {
            if (_lastPoint.HasValue)
            {
                e.Handled  = true;
                _lastPoint = null;

                var ev = new VectorEventArgs
                {
                    RoutedEvent = DragCompletedEvent,
                    Vector      = (Vector)e.GetPosition(this),
                };

                RaiseEvent(ev);
            }

            PseudoClasses.Remove(":pressed");
        }
예제 #19
0
        private void UpdateLargeState()
        {
            PseudoClasses.Remove(PseudoClass_Large);
            PseudoClasses.Remove(PseudoClass_Small);

            Action action;

            PseudoClasses.Set(PseudoClass_Large, IsLarge);
            PseudoClasses.Set(PseudoClass_Small, IsLarge == false);
            //if (IsLarge)
            //    /*action = () =>*/ this.PseudoClasses.Add(PseudoClass_Large);
            //else
            //    /*action = () =>*/ this.PseudoClasses.Add(PseudoClass_Small);

            //if (_deferredActions != null)
            //    _deferredActions.Add(action);
            //else
            //    action();
        }
예제 #20
0
        protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e)
        {
            if (_lastPoint.HasValue)
            {
                var ev = new VectorEventArgs
                {
                    RoutedEvent = DragCompletedEvent,
                    Vector      = _lastPoint.Value,
                };

                _lastPoint = null;

                RaiseEvent(ev);
            }

            PseudoClasses.Remove(":pressed");

            base.OnPointerCaptureLost(e);
        }
예제 #21
0
 private void TransportItem(object sender, DragEventArgs e)
 {
     PseudoClasses.Remove(":dragging");
     ItemsControlOperations.MoveItemOnDrop <AuraTabView, AuraTabItem>(
         sender,
         e,
         (view, src, item) =>
     {
         int h = (view.Items as IList).IndexOf(item);
         item.PseudoClasses.Remove(":dragging");
         view.lastselectindex = view.SelectedIndex;
         view.SelectedIndex   = h;
         view.SelectedItem    = (view.Items as IList)[view.SelectedIndex];
         var it = view.Items as IList <AuraTabItem>;
     });
     //Debug.WriteLine("Drag completed");
     //Debug.WriteLine($"Selected Index: {this.GetParentTOfLogical<AuraTabView>().SelectedIndex}");
     //Debug.WriteLine($"Tab Index: {(this.GetParentTOfLogical<AuraTabView>().Items as IList).IndexOf(this)}");
 }
예제 #22
0
        /// <inheritdoc/>
        protected override void OnPointerReleased(PointerReleasedEventArgs e)
        {
            base.OnPointerReleased(e);

            PseudoClasses.Remove(":dragging");
        }
예제 #23
0
 protected virtual void OnDragLeave(object sender, RoutedEventArgs e)
 {
     PseudoClasses.Remove(":dragging");
 }
예제 #24
0
        protected override IEnumerable <CGeometry> MeasureOverride(
            double entireWidth,
            double remainWidth)
        {
            var metrics = base.MeasureOverride(
                entireWidth,
                remainWidth);

            foreach (CGeometry metry in metrics)
            {
                metry.OnClick = () => Command?.Invoke(CommandParameter);

                metry.OnMousePressed = () =>
                {
                    PseudoClasses.Add(":pressed");
                };

                metry.OnMouseReleased = () =>
                {
                    PseudoClasses.Remove(":pressed");
                };

                metry.OnMouseEnter = () =>
                {
                    PseudoClasses.Add(":pointerover");
                    PseudoClasses.Add(":hover");


                    IEnumerable <TextGeometry> tmetries =
                        (metry is DecoratorGeometry d) ?
                        d.Targets.OfType <TextGeometry>() :
                        (metry is TextGeometry t) ?
                        new[] { t } :
                    new TextGeometry[0];

                    if (tmetries != null)
                    {
                        foreach (var tmetry in tmetries)
                        {
                            tmetry.TemporaryForeground = HoverForeground;
                            tmetry.TemporaryBackground = HoverBackground;
                        }
                        RequestRender();
                    }
                };

                metry.OnMouseLeave = () =>
                {
                    PseudoClasses.Remove(":pointerover");
                    PseudoClasses.Remove(":hover");

                    IEnumerable <TextGeometry> tmetries =
                        (metry is DecoratorGeometry d) ?
                        d.Targets.OfType <TextGeometry>() :
                        (metry is TextGeometry t) ?
                        new[] { t } :
                    new TextGeometry[0];

                    if (tmetries != null)
                    {
                        foreach (var tmetry in tmetries)
                        {
                            tmetry.TemporaryForeground = null;
                            tmetry.TemporaryBackground = null;
                        }
                        RequestRender();
                    }
                };

                yield return(metry);
            }
        }
예제 #25
0
 protected virtual void OnClosed(object sender, RoutedEventArgs e)
 {
     PseudoClasses.Remove(":opened");
     PseudoClasses.Add(":closed");
 }
예제 #26
0
 internal void RemovePseudoClasses(string name)
 {
     PseudoClasses.Remove(name);
 }
예제 #27
0
        /// <inheritdoc/>
        protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e)
        {
            base.OnPointerCaptureLost(e);

            PseudoClasses.Remove(":dragging");
        }
예제 #28
0
        /// <inheritdoc/>
        protected override void OnLostFocus(RoutedEventArgs e)
        {
            base.OnLostFocus(e);

            PseudoClasses.Remove(":dragging");
        }
예제 #29
0
        /// <inheritdoc/>
        protected override void OnPointerLeave(PointerEventArgs e)
        {
            base.OnPointerLeave(e);

            PseudoClasses.Remove(":dragging");
        }