OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TScroller Class Reference

Class TScroller implements the actual scroller object. More...

#include <owl/scroller.h>

Inheritance diagram for owl::TScroller:
owl::TStreamableBase owl::TFlatScroller

Public Member Functions

 TScroller (TWindow *window, int xUnit, int yUnit, long xRange, long yRange)
 Constructs a TScroller object with window as the owner window, and xUnit, yUnit, xRange, and yRange as xUnit, yUnit, xRange and yRange, respectively.
 
virtual ~TScroller ()
 Destructs a TScroller object. Sets owning window's Scroller number variable to 0.
 
virtual void SetWindow (TWindow *win)
 Sets the owning window to win.
 
virtual void SetUnits (int xUnit, int yUnit)
 Sets the XUnit and YUnit data members to TheXUnit and TheYUnit, respectively.
 
virtual void SetPageSize ()
 Sets the XPage and YPage data members (amount by which to scroll on a page scroll request) to the width and height (in XUnits and YUnits) of the owner window's client area.
 
virtual void SetSBarRange ()
 Sets the range of the owner window's scroll bars to match the range of the TScroller and repaints as necessary.
 
virtual void SetRange (long xRange, long yRange)
 Sets the xRange and yRange of the TScroller to the parameters specified.
 
virtual void SetTotalRangeOfUnits (long xTotalUnits, long yTotalUnits)
 
virtual void BeginView (TDC &dc, TRect &rect)
 If TScroller_AutoOrg is true (default condition), BeginView automatically offsets the origin of the logical coordinates of the client area by XPos, YPos during a paint operation.
 
virtual void EndView ()
 Updates the position of the owner window's scroll bars to be coordinated with the position of the TScroller.
 
virtual void VScroll (uint scrollEvent, int thumbPos)
 Responds to the specified vertical scrollEvent by calling ScrollBy or ScrollTo.
 
virtual void HScroll (uint scrollEvent, int thumbPos)
 Responds to the specified horizontal scrollEvent by calling ScrollBy or ScrollTo.
 
virtual void ScrollTo (long x, long y)
 Scrolls the rectangle to the position specified in x and y after checking boundary conditions.
 
virtual bool EnableScrollBar (uint flags=SB_BOTH, uint arrow=ESB_ENABLE_BOTH)
 
virtual void ShowScrollBar (int code, bool show=true)
 
void ScrollBy (long dx, long dy)
 Scrolls to a position calculated using the passed delta values.
 
virtual bool IsAutoMode ()
 IsAutoMode is true if automatic scrolling is activated.
 
virtual void AutoScroll ()
 Performs "auto-scrolling" (dragging the mouse from within the client client area of the Window to without results in auto-scrolling when the AutoMode data member of the Scroller is true)
 
bool IsVisibleRect (long x, long y, int xExt, int yExt)
 Returns a bool value indicating whether or not the passed area (in units) is currently visible.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Public Attributes

TWindowWindow
 Points to the window whose client area scroller is to be managed.
 
long XPos
 Specifies the current position of the rectangle in horizontal scroll units.
 
long YPos
 Specifies the current position of the rectangle in vertical scroll units.
 
long XRange
 Specifies the number of horizontal scroll units.
 
long YRange
 Specifies the number of vertical scroll units.
 
long XTotalUnits
 Total number of horizontal scroll units.
 
long YTotalUnits
 Total number of vertical scroll units.
 
int XUnit
 Specifies the amount (in logical device units) to scroll the rectangle in the horizontal (X) direction.
 
int YUnit
 Specifies the amount (in logical device units) to scroll the rectangle in the vertical (Y) direction.
 
int XLine
 Specifies the number of logical device units per line to scroll the rectangle in the horizontal (X) direction.
 
int YLine
 Specifies the number of logical device units per line to scroll the rectangle in the vertical (Y) direction.
 
int XPage
 Specifies the number of logical device units per page to scroll the rectangle in the horizontal (X) direction.
 
int YPage
 Specifies the number of logical device units per page to scroll the rectangle in the vertical (Y) direction.
 
bool AutoMode
 Is true if automatic scrolling is activated.
 
bool TrackMode
 Is true if track scrolling is activated.
 
bool AutoOrg
 Is true if scroller offsets origin.
 
bool HasHScrollBar
 Is true if scroller has horizontal scroll.
 
bool HasVScrollBar
 Is true if scroller has vertical scroll.
 

Protected Member Functions

virtual void SetScrollPage (int bar, int page, bool redraw=true)
 
virtual int GetScrollPage (int bar) const
 
virtual void GetScrollRange (int bar, int &minPos, int &maxPos) const
 
