Inheritance: NSObject
        public override id InitImageCell(NSImage anImage)
        {
            id self = this;

            if (base.InitImageCell(anImage) == null)
                return null;

            _segmentCellFlags._tracking_mode = (uint)NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectOne;
            _items = (NSMutableArray)NSMutableArray.Alloc().InitWithCapacity(2);
            _selected_segment = -1;
            Alignment = NSTextAlignment.NSCenterTextAlignment;

            return self;
        }
 public virtual void SetImageForSegment(NSImage image, int seg)
 {
     id segment = _items.ObjectAtIndex(seg);
     ((NSSegmentItem)segment).Image = image;
 }
Esempio n. 3
0
        public static NSColor ColorWithPatternImage(NSImage image)
        {
            id color;

            color = GSPatternColor.Alloc();
            color = ((GSPatternColor)color).InitWithPatternImage(image);

            return (NSColor)color;
        }
Esempio n. 4
0
        public virtual NSColor InitWithPatternImage(NSImage pattern)
        {
            NSColor self = this;

            _pattern = pattern;

            return self;
        }
 public virtual void SetImageForSegment(NSImage image, int seg)
 {
     ((NSSegmentedCell)_cell).SetImageForSegment(image, seg);
 }
Esempio n. 6
0
        public override id InitImageCell(NSImage anImage)
        {
            if (base.InitImageCell(anImage) == null)
                return null;

            return this._Init();
        }
        //public NSCustomResource(NSObjectDecoder aDecoder)
        //    : base(aDecoder)
        //{
        //}
        public override id InitWithCoder(NSCoder aDecoder)
        {
            NSObject realObject = null;
            if (aDecoder.AllowsKeyedCoding)
            {
                _className = (NSString)aDecoder.DecodeObjectForKey("NSClassName");
                _resourceName = (NSString)aDecoder.DecodeObjectForKey("NSResourceName");

                if (_className == "NSSound")
                {
                    //realObject = null;
                }
                else if (_className == "NSImage")
                {
                    realObject = new NSImage();
                    ((NSImage)realObject).ResourceName = _resourceName;
                }
            }
            else
            {

            }

            return realObject;
        }
Esempio n. 8
0
        public virtual id InitImageCell(NSImage anImage)
        {
            id self = this;

            _cell.type = (uint)NSCellType.NSImageCellType;
            _cell_image = anImage;
            _cell.image_position = (uint)NSCellImagePosition.NSImageOnly;
            _font = NSFont.SystemFontOfSize(-1);
            _action_mask = (uint)NSEventMask.NSLeftMouseUpMask;
            //_menu = [object_getClass(self) defaultMenu];
            //[self setFocusRingType: [object_getClass(self) defaultFocusRingType]];

            return self;
        }
Esempio n. 9
0
        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;
        }