protected void ConnectTextTagTable(Gtk.TextTagTable table, Monotalk.SourceView.Style [] styles) { foreach (Monotalk.SourceView.Style s in styles) { Gtk.TextTag tag = new TextTag(s.path); tag.Foreground = s.color; table.Add(tag); } }
private TextTagTable CreateTextTagTable(XmlNode topLevelNode) { TextTagTable textTagTable = new TextTagTable(); TextTag smallFontTag = new TextTag("small-font"); smallFontTag.Scale = Pango.Scale.Small; textTagTable.Add(smallFontTag); XmlNodeList linkNodes = topLevelNode.SelectNodes("//a"); if (linkNodes != null) { foreach(XmlNode linkNode in linkNodes) { XmlAttribute href = linkNode.Attributes["href"]; if (href != null) { string textTagName = href.Value; if (textTagTable.Lookup(textTagName) != null) continue; TextTag textTag = new TextTag(textTagName); textTag.Underline = Pango.Underline.Single; textTag.Foreground = "blue"; textTag.TextEvent += new TextEventHandler(OnTextEvent); textTagTable.Add(textTag); } } } return textTagTable; }
public TextTagWorkaround(string name, TextTagTable table) : base(name) { table.Add(this); }
public static TextTagTable BuildTagTable() { TextTagTable textTags = new TextTagTable(); var tag = new TextTag("date"); tag.Justification = Justification.Center; tag.Weight = Pango.Weight.Bold; textTags.Add(tag); tag = new TextTag("user1"); tag.Foreground = "#FF00FF"; textTags.Add(tag); tag = new TextTag("user2"); tag.Foreground = "#9400D3"; textTags.Add(tag); tag = new TextTag("user3"); tag.Foreground = "#191970"; textTags.Add(tag); tag = new TextTag("user4"); tag.Foreground = "#7F0000"; textTags.Add(tag); tag = new TextTag("user5"); tag.Foreground = "#FF8C00"; textTags.Add(tag); tag = new TextTag("user6"); tag.Foreground = "#FFA500"; textTags.Add(tag); tag = new TextTag("user7"); tag.Foreground = "#32CD32"; textTags.Add(tag); tag = new TextTag("user8"); tag.Foreground = "#3CB371"; textTags.Add(tag); tag = new TextTag("user9"); tag.Foreground = "#007F00"; textTags.Add(tag); tag = new TextTag("user10"); tag.Foreground = "#FFFF00"; textTags.Add(tag); return textTags; }
// Constructors public SqlEditorSharp() : base(false, 4) { scroll = new ScrolledWindow ( new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); scroll.HscrollbarPolicy = Gtk.PolicyType.Automatic; scroll.VscrollbarPolicy = Gtk.PolicyType.Automatic; scroll.ShadowType = Gtk.ShadowType.In; this.PackStart (scroll, true, true, 0); // default font famly for SQL editor family = "courier"; // other default settings use_hi_lighting = false; // create text tag table TextTagTable textTagTable = new TextTagTable (); // anything else is normaltext normaltext_tag = new TextTag ("normaltext"); normaltext_tag.Family = family; normaltext_tag.Foreground = "black"; normaltext_tag.Style = Pango.Style.Normal; textTagTable.Add (normaltext_tag); // SQL Keywords - SELECT FROM WHERE, etc sql_tag = new TextTag ("sql"); sql_tag.Family = family; sql_tag.Foreground = "blue"; sql_tag.Style = Pango.Style.Normal; textTagTable.Add (sql_tag); // c like free comment - used within a SQL statement freecomment_tag = new TextTag ("freecomment"); freecomment_tag.Family = family; freecomment_tag.Foreground = "darkgreen"; freecomment_tag.Style = Pango.Style.Italic; textTagTable.Add (freecomment_tag); // c++ like line comment, but using two hyphens linecomment_tag = new TextTag ("linecomment"); linecomment_tag.Family = family; linecomment_tag.Foreground = "darkgreen"; linecomment_tag.Style = Pango.Style.Italic; textTagTable.Add (linecomment_tag); /* single quoted constant - WHERE COL1 = 'ABC' */ singlequotedconstant_tag = new TextTag ("singlequotedconstant"); singlequotedconstant_tag.Family = family; singlequotedconstant_tag.Foreground = "red"; singlequotedconstant_tag.Style = Pango.Style.Normal; textTagTable.Add (singlequotedconstant_tag); // create TextBuffer and TextView sqlTextBuffer = new TextBuffer (textTagTable); sqlTextView = new TextView (sqlTextBuffer); // allow it to be edited sqlTextView.Editable = true; //line_last_changed = -1; //last_freecomment_count = -1; // attach OnTextChanged callback function // to "changed" signal so we can do something // when the text has changed in the buffer sqlTextBuffer.Changed += new EventHandler (OnTextChanged); // add the TextView to the ScrolledWindow scroll.Add (sqlTextView); }