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

Run menu sessions on a plugin's PanoramaMenuLayout. More...

#include <PanoramaMenu.hpp>

+ Inheritance diagram for VoltMod::PanoramaMenu:

Classes

struct  Services
 

Public Member Functions

 PanoramaMenu (const Services &services, PanoramaMenuLayout &layout)
 
bool CanShow (int slot) const
 
bool OpenSession (int slot, std::shared_ptr< Menu > menu, MenuOptions options) override
 
void Open (int slot, std::shared_ptr< Menu > menu) override
 
bool IsOpen (int slot) const override
 
void Close (int slot) override
 
void CloseAll (int slot) override
 
void CloseAll (int slot, std::string_view replyKey) override
 
void Prompt (int slot, std::string prompt, std::function< bool(int slot, std::string_view text)> callback) override
 
std::string Translate (int slot, std::string_view key, std::string_view fallback) const override
 
- Public Member Functions inherited from VoltMod::MenuSurface
virtual ~MenuSurface ()=default
 
 MenuSurface (const MenuSurface &)=delete
 
MenuSurface & operator= (const MenuSurface &)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from VoltMod::MenuSurface
 MenuSurface ()=default
 

Detailed Description

Run menu sessions on a plugin's PanoramaMenuLayout.

Uses the same MenuStack behavior as CenterHtmlMenu. Root submenus become sidebar tabs. Pass the menu to runtime.Menus.Prefer when Panorama should be the preferred surface.

Definition at line 33 of file PanoramaMenu.hpp.

Constructor & Destructor Documentation

◆ PanoramaMenu()

VoltMod::PanoramaMenu::PanoramaMenu ( const Services &  services,
PanoramaMenuLayout &  layout 
)

Member Function Documentation

◆ CanShow()

bool VoltMod::PanoramaMenu::CanShow ( int  slot) const

◆ Close()

void VoltMod::PanoramaMenu::Close ( int  slot)
overridevirtual

◆ CloseAll() [1/2]

void VoltMod::PanoramaMenu::CloseAll ( int  slot)
overridevirtual

Clears the stack and removes the menu from the player's screen.

Implements VoltMod::MenuSurface.

Definition at line 97 of file PanoramaMenu.cpp.

References VoltMod::MenuStack::Clear(), IsOpen(), and VoltMod::ReadFile().

Referenced by CloseAll(), and OpenSession().

◆ CloseAll() [2/2]

void VoltMod::PanoramaMenu::CloseAll ( int  slot,
std::string_view  replyKey 
)
overridevirtual

◆ IsOpen()

bool VoltMod::PanoramaMenu::IsOpen ( int  slot) const
overridevirtual

Implements VoltMod::MenuSurface.

Definition at line 69 of file PanoramaMenu.cpp.

References VoltMod::MenuStack::IsOpen(), and VoltMod::ReadFile().

Referenced by Close(), CloseAll(), Open(), and OpenSession().

◆ Open()

void VoltMod::PanoramaMenu::Open ( int  slot,
std::shared_ptr< Menu >  menu 
)
overridevirtual

Pushes menu onto slot's session and shows it, starting one with default options when none is open. What a row calls.

Implements VoltMod::MenuSurface.

Definition at line 52 of file PanoramaMenu.cpp.

References VoltMod::Draw, IsOpen(), OpenSession(), VoltMod::MenuStack::Push(), and VoltMod::ReadFile().

◆ OpenSession()

bool VoltMod::PanoramaMenu::OpenSession ( int  slot,
std::shared_ptr< Menu >  menu,
MenuOptions  options 
)
overridevirtual

Opens a session for slot showing menu, closing any the player has open here. What a command calls. False when this surface cannot draw for slot; nothing is left open then.

Implements VoltMod::MenuSurface.

Definition at line 29 of file PanoramaMenu.cpp.

References CanShow(), CloseAll(), VoltMod::Draw, VoltMod::PanoramaMenu::Services::Freeze, IsOpen(), VoltMod::MenuFreeze::Open(), VoltMod::MenuStack::Push(), and VoltMod::ReadFile().

Referenced by Open().

◆ Prompt()

void VoltMod::PanoramaMenu::Prompt ( int  slot,
std::string  prompt,
std::function< bool(int slot, std::string_view text)>  callback 
)
overridevirtual

Routes the next chat line to callback. Closing the menu cancels it.

Implements VoltMod::MenuSurface.

Definition at line 119 of file PanoramaMenu.cpp.

References VoltMod::ChatInput::BeginCapture(), VoltMod::PanoramaMenu::Services::ChatInput, and VoltMod::ReadFile().

◆ Translate()

std::string VoltMod::PanoramaMenu::Translate ( int  slot,
std::string_view  key,
std::string_view  fallback 
) const
overridevirtual

Translates key for slot, using fallback when missing.

Implements VoltMod::MenuSurface.

Definition at line 125 of file PanoramaMenu.cpp.

References VoltMod::Translations::GetOr(), VoltMod::ReadFile(), and VoltMod::PanoramaMenu::Services::Translations.


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