• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Gtk.TextBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Gtk.TextBuffer的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer类的具体用法?C# TextBuffer怎么用?C# TextBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TextBuffer类属于Gtk命名空间,在下文中一共展示了TextBuffer类的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: ConsoleGtk

		public ConsoleGtk ()
		{
			Window win = new Window ("MonoLOGO");
			win.DeleteEvent += new EventHandler (Window_Delete);
			win.BorderWidth = 4;
			win.DefaultSize = new Size (450, 300);
			
			VBox vbox = new VBox (false, 4);
			win.EmitAdd (vbox);
			
			ScrolledWindow swin = 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));
			swin.HscrollbarPolicy = Gtk.PolicyType.Automatic;
			swin.VscrollbarPolicy = Gtk.PolicyType.Automatic;
			swin.ShadowType = Gtk.ShadowType.In;
			vbox.PackStart (swin, true, true, 0);
			
			TextBuffer buf = new TextBuffer (new TextTagTable ());
			Out = new TextWriterGtk (buf);
			TextView text = new TextView (buf);
			text.Editable = false;
			swin.EmitAdd (text);

			Entry entry = new Entry ();
			entry.Activate += new EventHandler (Entry_Activate);
			vbox.PackStart (entry, false, false, 0);
			
			win.ShowAll ();
		}
开发者ID:emtees,项目名称:old-code,代码行数:28,代码来源:console-gtk.cs


示例3: AddPaddingEmpty

	public static int AddPaddingEmpty (TextBuffer buffer, int offset,  string suffix)
	{
		TextIter insertAt = buffer.GetIterAtOffset (offset);
		AddPaddingEmpty (buffer, ref insertAt, suffix);
		
		return insertAt.Offset;
	}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:7,代码来源:Utils.cs


示例4: 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


示例5: 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


示例6: CreateText

        private ScrolledWindow CreateText(TextBuffer buffer, bool IsSource)
        {
            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            scrolledWindow.ShadowType = ShadowType.In;

            TextView textView = new TextView (buffer);
            textView.Editable = false;
            textView.CursorVisible = false;

            scrolledWindow.Add (textView);

            if (IsSource) {
                FontDescription fontDescription = FontDescription.FromString ("monospace");
                textView.OverrideFont (fontDescription);
                textView.WrapMode = Gtk.WrapMode.None;
            } else {
                // Make it a bit nicer for text
                textView.WrapMode = Gtk.WrapMode.Word;
                textView.PixelsAboveLines = 2;
                textView.PixelsBelowLines = 2;
            }

            return scrolledWindow;
        }
开发者ID:head-thrash,项目名称:gtk-sharp,代码行数:25,代码来源:DemoMain.cs


示例7: Redo

	public override void Redo (TextBuffer buffer)
	{
		TextIter insertIter = buffer.GetIterAtOffset (index);
		buffer.InsertRange (ref insertIter, chop.Start, chop.End);
		buffer.MoveMark (buffer.SelectionBound, buffer.GetIterAtOffset (index));
		buffer.MoveMark (buffer.InsertMark, buffer.GetIterAtOffset (index + chop.Length));
	}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:7,代码来源:DocumentActions.cs


示例8: Indexing

        public Indexing()
        {
            this.Build();
            this.Hide(); // not show the on creation, since we can add text before we show the screen

            buffer = new Gtk.TextBuffer(new TextTagTable());
            log_text_view.Buffer = buffer;
        }
开发者ID:GNOME,项目名称:nemo,代码行数:8,代码来源:Indexing.cs


示例9: StyleWindow

        public StyleWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            SetSizeRequest(800, 800);

            var box = new VBox();
            Add(box);

            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            buf.Text = System.IO.File.ReadAllText("res/theme/gtk.css");
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            box.PackStart(sv, true, true, 0);

            var cssProvider = new CssProvider();
            StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);

            var isDefault = true;

            var but = new Button();
            but.Label = "Save";
            but.HeightRequest = 30;
            box.PackEnd(but, false, false, 0);
            but.Clicked += (s, e) => {
                System.IO.File.WriteAllText("res/theme/gtk.css", buf.Text);
            };

            buf.Changed += (s, e) => {
                bool error = false;
                try {
                    //StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                    cssProvider.LoadFromData(buf.Text);
                    //StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue - 10);
                } catch (Exception ex) {
                    error = true;
                }
                if (error) {
                    if (!isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, cssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider, uint.MaxValue);
                        isDefault = true;
                    }

                } else {
                    if (isDefault) {
                        StyleContext.RemoveProviderForScreen(Gdk.Screen.Default, AppLib.GlobalCssProvider);
                        StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, uint.MaxValue);
                        isDefault = false;
                    }
                }

            };

            ShowAll();
        }
