/// <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__ }
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]); //} }
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(); } } } }
public virtual System.nint RowsInSection(UIKit.UITableView tableview, System.nint section) { throw new NotImplementedException(); }
/// <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); }
/// <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)); }
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); }
public override System.nint GetRowsInComponent(UIPickerView pickerView, System.nint component) { return(list.Count); }
public override System.nint RowsInSection(UITableView tableView, System.nint section) { return(_astronauts?.Count ?? 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) { } }
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); }
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())); }
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)); }
public virtual System.nfloat GetHeightForHeader(UIKit.UITableView tableView, System.nint section) { throw new NotImplementedException(); }
public override string TitleForHeader(UITableView tableView, System.nint section) { return(Sections[(int)section]); }
public virtual UIKit.UIView GetViewForHeader(UIKit.UITableView tableView, System.nint section) { throw new NotImplementedException(); }
public override void Selected(UIPickerView pickerView, System.nint row, System.nint component) { selectedUnit = list[(int)row]; }
/// <inheritdoc/> public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex) { return(proposedPosition); }
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);
protected override void OnAttached() { _tag = Control.Tag; Control.Tag = BeatlesApp.TagEffect.GetTag(Element); }
/// <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); }
/// <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)); }
/// <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)); }
public override System.nint GetItemsCount(UICollectionView collectionView, System.nint section) { return(_Items.Count); }
public override UIView GetViewForHeader(UITableView tableView, System.nint section) { return(_source.GetViewForHeader(tableView, section)); }
/// <inheritdoc/> public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation) { DebugDragDrop("***** UPDATE VALIDATE DROP"); return(NSDragOperation.Link); }