Пример #1
0
 // handling if the "button" to the right of an item is clicked..
 private void ListBoxExtension_MouseClick(object sender, MouseEventArgs e)
 {
     // if an image is set, assume it will be wanted to be visible as well..
     if (_RightImage != null && _RightImageScaled != null)
     {
         // get the point where the mouse was clicked..
         Point point      = new Point(e.X, e.Y);
         int   clickIndex = IndexFromPoint(point); // ..and get an item's index on the point..
         if (clickIndex != -1)                     // if an index was found..
         {
             Point p2 = new Point(e.X, 0);         // check if the click hit the "button"..
             if (RightButtonRectangle.Contains(p2))
             {
                 // raise an event for the "button" click if subscribed..
                 ButtonClicked?.Invoke(this, new ListBoxButtonClickEventArgs()
                 {
                     ItemIndex = clickIndex, Item = Items[clickIndex]
                 });
             }
             else
             {
                 // raise an event for the item click if subscribed..
                 ItemClicked?.Invoke(this, new ListBoxButtonClickEventArgs()
                 {
                     ItemIndex = clickIndex, Item = Items[clickIndex]
                 });
             }
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Creates and initializes a new instance of the MultiButtonEntry class.
        /// </summary>
        /// <param name="parent">The parent is a given container, which will be attached by the MultiButtonEntry as a child. It's <see cref="EvasObject"/> type.</param>
        /// <since_tizen> preview </since_tizen>
        public MultiButtonEntry(EvasObject parent) : base(parent)
        {
            _clicked              = new SmartEvent(this, "clicked");
            _expanded             = new SmartEvent(this, "expanded");
            _contracted           = new SmartEvent(this, "contracted");
            _expandedStateChanged = new SmartEvent(this, "expand,state,changed");

            _itemSelected    = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,selected", MultiButtonEntryItemEventArgs.CreateFromSmartEvent);
            _itemClicked     = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,clicked", MultiButtonEntryItemEventArgs.CreateFromSmartEvent);
            _itemLongPressed = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,longpressed", MultiButtonEntryItemEventArgs.CreateFromSmartEvent);
            _itemAdded       = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,added", MultiButtonEntryItemEventArgs.CreateAndAddFromSmartEvent);

            _filterCallback = new Interop.Elementary.MultiButtonEntryItemFilterCallback(FilterCallbackHandler);
            _formatCallback = new Interop.Elementary.MultiButtonEntryFormatCallback(FormatCallbackHandler);

            _clicked.On              += (sender, e) => Clicked?.Invoke(this, EventArgs.Empty);
            _expanded.On             += (sender, e) => Expanded?.Invoke(this, EventArgs.Empty);
            _contracted.On           += (sender, e) => Contracted?.Invoke(this, EventArgs.Empty);
            _expandedStateChanged.On += (sender, e) => ExpandedStateChanged?.Invoke(this, EventArgs.Empty);

            _itemSelected.On    += (sender, e) => { ItemSelected?.Invoke(this, e); };
            _itemClicked.On     += (sender, e) => { ItemClicked?.Invoke(this, e); };
            _itemLongPressed.On += (sender, e) => { ItemLongPressed?.Invoke(this, e); };
            _itemAdded.On       += OnItemAdded;
        }
Пример #3
0
 public void SelectItem()
 {
     if (ItemClicked != null)
     {
         ItemClicked.Invoke(this, items[selectedItem]);
     }
 }
 public void OnItemClicked(IItemViewModel vm)
 {
     ItemClicked?.Invoke(this, new ItemClickedEventArgs()
     {
         SelectedItem = vm
     });
 }
Пример #5
0
        /// <summary>
        /// Adds a new defence to the menu.
        /// </summary>
        /// <param name="name">The name of the defence.</param>
        /// <param name="image">The image of the defence.</param>
        public void AddItem(string name, Texture2D image, int cost)
        {
            var item = new DefenceMenuItem(new Vector2(Size.X - Padding.X * 2 - Scrollbar.Size.X),
                                           name, image, cost);

            item.Click += (e) =>
            {
                ItemClicked?.Invoke();

                // Set the current selection to the default color if not null.
                if (SelectedItem != null)
                {
                    SelectedItem.FillColor = Color.White;
                }

                // If this is the current selection, clear it.
                if (e == SelectedItem)
                {
                    SelectedItem = null;
                }
                // If the player has enough points, select this item.
                else if (stats.Points >= e.Cost)
                {
                    SelectedItem           = e;
                    SelectedItem.FillColor = Color.RoyalBlue;
                }
            };

            AddChild(item);
        }
Пример #6
0
 /// <summary>
 /// Notify clients that an item was selected.
 /// </summary>
 protected void InvokeItemClicked(Item itemClicked)
 {
     if (ItemClicked != null)
     {
         ItemClicked.Invoke(itemClicked);
     }
 }
Пример #7
0
 private void OnItemClicked(int position)
 {
     ItemClicked?.Invoke(this, new NotificationItemClickedEventArgs
     {
         Position = position
     });
 }
Пример #8
0
        public BodyItemsControl(IGuiServices guiServices) : base(guiServices)
        {
            _manImage = GuiServices.ImagesStore.GetImage("equipment.man");

            _headContainer = new ItemContainer(GuiServices)
            {
                IsTransparent = true
            };
            _torseContainer     = new ItemContainer(GuiServices);
            _feetsContainer     = new ItemContainer(GuiServices);
            _leftHandContainer  = new ItemContainer(GuiServices);
            _rightHandContainer = new ItemContainer(GuiServices);

            AddElement(_headContainer);
            AddElement(_torseContainer);
            AddElement(_feetsContainer);
            AddElement(_leftHandContainer);
            AddElement(_rightHandContainer);

            _headContainer.Clicked      += args => ItemClicked?.Invoke(ItemSlotType.Head, args);
            _torseContainer.Clicked     += args => ItemClicked?.Invoke(ItemSlotType.Torse, args);
            _feetsContainer.Clicked     += args => ItemClicked?.Invoke(ItemSlotType.Feets, args);
            _leftHandContainer.Clicked  += args => ItemClicked?.Invoke(ItemSlotType.LeftHand, args);
            _rightHandContainer.Clicked += args => ItemClicked?.Invoke(ItemSlotType.RightHand, args);
        }
Пример #9
0
 protected override void OnMouseClick(MouseEventArgs e)
 {
     if (ItemClicked != null)
     {
         ItemClicked.Invoke(this, new EventArgs());
     }
 }
Пример #10
0
        private void Control_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            var item = sender as ContentControl;

            item.Scale(1, 1, (float)item.ActualWidth / 2, (float)item.ActualHeight / 2, _animationDuration).Start();
            ItemClicked?.Invoke(this, new SpaceViewItemClickedEventArgs(item, item.DataContext));
        }
Пример #11
0
        public void Build(ToolBarItem item)
        {
            var btn = new CustomButton
            {
                Padding           = new Thickness(0, 0, 0, 0),
                HorizontalOptions = item.Float == Float.Left ? LayoutOptions.Start : LayoutOptions.End,
                Style             = (Style)Application.Current.Resources["ButtonContainer"],
                TextColor         = (Color)Application.Current.Resources["text"],
                WidthRequest      = item.Width,
                HeightRequest     = this.Height
            };

            if (!string.IsNullOrWhiteSpace(item.Text))
            {
                btn.Text          = item.Text;
                btn.Padding       = new Thickness(1, 0, 1, 0);
                btn.FontSize      = 12;
                btn.TextAlignment = TextAlignment.Start;
            }
            else
            {
                btn.FontSize = 0;
            }

            if (item.Icon != null)
            {
                btn.ImageSource = item.Icon;
            }
            if (ItemClicked != null)
            {
                btn.Clicked += new EventHandler((sender, e) => ItemClicked.Invoke(item, btn));
            }

            this.Children.Add(btn);
        }
Пример #12
0
 private void item_Clicked(MenuItem i_MenuItem)
 {
     if (ItemClicked != null)
     {
         ItemClicked.Invoke(i_MenuItem);
     }
 }
Пример #13
0
        internal Button InternalAdd(Options options)
        {
            Button btn = new Button
            {
                IconChar                = options.IconChar,
                Text                    = options.Text,
                IconColor               = options.DefaultColor,
                ForeColor               = options.DefaultColor,
                DefaultColor            = options.DefaultColor,
                HighlightColor          = options.HighlightColor,
                Height                  = options.IconSize + (options.IconSize / 2),
                FlatAppearance          = { BorderSize = 0 },
                FlatStyle               = FlatStyle.Flat,
                IconSize                = options.IconSize,
                Dock                    = DockStyle.Top,
                ImageAlign              = ContentAlignment.MiddleLeft,
                TextAlign               = ContentAlignment.MiddleLeft,
                TextImageRelation       = TextImageRelation.ImageBeforeText,
                Padding                 = new Padding(10, 0, 20, 0),
                Font                    = new Font("Century Gothic", 10, FontStyle.Bold),
                UseVisualStyleBackColor = true,
                Cursor                  = Cursors.Hand
            };

            btn.Click += (sender, e) =>
            {
                ItemClicked?.Invoke(btn, EventArgs.Empty);
                ActivateButton(sender);
            };

            Controls.Add(btn);
            Controls.SetChildIndex(btn, 0);

            return(btn);
        }
Пример #14
0
        /// <summary>
        ///     Resets this object.
        /// </summary>
        public void Reset()
        {
            DisableButton();
            _leftBorderBtn.Visible = false;

            ItemClicked?.Invoke(this, EventArgs.Empty);
        }
 public void SetListeners(ItemPulled pulled, ItemClicked clicked, ItemReleased released, CarouselSettled settled = null, CarouselStartedScrolling scrolling = null)
 {
     this.m_itemPulledListener               = pulled;
     this.m_itemClickedListener              = clicked;
     this.m_itemReleasedListener             = released;
     this.m_carouselSettledListener          = settled;
     this.m_carouselStartedScrollingListener = scrolling;
 }
 private void OnDestroy()
 {
     this.m_itemPulledListener               = null;
     this.m_itemClickedListener              = null;
     this.m_itemReleasedListener             = null;
     this.m_carouselSettledListener          = null;
     this.m_carouselStartedScrollingListener = null;
 }
 private void OnItemClicked(int position, OpenNotification sbn)
 {
     ItemClicked?.Invoke(this, new NotificationItemClickedEventArgs
     {
         Position = position,
         StatusBarNotification = sbn
     });
 }
Пример #18
0
 private void Liste_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (auswahlListe.SelectedItem != null)
     {
         Userstory auswahl = (Userstory)auswahlListe.SelectedItem;
         ItemClicked.Invoke(auswahl.UserstoryId, EventArgs.Empty);
     }
 }
Пример #19
0
 protected virtual void OnItemClicked()
 {
     if (ItemClicked != null)
     {
         Console.WriteLine(this.m_MenuItemTitle);
         ItemClicked.Invoke();
     }
 }
Пример #20
0
        public void RaiseItemClicked(Point point)
        {
            var eventargs = new GestureEventArgs()
            {
                GesturePoint = point
            };

            ItemClicked?.Invoke(this, eventargs);
        }
Пример #21
0
        private void TapGesture_Tapped(object sender, EventArgs e)
        {
            var index = this.Children.IndexOf(sender as View);

            ItemClicked?.Invoke(this, new UniformImagePaneItemClickedEventArgs()
            {
                Index = index
            });
        }
Пример #22
0
 private void OnPointerClick(Vector2 localPosition)
 {
     (int x, int y) = PositionToGridIdx(localPosition);
     if (_grid[y, x] != null)
     {
         Debug.Log($"x:y {x}:{y}");
         ItemClicked?.Invoke(_grid[y, x], x, y);
     }
 }
Пример #23
0
        public MyMenuItem Add(MyMenuItem item)
        {
            base.Add(item);

            item.Click += (e) => ItemClicked?.Invoke(item);

            MenuItemAdded?.Invoke(item);
            return(item);
        }
Пример #24
0
 private void Control_KeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Enter || e.Key == Windows.System.VirtualKey.Space || e.Key == Windows.System.VirtualKey.GamepadA)
     {
         var item = sender as ContentControl;
         item.Scale(0.9f, 0.9f, (float)item.ActualWidth / 2, (float)item.ActualHeight / 2, _animationDuration).Start();
         ItemClicked?.Invoke(this, new SpaceViewItemClickedEventArgs(item, item.DataContext));
     }
 }
