本文整理汇总了C#中NSCoder.DecodeRectForKey方法的典型用法代码示例。如果您正苦于以下问题:C# NSCoder.DecodeRectForKey方法的具体用法?C# NSCoder.DecodeRectForKey怎么用?C# NSCoder.DecodeRectForKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSCoder
的用法示例。
在下文中一共展示了NSCoder.DecodeRectForKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitWithCoder
public override id InitWithCoder(NSCoder aDecoder)
{
id self = this;
NSEnumerator e;
NSView sub;
NSArray subs;
if (base.InitWithCoder(aDecoder) == null)
return null;
_matrixToWindow = (NSAffineTransform)NSAffineTransform.Alloc().Init(); // Map to window coordinates
_matrixFromWindow = (NSAffineTransform)NSAffineTransform.Alloc().Init();// Map from window coordinates
if (aDecoder.AllowsKeyedCoding)
{
NSView prevKeyView = null;
NSView nextKeyView = null;
if (aDecoder.ContainsValueForKey("NSFrame"))
{
_frame = aDecoder.DecodeRectForKey("NSFrame");
}
else
{
_frame = NSRect.Zero;
if (aDecoder.ContainsValueForKey("NSFrameSize"))
{
_frame = aDecoder.DecodeSizeForKey("NSFrameSize");
}
}
// Set bounds rectangle
_bounds.Origin = NSPoint.Zero;
_bounds.Size = _frame.Size;
if (aDecoder.ContainsValueForKey("NSBounds"))
{
this.SetBounds(aDecoder.DecodeRectForKey(@"NSBounds"));
}
_sub_views = (NSMutableArray)NSMutableArray.Alloc().Init();
_tracking_rects = (NSMutableArray)NSMutableArray.Alloc().Init();
_cursor_rects = (NSMutableArray)NSMutableArray.Alloc().Init();
_is_rotated_from_base = false;
_is_rotated_or_scaled_from_base = false;
_rFlags.needs_display = Convert.ToUInt32(true);
_post_bounds_changes = true;
_post_frame_changes = true;
_autoresizes_subviews = true;
_autoresizingMask =(uint) NSViewAutoresizingMasks.NSViewNotSizable;
_coordinates_valid = false;
/*
* Note: don't zero _nextKeyView and _previousKeyView, as the key view
* chain may already have been established by super's initWithCoder:
*
* _nextKeyView = 0;
* _previousKeyView = 0;
*/
// previous and next key views...
prevKeyView = (NSView)aDecoder.DecodeObjectForKey("NSPreviousKeyView");
nextKeyView = (NSView)aDecoder.DecodeObjectForKey("NSNextKeyView");
if (nextKeyView != null)
{
NextKeyView = nextKeyView;
}
if (prevKeyView != null)
{
PreviousKeyView = prevKeyView;
}
if (aDecoder.ContainsValueForKey("NSvFlags"))
{
uint vFlags = (uint)aDecoder.DecodeIntForKey("NSvFlags");
//2013-06-02 10:40:22.872 Gorm[26233] NSvFlags: 0x112 (274) (274)
//2013-06-02 10:40:22.872 Gorm[26233] NSvFlags: 0x80000100 (-2147483392) (-2147483392)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x80000100 (-2147483392) (-2147483392)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x136 (310) (310)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x900 (2304) (2304)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x8000010a (-2147483382) (-2147483382)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x10a (266) (266)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.873 Gorm[26233] NSvFlags: 0x10a (266) (266)
//2013-06-02 10:40:22.874 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.874 Gorm[26233] NSvFlags: 0x10a (266) (266)
//2013-06-02 10:40:22.874 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.874 Gorm[26233] NSvFlags: 0x112 (274) (274)
//2013-06-02 10:40:22.874 Gorm[26233] NSvFlags: 0x8000010a (-2147483382) (-2147483382)
//2013-06-02 10:40:22.874 Gorm[26233] NSvFlags: 0x100 (256) (256)
//2013-06-02 10:40:22.875 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.875 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.875 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.875 Gorm[26233] NSvFlags: 0x102 (258) (258)
//2013-06-02 10:40:22.876 Gorm[26233] NSvFlags: 0x104 (260) (260)
//2013-06-02 10:40:22.876 Gorm[26233] NSvFlags: 0x102 (258) (258)
//2013-06-02 10:40:22.876 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.879 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.885 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.893 Gorm[26233] NSvFlags: 0x10c (268) (268)
//2013-06-02 10:40:22.901 Gorm[26233] NSvFlags: 0x10c (268) (268)
//.........这里部分代码省略.........
示例2: 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;
}