예제 #1
0
 public IBObjectContainer()
 {
     ConnectionRecords = new NSMutableArray();
     ObjectRecords = new IBMutableOrderedSet();
     FlattenedProperties = new NSMutableDictionary();
     UnlocalizedProperties = new NSMutableDictionary();
     ActiveLocalization = null;
     Localizations = new NSMutableDictionary();
 }
예제 #2
0
        public override id InitWithCoder(NSCoder aDecoder)
        {
            base.InitWithCoder(aDecoder);

            if (aDecoder.AllowsKeyedCoding)
            {
                ReferencedPartialClassDescriptions = (NSMutableArray)aDecoder.DecodeObjectForKey("referencedPartialClassDescriptions");
            }

            return this;
        }
예제 #3
0
        public virtual id InitWithFrame(NSRect frameRect)
        {
            id self = this;

            if (base.Init() == null)
                return null;

            if (frameRect.Size.Width < 0)
            {
                frameRect.Size = new NSSize(0, frameRect.Size.Height);
            }
            if (frameRect.Size.Height < 0)
            {
                frameRect.Size = new NSSize(frameRect.Size.Width, 0);
            }

            _frame = frameRect;			// Set frame rectangle
            _bounds.Origin = NSPoint.Zero;		// Set bounds rectangle
            _bounds.Size = _frame.Size;

            // _frameMatrix = [NSAffineTransform new];    // Map fromsuperview to frame
            // _boundsMatrix = [NSAffineTransform new];   // Map from superview to bounds
            _matrixToWindow = (NSAffineTransform)NSAffineTransform.Alloc().Init();   // Map to window coordinates
            _matrixFromWindow = (NSAffineTransform)NSAffineTransform.Alloc().Init(); // Map from window coordinates

            _sub_views = (NSMutableArray)NSMutableArray.Alloc().Init();
            _tracking_rects = (NSMutableArray)NSMutableArray.Alloc().Init();
            _cursor_rects = (NSMutableArray)NSMutableArray.Alloc().Init();

            // Some values are already set by initialisation
            //_super_view = nil;
            //_window = nil;
            //_is_rotated_from_base = NO;
            //_is_rotated_or_scaled_from_base = NO;
            _rFlags.needs_display = 1;
            _post_bounds_changes = true;
            _post_frame_changes = true;
            _autoresizes_subviews = true;
            _autoresizingMask = (uint)NSViewAutoresizingMasks.NSViewNotSizable;
            //_coordinates_valid = NO;
            //_nextKeyView = 0;
            //_previousKeyView = 0;

            return self;
        }
예제 #4
0
        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)
                    //2013-06-02 10:40:22.902 Gorm[26233] NSvFlags: 0x10c (268) (268)
                    //2013-06-02 10:40:22.902 Gorm[26233] NSvFlags: 0x12d (301) (301)
                    //2013-06-02 10:40:22.903 Gorm[26233] NSvFlags: 0x112 (274) (274)

                    // We are lucky here, Apple use the same constants
                    // in the lower bits of the flags
                   this.SetAutoresizingMask(vFlags & 0x3F);
                   this.SetAutoresizesSubviews((vFlags & 0x100) == 0x100);
                   this.SetHidden((vFlags & 0x80000000) == 0x80000000);
                }

                 // iterate over subviews and put them into the view...
                subs = (NSArray)aDecoder.DecodeObjectForKey("NSSubviews");
                if (subs != null)
                {
                    e = subs.ObjectEnumerator();
                    while ((sub = (NSView)e.NextObject()) != null)
                    {
                        System.Diagnostics.Debug.Assert(sub.GetClass() != NSCustomView.Class);
                        System.Diagnostics.Debug.Assert(sub.Window == null);
                        System.Diagnostics.Debug.Assert(sub.Superview == null);

                        sub._ViewWillMoveToWindow(_window);
                        sub._ViewWillMoveToSuperview(this);
                        sub.SetNextResponder(this);
                        _sub_views.AddObject(sub);
                        _rFlags.has_subviews = 1;
                        sub.ResetCursorRects();
                        sub.SetNeedsDisplay(true);
                        sub._ViewDidMoveToWindow();
                        sub.ViewDidMoveToSuperview();
                        this.DidAddSubview(sub);

                    }
                }

                //NSvFlags = aDecoder.DecodeIntForKey("NSvFlags");
                //_sub_views = (NSArray)aDecoder.DecodeObjectForKey("NSSubviews");

                //Window = aDecoder.DecodeObjectForKey("NSWindow");
                //ClassName = (NSString)aDecoder.DecodeObjectForKey("NSWindow");

                //Offsets = aDecoder.DecodePointForKey("NSOffsets");

                //Superview = aDecoder.DecodeObjectForKey("NSSuperview");
            }

            return self;
        }
