public static FontData FromFont(NSFont font) { var traits = NSFontManager.SharedFontManager.TraitsOfFont (font); FontStretch stretch; if ((traits & NSFontTraitMask.Condensed) != 0) stretch = FontStretch.Condensed; else if ((traits & NSFontTraitMask.Narrow) != 0) stretch = FontStretch.SemiCondensed; else if ((traits & NSFontTraitMask.Compressed) != 0) stretch = FontStretch.ExtraCondensed; else if ((traits & NSFontTraitMask.Expanded) != 0) stretch = FontStretch.Expanded; else stretch = FontStretch.Normal; FontStyle style; if ((traits & NSFontTraitMask.Italic) != 0) style = FontStyle.Italic; else style = FontStyle.Normal; return new FontData { Font = font, Style = style, Weight = MacFontBackendHandler.GetWeightFromValue (NSFontManager.SharedFontManager.WeightOfFont (font)), Stretch = stretch }; }
public override void SetupSlide (PresentationViewController presentationViewController) { // Create the font and the materials that will be shared among the features in the word cloud Font = NSFont.FromFontName ("Myriad Set BoldItalic", 50) != null ? NSFont.FromFontName ("Myriad Set BoldItalic", 50) : NSFont.FromFontName ("Avenir Heavy Oblique", 50); var frontAndBackMaterial = SCNMaterial.Create (); var sideMaterial = SCNMaterial.Create (); sideMaterial.Diffuse.Contents = NSColor.DarkGray; Materials = new SCNMaterial[] { frontAndBackMaterial, sideMaterial, frontAndBackMaterial }; // Add different features to the word cloud PlaceFeature ("Export to DAE", new CGPoint (10, -8), 0); PlaceFeature ("OpenGL Core Profile", new CGPoint (-16, -7), 0.05f); PlaceFeature ("Warmup", new CGPoint (-12, -10), 0.1f); PlaceFeature ("Constraints", new CGPoint (-10, 6), 0.15f); PlaceFeature ("Custom projection", new CGPoint (4, 9), 0.2f); PlaceFeature ("Skinning", new CGPoint (-4, 8), 0.25f); PlaceFeature ("Morphing", new CGPoint (-3, -8), 0.3f); PlaceFeature ("Performance Statistics", new CGPoint (-1, 6), 0.35f); PlaceFeature ("CIFilters", new CGPoint (1, 5), 0.85f); PlaceFeature ("GLKit Math", new CGPoint (3, -10), 0.45f); PlaceFeature ("Depth of Field", new CGPoint (-0.5f, 0), 0.47f); PlaceFeature ("Animation Events", new CGPoint (5, 3), 0.50f); PlaceFeature ("Shader Modifiers", new CGPoint (7, 2), 0.95f); PlaceFeature ("GOBO", new CGPoint (-10, 1), 0.60f); PlaceFeature ("Ray testing", new CGPoint (-8, 0), 0.65f); PlaceFeature ("Skybox", new CGPoint (8, -1), 0.7f); PlaceFeature ("Fresnel", new CGPoint (6, -2), 0.75f); PlaceFeature ("SCNShape", new CGPoint (-6, -3), 0.8f); PlaceFeature ("Levels of detail", new CGPoint (-11, 3), 0.9f); PlaceFeature ("Animation blending", new CGPoint (-2, -5), 1); }
public SparkleUI() { // Use translations Catalog.Init ("sparkleshare", Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations")); using (NSAutoreleasePool pool = new NSAutoreleasePool ()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate (); NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); SetFolderIcon (); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } } }
public override void SetupSlide (PresentationViewController presentationViewController) { // Create the font and the materials that will be shared among the features in the word cloud Font = NSFont.FromFontName ("Myriad Set BoldItalic", 50) != null ? NSFont.FromFontName ("Myriad Set BoldItalic", 50) : NSFont.FromFontName ("Avenir Heavy Oblique", 50); var frontAndBackMaterial = SCNMaterial.Create (); var sideMaterial = SCNMaterial.Create (); sideMaterial.Diffuse.Contents = NSColor.DarkGray; Materials = new SCNMaterial[] { frontAndBackMaterial, sideMaterial, frontAndBackMaterial }; // Add different features to the word cloud PlaceFeature ("Techniques", new CGPoint (10, -8), 0); PlaceFeature ("SpriteKit materials", new CGPoint (-16, -7), 0.05f); PlaceFeature ("Inverse Kinematics", new CGPoint (-12, -6), 0.1f); PlaceFeature ("Actions", new CGPoint (-10, 6), 0.15f); PlaceFeature ("SKTexture", new CGPoint (4, 9), 0.2f); PlaceFeature ("JavaScript", new CGPoint (-4, 8), 0.25f); PlaceFeature ("Alembic", new CGPoint (-3, -8), 0.3f); PlaceFeature ("OpenSubdiv", new CGPoint (-1, 6), 0.35f); PlaceFeature ("Assets catalog", new CGPoint (1, 5), 0.85f); PlaceFeature ("SIMD bridge", new CGPoint (3, -6), 0.45f); PlaceFeature ("Physics", new CGPoint (-0.5f, 0), 0.47f); PlaceFeature ("Vehicle", new CGPoint (5, 3), 0.50f); PlaceFeature ("Fog", new CGPoint (7, 2), 0.95f); PlaceFeature ("SpriteKit Overlays", new CGPoint (-10, 1), 0.60f); PlaceFeature ("Particles", new CGPoint (-13, -1), 0.65f); PlaceFeature ("Forward shadows", new CGPoint (8, -1), 0.7f); PlaceFeature ("Snapshot", new CGPoint (6, -2), 0.75f); PlaceFeature ("Physics Fields", new CGPoint (-6, -3), 0.8f); PlaceFeature ("Archiving", new CGPoint (-11, 3), 0.9f); PlaceFeature ("Performance tools", new CGPoint (-2, -5), 1); }
public static NSAttributedString CreateString(this string text, NSColor color, NSFont font) { NSObject[] objects = new NSObject[] { color, font }; NSObject[] keys = new NSObject[] { NSAttributedString.ForegroundColorAttributeName, NSAttributedString.FontAttributeName }; NSDictionary attributes = NSDictionary.FromObjectsAndKeys (objects, keys); return new NSAttributedString (text, attributes); }
void BuildFont () { // 95 since if we do 96, we get the delete character... baseDL = GL.GenLists (95); font = NSFont.FromFontName (fontName, fontSize); if (font == null) Console.WriteLine ("Unable to create font: " + fontName); else MakeGLDisplayListFirst (' ', 95, baseDL); }
public unsafe void AppendPathWithGlyphs(uint[] glyphs, NSFont font) { if (glyphs == null) throw new ArgumentNullException ("glyphs"); if (glyphs.Length < 1) throw new ArgumentException ("glyphs array is empty"); fixed (uint* ptr = &glyphs [0]) _AppendPathWithGlyphs ((IntPtr)ptr, glyphs.Length, font); }
static NSAttributedString CreateAttributedString(string text, NSFont font) { NSDictionary dict; if (font != null) { dict = NSDictionary.FromObjectsAndKeys( new object [] { font, new NSNumber(true) }, new object [] { CTStringAttributeKey.Font, CTStringAttributeKey.ForegroundColorFromContext } ); } else { dict = NSDictionary.FromObjectsAndKeys( new object [] { new NSNumber(true) }, new object [] { CTStringAttributeKey.ForegroundColorFromContext } ); } return(new NSAttributedString(text, dict)); }
public void ToggleItalic(NSButton sender) { NSFont newFont = null; if (sender.State == NSCellStateValue.On) { newFont = NSFontManager.SharedFontManager.ConvertFont(arcView.Font, NSFontTraitMask.Italic); } else { newFont = NSFontManager.SharedFontManager.ConvertFontToNotHaveTrait(arcView.Font, NSFontTraitMask.Italic); } if (newFont != null) { arcView.Font = newFont; updateDisplay(); NSFontPanel.SharedFontPanel.SetPanelFont(arcView.Font, false); } }
public override void AwakeFromNib() { base.AwakeFromNib(); availableInputFieldsContainer.LinkClicked = (sender, e) => (e.Link.Tag as Action)?.Invoke(); helpLinkLabel.StringValue = "Help"; helpLinkLabel.LinkClicked = (sender, e) => events.OnHelpLinkClicked(); fieldsTable.DataSource = fieldsDataSource; fieldsTable.Delegate = new FieldsDelegate() { owner = this }; nameComboBox.Changed += (sender, e) => events.OnNameComboBoxTextChanged(); codeTextBox.Font = NSFont.FromFontName("Courier", 11); codeTextBox.TextDidChange += (sender, e) => events.OnCodeTextBoxChanged(); fieldsLinksHScroller.ScrollerStyle = NSScrollerStyle.Legacy; foreach (var i in codeTypeComboxBox.Items().ZipWithIndex()) { i.Value.Tag = i.Key; } }
static NSImage Render(string value) { NSImage image = null; NSApplication.SharedApplication.InvokeOnMainThread(() => { NSString text = new NSString(string.IsNullOrEmpty(value) ? " " : value); NSFont font = NSFont.FromFontName("Arial", 20); var fontDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { font, NSColor.Red }, new NSObject[] { NSStringAttributeKey.Font, NSStringAttributeKey.ForegroundColor }); CGSize size = text.StringSize(fontDictionary); image = new NSImage(new CGSize(size)); image.LockFocus(); text.DrawString(new CGPoint(0, 0), fontDictionary); image.UnlockFocus(); }); return(image); }
public static SCNNode SCLabelNode(string message, LabelSize size, bool isLit) { var node = SCNNode.Create(); var text = SCNText.Create(message, 0); node.Geometry = text; node.Scale = new SCNVector3((0.01f * (int)size), (0.01f * (int)size), (0.01f * (int)size)); text.Flatness = 0.4f; // Use Myriad it's if available, otherwise Avenir text.Font = NSFont.FromFontName("Myriad Set", 50) != null?NSFont.FromFontName("Myriad Set", 50) : NSFont.FromFontName("Avenir Medium", 50); if (!isLit) { text.FirstMaterial.LightingModelName = SCNLightingModel.Constant; } return(node); }
public static NSFont ToNSFont(this FontAttributes attributes) { if (attributes == null) { return(NSFont.SystemFontOfSize(12)); } if (attributes.Family == Device.FontService.SystemFontName) { var weight = (int)attributes.Weight; if (weight > (int)Weight.Regular) { return(NSFont.BoldSystemFontOfSize(attributes.Size)); } return(NSFont.SystemFontOfSize(attributes.Size)); } return(NSFont.FromFontName(attributes.Family, attributes.Size)); }
private static void ConfigureStyles() { Style.Add <FormHandler>(EtoStyles.FormMain, handler => { var control = handler.Control; control.Center(); }); Style.Add <DialogHandler>(EtoStyles.DeviceBotDialog, handler => { var control = handler.Control; control.Center(); }); Style.Add <SyntaxHightlightTextAreaHandler>(EtoStyles.SourceEditor, handler => { var control = handler.Control; control.Font = NSFont.FromFontName("Monaco", control.Font.PointSize); control.AutomaticQuoteSubstitutionEnabled = false; }); Style.Add <TextAreaHandler>(EtoStyles.SendCommandText, handler => { var control = handler.Control; control.Font = NSFont.FromFontName("Monaco", control.Font.PointSize); control.AutomaticQuoteSubstitutionEnabled = false; }); Style.Add <ToolBarHandler>(EtoStyles.Toolbar, handler => { var control = handler.Control; control.DisplayMode = NSToolbarDisplayMode.IconAndLabel; control.SizeMode = NSToolbarSizeMode.Regular; control.ShowsBaselineSeparator = false; }); Style.Add <ButtonToolItemHandler>(EtoStyles.ButtonToolItem, handler => { var control = handler.Control; var x = control.View as NSButton; x.BezelStyle = NSBezelStyle.Disclosure; }); }
void UpdateTitle() { if (_toolbar == null || _navigation == null || _titleGroup == null) { return; } var title = GetCurrentPageTitle(); var item = new NSToolbarItem(title); var view = new NSView(); var titleField = new NSTextField { AllowsEditingTextAttributes = true, Bordered = false, DrawsBackground = false, Bezeled = false, Editable = false, Selectable = false, Cell = new VerticallyCenteredTextFieldCell(0f, NSFont.TitleBarFontOfSize(18)), StringValue = title }; titleField.Cell.TextColor = GetTitleColor(); titleField.SizeToFit(); _titleGroup.Group.MinSize = new CGSize(NavigationTitleMinSize, ToolbarHeight); _titleGroup.Group.Subitems = new NSToolbarItem[] { item }; view.AddSubview(titleField); _titleGroup.Group.View = view; //save a reference so we can paint this for the background _nsToolbarItemViewer = _titleGroup.Group.View.Superview; if (_nsToolbarItemViewer == null) { return; } //position is hard .. we manually set the title to be centered var totalWidth = _nsToolbarItemViewer.Superview.Frame.Width; var fieldWidth = titleField.Frame.Width; var x = ((totalWidth - fieldWidth) / 2) - _nsToolbarItemViewer.Frame.X; titleField.Frame = new CGRect(x, 0, fieldWidth, ToolbarHeight); }
void CreateUI() { var style = _style; AddSubview(TextLabel = new NSTextField { Bordered = false, Selectable = false, Editable = false, Font = NSFont.LabelFontOfSize(NSFont.SystemFontSize) }); TextLabel.Cell.BackgroundColor = s_defaultChildViewsBackground; if (style == NSTableViewCellStyle.Image || style == NSTableViewCellStyle.Subtitle || style == NSTableViewCellStyle.ImageSubtitle) { AddSubview(DetailTextLabel = new NSTextField { Bordered = false, Selectable = false, Editable = false, Font = NSFont.LabelFontOfSize(NSFont.SmallSystemFontSize) }); DetailTextLabel.Cell.BackgroundColor = s_defaultChildViewsBackground; } if (style == NSTableViewCellStyle.Image || style == NSTableViewCellStyle.ImageSubtitle) { AddSubview(ImageView = new NSImageView()); } if (style == NSTableViewCellStyle.Value1 || style == NSTableViewCellStyle.Value2) { var accessoryView = new NSView { WantsLayer = true }; accessoryView.Layer.BackgroundColor = s_defaultChildViewsBackground.CGColor; AddSubview(AccessoryView = accessoryView); } }
protected override IView OnConvertToView(FigmaNode currentNode, ViewNode parentNode, ViewRenderService rendererService) { var frame = (FigmaFrame)currentNode; frame.TryGetNativeControlType(out var controlType); var scrollView = new NSScrollView(); var textView = new NSTextView( new CoreGraphics.CGRect(0, 0, scrollView.ContentSize.Width, scrollView.ContentSize.Height)); textView.Font = NSFont.SystemFontOfSize(NSFont.SystemFontSize); textView.AutoresizingMask = NSViewResizingMask.WidthSizable; textView.TextContainer.Size = new CoreGraphics.CGSize(scrollView.ContentSize.Width, float.MaxValue); var texts = frame.children.OfType <FigmaText>(); FigmaText text = texts.FirstOrDefault(s => s.name == ComponentString.TEXT && s.visible); if (text != null) { textView.Value = rendererService.GetTranslatedText(text.characters); textView.Value = textView.Value.Replace("\\n", Environment.NewLine); // TODO: text styling // textView.TextStorage.Append(new Foundation.NSAttributedString(""), null); } scrollView.BorderType = NSBorderType.LineBorder; scrollView.HasHorizontalScroller = false; scrollView.HasVerticalScroller = true; scrollView.DocumentView = textView; frame.TryGetNativeControlVariant(out var controlVariant); if (controlVariant == NativeControlVariant.Small) { textView.Font = NSFont.SystemFontOfSize(NSFont.SmallSystemFontSize); } return(new View(scrollView)); }
public FontTypefaceHandler(NSFont font, NSFontTraitMask?traits = null) { var descriptor = font.FontDescriptor; PostScriptName = descriptor.PostscriptName; var manager = NSFontManager.SharedFontManager; Weight = (int)manager.WeightOfFont(font); Traits = traits ?? manager.TraitsOfFont(font); name = (NSString)descriptor.FontAttributes[NSFontFaceAttribute]; if (name == null) { // no attribute, find font face based on postscript name var members = manager.AvailableMembersOfFontFamily(font.FamilyName); var member = members.FirstOrDefault(r => (string)(NSString)Runtime.GetNSObject(r.ValueAt(0)) == PostScriptName); if (member != null) { name = (string)(NSString)Runtime.GetNSObject(member.ValueAt(1)); } } }
public CustomSearchField() { TranslatesAutoresizingMaskIntoConstraints = false; Cell = cell = new SearchFieldCell(this); WantsLayer = true; var internalLayer = new CoreAnimation.CALayer(); internalLayer.BorderWidth = 1; internalLayer.BorderColor = NSColor.FromRgba(red: 0.75f, green: 0.75f, blue: 0.75f, 0.45f).CGColor; internalLayer.Frame = new CGRect(1, 0, DefaultWidth + 2, DefaultHeight); internalLayer.CornerRadius = 2; Layer.AddSublayer(internalLayer); Font = NSFont.SystemFontOfSize(SearchFontSize, NSFontWeight.Thin); //default size needs to be changed before change cell WidthAnchor.ConstraintEqualToConstant(DefaultWidth).Active = true; HeightAnchor.ConstraintEqualToConstant(DefaultHeight).Active = true; }
public override object SetFamily(object handle, string family) { FontData f = (FontData)handle; f = f.Copy(); var names = family.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); NSFont font = null; foreach (var name in names) { font = NSFontManager.SharedFontManager.ConvertFontToFamily(f.Font, name.Trim()); if (font != null) { f.Font = font; break; } } return(f); }
public BrushTabViewController(IHostResourceProvider hostResources) : base(hostResources) { TabBorderColor = NamedResources.TabBorderColor; TabBackgroundColor = NamedResources.PadBackgroundColor; PreferredContentSize = new CGSize(450, 280); TransitionOptions = NSViewControllerTransitionOptions.None; ContentPadding = new NSEdgeInsets(8, 8, 8, 8); this.filterResource = new NSSearchField { ControlSize = NSControlSize.Small, Font = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Small)), PlaceholderString = Properties.Resources.SearchResourcesTitle, }; this.filterResource.Changed += OnResourceFilterChanged; this.filterResource.Hidden = true; TabStack.AddView(this.filterResource, NSStackViewGravity.Leading); }
public void GetBoundingRect_SmokeTest() { TestRuntime.AssertXcodeVersion(9, 0); CGFont cgFont = CGFont.CreateWithFontName("Arial"); ushort [] glyphs = new ushort [5]; for (int i = 0; i < 5; ++i) { glyphs[i] = cgFont.GetGlyphWithGlyphName("Hello"[i].ToString()); } CTFont ctFont = new CTFont(cgFont, 14, new CTFontDescriptor("Arial", 14)); NSFont nsFont = NSFont.FromCTFont(ctFont); var bounding = nsFont.GetBoundingRects(glyphs); var advancement = nsFont.GetAdvancements(glyphs); Assert.AreEqual(5, bounding.Length); Assert.AreEqual(5, advancement.Length); }
/// <summary> /// Initialize this instance. /// </summary> private void Initialize() { // Init this.Delegate = new SourceTextViewDelegate(this); NSFont fixedFont = null; var fixedFontList = new [] { "SF Mono", "Monaco", "New Courier", "Courier" }; foreach (var fontName in fixedFontList) { fixedFont = NSFont.FromFontName(fontName, 12); if (fixedFont != null) { break; } } if (fixedFont != null) { this.Font = fixedFont; } }
NSAttributedString GetStatusString(string text, NSColor color) { nfloat fontSize = NSFont.SystemFontSize; if (Window != null && Window.Screen != null) { fontSize -= Window.Screen.BackingScaleFactor == 2 ? 2 : 1; } else { fontSize -= 1; } return(new NSAttributedString(text, new NSStringAttributes { ForegroundColor = color, ParagraphStyle = new NSMutableParagraphStyle { HeadIndent = imageView.Frame.Width, LineBreakMode = NSLineBreakMode.TruncatingMiddle, }, Font = NSFont.SystemFontOfSize(fontSize), })); }
public override void AwakeFromNib() { base.AwakeFromNib(); m_colorBackground = GuiUtils.ConvertColor(Colors.LightChartBackground); m_colorGrid = GuiUtils.ConvertColor(Colors.LightChartGrid); m_colorAxis = GuiUtils.ConvertColor(Colors.LightChartAxis); m_colorMouse = GuiUtils.ConvertColor(Colors.LightChartMouse); m_colorDownloadGraph = GuiUtils.ConvertColor(Colors.LightChartLineDownload); m_colorDownloadLine = GuiUtils.ConvertColor(Colors.LightChartLineDownload); m_colorUploadGraph = GuiUtils.ConvertColor(Colors.LightChartLineUpload); m_colorUploadLine = GuiUtils.ConvertColor(Colors.LightChartLineUpload); //m_colorLegendText = GuiUtils.ConvertColor(Colors.LightChartLegend); m_colorDownloadText = GuiUtils.ConvertColor(Colors.LightChartLineDownload); m_colorUploadText = GuiUtils.ConvertColor(Colors.LightChartLineUpload); m_font = NSFont.FromFontName("Menlo", 10); m_chart = Engine.Instance.Stats.Charts.ChartsList[m_chartIndex]; Engine.Instance.Stats.Charts.UpdateEvent += new Core.UI.Charts.UpdateHandler(Charts_UpdateEvent); }
public static NSAttributedString AttributeTitle(string title, NSColor color, float fontsize) { NSMutableParagraphStyle ps = new NSMutableParagraphStyle(); ps.Alignment = NSTextAlignment.Center; NSColor fontColor = color; NSFont font = NSFont.SystemFontOfSize(fontsize); NSString titleObj = new NSString(title); NSStringAttributes attributes = new NSStringAttributes(); attributes.Font = font; attributes.ForegroundColor = fontColor; attributes.ParagraphStyle = ps; attributes.BackgroundColor = NSColor.Clear; attributes.ToolTip = titleObj; NSAttributedString buttonString = new NSAttributedString(title, attributes); return(buttonString); }
public static NSImage CreateIconWithSolutionName(string name, NSImage baseImage) { if (string.IsNullOrWhiteSpace(name)) { return(baseImage); } const float margin = 4; var text = (NSString)name; // setup text styles var paragraphStyle = (NSParagraphStyle)NSParagraphStyle.DefaultParagraphStyle.MutableCopy(); paragraphStyle.Alignment = NSTextAlignment.Center; var attributes = new NSStringAttributes { Font = NSFont.SystemFontOfSize(19, NSFontWeight.Regular), ForegroundColor = NSColor.White, ParagraphStyle = paragraphStyle }; // setup rect var textRect = new CGSize(baseImage.Size.Width - margin * 2, baseImage.Size.Height - 2 * margin); var rect = text.BoundingRectWithSize(textRect, NSStringDrawingOptions.UsesLineFragmentOrigin, attributes.Dictionary); var centerAdjustment = baseImage.Size.Width - rect.Width - 2 * margin; rect.Offset(margin + centerAdjustment / 2, margin); // create image var brandedImage = NSImage.ImageWithSize(baseImage.Size, false, dstRect => { baseImage.Draw(dstRect); DrawBackgroundInRect(rect); text.DrawInRect(rect, attributes); return(true); }); return(brandedImage); }
public static NSFont ToNSFont(this Font font) { if (font == null) { return(NSFont.SystemFontOfSize(12)); } var attributes = font.Attributes; if (attributes.Name == Device.FontService.SystemFontName) { var weight = (int)attributes.Weight; if (weight > (int)Weight.Regular) { return(NSFont.BoldSystemFontOfSize(attributes.Size)); } return(NSFont.SystemFontOfSize(attributes.Size)); } return(NSFont.FromFontName(attributes.Name, attributes.Size)); }
/// <summary> /// User chose a different control font size from the Font Size popup /// </summary> /// <param name="sender"> /// A <see cref="NSPopUpButton"/> /// </param> partial void setFontSize(NSPopUpButton sender) { int tag = sender.SelectedCell.Tag; switch ((NSControlSize)tag) { case NSControlSize.Mini: datePickerControl.Cell.ControlSize = NSControlSize.Mini; datePickerControl.Cell.Font = NSFont.SystemFontOfSize(9.0f); break; case NSControlSize.Small: datePickerControl.Cell.ControlSize = NSControlSize.Small; datePickerControl.Cell.Font = NSFont.SystemFontOfSize(11.0f); break; case NSControlSize.Regular: datePickerControl.Cell.ControlSize = NSControlSize.Regular; datePickerControl.Cell.Font = NSFont.SystemFontOfSize(13.0f); break; } }
public override void DrawWithFrame(CGRect cellFrame, NSView inView) { if (NSGraphicsContext.IsCurrentContextDrawingToScreen) { base.DrawWithFrame(cellFrame, inView); } else { DrawTitle(AttributedTitle, TitleRectForBounds(cellFrame), inView); var state = State; var text = state == NSCellStateValue.On ? "⦿" : state == NSCellStateValue.Mixed ? "⊖" : "○"; var font = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(ControlSize)); var attributes = NSDictionary.FromObjectAndKey(font, NSStringAttributeKey.Font); var str = new NSAttributedString(text, attributes); var frame = cellFrame; var size = str.Size; var offset = (nfloat)Math.Max(0, (frame.Height - size.Height) / 2); frame.Y += offset; frame.Height -= offset; str.DrawString(frame); } }
public static int DetermineFitWidth(this NSCell cell, NSObject objectValueAtCell, int minWidth = 10) { int width; if (cell is NSTextFieldCell) { var font = cell.Font ?? NSFont.ControlContentFontOfSize(-1); var attrs = NSDictionary.FromObjectAndKey(font, NSAttributedString.FontAttributeName); // Determine the text on the cell NSString cellText; if (objectValueAtCell is NSString) { cellText = (NSString)objectValueAtCell; } else if (cell.Formatter != null) { cellText = cell.Formatter.StringFor(objectValueAtCell).ToNSString(); } else { cellText = objectValueAtCell.Description.ToNSString(); } width = (int)cellText.StringSize(attrs).Width + minWidth; } else if (cell.Image != null) { // if cell has an image, use that images width width = (int)Math.Max(minWidth, (int)cell.Image.Size.Width); } else { // cell is something else, just use its width width = (int)Math.Max(minWidth, (int)cell.CellSize.Width); } return(width); }
public CodeEditorControlHandler() { //te = new Controls.Mac.TextEditor(); te = new NSTextView(); te.Font = NSFont.FromFontName("Menlo", 11.0f); te.Editable = true; te.Selectable = true; te.AutoresizingMask = NSViewResizingMask.WidthSizable; te.MaxSize = new CGSize(1000, 10000000); //te.Formatter = new LanguageFormatter(te, new PythonDescriptor()); sv = new NSScrollView { AutoresizesSubviews = true, BorderType = NSBorderType.NoBorder, HasVerticalScroller = true, HasHorizontalScroller = true, AutoresizingMask = NSViewResizingMask.WidthSizable }; var cv = new NSClipView { AutoresizesSubviews = true }; cv.DocumentView = te; sv.ContentView = cv; this.Control = sv; te.BecomeFirstResponder(); }
private bool canToggleTrait(NSFont font, NSFontTraitMask trait) { NSFont testFont = null; if ((NSFontTraitMask)((int)font.FontDescriptor.SymbolicTraits & (int)trait) == trait) { testFont = NSFontManager.SharedFontManager.ConvertFontToNotHaveTrait(arcView.Font, trait); } else { testFont = NSFontManager.SharedFontManager.ConvertFont(arcView.Font, trait); } if (testFont != null) { if ((NSFontTraitMask)(testFont.FontDescriptor.SymbolicTraits ^ font.FontDescriptor.SymbolicTraits) == trait) { return(true); } } return(false); }
public static NSFont ToNSFont(this FigmaTypeStyle style) { string family = style.fontFamily; if (FontConversion.TryGetValue(family, out string newFamilyName)) { Console.WriteLine("{0} font was in the conversion dicctionary and was replaced by {1}.", family, newFamilyName); family = newFamilyName; } var fontDefault = NSFont.SystemFontOfSize(style.fontSize, GetFontWeight(style)); var traits = NSFontManager.SharedFontManager.TraitsOfFont(fontDefault); var weight = Math.Max(LiteForms.Cocoa.ViewsHelper.ToAppKitFontWeight(style.fontWeight) - 2, 1); NSFont font = null; try { font = NSFontManager.SharedFontManager.FontWithFamily(family, traits, weight, style.fontSize); } catch (Exception ex) { Console.WriteLine(ex); } if (font == null) { try { font = NSFontManager.SharedFontManager.FontWithFamily(fontDefault.FamilyName, traits, weight, style.fontSize); } catch (Exception ex) { Console.WriteLine(ex); } } return(font); }
public BrushEditorControl(IHostResourceProvider hostResources) : base(hostResources) { TranslatesAutoresizingMaskIntoConstraints = false; this.previewLayer = new CommonBrushLayer(hostResources) { Frame = new CGRect(0, 0, 30, 10) }; this.popover = new AutoClosePopOver(hostResources, hostResources.GetVibrantAppearance(EffectiveAppearance)) { ContentViewController = this.brushTabViewController = new BrushTabViewController(hostResources) { PreferredContentSize = new CGSize(550, 363) } }; this.popUpButton = new ColorPopUpButton { ControlSize = NSControlSize.Small, Font = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Small)), TranslatesAutoresizingMaskIntoConstraints = false, ProxyResponder = new ProxyResponder(this, ProxyRowType.SingleView) }; this.popupButtonList = new NSMenu(); this.popUpButton.Menu = this.popupButtonList; AddSubview(this.popUpButton); this.AddConstraints(new[] { NSLayoutConstraint.Create(this.popUpButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0), NSLayoutConstraint.Create(this.popUpButton, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, 16), NSLayoutConstraint.Create(this.popUpButton, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0), }); AppearanceChanged(); }
private void RequirePopup() { if (this.popupButton != null) { return; } RemoveComboBox(); this.popupButton = new FocusablePopUpButton { AllowsExpansionToolTips = true, Cell = { LineBreakMode = NSLineBreakMode.TruncatingTail, UsesSingleLineMode = true, }, ControlSize = NSControlSize.Small, Font = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Small)), TranslatesAutoresizingMaskIntoConstraints = false, StringValue = String.Empty, ProxyResponder = new ProxyResponder(this, ProxyRowType.SingleView) }; this.popupButton.ProxyResponder = new ProxyResponder(this, ProxyRowType.SingleView); this.popupButtonList = new NSMenu(); this.popupButton.Menu = this.popupButtonList; this.popupButton.Activated += PopupButton_Activated; AddSubview(this.popupButton); AddConstraints(new[] { NSLayoutConstraint.Create(this.popupButton, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.popupButton, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 0f), NSLayoutConstraint.Create(this.popupButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0), }); this.firstKeyView = this.popupButton; this.lastKeyView = this.popupButton; }
public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row) { if (row >= data.Count) { return(null); } var view = tableView.MakeView(tableColumn.Identifier, this); var dataItem = data[(int)row]; if (tableColumn.Identifier == Col1) { var currentView = view as NSButton; if (currentView == null) { currentView = new NSButton(); currentView.SetButtonType(NSButtonType.Switch); currentView.Activated += (s, e) => { dataItem.Value = currentView.State == NSCellStateValue.On; }; } currentView.State = dataItem.Value ? NSCellStateValue.On : NSCellStateValue.Off; currentView.Title = dataItem.Description; return(currentView); } if (tableColumn.Identifier == Col2) { var currentView = view as NSTextField; if (currentView == null) { currentView = ViewHelpers.CreateLabel(dataItem.PackageName, NSFont.SystemFontOfSize(13)); } return(currentView); } return(null); }
private bool isFontItalic (NSFont font) { return font.FontDescriptor.SymbolicTraits.HasFlag (NSFontSymbolicTraits.ItalicTrait); }
private bool isFontBold (NSFont font) { return font.FontDescriptor.SymbolicTraits.HasFlag (NSFontSymbolicTraits.BoldTrait); }
private bool canToggleTrait (NSFont font, NSFontTraitMask trait) { NSFont testFont = null; if ((NSFontTraitMask)((int)font.FontDescriptor.SymbolicTraits & (int)trait) == trait) { testFont = NSFontManager.SharedFontManager.ConvertFontToNotHaveTrait (arcView.Font, trait); } else { testFont = NSFontManager.SharedFontManager.ConvertFont (arcView.Font, trait); } if (testFont != null) { if ((NSFontTraitMask)(testFont.FontDescriptor.SymbolicTraits ^ font.FontDescriptor.SymbolicTraits) == trait) { return true; } } return false; }
public void SetFont(NSFont font) { if (font == null) throw new ArgumentNullException ("font"); _Font = font.Handle; }
public SparkleUI() { string content_path = Directory.GetParent ( System.AppDomain.CurrentDomain.BaseDirectory).ToString (); string app_path = Directory.GetParent (content_path).ToString (); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); // Needed for Growl Dlfcn.dlopen (growl_path, 0); NSApplication.Init (); using (NSAutoreleasePool pool = new NSAutoreleasePool ()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); SetFolderIcon (); if (!SparkleShare.Controller.BackendIsPresent) { this.alert = new SparkleAlert (); this.alert.RunModal (); return; } Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); StatusIcon = new SparkleStatusIcon (); } SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email, string message, string repository_path) { InvokeOnMainThread (delegate { if (EventLog != null) EventLog.UpdateEvents (); if (SparkleShare.Controller.NotificationsEnabled) { if (NSApplication.SharedApplication.DockTile.BadgeLabel == null) NSApplication.SharedApplication.DockTile.BadgeLabel = "1"; else NSApplication.SharedApplication.DockTile.BadgeLabel = (int.Parse (NSApplication.SharedApplication.DockTile.BadgeLabel) + 1).ToString (); if (GrowlApplicationBridge.IsGrowlRunning ()) { SparkleBubble bubble = new SparkleBubble (user_name, message) { ImagePath = SparkleShare.Controller.GetAvatar (user_email, 36) }; bubble.Show (); } else { NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); } } }); }; SparkleShare.Controller.ConflictNotificationRaised += delegate { string title = "Ouch! Mid-air collision!"; string subtext = "Don't worry, SparkleShare made a copy of each conflicting file."; new SparkleBubble (title, subtext).Show (); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread (delegate { if (EventLog != null) EventLog.UpdateEvents (); }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread (delegate { if (EventLog != null) EventLog.UpdateEvents (); }); }; SparkleShare.Controller.FolderListChanged += delegate { InvokeOnMainThread (delegate { if (EventLog != null) { EventLog.UpdateChooser (); EventLog.UpdateEvents (); } }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } }
public SparkleUI() { NSApplication.Init (); SetSparkleIcon (); // TODO: Getting crashes when I remove this NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); OpenLogs = new List <SparkleLog> (); StatusIcon = new SparkleStatusIcon (); NewEvents = 0; SparkleShare.Controller.NotificationRaised += delegate { InvokeOnMainThread (delegate { NewEvents++; NSApplication.SharedApplication.DockTile.BadgeLabel = NewEvents.ToString (); foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); }); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } }
public override void DrawRect (RectangleF dirtyRect) { // Don't draw if we don't have a font or a title. if (Font == null || Title == string.Empty) return; // Initialize the text matrix to a known value CGContext context = NSGraphicsContext.CurrentContext.GraphicsPort; context.TextMatrix = CGAffineTransform.MakeIdentity (); // Draw a white background NSColor.White.Set (); context.FillRect (dirtyRect); //CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)self.attributedString); CTLine line = new CTLine (AttributedString); int glyphCount = line.GlyphCount; if (glyphCount == 0) return; GlyphArcInfo[] glyphArcInfo = new GlyphArcInfo[glyphCount]; PrepareGlyphArcInfo (line, glyphCount, glyphArcInfo); // Move the origin from the lower left of the view nearer to its center. context.SaveState (); context.TranslateCTM (dirtyRect.GetMidX (), dirtyRect.GetMidY () - Radius / 2); // Stroke the arc in red for verification. context.BeginPath (); context.AddArc (0, 0, Radius, (float)Math.PI, 0, true); context.SetRGBStrokeColor (1, 0, 0, 1); context.StrokePath (); // Rotate the context 90 degrees counterclockwise. context.RotateCTM ((float)PI_2); // Now for the actual drawing. The angle offset for each glyph relative to the previous // glyph has already been calculated; with that information in hand, draw those glyphs // overstruck and centered over one another, making sure to rotate the context after each // glyph so the glyphs are spread along a semicircular path. PointF textPosition = new PointF (0, Radius); context.TextPosition = textPosition; var runArray = line.GetGlyphRuns (); var runCount = runArray.Count (); var glyphOffset = 0; var runIndex = 0; for (; runIndex < runCount; runIndex++) { var run = runArray[runIndex]; var runGlyphCount = run.GlyphCount; bool drawSubstitutedGlyphsManually = false; CTFont runFont = run.GetAttributes ().Font; // Determine if we need to draw substituted glyphs manually. Do so if the runFont is not // the same as the overall font. NSFont rrunFont = new NSFont (runFont.Handle); // used for comparison if (DimsSubstitutedGlyphs && Font != rrunFont) { drawSubstitutedGlyphsManually = true; } var runGlyphIndex = 0; for (; runGlyphIndex < runGlyphCount; runGlyphIndex++) { var glyphRange = new NSRange (runGlyphIndex, 1); context.RotateCTM (-(glyphArcInfo[runGlyphIndex + glyphOffset].angle)); // Center this glyph by moving left by half its width. var glyphWidth = glyphArcInfo[runGlyphIndex + glyphOffset].width; var halfGlyphWidth = glyphWidth / 2.0; var positionForThisGlyph = new PointF (textPosition.X - (float)halfGlyphWidth, textPosition.Y); // Glyphs are positioned relative to the text position for the line, so offset text position leftwards by this glyph's // width in preparation for the next glyph. textPosition.X -= glyphWidth; CGAffineTransform textMatrix = run.TextMatrix; textMatrix.x0 = positionForThisGlyph.X; textMatrix.y0 = positionForThisGlyph.Y; context.TextMatrix = textMatrix; if (!drawSubstitutedGlyphsManually) run.Draw (context, glyphRange); else { // We need to draw the glyphs manually in this case because we are effectively applying a graphics operation by // setting the context fill color. Normally we would use kCTForegroundColorAttributeName, but this does not apply // as we don't know the ranges for the colors in advance, and we wanted demonstrate how to manually draw. var cgFont = runFont.ToCGFont (); var glyph = run.GetGlyphs (glyphRange); var position = run.GetPositions (glyphRange); context.SetFont (cgFont); context.SetFontSize (runFont.Size); context.SetRGBFillColor (0.25f, 0.25f, 0.25f, 1); context.ShowGlyphsAtPositions (glyph, position, 1); } // Draw the glyph bounds if (ShowsGlyphBounds) { var glyphBounds = run.GetImageBounds (context, glyphRange); context.SetRGBStrokeColor (0, 0, 1, 1); context.StrokeRect (glyphBounds); } // Draw the bounding boxes defined by the line metrics if (ShowsLineMetrics) { var lineMetrics = new RectangleF (); float ascent = 0; float descent = 0; float leading = 0; run.GetTypographicBounds (glyphRange, out ascent, out descent, out leading); // The glyph is centered around the y-axis lineMetrics.Location = new PointF (-(float)halfGlyphWidth, positionForThisGlyph.Y - descent); lineMetrics.Size = new SizeF (glyphWidth, ascent + descent); context.SetRGBStrokeColor (0, 1, 0, 1); context.StrokeRect (lineMetrics); } } glyphOffset += runGlyphCount; } context.RestoreState (); }
public override void AwakeFromNib () { base.AwakeFromNib (); font = NSFont.SystemFontOfSize (16.0f); }
public override void AwakeFromNib () { base.AwakeFromNib (); m_colorBackground = GuiUtils.ConvertColor(Colors.LightChartBackground); m_colorGrid = GuiUtils.ConvertColor(Colors.LightChartGrid); m_colorAxis = GuiUtils.ConvertColor (Colors.LightChartAxis); m_colorMouse = GuiUtils.ConvertColor(Colors.LightChartMouse); m_colorDownloadGraph = GuiUtils.ConvertColor(Colors.LightChartLineDownload); m_colorDownloadLine = GuiUtils.ConvertColor(Colors.LightChartLineDownload); m_colorUploadGraph = GuiUtils.ConvertColor(Colors.LightChartLineUpload); m_colorUploadLine = GuiUtils.ConvertColor(Colors.LightChartLineUpload); //m_colorLegendText = GuiUtils.ConvertColor(Colors.LightChartLegend); m_colorDownloadText = GuiUtils.ConvertColor(Colors.LightChartLineDownload); m_colorUploadText = GuiUtils.ConvertColor(Colors.LightChartLineUpload); m_font = NSFont.FromFontName ("Menlo", 10); m_chart = Engine.Instance.Stats.Charts.ChartsList[m_chartIndex]; Engine.Instance.Stats.Charts.UpdateEvent += new Core.UI.Charts.UpdateHandler(Charts_UpdateEvent); }
static FontAwesome() { Font = NSFont.FromFontName (Core.Fonts.Awesome.Name, 14); }
public NSAttributedString(string str, NSFont font = null, NSColor foregroundColor = null, NSColor backgroundColor = null, NSColor strokeColor = null, NSColor underlineColor = null, NSColor strikethroughColor = null, NSUnderlineStyle underlineStyle = NSUnderlineStyle.None, NSUnderlineStyle strikethroughStyle = NSUnderlineStyle.None, NSParagraphStyle paragraphStyle = null, float strokeWidth = 0, NSShadow shadow = null, NSUrl link = null, bool superscript = false, NSTextAttachment attachment = null, NSLigatureType ligature = NSLigatureType.Default, float baselineOffset = 0, float kerningAdjustment = 0, float obliqueness = 0, float expansion = 0, NSCursor cursor = null, string toolTip = null, int characterShape = 0, NSGlyphInfo glyphInfo = null, NSArray writingDirection = null, bool markedClauseSegment = false, NSTextLayoutOrientation verticalGlyphForm = NSTextLayoutOrientation.Horizontal, NSTextAlternatives textAlternatives = null, NSSpellingState spellingState = NSSpellingState.None) : this(str, NSStringAttributes.ToDictionary ( font: font, foregroundColor: foregroundColor, backgroundColor: backgroundColor, strokeColor: strokeColor, underlineColor: underlineColor, strikethroughColor: strikethroughColor, underlineStyle: underlineStyle, strikethroughStyle: strikethroughStyle, paragraphStyle: paragraphStyle, strokeWidth: strokeWidth, shadow: shadow, link: link, superscript: superscript, attachment: attachment, ligature: ligature, baselineOffset: baselineOffset, kerningAdjustment: kerningAdjustment, obliqueness: obliqueness, expansion: expansion, cursor: cursor, toolTip: toolTip, characterShape: characterShape, glyphInfo: glyphInfo, writingDirection: writingDirection, markedClauseSegment: markedClauseSegment, verticalGlyphForm: verticalGlyphForm, textAlternatives: textAlternatives, spellingState: spellingState )) { }
public UIFont (NSFont font) { // Initialize this.NSFont = font; }
public SparkleUI() { string content_path = Directory.GetParent ( System.AppDomain.CurrentDomain.BaseDirectory).ToString (); string app_path = Directory.GetParent (content_path).ToString (); string growl_path = Path.Combine (app_path, "Frameworks", "Growl.framework", "Growl"); // Needed for Growl Dlfcn.dlopen (growl_path, 0); NSApplication.Init (); // Use translations Catalog.Init ("sparkleshare", Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations")); using (NSAutoreleasePool pool = new NSAutoreleasePool ()) { // Needed for Growl GrowlApplicationBridge.WeakDelegate = this; NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); if (!Program.Controller.BackendIsPresent) { this.alert = new SparkleAlert (); this.alert.RunModal (); return; } SetFolderIcon (); Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); StatusIcon = new SparkleStatusIcon (); Bubbles = new SparkleBubbles (); if (Program.Controller.FirstRun) { Setup = new SparkleSetup (); Setup.Controller.ShowSetupPage (); } } }
public SparkleUI() { NSApplication.Init (); SetSparkleIcon (); // TODO: Getting crashes when I remove this NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed ("sparkleshare.icns"); if (!SparkleShare.Controller.BackendIsPresent) { Alert = new SparkleAlert (); Alert.RunModal (); return; } Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", NSFontTraitMask.Condensed, 0, 13); OpenLogs = new List <SparkleLog> (); StatusIcon = new SparkleStatusIcon (); SparkleShare.Controller.NotificationRaised += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); if (SparkleShare.Controller.NotificationsEnabled) { if (NSApplication.SharedApplication.DockTile.BadgeLabel == null) NSApplication.SharedApplication.DockTile.BadgeLabel = "1"; else NSApplication.SharedApplication.DockTile.BadgeLabel = (int.Parse (NSApplication.SharedApplication.DockTile.BadgeLabel) + 1).ToString (); NSApplication.SharedApplication.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); } }); }; SparkleShare.Controller.AvatarFetched += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; SparkleShare.Controller.OnIdle += delegate { InvokeOnMainThread (delegate { foreach (SparkleLog log in SparkleUI.OpenLogs) log.UpdateEventLog (); }); }; if (SparkleShare.Controller.FirstRun) { Intro = new SparkleIntro (); Intro.ShowAccountForm (); } }
public void AppendPathWithGlyphs (uint[] glyphs, NSFont font) { if (glyphs == null) throw new ArgumentNullException ("glyphs"); if (glyphs.Length < 1) throw new ArgumentException ("glyphs array is empty"); int size = Marshal.SizeOf(glyphs[0]); IntPtr pNativeArray = Marshal.AllocHGlobal(size * glyphs.Length); IntPtr currentPtr = pNativeArray; for (int i = 0; i < glyphs.Length; i++) { Marshal.WriteIntPtr(currentPtr, (IntPtr)glyphs[i]); currentPtr = (IntPtr)((long)currentPtr + size); } _AppendPathWithGlyphs (pNativeArray, glyphs.Length, font); Marshal.FreeHGlobal(pNativeArray); }