Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
GUIChatConsole Class Reference

#include <guiChatConsole.h>

+ Inheritance diagram for GUIChatConsole:
+ Collaboration diagram for GUIChatConsole:

Public Member Functions

 GUIChatConsole (gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, ChatBackend *backend, Client *client, IMenuManager *menumgr)
 
virtual ~GUIChatConsole ()
 
void openConsole (f32 scale)
 
bool isOpen () const
 
bool isOpenInhibited () const
 
void closeConsole ()
 
void closeConsoleAtOnce ()
 
void setCloseOnEnter (bool close)
 
void replaceAndAddToHistory (const std::wstring &line)
 
void setCursor (bool visible, bool blinking=false, f32 blink_speed=1.0, f32 relative_height=1.0)
 
virtual void draw ()
 
virtual bool OnEvent (const SEvent &event)
 
virtual void setVisible (bool visible)
 
virtual bool acceptsIME ()
 

Private Member Functions

void reformatConsole ()
 
void recalculateConsolePosition ()
 
void animate (u32 msec)
 
void drawBackground ()
 
void drawText ()
 
void drawPrompt ()
 
bool weblinkClick (s32 col, s32 row)
 
void updatePrimarySelection ()
 

Private Attributes

ChatBackendm_chat_backend
 
Clientm_client
 
IMenuManagerm_menumgr
 
v2u32 m_screensize
 
u64 m_animate_time_old
 
bool m_open = false
 
bool m_close_on_enter = false
 
s32 m_height = 0
 
f32 m_desired_height = 0.0f
 
f32 m_desired_height_fraction = 0.0f
 
f32 m_height_speed = 5.0f
 
u32 m_open_inhibited = 0
 
u32 m_cursor_blink = 0
 
f32 m_cursor_blink_speed = 0.0f
 
f32 m_cursor_height = 0.0f
 
video::ITexture * m_background = nullptr
 
video::SColor m_background_color = video::SColor(255, 0, 0, 0)
 
gui::IGUIFont * m_font = nullptr
 
v2u32 m_fontsize
 
bool m_cache_clickable_chat_weblinks
 
bool m_is_ctrl_down
 

Constructor & Destructor Documentation

◆ GUIChatConsole()

GUIChatConsole::GUIChatConsole ( gui::IGUIEnvironment * env,
gui::IGUIElement * parent,
s32 id,
ChatBackend * backend,
Client * client,
IMenuManager * menumgr )

◆ ~GUIChatConsole()

GUIChatConsole::~GUIChatConsole ( )
virtual

References m_font.

Member Function Documentation

◆ acceptsIME()

virtual bool GUIChatConsole::acceptsIME ( )
inlinevirtual

◆ animate()

void GUIChatConsole::animate ( u32 msec)
private

References m_cursor_blink, m_cursor_blink_speed, m_desired_height, m_height, m_height_speed, m_open, m_open_inhibited, m_screensize, and recalculateConsolePosition().

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeConsole()

void GUIChatConsole::closeConsole ( )

References IMenuManager::deletingMenu(), m_menumgr, and m_open.

Referenced by closeConsoleAtOnce(), and OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeConsoleAtOnce()

void GUIChatConsole::closeConsoleAtOnce ( )

References closeConsole(), m_height, and recalculateConsolePosition().

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw()

void GUIChatConsole::draw ( )
virtual

References animate(), drawBackground(), drawPrompt(), drawText(), porting::getTimeMs(), m_animate_time_old, m_desired_height, m_desired_height_fraction, m_height, m_screensize, and reformatConsole().

+ Here is the call graph for this function:

◆ drawBackground()

void GUIChatConsole::drawBackground ( )
private

References m_background, m_background_color, m_height, and m_screensize.

Referenced by draw().

+ Here is the caller graph for this function:

◆ drawPrompt()

void GUIChatConsole::drawPrompt ( )
private

References ChatBackend::getConsoleBuffer(), ChatPrompt::getCursorLength(), ChatBackend::getPrompt(), ChatBuffer::getRows(), ChatPrompt::getVisibleCursorPosition(), ChatPrompt::getVisiblePortion(), m_chat_backend, m_cursor_blink, m_cursor_height, m_desired_height, m_font, m_fontsize, m_height, and MYMAX.

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawText()

void GUIChatConsole::drawText ( )
private

References irr::gui::CGUITTFont::draw(), ChatBackend::getConsoleBuffer(), ChatBuffer::getFormattedLine(), ChatBuffer::getRows(), m_chat_backend, m_desired_height, m_font, m_fontsize, and m_height.

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isOpen()

bool GUIChatConsole::isOpen ( ) const

References m_open.

◆ isOpenInhibited()

bool GUIChatConsole::isOpenInhibited ( ) const

References m_open_inhibited.

◆ OnEvent()

◆ openConsole()

void GUIChatConsole::openConsole ( f32 scale)

