示例#1
0
		protected TextArea(TextView textView)
		{
			if (textView == null) {
				throw new ArgumentNullException("textView");
			}
			TextView = textView;
			TextView.SetBinding(TextView.DocumentProperty, new Binding("Document") { Source = this });
			
			ReadOnlySectionProvider = NoReadOnlySections.Instance;
			
			LeftMargins = new ObservableCollection<UIElement>();
			LeftMargins.Add(new LineNumberMargin {
				TextView = textView,
				TextArea = this
			});
			LeftMargins.Add(new Line { 
				X1 = 0, Y1 = 0, X2 = 0, Y2 = 1, StrokeDashArray = { 0, 2 },
				Stretch = Stretch.Fill, Stroke = Brushes.Gray, StrokeDashCap = PenLineCap.Round,
				Margin = new Thickness(2, 0, 2, 0)
			});
			
			var colorizer = new SelectionColorizer(this);
			TextView.LineTransformers.Add(colorizer);
			TextView.BackgroundRender.Add(colorizer);
			
			Caret = new Caret(this);
			
			CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo, ExecuteUndo, CanExecuteUndo));
			CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo, ExecuteRedo, CanExecuteRedo));
			
			CommandBindings.AddRange(CaretNavigationCommandHandler.CommandBindings);
			InputBindings.AddRange(CaretNavigationCommandHandler.InputBindings);
			
			CommandBindings.AddRange(EditingCommandHandler.CommandBindings);
			InputBindings.AddRange(EditingCommandHandler.InputBindings);
			
			new SelectionMouseHandler(this).Attach();
		}
		public void AddSegments(TextView textView, IEnumerable<ISegment> segments) 
		{ 
			//TODO: BackgroundGeometryBuilder.AddSegments()
			throw new NotImplementedException();
		}
		protected override void OnTextViewChanged(TextView oldTextView, TextView newTextView)
		{
			base.OnTextViewChanged(oldTextView, newTextView);
		}
		protected virtual void OnTextViewChanged(TextView oldTextView, TextView newTextView) 
		{ 
			//TODO: AbstractMargin.OnTextViewChanged()
			throw new NotImplementedException();
		}
示例#5
0
		internal Caret(TextArea textArea)
		{
			this.textArea = textArea;
			this.textView = textArea.TextView;
			Position = new TextViewPosition(1, 1, 0);
			
			caretAdorner = new CaretAdorner(textView);
			textView.Adorners.Add(caretAdorner);
			textView.VisualLinesChanged += textView_VisualLinesChanged;
			textView.ScrollOffsetChanged += textView_ScrollOffsetChanged;
		}
		public FoldingManager(TextView textView, TextDocument document)
		{
			this.textView = textView;
			this.document = document;
		}
示例#7
0
		public CaretAdorner(TextView textView)
		{
		}
		public HighlightingColorizer(TextView textView, HighlightingRuleSet ruleSet)
		{
		}