Package voltage.core

# Class VoltageViewport

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageViewport

public class VoltageViewport extends VoltageComponent
A scrollable view. Add Voltage Components to this view. Jacks are not allowed inside this component.

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageViewport(String name, String displayName, VoltageModule module)`
  Construct a VoltageViewport
  `VoltageViewport(String name, VoltageModule module)`
  Construct a VoltageViewport

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `AddVoltageComponent(VoltageComponent child, int x, int y)`
  Add a child component at specified x and y.
  `boolean`
  `CanScrollHorizontally()`
  Is the view bigger horizontally than the viewport?
  `boolean`
  `CanScrollVertically()`
  Is the view bigger vertically than the viewport?
  `float`
  `GetHorizontalZoom()`
  Gets the horizontal zoom for the viewed items.
  `int`
  `GetScrollThickness()`
  Gets the scrollbar thickness
  `float`
  `GetVerticalZoom()`
  Gets the vertical zoom for the viewed items.
  `int`
  `GetViewedHeight()`
  Gets the height of the viewed area.
  `int`
  `GetViewedPositionX()`
  Gets the X offset in the view.
  `int`
  `GetViewedPositionY()`
  Gets the Y offset in the view.
  `int`
  `GetViewedWidth()`
  Gets the width of the viewed area.
  `VoltageComponent`
  `GetVoltageComponent(int index)`
  Gets a child component.
  `int`
  `NumVoltageComponents()`
  Returns the number of children components.
  `void`
  `RemoveVoltageComponent(VoltageComponent child)`
  Removes a child component from this viewport.
  `void`
  `SetBackgroundColor(int red, int green, int blue)`
  Sets the background color of the viewport.
  `void`
  `SetHorizontalZoom(float zoomAmount)`
  Sets a horizontal zoom for the viewed items.
  `void`
  `SetScrollBackColor(int red, int green, int blue)`
  Sets the background color of the scrollbars
  `void`
  `SetScrollSingleStep(int xPixels, int yPixels)`
  Sets the amount that a mouse click in the track will move a scrollbar
  `void`
  `SetScrollThickness(int pixels)`
  Sets the scrollbar thickness in pixels.
  `void`
  `SetScrollThumbColor(int red, int green, int blue)`
  Sets the background color of the scrollbar thumbs.
  `void`
  `SetScrollTrackColor(int red, int green, int blue)`
  Sets the background color of the scrollbar track area.
  `void`
  `SetShowScrollbarsIfNeeded(boolean bShowHorizontal, boolean bShowVertical)`
  Should the viewport use scrollbars?
  `void`
  `SetVerticalZoom(float zoomAmount)`
  Sets a vertical zoom for the viewed items.
  `void`
  `SetViewedPosition(int xPix, int yPix)`
  Sets the viewed position This will adjust scroll bars and scroll if necessary to the offset of the viewed area.
  `void`
  `SetViewedSize(int width, int height)`
  Sets the size of the viewed size.
  `void`
  `SetZoom(float zoomAmount)`
  Sets a zoom for the viewed items.

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTooltipText, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetRect, SetSize, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetValue, SetValueNoNotification, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### VoltageViewport

    public VoltageViewport(String name, String displayName, VoltageModule module)
    Construct a VoltageViewport
    Parameters:
      `name` - object name
      `displayName` - the display name to use.
      `module` - the module this is to go on.

  - ### VoltageViewport

    public VoltageViewport(String name, VoltageModule module)
    Construct a VoltageViewport
    Parameters:
      `name` - object name
      `module` - the module this is to go on.

- ## Method Details

  - ### AddVoltageComponent

    public boolean AddVoltageComponent(VoltageComponent child, int x, int y)
    Add a child component at specified x and y.
    Parameters:
      `child` - the child component.
      `x` - the x coordinate for the child relative to this viewport.
      `y` - the y coordinate for the child relative to this viewport.
    Returns:
      true if successful. Note that you cannot add jacks to viewport objects.

  - ### RemoveVoltageComponent

    public void RemoveVoltageComponent(VoltageComponent child)
    Removes a child component from this viewport.
    Parameters:
      `child` - the child component to remove.

  - ### NumVoltageComponents

    public int NumVoltageComponents()
    Returns the number of children components.
    Returns:
      the number of children.

  - ### GetVoltageComponent

    public VoltageComponent GetVoltageComponent(int index)
    Gets a child component.
    Parameters:
      `index` - the index of the child to get.
    Returns:
      the child component.

  - ### SetViewedSize

    public void SetViewedSize(int width, int height)
    Sets the size of the viewed size.
    Parameters:
      `width` - the width of the viewed area.
      `height` - the height of the viewed area.

  - ### GetViewedWidth

    public int GetViewedWidth()
    Gets the width of the viewed area.
    Returns:
      the width

  - ### GetViewedHeight

    public int GetViewedHeight()
    Gets the height of the viewed area.
    Returns:
      the height

  - ### SetViewedPosition

    public void SetViewedPosition(int xPix, int yPix)
    Sets the viewed position This will adjust scroll bars and scroll if necessary to the offset of the viewed area. If there are no scrollbars, this will not do anything.
    Parameters:
      `xPix` - the x coordinate
      `yPix` - the y coordinate

  - ### GetViewedPositionX

    public int GetViewedPositionX()
    Gets the X offset in the view.
    Returns:
      the x coordinate.

  - ### GetViewedPositionY

    public int GetViewedPositionY()
    Gets the Y offset in the view.
    Returns:
      the y coordinate.

  - ### SetShowScrollbarsIfNeeded

    public void SetShowScrollbarsIfNeeded(boolean bShowHorizontal, boolean bShowVertical)
    Should the viewport use scrollbars?
    Parameters:
      `bShowHorizontal` - set to true to use a horizontal scrollbar if necessary.
      `bShowVertical` - set to true to use a vertical scrollbar if necessary.

  - ### SetScrollThickness

    public void SetScrollThickness(int pixels)
    Sets the scrollbar thickness in pixels.
    Parameters:
      `pixels` - the thickness.

  - ### GetScrollThickness

    public int GetScrollThickness()
    Gets the scrollbar thickness
    Returns:
      the thickness in pixels.

  - ### CanScrollVertically

    public boolean CanScrollVertically()
    Is the view bigger vertically than the viewport?
    Returns:
      true if the user can scroll vertically.

  - ### CanScrollHorizontally

    public boolean CanScrollHorizontally()
    Is the view bigger horizontally than the viewport?
    Returns:
      true if the user can scroll horizontally.

  - ### SetScrollSingleStep

    public void SetScrollSingleStep(int xPixels, int yPixels)
    Sets the amount that a mouse click in the track will move a scrollbar
    Parameters:
      `xPixels` - the amount to move on track clicks on the horizontal scrollbar.
      `yPixels` - the amount to move on track clicks on the vertical scrollbar.

  - ### SetZoom

    public void SetZoom(float zoomAmount)
    Sets a zoom for the viewed items.
    Parameters:
      `zoomAmount` - 1.0 is normal. 2.0 would be 2 times bigger. 0.5 would be half size.

  - ### SetHorizontalZoom

    public void SetHorizontalZoom(float zoomAmount)
    Sets a horizontal zoom for the viewed items.
    Parameters:
      `zoomAmount` - 1.0 is normal. 2.0 would be 2 times bigger. 0.5 would be half size.

  - ### SetVerticalZoom

    public void SetVerticalZoom(float zoomAmount)
    Sets a vertical zoom for the viewed items.
    Parameters:
      `zoomAmount` - 1.0 is normal. 2.0 would be 2 times bigger. 0.5 would be half size.

  - ### GetHorizontalZoom

    public float GetHorizontalZoom()
    Gets the horizontal zoom for the viewed items.
    Returns:
      the zoomAmount 1.0 is normal. 2.0 would be 2 times bigger. 0.5 would be half size.

  - ### GetVerticalZoom

    public float GetVerticalZoom()
    Gets the vertical zoom for the viewed items.
    Returns:
      the zoomAmount 1.0 is normal. 2.0 would be 2 times bigger. 0.5 would be half size.

  - ### SetBackgroundColor

    public void SetBackgroundColor(int red, int green, int blue)
    Sets the background color of the viewport.
    Parameters:
      `red` - (0-255)
      `green` - (0-255)
      `blue` - (0-255)

  - ### SetScrollBackColor

    public void SetScrollBackColor(int red, int green, int blue)
    Sets the background color of the scrollbars
    Parameters:
      `red` - (0-255)
      `green` - (0-255)
      `blue` - (0-255)

  - ### SetScrollTrackColor

    public void SetScrollTrackColor(int red, int green, int blue)
    Sets the background color of the scrollbar track area.
    Parameters:
      `red` - (0-255)
      `green` - (0-255)
      `blue` - (0-255)

  - ### SetScrollThumbColor

    public void SetScrollThumbColor(int red, int green, int blue)
    Sets the background color of the scrollbar thumbs.
    Parameters:
      `red` - (0-255)
      `green` - (0-255)
      `blue` - (0-255)