vegui. scrollbar. class.js

Summary
vegUI element type for VegUIScrollbar
extends VegUINode
Returns the size of the active scroll area in the scrolbar.
Builds the scrollbar
Similar to the VegUINode::disable_node method but makes sure all children will be disabled as well.
Move Btn3 to a new position and sync the content element’s position to it
Checks if scroll bar is an x axis or an y axis scroll bar
Links two VegUIElement as CHolder and Content.
Calculate content overflow ratio
Scrolls content into the specified direction
Sets the most common template properties for the scrollbar
Syncs the position and proportions of Btn3 to the Contenr overflow ratio of the CHolder and Content elements.
Toggles drag mode on or off.
Toggles auto scroll mode on or off.
Updates the BBox settings for the Content element that is linked to this scrollbar

Constants

VUI_SCOLL

vegUI element type for VegUIScrollbar

VegUIScrollbar

extends VegUINode

Inherits properties and functions from: VegUINode

VegUINode
|
|
+--> VegUIScrollbar

Type

<VUI_SCROLL>

Child Elements

These children are all accessable over this.[child_name]

Btn1VUI_BUTTON, Button to scroll up or left
Btn2VUI_BUTTON, Button to scroll up or right
Btn3VUU_BUTTON, Button that can be dragged to scroll
Summary
Returns the size of the active scroll area in the scrolbar.
Builds the scrollbar
Similar to the VegUINode::disable_node method but makes sure all children will be disabled as well.
Move Btn3 to a new position and sync the content element’s position to it
Checks if scroll bar is an x axis or an y axis scroll bar
Links two VegUIElement as CHolder and Content.
Calculate content overflow ratio
Scrolls content into the specified direction
Sets the most common template properties for the scrollbar
Syncs the position and proportions of Btn3 to the Contenr overflow ratio of the CHolder and Content elements.
Toggles drag mode on or off.
Toggles auto scroll mode on or off.
Updates the BBox settings for the Content element that is linked to this scrollbar

Properties

Object Properties

CHolderVegUIElement, the content holder element this scroll bar is linked to
ContentVegUIElement, the content element this scroll bar is linked to
scrollSpeedint, interval of timer when auto scroll is on
scrollStepint, pixels moved each scroll step
dirchar, direction type of the scrollbar, ‘y’ or ‘x’
scrollIntervalInterval, holds the interval object when auto scroll is on
bDragbool, is true if scrollbar is in drag mode
skipButtonAlignbool, if true buttons will not be aligned automatically on build_scroll

Template Properties

T.scrollSpeedscrollSpeed
T.scrollStepscrollStep
T.scrollDirdir
T.skipButtonAlignskipButtonAlign

Functions

asa

this.asa = function()

Returns the size of the active scroll area in the scrolbar.  The active scroll area is the are between Btn1 and Btn2.  If the scrollbar is of type ‘x’ then width is returned else height

Returns

intavtice scroll area size (pixels)

build_scroll

this.build = this.build_scroll = function(toNode)

Builds the scrollbar

Alias

build()

Parameters

<HTMLnode> toNodeif submitted the created HTML node will be appended to toNode

Returns

nullon failure
int1 on success

See also

VegUINode::build_node

disable_scroll

this.disable = this.disable_scroll = function(b)

Similar to the VegUINode::disable_node method but makes sure all children will be disabled as well.

Alias

disable()

Parameters

bool btrue (disable) false (enable)

See also

VegUINode::disable_node

drag

this.drag = function(x,
y)

Move Btn3 to a new position and sync the content element’s position to it

Parameters

int xnew x position of the Btn3
int ynew y position of the Btn3

See also

tgl_drag, scroll

is_x

this.is_x = function()

Checks if scroll bar is an x axis or an y axis scroll bar

Returns

booltrue if direction is x
boolfalse if direction is y

link

this.link = function(CHolder,
Content)

Links two VegUIElement as CHolder and Content.  The Content element should be a child of the CHolder element

Parameters

VegUIElement CHolderThe content holder element that holds the content to be scrolled
VegUIElement ContentThe element that holds the content

See also

sync

overflow

this.overflow = function()

Calculate content overflow ratio

Returns

intcontent overflow ration

scroll

this.scroll = function(dir,
rep)

Scrolls content into the specified direction

Parameters

bool dirfalse = up/left, true = down/right
<int rep>repeat scroll n times

See also

tgl_scroll, drag

set_scroll

this.set = this.set_scroll = function(dir,
x,
y,
w,
h)

Sets the most common template properties for the scrollbar

Alias

set()

Parameters

char dirdirection type of the scrollbar ‘x’ or ‘y’
int xx position of the scroll bar (pixels)
int yy position of the scroll bar (pixels)
int wwidth of the scroll bar (pixels)
int hheight of the scroll bar (pixels)

See also

VegUINode::set_node

sync

this.sync = function(b)

Syncs the position and proportions of Btn3 to the Contenr overflow ratio of the CHolder and Content elements.  Can also sync the position of the content element to the position of Btn3

Parameters

bool bif true content is sync’d to scroll bar, if false Btn3 is synced to content

See also

link

tgl_drag

this.tgl_drag = function(b)

Toggles drag mode on or off.  While in drag mode Btn3 will follow mouse movements

Parameters

bool btrue (on) false (off)

See also

drag, tgl_scroll

tgl_scroll

this.tgl_scroll = function(b,
dir)

Toggles auto scroll mode on or off.  If the scrollbar is in auto scroll mode then the content will be scrolled until it is either toggled off again or the content’s BBox bumped

Parameters

bool btrue (on) false (off)
bool dirfalse = up/left , true = down/right

See also

scroll

update_content_boundary

this.update_content_boundary = function()

Updates the BBox settings for the Content element that is linked to this scrollbar

extends VegUINode
this.asa = function()
Returns the size of the active scroll area in the scrolbar.
this.build = this.build_scroll = function(toNode)
Builds the scrollbar
this.disable = this.disable_scroll = function(b)
Similar to the VegUINode::disable_node method but makes sure all children will be disabled as well.
this.disable = this.disable_node = function(b)
Toggles the VUI_DISABLED flag on this element
this.drag = function(x,
y)
Move Btn3 to a new position and sync the content element’s position to it
this.is_x = function()
Checks if scroll bar is an x axis or an y axis scroll bar
this.link = function(CHolder,
Content)
Links two VegUIElement as CHolder and Content.
this.overflow = function()
Calculate content overflow ratio
this.scroll = function(dir,
rep)
Scrolls content into the specified direction
this.set = this.set_scroll = function(dir,
x,
y,
w,
h)
Sets the most common template properties for the scrollbar
this.sync = function(b)
Syncs the position and proportions of Btn3 to the Contenr overflow ratio of the CHolder and Content elements.
this.tgl_drag = function(b)
Toggles drag mode on or off.
this.tgl_scroll = function(b,
dir)
Toggles auto scroll mode on or off.
this.update_content_boundary = function()
Updates the BBox settings for the Content element that is linked to this scrollbar
The most basic VegUI Element.
int, interval of timer when auto scroll is on
int, pixels moved each scroll step
char, direction type of the scrollbar, ‘y’ or ‘x’
bool, if true buttons will not be aligned automatically on build_scroll
this.build = this.build_node = function(toNode,
takeNode)
build a HTML node from the template properties of this element.
this.set = this.set_node = function(nodeType,
w,
h,
x,
y,
pos,
z)
Template Function