Ejemplo n.º 1
0
        /// <summary>
        /// Start editing a cell in a given row and column. Yeah, the name is a little off.
        /// </summary>
        /// <param name="table">The <see cref=">NSTable"/> in which the edit operation is to occur.</param>
        /// <param name="column">The column number of the cell to edit.</param>
        /// <param name="row">The row number of the cell to edit.</param>
        internal static void EditColumn(this NSTableView table, nint column, nint row)
        {
            NSApplication.EnsureUIThread();
#if __UNIFIED__
            void_objc_msgSend_nint_nint_IntPtr_bool(table.Handle, SelEditColumnRowWithEventSelectHandle, column, row, System.IntPtr.Zero, true);
#else
            Messaging.void_objc_msgSend_int_int_IntPtr_bool(table.Handle, SelEditColumnRowWithEventSelectHandle, column, row, System.IntPtr.Zero, true);
#endif // __UNIFIED__
        }
Ejemplo n.º 2
0
 public override string GetTitle(UIPickerView pickerView, System.nint row, System.nint component)
 {
     //if (row == null)
     //{
     //    // Set the default selected unit
     //    //selectedUnit = list[0];
     //}
     //else
     //{
     return(list[(int)row]);
     //}
 }
Ejemplo n.º 3
0
        public void ChangeStatusBarColor(Color color)
        {
            bool isColorDark = color.ToCGColor().IsColorDark();

            //Status Bar property removed in iOS 13
            //TODO: Implement statusBarManager when bindings available from Xamarin
            //if (@available(iOS 13, *))
            //{
            //    UIView* statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame] ;
            //    statusBar.backgroundColor = [UIColor redColor];
            //    [[UIApplication sharedApplication].keyWindow addSubview:statusBar];
            //}
            if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
            {
                System.nint tag       = (System.nint) 38482458385;
                UIView      statusBar = UIApplication.SharedApplication.KeyWindow?.ViewWithTag(tag);
                if (statusBar != null)
                {
                    statusBar.BackgroundColor = color.ToUIColor();
                }
                else
                {
                    UIView statusBarView = new UIView(frame: UIApplication.SharedApplication.StatusBarFrame);
                    statusBarView.Tag = tag;

                    UIApplication.SharedApplication.KeyWindow?.AddSubview(statusBarView);
                    statusBarView.BackgroundColor = color.ToUIColor();
                }
            }
            else
            {
                UIApplication.SharedApplication.StatusBarStyle = isColorDark ? UIStatusBarStyle.LightContent : UIStatusBarStyle.Default;
                if (UIApplication.SharedApplication.RespondsToSelector(new ObjCRuntime.Selector("statusBar")))
                {
                    if (UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) is UIView statusBar)
                    {
                        statusBar.BackgroundColor = color.ToUIColor();
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public virtual System.nint RowsInSection(UIKit.UITableView tableview, System.nint section)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
            /// <inheritdoc/>
            public override bool ShouldEditTableColumn(NSTableView tableView, NSTableColumn tableColumn, nint row)
            {
                var programDescription = Programs.ArrangedObjects()[row] as ProgramDescriptionViewModel;
                var canEdit            = RomListCommandGroup.EditProgramNameCommand.CanExecute(ViewModel);

                if (canEdit)
                {
                    string initialValue = null;
                    var    column       = (RomListColumn)tableView.TableColumns().ToList().IndexOf(tableColumn);
                    int    maxLength    = -1;
                    System.Predicate <char> isValidCharacter = null;
                    switch (column)
                    {
                    case RomListColumn.Title:
                        canEdit      = true;
                        initialValue = programDescription.Name;
                        maxLength    = ProgramDescription.MaxProgramNameLength;
                        break;

                    case RomListColumn.Vendor:
                        canEdit      = true;
                        initialValue = programDescription.Vendor;
                        maxLength    = ProgramDescription.MaxVendorNameLength;
                        break;

                    case RomListColumn.Year:
                        canEdit          = true;
                        initialValue     = programDescription.Year;
                        maxLength        = ProgramDescription.MaxYearTextLength;
                        isValidCharacter = (c) => char.IsDigit(c);
                        break;

                    default:
                        break;
                    }
                    if (canEdit)
                    {
                        if (InPlaceEditor == null)
                        {
                            InPlaceEditor = new TextCellInPlaceEditor(tableView);
                        }
                        InPlaceEditor.EditingObject    = programDescription;
                        InPlaceEditor.InitialValue     = initialValue;
                        InPlaceEditor.MaxLength        = maxLength;
                        InPlaceEditor.IsValidCharacter = isValidCharacter;
                        InPlaceEditor.EditorClosed    += InPlaceEditor_EditorClosed;
                        InPlaceEditor.BeginEdit();
                    }
                }
                else if ((SingleInstanceApplication.Current.LastKeyPressed == 0x24) && (SingleInstanceApplication.Current.LastKeyPressedTimestamp != ReturnKeyTimestamp))
                {
                    // return was pressed
                    ReturnKeyTimestamp = SingleInstanceApplication.Current.LastKeyPressedTimestamp;
                    DebugItemChange(programDescription.Name);
                    ViewModel.Model.InvokeProgramFromDescription(programDescription.Model);
                }
                return(canEdit);
            }
Ejemplo n.º 6
0
 /// <inheritdoc/>
 public override NSString GetToolTip(NSTableView tableView, NSCell cell, ref CGRect rect, NSTableColumn tableColumn, nint row, CGPoint mouseLocation)
 {
     return(GetToolTip(cell, rect, tableColumn, row, mouseLocation));
 }
Ejemplo n.º 7
0
 public override System.nfloat GetHeightForHeader(UITableView tableView, System.nint section)
 {
     return(_source.GetHeightForHeader(tableView, section));
 }
 /// <inheritdoc/>
 public override bool ShouldHideDivider(NSSplitView splitView, nint dividerIndex)
 {
     return(true);
 }
Ejemplo n.º 9
0
 public override System.nint GetRowsInComponent(UIPickerView pickerView, System.nint component)
 {
     return(list.Count);
 }
Ejemplo n.º 10
0
 public override System.nint RowsInSection(UITableView tableView, System.nint section)
 {
     return(_astronauts?.Count ?? 0);
 }
Ejemplo n.º 11
0
 public override System.nint RowsInSection(UITableView tableview, System.nint section)
 {
     return(Sessions.Count(s => s.Day == TitleForHeader(tableview, section)));
 }
            /// <inheritdoc/>
            public override void WillDisplayCell(NSTableView tableView, NSObject cell, NSTableColumn tableColumn, nint row)
            {
                var textCell = cell as NSTextFieldCell;

                if (textCell != null)
                {
                }
            }
Ejemplo n.º 13
0
 public static extern int IOCancelPowerChange(System.IntPtr kernelPort, nint notificationId);
            /// <inheritdoc/>
            public override NSCell GetDataCell(NSTableView tableView, NSTableColumn tableColumn, nint row)
            {
                NSTextFieldCell cell = null;

                if (tableColumn != null)
                {
                    cell = tableColumn.DataCellForRow(row) as NSTextFieldCell;
                    var element = DataContext.AvailableSerialPorts[(int)row];
                    if (DataContext.DisabledSerialPorts.Contains(element.PortName))
                    {
                        cell.Enabled   = false;
                        cell.TextColor = NSColor.DisabledControlText;
                    }
                    else
                    {
                        cell.Enabled   = true;
                        cell.TextColor = NSColor.ControlText;
                    }
                }
                return(cell);
            }
Ejemplo n.º 15
0
            private NSString GetToolTip(NSCell cell, CGRect rect, NSTableColumn tableColumn, nint row, CGPoint mouse)
            {
                var programDescription = Programs.ArrangedObjects()[row] as ProgramDescriptionViewModel;
                var toolTip            = string.Empty;

                if (cell is NSImageCell)
                {
                    if (tableColumn.Identifier == "icon")
                    {
                        toolTip = programDescription.RomFileStatus;
                    }
                    else if (tableColumn.Identifier == "features")
                    {
                        var    space           = INTV.Shared.Converter.ProgramFeaturesToImageTransformer.Padding;
                        var    offsetIntoImage = mouse.X - rect.X;
                        nfloat leftEdgeOfImage = 0;
                        for (int i = 0; string.IsNullOrEmpty(toolTip) && (i < programDescription.Features.Count); ++i)
                        {
                            var feature          = programDescription.Features[i];
                            var rightEdgeOfImage = leftEdgeOfImage + feature.Image.Size.Width + (space / 2);
                            if ((leftEdgeOfImage <= offsetIntoImage) && (offsetIntoImage <= rightEdgeOfImage))
                            {
                                toolTip = feature.ToolTip;
                            }
                            else
                            {
                                leftEdgeOfImage += feature.Image.Size.Width + space;
                            }
                        }
                    }
                }
#if false
                // By leaving the string as empty, we get default behavior for tool tip, which is preferred.
                // It will display the full text only when it's too long to show in the cell.
                else if (tableColumn.Identifier == "name")
                {
                    toolTip = programDescription.Name;
                }
                else if (tableColumn.Identifier == "vendor")
                {
                    toolTip = programDescription.Vendor;
                }
#endif // false
                else if (tableColumn.Identifier == "romFile")
                {
                    toolTip = programDescription.RomFile;
                }
                return(new NSString(toolTip.SafeString()));
            }
Ejemplo n.º 16
0
 public NSString ToolTipForCell(NSTableView tableView, NSCell cell, ref System.Drawing.RectangleF rect, NSTableColumn tableColumn, nint row, System.Drawing.PointF mouse)
 {
     return(GetToolTip(cell, rect, tableColumn, row, mouse));
 }
Ejemplo n.º 17
0
 public virtual System.nfloat GetHeightForHeader(UIKit.UITableView tableView, System.nint section)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 18
0
 public override string TitleForHeader(UITableView tableView, System.nint section)
 {
     return(Sections[(int)section]);
 }
Ejemplo n.º 19
0
 public virtual UIKit.UIView GetViewForHeader(UIKit.UITableView tableView, System.nint section)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 20
0
 public override void Selected(UIPickerView pickerView, System.nint row, System.nint component)
 {
     selectedUnit = list[(int)row];
 }
Ejemplo n.º 21
0
 /// <inheritdoc/>
 public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex)
 {
     return(proposedPosition);
 }
Ejemplo n.º 22
0
 private static extern void void_objc_msgSend_nint_nint_IntPtr_bool(System.IntPtr receiver, System.IntPtr selector, nint arg1, nint arg2, System.IntPtr arg3, bool arg4);
Ejemplo n.º 23
0
 protected override void OnAttached()
 {
     _tag        = Control.Tag;
     Control.Tag = BeatlesApp.TagEffect.GetTag(Element);
 }
Ejemplo n.º 24
0
            /// <inheritdoc/>
            public override void WillDisplayCell(NSTableView tableView, NSObject cell, NSTableColumn tableColumn, nint row)
            {
                var tableCell = cell as NSCell;

                if ((tableCell != null) && (tableView.Menu != null))
                {
                    tableCell.Menu = tableView.Menu;
                }
            }
 public override System.nint RowsInSection(UITableView tableView, System.nint section)
 {
     return(100);
 }
Ejemplo n.º 26
0
 /// <summary>
 /// The caller acknowledges notification of a power state change on a device it has registered
 /// for notifications for via IORegisterForSystemPower.
 /// </summary>
 /// <param name="notificationId">Notification identifier.</param>
 /// <returns>The result of the funcion call - 0 indicates success, otherwise an error code.</returns>
 public int AllowPowerChange(nint notificationId)
 {
     return(NativeMethods.IOAllowPowerChange(Handle, notificationId));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// The caller wishes to cancel a change in poewr state. The request may or may not be
 /// honored, depending on system state.
 /// </summary>
 /// <param name="notificationId">Notification identifier.</param>
 /// <returns>The result of the funcion call - 0 indicates success, otherwise an error code.</returns>
 public int CancelPowerChange(nint notificationId)
 {
     return(NativeMethods.IOCancelPowerChange(Handle, notificationId));
 }
Ejemplo n.º 28
0
 public override System.nint GetItemsCount(UICollectionView collectionView, System.nint section)
 {
     return(_Items.Count);
 }
Ejemplo n.º 29
0
 public override UIView GetViewForHeader(UITableView tableView, System.nint section)
 {
     return(_source.GetViewForHeader(tableView, section));
 }
Ejemplo n.º 30
0
 /// <inheritdoc/>
 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     DebugDragDrop("***** UPDATE VALIDATE DROP");
     return(NSDragOperation.Link);
 }