public IBObjectContainer() { ConnectionRecords = new NSMutableArray(); ObjectRecords = new IBMutableOrderedSet(); FlattenedProperties = new NSMutableDictionary(); UnlocalizedProperties = new NSMutableDictionary(); ActiveLocalization = null; Localizations = new NSMutableDictionary(); }
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; }
static new void Initialize() { namedColorLock = (NSRecursiveLock)NSRecursiveLock.Alloc().Init(); namedColors = (NSMutableDictionary)NSMutableDictionary.Alloc().Init(); }
public static void InitSystemColors() { NSString white; NSString lightGray; NSString gray; NSString darkGray; NSString black; // Set up a dictionary containing the names of all the system colors // as keys and with colors in string format as values. white = NSString.StringWithFormat(@"%g %g %g", (double)NSWhite, (double)NSWhite, (double)NSWhite); lightGray = NSString.StringWithFormat(@"%g %g %g", (double)NSLightGray, (double)NSLightGray, (double)NSLightGray); gray = NSString.StringWithFormat(@"%g %g %g", (double)NSGray, (double)NSGray, (double)NSGray); darkGray = NSString.StringWithFormat(@"%g %g %g", (double)NSDarkGray, (double)NSDarkGray, (double)NSDarkGray); black = NSString.StringWithFormat(@"%g %g %g", (double)NSBlack, (double)NSBlack, (double)NSBlack); ColorStrings = (NSMutableDictionary)NSMutableDictionary.Alloc().InitWithObjectsAndKeys( lightGray, (NSString)@"controlBackgroundColor", lightGray, (NSString)@"controlColor", lightGray, (NSString)@"controlHighlightColor", white, (NSString)@"controlLightHighlightColor", darkGray, (NSString)@"controlShadowColor", black, (NSString)@"controlDarkShadowColor", black, (NSString)@"controlTextColor", darkGray, (NSString)@"disabledControlTextColor", gray, (NSString)@"gridColor", lightGray, (NSString)@"headerColor", black, (NSString)@"headerTextColor", white, (NSString)@"highlightColor", black, (NSString)@"keyboardFocusIndicatorColor", lightGray, (NSString)@"knobColor", gray, (NSString)@"scrollBarColor", white, (NSString)@"selectedControlColor", black, (NSString)@"selectedControlTextColor", lightGray, (NSString)@"selectedKnobColor", white, (NSString)@"selectedMenuItemColor", black, (NSString)@"selectedMenuItemTextColor", lightGray, (NSString)@"selectedTextBackgroundColor", black, (NSString)@"selectedTextColor", black, (NSString)@"shadowColor", white, (NSString)@"textBackgroundColor", black, (NSString)@"textColor", lightGray, (NSString)@"windowBackgroundColor", black, (NSString)@"windowFrameColor", white, (NSString)@"windowFrameTextColor", black, (NSString)@"alternateSelectedControlColor", white, (NSString)@"alternateSelectedControlTextColor", white, (NSString)@"rowBackgroundColor", lightGray, (NSString)@"alternateRowBackgroundColor", lightGray, (NSString)@"secondarySelectedControlColor", //gray, (NSString)@"windowFrameColor", //black, (NSString)@"windowFrameTextColor", null); SystemColors = NSColorList.ColorListNamed(@"System"); DefaultSystemColors = (NSColorList)NSColorList.Alloc().InitWithName(@"System"); NSColorList._SetDefaultSystemColorList(DefaultSystemColors); if (SystemColors == null) { SystemColors = DefaultSystemColors; } { NSEnumerator enumerator; NSString key; // Set up default system colors enumerator = ColorStrings.KeyEnumerator(); while ((key = (NSString)enumerator.NextObject()) != null) { NSColor color; if ((color = SystemColors.ColorWithKey(key)) == null) { NSString aColorString; aColorString = (NSString)ColorStrings.ObjectForKey(key); color = NSColor.ColorFromString(aColorString); //NSCAssert1(color, @"couldn't get default system color %@", key); SystemColors.SetColor(color, key); } if (DefaultSystemColors != SystemColors) { DefaultSystemColors.SetColor(color, key); } } } SystemDict = (NSMutableDictionary)NSMutableDictionary.Alloc().Init(); }
public static void RegisterModelLoaderClass(Class aClass) { if (_modelMap == null) { _modelMap = (NSMutableDictionary)NSMutableDictionary.Alloc().InitWithCapacity(5); } _modelMap.SetObjectForKey(aClass, (NSString)Objc.MsgSend(aClass, "Type")); }
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; }
//<object class="IBPartialClassDescription"> //<string key="className">ComposeController</string> // <string key="superclassName">NSWindowController</string> // <object class="NSMutableDictionary" key="actions"> // <bool key="EncodedWithXMLCoder">YES</bool> // <object class="NSArray" key="dict.sortedKeys"> // <bool key="EncodedWithXMLCoder">YES</bool> // <string>attachmentUploaded:</string> // <string>saveAsDraftButtonClickedAction:</string> // <string>sendButtonClickedAction:</string> // <string>toogleFormatBar:</string> // </object> // <object class="NSMutableArray" key="dict.values"> // <bool key="EncodedWithXMLCoder">YES</bool> // <string>id</string> // <string>id</string> // <string>id</string> // <string>id</string> // </object> public override id InitWithCoder(NSCoder aDecoder) { id self = this; base.InitWithCoder(aDecoder); if (aDecoder.AllowsKeyedCoding) { ClassName = (NSString)aDecoder.DecodeObjectForKey("className"); SuperClassName = (NSString)aDecoder.DecodeObjectForKey("superclassName"); Actions = (NSMutableDictionary)aDecoder.DecodeObjectForKey("actions"); ActionInfosByName = (NSMutableDictionary)aDecoder.DecodeObjectForKey("actionInfosByName"); Outlets = (NSMutableDictionary)aDecoder.DecodeObjectForKey("outlets"); ToOneOutletInfosByName = (NSMutableDictionary)aDecoder.DecodeObjectForKey("toOneOutletInfosByName"); SourceIdentifier = (IBClassDescriptionSource)aDecoder.DecodeObjectForKey("sourceIdentifier"); } return self; }
private NSData PreProcessXib(NSData data) { NSData result = data; string xml = System.Text.Encoding.Default.GetString(data.Bytes); XDocument xDoc = XDocument.Parse(xml); NSMutableDictionary customClassDict = new NSMutableDictionary(); var customClassNodes = xDoc.XPathSelectElements("//dictionary[@key=\"flattenedProperties\"]/string[contains(@key,\"CustomClassName\")]", null); if (customClassNodes != null && customClassNodes.Count() == 1) { } else { var flatProps = xDoc.XPathSelectElements("//object[@key=\"flattenedProperties\"]", null); if (flatProps != null && flatProps.Count() == 1) { var xmlKeys = xDoc.XPathSelectElements("//object[@key=\"flattenedProperties\"]/object[@key=\"dict.sortedKeys\"]/*", null).ToArray(); var xmlObjs = xDoc.XPathSelectElements("//object[@key=\"flattenedProperties\"]/object[@key=\"dict.values\"]/*", null).ToArray(); for (int index = 0; index < xmlKeys.Count(); index++) { NSString key = xmlKeys[index].Value; if (key.Contains("CustomClassName")) { customClassDict.Add(key, (NSString)xmlObjs[index].Value); } } } } if (customClassDict.Count > 0) { foreach (var kvp in customClassDict) { NSString keyValue = ((NSString)kvp.Key).Replace(".CustomClassName", ""); NSString className = (NSString)kvp.Value; NSString objectRecordXpath = string.Format("//object[@class=\"IBObjectRecord\"]/int[@key=\"objectID\"][text()=\"{0}\"]/../reference", keyValue); var objectRecords = xDoc.XPathSelectElements(objectRecordXpath, null).ToArray(); if (objectRecords != null && objectRecords.Count() > 0) { foreach (var record in objectRecords) { if (record.AttributeValueOrDefault("key", "") == "object") { var refId = record.AttributeValueOrDefault("ref", ""); var refXpath = string.Format("//object[@id=\"{0}\"]", refId); var classNodes = xDoc.XPathSelectElements(refXpath, null).ToArray(); if (classNodes != null && classNodes.Count() > 0) { Class cls = Class.NSClassFromString(className); var classNode = classNodes[0]; var classAttr = classNode.Attribute("class"); classAttr.Value = className; if (cls != null) { } } } } } } } // ... return result; }
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; }
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; }
public virtual void SetFileAttributes(NSDictionary attributes) { if (_fileAttributes == null) { _fileAttributes = (NSMutableDictionary)NSMutableDictionary.Alloc().Init(); } _fileAttributes.AddEntriesFromDictionary(attributes); }