/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using VST = Microsoft.VisualStudio.Text;
using VSTE = Microsoft.VisualStudio.Text.Editor;
namespace dnSpy.Contracts.Hex.Editor {
///
/// View scroller
///
public abstract class HexViewScroller {
///
/// Constructor
///
protected HexViewScroller() { }
///
/// Scrolls a span into view
///
/// Line span
public void EnsureSpanVisible(HexLineSpan lineSpan) => EnsureSpanVisible(lineSpan, VSTE.EnsureSpanVisibleOptions.None);
///
/// Scrolls a span into view
///
/// Line span
/// Options
public abstract void EnsureSpanVisible(HexLineSpan lineSpan, VSTE.EnsureSpanVisibleOptions options);
///
/// Scrolls a span into view
///
/// Span
/// Flags
public void EnsureSpanVisible(HexBufferSpan span, HexSpanSelectionFlags flags) =>
EnsureSpanVisible(span, flags, VSTE.EnsureSpanVisibleOptions.None);
///
/// Scrolls a span into view
///
/// Span
/// Flags
/// Options
public abstract void EnsureSpanVisible(HexBufferSpan span, HexSpanSelectionFlags flags, VSTE.EnsureSpanVisibleOptions options);
///
/// Scrolls a line into view
///
/// Line
/// Line span
public void EnsureSpanVisible(HexBufferLine line, VST.Span span) =>
EnsureSpanVisible(line, span, VSTE.EnsureSpanVisibleOptions.None);
///
/// Scrolls a line into view
///
/// Line
/// Line span
/// Options
public abstract void EnsureSpanVisible(HexBufferLine line, VST.Span span, VSTE.EnsureSpanVisibleOptions options);
///
/// Scrolls the viewport horizontally
///
/// Distance to scroll
public abstract void ScrollViewportHorizontallyByPixels(double distanceToScroll);
///
/// Scrolls the viewport vertically
///
/// Distance to scroll
public abstract void ScrollViewportVerticallyByPixels(double distanceToScroll);
///
/// Scrolls the viewport one line up or down
///
/// Direction
public void ScrollViewportVerticallyByLine(VSTE.ScrollDirection direction) =>
ScrollViewportVerticallyByLines(direction, 1);
///
/// Scrolls the viewport by lines
///
/// Direction
/// Number of lines to scroll
public abstract void ScrollViewportVerticallyByLines(VSTE.ScrollDirection direction, int count);
///
/// Scrolls the viewport one page up or down
///
/// Direction
///
public abstract bool ScrollViewportVerticallyByPage(VSTE.ScrollDirection direction);
}
}