public virtual void SetCellAttribute(NSCellAttribute aParameter, int toValue) { switch (aParameter) { case NSCellAttribute.NSCellDisabled: { _cell.is_disabled = (uint)toValue; break; } case NSCellAttribute.NSCellState: { _cell.state = toValue; break; } case NSCellAttribute.NSCellEditable: { _cell.is_editable = (uint)toValue; break; } case NSCellAttribute.NSCellHighlighted: { _cell.is_highlighted = (uint)toValue; break; } case NSCellAttribute.NSCellHasOverlappingImage: { if (Convert.ToBoolean(toValue)) { _cell.image_position = (uint)NSCellImagePosition.NSImageOverlaps; } else { if (_cell.image_position == (uint)NSCellImagePosition.NSImageOverlaps) { _cell.image_position = (uint)NSCellImagePosition.NSImageLeft; } } break; } case NSCellAttribute.NSCellHasImageHorizontal: { if (Convert.ToBoolean(toValue)) { if (_cell.image_position != (uint)NSCellImagePosition.NSImageLeft && _cell.image_position != (uint)NSCellImagePosition.NSImageRight) { _cell.image_position = (uint)NSCellImagePosition.NSImageLeft; } } else { if (_cell.image_position == (uint)NSCellImagePosition.NSImageLeft) { _cell.image_position = (uint)NSCellImagePosition.NSImageAbove; } else if (_cell.image_position == (uint)NSCellImagePosition.NSImageRight) { _cell.image_position = (uint)NSCellImagePosition.NSImageBelow; } } break; } case NSCellAttribute.NSCellHasImageOnLeftOrBottom: { if (Convert.ToBoolean(toValue)) { if (_cell.image_position == (uint)NSCellImagePosition.NSImageAbove) { _cell.image_position = (uint)NSCellImagePosition.NSImageBelow; } else { _cell.image_position = (uint)NSCellImagePosition.NSImageLeft; } } else { if (_cell.image_position == (uint)NSCellImagePosition.NSImageBelow) { _cell.image_position = (uint)NSCellImagePosition.NSImageAbove; } else { _cell.image_position = (uint)NSCellImagePosition.NSImageRight; } } break; } /* case NSCellChangesContents: _cell. = value; break; case NSCellIsInsetButton: _cell. = value; break; */ case NSCellAttribute.NSCellIsBordered: { _cell.is_bordered = (uint)toValue; break; } case NSCellAttribute.NSCellAllowsMixedState: { _cell.allows_mixed_state = (uint)toValue; break; } default: { //NSWarnLog(@"cell attribute %d not supported", (int)aParameter); break; } } }
public override void SetCellAttribute(NSCellAttribute aParameter, int toValue) { switch (aParameter) { case NSCellAttribute.NSPushInCell: if (toValue != 0) _highlightsByMask |= (uint)NSCellMasks.NSPushInCellMask; else _highlightsByMask &= ~(uint)NSCellMasks.NSPushInCellMask; break; case NSCellAttribute.NSChangeGrayCell: if (toValue != 0) _showAltStateMask |= (uint)NSCellMasks.NSChangeGrayCellMask; else _showAltStateMask &= ~(uint)NSCellMasks.NSChangeGrayCellMask; break; case NSCellAttribute.NSChangeBackgroundCell: if (toValue != 0) _showAltStateMask |= (uint)NSCellMasks.NSChangeBackgroundCellMask; else _showAltStateMask &= ~(uint)NSCellMasks.NSChangeBackgroundCellMask; break; case NSCellAttribute.NSCellChangesContents: if (toValue != 0) _showAltStateMask |= (uint)NSCellMasks.NSContentsCellMask; else _showAltStateMask &= ~(uint)NSCellMasks.NSContentsCellMask; break; case NSCellAttribute.NSCellLightsByGray: if (toValue != 0) _highlightsByMask |= (uint)NSCellMasks.NSChangeGrayCellMask; else _highlightsByMask &= ~(uint)NSCellMasks.NSChangeGrayCellMask; break; case NSCellAttribute.NSCellLightsByBackground: if (toValue != 0) _highlightsByMask |= (uint)NSCellMasks.NSChangeBackgroundCellMask; else _highlightsByMask &= ~(uint)NSCellMasks.NSChangeBackgroundCellMask; break; case NSCellAttribute.NSCellLightsByContents: if (toValue != 0) _highlightsByMask |= (uint)NSCellMasks.NSContentsCellMask; else _highlightsByMask &= ~(uint)NSCellMasks.NSContentsCellMask; break; default: base.SetCellAttribute(aParameter, toValue); break; } }
public int CellAttribute(NSCellAttribute aParameter) { switch (aParameter) { case NSCellAttribute.NSCellDisabled: return (int)_cell.is_disabled; case NSCellAttribute.NSCellState: return _cell.state; case NSCellAttribute.NSCellEditable: return (int)_cell.is_editable; case NSCellAttribute.NSCellHighlighted: return (int)_cell.is_highlighted; case NSCellAttribute.NSCellIsBordered: return (int)_cell.is_bordered; case NSCellAttribute.NSCellAllowsMixedState: return (int)_cell.allows_mixed_state; /* case NSPushInCell: return 0; case NSChangeGrayCell: return 0; case NSCellLightsByContents: return 0; case NSCellLightsByGray: return 0; case NSChangeBackgroundCell: return 0; case NSCellLightsByBackground: return 0; case NSCellChangesContents: return 0; case NSCellIsInsetButton: return 0; */ case NSCellAttribute.NSCellHasOverlappingImage: { return (_cell.image_position == (uint)NSCellImagePosition.NSImageOverlaps).ToInt(); } case NSCellAttribute.NSCellHasImageHorizontal: { return ((_cell.image_position == (uint)NSCellImagePosition.NSImageRight) || (_cell.image_position == (uint)NSCellImagePosition.NSImageLeft)).ToInt(); } case NSCellAttribute.NSCellHasImageOnLeftOrBottom: { return ((_cell.image_position == (uint)NSCellImagePosition.NSImageBelow) || (_cell.image_position == (uint)NSCellImagePosition.NSImageLeft)).ToInt(); } default: { //NSWarnLog (@"cell attribute %d not supported", (int)aParameter); break; } } return 0; }