private void deleteAlert(NSAlert alert) result(NSInteger res) context(id ctx) { if (res != 1) { return; } NSInteger index = this.tableViewOutlet.selectedRow(); DataLayer.sharedInstance.tasks.removeObjectAtIndex(index); this.loadDataAction(this); }
public void removeTaskAction(id sender) { NSInteger row = this.tableViewOutlet.selectedRow(); if (row < 0) { return; } NSAlert a = NSAlert.alertWithMessageText("Remove task?") defaultButton("Remove") alternateButton("Cancel") otherButton(null) informativeTextWithFormat("Do you really want to delete task?"); a.beginSheetModalForWindow(this.window) modalDelegate(this) didEndSelector(__selector(deleteAlert: result: context:)) contextInfo(null); }
public void editTaskAction(id sender) { NSInteger row = this.tableViewOutlet.selectedRow(); if (row < 0) { return; } TaskModel task = DataLayer.sharedInstance.tasks[row]; this.showEditorSheetForTask(task); }
private void tableViewDidDoubleClick(id sender) { NSInteger index = this.tableViewOutlet.clickedRow; if (index == -1) { this.addTaskAction(sender); return; } TaskModel task = DataLayer.sharedInstance.tasks[index]; this.showEditorSheetForTask(task); }
public void alertView(UIAlertView alertView) clickedButtonAtIndex(NSInteger buttonIndex) { string buttonText = alertView.buttonTitleAtIndex(buttonIndex); NSLog("Button Text:%@", buttonText); if (buttonText == "OK") { NSLog("OK"); } switch (buttonText) { case "OK": { NSLog("OK was selected."); break; } } }
private CGFloat splitView(NSSplitView splitView) constrainMaxCoordinate(CGFloat proposedMax) ofSubviewAt(NSInteger dividerIndex) { return this.totalSize() - _minBottomRight; }
public BOOL tableView(NSTableView tableView) isGroupRow(NSInteger row) { return(false); }
public void tableView(NSTableView tableView) willDisplayCell(id cell) forTableColumn(NSTableColumn tableColumn) row(NSInteger row) { TaskModel task = DataLayer.sharedInstance.tasks[row]; if (task.done) { cell.textColor = NSColor.grayColor; } else { cell.textColor = NSColor.blackColor; } }
private NSInteger tableView(UITableView !tableView) numberOfRowsInSection(NSInteger section) { return(this.dataArray.length); }
public id tableView(NSTableView tableView) objectValueForTableColumn(NSTableColumn tableColumn) row(NSInteger row) { NSString columnName = tableColumn.identifier; TaskModel task = DataLayer.sharedInstance.tasks[row]; if ("Subject" == columnName) { return(task.subject); } if ("Priority" == columnName) { return(NSString.stringWithFormat("%@", task.priority)); } if ("DueDate" == columnName) { return(Helpers.sharedInstance.stringFromDate(task.dueDate)); } return("nothing?"); }
public NSInteger collectionView(UICollectionView collectionView) numberOfItemsInSection(NSInteger section) { if (data != null) { return(data[section].count); } return(0); }
private NSRect splitView(NSSplitView splitView) additionalEffectiveRectOfDividerAtIndex(NSInteger dividerIndex) { return handleImage.convertRect(handleImage.bounds()) toView(this); }
public static TaskModel newTaskWithSubject(String subj) andPriority(NSInteger prio) datedBy(NSDate due)
public void tableView(NSTableView tableView) setObjectValue(id obj) forTableColumn(NSTableColumn tableColumn) row(NSInteger row) { Person person = this.people.objectAtIndex(row); if (tableColumn.identifier == "name") { person.name = obj; } else if (tableColumn.identifier == "age") { person.age = obj.intValue; } self.updateMessageLabel(); }
private CGFloat splitView(NSSplitView splitView) constrainMinCoordinate(CGFloat proposedMin) ofSubviewAt(NSInteger dividerIndex) { return _minTopLeft; }
private CGFloat splitView(NSSplitView splitView) constrainSplitPosition(CGFloat proposedPosition) ofSubviewAt(NSInteger dividerIndex) { // if (![self isVertical]) NSLog(@"constrainSplitPosition:%f ofSubviewAt:%ld", proposedPosition, dividerIndex); // if (_priorityViewIndex == 1 && [self secondaryViewIsHidden]) return splitView.bounds.size.width; // if (_priorityViewIndex == 0 && [self secondaryViewIsHidden]) return 0; if (proposedPosition < _minTopLeft) proposedPosition = _minTopLeft; if (proposedPosition > (this.totalSize() - _minBottomRight)) proposedPosition = (this.totalSize() - _minBottomRight); if (proposedPosition > _maxTopLeft) proposedPosition = _maxTopLeft; if (proposedPosition < (this.totalSize() - _maxBottomRight)) proposedPosition = (this.totalSize() - _maxBottomRight); return proposedPosition; }
public id tableView(NSTableView tableView) objectValueForTableColumn(NSTableColumn tableColumn) row(NSInteger row) { Person person = this.people.objectAtIndex(row); if (tableColumn.identifier == "name") { return(person.name); } else if (tableColumn.identifier == "age") { return(person.age); } else { return("Unkown"); } }
private void deleteAlert(NSAlert alert) result(NSInteger res) context(id ctx)
public CGFloat positionOfDividerAtIndex(NSInteger index) { if (this.isVertical()) return this.subviews().objectAtIndex(index).frame().size.width; else return this.subviews().objectAtIndex(index).frame().size.height; }
public NSInteger tableView(UITableView tableView) numberOfRowsInSection(NSInteger section) { return(_objects != null ? _objects.count : 0); }
private bool splitView(NSSplitView splitView) shouldHideDividerAtIndex(NSInteger dividerIndex) { return this.secondaryViewIsHidden(); }