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);
        }
示例#5
0
        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;
            }
            }
        }
示例#6
0
		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?");
        }
示例#11
0
 public NSInteger collectionView(UICollectionView collectionView) numberOfItemsInSection(NSInteger section)
 {
     if (data != null)
     {
         return(data[section].count);
     }
     return(0);
 }
示例#12
0
		private NSRect splitView(NSSplitView splitView) additionalEffectiveRectOfDividerAtIndex(NSInteger dividerIndex)
		{
			return handleImage.convertRect(handleImage.bounds()) toView(this);
		}
示例#13
0
 public static TaskModel newTaskWithSubject(String subj) andPriority(NSInteger prio) datedBy(NSDate due)
示例#14
0
        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();
        }
示例#15
0
		private CGFloat splitView(NSSplitView splitView) constrainMinCoordinate(CGFloat proposedMin) ofSubviewAt(NSInteger dividerIndex)
		{
			return _minTopLeft;
		}
示例#16
0
		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;
		}
示例#17
0
        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)
示例#19
0
		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);
 }
示例#21
0
		private bool splitView(NSSplitView splitView) shouldHideDividerAtIndex(NSInteger dividerIndex)
		{
			return this.secondaryViewIsHidden();
		}