Package voltage.core

# Class VoltageButton

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageButton

Direct Known Subclasses:
  `VoltageToggle`

public class VoltageButton extends VoltageComponent
Your standard button class.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `VoltageButton.ButtonState`
  The four button states.
  `static enum`
  `VoltageButton.Justification`
  Justification flags for the optional text on a button.

- ## Field Summary

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

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageButton(String name, String displayName, VoltageModule module)`
  `VoltageButton(String name, String displayName, VoltageModule module, boolean bCallCreateButton)`
  `VoltageButton(String name, VoltageModule module)`
  `VoltageButton(String name, VoltageModule module, boolean bCallCreateButton)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `GetAutoRepeat()`
  Gets the auto repeat state.
  `String`
  `GetButtonStateImageOverlay(VoltageButton.ButtonState state)`
  Gets the image resource name for a button state.
  `String`
  `GetImageOverlay()`
  Gets the current image overlay.
  `Rectangle`
  `GetOverlayArea()`
  Gets the overlay bounds.
  `int`
  `GetOverlayFontSize()`
  Get the overlay font size
  `String`
  `GetOverlayText()`
  Get the button text
  `Color`
  `GetOverlayTextColor()`
  Get the text overlay color.
  `Color`
  `GetOverlayTextColor(VoltageButton.ButtonState state)`
  Get the text overlay color for a specific state.
  `String`
  `GetOverlayTextFont()`
  Get the overlay font name
  `VoltageButton.Justification`
  `GetOverlayTextJustification()`
  Get the overlay text justification.
  `boolean`
  `IsOverlayFontBold()`
  Is the overlay font bold?
  `boolean`
  `IsOverlayFontItalic()`
  Is the overlay font italic?
  `void`
  `SetAutoRepeat(boolean bRepeatFlag)`
  Sets the auto repeat for the button.
  `void`
  `SetButtonStateImageOverlay(String resourceName, VoltageButton.ButtonState state)`
  Sets the overlay for different button states.
  `void`
  `SetDragMode(boolean bDragMode)`
  Allows a button to be in drag mode.
  `void`
  `SetImageOverlay(String resourceName)`
  Set an image overlay for a button.
  `void`
  `SetOverlayArea(int x, int y, int w, int h)`
  Sets the bounds for the overlay.
  `void`
  `SetOverlayArea(Rectangle rect)`
  Sets the bounds for the overlay.
  `void`
  `SetOverlayStateTextColor(int r, int g, int b, int a, VoltageButton.ButtonState state)`
  Set the text color for the overlay and a specific button state.
  `void`
  `SetOverlayStateTextColor(Color zeColor, VoltageButton.ButtonState state)`
  Set the text color for the overlay and a specific button state.
  `void`
  `SetOverlayText(String buttonText)`
  Set the button text
  `void`
  `SetOverlayTextColor(int r, int g, int b, int a)`
  Set the color for the overlay text
  `void`
  `SetOverlayTextColor(Color zeColor)`
  Set the color for the overlay text
  `void`
  `SetOverlayTextFont(String typeFace, int fontSize, boolean bBold, boolean bItalic)`
  Sets the font for the text overlay
  `void`
  `SetOverlayTextJustification(VoltageButton.Justification justificationFlag)`
  Sets the justification for the overlay text.
  `void`
  `SetValue(double newValue, boolean bUpdateGUI)`
  Sets the button state.
  `void`
  `SetValueNoNotification(double newValue, boolean bUpdateGUI)`
  Sets the button state without sending a notification.
  `boolean`
  `ShowingOverlay()`
  Returns true if we are showing the overlay.
  `void`
  `ShowOverlay(boolean bShow)`
  Do we show the overlay? An overlay can be either text and or an image.

  ### 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, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

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

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

- ## Constructor Details

  - ### VoltageButton

    public VoltageButton(String name, String displayName, VoltageModule module)

  - ### VoltageButton

    public VoltageButton(String name, VoltageModule module)

  - ### VoltageButton

    public VoltageButton(String name, String displayName, VoltageModule module, boolean bCallCreateButton)

  - ### VoltageButton

    public VoltageButton(String name, VoltageModule module, boolean bCallCreateButton)

