kaddressbook

#include <cardview.h>

Inherited by AddresseeCardViewItem.

Public Types

typedef TQPair< TQString, TQString > Field
 

Public Member Functions

 CardViewItem (CardView *parent, const TQString &caption=TQString())
 
const TQString & caption () const
 
void setCaption (const TQString &caption)
 
virtual void paintCard (TQPainter *p, TQColorGroup &cg)
 
virtual void repaintCard ()
 
void insertField (const TQString &label, const TQString &value)
 
void removeField (const TQString &label)
 
TQString fieldValue (const TQString &label) const
 
void clearFields ()
 
CardViewItemnextItem () const
 
bool isSelected () const
 
void showFullString (const TQPoint &pos, CardViewTip *tip)
 
FieldfieldAt (const TQPoint &itempos) const
 
CardViewcardView () const
 
int height (bool allowCache=true) const
 

Protected Member Functions

void setSelected (bool selected)
 

Friends

class CardView
 

Detailed Description

Represents a single card (item) in the card view.

A card has a caption and a list of fields. A Field is a label<->value pair. The labels in a card should be unique, since they will be used to index the values.

Definition at line 49 of file cardview.h.

Member Typedef Documentation

◆ Field

typedef TQPair<TQString, TQString> CardViewItem::Field

A single field in the card view.

The first item is the label and the second item is the value.

Definition at line 58 of file cardview.h.

Constructor & Destructor Documentation

◆ CardViewItem()

CardViewItem::CardViewItem ( CardView parent,
const TQString &  caption = TQString() 
)

Constructor.

Parameters
parentThe CardView that this card should be displayed on.
captionThe caption of the card. This is the text that will appear at the top of the card. This is also the string that will be used to sort the cards in the view.

Definition at line 195 of file cardview.cpp.

Member Function Documentation

◆ caption()

const TQString & CardViewItem::caption ( ) const
Returns
The caption of the card, or TQString() if none was ever set.

Definition at line 326 of file cardview.cpp.

◆ clearFields()

void CardViewItem::clearFields ( )

Removes all the fields from this card.

Definition at line 409 of file cardview.cpp.

◆ fieldAt()

CardViewItem::Field * CardViewItem::fieldAt ( const TQPoint &  itempos) const
Returns
a pointer to the Field at the position itempos in this item. 0 is returned if itempos is in the caption.
Parameters
itemposthe position in item coordinates

Definition at line 549 of file cardview.cpp.

◆ fieldValue()

TQString CardViewItem::fieldValue ( const TQString &  label) const
Returns
The value of the field with label label.

Definition at line 463 of file cardview.cpp.

◆ height()

int CardViewItem::height ( bool  allowCache = true) const
Returns
The height of this item as rendered, in pixels.

if allowCache is true, the item may use an internally cached value rather than recalculating from scratch. The argument is mainly to allow the cardView to change global settings (like maxFieldLines) that might influence the items heights

Definition at line 332 of file cardview.cpp.

◆ insertField()

void CardViewItem::insertField ( const TQString &  label,
const TQString &  value 
)

Adds a field to the card.

Parameters
labelThe label of the field. The field labels must be unique within a card.
valueThe value of the field.

Definition at line 378 of file cardview.cpp.

◆ isSelected()

bool CardViewItem::isSelected ( ) const
Returns
True if this card is currently selected, false otherwise.

Definition at line 368 of file cardview.cpp.

◆ nextItem()

CardViewItem * CardViewItem::nextItem ( ) const
Returns
The next card item. The order of the items will be the same as the display order in the view. 0 will be returned if this is the last card.

Definition at line 441 of file cardview.cpp.

◆ paintCard()

void CardViewItem::paintCard ( TQPainter *  p,
TQColorGroup &  cg 
)
virtual

Paints the card using the given painter and color group.

The card will handle painting itself selected if it is selected.

Definition at line 225 of file cardview.cpp.

◆ removeField()

void CardViewItem::removeField ( const TQString &  label)

Removes the field with label label from the card.

Definition at line 390 of file cardview.cpp.

◆ repaintCard()

void CardViewItem::repaintCard ( )
virtual

Repaints the card.

This is done by sending a repaint event to the view with the clip rect defined as this card.

Definition at line 451 of file cardview.cpp.

◆ setCaption()

void CardViewItem::setCaption ( const TQString &  caption)

Sets the caption of the card.

This is the text that will appear at the top of the card. This is also the string that will be used to sort the cards in the view.

Definition at line 457 of file cardview.cpp.

◆ setSelected()

void CardViewItem::setSelected ( bool  selected)
protected

Sets the card as selected.

This is usually only called from the card view.

Definition at line 373 of file cardview.cpp.

◆ showFullString()

void CardViewItem::showFullString ( const TQPoint &  pos,
CardViewTip *  tip 
)

Called by the parent card view when the mouse has been resting for a certain amount of time.

If the label or value at pos is obscured (trimmed) make the label display the full text.

Definition at line 474 of file cardview.cpp.


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