开发者ID:abanu-desktop,项目名称:abanu,代码行数:57,代码来源:StyleEditor.cs


示例10: CheckDependenciesDialog

        public CheckDependenciesDialog(Project project)
            : base("CheckDependenciesDialog.ui", "dependencies")
        {
            text_buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            capabilitiesview.Buffer = text_buffer;

            Gtk.TextBuffer buffer_intro = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            textview_intro.Buffer = buffer_intro;
            buffer_intro.Text = Catalog.GetString ("Mistelix uses a set of external components. Their availability determines Mistelix's capabilities. The following list shows the level of support of your system for Mistelix and if there are actions required.");
        }
开发者ID:GNOME,项目名称:mistelix,代码行数:10,代码来源:CheckDependenciesDialog.cs


示例11: TextView

		public TextView (TextBuffer buffer) : base (IntPtr.Zero)
		{
			if (GetType() != typeof (TextView)) {
				CreateNativeObject (new string [0], new GLib.Value [0]);
				Buffer = buffer;
				return;
			}

			Raw = gtk_text_view_new_with_buffer (buffer.Handle);
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:10,代码来源:TextView.cs


示例12: Serialize

	public static string Serialize (TextBuffer buffer, TextIter start, TextIter end)
	{
		StringWriter stream = new StringWriter ();
		XmlTextWriter xmlWriter = new XmlTextWriter (stream);
		xmlWriter.Formatting = Formatting.Indented;
		
		Serialize (buffer, start, end, xmlWriter);
		
		xmlWriter.Close ();
		return stream.ToString ();
	}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:11,代码来源:DocumentBufferArchiver.cs


示例13: MapWindow

        private TextView textView; // Textview to hold landmark information.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="SLAM.MapWindow"/> class.
        /// </summary>
        /// <param name="mapView">Map view contained in this window.</param>
        public MapWindow(MapView mapView)
            : base("Map")
        {
            robot = mapView.RobotView.Robot;

            this.mapView = mapView;

            // Subscribe to events.
            mapView.MapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update);
            mapView.RobotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update);

            SetPosition (WindowPosition.Center);
            Resizable = false;

            DeleteEvent += delegate
            {
                Application.Quit ();
            };

            TextBuffer textBuffer = new TextBuffer (new TextTagTable ());

            textView = new TextView ();
            textView.Indent = 10;
            textView.Editable = false;
            textView.Buffer = textBuffer;
            textView.CursorVisible = false;
            textView.SetSizeRequest (mapView.ViewWidth, 150);

            foreach (Landmark landmark in mapView.MapModel.Landmarks)
            {
                this.textView.Buffer.Text += landmark.ToString ();
            }

            ScrolledWindow scrolledWindow = new ScrolledWindow ();
            scrolledWindow.Add (textView);

            commandEntry = new Entry ();
            commandEntry.Activated += CommandEntry_OnActivated;

            sendButton = new Button ("Send");
            sendButton.Clicked += SendButton_OnClick;

            HBox hbox = new HBox (false, 0);
            hbox.Add (commandEntry);
            hbox.Add (sendButton);

            VBox vbox = new VBox (false, 0);
            vbox.Add (this.mapView);
            vbox.Add (scrolledWindow);
            vbox.Add (hbox);

            Add (vbox);
            Shown += OnShown;
        }
开发者ID:abdulrahman-alhemmy,项目名称:slambot,代码行数:64,代码来源:MapWindow.cs


