Class GUI

Core class for the canvasGUI library

Use an instance of GUI (the controller) to control all aspects of your gui.

  • Create the UI controls e.g. buttons, sliders
  • Provides 7 color schemes for the controls

Hierarchy

  • GUI

Properties

_announced: boolean = false
_guis: Map<any, any> = ...

Methods

  • Returns void

  • Returns void

  • Returns void

  • Parameters

    • e: FocusEvent

    Returns void

  • Returns void

  • Returns void

  • Adds a child control to this one.

    Returns

    the control just added

    Parameters

    • control: any

      the child control to add

    Returns any

  • Adds a new color scheme to those already available. It does not replace an existing scheme.

    Returns

    this gui instance

    Parameters

    • schemename: string

      the name of the color schmem

    • scheme: __Scheme

      the color scheme

    Returns GUI

  • Create a button control

    Returns

    a button

    Parameters

    • name: string

      unique name for this control

    • Optional x: number

      left-hand pixel position

    • Optional y: number

      top pixel position

    • Optional w: number

      width

    • Optional h: number

      height

    Returns any

  • Get the height of the HTML canvas tag

    Returns

    the height of the canvas

    Returns any

  • Get the width of the HTML canvas tag

    Returns

    the width of the canvas

    Returns any

  • Create a checkbox control

    Returns

    a checkbox

    Parameters

    • name: string

      unique name for this control

    • x: number

      left-hand pixel position

    • y: number

      top pixel position

    • w: number

      width

    • h: number

      height

    Returns any

  • Set or get the corner radii used for the controls

    Returns

    an array with the 4 corner radii

    Parameters

    • Optional c: number[]

      an array of 4 corner radii

    Returns number[]

  • Disable mouse/key event handling for this gui

    Returns

    this gui

    Since

    0.9.3

    Returns GUI

  • Enable mouse/key event handling for this gui

    Returns

    this gui

    Since

    0.9.3

    Returns GUI

  • Do not render any controls for this gui

    Returns

    this gui

    Since

    0.9.3

    Returns GUI

  • Hide all side panes. This will also close any pane that is open.
    Replaces hideAll

    Since

    0.9.3

    Returns void

  • Is this a 3D renderer?

    Returns

    true for WEBGL and false for P2D

    Returns boolean

  • Returns

    true if this gui can respond to mouse/key events

    Since

    0.9.3

    Returns boolean

  • Returns

    true if gui rendering is allowed

    Returns

    this gui

    Since

    0.9.3

    Returns boolean

  • Create a label control

    Returns

    a label

    Parameters

    • name: string

      unique name for this control

    • x: number

      left-hand pixel position

    • y: number

      top pixel position

    • w: number

      width

    • h: number

      height

    Returns any

  • Returns the name of this GUI. If the GUI is not named then the returned value is undefined.

    Returns

    the name of this gui or undefined

    Returns string

  • Create an option (radio button) control

    Returns

    an option button

    Parameters

    • name: string
    • x: number

      left-hand pixel position

    • y: number

      top pixel position

    • w: number

      width

    • h: number

      height

    Returns any

  • Create a side pane. The pane location is either 'north', 'south', 'east' or 'west'.

    The pane will fill the whole width/height of the canvas depending on its position. The user controls how far the pane extends into the canvas when open.

    Returns

    a side pane

    Parameters

    • name: string

      unique name for this control

    • location: string

      the pane position ('north', 'south', 'east' or 'west')

    • depth: number

      the maximum depth the pane expands into the canvas

    Returns CvsPane

  • Create a ranger control

    Returns

    ranger control

    Parameters

    • name: string

      unique name for this control

    • x: number

      left-hand pixel position

    • y: number

      top pixel position

    • w: number

      width

    • h: number

      height

    Returns any

  • Set or get an existing global color scheme.

    Returns

    this gui instance

    Parameters

    • Optional schemename: string

      color scheme to set

    Returns GUI | __Scheme

  • Render any controls for this gui

    Returns

    this gui

    Since

    0.9.3

    Returns GUI

  • Show all pane tabs. All panes will be shown closed. Replaces showAll

    Since

    0.9.3

    Returns void

  • Create a slider control

    Returns

    slider control

    Parameters

    • name: string

      unique name for this control

    • x: number

      left-hand pixel position

    • y: number

      top pixel position

    • w: number

      width

    • h: number

      height

    Returns any

  • Start handling mouse and key events

    Since

    0.9.4

    Returns void

  • Stop handling mouse and key events

    Since

    0.9.4

    Returns void

  • Sets or gets the global text size.

    If no parameter is passed then the global text size is returned otherwise it returns this control.

    Returns

    the global text size or this control

    Parameters

    • Optional gts: number

      new global text size

    Returns number | GUI

  • Create a single line text input control

    Returns

    a textfield

    Parameters

    • name: string

      unique name for this control

    • Optional x: number

      left-hand pixel position

    • Optional y: number

      top pixel position

    • Optional w: number

      width

    • Optional h: number

      height

    Returns any

  • Sets or gets the global tip text size. If no parameter is passed then the global tip text size is returned otherwise it returns this control

    Returns

    the global tip text size or this control

    Parameters

    • Optional gtts: number

      new global tip text size

    Returns number | GUI

  • Create a viewer

    Returns

    an image viewer

    Parameters

    • name: string

      unique name for this control

    • x: number

      left-hand pixel position

    • y: number

      top pixel position

    • w: number

      width

    • h: number

      height

    Returns any

  • Returns a previously created GUI controller for a given canvas or name.

    Returns

    a matching GUI controller or undefined if not found

    Parameters

    • key: any

      associated canvas or GUI name

    Returns any

  • Returns a GUI controller for a given canvas element.

    If a GUI has already been created for this canvas it will be returned, otherwise a new GUI will be created and returned

    A canvas can have more than one GUI associated with it but in that case each GUI must have a unique name.

    Returns

    a GUI controller

    Parameters

    • p5c: Renderer

      the renderer - the display canvas

    • p: p5 = p5.instance

      the processing instance (required in Instance mode)

    Returns any

  • Returns a named GUI controller.

    If an exisiting GUI has the same name it will be returned, otherwise a new GUI will be created and returned

    If the name parameter is not of type 'string' or an empty string then the returned value is undefined.

    Returns

    a GUI controller if valid name provided

    Parameters

    • name: any

      unique name for the GUI

    • p5c: Renderer

      the renderer - the display canvas

    • p: p5 = p5.instance

      the processing instance (required in Instance mode)

    Returns any

Generated using TypeDoc