virtual void SetScrollRange (int bar, int minPos, int maxPos, bool redraw=true)
 
virtual int GetScrollPos (int bar) const
 
virtual int SetScrollPos (int bar, int pos, bool redraw=true)
 
virtual int GetScrollTrackPos (int bar) const
 

Detailed Description

Class TScroller implements the actual scroller object.

All functions are inline or virtual to avoid pulling in code when no scrollers have been constructed. TScroller supports an automatic window-scrolling mechanism (referred to as autoscrolling) that works in conjunction with horizontal or vertical window scroll bars. (It also works if there are no scroll bars.) When autoscrolling is activated, the window automatically scrolls when the mouse is dragged from inside the client area of the window to outside that area. If the AutoMode data member is true, TScroller performs autoscrolling.

To use TScroller, set the Scroller member of your TWindow descendant to a TScroller object instantiated in the constructor of your TWindow descendant.

Definition at line 46 of file scroller.h.

Constructor & Destructor Documentation

◆ TScroller()

owl::TScroller::TScroller ( TWindow * window,
int xUnit,
int yUnit,
long xRange,
long yRange )

Constructs a TScroller object with window as the owner window, and xUnit, yUnit, xRange, and yRange as xUnit, yUnit, xRange and yRange, respectively.

Initializes data members to default values. HasHScrollBar and HasVScrollBar are set according to the scroll bar attributes of the owner window.

Definition at line 27 of file scroller.cpp.

References AutoMode, AutoOrg, owl::TWindow::GetWindowAttr(), HasHScrollBar, HasVScrollBar, owl::TWindowAttr::Style, owl::ToBool(), TrackMode, Window, XLine, XPage, XPos, XRange, XTotalUnits, XUnit, YLine, YPage, YPos, YRange, YTotalUnits, and YUnit.

◆ ~TScroller()

owl::TScroller::~TScroller ( )
virtual

Destructs a TScroller object. Sets owning window's Scroller number variable to 0.

Definition at line 53 of file scroller.cpp.

References owl::TWindow::GetScroller(), owl::TWindow::SetScroller(), and Window.

Member Function Documentation

◆ AutoScroll()

void owl::TScroller::AutoScroll ( )
virtual

Performs "auto-scrolling" (dragging the mouse from within the client client area of the Window to without results in auto-scrolling when the AutoMode data member of the Scroller is true)

Scrolls the owner window's display in response to the mouse being dragged from inside to outside the window. The direction and the amount by which the display is scrolled depend on the current position of the mouse.

Definition at line 363 of file scroller.cpp.

References AutoMode, owl::TWindow::GetClientRect(), owl::TWindow::GetHandle(), PRECONDITION, owl::TWindow::ScreenToClient(), ScrollBy(), Window, XLine, XPage, YLine, and YPage.

◆ BeginView()

void owl::TScroller::BeginView ( TDC & dc,
TRect & rect )
virtual

If TScroller_AutoOrg is true (default condition), BeginView automatically offsets the origin of the logical coordinates of the client area by XPos, YPos during a paint operation.

If AutoOrg is false (for example, when the scroller is larger than 32,767 units), you must set the offset manually.

Definition at line 169 of file scroller.cpp.

References AutoOrg, owl::TDC::SetViewportOrg(), XPos, XUnit, YPos, and YUnit.

◆ EnableScrollBar()

bool owl::TScroller::EnableScrollBar ( uint flags = SB_BOTH,
uint arrow = ESB_ENABLE_BOTH )
inlinevirtual

Reimplemented in owl::TFlatScroller.

Definition at line 166 of file scroller.h.

References owl::TWindow::EnableScrollBar(), and Window.

◆ EndView()

void owl::TScroller::EndView ( )
virtual

Updates the position of the owner window's scroll bars to be coordinated with the position of the TScroller.

Definition at line 186 of file scroller.cpp.

References GetScrollPos(), HasHScrollBar, HasVScrollBar, SetScrollPos(), Window, XPos, and YPos.

◆ GetScrollPage()

int owl::TScroller::GetScrollPage ( int bar) const
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 151 of file scroller.h.

References owl::TWindow::GetScrollPage(), and Window.

◆ GetScrollPos()

int owl::TScroller::GetScrollPos ( int bar) const
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 176 of file scroller.h.

References owl::TWindow::GetScrollPos(), and Window.

◆ GetScrollRange()

void owl::TScroller::GetScrollRange ( int bar,
int & minPos,
int & maxPos ) const
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 156 of file scroller.h.

References owl::TWindow::GetScrollRange(), and Window.

◆ GetScrollTrackPos()

int owl::TScroller::GetScrollTrackPos ( int bar) const
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 186 of file scroller.h.

