[Foundation] Move NSAttributedStringDocumentAttributes.ViewMode to shared code.
This property has also been added on macOS (where it didn't exist before), since both documentation and headers reveal it's available there.
This commit is contained in:
Родитель
cb12b9ebb9
Коммит
22a8aae9e0
|
@ -25,7 +25,6 @@ namespace Foundation {
|
|||
}
|
||||
|
||||
// Utility enum, ObjC uses NSString
|
||||
[NoMac]
|
||||
public enum NSDocumentViewMode {
|
||||
Normal,
|
||||
PageLayout
|
||||
|
|
|
@ -41,22 +41,6 @@ namespace Foundation {
|
|||
|
||||
public partial class NSAttributedStringDocumentAttributes : DictionaryContainer {
|
||||
#if !MONOMAC && !COREBUILD
|
||||
public NSDocumentViewMode? ViewMode {
|
||||
get {
|
||||
var value = GetInt32Value (NSAttributedStringDocumentAttributeKey.NSViewModeDocumentAttribute);
|
||||
if (value is null)
|
||||
return null;
|
||||
else
|
||||
return (NSDocumentViewMode) value.Value;
|
||||
}
|
||||
set {
|
||||
if (value is null)
|
||||
RemoveValue (NSAttributedStringDocumentAttributeKey.NSViewModeDocumentAttribute);
|
||||
else
|
||||
SetNumberValue (NSAttributedStringDocumentAttributeKey.NSViewModeDocumentAttribute, (int) value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReadOnly {
|
||||
get {
|
||||
var value = GetInt32Value (NSAttributedStringDocumentAttributeKey.NSReadOnlyDocumentAttribute);
|
||||
|
|
|
@ -174,6 +174,16 @@ namespace Foundation {
|
|||
SetNumberValue (NSAttributedStringDocumentAttributeKey.NSViewZoomDocumentAttribute, value);
|
||||
}
|
||||
}
|
||||
|
||||
public NSDocumentViewMode? ViewMode {
|
||||
get {
|
||||
return (NSDocumentViewMode?) GetInt32Value (NSAttributedStringDocumentAttributeKey.NSViewModeDocumentAttribute);
|
||||
}
|
||||
set {
|
||||
SetNumberValue (NSAttributedStringDocumentAttributeKey.NSViewModeDocumentAttribute, value is null ? null : (int) value.Value);
|
||||
}
|
||||
}
|
||||
|
||||
#if !TVOS && !WATCH
|
||||
// documentation is unclear if an NSString or an NSUrl should be used...
|
||||
// but providing an `NSString` throws a `NSInvalidArgumentException Reason: (null) is not a file URL`
|
||||
|
|
Загрузка…
Ссылка в новой задаче