class PScrollable: public PInteractor

An interactor that has its logical contents larger than the drawable bounds.

Inheritance:


Public Fields

[more]PRect scrollRange
The range in which the scrollable is scrolled.

Public Methods

[more] PScrollable ( PScroller * parent )
Create a scrollable interactor that will be scrolled by the parent PScroller class.
[more]virtual PRect GetDrawingBounds ( CoordinateSystem coords ) const
Get the drawing bounds for the scrollable interactor.
[more]void SetScrollRange ( const PRect & rect )
Set the range in which the scrollable is scrolled.
[more]PRect GetScrollRange () const
Get the range in which the scrollable is scrolled.
[more]void SetScaleFactor ( PORDINATE x, PORDINATE y )
Set the scaling factor in pixels for the scroll range.
[more]PPoint GetScaleFactor () const
Get the scaling factor in pixels for the scroll range.
[more]PPoint GetOrigin () const
Get the current origin of the scrollable in the scrolling units.
[more]void ScrollTo ( PORDINATE x, PORDINATE y )
Scroll the scrollable contents to the new origin specified.
[more]void ScrollBy ( PORDINATE dx, PORDINATE dy )
Scroll the scrollable contents by the amount specified.
[more]virtual void OnScroll ( const PPoint & delta )
The system (via the PScroller class) calls this whenever the user has scrolled the window in one of the two dimensions.

Public

[more] Overrides from class PInteractor
[more] New functions for class
[more] System callback functions.

Protected Fields

[more]PPoint scaleFactor
Scaling factor in pixels of the scrollBounds.
[more]PPoint origin
Origin into the virtual bounds rectangle that the top left corner of the interactor is currently displaying

Protected

[more] Member variables


Inherited from PInteractor:

Public Classes

oenum PositionOrigin
oenum CoordinateSystem
oenum AutoAdjustType

Public Fields

oPCursor cursor

Public Methods

ovirtual Comparison Compare( const PObject & obj ) const
oPInteractor* GetParent() const
oBOOL IsChild( PInteractor * parent ) const
oPINDEX GetNumChildren()
oPInteractor& operator[]( PINDEX index )
ovirtual void UpdateCommandSources()
ovirtual void SetFont( const PFont & newFont, BOOL toChildren = TRUE )
oconst PRealFont& GetFont()
oPDIMENSION ToPixelsDX( PDIMENSION x ) const
oPDIMENSION ToPixelsDY( PDIMENSION y ) const
oPORDINATE ToPixelsX( PORDINATE x ) const
oPORDINATE ToPixelsY( PORDINATE y ) const
oPDim ToPixels( const PDim & dim ) const
oPPoint ToPixels( const PPoint & pt ) const
oPRect ToPixels( const PRect & r ) const
oPDIMENSION FromPixelsDX( PDIMENSION x ) const
oPDIMENSION FromPixelsDY( PDIMENSION y ) const
oPORDINATE FromPixelsX( PORDINATE x ) const
oPORDINATE FromPixelsY( PORDINATE y ) const
oPDim FromPixels( const PDim & dim ) const
oPPoint FromPixels( const PPoint & pt ) const
oPRect FromPixels( const PRect & r ) const
ovoid SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin = TopLeftParent, PositionOrigin yOrigin = TopLeftParent )
oPPoint GetPosition( CoordinateSystem coords ) const
oPPoint ToScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
oPPoint FromScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
ovoid SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
oPDim GetDimensions( CoordinateSystem coords ) const
oPRect GetStructureBounds( CoordinateSystem coords ) const
ovoid AutoAdjustBounds( PRect & bounds, AutoAdjustType type = AdjustBounds )
oBOOL ContainsPoint( const PPoint & pt, CoordinateSystem coords ) const
oPInteractor* FindInteractor( const PPoint & pt, CoordinateSystem coords ) const
ovirtual void Enable( BOOL enabled = TRUE )
ovoid Disable()
oBOOL IsEnabled() const
ovirtual void ShowAll()
ovirtual void Show( BOOL visible = TRUE )
ovoid Hide()
oBOOL IsVisible() const
ovirtual void BringToTop()
ovirtual BOOL IsOnTop() const
ovoid Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Update()
ovoid GrabMouse()
ovoid ReleaseMouse()
oBOOL HasMouse() const
ovoid GrabFocus()
oBOOL HasFocus() const
ovirtual void SetCursor( const PCursor & newCursor )
oPCursor GetCursor() const
ovoid SetCursorToParent( BOOL useParent = TRUE )
ovoid SetAllCursors( const PCursor & newCursor )
ovoid RestoreAllCursors()
ovoid SetWaitCursor()
ovoid SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCursorPos( CoordinateSystem coords ) const
ovirtual void ShowCursor( BOOL show = TRUE )
ovoid HideCursor()
ovoid SetCaret( const PCaret & newCaret )
oPCaret GetCaret() const
ovoid SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCaretPos( CoordinateSystem coords ) const
ovirtual void ShowCaret(BOOL show = TRUE)
ovoid HideCaret()
ovirtual void SetForegroundColour( const PColour & newColour )
oconst PColour& GetForegroundColour() const
ovirtual void SetBackgroundColour( const PColour & newColour )
oconst PColour& GetBackgroundColour() const
oPDim GetBorderSize() const
oconst PColour& GetBorderColour() const
oPCanvas* StartMouseTrack( BOOL wantsCanvas = FALSE )
ovirtual void OnMouseMove( PKeyCode button, const PPoint & where )
ovirtual void OnMouseDown( PKeyCode button, const PPoint & where, BOOL doubleClick )
ovirtual void OnMouseUp( PKeyCode button, const PPoint & where )
ovirtual BOOL OnKeyDown( PKeyCode key, unsigned repeat )
ovirtual void OnKeyUp( PKeyCode key )
ovirtual void OnKeyInput( const PString & str )
ovirtual void OnGainFocus()
ovirtual void OnLostFocus()
ovirtual void OnStartInput()
ovirtual BOOL OnEndInput()
ovirtual void OnRedraw( PCanvas & canvas )
ovirtual void OnControlNotify( PControl & control, int option )
ovirtual void OnSelectHelp()
ovirtual PBalloon* OnBalloonHelp()
ovirtual void OnMouseTrack( PCanvas * canvas, const PPoint & where, BOOL lastTrack )
ovirtual void _SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin, PositionOrigin yOrigin )