예제 #5
0
        public virtual void SetSubviews(NSArray newSubviews)
        {
            NSEnumerator en;
            NSView aView;
            NSMutableArray uniqNew = NSMutableArray.Array();

            if (null == newSubviews)
            {
                NSException.Raise(@"NSInvalidArgumentException" ,@"Setting nil as new subviews.");
            }

            // Use a copy as we remove from the subviews array
            en = NSArray.ArrayWithArray(_sub_views).ObjectEnumerator();
            while ((aView = (NSView)en.NextObject()) != null)
            {
                if (false == newSubviews.ContainsObject(aView))
                {
                    aView.RemoveFromSuperview();
                }
            }

            en = newSubviews.ObjectEnumerator();
            while ((aView = (NSView)en.NextObject()) != null)
            {
                id supersub = aView.Superview;

                if (supersub != null && supersub != this)
                {
                    NSException.Raise(@"NSInvalidArgumentException" ,@"Superviews of new subviews must be either nil or receiver.");
                }

                if (uniqNew.ContainsObject(aView))
                {
                    NSException.Raise(@"NSInvalidArgumentException" ,@"Duplicated new subviews.");
                }

                if (false == _sub_views.ContainsObject(aView))
                {
                    this.AddSubview(aView);
                }

                uniqNew.AddObject(aView);
            }

            _sub_views = uniqNew;

            // The order of the subviews may have changed
            this.SetNeedsDisplay(true);
        }
예제 #6
0
        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;
        }
예제 #7
0
        public override id InitTextCell(NSString aString)
        {
            id self = this;

            if (base.InitTextCell(aString) == null)
                return null;

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

            return self;
        }
예제 #8
0
        public virtual id InitWithTitle(NSString aTitle)
        {
            id self = this;
            NSMenuView menuRep;

            if (base.Init() == null)
                return null;

            _title = aTitle;
            _items = (NSMutableArray)NSMutableArray.Alloc().Init();
            _menu.changedMessagesEnabled = 1;
            _notifications = (NSMutableArray)NSMutableArray.Alloc().Init();
            _menu.needsSizing = 1;
            // According to the spec, menus do autoenable by default.
            _menu.autoenable = 1;

            // Create the windows that will display the menu.
            //_aWindow = [self _CreateWindow];
            //_bWindow = [self _CreateWindow];
            //[_bWindow setLevel: NSPopUpMenuWindowLevel];

            // Create a NSMenuView to draw our menu items.
            menuRep = (NSMenuView)NSMenuView.Alloc().InitWithFrame(NSRect.Zero);
            //[self setMenuRepresentation: menuRep];

            return self;
        }
예제 #9
0
        private static void _LoadAvailableColorLists(NSNotification aNotification)
        {
            _colorListLock.Lock();

            /* FIXME ... we should ensure that we get housekeeping notifications */
            if (_availableColorLists != null && aNotification == null)
            {
                // Nothing to do ... already loaded
                _colorListLock.Unlock();
            }
            else
            {
                NSString dir;
                NSString file;
                NSEnumerator e;
                NSFileManager fm = NSFileManager.DefaultManager;
                NSDirectoryEnumerator de;
                NSColorList newList;

                if (_availableColorLists == null)
                {
                    // Create the global array of color lists
                    _availableColorLists = (NSMutableArray)NSMutableArray.Alloc().Init();
                }
                else
                {
                    _availableColorLists.RemoveAllObjects(); ;
                }

                /*
                 * Keep any pre-loaded system color list.
                 */
                if (ThemeColorList != null)
                {
                    _availableColorLists.AddObject(ThemeColorList);
                }

                /*
                 * Load color lists found in standard paths into the array
                 * FIXME: Check exactly where in the directory tree we should scan.
                 */
                e = NSSearchPathForDirectoriesInDomains(
                    NSSearchPathDirectory.NSLibraryDirectory,
                    NSSearchPathDomainMask.NSAllDomainsMask, true).ObjectEnumerator();

                while ((dir = (NSString)e.NextObject()) != null)
                {
                    bool flag = false;

                    dir = dir.StringByAppendingPathComponent(@"Colors");
                    if (!fm.FileExistsAtPath(dir, ref flag) || !flag)
                    {
                        // Only process existing directories
                        continue;
                    }

                    de = fm.EnumeratorAtPath(dir);
                    while ((file = (NSString)de.NextObject()) != null)
                    {
                        if (file.PathExtension().IsEqualToString(@"clr"))
                        {
                            NSString name;

                            name = file.StringByDeletingPathExtension();
                            newList = (NSColorList)NSColorList.Alloc().InitWithName(name, dir.StringByAppendingPathComponent(file));
                            _availableColorLists.AddObject(newList);
                        }
                    }
                }

                if (DefaultSystemColorList != null)
                {
                    _availableColorLists.AddObject(DefaultSystemColorList);
                }
                _colorListLock.Unlock();
            }
        }
