예제 #1
0
                /// <summary>
                /// Creates and initializes a new instance of the MoreOption class.
                /// </summary>
                /// <param name="parent">The Efl.Ui.Widget to which the new MoreOption will be attached as a child.</param>
                /// <since_tizen> 6 </since_tizen>
                public MoreOption(Efl.Ui.Widget parent) : base(new Efl.Eo.Globals.WrappingHandle(Interop.Eext.eext_more_option_add(parent.NativeHandle)))
                {
                    smartClicked = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        MoreOptionItem clickedItem = FindItemByNativeHandle(e);
                        if (clickedItem != null)
                        {
                            ClickedEvt?.Invoke(this, new MoreOptionItemEventArgs {
                                item = clickedItem
                            });
                        }
                    });

                    smartSelected = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        MoreOptionItem selectedItem = FindItemByNativeHandle(e);
                        if (selectedItem != null)
                        {
                            SelectedEvt?.Invoke(this, new MoreOptionItemEventArgs {
                                item = selectedItem
                            });
                        }
                    });

                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemClickedEventName, smartClicked, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemSelectedEventName, smartSelected, IntPtr.Zero);
                }
예제 #2
0
                /// <summary>
                /// Creates and initializes a new instance of the RotarySelector class.
                /// </summary>
                /// <param name="parent">The Efl.Ui.Widget to which the new RotarySelector will be attached as a child.</param>
                /// <since_tizen> 6 </since_tizen>
                public RotarySelector(Efl.Ui.Widget parent) : base(Interop.Eext.eext_rotary_selector_add(parent.NativeHandle))
                {
                    smartClicked = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        RotarySelectorItem clickedItem = FindItemByNativeHandle(e);
                        if (clickedItem != null)
                        {
                            ClickedEvt?.Invoke(this, new RotarySelectorItemEventArgs {
                                item = clickedItem
                            });
                        }
                    });

                    smartSelected = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        RotarySelectorItem selectedItem = FindItemByNativeHandle(e);
                        if (selectedItem != null)
                        {
                            SelectedEvt?.Invoke(this, new RotarySelectorItemEventArgs {
                                item = selectedItem
                            });
                        }
                    });

                    smartDeleted = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        RotarySelectorItem deletedItem = FindItemByNativeHandle(e);
                        if (deletedItem != null)
                        {
                            Deleted?.Invoke(this, new RotarySelectorItemEventArgs {
                                item = deletedItem
                            });
                        }
                        Items.Remove(deletedItem);
                    });

                    smartReordered = new Interop.Evas.SmartCallback((d, o, e) =>
                    {
                        var items_list = Interop.Eext.eext_rotary_selector_items_get(this.NativeHandle);
                        int idx        = Eina.ListNativeFunctions.eina_list_data_idx(items_list, e);
                        RotarySelectorItem reorderedItem = FindItemByNativeHandle(e);
                        if (reorderedItem != null)
                        {
                            Reordered?.Invoke(this, new RotarySelectorItemReorderedEventArgs
                            {
                                item = reorderedItem, OldIndex = Items.IndexOf(reorderedItem), NewIndex = idx
                            });
                        }
                        UpdateListOrder(reorderedItem, idx);
                    });

                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemClickedEventName, smartClicked, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemSelectedEventName, smartSelected, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemDeletedEventName, smartDeleted, IntPtr.Zero);
                    Interop.Evas.evas_object_smart_callback_add(this.NativeHandle, ItemReorderedEventName, smartReordered, IntPtr.Zero);
                }