Public

Overrides from class PObject

Protected Fields

oPApplication* owner
oPInteractor* parent
oPInteractorList children
oPRealFont font
oPCursor savedCursor
oPCaret caret
oPPoint caretPosition
oint caretVisible
oPColour foregroundColour
oPColour backgroundColour
oPInteractor* mouseTrackInteractor
oPInteractorCanvas* mouseTrackCanvas

Protected Methods

ovirtual void _SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void _SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void SetFocusInteractor( PInteractor * interactor )
ovirtual PInteractor* GetFocusInteractor() const
ovirtual void UpdateMyCommandSources()

Protected

o Flag to indicate that the parent interactor layouts cursor should be used with this interactor.


Documentation

An interactor that has its logical contents larger than the drawable bounds. This works in conjunction with the PScroller class to produce a scrolling interactor.

The bounds returned by a PCanvas attached to an interactor normally indicate the size of the internal area of the window. With a scrollable interactor the PCanvas may return a larger dimension, as set by the SetScrollRange() function.

The canvas does not know (or care) what is visible and this interactor handles the necessary coordinate adjustments and and bitblt's for scrolling around a large drawable area.

The scrolling mechanism can operate in minimum "quanta". This is smallest number of pixels that can be scrolled. This is set by the scale factor of the scrollable interactor. For example, a text editor would only ever scroll in whole lines or character widths. So the scale factor is set to the number of pixels for the height of a line and width of a character.

Note that the last child interactor that is a descendent of the PScrollable class is the contents" that is scrolled by the PScroller.

o PScrollable( PScroller * parent )
Create a scrollable interactor that will be scrolled by the parent PScroller class.
Parameters:
parent - Scroller class that scrolls the scrollable.

o Overrides from class PInteractor

ovirtual PRect GetDrawingBounds( CoordinateSystem coords ) const
Get the drawing bounds for the scrollable interactor. This yields the size of the drawable area that the PInteractorCanvas will use as its drawing bounds.

When scaling is used (coords == LocalCoords), the coordinates used are 1/4 average font width and 1/8 the font height.

Returns:
drawing bounds rectangle for the interactor.
Parameters:
coords - Coordinate system to use.

o New functions for class

ovoid SetScrollRange( const PRect & rect )
Set the range in which the scrollable is scrolled. This gives the minimum and maximum scroll range in both vertical and horizontal directions.
Parameters:
rect - Rectangle for the scrolling limits.

oPRect GetScrollRange() const
Get the range in which the scrollable is scrolled. This gives the minimum and maximum scroll range in both vertical and horizontal directions.

Returns:
rectangle for the scrolling limits.

ovoid SetScaleFactor( PORDINATE x, PORDINATE y )
Set the scaling factor in pixels for the scroll range. This determines the minimum "quanta" for scrolling. Each scroll bar unit will scroll the contents by this many pixels in each direction.
Parameters:
x - Set horizontal scale factor.
y - Set vertical sccroll factor.

oPPoint GetScaleFactor() const
Get the scaling factor in pixels for the scroll range. This determines the minimum "quanta" for scrolling. Each scroll bar unit will scroll the contents by this many pixels in each direction.

Returns:
scale factor in each dimension.

oPPoint GetOrigin() const
Get the current origin of the scrollable in the scrolling units. This must be multiplied by the scale factor to yield a number of pixels to scroll.

Returns:
the current origin for the scrollable area

ovoid ScrollTo( PORDINATE x, PORDINATE y )
Scroll the scrollable contents to the new origin specified. The origin is in the scrolling units. This must be multiplied by the scale factor to yield a number of pixels.
Parameters:
x - Horizontal position to scroll to.
y - Vertical position to scroll to.

ovoid ScrollBy( PORDINATE dx, PORDINATE dy )
Scroll the scrollable contents by the amount specified. The delta to scroll is in the scrolling units. This must be multiplied by the scale factor to yield a number of pixels.
Parameters:
dx - Amount to scroll horizontally.
dy - Amount to scroll vertically.

o System callback functions.

ovirtual void OnScroll( const PPoint & delta )
The system (via the PScroller class) calls this whenever the user has scrolled the window in one of the two dimensions. The origin variable will be already be updated to its new position. The old position can be calculated by subtracting the delta value to it.

The default behaviour of this function is to do the bitblt of the interactors contents by the scrolled amount and invalidate the area "exposed" by the scrolling.

Parameters:
delta - Amount the scrollable was scrolled.

o Member variables

oPRect scrollRange
The range in which the scrollable is scrolled.

oPPoint scaleFactor
Scaling factor in pixels of the scrollBounds.

oPPoint origin
Origin into the virtual bounds rectangle that the top left corner of the interactor is currently displaying


Direct child classes:
PTerminal

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.