References owl::TWindow::GetScrollTrackPos(), and Window.

◆ HScroll()

void owl::TScroller::HScroll ( uint scrollEvent,
int thumbPos )
virtual

Responds to the specified horizontal scrollEvent by calling ScrollBy or ScrollTo.

The type of scroll event is identified by the corresponding SB_ constants. The 16-bit thumbPos argument is ignored. The function retrieves the 32-bit value directly from the scroll bar instead.

Definition at line 260 of file scroller.cpp.

References GetScrollTrackPos(), HasHScrollBar, ScrollBy(), ScrollTo(), SetScrollPos(), TrackMode, Window, XLine, XPage, XRange, and YPos.

◆ IsAutoMode()

bool owl::TScroller::IsAutoMode ( )
virtual

IsAutoMode is true if automatic scrolling is activated.

Definition at line 348 of file scroller.cpp.

References AutoMode.

◆ IsVisibleRect()

bool owl::TScroller::IsVisibleRect ( long x,
long y,
int xExt,
int yExt )
inline

Returns a bool value indicating whether or not the passed area (in units) is currently visible.

Is true if the rectangle (x, y, xExt, and yExt) is visible.

Definition at line 140 of file scroller.h.

References XPage, XPos, YPage, and YPos.

◆ ScrollBy()

void owl::TScroller::ScrollBy ( long dx,
long dy )
inline

Scrolls to a position calculated using the passed delta values.

Scrolls to a position calculated using the passed delta values (dx and dy).

A positive delta position moves the thumb position down or right. A negative delta position moves the thumb up or left.

Definition at line 134 of file scroller.h.

References ScrollTo(), XPos, and YPos.

◆ ScrollTo()

void owl::TScroller::ScrollTo ( long x,
long y )
virtual

Scrolls the rectangle to the position specified in x and y after checking boundary conditions.

Causes a WM_PAINT message to be sent

First scrolls the contents of the client area, if a portion of the client area will remain visible

Definition at line 311 of file scroller.cpp.

References AutoOrg, owl::TWindow::GetHandle(), owl::TWindow::Invalidate(), PRECONDITION, owl::TWindow::ScrollWindow(), owl::TWindow::UpdateWindow(), Window, XPage, XPos, XRange, XUnit, YPage, YPos, YRange, and YUnit.

◆ SetPageSize()

void owl::TScroller::SetPageSize ( )
virtual

Sets the XPage and YPage data members (amount by which to scroll on a page scroll request) to the width and height (in XUnits and YUnits) of the owner window's client area.

Definition at line 65 of file scroller.cpp.

References owl::TWindow::GetClientRect(), owl::TWindow::GetHandle(), PRECONDITION, SetScrollPage(), Window, XPage, XRange, XTotalUnits, XUnit, YPage, YRange, YTotalUnits, and YUnit.

◆ SetRange()

void owl::TScroller::SetRange ( long xRange,
long yRange )
virtual

Sets the xRange and yRange of the TScroller to the parameters specified.

Then calls SetSBarRange to synchronize the range of the owner window's scroll bars.

Definition at line 101 of file scroller.cpp.

References ScrollTo(), SetSBarRange(), XPos, XRange, YPos, and YRange.

◆ SetSBarRange()

void owl::TScroller::SetSBarRange ( )
virtual

Sets the range of the owner window's scroll bars to match the range of the TScroller and repaints as necessary.

Definition at line 138 of file scroller.cpp.

References owl::TWindow::GetHandle(), GetScrollRange(), HasHScrollBar, HasVScrollBar, PRECONDITION, SetScrollRange(), Window, XRange, and YRange.

◆ SetScrollPage()

void owl::TScroller::SetScrollPage ( int bar,
int page,
bool redraw = true )
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 146 of file scroller.h.

References owl::TWindow::SetScrollPage(), and Window.

◆ SetScrollPos()

int owl::TScroller::SetScrollPos ( int bar,
int pos,
bool redraw = true )
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 181 of file scroller.h.

References owl::TWindow::SetScrollPos(), and Window.

◆ SetScrollRange()

void owl::TScroller::SetScrollRange ( int bar,
int minPos,
int maxPos,
bool redraw = true )
inlineprotectedvirtual

Reimplemented in owl::TFlatScroller.

Definition at line 161 of file scroller.h.

References owl::TWindow::SetScrollRange(), and Window.

◆ SetTotalRangeOfUnits()

void owl::TScroller::SetTotalRangeOfUnits ( long xTotalUnits,
long yTotalUnits )
virtual

Definition at line 113 of file scroller.cpp.

