Model Railroad System  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OvalWidgets::OvalSrollBar Class Reference

Oval SrollBar. More...

Public Member Functions

 OvalSrollBar (name, _canvas,...)
 Constructor initialize and build an Oval Scrollbar. More...
 
 ~OvalSrollBar ()
 Destructor free up all resources. More...
 
 resize (newMin, newMax)
 Resize method. More...
 
 delta (deltaX, deltaY)
 Method to return a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in slider position. More...
 
 fraction (x, y)
 Method to return a real number between 0 and 1 indicating where the point given by x and y lies in the trough area of the scrollbar. More...
 
 get ()
 Method to return the scrollbar settings in the form of a list whose elements are the arguments to the most recent set widget command. More...
 
 identify (x, y)
 Method to return the name of the element under the point given by x and y (such as arrow1), or an empty string if the point does not lie in any element of the scrollbar. More...
 
 set (first, last)
 This method is invoked by the scrollbar’s associated widget to tell the scrollbar about the current view in the widget. More...
 

Private Member Functions

 _ConfigureXY (option, value)
 Method to configure an x or y coordinate. More...
 
 _ConfigureWL (option, value)
 Method to configure a width or length option. More...
 
 _MoveThumb (mx, my)
 Method bound to button1 motion move the thumb. More...
 
 _BaseRect (mx, my)
 Method bound to button 1 presses. More...
 
 _Command (...)
 Method used to invoke the command as the thumb is moved. More...
 

Private Attributes

 canvas
 Canvas the widget is on. More...
 
 _lastSet
 Holds the last scrollbar settings. More...
 

Detailed Description

Oval SrollBar.

Works just like a normal scrollbar widget.

Parameters
_canvasThe canvas to draw the widget on.
...Options:
  • -x The X coordinate (default 0).
  • -y The Y coordinate (default 0).
  • -width The width of the scrollbar (default 40).
  • -length The length of the scrollbar (default 100).
  • -background The background color (default white).
  • -foreground The background color (default black).
  • -orientation The orientation of the scrollbar, horizontal or vertical (readonly, default vertical).
  • -command The command of the scrollbar (default {}).
Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ OvalSrollBar()

OvalWidgets::OvalSrollBar::OvalSrollBar ( name  ,
_canvas  ,
  ... 
)

Constructor initialize and build an Oval Scrollbar.

Parameters
_canvasThe canvas to draw the scrollbar on.
...The option value list.

◆ ~OvalSrollBar()

OvalWidgets::OvalSrollBar::~OvalSrollBar ( )

Destructor free up all resources.

Member Function Documentation

◆ _BaseRect()

OvalWidgets::OvalSrollBar::_BaseRect ( mx  ,
my   
)
private

Method bound to button 1 presses.

Parameters
mxMouse X coordinate.
myMouse Y coordinate.

◆ _Command()

OvalWidgets::OvalSrollBar::_Command (   ...)
private

Method used to invoke the command as the thumb is moved.

Parameters
...passed to -command option.

◆ _ConfigureWL()

OvalWidgets::OvalSrollBar::_ConfigureWL ( option  ,
value   
)
private

Method to configure a width or length option.

Parameters
optionThe name of the option to configure.
valueThe value of the option.

◆ _ConfigureXY()

OvalWidgets::OvalSrollBar::_ConfigureXY ( option  ,
value   
)
private

Method to configure an x or y coordinate.

Parameters
optionThe name of the option to configure.
valueThe value of the option.

◆ _MoveThumb()

OvalWidgets::OvalSrollBar::_MoveThumb ( mx  ,
my   
)
private

Method bound to button1 motion move the thumb.

Parameters
mxMouse X coordinate.
myMouse Y coordinate.

◆ delta()

OvalWidgets::OvalSrollBar::delta ( deltaX  ,
deltaY   
)

Method to return a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in slider position.

For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the slider deltaX pixels to the right (deltaY is ignored in this case). If the scrollbar is vertical, the result indicates how much the scrollbar setting must change to move the slider deltaY pixels down. The arguments and the result may be zero or negative.

Parameters
deltaXAmount of movement if scrollbar is horizontal.
deltaYAmount of movement if scrollbar is vertical.

◆ fraction()

OvalWidgets::OvalSrollBar::fraction ( ,
 
)

Method to return a real number between 0 and 1 indicating where the point given by x and y lies in the trough area of the scrollbar.

The value 0 corresponds to the top or left of the trough, the value 1 corresponds to the bottom or right, 0.5 corresponds to the middle, and so on. X and y must be pixel coordinates relative to the scrollbar widget. If x and y refer to a point outside the trough, the closest point in the trough is used.

Parameters
xThe X coordinate to check.
yThe Y coordinate to check.

◆ get()

OvalWidgets::OvalSrollBar::get ( )

Method to return the scrollbar settings in the form of a list whose elements are the arguments to the most recent set widget command.

◆ identify()

OvalWidgets::OvalSrollBar::identify ( ,
 
)

Method to return the name of the element under the point given by x and y (such as arrow1), or an empty string if the point does not lie in any element of the scrollbar.

X and y must be pixel coordinates relative to the scrollbar widget.

Parameters
xThe X coordinate to check.
yThe Y coordinate to check.

◆ resize()

OvalWidgets::OvalSrollBar::resize ( newMin  ,
newMax   
)

Resize method.

Method update the range of the scroll region.

Parameters
newMinnew minimum of the scroll region.
newMaxnew maximum of the scroll region.

◆ set()

OvalWidgets::OvalSrollBar::set ( first  ,
last   
)

This method is invoked by the scrollbar’s associated widget to tell the scrollbar about the current view in the widget.

The command takes two arguments, each of which is a real fraction between 0 and 1. The fractions describe the range of the document that is visible in the associated widget. For example, if first is 0.2 and last is 0.4, it means that the first part of the document
visible in the window is 20% of the way through the document, and the last visible part is 40% of the way through.

Parameters
firstFirst visible fraction.
lastLast visible fraction.

Member Data Documentation

◆ _lastSet

OvalWidgets::OvalSrollBar::_lastSet
private

Holds the last scrollbar settings.

◆ canvas

OvalWidgets::OvalSrollBar::canvas
private

Canvas the widget is on.