当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.Insert方法代码示例

本文整理汇总了C#中Gtk.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Insert方法的具体用法?C# Gtk.Insert怎么用?C# Gtk.Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk的用法示例。


在下文中一共展示了Gtk.Insert方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartUpload

        public void StartUpload(Gtk.TextBuffer updateWindow)
        {
            //Create a temp file
            updateWindow.Insert (updateWindow.EndIter, "Saving file.\n");
            PintaCore.Workspace.ActiveDocument.Save (false);

            //Using Imgur API key
            updateWindow.Insert (updateWindow.EndIter, "Uploading file.\n");
            string result = PostToImgur (PintaCore.Workspace.ActiveDocument.PathAndFileName,
                                         "ecf58baa7533e4c4535205bcac51a010");
            string web_path = ParseResult (result);
            updateWindow.Insert (updateWindow.EndIter, "The imgur address is:\n");
            updateWindow.Insert (updateWindow.EndIter, web_path);
        }
开发者ID:PintaProject,项目名称:PintaUploadAddin,代码行数:14,代码来源:ImgurUploadType.cs

示例2: InsertTimeStamp

        protected override void InsertTimeStamp(Gtk.TextBuffer buffer, ref Gtk.TextIter iter,
                                                string timestamp, MessageModel msg)
        {
            if (String.IsNullOrWhiteSpace(msg.ID)) {
                buffer.Insert(ref iter, timestamp);
            } else {
                var uri = new Uri(String.Format("https://twitter.com/{0}/status/{1}", msg.GetNick(), msg.ID));

                var tags = new List<Gtk.TextTag>();
                // link URI tag
                var linkTag = new LinkTag(uri);
                linkTag.TextEvent += OnLinkTagTextEvent;
                _MessageTextTagTable.Add(linkTag);
                tags.Add(linkTag);

                // link style tag
                tags.Add(LinkTag);

                buffer.InsertWithTags(ref iter, timestamp, tags.ToArray());
            }

            buffer.Insert(ref iter, " ");
        }
开发者ID:meebey,项目名称:smuxi,代码行数:23,代码来源:TwitterMessageTextView.cs

示例3: BuildToolbar

        public override void BuildToolbar(Gtk.Toolbar toolBar)
        {
            ToolBarComboBox zoomCombobox = new ToolBarComboBox (100, 4, true, new string[] { "400%", "300%", "200%", "150%", "100%", "66%", "50%" });
            zoomCombobox.ComboBox.Changed += delegate(object sender, EventArgs e) {
                string text = zoomCombobox.ComboBox.ActiveText;
                text = text.Trim ('%');

                double percent;

                if (!double.TryParse (text, out percent))
                    return;
                percent = Math.Min (percent, 400);
                designService.ZoomChanged (percent / 100.0);
            };
            toolBar.Insert(zoomCombobox,0);
        }
开发者ID:modesto,项目名称:monoreports,代码行数:16,代码来源:ZoomTool.cs

