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

The chat window. More...

#include <chatwindow.h>

Inheritance diagram for ChatWindow:
Window EventListener

Public Member Functions

 ChatWindow ()
 
 ~ChatWindow () override
 Destructor: used to write back values to the config file.
 
void resetToDefaultSize () override
 Reset the chat window and recorder window attached to it to their default positions.
 
ChatTabgetFocused () const
 Gets the focused tab.
 
void clearTab ()
 Clear the current tab.
 
void prevTab ()
 Switch to the previous tab in order.
 
void nextTab ()
 Switch to the next tab in order.
 
void action (const gcn::ActionEvent &event) override
 Performs action.
 
bool requestChatFocus ()
 Request focus for typing chat message.
 
bool isInputFocused () const
 Checks whether ChatWindow is Focused or not.
 
void chatInput (const std::string &msg)
 Passes the text to the current tab as input.
 
void addInputText (const std::string &text)
 Add the given text to the chat input.
 
void addItemText (const std::string &item)
 Called to add item to chat.
 
void setVisible (bool visible) override
 Override to reset mTmpVisible.
 
void mousePressed (gcn::MouseEvent &event) override
 
void mouseDragged (gcn::MouseEvent &event) override
 
void event (Event::Channel channel, const Event &event) override
 
void scroll (int amount)
 Scrolls the chat window.
 
void setRecordingFile (const std::string &msg)
 Sets the file being recorded to.
 
void doPresent ()
 
void whisper (const std::string &nick, const std::string &mes, Own own=BY_OTHER)
 
ChatTabaddWhisperTab (const std::string &nick, bool switchTo=false)
 
- Public Member Functions inherited from Window
 Window (const std::string &caption="Window", bool modal=false, Window *parent=nullptr)
 Constructor.
 
 Window (SkinType skinType, const std::string &caption="Window", bool modal=false, Window *parent=nullptr)
 Constructor that allows customizing the SkinType used by the window.
 
 ~Window () override
 Destructor.
 
void draw (gcn::Graphics *graphics) override
 Draws the window contents.
 
void drawFrame (gcn::Graphics *graphics) override
 Draws the window frame.
 
void setContentSize (int width, int height)
 Sets the size of this window.
 
void setMinimumContentSize (int width, int height)
 Sets the minimum size of the window content.
 
void setLocationRelativeTo (gcn::Widget *widget)
 Sets the location relative to the given widget.
 
void setResizable (bool resize)
 Sets whether or not the window can be resized.
 
void redraw ()
 
void widgetResized (const gcn::Event &event) override
 Called whenever the widget changes size.
 
void widgetHidden (const gcn::Event &event) override
 Called whenever the widget is hidden.
 
void setCloseButton (bool flag)
 Sets whether or not the window has a close button.
 
bool isResizable () const
 Returns whether the window can be resized.
 
void setMinWidth (int width)
 Sets the minimum width of the window.
 
int getMinWidth () const
 
void setMinHeight (int height)
 Sets the minimum height of the window.
 
int getMinHeight () const
 
void setMaxWidth (int width)
 Sets the maximum width of the window.
 
int getMaxWidth () const
 
void setMaxHeight (int height)
 Sets the minimum height of the window.
 
int getMaxHeight () const
 
void setShowTitle (bool flag)
 Sets flag to show a title or not.
 
void setStickyButton (bool flag)
 Sets whether or not the window has a sticky button.
 
void setSticky (bool sticky)
 Sets whether the window is sticky.
 
bool isSticky () const
 Returns whether the window is sticky.
 
void setVisible (bool visible, bool forceSticky)
 Overloads window setVisible by Guichan to allow sticky window handling, or not, if you force the sticky state.
 
bool isDefaultVisible () const
 Returns whether the window is visible by default.
 
void setDefaultVisible (bool save)
 Sets whether the window is visible by default.
 
bool willSaveVisible () const
 Returns whether the window will save it's visibility.
 
void setSaveVisible (bool save)
 Sets whether the window will save it's visibility.
 
WindowgetParentWindow () const
 Returns the parent window.
 
void scheduleDelete ()
 Schedule this window for deletion.
 
void mousePressed (gcn::MouseEvent &event) override
 Starts window resizing when appropriate.
 
void mouseDragged (gcn::MouseEvent &event) override
 Implements window resizing and makes sure the window is not dragged/resized outside of the screen.
 
void mouseMoved (gcn::MouseEvent &event) override
 Implements custom cursor image changing context, based on mouse relative position.
 
void mouseReleased (gcn::MouseEvent &event) override
 When the mouse button has been let go, this ensures that the mouse custom cursor is restored back to it's standard image.
 
