A vertical list of panels (fl_sidebar) that scrolls without a visible scrollbar, drawn by the active theme's PaintSidebar hook. Fill it from top to bottom with add_button and add_panel, spaced with set_margin and add_space; Clear empties it again. Buttons added with add_button behave like tabs: the clicked one becomes active and the previously clicked one is deactivated. The main menu and the admin menu use it for their navigation. Derives from DScrollPanel.

Summary

Methods

Creates an fl_button as wide as the sidebar and adds it as the next item.
Adds a panel below the previously added item, followed by the configured margin.
Adds empty vertical space before the next item.
Centers every item horizontally within the sidebar.
Clear()client
Removes all items from the sidebar and resets the position of the next item to the top.
Init()client
Hides the scrollbar graphics and performs the initial layout.
Delegates drawing of the sidebar to the active theme's PaintSidebar hook.
Rebuilds the canvas and updates the scrollbar while keeping the canvas as wide as the sidebar itself.
Sets the vertical gap left after each item that is added from now on.

Methods

PANEL:add_button(text, callback)

client packages/active_ui/views/base/cl_sidebar.lua:83

Creates an fl_button as wide as the sidebar and adds it as the next item. Clicking it marks it as active and deactivates the previously clicked button.

Parameters

  • text String title of the button
  • callback Function optional, defaults to nil called with the button when it is clicked

Returns

  • Panel the created fl_button

PANEL:add_panel(panel, center)

client packages/active_ui/views/base/cl_sidebar.lua:64

Adds a panel below the previously added item, followed by the configured margin.

Parameters

  • panel Panel
  • center Boolean optional, defaults to false center the panel horizontally instead of keeping its x position

Adds empty vertical space before the next item.

Parameters

  • px Number height of the gap in pixels

Centers every item horizontally within the sidebar.

Removes all items from the sidebar and resets the position of the next item to the top.

Hides the scrollbar graphics and performs the initial layout.

PANEL:Paint(width, height)

client packages/active_ui/views/base/cl_sidebar.lua:29

Delegates drawing of the sidebar to the active theme's PaintSidebar hook.

Parameters

  • width Number panel width
  • height Number panel height

Rebuilds the canvas and updates the scrollbar while keeping the canvas as wide as the sidebar itself.

PANEL:set_margin(margin)

client packages/active_ui/views/base/cl_sidebar.lua:117

Sets the vertical gap left after each item that is added from now on.

Parameters

  • margin Number gap in pixels; values tonumber cannot convert become 0

Defined in