Esempio n. 1
0
 protected virtual void OnClicked(ContextMenuItemClickedEventArgs e)
 {
     if (Clicked != null)
     {
         Clicked(this, e);
     }
 }
Esempio n. 2
0
        static void CopyClicked(object o, ContextMenuItemClickedEventArgs e)
        {
            var entry = (Gtk.Entry)e.Context;
            int selection_start, selection_end;

            if (entry.GetSelectionBounds(out selection_start, out selection_end))
            {
                var text      = entry.GetChars(selection_start, selection_end);
                var clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

                clipboard.Text = text;
            }
        }
Esempio n. 3
0
        static void DeleteClicked(object o, ContextMenuItemClickedEventArgs e)
        {
            var entry = (Gtk.Entry)e.Context;

            if (entry.IsEditable)
            {
                int selection_start, selection_end;

                if (entry.GetSelectionBounds(out selection_start, out selection_end))
                {
                    entry.DeleteText(selection_start, selection_end);
                }
            }
        }
Esempio n. 4
0
        static void PasteClicked(object o, ContextMenuItemClickedEventArgs e)
        {
            var entry = (Gtk.Entry)e.Context;

            if (entry.IsEditable)
            {
                var clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

                clipboard.RequestText((cb, text) => {
                    entry.InsertText(text);
                });
            }
            else
            {
                entry.ErrorBell();
            }
        }
Esempio n. 5
0
        static void CutClicked(object o, ContextMenuItemClickedEventArgs e)
        {
            var entry = (Gtk.Entry)e.Context;

            if (entry.IsEditable)
            {
                int selection_start, selection_end;

                if (entry.GetSelectionBounds(out selection_start, out selection_end))
                {
                    var text      = entry.GetChars(selection_start, selection_end);
                    var clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

                    clipboard.Text = text;
                    entry.DeleteText(selection_start, selection_end);
                }
            }
            else
            {
                entry.ErrorBell();
            }
        }
Esempio n. 6
0
        static void SelectAllClicked(object o, ContextMenuItemClickedEventArgs e)
        {
            var entry = (Gtk.Entry)e.Context;

            entry.SelectRegion(0, entry.Text.Length - 1);
        }
		protected virtual void OnClicked (ContextMenuItemClickedEventArgs e)
		{
			if (Clicked != null)
				Clicked (this, e);
		}