本文整理汇总了C#中NSCoder.DecodeIntForKey方法的典型用法代码示例。如果您正苦于以下问题:C# NSCoder.DecodeIntForKey方法的具体用法?C# NSCoder.DecodeIntForKey怎么用?C# NSCoder.DecodeIntForKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSCoder
的用法示例。
在下文中一共展示了NSCoder.DecodeIntForKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
base.InitWithCoder(aDecoder);
//////////////////////////////////////////////////////////////////////////////
//<object class="NSNibBindingConnector" key="connector">
// <reference key="NSSource" ref="898315540"/>
// <reference key="NSDestination" ref="622487602"/>
// <string key="NSLabel">content: arrangedObjects</string>
// <string key="NSBinding">content</string>
// <string key="NSKeyPath">arrangedObjects</string>
// <int key="NSNibBindingConnectorVersion">2</int>
//</object>
//////////////////////////////////////////////////////////////////////////////
if (aDecoder.AllowsKeyedCoding)
{
if (aDecoder.DecodeIntForKey("NSNibBindingConnectorVersion") != 2)
{
return null;
}
Binding = (NSString)aDecoder.DecodeObjectForKey("NSBinding");
KeyPath = (NSString)aDecoder.DecodeObjectForKey("NSKeyPath");
Options = (NSMutableDictionary)aDecoder.DecodeObjectForKey("NSOptions");
}
else
{
}
return this;
}
示例2: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (aDecoder.AllowsKeyedCoding)
{
Connection = (IBConnection)aDecoder.DecodeObjectForKey("connection");
ConnectionID = aDecoder.DecodeIntForKey("connectionID");
}
return self;
}
示例3: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (aDecoder.AllowsKeyedCoding)
{
ObjectID = aDecoder.DecodeIntForKey("objectID");
Object = aDecoder.DecodeObjectForKey("object");
Children = aDecoder.DecodeObjectForKey("children");
Parent = aDecoder.DecodeObjectForKey("parent");
ObjectName = (NSString)aDecoder.DecodeObjectForKey("objectName");
}
return self;
}
示例4: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (base.InitWithCoder(aDecoder) == null)
return null;
if (aDecoder.AllowsKeyedCoding)
{
int i;
_selected_segment = -1;
_segmentCellFlags._tracking_mode = (uint)NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectOne;
if (aDecoder.ContainsValueForKey(@"NSSegmentImages"))
_items = (NSMutableArray)aDecoder.DecodeObjectForKey(@"NSSegmentImages");
else
_items = (NSMutableArray)NSMutableArray.Alloc().InitWithCapacity(2);
for (i = 0; i < _items.Count; i++)
{
if (IsSelectedForSegment(i))
_selected_segment = i;
}
if (aDecoder.ContainsValueForKey(@"NSSelectedSegment"))
{
_selected_segment = aDecoder.DecodeIntForKey(@"NSSelectedSegment");
if (_selected_segment != -1)
SelectedSegment = _selected_segment;
}
_segmentCellFlags._style = (uint)aDecoder.DecodeIntForKey(@"NSSegmentStyle");
}
else
{
int style = 0;
_segmentCellFlags._tracking_mode = (uint)NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectOne;
_items = (NSMutableArray)aDecoder.DecodeObject();
aDecoder.DecodeValueOfObjCType<int>(ref _selected_segment);
if (_selected_segment != -1)
SelectedSegment = _selected_segment;
aDecoder.DecodeValueOfObjCType<int>(ref style);
_segmentCellFlags._style = (uint)style;
}
return self;
}
示例5: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
base.InitWithCoder(aDecoder);
if (aDecoder.AllowsKeyedCoding)
{
if (aDecoder.ContainsValueForKey("NSViewClass"))
{
_viewClass = (id)aDecoder.DecodeObjectForKey("NSViewClass");
}
if (aDecoder.ContainsValueForKey("NSWindowClass"))
{
_windowClass = (NSString)aDecoder.DecodeObjectForKey("NSWindowClass");
}
if (aDecoder.ContainsValueForKey("NSWindowStyleMask"))
{
_windowStyle = (uint)aDecoder.DecodeIntForKey("NSWindowStyleMask");
}
if (aDecoder.ContainsValueForKey("NSWindowBacking"))
{
_backingStoreType = (NSBackingStoreType)aDecoder.DecodeIntForKey("NSWindowBacking");
}
if (aDecoder.ContainsValueForKey("NSWindowView"))
{
_view = (id)aDecoder.DecodeObjectForKey("NSWindowView");
}
if (aDecoder.ContainsValueForKey("NSWTFlags"))
{
uint flags = (uint)aDecoder.DecodeIntForKey("NSWTFlags");
_flags = PrimitiveConversion.FromLong<GSWindowTemplateFlags>(flags);
}
if (aDecoder.ContainsValueForKey("NSMinSize"))
{
_minSize = aDecoder.DecodeSizeForKey("NSMinSize");
}
if (aDecoder.ContainsValueForKey("NSMaxSize"))
{
_maxSize = aDecoder.DecodeSizeForKey("NSMaxSize");
}
else
{
_maxSize = new NSSize((float)10e+4, (float)10e+4);
}
if (aDecoder.ContainsValueForKey("NSWindowRect"))
{
_windowRect = aDecoder.DecodeRectForKey("NSWindowRect");
}
if (aDecoder.ContainsValueForKey("NSFrameAutosaveName"))
{
_autosaveName = (NSString)aDecoder.DecodeObjectForKey("NSFrameAutosaveName");
}
if (aDecoder.ContainsValueForKey("NSWindowTitle"))
{
_title = (NSString)aDecoder.DecodeObjectForKey("NSWindowTitle");
_windowStyle |= (uint)NSWindowStyleMasks.NSTitledWindowMask;
}
//_baseWindowClass = [NSWindow class];
}
else
{
//[NSException raise: NSInvalidArgumentException
// format: @"Can't decode %@ with %@.",NSStringFromClass([self class]),
// NSStringFromClass([coder class])];
}
//if (aDecoder.AllowsKeyedCoding)
//{
// StyleMask = (NSWindowStyleMasks)aDecoder.DecodeIntForKey("NSWindowStyleMask");
// Backing = aDecoder.DecodeIntForKey("NSWindowBacking");
// WindowRect = aDecoder.DecodeRectForKey("NSWindowRect");
// NSWTFlags = (uint)aDecoder.DecodeIntForKey("NSWTFlags");
// if (aDecoder.ContainsValueForKey("NSWindowTitle"))
// {
// Title = (NSString)aDecoder.DecodeObjectForKey("NSWindowTitle");
// StyleMask |= NSWindowStyleMasks.NSTitledWindowMask;
// }
// WindowClass = (NSString)aDecoder.DecodeObjectForKey("NSWindowClass");
// Toolbar = (NSToolbar)aDecoder.DecodeObjectForKey("NSViewClass");
// WindowView = (NSView)aDecoder.DecodeObjectForKey("NSWindowView");
// ScreenRect = (NSRect)aDecoder.DecodeRectForKey("NSScreenRect");
// IsRestorable = aDecoder.DecodeBoolForKey("NSWindowIsRestorable");
// MinSize = aDecoder.DecodeSizeForKey("NSMinSize");
// if (aDecoder.ContainsValueForKey("NSMaxSize"))
// {
// MaxSize = aDecoder.DecodeSizeForKey("NSMaxSize");
// }
// else
// {
// MaxSize = new NSSize((float)10e+4, (float)10e+4);
// }
//}
return this;
}
示例6: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
id menu = null;
base.InitWithCoder(aDecoder);
if (aDecoder.AllowsKeyedCoding)
{
if (aDecoder.ContainsValueForKey(@"NSInterfaceStyle"))
{
_interface_style = (NSInterfaceStyle)aDecoder.DecodeIntForKey(@"NSInterfaceStyle");
}
if (aDecoder.ContainsValueForKey(@"NSMenu"))
{
menu = (NSMenu)aDecoder.DecodeObjectForKey(@"NSMenu");
}
if (aDecoder.ContainsValueForKey(@"NSNextResponder"))
{
NextResponder = (NSResponder)aDecoder.DecodeObjectForKey(@"NSNextResponder");
}
}
else
{
}
Menu = (NSMenu)menu;
return self;
}
示例7: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (aDecoder.AllowsKeyedCoding)
{
int colorSpace = aDecoder.DecodeIntForKey(@"NSColorSpace");
if ((colorSpace == 1) || (colorSpace == 2))
{
int length = 0;
byte[] data = null;
double red = 0.0;
double green = 0.0;
double blue = 0.0;
double alpha = 1.0;
NSString str = null;
NSScanner scanner = null;
if (aDecoder.ContainsValueForKey(@"NSRGB"))
{
data = aDecoder.DecodeBytesForKey(@"NSRGB", ref length);
str = (NSString)NSString.Alloc().InitWithBytes(data, (uint)data.Length, NSStringEncoding.NSASCIIStringEncoding);
scanner = (NSScanner)NSScanner.Alloc().InitWithString(str);
scanner.ScanDouble(ref red);
scanner.ScanDouble(ref green);
scanner.ScanDouble(ref blue);
scanner.ScanDouble(ref alpha);
}
if (colorSpace == 1)
{
self = NSColor.ColorWithCalibratedRed((double)red, (double)green, (double)blue, (double)alpha);
}
else
{
self = NSColor.ColorWithDeviceRed((double)red, (double)green, (double)blue, (double)alpha);
}
}
else if ((colorSpace == 3) || (colorSpace == 4))
{
int length = 0;
byte[] data = null;
double white = 0.0;
double alpha = 0.0;
NSString str = null;
NSScanner scanner = null;
if (aDecoder.ContainsValueForKey(@"NSWhite"))
{
data = aDecoder.DecodeBytesForKey(@"NSWhite", ref length);
str = (NSString)NSString.Alloc().InitWithBytes(data, (uint)data.Length, NSStringEncoding.NSASCIIStringEncoding);
scanner = (NSScanner)NSScanner.Alloc().InitWithString(str);
scanner.ScanDouble(ref white);
scanner.ScanDouble(ref alpha);
}
if (colorSpace == 3)
{
self = NSColor.ColorWithCalibratedWhite((double)white, (double)alpha);
}
else
{
self = NSColor.ColorWithDeviceWhite((double)white, (double)alpha);
}
}
else if (colorSpace == 5)
{
int length = 0;
byte[] data = null;
double cyan = 0.0;
double yellow = 0.0;
double magenta = 0.0;
double black = 0.0;
double alpha = 1.0;
NSString str = null;
NSScanner scanner = null;
if (aDecoder.ContainsValueForKey(@"NSCYMK"))
{
data = aDecoder.DecodeBytesForKey(@"NSCYMK", ref length);
str = (NSString)NSString.Alloc().InitWithBytes(data, (uint)data.Length, NSStringEncoding.NSASCIIStringEncoding);
scanner = (NSScanner)NSScanner.Alloc().InitWithString(str);
scanner.ScanDouble(ref cyan);
scanner.ScanDouble(ref yellow);
scanner.ScanDouble(ref magenta);
scanner.ScanDouble(ref black);
scanner.ScanDouble(ref alpha);
}
self = NSColor.ColorWithDeviceCyan((double)cyan, (double)magenta, (double)yellow, (double)black, (double)alpha);
}
else if (colorSpace == 6)
{
NSString catalog = (NSString)aDecoder.DecodeObjectForKey(@"NSCatalogName");
NSString name = (NSString)aDecoder.DecodeObjectForKey(@"NSColorName");
//NSColor color = (NSColor)aDecoder.DecodeObjectForKey(@"NSColor");
self = NSColor.ColorWithCatalogName(catalog, name);
}
else if (colorSpace == 10)
{
//.........这里部分代码省略.........
示例8: InitWithCoder
//https://github.com/gnustep/gnustep-gui/blob/master/Source/NSButtonCell.m
public override id InitWithCoder(NSCoder aDecoder)
{
base.InitWithCoder(aDecoder);
if (aDecoder.AllowsKeyedCoding)
{
int delay = 0;
int interval = 0;
if (aDecoder.ContainsValueForKey("NSKeyEquivalent"))
{
KeyEquivalent = (NSString)aDecoder.DecodeObjectForKey("NSKeyEquivalent");
}
if (aDecoder.ContainsValueForKey("NSNormalImage"))
{
Image = (NSImage)aDecoder.DecodeObjectForKey("NSNormalImage");
}
if (aDecoder.ContainsValueForKey("NSAlternateContents"))
{
AlternateTitle = (NSString)aDecoder.DecodeObjectForKey("NSAlternateContents");
}
if (aDecoder.ContainsValueForKey("NSButtonFlags"))
{
uint bFlags = (uint)aDecoder.DecodeIntForKey("NSButtonFlags");
GSButtonCellFlags buttonCellFlags = PrimitiveConversion.FromLong<GSButtonCellFlags>(bFlags);
this.Transparent = Convert.ToBoolean(buttonCellFlags.isTransparent);
this.Bordered = Convert.ToBoolean(buttonCellFlags.isBordered);
this.SetCellAttribute(NSCellAttribute.NSPushInCell, (int)buttonCellFlags.isPushin);
this.SetCellAttribute(NSCellAttribute.NSCellLightsByBackground, (int)buttonCellFlags.highlightByBackground);
this.SetCellAttribute(NSCellAttribute.NSCellLightsByContents, (int)buttonCellFlags.highlightByContents);
this.SetCellAttribute(NSCellAttribute.NSCellLightsByGray, (int)buttonCellFlags.highlightByGray);
this.SetCellAttribute(NSCellAttribute.NSChangeBackgroundCell, (int)buttonCellFlags.changeBackground);
this.SetCellAttribute(NSCellAttribute.NSCellChangesContents, (int)buttonCellFlags.changeContents);
this.SetCellAttribute(NSCellAttribute.NSChangeGrayCell, (int)buttonCellFlags.changeGray);
if (Convert.ToBoolean(buttonCellFlags.imageDoesOverlap))
{
if (Convert.ToBoolean(buttonCellFlags.isImageAndText))
{
this.ImagePosition = NSCellImagePosition.NSImageOverlaps;
}
else
{
this.ImagePosition = NSCellImagePosition.NSImageOnly;
}
}
else if (Convert.ToBoolean(buttonCellFlags.isImageAndText))
{
if (Convert.ToBoolean(buttonCellFlags.isHorizontal))
{
if (Convert.ToBoolean(buttonCellFlags.isBottomOrLeft))
{
this.ImagePosition = NSCellImagePosition.NSImageLeft;
}
else
{
this.ImagePosition = NSCellImagePosition.NSImageRight;
}
}
else
{
if (Convert.ToBoolean(buttonCellFlags.isBottomOrLeft))
{
this.ImagePosition = NSCellImagePosition.NSImageBelow;
}
else
{
this.ImagePosition = NSCellImagePosition.NSImageAbove;
}
}
}
else
{
this.ImagePosition = NSCellImagePosition.NSNoImage;
}
}
if (aDecoder.ContainsValueForKey("NSButtonFlags2"))
{
//uint bFlags2 = (uint)aDecoder.DecodeIntForKey("NSButtonFlags2");
//GSButtonCellFlags2 buttonCellFlags2 = PrimitiveConversion.FromLong<GSButtonCellFlags2>(bFlags2);
//this.ShowsBorderOnlyWhileMouseInside = Convert.ToBoolean(buttonCellFlags2.showsBorderOnlyWhileMouseInside);
//this.BezelStyle = (NSBezelStyle)buttonCellFlags2.bezelStyle;
//this._keyEquivalentModifierMask = buttonCellFlags2.keyEquivalentModifierMask;
//uint imageScale = buttonCellFlags2.imageScaling;
uint imageScale;
uint bFlags2 = (uint)aDecoder.DecodeIntForKey("NSButtonFlags2");
this.ShowsBorderOnlyWhileMouseInside = Convert.ToBoolean(bFlags2 & 0x8);
this.BezelStyle = (NSBezelStyle)((bFlags2 & 0x7) | ((bFlags2 & 0x20) >> 2));
this._keyEquivalentModifierMask = (uint)((bFlags2 >> 8) & (uint)NSDeviceIndependentModifierFlagsMasks.NSDeviceIndependentModifierFlagsMask);
switch (bFlags2 & (3 << 6))
{
case 0:
default:
imageScale = (uint)NSImageScaling.NSImageScaleNone; break;
//.........这里部分代码省略.........
示例9: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (aDecoder.AllowsKeyedCoding)
{
ConnectionRecords = (NSMutableArray)aDecoder.DecodeObjectForKey("connectionRecords");
ObjectRecords = (IBMutableOrderedSet)aDecoder.DecodeObjectForKey("objectRecords");
FlattenedProperties = (NSMutableDictionary)aDecoder.DecodeObjectForKey("flattenedProperties");
UnlocalizedProperties = (NSMutableDictionary)aDecoder.DecodeObjectForKey("unlocalizedProperties");
Localizations = (NSMutableDictionary)aDecoder.DecodeObjectForKey("localizations");
SourceID = aDecoder.DecodeObjectForKey("sourceID");
MaxId = aDecoder.DecodeIntForKey("maxID");
}
return self;
}
示例10: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (base.InitWithCoder(aDecoder) == null)
return null;
if (aDecoder.AllowsKeyedCoding)
{
NSCell cell = (NSCell)aDecoder.DecodeObjectForKey("NSCell");
if (cell != null)
{
Cell = cell;
}
else
{
// This is needed for subclasses without cells, like NSColorWeel
// as we store some properties only on the cell.
//FIXME
Cell = (NSCell)NSCell.Alloc().Init();
}
if (aDecoder.ContainsValueForKey("NSEnabled"))
{
this.Enabled = aDecoder.DecodeBoolForKey("NSEnabled");
}
if (aDecoder.ContainsValueForKey("NSTag"))
{
this.Tag = aDecoder.DecodeIntForKey("NSTag");
}
}
return self;
}
示例11: InitWithCoder
//public id InitWithItemIdentifier(NSString itemIdentifier)
//{
//}
//public NSToolbarItem(NSObjectDecoder aDecoder)
// : base(aDecoder)
//{
//}
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
base.InitWithCoder(aDecoder);
if (aDecoder.AllowsKeyedCoding)
{
ItemIdentifier = (NSString)aDecoder.DecodeObjectForKey("NSToolbarItemIdentifier");
Label = (NSString)aDecoder.DecodeObjectForKey("NSToolbarItemLabel");
PaletteLabel = (NSString)aDecoder.DecodeObjectForKey("NSToolbarItemPaletteLabel");
ToolTip = (NSString)aDecoder.DecodeObjectForKey("NSToolbarItemToolTip");
View = (NSView)aDecoder.DecodeObjectForKey("NSToolbarItemView");
Image = (NSImage)aDecoder.DecodeObjectForKey("NSToolbarItemImage");
//Target = (NSString)aDecoder.DecodeObjectForKey("NSToolbarItemTarget");
//Action = (NSString)aDecoder.DecodeObjectForKey("NSToolbarItemAction");
MinSize = (NSSize)(NSString)aDecoder.DecodeObjectForKey("NSToolbarItemMinSize");
MaxSize = (NSSize)(NSString)aDecoder.DecodeObjectForKey("NSToolbarItemMaxSize");
Enabled = aDecoder.DecodeBoolForKey("NSToolbarItemEnabled");
Autovalidates = aDecoder.DecodeBoolForKey("NSToolbarItemAutovalidates");
Tag = aDecoder.DecodeIntForKey("NSToolbarItemTag");
IsUserRemovable = aDecoder.DecodeBoolForKey("NSToolbarIsUserRemovable");
VisibilityPriority = aDecoder.DecodeIntForKey("NSToolbarItemVisibilityPriority");
}
return self;
}
示例12: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
base.InitWithCoder(aDecoder);
if (aDecoder.AllowsKeyedCoding)
{
NSScroller hScroller = (NSScroller)aDecoder.DecodeObjectForKey("NSHScroller");
NSScroller vScroller = (NSScroller)aDecoder.DecodeObjectForKey("NSVScroller");
NSClipView content = (NSClipView)aDecoder.DecodeObjectForKey("NSContentView");
if (aDecoder.ContainsValueForKey("NSsFlags"))
{
NSsFlags = (uint)aDecoder.DecodeIntForKey("NSsFlags");
}
}
return this;
}
示例13: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (base.InitWithCoder(aDecoder) == null)
return null;
if (aDecoder.AllowsKeyedCoding)
{
if (aDecoder.ContainsValueForKey("NSTag"))
{
this.Tag = aDecoder.DecodeIntForKey("NSTag");
}
if (aDecoder.ContainsValueForKey("NSTarget"))
{
this.Target = aDecoder.DecodeObjectForKey("NSTarget");
}
if (aDecoder.ContainsValueForKey("NSAction"))
{
NSString action = (NSString)aDecoder.DecodeObjectForKey("NSAction");
this.Action = SEL.SelectorFromString(action);
}
}
return self;
}
示例14: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
if (aDecoder.AllowsKeyedCoding)
{
id contents = (id)aDecoder.DecodeObjectForKey("NSContents");
//In objc messages can be send to nil object - so in this case I had to add a
// test to check if contents variable is null or not
// NSPopUpButtonCell doesn't have NSContents object
if (contents != null && contents.IsKindOfClass(NSString.Class))
{
InitTextCell((NSString)contents);
}
else if (contents != null && contents.IsKindOfClass(NSImage.Class))
{
InitImageCell((NSImage)contents);
}
else
{
Init();
this.ObjectValue = contents;
}
if (aDecoder.ContainsValueForKey("NSCellFlags"))
{
uint mask = 0;
uint cFlags = (uint)aDecoder.DecodeIntForKey("NSCellFlags");
FocusRingType = (NSFocusRingType)(cFlags & 0x3);
ShowsFirstResponder = ((cFlags & 0x4) == 0x4);
if ((cFlags & 0x20) != 0x20) { mask |= (uint)NSEventMask.NSLeftMouseUpMask; }
Wraps = ((cFlags & 0x40) != 0x40);
if ((cFlags & 0x100) == 0x100)
mask |= (uint)NSEventMask.NSLeftMouseDraggedMask;
if ((cFlags & 0x40000) == 0x40000)
mask |= (uint)NSEventMask.NSLeftMouseDownMask;
if ((cFlags & 0x80000) == 0x80000)
mask |= (uint)NSEventMask.NSPeriodicMask;
this.SendActionOn((int)mask);
this.Scrollable = ((cFlags & 0x100000) == 0x100000);
this.Selectable = ((cFlags & 0x200000) == 0x200000);
this.Bezeled = ((cFlags & 0x400000) == 0x400000);
this.Bordered = ((cFlags & 0x800000) == 0x800000);
this.Type = (NSCellType)((cFlags & 0xC000000) >> 26);
this.Editable = ((cFlags & 0x10000000) == 0x10000000);
this.Enabled = ((cFlags & 0x20000000) != 0x20000000);
this.Highlighted = ((cFlags & 0x40000000) == 0x40000000);
this.State = (int)(((cFlags & 0x80000000) == 0x80000000) ? NSCellStateValue.NSOnState : NSCellStateValue.NSOffState);
}
if (aDecoder.ContainsValueForKey("NSCellFlags2"))
{
int cFlags2 = aDecoder.DecodeIntForKey("NSCellFlags2");
this.ControlTint = (NSControlTint)((cFlags2 & 0xE0) >> 5);
this.LineBreakMode = (NSLineBreakMode)((cFlags2 & 0xE00) >> 9);
this.ControlSize = (NSControlSize)((cFlags2 & 0xE0000) >> 17);
this.SendsActionOnEndEditing = ((cFlags2 & 0x400000) == 0x400000);
this.AllowsMixedState = ((cFlags2 & 0x1000000) == 0x1000000);
this.RefusesFirstResponder = ((cFlags2 & 0x2000000) == 0x2000000);
this.Alignment = (NSTextAlignment)((cFlags2 & 0x1C000000) >> 26);
this.ImportsGraphics = ((cFlags2 & 0x20000000) == 0x20000000);
this.AllowsEditingTextAttributes = ((cFlags2 & 0x40000000) == 0x40000000);
}
if (aDecoder.ContainsValueForKey("NSSupport"))
{
id support = aDecoder.DecodeObjectForKey("NSSupport");
if (support.IsKindOfClass(NSFont.Class))
{
this.Font = (NSFont)support;
}
else if (support.IsKindOfClass(NSImage.Class))
{
this.Image = (NSImage)support;
}
}
if (aDecoder.ContainsValueForKey("NSFormatter"))
{
NSFormatter formatter = (NSFormatter)aDecoder.DecodeObjectForKey("NSFormatter");
Formatter = formatter;
}
}
return this;
}
示例15: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
if (aDecoder.AllowsKeyedCoding)
{
if (aDecoder.ContainsValueForKey(@"NSSegmentItemLabel"))
Label = (NSString)aDecoder.DecodeObjectForKey(@"NSSegmentItemLabel");
if (aDecoder.ContainsValueForKey(@"NSSegmentItemImage"))
Image = (NSImage)aDecoder.DecodeObjectForKey(@"NSSegmentItemImage");
if (aDecoder.ContainsValueForKey(@"NSSegmentItemMenu"))
Menu = (NSMenu)aDecoder.DecodeObjectForKey(@"NSSegmentItemMenu");
if (aDecoder.ContainsValueForKey(@"NSSegmentItemEnabled"))
_enabled = aDecoder.DecodeBoolForKey(@"NSSegmentItemEnabled");
else if (aDecoder.ContainsValueForKey(@"NSSegmentItemDisabled"))
_enabled = !aDecoder.DecodeBoolForKey(@"NSSegmentItemDisabled");
else
_enabled = true;
if (aDecoder.ContainsValueForKey(@"NSSegmentItemSelected"))
_selected = aDecoder.DecodeBoolForKey(@"NSSegmentItemSelected");
if (aDecoder.ContainsValueForKey(@"NSSegmentItemWidth"))
_width = aDecoder.DecodeFloatForKey(@"NSSegmentItemWidth");
if (aDecoder.ContainsValueForKey(@"NSSegmentItemTag"))
_tag = aDecoder.DecodeIntForKey(@"NSSegmentItemTag");
}
else
{
_label = (NSString)aDecoder.DecodeObject();
_image = (NSImage)aDecoder.DecodeObject();
_menu = (NSMenu)aDecoder.DecodeObject();
aDecoder.DecodeValueOfObjCType<bool>(ref _enabled);
aDecoder.DecodeValueOfObjCType<bool>(ref _selected);
aDecoder.DecodeValueOfObjCType<float>(ref _width);
aDecoder.DecodeValueOfObjCType<int>(ref _tag);
}
return self;
}