Пример #25
0
        public bool ShowNext(bool fromStart, bool doubleClick)
        {
            int wrappedCount = 0;

            if ((items != null && items.Count > 0))
            {
                do
                {
                    if (fromStart)
                    {
                        selectedItem = 0;
                        fromStart    = false;
                    }
                    else
                    {
                        if (selectedItem < items.Count - 1)
                        {
                            selectedItem++;
                        }
                        else
                        {
                            selectedItem = 0;
                            wrappedCount++;
                        }
                    }
                }while ((((IThumbnail)items[selectedItem]).IsFolder || (items[selectedItem]) is FolderUp) && wrappedCount < 2);

                if (wrappedCount > 1)
                {
                    return(false);
                }

                if (doubleClick)
                {
                    if (ItemDoubleClicked != null)
                    {
                        ItemDoubleClicked.Invoke(this, items[selectedItem]);
                    }
                }
                else
                {
                    if (ItemClicked != null)
                    {
                        if (selectedItem != -1)
                        {
                            ItemClicked.Invoke(this, items[selectedItem]);
                        }
                    }
                }
                startIndex = ((selectedItem) / ItemsPerPage) * ItemsPerPage;
                Invalidate();
                UpdatePaginator();
                return(selectedItem > -1);
            }
            return(false);
        }