예제 #10
0
        public virtual id InitWithName(NSString name, NSString path)
        {
            id self = this;
            NSColorList cl = null;
            bool could_load = false;

            _name = name;
            if (path != null)
            {
                bool isDir = false;
                // previously impl wrongly expected directory containing color file
                // rather than color file; we support this for apps that rely on it
                if ((NSFileManager.DefaultManager.FileExistsAtPath(path, ref isDir) == false) || isDir == true)
                {
                    //NSLog(@"NSColorList -initWithName:fromFile: warning: excluding " @"filename from path (%@) is deprecated.", path);
                    _fullFileName = path.StringByAppendingPathComponent(name).StringByAppendingPathExtension(@"clr");
                }
                else
                {
                    _fullFileName = path;
                }

                // Unarchive the color list

                // TODO [Optm]: Rewrite to initialize directly without unarchiving
                // in another object
                try
                {
                    //FIXME
                    //cl = (NSColorList) NSUnarchiver.UnarchiveObjectWithFile(_fullFileName);
                }
                catch (Exception ex)
                {
                    cl = null;
                }

                if ((cl != null) && (cl.IsKindOfClass(NSColorList.Class)))
                {
                    could_load = true;

                    _is_editable = NSFileManager.DefaultManager.IsWritableFileAtPath(_fullFileName);

                    _colorDictionary = NSMutableDictionary.DictionaryWithDictionary(cl._colorDictionary);

                    _orderedColorKeys = NSMutableArray.ArrayWithArray(cl._orderedColorKeys);
                }
                else if (NSFileManager.DefaultManager.FileExistsAtPath(path))
                {
                    _colorDictionary = (NSMutableDictionary)NSMutableDictionary.Alloc().Init();
                    _orderedColorKeys = (NSMutableArray)NSMutableArray.Alloc().Init();
                    _is_editable = true;

                    if (_ReadTextColorFile(_fullFileName))
                    {
                        could_load = true;
                        _is_editable = NSFileManager.DefaultManager.IsWritableFileAtPath(_fullFileName);
                    }
                    else
                    {
                        _colorDictionary = null;
                        _orderedColorKeys = null;
                    }
                }
            }

            if (could_load == false)
            {
                _fullFileName = null;
                _colorDictionary = (NSMutableDictionary)NSMutableDictionary.Alloc().Init();
                _orderedColorKeys = (NSMutableArray)NSMutableArray.Alloc().Init();
                _is_editable = true;
            }

            return self;
        }
예제 #11
0
        public override id InitWithFrame(NSRect aFrame)
        {
            id self = this;

            //self = [super initWithFrame: aFrame];
            //if (!self)
            //  return nil;

            //[self setFont: [NSFont menuFontOfSize: 0.0]];

            _highlightedItemIndex = -1;
            _horizontalEdgePad = 4.0f;

            /* Set the necessary offset for the menuView. That is, how many pixels
             * do we need for our left side border line.
             */
            _leftBorderOffset = 1;

            // Create an array to store our menu item cells.
            _itemCells = (NSMutableArray)NSMutableArray.Alloc().Init();

            return self;
        }
예제 #12
0
 public IBClassDescriber()
 {
     ReferencedPartialClassDescriptions = new NSMutableArray();
 }
        public virtual GSXibElement InitWithTypeAndAttributes(NSString typeName, NSDictionary attribs)
        {
            GSXibElement self = this;

            _type = typeName;
            _attributes = attribs;
            _elements = (NSMutableDictionary)NSMutableDictionary.Alloc().Init();
            _values = (NSMutableArray)NSMutableArray.Alloc().Init();

            return self;
        }