KChatBaseText Class Reference

A QListBoxText implementation for KChatBase. More...

#include <kchatbase.h>

Collaboration diagram for KChatBaseText:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KChatBaseText (const QString &player, const QString &text)
 Constructs a KChatBaseText object with the player and text part.
 KChatBaseText (const QString &text)
 Constructs a KChatBaseText object without player part.
virtual ~KChatBaseText ()
 Destruct a KChatBaseText object.
void setName (const QString &name)
 Set the name part of a message.
void setMessage (const QString &message)
 Set the text part of a message.
const QString & name () const
const QString & message () const
QFont nameFont () const
 You can set the font of the sender name independently of the message itself.
QFont messageFont () const
 You can set the font of the message independently of the sender name.
void setNameFont (const QFont *font)
 Set the font for the name.
void setMessageFont (const QFont *font)
 Set the font for the message text.
virtual int width (QListBox *) const
virtual int height (QListBox *) const

Protected Member Functions

virtual void paint (QPainter *)

Detailed Description

A QListBoxText implementation for KChatBase.

It supports different colors, text fonts, ...

A KChatBaseText consists of two text items: first the player part then the text part. This honors KChatBase::addMessage which also uses both. You can leave the player part out if you don't need it - there won't be any difference.

You can set different colors and fonts for both parts. In the future there will probably some kind of KChatBaseDialog which offers the user the ability to configure things like color and font on the fly.

Definition at line 49 of file kchatbase.h.


Constructor & Destructor Documentation

KChatBaseText::KChatBaseText const QString &  player,
const QString &  text
 

Constructs a KChatBaseText object with the player and text part.

Definition at line 50 of file kchatbase.cpp.

References setMessage(), and setName().

Here is the call graph for this function:

KChatBaseText::KChatBaseText const QString &  text  ) 
 

Constructs a KChatBaseText object without player part.

Definition at line 57 of file kchatbase.cpp.

References setMessage().

Here is the call graph for this function:

KChatBaseText::~KChatBaseText  )  [virtual]
 

Destruct a KChatBaseText object.

Definition at line 63 of file kchatbase.cpp.


Member Function Documentation

int KChatBaseText::height QListBox *   )  const [virtual]
 

Definition at line 141 of file kchatbase.cpp.

References messageFont(), and nameFont().

Here is the call graph for this function:

const QString & KChatBaseText::message  )  const
 

Returns:
The message text.
See also:
setMessage

Definition at line 89 of file kchatbase.cpp.

References KChatBaseTextPrivate::mMessage.

Referenced by paint(), setMessage(), setName(), and width().

QFont KChatBaseText::messageFont  )  const
 

You can set the font of the message independently of the sender name.

This font is used as the text part of the message.

Returns:
The font thaz is used for message text

Definition at line 103 of file kchatbase.cpp.

References KChatBaseTextPrivate::mMessageFont.

Referenced by height(), paint(), and width().

const QString & KChatBaseText::name  )  const
 

Returns:
The name part of a message.
See also:
setName

Definition at line 86 of file kchatbase.cpp.

References KChatBaseTextPrivate::mName.

Referenced by paint(), setMessage(), setName(), and width().

QFont KChatBaseText::nameFont  )  const
 

You can set the font of the sender name independently of the message itself.

This font is used as the "name: " part of the message.

Returns:
The font that is used for the name

Definition at line 92 of file kchatbase.cpp.

References KChatBaseTextPrivate::mNameFont.

Referenced by height(), paint(), and width().

void KChatBaseText::paint QPainter *   )  [protected, virtual]
 

Definition at line 120 of file kchatbase.cpp.

References message(), messageFont(), name(), nameFont(), and width().

Here is the call graph for this function:

void KChatBaseText::setMessage const QString &  message  ) 
 

Set the text part of a message.

A message is usually shown like "name: message" and you can change both parts independently.

See also setName

Parameters:
message The message that has been sent

Definition at line 80 of file kchatbase.cpp.

References message(), KChatBaseTextPrivate::mMessage, and name().

Referenced by KChatBaseText().

Here is the call graph for this function:

void KChatBaseText::setMessageFont const QFont *  font  ) 
 

Set the font for the message text.

See also:
messageFont
Parameters:
font A pointer to the message font. Only the pointer is stored so don't delete the object! This way there is only one object for a lot of messages in memory.

Definition at line 117 of file kchatbase.cpp.

References KChatBaseTextPrivate::mMessageFont.

Referenced by KChatBase::layoutSystemMessage().

void KChatBaseText::setName const QString &  name  ) 
 

Set the name part of a message.

A message is usually shown like "name: text" and you can change both parts independently.

See also:
setMessage
Parameters:
name The name of the sender (e.g. the player)

Definition at line 73 of file kchatbase.cpp.

References message(), KChatBaseTextPrivate::mName, and name().

Referenced by KChatBaseText().

Here is the call graph for this function:

void KChatBaseText::setNameFont const QFont *  font  ) 
 

Set the font for the name.

See also:
nameFont
Parameters:
font A pointer to the name font. Only the pointer is stored so don't delete the object. This way there is only one object for a lot of messages in memory.

Definition at line 114 of file kchatbase.cpp.

References KChatBaseTextPrivate::mNameFont.

Referenced by KChatBase::layoutSystemMessage().

int KChatBaseText::width QListBox *   )  const [virtual]
 

Definition at line 129 of file kchatbase.cpp.

References message(), messageFont(), name(), and nameFont().

Referenced by paint().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Aug 23 18:04:48 2006 for libkdegames by  doxygen 1.4.6