void mouseExited (gcn::MouseEvent &event) override
 When the mouse leaves the window this ensures that the custom cursor is restored back to it's standard image.
 
void setWindowName (const std::string &name)
 Sets the name of the window.
 
const std::string & getWindowName () const
 Returns the name of the window.
 
void loadWindowState ()
 Reads the position (and the size for resizable windows) in the configuration based on the given string.
 
void saveWindowState () const
 Saves the window state so that when the window is reloaded, it'll maintain its previous state and location.
 
void setDefaultSize (int defaultX, int defaultY, int defaultWidth, int defaultHeight)
 Set the default win pos and size.
 
void setDefaultSize ()
 Set the default win pos and size to the current ones.
 
void setDefaultSize (int defaultWidth, int defaultHeight, WindowAlignment alignment, int offsetx=0, int offsetY=0)
 Set the default win pos and size.
 
void adjustPositionAfterResize (int oldScreenWidth, int oldScreenHeight)
 Adjusts the window position after the application window has been resized.
 
LayoutgetLayout ()
 Gets the layout handler for this window.
 
void clearLayout ()
 Clears the window's layout (useful for redesigning the window).
 
void reflowLayout (int w=0, int h=0)
 Computes the position of the widgets according to the current layout.
 
LayoutCellplace (int x, int y, gcn::Widget *, int w=1, int h=1)
 Adds a widget to the window and sets it at given cell.
 
ContainerPlacer getPlacer (int x, int y)
 Returns a proxy for adding widgets in an inner table of the layout.
 
void center ()
 Positions the window in the center of it's parent.
 
virtual void close ()
 Overrideable functionality for when the window is to close.
 
const SkingetSkin () const
 Returns the Skin used by this window.
 
- Public Member Functions inherited from EventListener
virtual ~EventListener ()
 
void listen (Event::Channel channel)
 
void ignore (Event::Channel channel)
 

Protected Member Functions

void removeTab (ChatTab *tab)
 Remove the given tab from the window.
 
void addTab (ChatTab *tab)
 Add the tab to the window.
 
void removeWhisper (const std::string &nick)
 
void removeAllWhispers ()
 

Protected Attributes

ItemLinkHandlermItemLinkHandler
 Used for showing item popup on clicking links.
 
RecordermRecorder
 
ChatInputmChatInput
 Input box for typing chat messages.
 
TextHistory mHistory
 
AutoCompleteListermAutoComplete
 

Private Attributes

bool mTmpVisible = false
 
TabbedAreamChatTabs
 Tabbed area for holding each channel.
 
std::map< const std::string, ChatTab * > mWhispers
 Manage whisper tabs.
 

Friends

class ChatTab
 
class WhisperTab
 
class ChatAutoComplete
 

Additional Inherited Members

- Static Public Member Functions inherited from Window
static void setWindowContainer (WindowContainer *windowContainer)
 Sets the window container to be used by new windows.
 
static int getGuiAlpha ()
 Gets the alpha value used by the window, in a Guichan usable format.
 
- Static Protected Attributes inherited from Window
static int mouseResize = 0
 Active resize handles.
 

Detailed Description

The chat window.

Definition at line 70 of file chatwindow.h.

Constructor & Destructor Documentation

◆ ChatWindow()

ChatWindow::ChatWindow ( )

Definition at line 85 of file chatwindow.cpp.

◆ ~ChatWindow()

ChatWindow::~ChatWindow ( )
override

Destructor: used to write back values to the config file.

Definition at line 128 of file chatwindow.cpp.

Member Function Documentation

◆ action()

void ChatWindow::action ( const gcn::ActionEvent &  event)
override

Performs action.

Definition at line 175 of file chatwindow.cpp.

◆ addInputText()

void ChatWindow::addInputText ( const std::string &  text)

Add the given text to the chat input.

Definition at line 406 of file chatwindow.cpp.

◆ addItemText()

void ChatWindow::addItemText ( const std::string &  item)

Called to add item to chat.

Definition at line 420 of file chatwindow.cpp.

◆ addTab()

void ChatWindow::addTab ( ChatTab tab)
protected

Add the tab to the window.

Definition at line 238 of file chatwindow.cpp.

◆ addWhisperTab()

ChatTab * ChatWindow::addWhisperTab ( const std::string &  nick,
bool  switchTo = false 
)

Definition at line 498 of file chatwindow.cpp.

◆ chatInput()

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

Passes the text to the current tab as input.

Parameters
msgThe message text which is to be sent.

Definition at line 269 of file chatwindow.cpp.

◆ clearTab()

void ChatWindow::clearTab ( )

Clear the current tab.

Definition at line 147 of file chatwindow.cpp.

◆ doPresent()

void ChatWindow::doPresent ( )

Definition at line 275 of file chatwindow.cpp.

◆ event()

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

Implements EventListener.

Definition at line 367 of file chatwindow.cpp.

◆ getFocused()

ChatTab * ChatWindow::getFocused ( ) const

Gets the focused tab.

Definition at line 142 of file chatwindow.cpp.

◆ isInputFocused()

bool ChatWindow::isInputFocused ( ) const

Checks whether ChatWindow is Focused or not.

Definition at line 228 of file chatwindow.cpp.

◆ mouseDragged()

void ChatWindow::mouseDragged ( gcn::MouseEvent &  event)
override

Definition at line 350 of file chatwindow.cpp.

◆ mousePressed()

void ChatWindow::mousePressed ( gcn::MouseEvent &  event)
override

Definition at line 330 of file chatwindow.cpp.

◆ nextTab()

void ChatWindow::nextTab ( )

Switch to the next tab in order.

Definition at line 164 of file chatwindow.cpp.

◆ prevTab()

void ChatWindow::prevTab ( )

Switch to the previous tab in order.

Definition at line 153 of file chatwindow.cpp.

◆ removeAllWhispers()

void ChatWindow::removeAllWhispers ( )
protected

Definition at line 257 of file chatwindow.cpp.

◆ removeTab()

void ChatWindow::removeTab ( ChatTab tab)
protected

Remove the given tab from the window.

Definition at line 233 of file chatwindow.cpp.

◆ removeWhisper()

void ChatWindow::removeWhisper ( const std::string &  nick)
protected

Definition at line 250 of file chatwindow.cpp.

◆ requestChatFocus()

bool ChatWindow::requestChatFocus ( )

Request focus for typing chat message.

Returns
true if the input was shown false otherwise

Definition at line 203 of file chatwindow.cpp.

◆ resetToDefaultSize()

void ChatWindow::resetToDefaultSize ( )
overridevirtual

Reset the chat window and recorder window attached to it to their default positions.

Reimplemented from Window.

Definition at line 136 of file chatwindow.cpp.

◆ scroll()

void ChatWindow::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 320 of file chatwindow.cpp.

◆ setRecordingFile()

void ChatWindow::setRecordingFile ( const std::string &  msg)

Sets the file being recorded to.

Parameters
msgThe file to write out to. If null, then stop recording.

Definition at line 438 of file chatwindow.cpp.

◆ setVisible()

void ChatWindow::setVisible ( bool  visible)
overridevirtual

Override to reset mTmpVisible.

Reimplemented from Window.

Definition at line 427 of file chatwindow.cpp.

◆ whisper()

void ChatWindow::whisper ( const std::string &  nick,
const std::string &  mes,
Own  own = BY_OTHER 
)

Definition at line 443 of file chatwindow.cpp.

Friends And Related Symbol Documentation

◆ ChatAutoComplete

friend class ChatAutoComplete
friend

Definition at line 173 of file chatwindow.h.

◆ ChatTab

friend class ChatTab
friend

Definition at line 171 of file chatwindow.h.

◆ WhisperTab

friend class WhisperTab
friend

Definition at line 172 of file chatwindow.h.

Member Data Documentation

◆ mAutoComplete

AutoCompleteLister* ChatWindow::mAutoComplete
protected

Definition at line 193 of file chatwindow.h.

◆ mChatInput

ChatInput* ChatWindow::mChatInput
protected

Input box for typing chat messages.

Definition at line 190 of file chatwindow.h.

◆ mChatTabs

TabbedArea* ChatWindow::mChatTabs
private

Tabbed area for holding each channel.

Definition at line 199 of file chatwindow.h.

◆ mHistory

TextHistory ChatWindow::mHistory
protected

Definition at line 192 of file chatwindow.h.

◆ mItemLinkHandler

ItemLinkHandler* ChatWindow::mItemLinkHandler
protected

Used for showing item popup on clicking links.

Definition at line 186 of file chatwindow.h.

◆ mRecorder

Recorder* ChatWindow::mRecorder
protected

Definition at line 187 of file chatwindow.h.

◆ mTmpVisible

bool ChatWindow::mTmpVisible = false
private

Definition at line 196 of file chatwindow.h.

◆ mWhispers

std::map<const std::string, ChatTab *> ChatWindow::mWhispers
private

Manage whisper tabs.

Definition at line 202 of file chatwindow.h.


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