• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

Signals | Public Member Functions | Protected Member Functions | List of all members
KChat Class Reference

#include <kchat.h>

Inheritance diagram for KChat:
KChatBase

Signals

void signalSendMessage (int id, const TQString &msg)
 
- Signals inherited from KChatBase
void rightButtonClicked (TQListBoxItem *, const TQPoint &)
 

Public Member Functions

 KChat (TQWidget *parent, bool twoPlayerGame=false)
 
virtual const TQString & fromName () const
 
void setFromNickname (const TQString &name)
 
int addPlayer (const TQString &nick)
 
void removePlayer (const TQString &nick)
 
void removePlayer (int id)
 
bool autoAddMessages () const
 
void setAutoAddMessages (bool add)
 
const TQString & player (int id) const
 
int fromId () const
 
- Public Member Functions inherited from KChatBase
 KChatBase (TQWidget *parent, bool noComboBox=false)
 
virtual ~KChatBase ()
 
bool addSendingEntry (const TQString &text, int id)
 
bool insertSendingEntry (const TQString &text, int id, int index=-1)
 
void changeSendingEntry (const TQString &text, int id)
 
void setSendingEntry (int id)
 
void removeSendingEntry (int id)
 
int sendingEntry () const
 
int findIndex (int id) const
 
int nextId () const
 
virtual bool acceptMessage () const
 
void setCompletionMode (TDEGlobalSettings::Completion mode)
 
void setNameFont (const TQFont &font)
 
void setMessageFont (const TQFont &font)
 
void setBothFont (const TQFont &font)
 
void setSystemNameFont (const TQFont &font)
 
void setSystemMessageFont (const TQFont &font)
 
void setSystemBothFont (const TQFont &font)
 
const TQFont & nameFont () const
 
const TQFont & messageFont () const
 
const TQFont & systemNameFont () const
 
const TQFont & systemMessageFont () const
 
virtual void saveConfig (TDEConfig *conf=0)
 
virtual void readConfig (TDEConfig *conf=0)
 
void setMaxItems (int maxItems)
 
void clear ()
 
int maxItems () const
 

Protected Member Functions

virtual void returnPressed (const TQString &)
 
int uniqueId ()
 
- Protected Member Functions inherited from KChatBase
virtual TQString comboBoxItem (const TQString &name) const
 
virtual TQListBoxItem * layoutMessage (const TQString &fromName, const TQString &text)
 
virtual TQListBoxItem * layoutSystemMessage (const TQString &fromName, const TQString &text)
 

Additional Inherited Members

- Public Types inherited from KChatBase
enum  SendingIds { SendToAll = 0 }
 
- Public Slots inherited from KChatBase
virtual void addMessage (const TQString &fromName, const TQString &text)
 
virtual void addSystemMessage (const TQString &fromName, const TQString &text)
 
virtual void addItem (const TQListBoxItem *item)
 
void slotClear ()
 
void setAcceptMessage (bool a)
 

Detailed Description

A chat widget for non-KGame games.

Docu is TODO

Author
Andreas Beckermann b_man.nosp@m.n@gm.nosp@m.x.de

Definition at line 36 of file kchat.h.

Constructor & Destructor Documentation

◆ KChat()

KChat::KChat ( TQWidget *  parent,
bool  twoPlayerGame = false 
)
Parameters
parentThe parent widget for this widget.
twoPlayerGameIf true the combo box where the player can choose to send to a single player or to all players will not be added as you will hardly need it in 2-player games.

Definition at line 39 of file kchat.cpp.

Member Function Documentation

◆ addPlayer()

int KChat::addPlayer ( const TQString &  nick)

Adds a player nickname.

Returns
The unique ID of the player

Definition at line 92 of file kchat.cpp.

◆ autoAddMessages()

bool KChat::autoAddMessages ( ) const
Returns
true if the messages which will be sent from here will be added automatically using KChatBase::addMessage. See also setAutoAddMessages

Definition at line 65 of file kchat.cpp.

◆ fromId()

int KChat::fromId ( ) const
Returns
The ID that belongs to the local player.
See also
setFromNickname

Definition at line 69 of file kchat.cpp.

◆ fromName()

const TQString & KChat::fromName ( ) const
virtual

Equivalent to player(fromId())

Returns
The name that will be shown for messages from this widget. That is the string from setFromNickname

Implements KChatBase.

Definition at line 61 of file kchat.cpp.

◆ player()

const TQString & KChat::player ( int  id) const
Returns
The nickname of the player which belongs to this id

Definition at line 71 of file kchat.cpp.

◆ removePlayer() [1/2]

void KChat::removePlayer ( const TQString &  nick)

Removes all players with this nickname.

Better don't use this as it will remove all players with this nickname. Save the id instead and call removePlayer(id)

Parameters
nickThe nickname of the removed players

Definition at line 104 of file kchat.cpp.

◆ removePlayer() [2/2]

void KChat::removePlayer ( int  id)

Removes the player with this id, as returned by addPlayer.

Parameters
idThe id of the player to be removed

Definition at line 99 of file kchat.cpp.

◆ returnPressed()

void KChat::returnPressed ( const TQString &  text)
protectedvirtual

This emits signalSendMessage and, if autoAddMessages is true, calls KChatBase::addMessage.

Implements KChatBase.

Definition at line 74 of file kchat.cpp.

◆ setAutoAddMessages()

void KChat::setAutoAddMessages ( bool  add)

Usually the messages which will be sent from here (see signalSendMessage) are added autmatically to this widget.

But under some circumstances that would be very unhandy. So you can deactivate this behaviour here and call KChatBase::addMessage yourself

Parameters
addIf true (default) messages sent from here will be added automatically. Otherwise you will have to add them yourself

Definition at line 63 of file kchat.cpp.

◆ setFromNickname()

void KChat::setFromNickname ( const TQString &  name)

This sets the name that will be shown on all chat widgets if this widget sends a message.

See signalSendMessage

Parameters
nameThe name of the player owning this widget

Definition at line 59 of file kchat.cpp.

◆ signalSendMessage

void KChat::signalSendMessage ( int  id,
const TQString &  msg 
)
signal

This signal is emitted when the player wants to send a message.

The message is added automatically using KChatBase::addMessage if autoAddMessages is enabled.

Parameters
idThe id of the player who sends the message - see setFromNickname and player
msgThe message itself

◆ uniqueId()

int KChat::uniqueId ( )
protected

The Id of the next player.

Incremented after every call.

Definition at line 67 of file kchat.cpp.


The documentation for this class was generated from the following files:
  • kchat.h
  • kchat.cpp

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.8.13
This website is maintained by Timothy Pearson.