示例4: InsertOptions

		public void InsertOptions (Gtk.Menu menu, CommandEntrySet entrySet, int index)
		{
			CommandTargetRoute route = new CommandTargetRoute ();
			foreach (CommandEntry entry in entrySet) {
				Gtk.MenuItem item = entry.CreateMenuItem (this);
				CustomItem ci = item.Child as CustomItem;
				if (ci != null)
					ci.SetMenuStyle (menu);
				int n = menu.Children.Length;
				menu.Insert (item, index);
				if (item is ICommandUserItem)
					((ICommandUserItem)item).Update (route);
				else
					item.Show ();
				index += menu.Children.Length - n;
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:17,代码来源:CommandManager.cs

示例5: AddAlternativeText

 static void AddAlternativeText(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, ImageMessagePartModel imgPart)
 {
     if (!String.IsNullOrEmpty(imgPart.AlternativeText)) {
         buffer.Insert(ref iter, imgPart.AlternativeText);
     }
 }
开发者ID:pacificIT,项目名称:smuxi,代码行数:6,代码来源:MessageTextView.cs

示例6: InsertToBuffer

        private void InsertToBuffer(Gtk.TextBuffer buffer, ref Gtk.TextIter iter, TextMessagePartModel fmsgti)
        {
            var tags = new List<Gtk.TextTag>();
            if (fmsgti.Text == null) {
                // Gtk.TextBuffer.Insert*() asserts on text == NULL
                return;
            }
            if (fmsgti.ForegroundColor != TextColor.None) {
                var bg = ColorConverter.GetTextColor(BackgroundColor);
                if (fmsgti.BackgroundColor != TextColor.None) {
                    bg = fmsgti.BackgroundColor;
                }
                TextColor color = TextColorTools.GetBestTextColor(
                    fmsgti.ForegroundColor, bg
                );
                string tagname = GetTextTagName(color, null);
                var tag = _MessageTextTagTable.Lookup(tagname);
                tags.Add(tag);
            }
            if (fmsgti.BackgroundColor != TextColor.None) {
                // TODO: get this from ChatView
                string tagname = GetTextTagName(null, fmsgti.BackgroundColor);
                var tag = _MessageTextTagTable.Lookup(tagname);
                tags.Add(tag);
            }
            if (fmsgti.Underline) {
            #if LOG4NET && MSG_DEBUG
                _Logger.Debug("AddMessage(): fmsgti.Underline is true");
            #endif
                tags.Add(UnderlineTag);
            }
            if (fmsgti.Bold) {
            #if LOG4NET && MSG_DEBUG
                _Logger.Debug("AddMessage(): fmsgti.Bold is true");
            #endif
                tags.Add(BoldTag);
            }
            if (fmsgti.Italic) {
            #if LOG4NET && MSG_DEBUG
                _Logger.Debug("AddMessage(): fmsgti.Italic is true");
            #endif
                tags.Add(ItalicTag);
            }

            if (tags.Count > 0) {
                buffer.InsertWithTags(ref iter, fmsgti.Text, tags.ToArray());
            } else {
                buffer.Insert(ref iter, fmsgti.Text);
            }
        }
开发者ID:meebey,项目名称:smuxi,代码行数:50,代码来源:MessageTextView.cs

示例7: InsertTimeStamp

 protected virtual void InsertTimeStamp(Gtk.TextBuffer buffer, ref Gtk.TextIter iter,
                                        string timestamp, MessageModel msg)
 {
     timestamp = String.Format("{0} ", timestamp);
     buffer.Insert(ref iter, timestamp);
 }
开发者ID:meebey,项目名称:smuxi,代码行数:6,代码来源:MessageTextView.cs

示例8: Deserialize

		public static void Deserialize (Gtk.TextBuffer buffer,
		                                Gtk.TextIter   start,
		                                XmlTextReader  xml)
		{
			int offset = start.Offset;
			Stack<TagStart> stack = new Stack<TagStart> ();
			TagStart tag_start;

			NoteTagTable note_table = buffer.TagTable as NoteTagTable;

			int curr_depth = -1;

			// A stack of boolean values which mark if a
			// list-item contains content other than another list
			Stack<bool> list_stack = new Stack<bool> ();

			while (xml.Read ()) {
				switch (xml.NodeType) {
				case XmlNodeType.Element:
					if (xml.Name == "note-content")
						break;

					tag_start = new TagStart ();
					tag_start.Start = offset;

					if (note_table != null &&
					                note_table.IsDynamicTagRegistered (xml.Name)) {
						tag_start.Tag =
						        note_table.CreateDynamicTag (xml.Name);
					} else if (xml.Name == "list") {
						curr_depth++;
						break;
					} else if (xml.Name == "list-item") {
						if (curr_depth >= 0) {
							if (xml.GetAttribute ("dir") == "rtl") {
								tag_start.Tag =
								        note_table.GetDepthTag (curr_depth, Pango.Direction.Rtl);
							} else {
								tag_start.Tag =
								        note_table.GetDepthTag (curr_depth, Pango.Direction.Ltr);
							}
							list_stack.Push (false);
						} else {
							Logger.Error("</list> tag mismatch");
						}
					} else {
						tag_start.Tag = buffer.TagTable.Lookup (xml.Name);
					}

					if (tag_start.Tag is NoteTag) {
						((NoteTag) tag_start.Tag).Read (xml, true);
					}

					stack.Push (tag_start);
					break;
				case XmlNodeType.Text:
				case XmlNodeType.Whitespace:
				case XmlNodeType.SignificantWhitespace:
					Gtk.TextIter insert_at = buffer.GetIterAtOffset (offset);
					buffer.Insert (ref insert_at, xml.Value);

					offset += xml.Value.Length;

					// If we are inside a <list-item> mark off
					// that we have encountered some content
					if (list_stack.Count > 0) {
						list_stack.Pop ();
						list_stack.Push (true);
					}

					break;
				case XmlNodeType.EndElement:
					if (xml.Name == "note-content")
						break;

					if (xml.Name == "list") {
						curr_depth--;
						break;
					}

					tag_start = stack.Pop ();
					if (tag_start.Tag == null)
						break;

					Gtk.TextIter apply_start, apply_end;
					apply_start = buffer.GetIterAtOffset (tag_start.Start);
					apply_end = buffer.GetIterAtOffset (offset);

					if (tag_start.Tag is NoteTag) {
						((NoteTag) tag_start.Tag).Read (xml, false);
					}

					// Insert a bullet if we have reached a closing
					// <list-item> tag, but only if the <list-item>
					// had content.
					DepthNoteTag depth_tag = tag_start.Tag as DepthNoteTag;

					if (depth_tag != null && list_stack.Pop ()) {
						((NoteBuffer) buffer).InsertBullet (ref apply_start,
						                                    depth_tag.Depth,
//.........这里部分代码省略.........
开发者ID:MatteoNardi,项目名称:Tomboy,代码行数:101,代码来源:NoteBuffer.cs

示例9: PopulateNodeTypes

		void PopulateNodeTypes (Gtk.Menu menu, TreeIter it)
		{
			ExtensionNodeTypeCollection types = GetAllowedChildTypes (it);
			Extension ext = (Extension) store.GetValue (it, ColExtension);
			ExtensionNodeDescription node = (ExtensionNodeDescription) store.GetValue (it, ColNode);
			
			if (types != null && types.Count > 0) {
				if (menu.Children.Length > 0)
					menu.Insert (new Gtk.SeparatorMenuItem (), -1);
				foreach (ExtensionNodeType nt in types) {
					Gtk.ImageMenuItem mi = new Gtk.ImageMenuItem (AddinManager.CurrentLocalizer.GetString ("Add node '{0}'", nt.NodeName));
					menu.Insert (mi, -1);
					ExtensionNodeType ntc = nt;
					mi.Activated += delegate {
						CreateNode (it, ext, node, ntc);
					};
				}
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:19,代码来源:ExtensionEditorWidget.cs

示例10: Deserialize

        public static void Deserialize (Gtk.TextBuffer buffer, Gtk.TextIter start, string content)
        {
            StringReader reader = new StringReader(content);
            int intCharacter;
            char convertedCharacter;
            int offset = start.Offset;
            string sbuffer = String.Empty;
            Stack<TagStart> stack = new Stack<TagStart> ();
            TagStart tag_start;

            while (true) {
                intCharacter = reader.Read ();

                if (intCharacter == -1) break;

                convertedCharacter = Convert.ToChar (intCharacter);

                if (sbuffer != String.Empty || convertedCharacter == '<') {
                    sbuffer += convertedCharacter;
                    if (sbuffer == "<bold>") {
                        tag_start = new TagStart ();
                        tag_start.Start = offset;
                        tag_start.Tag = buffer.TagTable.Lookup ("bold");
                        stack.Push (tag_start);
                        sbuffer = String.Empty;
                    } else if (sbuffer == "<italic>") {
                        tag_start = new TagStart ();
                        tag_start.Start = offset;
                        tag_start.Tag = buffer.TagTable.Lookup ("italic");
                        stack.Push (tag_start);
                        sbuffer = String.Empty;
                    } else if (sbuffer == "</bold>" || sbuffer == "</italic>") {
                        if (stack.Count > 0) {
                            tag_start = stack.Pop ();
                            Gtk.TextIter apply_start, apply_end;
                            apply_start = buffer.GetIterAtOffset (tag_start.Start);
                            apply_end = buffer.GetIterAtOffset (offset);
                            buffer.ApplyTag (tag_start.Tag, apply_start, apply_end);
                            sbuffer = String.Empty;
                        }
                    } else if (sbuffer.Length > 9) {
                        Gtk.TextIter insert_at = buffer.GetIterAtOffset(offset);
                        buffer.Insert (ref insert_at, sbuffer);
                        offset += sbuffer.Length;
                        sbuffer = String.Empty;
                    }
                } else {
                    Gtk.TextIter insert_at = buffer.GetIterAtOffset(offset);
                    buffer.Insert (ref insert_at, convertedCharacter.ToString ());
                    offset += 1;
                }
            }
        }
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:53,代码来源:EditableTextView.cs

示例11: BuildToolbar

        public override void BuildToolbar(Gtk.Toolbar toolBar)
        {
            bool setMode = false;
            ToolBarComboBox zoomCombobox = new ToolBarComboBox (100, 4, true, zoomItems);
            designService.OnZoomChanged += (a, b) => {

                setMode = true;
                ((Gtk.Entry)zoomCombobox.ComboBox.Child).Text = (designService.Zoom * 100).ToString() + "%";

                setMode = false;
            };
            zoomCombobox.ComboBox.Changed += delegate(object sender, EventArgs e) {
                if (!setMode)
                {
                    string text = zoomCombobox.ComboBox.ActiveText;
                    text = text.Trim('%');

                    double percent;

                    if (!double.TryParse(text, out percent))
                        return;
                    percent = Math.Min(percent, 400);
                    designService.ZoomChanged(percent / 100.0);
                }
            };
            toolBar.Insert(zoomCombobox,0);
        }
开发者ID:elsupergomez,项目名称:monoreports,代码行数:27,代码来源:ZoomTool.cs

示例12: Redo

		public void Redo (Gtk.TextBuffer buffer)
		{
			Gtk.TextIter iter = buffer.GetIterAtOffset (offset);

			buffer.Insert (ref iter, "\n");

			((NoteBuffer) buffer).InsertBullet (ref iter, depth, direction);

			buffer.MoveMark (buffer.InsertMark, iter);
			buffer.MoveMark (buffer.SelectionBound, iter);
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:11,代码来源:Undo.cs

示例13: BuildToolbar

 public virtual void BuildToolbar(Gtk.Toolbar toolBar)
 {
     if(IsToolbarTool){
     ToolBarButton toolButton = new ToolBarButton (ToolbarImageName,Name,Name);
     toolButton.Clicked += delegate(object sender, EventArgs e) {
         designService.SelectedControl = null;
         designService.SelectedTool = this;
         this.CreateMode = true;
     };
     toolBar.Insert (toolButton, 1);
     }
 }
开发者ID:modesto,项目名称:monoreports,代码行数:12,代码来源:BaseTool.cs


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