本文整理汇总了C#中Gtk.TextTag类的典型用法代码示例。如果您正苦于以下问题:C# TextTag类的具体用法?C# TextTag怎么用?C# TextTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextTag类属于Gtk命名空间,在下文中一共展示了TextTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertLink
// Inserts a piece of text into the buffer, giving it the usual
// appearance of a hyperlink in a web browser: blue and underlined.
// Additionally, attaches some data on the tag, to make it recognizable
// as a link.
void InsertLink (TextBuffer buffer, ref TextIter iter, string text, int page)
{
TextTag tag = new TextTag (null);
tag.Foreground = "blue";
tag.Underline = Pango.Underline.Single;
tag_pages [tag] = page;
buffer.TagTable.Add (tag);
buffer.InsertWithTags (ref iter, text, tag);
}
示例2: StatusLogPage
private StatusLogPage()
{
m_TextView = new TextView();
m_TextView.Editable = false;
ScrolledWindow swindow = new ScrolledWindow();
swindow.Add(m_TextView);
this.PackStart(swindow, true, true, 0);
swindow.ShowAll();
var tag = new TextTag("Error");
tag.Foreground = "darkred";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Fatal");
tag.Foreground = "darkred";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Warn");
tag.Foreground = "darkorange";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Info");
tag.Foreground = "darkgreen";
m_TextView.Buffer.TagTable.Add(tag);
tag = new TextTag("Debug");
tag.Foreground = "darkblue";
m_TextView.Buffer.TagTable.Add(tag);
m_TextView.Buffer.CreateMark("end", m_TextView.Buffer.EndIter, false);
LoggingService.AddLogger(this);
}
示例3: MainWindow
public MainWindow()
: base("MainWindow")
{
// Setup ui
var textview = new TextView();
Add (textview);
// Setup tag
var tag = new TextTag ("helloworld-tag");
tag.Scale = Pango.Scale.XXLarge;
tag.Style = Pango.Style.Italic;
tag.Underline = Pango.Underline.Double;
tag.Foreground = "blue";
tag.Background = "pink";
tag.Justification = Justification.Center;
var buffer = textview.Buffer;
buffer.TagTable.Add (tag);
// Insert "Hello world!" into textview buffer
var insertIter = buffer.StartIter;
buffer.InsertWithTagsByName (ref insertIter, "Hello World!\n", "helloworld-tag");
buffer.Insert (ref insertIter, "Simple Hello World!");
ShowAll ();
}
示例4: ProgressDialog
public ProgressDialog (Window parent, bool allowCancel, bool showDetails)
{
this.Build ();
HasSeparator = false;
ActionArea.Hide ();
DefaultHeight = 5;
TransientFor = parent;
btnCancel.Visible = allowCancel;
expander.Visible = showDetails;
buffer = detailsTextView.Buffer;
detailsTextView.Editable = false;
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (bold);
tag = new TextTag ("0");
tag.Indent = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
}
示例5: DemoMain
public DemoMain ()
{
SetupDefaultIcon ();
window = new Gtk.Window ("Gtk# Code Demos");
window.SetDefaultSize (600, 400);
window.DeleteEvent += new DeleteEventHandler (WindowDelete);
HBox hbox = new HBox (false, 0);
window.Add (hbox);
treeView = CreateTree ();
hbox.PackStart (treeView, false, false, 0);
Notebook notebook = new Notebook ();
hbox.PackStart (notebook, true, true, 0);
notebook.AppendPage (CreateText (infoBuffer, false), new Label ("_Info"));
TextTag heading = new TextTag ("heading");
heading.Font = "Sans 18";
infoBuffer.TagTable.Add (heading);
notebook.AppendPage (CreateText (sourceBuffer, true), new Label ("_Source"));
window.ShowAll ();
}
示例6: LogView
public LogView ()
{
buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
textEditorControl = new Gtk.TextView (buffer);
textEditorControl.Editable = false;
ShadowType = ShadowType.None;
Add (textEditorControl);
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (bold);
errorTag = new TextTag ("error");
errorTag.Foreground = "red";
errorTag.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (errorTag);
consoleLogTag = new TextTag ("consoleLog");
consoleLogTag.Foreground = "darkgrey";
buffer.TagTable.Add (consoleLogTag);
tag = new TextTag ("0");
tag.LeftMargin = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false);
UpdateCustomFont (IdeApp.Preferences.CustomOutputPadFont);
IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomFontChanged;
outputDispatcher = new GLib.TimeoutHandler (outputDispatchHandler);
}
示例7: MonospacedTextViewControl
/// <summary>
/// Constructs a new MonospacedTextViewControl wrapper.
/// </summary>
/// <param name="widget">
/// The TextView widget to be wrapped.
/// </param>
public MonospacedTextViewControl(Widget widget)
: base(widget)
{
TextTag tag = new TextTag("Monospaced");
tag.Family = "Monospace";
buffer.TagTable.Add(tag);
}
示例8: ShowPage
// Fills the buffer with text and interspersed links. In any real
// hypertext app, this method would parse a file to identify the links.
void ShowPage (TextBuffer buffer, int page)
{
buffer.Text = "";
TextIter iter = buffer.StartIter;
if (page == 1) {
buffer.Insert (ref iter, "Some text to show that simple ");
InsertLink (buffer, ref iter, "hypertext", 3);
buffer.Insert (ref iter, " can easily be realized with ");
InsertLink (buffer, ref iter, "tags", 2);
buffer.Insert (ref iter, ".");
} else if (page == 2) {
buffer.Insert (ref iter,
"A tag is an attribute that can be applied to some range of text. " +
"For example, a tag might be called \"bold\" and make the text inside " +
"the tag bold. However, the tag concept is more general than that; " +
"tags don't have to affect appearance. They can instead affect the " +
"behavior of mouse and key presses, \"lock\" a range of text so the " +
"user can't edit it, or countless other things.\n");
InsertLink (buffer, ref iter, "Go back", 1);
} else if (page == 3) {
TextTag tag = buffer.TagTable.Lookup ("bold");
if (tag == null) {
tag = new TextTag ("bold");
tag.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (tag);
}
buffer.InsertWithTags (ref iter, "hypertext:\n", tag);
buffer.Insert (ref iter,
"machine-readable text that is not sequential but is organized " +
"so that related items of information are connected.\n");
InsertLink (buffer, ref iter, "Go back", 1);
}
}
示例9: ProgressDialog
public ProgressDialog (MonoDevelop.Components.Window parent, bool allowCancel, bool showDetails)
{
MonoDevelop.Components.IdeTheme.ApplyTheme (this);
this.Build ();
this.Title = BrandingService.ApplicationName;
HasSeparator = false;
ActionArea.Hide ();
DefaultHeight = 5;
TransientFor = parent;
btnCancel.Visible = allowCancel;
expander.Visible = showDetails;
buffer = detailsTextView.Buffer;
detailsTextView.Editable = false;
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add (bold);
tag = new TextTag ("0");
tag.Indent = 10;
buffer.TagTable.Add (tag);
tags.Add (tag);
}
示例10: UtilMainWindow
public UtilMainWindow()
: base(Gtk.WindowType.Toplevel)
{
this.Build();
GLib.ExceptionManager.UnhandledException += UnhandledException;
this.WindowPosition = WindowPosition.Center;
this.WidthRequest = 800;
this.HeightRequest = 500;
this.DeleteEvent += WindowClosed;
ParserContext = ExecutionContext.CreateRootContext(new ToolScriptParser());
TextTag tag = new TextTag("command");
tag.Weight = Pango.Weight.Bold;
tag.WeightSet = true;
outputView.Buffer.TagTable.Add(tag);
TextTag tagerror = new TextTag("error");
tagerror.Weight = Pango.Weight.Bold;
// tagerror.WeightSet = true;
tagerror.Font = "Courier Bold";
tagerror.Foreground = "#880000";
outputView.Buffer.TagTable.Add(tagerror);
TextTag tagcode = new TextTag("code");
tagcode.Weight = Pango.Weight.Bold;
tagcode.Font = "Courier Bold";
outputView.Buffer.TagTable.Add(tagcode);
Instance = this;
}
示例11: AddTag
/// <summary>
/// Adds a tag to a text buffer.
/// </summary>
public static void AddTag(this TextBuffer buff, string tagName, string foreground, string family, Pango.Style style)
{
TextTag tag = new TextTag(tagName);
tag.Foreground = foreground;
tag.Family = family;
tag.Style = style;
buff.TagTable.Add(tag);
}
示例12: AddTags
private void AddTags ()
{
foreach (Monotalk.SourceView.Style s in config.styles) {
Gtk.TextTag tag = new TextTag (s.path);
tag.Foreground = s.color;
//tag.Weight = Convert.ToInt32 (s.weight);
TagTable.Add (tag);
}
}
示例13: ConnectTextTagTable
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 );
}
}
示例14: QueryWidget
public QueryWidget()
{
this.Build ();
textviewEditor.ModifyFont(FontDescription.FromString("Monospace"));
// Setup keyword format
_tagKeyword = new TextTag("keyword");
_tagKeyword.Weight = Weight.Bold;
_tagKeyword.Foreground = "#0000ff";
textviewEditor.Buffer.TagTable.Add(_tagKeyword);
}
示例15: GetToggledTags
public TextTag[] GetToggledTags (bool toggled_on)
{
IntPtr raw_ret = gtk_text_iter_get_toggled_tags (ref this, toggled_on);
if (raw_ret == IntPtr.Zero)
return new TextTag [0];
GLib.SList list = new GLib.SList(raw_ret);
TextTag[] result = new TextTag [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as TextTag;
return result;
}