예제 #1
0
 private static void RaiseSelectionChanged(IntPtr cPtr, IntPtr sender, IntPtr e)
 {
     try {
         if (!_SelectionChanged.ContainsKey(cPtr))
         {
             throw new System.InvalidOperationException("Delegate not registered for SelectionChanged event");
         }
         if (sender == System.IntPtr.Zero && e == System.IntPtr.Zero)
         {
             _SelectionChanged.Remove(cPtr);
             return;
         }
         if (Noesis.Extend.Initialized)
         {
             SelectionChangedHandler handler = _SelectionChanged[cPtr];
             if (handler != null)
             {
                 handler(Noesis.Extend.GetProxy(sender, false), new SelectionChangedEventArgs(e, false));
             }
         }
     }
     catch (System.Exception exception) {
         Noesis.Error.SetNativePendingError(exception);
     }
 }
예제 #2
0
 public _Editable(TextSpan textSpan                  = null, TextEditingValue value          = null,
                  Color cursorColor                  = null, ValueNotifier <bool> showCursor = null, bool hasFocus = false,
                  int?maxLines                       = null, Color selectionColor   = null, float textScaleFactor  = 1.0f,
                  TextDirection?textDirection        = null, bool obscureText       = false, TextAlign textAlign   = TextAlign.left,
                  bool autocorrect                   = false, ViewportOffset offset = null, SelectionChangedHandler onSelectionChanged = null,
                  CaretChangedHandler onCaretChanged = null, bool rendererIgnoresPointer = false,
                  Key key = null) : base(key)
 {
     this.textSpan               = textSpan;
     this.value                  = value;
     this.cursorColor            = cursorColor;
     this.showCursor             = showCursor;
     this.hasFocus               = hasFocus;
     this.maxLines               = maxLines;
     this.selectionColor         = selectionColor;
     this.textScaleFactor        = textScaleFactor;
     this.textAlign              = textAlign;
     this.textDirection          = textDirection;
     this.obscureText            = obscureText;
     this.autocorrect            = autocorrect;
     this.offset                 = offset;
     this.onSelectionChanged     = onSelectionChanged;
     this.onCaretChanged         = onCaretChanged;
     this.rendererIgnoresPointer = rendererIgnoresPointer;
 }
예제 #3
0
        public RenderEditable(TextSpan text, TextDirection textDirection, ViewportOffset offset,
                              ValueNotifier <bool> showCursor,
                              TextAlign textAlign                = TextAlign.left, double textScaleFactor = 1.0, Color cursorColor = null,
                              bool?hasFocus                      = null, int?maxLines = 1, Color selectionColor = null,
                              TextSelection selection            = null, bool obscureText = false, SelectionChangedHandler onSelectionChanged = null,
                              CaretChangedHandler onCaretChanged = null, bool ignorePointer = false)
        {
            this._textPainter = new TextPainter(text: text, textAlign: textAlign, textDirection: textDirection,
                                                textScaleFactor: textScaleFactor);
            this._cursorColor       = cursorColor;
            this._showCursor        = showCursor ?? new ValueNotifier <bool>(false);
            this._hasFocus          = hasFocus ?? false;
            this._maxLines          = maxLines;
            this._selectionColor    = selectionColor;
            this._selection         = selection;
            this._obscureText       = obscureText;
            this._offset            = offset;
            this.ignorePointer      = ignorePointer;
            this.onCaretChanged     = onCaretChanged;
            this.onSelectionChanged = onSelectionChanged;

            D.assert(this._maxLines == null || this._maxLines > 0);
            D.assert(this._showCursor != null);
            D.assert(!this._showCursor.value || cursorColor != null);

            this._tap                   = new TapGestureRecognizer(this);
            this._doubleTap             = new DoubleTapGestureRecognizer(this);
            this._tap.onTapDown         = this._handleTapDown;
            this._tap.onTap             = this._handleTap;
            this._doubleTap.onDoubleTap = this._handleDoubleTap;
            this._longPress             = new LongPressGestureRecognizer(debugOwner: this);
            this._longPress.onLongPress = this._handleLongPress;
        }