Public Member Functions | |
this (WindowBase w, SB_VISIBLE xBar, SB_VISIBLE yBar) | |
Constructs a new Scroller to scroll a window. | |
Properties | |
WindowBase | window () |
The window to which this Scroller is attached. | |
ScrollDimension | x () |
The horizontal scroll bar. | |
ScrollDimension | y () |
The vertical scroll bar. | |
bool | dragging () |
Whether a drag-scroll operation is currently in progress. | |
Listeners | |
int | dragScroll (uint message, uint wParam, int lParam, WindowBase receivedVia, out bool swallow) |
Implements scrolling by dragging from the inside to the outside of the window. | |
int | keyboardScroll (uint message, uint wParam, int lParam, WindowBase receivedVia, out bool swallow) |
Implements a keyboard interface to scroll the window. | |
Public Attributes | |
int | dragInterval = 100 |
The time interval, in milliseconds, at which the scroll position will be updated during drag-scrolling. | |
bool | homeEndHorizontal |
Whether the Home and End keys will scroll horizontally instead of vertically. | |
bool | pageUpDownHorizontal |
Whether the Page Up and Page Down keys will scroll horizontally instead of vertically. | |
Protected Member Functions | |
Callback Methods | |
void | doScroll (int xPos, int yPos, int xIncrement, int yIncrement) |
void | setPageSize () |
Called when the window is resized, to update the pageLength values of the scroll bars. | |
void | doDragScroll (int xMouse, int yMouse) |
Called by Scroller.dragScroll to update the scroll state while drag-scrolling. |
smjg.libs.sdwf.scroller.Scroller.this | ( | WindowBase | w, | |
SB_VISIBLE | xBar, | |||
SB_VISIBLE | yBar | |||
) |
Constructs a new Scroller to scroll a window.
w | the window that this Scroller will scroll. The scroller is automatically attached to the window. | |
xBar | the visibility of the horizontal scroll bar. | |
yBar | the visibility of the vertical scroll bar. |
WindowBase smjg.libs.sdwf.scroller.Scroller.window | ( | ) |
ScrollDimension smjg.libs.sdwf.scroller.Scroller.x | ( | ) |
The horizontal scroll bar.
Will be null
if SB_VISIBLE.NONE was specified when the Scroller was constructed.
ScrollDimension smjg.libs.sdwf.scroller.Scroller.y | ( | ) |
The vertical scroll bar.
Will be null
if SB_VISIBLE.NONE was specified when the Scroller was constructed.
bool smjg.libs.sdwf.scroller.Scroller.dragging | ( | ) |
Whether a drag-scroll operation is currently in progress.
int smjg.libs.sdwf.scroller.Scroller.dragScroll | ( | uint | message, | |
uint | wParam, | |||
int | lParam, | |||
WindowBase | receivedVia, | |||
out bool | swallow | |||
) |
Implements scrolling by dragging from the inside to the outside of the window.
To enable drag-scrolling, add this method as a listener to the window involved. Care should be taken to ensure that any mouse messages that may be required for this to work are not swallowed before this listener can process them.
This listener causes the window to capture all mouse messages while a drag operation is in progress, even if no scrolling is needed for the time being. This also simplifies the task of supporting dragging within a window.
int smjg.libs.sdwf.scroller.Scroller.keyboardScroll | ( | uint | message, | |
uint | wParam, | |||
int | lParam, | |||
WindowBase | receivedVia, | |||
out bool | swallow | |||
) |
Implements a keyboard interface to scroll the window.
To enable keyboard scrolling, add this method as a listener to the window involved. Care should be taken to ensure that any keyboard messages that may be required for this to work are not swallowed before this listener can process them.
This listener processes the following keystrokes:
Left, Right | horizontally by lineStep |
Up, Down | vertically by lineStep |
Page Up, Page Down | vertically by pageStep (or horizontally if pageUpDownHorizontal is true) |
Ctrl+Page Up, Ctrl+Page Down | horizontally by pageStep |
Home, End | vertically to the beginning or end (or horizontally if homeEndHorizontal is true) |
Ctrl+Home, Ctrl+End | vertically to the beginning or end |
If one dimension has the SB_VISIBLE.NONE setting, then the remaining dimension will automatically be chosen for the Home, End, Page Up and Page Down keys with and without Ctrl.
void smjg.libs.sdwf.scroller.Scroller.doScroll | ( | int | xPos, | |
int | yPos, | |||
int | xIncrement, | |||
int | yIncrement | |||
) | [protected] |
Called when a scroll operation is activated to do the scrolling itself.
The default implementation updates the window's logical coordinate system and scrolls the whole window client area.
xPos | the new horizontal scroll position. | |
yPos | the new vertical scroll position. | |
xIncrement | the amount by which the horizontal scroll position has changed in this operation. | |
yIncrement | the amount by which the vertical scroll position has changed in this operation. |
xPos
and yPos
, or only xIncrement
and yIncrement
, or use both in different places as appropriate. There is no need to update the scroll bars themselves, as this is done automatically before doScroll
is called.void smjg.libs.sdwf.scroller.Scroller.setPageSize | ( | ) | [protected] |
void smjg.libs.sdwf.scroller.Scroller.doDragScroll | ( | int | xMouse, | |
int | yMouse | |||
) | [protected] |
Called by Scroller.dragScroll to update the scroll state while drag-scrolling.
The default implementation scrolls the window when the mouse cursor leaves the client area, at a rate proportional to the distance of the mouse cursor from the edge.
xMouse | x-coordinate of the mouse cursor. | |
yMouse | y-coordinate of the mouse cursor. The x and y values are given in device coordinates from the upper-left corner of the window client area. |
The time interval, in milliseconds, at which the scroll position will be updated during drag-scrolling.
Whether the Home and End keys will scroll horizontally instead of vertically.
Whether the Page Up and Page Down keys will scroll horizontally instead of vertically.