References IMenuManager::createdMenu(), porting::getTimeMs(), m_animate_time_old, m_desired_height, m_desired_height_fraction, m_menumgr, m_open, m_screensize, and reformatConsole().

+ Here is the call graph for this function:

◆ recalculateConsolePosition()

void GUIChatConsole::recalculateConsolePosition ( )
private

References m_height, and m_screensize.

Referenced by animate(), closeConsoleAtOnce(), reformatConsole(), and setVisible().

+ Here is the caller graph for this function:

◆ reformatConsole()

void GUIChatConsole::reformatConsole ( )
private

References m_chat_backend, m_desired_height, m_fontsize, m_screensize, recalculateConsolePosition(), and ChatBackend::reformat().

Referenced by draw(), and openConsole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replaceAndAddToHistory()

void GUIChatConsole::replaceAndAddToHistory ( const std::wstring & line)

References ChatPrompt::addToHistory(), ChatPrompt::getLine(), ChatBackend::getPrompt(), m_chat_backend, and ChatPrompt::replace().

+ Here is the call graph for this function:

◆ setCloseOnEnter()

void GUIChatConsole::setCloseOnEnter ( bool close)
inline

References m_close_on_enter.

◆ setCursor()

void GUIChatConsole::setCursor ( bool visible,
bool blinking = false,
f32 blink_speed = 1.0,
f32 relative_height = 1.0 )

References m_cursor_blink, m_cursor_blink_speed, and m_cursor_height.

Referenced by GUIChatConsole().

+ Here is the caller graph for this function:

◆ setVisible()

void GUIChatConsole::setVisible ( bool visible)
virtual

References m_height, m_open, and recalculateConsolePosition().

+ Here is the call graph for this function:

◆ updatePrimarySelection()

void GUIChatConsole::updatePrimarySelection ( )
private

References ChatBackend::getPrompt(), ChatPrompt::getSelection(), m_chat_backend, and wide_to_utf8().

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ weblinkClick()

bool GUIChatConsole::weblinkClick ( s32 col,
s32 row )
private

References ChatBackend::addUnparsedMessage(), ChatFormattedLine::fragments, ChatBackend::getConsoleBuffer(), ChatBuffer::getFormattedLine(), porting::getTimeMs(), m_chat_backend, porting::open_url(), and utf8_to_wide().

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_animate_time_old

u64 GUIChatConsole::m_animate_time_old
private

Referenced by draw(), and openConsole().

◆ m_background

video::ITexture* GUIChatConsole::m_background = nullptr
private

Referenced by GUIChatConsole(), and drawBackground().

◆ m_background_color

video::SColor GUIChatConsole::m_background_color = video::SColor(255, 0, 0, 0)
private

Referenced by GUIChatConsole(), and drawBackground().

◆ m_cache_clickable_chat_weblinks

bool GUIChatConsole::m_cache_clickable_chat_weblinks
private

Referenced by GUIChatConsole(), and OnEvent().

◆ m_chat_backend

◆ m_client

Client* GUIChatConsole::m_client
private

Referenced by OnEvent().

◆ m_close_on_enter

bool GUIChatConsole::m_close_on_enter = false
private

Referenced by OnEvent(), and setCloseOnEnter().

◆ m_cursor_blink

u32 GUIChatConsole::m_cursor_blink = 0
private

Referenced by animate(), drawPrompt(), and setCursor().

◆ m_cursor_blink_speed

f32 GUIChatConsole::m_cursor_blink_speed = 0.0f
private

Referenced by animate(), and setCursor().

◆ m_cursor_height

f32 GUIChatConsole::m_cursor_height = 0.0f
private

Referenced by drawPrompt(), and setCursor().

◆ m_desired_height

f32 GUIChatConsole::m_desired_height = 0.0f
private

◆ m_desired_height_fraction

f32 GUIChatConsole::m_desired_height_fraction = 0.0f
private

Referenced by draw(), and openConsole().

◆ m_font

gui::IGUIFont* GUIChatConsole::m_font = nullptr
private

◆ m_fontsize

v2u32 GUIChatConsole::m_fontsize
private

◆ m_height

◆ m_height_speed

f32 GUIChatConsole::m_height_speed = 5.0f
private

Referenced by animate().

◆ m_is_ctrl_down

bool GUIChatConsole::m_is_ctrl_down
private

Referenced by GUIChatConsole(), and OnEvent().

◆ m_menumgr

IMenuManager* GUIChatConsole::m_menumgr
private

Referenced by closeConsole(), and openConsole().

◆ m_open

bool GUIChatConsole::m_open = false
private

◆ m_open_inhibited

u32 GUIChatConsole::m_open_inhibited = 0
private

Referenced by animate(), isOpenInhibited(), and OnEvent().

◆ m_screensize

v2u32 GUIChatConsole::m_screensize
private

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