void UpdateLabel() { string msg = hasMarkup ? text : GLib.Markup.EscapeText(text); if (severity.HasValue) { switch (severity.Value) { case TaskSeverity.Information: label.Markup = "<span font='" + Theme.Font.ToString() + "' color='" + Styles.ColorGetHex(Styles.PopoverWindow.InformationTextColor) + "'>" + msg + "</span>"; return; case TaskSeverity.Comment: label.Markup = "<span font='" + Theme.Font.ToString() + "' color='" + Styles.ColorGetHex(Styles.PopoverWindow.InformationTextColor) + "'>" + msg + "</span>"; return; case TaskSeverity.Error: label.Markup = "<span font='" + Theme.Font.ToString() + "' color='" + Styles.ColorGetHex(Styles.PopoverWindow.ErrorTextColor) + "'>" + msg + "</span>"; return; case TaskSeverity.Warning: label.Markup = "<span font='" + Theme.Font.ToString() + "' color='" + Styles.ColorGetHex(Styles.PopoverWindow.WarningTextColor) + "'>" + msg + "</span>"; return; } } label.Markup = "<span font='" + Theme.Font.ToString() + "' color='" + Styles.ColorGetHex(Styles.PopoverWindow.DefaultTextColor) + "'>" + msg + "</span>"; }
protected static string HighlightMatch(string text, string toMatch, bool selected) { var lane = StringMatcher.GetMatcher(toMatch, true).GetMatch(text); StringBuilder result = new StringBuilder(); if (lane != null) { int lastPos = 0; for (int n = 0; n < lane.Length; n++) { int pos = lane[n]; if (pos - lastPos > 0) { MarkupUtilities.AppendEscapedString(result, text.Substring(lastPos, pos - lastPos)); } var matchColor = selected ? Styles.GlobalSearch.SelectedResultMatchTextColor : Styles.GlobalSearch.ResultMatchTextColor; result.Append("<span foreground=\"" + Styles.ColorGetHex(matchColor) + "\" font_weight=\"bold\">"); MarkupUtilities.AppendEscapedString(result, text[pos].ToString()); result.Append("</span>"); lastPos = pos + 1; } if (lastPos < text.Length) { MarkupUtilities.AppendEscapedString(result, text.Substring(lastPos, text.Length - lastPos)); } } else { MarkupUtilities.AppendEscapedString(result, text); } return(result.ToString()); }
string GetRowMarkup(SearchResult result, bool selected = false) { var resultFgColor = selected ? Styles.GlobalSearch.SelectedResultTextColor : Styles.GlobalSearch.ResultTextColor; var descFgColor = selected ? Styles.GlobalSearch.SelectedResultDescriptionTextColor : Styles.GlobalSearch.ResultDescriptionTextColor; string txt = "<span foreground=\"" + Styles.ColorGetHex(resultFgColor) + "\">" + result.GetMarkupText(selected) + "</span>"; string desc = result.GetDescriptionMarkupText(); if (!string.IsNullOrEmpty(desc)) { txt += "<span foreground=\"" + Styles.ColorGetHex(descFgColor) + "\" size=\"small\">\n" + desc + "</span>"; } return(txt); }
static void UpdateStyles() { var bgColorHex = Styles.ColorGetHex(Styles.NewProjectDialog.ProjectConfigurationRightHandBackgroundColor); string rcstyle = "style \"projectFolderPreviewWidget\"\r\n{\r\n" + " base[NORMAL] = \"" + bgColorHex + "\"\r\n" + " GtkTreeView::even-row-color = \"" + bgColorHex + "\"\r\n" + "}\r\n"; rcstyle += "widget \"*projectFolderPreviewWidget*\" style \"projectFolderPreviewWidget\"\r\n"; Rc.ParseString(rcstyle); }
public GtkProjectFolderPreviewWidget() { this.Build(); folderTreeView.Name = "projectFolderPreviewWidget"; previewLabel.LabelProp = String.Format( "<span weight='bold' foreground='{0}'>{1}</span>", Styles.ColorGetHex(Styles.NewProjectDialog.ProjectConfigurationPreviewLabelColor), global::Mono.Unix.Catalog.GetString("PREVIEW")); CreateFolderTreeViewColumns(); }
static void UpdateStyles() { var categoriesBackgroundColorHex = Styles.ColorGetHex(Styles.NewProjectDialog.CategoriesBackgroundColor); var templateListBackgroundColorHex = Styles.ColorGetHex(Styles.NewProjectDialog.TemplateListBackgroundColor); string rcstyle = "style \"templateCategoriesTreeView\"\r\n{\r\n" + " base[NORMAL] = \"" + categoriesBackgroundColorHex + "\"\r\n" + " GtkTreeView::even-row-color = \"" + categoriesBackgroundColorHex + "\"\r\n" + "}\r\n"; rcstyle += "style \"templatesTreeView\"\r\n{\r\n" + " base[NORMAL] = \"" + templateListBackgroundColorHex + "\"\r\n" + " GtkTreeView::even-row-color = \"" + templateListBackgroundColorHex + "\"" + "\r\n}"; rcstyle += "widget \"*templateCategoriesTreeView*\" style \"templateCategoriesTreeView\"\r\n"; rcstyle += "widget \"*templatesTreeView*\" style \"templatesTreeView\"\r\n"; Rc.ParseString(rcstyle); }
public GtkProjectFolderPreviewWidget() { this.Build(); folderTreeView.Name = "projectFolderPreviewWidget"; previewLabel.LabelProp = String.Format( "<span weight='bold' foreground='{0}'>{1}</span>", Styles.ColorGetHex(Styles.NewProjectDialog.ProjectConfigurationPreviewLabelColor), global::Mono.Unix.Catalog.GetString("PREVIEW")); CreateFolderTreeViewColumns(); // Accessibility previewLabel.Accessible.Name = "projectFolderPreviewLabel"; previewLabel.Accessible.SetTitleFor(folderTreeView.Accessible); folderTreeView.Accessible.Name = "projectFolderPreviewWidget"; folderTreeView.Accessible.Description = GettextCatalog.GetString("A preview of how the folder will look"); folderTreeView.Accessible.SetTitleUIElement(previewLabel.Accessible); }