public ColumnDetail(string name, float width, ColumnAlignment alignment = ColumnAlignment.Left, ColumnType columnType = ColumnType.TextBox) { ColumnName = name; ColumnWidth = width; TypeofColumn = columnType; #if __PC__ switch (alignment) { case ColumnAlignment.Left: Alignment = DataGridViewContentAlignment.MiddleLeft; break; case ColumnAlignment.Right: Alignment = DataGridViewContentAlignment.MiddleRight; break; case ColumnAlignment.Center: Alignment = DataGridViewContentAlignment.MiddleCenter; break; } #elif __MACOS__ switch (alignment) { case ColumnAlignment.Left: Alignment = NSTextAlignment.Left; break; case ColumnAlignment.Right: Alignment = NSTextAlignment.Right; break; case ColumnAlignment.Center: Alignment = NSTextAlignment.Center; break; } #endif }
internal static NSTextField CreateTextField( string text, NSTextAlignment alignment, NSColor color) { NSTextField result = new NSTextField(); result.Cell = CreateTextFieldCell(text, alignment, color); return(result); }
public static NSTextField CreateTextEntry(string text, NSFont font = null, NSTextAlignment alignment = NSTextAlignment.Left, bool translatesAutoresizingMaskIntoConstraints = false) { return(new NSTextField { StringValue = text ?? "", Font = font ?? GetSystemFont(false), Alignment = alignment, TranslatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints }); }
static NSTextFieldCell CreateTextFieldCell( string text, NSTextAlignment alignment, NSColor color) { NSTextFieldCell result = new NSTextFieldCell(text); result.LineBreakMode = NSLineBreakMode.ByWordWrapping; result.Alignment = alignment; result.TextColor = color; return(result); }
internal NSTableCellView GetFTAnalyzerGridCell(NSTableView tableView, NSTableColumn tableColumn, nint row) { var index = Array.IndexOf(_fieldNames, tableColumn.Identifier); if (index < 0 || index > _properties.Length) { return(null); } var property = _properties[index]; NSTextAlignment alignment = NSTextAlignment.Left; var width = tableColumn.Width; ColumnDetail[] x = property.GetCustomAttributes(typeof(ColumnDetail), false) as ColumnDetail[]; if (x?.Length == 1) { alignment = x[0].Alignment; width = x[0].ColumnWidth; } if (!(tableView.MakeView(CellIdentifier, this) is NSTableCellView cellView)) { var textField = new NSTextField { BackgroundColor = NSColor.Clear, LineBreakMode = NSLineBreakMode.TruncatingTail, Bordered = false, Selectable = false, Editable = false, Alignment = alignment, AutoresizingMask = NSViewResizingMask.MinYMargin | NSViewResizingMask.WidthSizable, AutoresizesSubviews = true, TranslatesAutoresizingMaskIntoConstraints = false, AllowsDefaultTighteningForTruncation = true, }; if (tableView.AutosaveName == "PrintView") { textField.Font = NSFont.SystemFontOfSize(8); } cellView = new NSTableCellView { Identifier = CellIdentifier, TextField = textField, AutoresizesSubviews = true, AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; cellView.AddSubview(textField); var views = new NSMutableDictionary { { new NSString("textField"), textField } }; cellView.AddConstraints(NSLayoutConstraint.FromVisualFormat($"H:|[textField({width}@750)]|", NSLayoutFormatOptions.AlignAllTop, null, views)); cellView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[textField]|", NSLayoutFormatOptions.AlignAllTop, null, views)); NSLayoutConstraint.ActivateConstraints(cellView.Constraints); } return(cellView); }
public static Alignment ToAlignment(this NSTextAlignment align) { switch (align) { case NSTextAlignment.Center: return(Alignment.Center); case NSTextAlignment.Right: return(Alignment.End); default: return(Alignment.Start); } }
public static HorizontalAlignment ToHorizontalAlignment(this NSTextAlignment self) { switch (self) { case NSTextAlignment.Center: return(HorizontalAlignment.Center); case NSTextAlignment.Right: return(HorizontalAlignment.Right); default: return(HorizontalAlignment.Left); } }
public SparkleLabel(string label, NSTextAlignment alignment) { if (!string.IsNullOrEmpty(label)) { StringValue = label; } Alignment = alignment; BackgroundColor = NSColor.WindowBackground; Bordered = false; Editable = false; }
public static string CreateLabelToDesignerString(string text, NSTextAlignment alignment = NSTextAlignment.Left) { StringBuilder builder = new StringBuilder(); builder.Append(string.Format("new {0}() {{", nameof(NSTextField))); builder.AppendLine(string.Format(" StringValue = \"{0}\",", text)); builder.AppendLine("Editable = false,"); builder.AppendLine("Bordered = false,"); builder.AppendLine("Bezeled = false,"); builder.AppendLine("DrawsBackground = false,"); builder.AppendLine(string.Format("Alignment = {0},", alignment.ToDesignerString())); builder.Append("}"); return(builder.ToString()); }
public static NSTextField CreateLabel(string text, NSTextAlignment alignment = NSTextAlignment.Left, NSFont font = null) { return(new NSTextField() { StringValue = text ?? "", Font = font ?? GetSystemFont(false), Editable = false, Bordered = false, Bezeled = false, DrawsBackground = false, Selectable = false, Alignment = alignment, TranslatesAutoresizingMaskIntoConstraints = false }); }
public static HorizontalAlign ToEto(this NSTextAlignment align) { switch (align) { default: case NSTextAlignment.Left: return(HorizontalAlign.Left); case NSTextAlignment.Right: return(HorizontalAlign.Right); case NSTextAlignment.Center: return(HorizontalAlign.Center); } }
public static NSTextField CreateLabel(string text, NSFont font = null, NSTextAlignment alignment = NSTextAlignment.Left) { var label = new NSTextField(); label.Cell = new VerticalAlignmentTextCell(); label.StringValue = text ?? ""; label.Font = font ?? GetSystemFont(false); label.Editable = false; label.Bordered = false; label.Bezeled = false; label.DrawsBackground = false; label.Selectable = false; label.Alignment = alignment; return(label); }
public static NSTextAlignment ToNSTextAlignment(this ContentAlignment alignment) { NSTextAlignment retval = NSTextAlignment.Center; switch (alignment) { case ContentAlignment.BottomCenter: retval = NSTextAlignment.Center; break; case ContentAlignment.BottomLeft: retval = NSTextAlignment.Left; break; case ContentAlignment.BottomRight: retval = NSTextAlignment.Right; break; case ContentAlignment.MiddleCenter: retval = NSTextAlignment.Center; break; case ContentAlignment.MiddleLeft: retval = NSTextAlignment.Left; break; case ContentAlignment.MiddleRight: retval = NSTextAlignment.Right; break; case ContentAlignment.TopCenter: retval = NSTextAlignment.Center; break; case ContentAlignment.TopLeft: retval = NSTextAlignment.Left; break; case ContentAlignment.TopRight: retval = NSTextAlignment.Right; break; default: retval = NSTextAlignment.Center; break; } return(retval); }
public static NSTextField CreateLabel(string text, NSFont font = null, NSTextAlignment alignment = NSTextAlignment.Left, bool translatesAutoresizingMaskIntoConstraints = false) { var label = new NSTextField() { StringValue = text ?? "", Font = font ?? ViewsHelper.GetSystemFont(false), Editable = false, Bordered = false, Bezeled = false, DrawsBackground = false, Selectable = false, Alignment = alignment }; label.TranslatesAutoresizingMaskIntoConstraints = translatesAutoresizingMaskIntoConstraints; return(label); }
public static nuint ToNative(NSTextAlignment value) { // For backwards compat reasons, the values we have in managed code corresponds with the X64 values. if (Runtime.IsARM64CallingConvention) { // Center and Right are switched on arm64 on macOS switch (value) { case (NSTextAlignment)2: value = (NSTextAlignment)1; break; case (NSTextAlignment)1: value = (NSTextAlignment)2; break; } } return((nuint)(ulong)value); }
public void SetAlignmentrange(NSTextAlignment alignment, NSRange range) { SetAlignmentRange(alignment, range); }
public CCTexture2D (string text, SizeF dimensions, NSTextAlignment alignment, CCVerticalTextAlignment vertAlignment, string fontName, float fontSize) : this (text, fontName, fontSize, dimensions, alignment, vertAlignment)
public CCLabelTTF (string label, SizeF dimensions, NSTextAlignment alignment, NSLineBreakMode lineBreakMode, string fontName, float fontSize) : this (label, fontName, fontSize, dimensions, alignment, lineBreakMode)
public static NSMutableAttributedString WithAlignment(this NSMutableAttributedString ns, NSTextAlignment alignment) { if (ns == null) { return(null); } ns.BeginEditing(); var r = new NSRange(0, ns.Length); ns.RemoveAttribute(NSStringAttributeKey.ParagraphStyle, r); var pstyle = NSParagraphStyle.DefaultParagraphStyle.MutableCopy() as NSMutableParagraphStyle; pstyle.Alignment = alignment; ns.AddAttribute(NSStringAttributeKey.ParagraphStyle, pstyle, r); ns.EndEditing(); return(ns); }
public CCLabelTTF (string label, SizeF dimensions, NSTextAlignment alignment, string fontName, float fontSize) : this (label, fontName, fontSize, dimensions, alignment)
public static NSAttributedString AttributedPartialTitle(string title, List <string> keyWordsList, NSColor fontColor, string fontName, float fontSize, NSTextAlignment textAlignment, NSLineBreakMode breakMode) { string patten = "\\b("; int i = 0; foreach (var item in keyWordsList) { if (i != 0) { patten = patten + "|" + item; } else { patten = patten + item; } i++; } patten = patten + ")\\b"; string [] results = Regex.Split(title, patten); NSMutableParagraphStyle ps = new NSMutableParagraphStyle(); ps.Alignment = textAlignment; ps.LineBreakMode = breakMode; NSMutableAttributedString attrTitle = new NSMutableAttributedString(); foreach (var item in results) { //Console.WriteLine ("result:{0}", item); if (item.Length == 0) { continue; } if (keyWordsList.Contains(item)) { NSStringAttributes attributes = new NSStringAttributes(); attributes.Font = NSFont.FromFontName(fontName + " Bold Italic", fontSize); attributes.ForegroundColor = Utility.ColorWithRGB(0, 0, 0, 0.45f); attributes.ParagraphStyle = ps; NSAttributedString attrString = new NSAttributedString(item, attributes); attrTitle.Append(attrString); } else { NSStringAttributes attributes = new NSStringAttributes(); attributes.Font = NSFont.FromFontName(fontName, fontSize); attributes.ForegroundColor = fontColor; attributes.ParagraphStyle = ps; NSAttributedString attrString = new NSAttributedString(item, attributes); attrTitle.Append(attrString); } } return(attrTitle); }
internal static NSTextField CreateTextField( string text, NSTextAlignment alignment) { return(CreateTextField(text, alignment, NSColor.ControlText)); }
public static NSAttributedString AttributedTitle(string title, NSColor color, String fontName, float fontSize, NSTextAlignment textAlignment) { NSMutableParagraphStyle ps = new NSMutableParagraphStyle(); ps.Alignment = textAlignment; ps.LineSpacing = 0.0f; NSColor fontColor = color; NSFont font = NSFont.FromFontName(fontName, fontSize); if (font == null) { font = NSFont.SystemFontOfSize(fontSize); } NSString titleObj = new NSString(title); NSStringAttributes attributes = new NSStringAttributes(); attributes.Font = font; attributes.ForegroundColor = fontColor; attributes.ParagraphStyle = ps; attributes.ToolTip = titleObj; NSAttributedString buttonString = new NSAttributedString(title, attributes); return(buttonString); }
public static string ToDesignerString(this NSTextAlignment alignment) { return(string.Format("{0}.{1}", nameof(NSTextAlignment), alignment.ToString())); }
public void SetVAlign(string alignDesc) { VAlign = ParseAlignment(alignDesc); }
public void SetVAlign(string alignDesc) { VAlign = ParseAlignment (alignDesc); }
public static string ToDesignerString(this NSTextAlignment alignment) { return(typeof(NSTextAlignment).WithProperty(alignment.ToString())); }
public void SetAlignmentrange(NSTextAlignment alignment, NSRange range) { SetAlignmentRange (alignment, range); }
public SparkleLabel (string label, NSTextAlignment alignment) { if (!string.IsNullOrEmpty (label)) StringValue = label; Alignment = alignment; BackgroundColor = NSColor.WindowBackground; Bordered = false; Editable = false; Font = SparkleUI.Font; }
public static string CreateLabelToDesignerString(string text, NSTextAlignment alignment = NSTextAlignment.Left, Func <string, (string data, bool translated)> tranlationHandler = null)
public NSTextTab(NSTextAlignment textAlignment, CGFloat location, Dictionary <NSObject, AnyObject> options) { }