Mana
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ChatTab Class Reference

A tab for the chat window. More...

#include <chattab.h>

Inheritance diagram for ChatTab:
Tab AutoCompleteLister EventListener ChannelTab TmwAthena::GuildTab TmwAthena::PartyTab WhisperTab

Public Member Functions

 ChatTab (const std::string &name)
 
 ~ChatTab () override
 
void chatLog (std::string line, Own own=BY_SERVER, bool ignoreRecord=false)
 Adds a line of text to our message list.
 
void chatLog (const std::string &nick, const std::string &msg)
 Adds the text to the message list.
 
void chatInput (const std::string &msg)
 Determines whether the message is a command or message, then sends the given message to the game server to be said, or to the command handler.
 
void scroll (int amount)
 Scrolls the chat window.
 
void clearText ()
 Clears the text from the tab.
 
virtual void showHelp ()
 Add any extra help text to the output.
 
virtual bool handleCommand (const std::string &type, const std::string &args)
 Handle special commands.
 
void getAutoCompleteList (std::vector< std::string > &names) const override
 
virtual void saveToLogFile (std::string &msg)
 
void event (Event::Channel channel, const Event &event) override
 
- Public Member Functions inherited from Tab
 Tab ()
 
void setCaption (const std::string &caption)
 Sets the caption of the tab.
 
void draw (gcn::Graphics *graphics) override
 Draw the tab.
 
void drawFrame (gcn::Graphics *graphics) override
 Draw the tab frame.
 
void setTabColor (const gcn::Color *color)
 Set the normal color fo the tab's text.
 
void setFlash (bool flash)
 Set tab flashing state.
 
- Public Member Functions inherited from AutoCompleteLister
virtual ~AutoCompleteLister ()=default
 
- Public Member Functions inherited from EventListener
virtual ~EventListener ()
 
void listen (Event::Channel channel)
 
void ignore (Event::Channel channel)
 

Protected Member Functions

void setCurrent () override
 
virtual void handleInput (const std::string &msg)
 
virtual void handleCommand (const std::string &msg)
 
virtual bool checkNotify (Own own) const
 Returns whether a notify sound may be played for the given type of message.
 
void updateTextFormat (int alpha)
 Adapts the text format to the current gui opacity, for better readability.
 

Protected Attributes

ScrollAreamScrollArea
 
BrowserBoxmTextOutput
 

Friends

class ChatWindow
 
class WhisperWindow
 

Detailed Description

A tab for the chat window.

This is special to ease chat handling.

Definition at line 35 of file chattab.h.

Constructor & Destructor Documentation

◆ ChatTab()

ChatTab::ChatTab ( const std::string &  name)

Definition at line 49 of file chattab.cpp.

◆ ~ChatTab()

ChatTab::~ChatTab ( )
override

Definition at line 72 of file chattab.cpp.

Member Function Documentation

◆ chatInput()

void ChatTab::chatInput ( const std::string &  msg)

Determines whether the message is a command or message, then sends the given message to the game server to be said, or to the command handler.

Parameters
msgThe message text which is to be sent.

Definition at line 259 of file chattab.cpp.

◆ chatLog() [1/2]

void ChatTab::chatLog ( const std::string &  nick,
const std::string &  msg 
)

Adds the text to the message list.

Parameters
msgThe message text which is to be sent.

Definition at line 252 of file chattab.cpp.

◆ chatLog() [2/2]

void ChatTab::chatLog ( std::string  line,
Own  own = BY_SERVER,
bool  ignoreRecord = false 
)

Adds a line of text to our message list.

Parameters:

Parameters
lineText message.
ownType of message (usually the owner-type).
ignoreRecordshould this not be recorded?

Definition at line 111 of file chattab.cpp.

◆ checkNotify()

bool ChatTab::checkNotify ( Own  own) const
protectedvirtual

Returns whether a notify sound may be played for the given type of message.

By default, only returns true for inline whispers.

Is never called for server-messages or when the window has focus and this is the current tab.

Reimplemented in WhisperTab.

Definition at line 327 of file chattab.cpp.

◆ clearText()

void ChatTab::clearText ( )

Clears the text from the tab.

Definition at line 312 of file chattab.cpp.

◆ event()

void ChatTab::event ( Event::Channel  channel,
const Event event 
)
overridevirtual

Implements EventListener.

Definition at line 100 of file chattab.cpp.

◆ getAutoCompleteList()

void ChatTab::getAutoCompleteList ( std::vector< std::string > &  names) const
overridevirtual

Reimplemented from AutoCompleteLister.

Reimplemented in TmwAthena::PartyTab, and TmwAthena::GuildTab.

Definition at line 332 of file chattab.cpp.

◆ handleCommand() [1/2]

void ChatTab::handleCommand ( const std::string &  msg)
protectedvirtual

Reimplemented in WhisperTab.

Definition at line 322 of file chattab.cpp.

◆ handleCommand() [2/2]

virtual bool ChatTab::handleCommand ( const std::string &  type,
const std::string &  args 
)
inlinevirtual

Handle special commands.

Allows a tab to handle commands it defines itself.

Returns
true if the command was handled false if the command was not handled

Reimplemented in ChannelTab, WhisperTab, TmwAthena::GuildTab, and TmwAthena::PartyTab.

Definition at line 94 of file chattab.h.

◆ handleInput()

void ChatTab::handleInput ( const std::string &  msg)
protectedvirtual

Reimplemented in ChannelTab, WhisperTab, TmwAthena::GuildTab, and TmwAthena::PartyTab.

Definition at line 317 of file chattab.cpp.

◆ saveToLogFile()

void ChatTab::saveToLogFile ( std::string &  msg)
virtual

Reimplemented in WhisperTab, TmwAthena::GuildTab, and TmwAthena::PartyTab.

Definition at line 337 of file chattab.cpp.

◆ scroll()

void ChatTab::scroll ( int  amount)

Scrolls the chat window.

Parameters
amountdirection and amount to scroll. Negative numbers scroll up, positive numbers scroll down. The absolute amount indicates the amount of 1/8ths of chat window real estate that should be scrolled.

Definition at line 303 of file chattab.cpp.

◆ setCurrent()

void ChatTab::setCurrent ( )
inlineoverrideprotectedvirtual

Reimplemented from Tab.

Definition at line 109 of file chattab.h.

◆ showHelp()

virtual void ChatTab::showHelp ( )
inlinevirtual

Add any extra help text to the output.

Allows tabs to define help for commands defined by the tab itself.

Reimplemented in ChannelTab, WhisperTab, TmwAthena::GuildTab, and TmwAthena::PartyTab.

Definition at line 85 of file chattab.h.

◆ updateTextFormat()

void ChatTab::updateTextFormat ( int  alpha)
protected

Adapts the text format to the current gui opacity, for better readability.

Definition at line 81 of file chattab.cpp.

Friends And Related Symbol Documentation

◆ ChatWindow

friend class ChatWindow
friend

Definition at line 106 of file chattab.h.

◆ WhisperWindow

friend class WhisperWindow
friend

Definition at line 107 of file chattab.h.

Member Data Documentation

◆ mScrollArea

ScrollArea* ChatTab::mScrollArea
protected

Definition at line 130 of file chattab.h.

◆ mTextOutput

BrowserBox* ChatTab::mTextOutput
protected

Definition at line 131 of file chattab.h.


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