- ## Method Details

  - ### SetValue

    public void SetValue(double newValue, boolean bUpdateGUI)
    Sets the button state.
    Overrides:
      `SetValue` in class `VoltageComponent`
    Parameters:
      `newValue` - Use 1.0 to simulate a mouse down on the button. Use 0.0 to restore the button to a normal state.
      `bUpdateGUI` - A flag to optional change the gui as well.

  - ### SetValueNoNotification

    public void SetValueNoNotification(double newValue, boolean bUpdateGUI)
    Sets the button state without sending a notification.
    Overrides:
      `SetValueNoNotification` in class `VoltageComponent`
    Parameters:
      `newValue` - Use 1.0 to simulate a mouse down on the button. Use 0.0 to restore the button to a normal state.
      `bUpdateGUI` - A flag to optional change the gui as well.

  - ### ShowOverlay

    public void ShowOverlay(boolean bShow)
    Do we show the overlay? An overlay can be either text and or an image.
    Parameters:
      `bShow` - set to true to show the overlay.

  - ### ShowingOverlay

    public boolean ShowingOverlay()
    Returns true if we are showing the overlay.
    Returns:
      true if showing the overlay.

  - ### SetImageOverlay

    public void SetImageOverlay(String resourceName)
    Set an image overlay for a button. The image will be displayed for all button states.
    Parameters:
      `resourceName` - the resource name of an image.

  - ### GetImageOverlay

    public String GetImageOverlay()
    Gets the current image overlay.
    Returns:
      the name of the overlay image.

  - ### SetButtonStateImageOverlay

    public void SetButtonStateImageOverlay(String resourceName, VoltageButton.ButtonState state)
    Sets the overlay for different button states.
    Parameters:
      `resourceName` - is the name of the image to use.
      `state` - is the button state to set the image for.

  - ### GetButtonStateImageOverlay

    public String GetButtonStateImageOverlay(VoltageButton.ButtonState state)
    Gets the image resource name for a button state.
    Parameters:
      `state` - the button state.
    Returns:
      the name of the button state image overlay.

  - ### SetOverlayTextColor

    public void SetOverlayTextColor(Color zeColor)
    Set the color for the overlay text
    Parameters:
      `zeColor` - the text color.

  - ### SetOverlayTextColor

    public void SetOverlayTextColor(int r, int g, int b, int a)
    Set the color for the overlay text
    Parameters:
      `r` - red (0-255)
      `g` - green (0-255)
      `b` - blue (0-255)
      `a` - alpha (0-255)

  - ### GetOverlayTextColor

    public Color GetOverlayTextColor()
    Get the text overlay color.
    Returns:
      the color of the text overlay.

  - ### SetOverlayStateTextColor

    public void SetOverlayStateTextColor(Color zeColor, VoltageButton.ButtonState state)
    Set the text color for the overlay and a specific button state.
    Parameters:
      `zeColor` - the color to set
      `state` - the state of the button.

  - ### SetOverlayStateTextColor

    public void SetOverlayStateTextColor(int r, int g, int b, int a, VoltageButton.ButtonState state)
    Set the text color for the overlay and a specific button state.
    Parameters:
      `r` - red (0-255)
      `g` - green (0-255)
      `b` - blue (0-255)
      `a` - alpha (0-255)
      `state` - the state of the button.

  - ### GetOverlayTextColor

    public Color GetOverlayTextColor(VoltageButton.ButtonState state)
    Get the text overlay color for a specific state.
    Parameters:
      `state` - the button state.
    Returns:
      the color of the text overlay.

  - ### SetAutoRepeat

    public void SetAutoRepeat(boolean bRepeatFlag)
    Sets the auto repeat for the button.
    Parameters:
      `bRepeatFlag` - set to true for auto repeat.

  - ### GetAutoRepeat

    public boolean GetAutoRepeat()
    Gets the auto repeat state.
    Returns:
      true if auto repeat is on.

  - ### SetOverlayText

    public void SetOverlayText(String buttonText)
    Set the button text
    Parameters:
      `buttonText` - the text to set for the button.

  - ### GetOverlayText

    public String GetOverlayText()
    Get the button text
    Returns:
      the button text.

  - ### SetOverlayArea

    public void SetOverlayArea(Rectangle rect)
    Sets the bounds for the overlay.
    Parameters:
      `rect` - the size and position of the overlay relative to the button.

  - ### GetOverlayArea

    public Rectangle GetOverlayArea()
    Gets the overlay bounds.
    Returns:
      the bounds of the overlay rectangle.

  - ### SetOverlayArea

    public void SetOverlayArea(int x, int y, int w, int h)
    Sets the bounds for the overlay.
    Parameters:
      `x` - the left margin relative to the button.
      `y` - the top margin relative to the button.
      `w` - the width of the overlay.
      `h` - the height of the overlay.

  - ### SetOverlayTextFont

    public void SetOverlayTextFont(String typeFace, int fontSize, boolean bBold, boolean bItalic)
    Sets the font for the text overlay
    Parameters:
      `typeFace` - the name of the font.
      `fontSize` - the size of the font.
      `bBold` - true if its a bold font.
      `bItalic` - true if its italic.

  - ### IsOverlayFontBold

    public boolean IsOverlayFontBold()
    Is the overlay font bold?
    Returns:
      true if bold.

  - ### IsOverlayFontItalic

    public boolean IsOverlayFontItalic()
    Is the overlay font italic?
    Returns:
      true if italic.

  - ### GetOverlayFontSize

    public int GetOverlayFontSize()
    Get the overlay font size
    Returns:
      size of the font.

  - ### GetOverlayTextFont

    public String GetOverlayTextFont()
    Get the overlay font name
    Returns:
      name of the font.

  - ### SetOverlayTextJustification

    public void SetOverlayTextJustification(VoltageButton.Justification justificationFlag)
    Sets the justification for the overlay text.
    Parameters:
      `justificationFlag` - the justification for the overlay text.

  - ### GetOverlayTextJustification

    public VoltageButton.Justification GetOverlayTextJustification()
    Get the overlay text justification.
    Returns:
      the justification of the overlay text.

  - ### SetDragMode

    public void SetDragMode(boolean bDragMode)
    Allows a button to be in drag mode. Drag mode is used in the Eight Step Sequencer. It allows you to click down on a button and drag over other buttons in the same group.
    Parameters:
      `bDragMode` - set to true to enable drag mode.