VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::PanoramaMenuLayout Class Reference

The screen built from the menu Panorama block, as PanoramaMenu draws on it. More...

#include <PanoramaMenuLayout.hpp>

Public Member Functions

 PanoramaMenuLayout (ScreenManager &screens, std::string_view screen, std::size_t tabs, std::size_t rows, std::span< const std::string_view > iconNames)
 
int RowCount () const
 
int TabCount () const
 
bool Show (int slot)
 
void Hide (int slot)
 
void SetHeader (int slot, const MenuHeader &header)
 
void SetSidebarVisible (int slot, bool visible)
 
void SetHomeVisible (int slot, bool visible)
 
void SetTab (int slot, int index, const MenuTab *tab)
 
void SetRow (int slot, int index, const MenuRow *row, std::string_view pendingHint)
 
void SetEmpty (int slot, std::string_view text)
 
void SetPager (int slot, std::string_view text)
 
void SetPrompt (int slot, std::string_view text, std::string_view hint)
 
void SetFooter (int slot, std::string_view back, std::string_view cancel)
 
std::optional< MenuButton > ButtonFor (std::string_view id) const
 
void AddText (std::string_view variable, std::function< std::string(int slot)> text)
 

Detailed Description

The screen built from the menu Panorama block, as PanoramaMenu draws on it.

Knows element ids and classes and nothing about menus; every call names the player it draws for. A null tab or row hides it, and so does empty text for the empty-list line, the pager and the prompt. screen is the layout name; tabs, rows and iconNames come from its generated header (Tabs.size(), Rows.size(), IconSetNames). Each player gets their own screen, so the menu survives death and spectating. screens and iconNames must outlive this; the generated header's array does.

Definition at line 66 of file PanoramaMenuLayout.hpp.

Constructor & Destructor Documentation

◆ PanoramaMenuLayout()

VoltMod::PanoramaMenuLayout::PanoramaMenuLayout ( ScreenManager &  screens,
std::string_view  screen,
std::size_t  tabs,
std::size_t  rows,
std::span< const std::string_view >  iconNames 
)

Definition at line 9 of file PanoramaMenuLayout.cpp.

References VoltMod::ReadFile().

Member Function Documentation

◆ AddText()

void VoltMod::PanoramaMenuLayout::AddText ( std::string_view  variable,
std::function< std::string(int slot)>  text 
)

Fills {s:<variable>} in markup the screen adds itself, such as its home panel. Written with every header, so it outlives a respawned screen.

Definition at line 176 of file PanoramaMenuLayout.cpp.

References VoltMod::ReadFile().

◆ ButtonFor()

std::optional< MenuButton > VoltMod::PanoramaMenuLayout::ButtonFor ( std::string_view  id) const

The button a pressed id names, or nothing for an id outside this screen.

Definition at line 181 of file PanoramaMenuLayout.cpp.

References VoltMod::Back, VoltMod::Cancel, VoltMod::Close, VoltMod::NextPage, VoltMod::PreviousPage, VoltMod::ReadFile(), VoltMod::Row, RowCount(), VoltMod::StepDown, VoltMod::StepUp, VoltMod::Tab, and TabCount().

◆ Hide()

void VoltMod::PanoramaMenuLayout::Hide ( int  slot)

◆ RowCount()

int VoltMod::PanoramaMenuLayout::RowCount ( ) const
inline

Rows on one page.

Definition at line 73 of file PanoramaMenuLayout.hpp.

Referenced by ButtonFor().

◆ SetEmpty()

void VoltMod::PanoramaMenuLayout::SetEmpty ( int  slot,
std::string_view  text 
)

◆ SetFooter()

void VoltMod::PanoramaMenuLayout::SetFooter ( int  slot,
std::string_view  back,
std::string_view  cancel 
)

An empty back hides the back button: the root has nothing to go back to.

Definition at line 168 of file PanoramaMenuLayout.cpp.

References VoltMod::PlayerScreens::For(), VoltMod::ReadFile(), and VoltMod::Screen::SetText().

◆ SetHeader()

void VoltMod::PanoramaMenuLayout::SetHeader ( int  slot,
const MenuHeader &  header 
)

◆ SetHomeVisible()

void VoltMod::PanoramaMenuLayout::SetHomeVisible ( int  slot,
bool  visible 
)

Show the home markup in the rows' place. A screen without any does nothing.

Definition at line 94 of file PanoramaMenuLayout.cpp.

References VoltMod::PlayerScreens::For(), VoltMod::ReadFile(), and VoltMod::Screen::SetClass().

◆ SetPager()

void VoltMod::PanoramaMenuLayout::SetPager ( int  slot,
std::string_view  text 
)

◆ SetPrompt()

void VoltMod::PanoramaMenuLayout::SetPrompt ( int  slot,
std::string_view  text,
std::string_view  hint 
)

◆ SetRow()

void VoltMod::PanoramaMenuLayout::SetRow ( int  slot,
int  index,
const MenuRow *  row,
std::string_view  pendingHint 
)

◆ SetSidebarVisible()

void VoltMod::PanoramaMenuLayout::SetSidebarVisible ( int  slot,
bool  visible 
)

◆ SetTab()

void VoltMod::PanoramaMenuLayout::SetTab ( int  slot,
int  index,
const MenuTab *  tab 
)

◆ Show()

bool VoltMod::PanoramaMenuLayout::Show ( int  slot)

Spawn if needed, unhide, and give the cursor. False when slot cannot be drawn to.

Definition at line 47 of file PanoramaMenuLayout.cpp.

References VoltMod::PlayerScreens::For(), VoltMod::ReadFile(), and VoltMod::Screen::SetHidden().

◆ TabCount()

int VoltMod::PanoramaMenuLayout::TabCount ( ) const
inline

Sidebar tabs, filled from the root menu's submenus.

Definition at line 76 of file PanoramaMenuLayout.hpp.

Referenced by ButtonFor().


The documentation for this class was generated from the following files: