Ejemplo n.º 1
0
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     base.OnSelected(popupMenu, e);
     if (Parent.Fragment.tb.AutoIndent)
         Parent.Fragment.tb.DoAutoIndent();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// This method is called after item inserted into text
 /// </summary>
 public virtual void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     ;
 }
Ejemplo n.º 3
0
        internal virtual void OnSelecting()
        {
            if (FocussedItemIndex < 0 || FocussedItemIndex >= visibleItems.Count)
                return;
            tb.TextSource.Manager.BeginAutoUndoCommands();
            try
            {
                AutocompleteItem item = FocussedItem;
                SelectingEventArgs args = new SelectingEventArgs()
                {
                    Item = item,
                    SelectedIndex = FocussedItemIndex
                };

                Menu.OnSelecting(args);

                if (args.Cancel)
                {
                    FocussedItemIndex = args.SelectedIndex;
                    Invalidate();
                    return;
                }

                if (!args.Handled)
                {
                    var fragment = Menu.Fragment;
                    DoAutocomplete(item, fragment);
                }

                Menu.Close();
                //
                SelectedEventArgs args2 = new SelectedEventArgs()
                {
                    Item = item,
                    Tb = Menu.Fragment.tb
                };
                item.OnSelected(Menu, args2);
                Menu.OnSelected(args2);
            }
            finally
            {
                tb.TextSource.Manager.EndAutoUndoCommands();
            }
        }
Ejemplo n.º 4
0
 public override void OnSelected(AutocompleteMenu popupMenu, SelectedEventArgs e)
 {
     e.Tb.BeginUpdate();
     e.Tb.Selection.BeginUpdate();
     //remember places
     var p1 = popupMenu.Fragment.Start;
     var p2 = e.Tb.Selection.Start;
     //do auto indent
     if (e.Tb.AutoIndent)
     {
         for (int iLine = p1.iLine + 1; iLine <= p2.iLine; iLine++)
         {
             e.Tb.Selection.Start = new Place(0, iLine);
             e.Tb.DoAutoIndent(iLine);
         }
     }
     e.Tb.Selection.Start = p1;
     //move caret position right and find char ^
     while (e.Tb.Selection.CharBeforeStart != '^')
         if (!e.Tb.Selection.GoRightThroughFolded())
             break;
     //remove char ^
     e.Tb.Selection.GoLeft(true);
     e.Tb.InsertText("");
     //
     e.Tb.Selection.EndUpdate();
     e.Tb.EndUpdate();
 }
Ejemplo n.º 5
0
 public void OnSelected(SelectedEventArgs args)
 {
     if (Selected != null)
         Selected(this, args);
 }