Defines the cw.menu panel, the framework's main menu, with a button column that opens the menu tabs.

Rebuild creates the Close and Characters buttons and a cw.menuButton for each item collected by the MenuItemsAdd and MenuItemsDestroy hooks, keeping the tab panels in cw.menu.stored; OpenPanel fades between tabs. The MenuOpen Cable message opens, closes or creates the menu.

Summary

Methods

Shows a tab panel and fades it in, playing the click sound.
Fades a tab panel out and hides it, playing the rollover sound.
Init()client
Builds the main menu with its collapse bar, which shows or hides the button text when clicked, and builds the tab buttons.
Opens a tab panel, closing the open one first.
Draws the skin's panel background unless the theme's PreMainMenuPaint hook returns true.
Rebuilds the Close and Characters buttons and a button for each menu item.
Fades out the open tab and slides the menu back to its resting position.
Opens or closes the menu and the screen clicker.
Think()client
Keeps the menu full-screen, updates the menu size, runs the fade animations and highlights the open tab's button.
Toggles the Close, Characters and every tab button between showing and hiding their text.

Methods

PANEL:FadeIn(speed, panel, Callback)

client gamemodes/catwork/gamemode/core/derma/cl_menu.lua:332

Shows a tab panel and fades it in, playing the click sound.

When the panel is already visible or another fade in is running, it is made fully visible at once.

Parameters

  • speed Number Length of the fade in seconds
  • panel Panel The panel to fade in
  • Callback Function optional, defaults to nil Called once the panel is fully visible

PANEL:FadeOut(speed, panel, Callback)

client gamemodes/catwork/gamemode/core/derma/cl_menu.lua:295

Fades a tab panel out and hides it, playing the rollover sound.

When the panel is already transparent or another fade out is running, it is hidden at once.

Parameters

  • speed Number Length of the fade in seconds
  • panel Panel The panel to fade out
  • Callback Function optional, defaults to nil Called once the panel is hidden

Builds the main menu with its collapse bar, which shows or hides the button text when clicked, and builds the tab buttons.

Skipped when the theme's PreMainMenuInit hook returns true; PostMainMenuInit runs before the buttons are built.

PANEL:OpenPanel(panelToOpen)

client gamemodes/catwork/gamemode/core/derma/cl_menu.lua:244

Opens a tab panel, closing the open one first.

The panel is sized to the menu width or to its GetMenuWidth method, placed on the right of the screen and faded in; its OnSelected method is called once it is visible. Skipped when the theme's PreMainMenuOpenPanel hook returns true; PostMainMenuOpenPanel runs afterwards.

Parameters

  • panelToOpen Panel The tab panel to open

Draws the skin's panel background unless the theme's PreMainMenuPaint hook returns true.

Parameters

  • w
  • h

Rebuilds the Close and Characters buttons and a button for each menu item.

Menu items are collected through the MenuItemsAdd and MenuItemsDestroy hooks, sorted by text and stored in cw.menu.stored. Tab panels are created once and reused, except in debug mode. A tab gets a button unless its IsButtonVisible method returns false. The open tab is closed when it no longer has a button. Skipped when the theme's PreMainMenuRebuild hook returns true; PostMainMenuRebuild runs afterwards.

Parameters

  • change Boolean optional, defaults to nil true to place the menu at once instead of sliding it in

PANEL:ReturnToMainMenu(bPerformCheck)

client gamemodes/catwork/gamemode/core/derma/cl_menu.lua:78

Fades out the open tab and slides the menu back to its resting position.

Parameters

  • bPerformCheck Boolean optional, defaults to nil true to only bring the open tab to the front, without closing it

Opens or closes the menu and the screen clicker.

Opening rebuilds the menu and runs the MenuOpened hook; closing runs MenuClosed.

Parameters

  • bIsOpen Boolean true to open the menu

Keeps the menu full-screen, updates the menu size, runs the fade animations and highlights the open tab's button.

Skipped when the theme's PreMainMenuThink hook returns true; PostMainMenuThink runs before the buttons are highlighted.

Toggles the Close, Characters and every tab button between showing and hiding their text.

Defined in