Пример #26
0
 public void ShowCurrent()
 {
     if (ItemClicked != null)
     {
         if (selectedItem != -1)
         {
             ItemClicked.Invoke(this, items[selectedItem]);
         }
     }
 }
Пример #27
0
        private void rect_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (flag)
            {
                ItemClicked?.Invoke(this, new EventArgs());
            }

            ClearUC.Utils.AnimationHelper.Double da = new ClearUC.Utils.AnimationHelper.Double();
            da.Animate(rect.Opacity, 0.5, Config.Current.iValue[Enums.iValue.DefaultAnimation], null, OpacityProperty, rect);
        }
Пример #28
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (!Focused && Focusable)
            {
                Focus();
            }

            int endHeight     = vertical ? Height : Width;
            int endWidth      = vertical ? Width : Height;
            int rowLength     = RowLength();
            int maxSize       = 0;
            int currentHeight = 0;
            int currentWidth  = 0;
            int rowSize       = 0;

            for (int i = topIndex; i < Items.Count; i++)
            {
                ListItem item = Items[i];
                if (!item.Visible)
                {
                    continue;
                }

                int height = vertical ? item.Height : item.Width;
                int width  = vertical ? item.Width : item.Height;
                if (height > maxSize)
                {
                    maxSize = height;
                }
                rowSize++;

                if (CheckBounds(e.Location, vertical ? currentWidth : currentHeight, vertical ? currentHeight : currentWidth, item.Width, item.Height))
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        SelectedIndex = i;
                    }
                    ItemClicked?.Invoke(item, e.Button);
                    break;
                }
                currentWidth += width;

                if (rowSize == rowLength)
                {
                    currentHeight += maxSize;
                    currentWidth   = 0;
                    maxSize        = 0;
                    rowSize        = 0;
                    if (currentHeight >= endHeight)
                    {
                        break;
                    }
                }
            }
        }
Пример #29
0
 private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (DisassemblyListBox.SelectedItem is DisassemblyItemViewModel disItem)
     {
         if (e.ClickCount == 1 && !_isInClick)
         {
             ItemClicked?.Invoke(this, new DisassemblyItemSelectedEventArgs(disItem));
         }
         _isInClick = false;
     }
 }
Пример #30
0
 protected virtual void OnClicked()
 {
     if (ItemClicked != null)
     {
         ItemClicked.Invoke();
     }
     else
     {
         throw new NotImplementedException("Empty delegate.");
     }
 }