References ScrollTo(), SetSBarRange(), XPos, XTotalUnits, YPos, and YTotalUnits.

◆ SetUnits()

void owl::TScroller::SetUnits ( int xUnit,
int yUnit )
virtual

Sets the XUnit and YUnit data members to TheXUnit and TheYUnit, respectively.

Updates XPage and YPage by calling SetPageSize.

Definition at line 126 of file scroller.cpp.

References SetPageSize(), XUnit, and YUnit.

◆ SetWindow()

void owl::TScroller::SetWindow ( TWindow * win)
inlinevirtual

Sets the owning window to win.

Reimplemented in owl::TFlatScroller.

Definition at line 126 of file scroller.h.

References Window.

◆ ShowScrollBar()

void owl::TScroller::ShowScrollBar ( int code,
bool show = true )
inlinevirtual

Reimplemented in owl::TFlatScroller.

Definition at line 171 of file scroller.h.

References owl::TWindow::ShowScrollBar(), and Window.

◆ VScroll()

void owl::TScroller::VScroll ( uint scrollEvent,
int thumbPos )
virtual

Responds to the specified vertical scrollEvent by calling ScrollBy or ScrollTo.

The type of scroll event is identified by the corresponding SB_ constants. The 16-bit thumbPos argument is ignored. The function retrieves the 32-bit value directly from the scroll bar instead.

Definition at line 210 of file scroller.cpp.

References GetScrollTrackPos(), HasVScrollBar, ScrollBy(), ScrollTo(), SetScrollPos(), TrackMode, Window, XPos, YLine, YPage, and YRange.

Member Data Documentation

◆ AutoMode

bool owl::TScroller::AutoMode

Is true if automatic scrolling is activated.

Definition at line 106 of file scroller.h.

◆ AutoOrg

bool owl::TScroller::AutoOrg

Is true if scroller offsets origin.

Definition at line 108 of file scroller.h.

◆ HasHScrollBar

bool owl::TScroller::HasHScrollBar

Is true if scroller has horizontal scroll.

Definition at line 109 of file scroller.h.

◆ HasVScrollBar

bool owl::TScroller::HasVScrollBar

Is true if scroller has vertical scroll.

Definition at line 110 of file scroller.h.

◆ TrackMode

bool owl::TScroller::TrackMode

Is true if track scrolling is activated.

Definition at line 107 of file scroller.h.

◆ Window

TWindow* owl::TScroller::Window

Points to the window whose client area scroller is to be managed.

Definition at line 91 of file scroller.h.

◆ XLine

int owl::TScroller::XLine

Specifies the number of logical device units per line to scroll the rectangle in the horizontal (X) direction.

Definition at line 102 of file scroller.h.

◆ XPage

int owl::TScroller::XPage

Specifies the number of logical device units per page to scroll the rectangle in the horizontal (X) direction.

Definition at line 104 of file scroller.h.

◆ XPos

long owl::TScroller::XPos

Specifies the current position of the rectangle in horizontal scroll units.

Definition at line 92 of file scroller.h.

◆ XRange

long owl::TScroller::XRange

Specifies the number of horizontal scroll units.

Definition at line 94 of file scroller.h.

◆ XTotalUnits

long owl::TScroller::XTotalUnits

Total number of horizontal scroll units.

Definition at line 96 of file scroller.h.

◆ XUnit

int owl::TScroller::XUnit

Specifies the amount (in logical device units) to scroll the rectangle in the horizontal (X) direction.

The rectangle is scrolled right if XUnit is positive and left if XUnit is negative.

Definition at line 98 of file scroller.h.

◆ YLine

int owl::TScroller::YLine

Specifies the number of logical device units per line to scroll the rectangle in the vertical (Y) direction.

Definition at line 103 of file scroller.h.

◆ YPage

int owl::TScroller::YPage

Specifies the number of logical device units per page to scroll the rectangle in the vertical (Y) direction.

Definition at line 105 of file scroller.h.

◆ YPos

long owl::TScroller::YPos

Specifies the current position of the rectangle in vertical scroll units.

Definition at line 93 of file scroller.h.

◆ YRange

long owl::TScroller::YRange

Specifies the number of vertical scroll units.

Definition at line 95 of file scroller.h.

◆ YTotalUnits

long owl::TScroller::YTotalUnits

Total number of vertical scroll units.

Definition at line 97 of file scroller.h.

◆ YUnit

int owl::TScroller::YUnit

Specifies the amount (in logical device units) to scroll the rectangle in the vertical (Y) direction.

The rectangle is scrolled down if YUnit is positive and up if YUnit is negative.

Definition at line 100 of file scroller.h.


The documentation for this class was generated from the following files: