Skip to content

Cave Toolbar API

james edited this page Nov 4, 2017 · 1 revision

These methods are part of the cave JavaScript API, and allow you to interact with the toolbar along the bottom of the screen.

buttonType values:

Value Button
0 Exit
1 Back
2 Activity
3 Community
4 Notification
5 My Menu
7 Guide
99 Back key

Methods

toolbar_setVisible

  • Arguments:

    • {Boolean} visibility
  • Usage:

    Toggle toolbar visibility.

toolbar_setCallback

  • Arguments:

    • {Number} buttonType
    • {Function} callback
  • Usage:

    Attach a callback function that gets called whenever a specific toolbar button is pressed.

  • Example:

    // add a custom callback to the "My Menu" button (type 5)
    cave.toolbar_setCallback(5, function() {
         // do something...
    })

toolbar_setToolbarCallback

  • Arguments:

    • {Function} myMenuCallback
    • {Function} activityCallback
    • {Function} communityCallback
    • {Function} notificationCallback
  • Usage:

    Similar to toolbar_setCallback, only that it allows you to add callbacks to each toolbar button in one go.

toolbar_setNotificationCount

  • Arguments:

    • {Number} count
  • Usage:

    Set the current notification count

toolbar_setActiveButton

  • Arguments:

    • {Number} buttonType
  • Usage:

    Highlight a button - usually done in a button's own callback function to show that it has been activated.

toolbar_enableBackBtnFunc

  • Arguments:

    • {Boolean} enable
  • Usage:

    Toggle default back button behaviour from a boolean.

toolbar_setButtonType

  • Arguments:

    • {Number} buttonType
  • Usage:

    (untested) Appears to set the "corner button" type.

toolbar_getButtonType

  • Usage:

    (untested) Presumably get the corner button's current type.

toolbar_setMode(mode)

  • Arguments:

    • {Number} mode
  • Usage:

    (untested)

toolbar_setWideButtonMessage

  • Arguments:

    • {String} message
  • Usage:

    (untested)

toolbar_enableBackBtnKeyAnim

  • Arguments:

    • {Boolean} enable
  • Usage:

    (untested)

toolbar_executeBackBtnAnim

  • Usage:

    (untested)