当前位置: 首页>>代码示例>>C#>>正文


C# NSCoder.ContainsValueForKey方法代码示例

本文整理汇总了C#中NSCoder.ContainsValueForKey方法的典型用法代码示例。如果您正苦于以下问题:C# NSCoder.ContainsValueForKey方法的具体用法?C# NSCoder.ContainsValueForKey怎么用?C# NSCoder.ContainsValueForKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NSCoder的用法示例。


在下文中一共展示了NSCoder.ContainsValueForKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            id self = this;
            NSMenu menu;

            if (base.InitWithCoder(aDecoder) == null)
                return null;

              if (aDecoder.AllowsKeyedCoding)
              {
                  menu = (NSMenu)aDecoder.DecodeObjectForKey(@"NSMenu");
                  this.Menu = null;
                  this.Menu = menu;

                  if (aDecoder.ContainsValueForKey(@"NSAltersState"))
                  {

                  }
                  if (aDecoder.ContainsValueForKey(@"NSPullDown"))
                  {

                  }
                  if (aDecoder.ContainsValueForKey(@"NSUsesItemFromMenu"))
                  {

                  }
                  if (aDecoder.ContainsValueForKey(@"NSArrowPosition"))
                  {

                  }
                  if (aDecoder.ContainsValueForKey(@"NSPreferredEdge"))
                  {

                  }
                  if (aDecoder.ContainsValueForKey(@"NSSelectedIndex"))
                  {

                  }
                  if (aDecoder.ContainsValueForKey(@"NSMenuItem"))
                  {

                  }

              }

            return self;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:47,代码来源:NSPopUpButtonCell.cs

示例2: 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)
//.........这里部分代码省略.........
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:101,代码来源:NSView.cs

示例3: 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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:49,代码来源:NSSegmentedCell.cs

示例4: 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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:99,代码来源:NSWindowTemplate.cs

示例5: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            //base.InitWithCoder(aDecoder);

            if (aDecoder.AllowsKeyedCoding)
            {
                if (aDecoder.ContainsValueForKey(@"NSDestination"))
                {
                    _dst = aDecoder.DecodeObjectForKey(@"NSDestination");
                }
                if (aDecoder.ContainsValueForKey(@"NSSource"))
                {
                    _src = aDecoder.DecodeObjectForKey(@"NSSource");
                }
                if (aDecoder.ContainsValueForKey(@"NSLabel"))
                {
                    _tag = (NSString)aDecoder.DecodeObjectForKey(@"NSLabel");
                }
            }
            else
            {

            }

            return this;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:26,代码来源:NSNibConnector.cs

示例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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:31,代码来源:NSResponder.cs

示例7: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            base.InitWithCoder(aDecoder);

            if (aDecoder.AllowsKeyedCoding)
            {
                //NSString title;
                //NSString action;
                //NSString key;
                bool isSeparator = false;
                //int keyMask;

                if (aDecoder.ContainsValueForKey(@"NSIsSeparator"))
                {
                    isSeparator = aDecoder.DecodeBoolForKey(@"NSIsSeparator");
                }

                Title = (NSString)aDecoder.DecodeObjectForKey("NSTitle");

                IsDisabled = aDecoder.DecodeBoolForKey("NSIsDisabled");

                IsSeparator = aDecoder.DecodeBoolForKey("NSIsSeparator");

                SubMenu = (NSMenu)aDecoder.DecodeObjectForKey("NSSubmenu");
            }

            return this;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:28,代码来源:NSMenuItem.cs

示例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;

//.........这里部分代码省略.........
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:101,代码来源:NSButtonCell.cs

示例9: 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)
                {
//.........这里部分代码省略.........
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:101,代码来源:NSColor.cs

示例10: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            id self = this;

            base.InitWithCoder(aDecoder);

            if (aDecoder.AllowsKeyedCoding)
            {
                if (aDecoder.ContainsValueForKey(@"NSBoxType"))
                {
                    int boxType = aDecoder.DecodeIntForKey(@"NSBoxType");
                    this.BoxType = (NSBoxType)boxType;
                }
                if (aDecoder.ContainsValueForKey(@"NSBorderType"))
                {
                    NSBorderType borderType = (NSBorderType)aDecoder.DecodeIntForKey(@"NSBorderType");
                    this.BorderType = borderType;
                }
                if (aDecoder.ContainsValueForKey(@"NSTitlePosition"))
                {
                    NSTitlePosition titlePosition = (NSTitlePosition)aDecoder.DecodeIntForKey(@"NSTitlePosition");
                    this.TitlePosition = titlePosition;
                }
                if (aDecoder.ContainsValueForKey(@"NSTransparent"))
                {
                    // On Apple this is always NO, we keep it for old GNUstep archives
                    _transparent = aDecoder.DecodeBoolForKey(@"NSTransparent");
                }
                if (aDecoder.ContainsValueForKey(@"NSFullyTransparent"))
                {
                    _transparent = aDecoder.DecodeBoolForKey(@"NSFullyTransparent");
                }
                if (aDecoder.ContainsValueForKey(@"NSOffsets"))
                {
                    this.ContentViewMargins = aDecoder.DecodeSizeForKey(@"NSOffsets");
                }
                if (aDecoder.ContainsValueForKey(@"NSTitleCell"))
                {
                    NSCell titleCell = (NSCell)aDecoder.DecodeObjectForKey(@"NSTitleCell");
                    _cell = titleCell;
                }
                if (aDecoder.ContainsValueForKey(@"NSContentView"))
                {
                    NSView contentView = (NSView)aDecoder.DecodeObjectForKey(@"NSContentView");
                    this.ContentView = contentView;
                }
            }

            return this;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:50,代码来源:NSBox.cs

示例11: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            id self = this;

            base.InitWithCoder(aDecoder);

            if (aDecoder.AllowsKeyedCoding)
            {
                if (aDecoder.ContainsValueForKey("label"))
                {
                    _label = (NSString)aDecoder.DecodeObjectForKey("label");
                }
                if (aDecoder.ContainsValueForKey("source"))
                {
                    _source = (id)aDecoder.DecodeObjectForKey("source");
                }
                if (aDecoder.ContainsValueForKey("destination"))
                {
                    _destination = (id)aDecoder.DecodeObjectForKey("destination");
                }
            }

            return self;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:24,代码来源:IBConnection.cs

示例12: 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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:35,代码来源:NSControl.cs

示例13: 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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:18,代码来源:NSScrollView.cs

示例14: 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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:26,代码来源:NSActionCell.cs

示例15: 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;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:89,代码来源:NSCell.cs


注:本文中的NSCoder.ContainsValueForKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。