示例14: Undo

	public override void Undo (TextBuffer buffer)
	{
		#if DEBUG
		Console.WriteLine ("DEBUG: Chop Text: {0} Length: {1}", chop.Text, chop.Length);
		#endif
		
		TextIter startIter = buffer.GetIterAtOffset (index);
		TextIter endIter = buffer.GetIterAtOffset (index + chop.Length);
		buffer.Delete (ref startIter, ref endIter);
		buffer.MoveMark (buffer.InsertMark, buffer.GetIterAtOffset (index));
		buffer.MoveMark (buffer.SelectionBound, buffer.GetIterAtOffset (index));
	}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:12,代码来源:DocumentActions.cs


示例15: DrawLineToBuffer

 private void DrawLineToBuffer(Line line, TextBuffer tb)
 {
     Gtk.TextIter iter = tb.EndIter;
     lock (line.text)
     {
         foreach (ContentText _text in line.text)
         {
             DrawPart(_text, tb);
         }
     }
     iter = tb.EndIter;
     tb.Insert(ref iter, Environment.NewLine);
 }
开发者ID:JGunning,项目名称:OpenAIM,代码行数:13,代码来源:Data.cs


示例16: LinkTextView

 public LinkTextView(string linkText)
     : base()
 {
     currentCursor = -1;
        handCursor = new Gdk.Cursor (Gdk.CursorType.Hand2);
        hoveringOverLink = false;
        string xmlLinkText = "<message>" + linkText + "</message>";
        XmlDocument linkTextDom = new XmlDocument();
        linkTextDom.LoadXml(xmlLinkText);
        TextTagTable textTagTable = CreateTextTagTable(linkTextDom);
        TextBuffer textBuffer = new TextBuffer(textTagTable);
        FormatTextBuffer(textBuffer, linkTextDom.DocumentElement);
        this.Buffer = textBuffer;
 }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:14,代码来源:NotifyWindow.cs


示例17: BuildProjectDialog

        public BuildProjectDialog(Project project)
            : base("BuildProjectDialog.ui", "buildproject")
        {
            Gtk.TextBuffer buffer_intro;
            this.project = project;
            buffer = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            status_text.Buffer = buffer;

            color = totalprogress_label.Style.Background (StateType.Normal);
            buffer_intro = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            textview_intro.Buffer = buffer_intro;
            textview_intro.ModifyBase (Gtk.StateType.Normal, color);
            buffer_intro.Text = Catalog.GetString ("Welcome to the project building process. Press the 'Generate' button to start this process.");
        }
开发者ID:GNOME,项目名称:mistelix,代码行数:14,代码来源:BuildProjectDialog.cs


示例18: StringWindow

        public StringWindow(string data)
        {
            Glade.XML ui;

            buffer = new Gtk.TextBuffer (null);

            ui = Glade.XML.FromAssembly ("stringvis.glade", "string_dialog", null);
            ui.Autoconnect (this);

            string_dialog.SetDefaultSize (400, 300);

            string_textview.Buffer = buffer;
            buffer.Text = data;
        }
开发者ID:mono,项目名称:monodevelop-visualizers,代码行数:14,代码来源:StringVisualizer.cs


示例19: TextVisualizerView

		public TextVisualizerView ()
		{
			vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			
			TextTagTable tagTable = new TextTagTable ();
			TextBuffer buffer = new TextBuffer (tagTable);
			textView = new TextView (buffer);

			scrolledWindow = new ScrolledWindow ();
			scrolledWindow.AddWithViewport (textView);
			
			vbox.PackStart (scrolledWindow, true, true, 0);
			
			vbox.ShowAll ();
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:16,代码来源:TextVisualizerView.cs


示例20: LogWindow

        public LogWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            Current = this;
            SetSizeRequest(800, 800);
            var tab = new TextTagTable();
            buf = new TextBuffer(tab);
            var en = new TextView(buf);
            sv = new ScrolledWindow();
            sv.Add(en);
            Add(sv);

            CoreLib.OnLog += (txt) => AppendText(txt);

            ShowAll();
        }
开发者ID:abanu-desktop,项目名称:abanu,代码行数:16,代码来源:LogWindow.cs



注:本文中的Gtk.TextBuffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Gtk.TextTag类代码示例发布时间:2022-05-26
下一篇:
C# Gtk.Table类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap