本文整理汇总了C#中Gtk.TextTag类的典型用法代码示例。如果您正苦于以下问题:C# TextTag类的具体用法?C# TextTag怎么用?C# TextTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextTag类属于Gtk命名空间,在下文中一共展示了TextTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:13,代码来源:DemoHyperText.cs
示例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);
}
开发者ID:codebutler,项目名称:meshwork,代码行数:35,代码来源:StatusLogPage.cs
示例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 ();
}
开发者ID:KoMaTo3,项目名称:csgl,代码行数:25,代码来源:MainWindow.cs
示例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);
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:25,代码来源:ProgressDialog.cs
示例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 ();
}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:25,代码来源:DemoMain.cs
示例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);
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:34,代码来源:LogView.cs
示例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);
}
开发者ID:Ripper555,项目名称:DynamicPropertyManagement,代码行数:13,代码来源:MonospacedTextViewControl.cs
示例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);
}
}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:36,代码来源:DemoHyperText.cs
示例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);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:27,代码来源:ProgressDialog.cs
示例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;
}
开发者ID:langpavel,项目名称:LPS-old,代码行数:33,代码来源:UtilMainWindow.cs
示例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);
}
开发者ID:2015SoftwarePrinciples,项目名称:GTKTestWindow,代码行数:11,代码来源:GTKExtensions.cs
示例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);
}
}
开发者ID:emtees,项目名称:old-code,代码行数:9,代码来源:SourceView.cs
示例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 );
}
}
开发者ID:emtees,项目名称:old-code,代码行数:10,代码来源:DemoApp.cs
示例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);
}
开发者ID:lachsfilet,项目名称:SQLGrenadine,代码行数:11,代码来源:QueryWidget.cs
示例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;
}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:11,代码来源:TextIter.cs
示例16: MainTextViewControl
/// <summary>
/// Constructs a new MainTextViewControl object.
/// </summary>
/// <param name="widget">
/// The TextView widget to wrap.
/// </param>
public MainTextViewControl(Widget widget)
: base(widget)
{
TextTag tag = new TextTag("Caption");
tag.Weight = Weight.Bold;
buffer.TagTable.Add(tag);
tag = new TextTag("Monospaced");
tag.Family = "Monospace";
buffer.TagTable.Add(tag);
}
开发者ID:Ripper555,项目名称:DynamicPropertyManagement,代码行数:17,代码来源:MainTextViewControl.cs
示例17: Initialize
static uint RE_REMIND_DELAY = 30*60; //Wait x before re-showing [in seconds] (snooze)
#endregion Fields
#region Methods
public override void Initialize()
{
// If a tag of this name already exists, don't install.
if (Note.TagTable.Lookup ("reminder") == null) {
TextTag highlightTag = new TextTag("reminder");
highlightTag.Background = "yellow";
Note.TagTable.Add (highlightTag);
}
ScanNote();
}
开发者ID:sinisterstuf,项目名称:tomboy-reminder,代码行数:18,代码来源:Reminder.cs
示例18: ErrorDialog
public ErrorDialog(Window parent)
{
this.Build ();
TransientFor = parent;
descriptionLabel.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0));
tagNoWrap = new TextTag ("nowrap");
tagNoWrap.WrapMode = WrapMode.None;
detailsTextView.Buffer.TagTable.Add (tagNoWrap);
tagWrap = new TextTag ("wrap");
tagWrap.WrapMode = WrapMode.Word;
detailsTextView.Buffer.TagTable.Add (tagWrap);
expander.Visible = false;
}
开发者ID:RudoCris,项目名称:Pinta,代码行数:16,代码来源:ErrorDialog.cs
示例19: ErrorDialog
public ErrorDialog(Window parent)
{
new Glade.XML (null, "Base.glade", "ErrorDialog", null).Autoconnect (this);
dialog.TransientFor = parent;
okButton.Clicked += new EventHandler (OnClose);
expander.Activated += new EventHandler (OnExpanded);
descriptionLabel.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0));
tagNoWrap = new TextTag ("nowrap");
tagNoWrap.WrapMode = WrapMode.None;
detailsTextView.Buffer.TagTable.Add (tagNoWrap);
tagWrap = new TextTag ("wrap");
tagWrap.WrapMode = WrapMode.Word;
detailsTextView.Buffer.TagTable.Add (tagWrap);
}
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:16,代码来源:ErrorDialog.cs
示例20: TorrentError
public TorrentError(string errortext, string tpath)
{
this.Build ();
this.tpath = tpath;
Gtk.TextTag tt = new Gtk.TextTag("bold");
tt.Weight = Pango.Weight.Bold;
textview1.Buffer.TagTable.Add(tt);
TextIter tr = textview1.Buffer.GetIterAtLine(0);
textview1.Buffer.InsertWithTags(ref tr,"<Torrent File>\n",tt);
textview1.Buffer.Insert(ref tr, tpath+"\n\n");
textview1.Buffer.InsertWithTags(ref tr,"<Error>\n",tt);
textview1.Buffer.Insert(ref tr, errortext + "\n\n");
textview1.Buffer.Insert(ref tr, "Do you want to delete this file?");
}
开发者ID:Xeonios,项目名称:XenoTorrent,代码行数:17,代码来源:TorrentError.cs
注:本文中的Gtk.TextTag类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论