31#include <tqscrollview.h>
40class CardViewItemPrivate;
51 friend class CardView;
58 typedef TQPair<TQString, TQString>
Field;
74 const TQString &
caption()
const;
87 virtual void paintCard( TQPainter *p, TQColorGroup &cg );
102 void insertField(
const TQString &label,
const TQString &value );
112 TQString
fieldValue(
const TQString &label )
const;
145 CardView *cardView()
const {
return mView; };
155 int height(
bool allowCache =
true )
const;
176 TQString trimString(
const TQString &text,
int width, TQFontMetrics &fm )
const;
178 CardViewItemPrivate *d;
196 friend class CardViewItem;
205 CardView( TQWidget *parent,
const char *name );
219 void takeItem( CardViewItem *item );
243 CardViewItem *
itemAt(
const TQPoint &viewPos )
const;
248 TQRect
itemRect(
const CardViewItem *item )
const;
260 enum SelectionMode { Single, Multi, Extended, NoSelection };
278 void setSelected( CardViewItem *item,
bool selected );
308 CardViewItem *
itemAfter(
const CardViewItem *item )
const;
324 CardViewItem *
findItem(
const TQString &text,
const TQString &label,
325 TQt::StringComparisonMode compare = TQt::BeginsWith )
const;
442 void setFont(
const TQFont &fnt );
516 void drawContents( TQPainter *p,
int clipx,
int clipy,
int clipw,
int cliph );
540 virtual void contentsMousePressEvent( TQMouseEvent* );
541 virtual void contentsMouseMoveEvent( TQMouseEvent* );
542 virtual void contentsMouseReleaseEvent( TQMouseEvent* );
543 virtual void contentsMouseDoubleClickEvent( TQMouseEvent* );
545 virtual void enterEvent( TQEvent* );
546 virtual void leaveEvent( TQEvent* );
548 virtual void focusInEvent( TQFocusEvent* );
549 virtual void focusOutEvent( TQFocusEvent* );
551 virtual void keyPressEvent( TQKeyEvent* );
566 void tryShowFullText();
575 void drawRubberBands(
int pos );
void removeField(const TQString &label)
Removes the field with label label from the card.
const TQString & caption() const
virtual void paintCard(TQPainter *p, TQColorGroup &cg)
Paints the card using the given painter and color group.
CardViewItem * nextItem() const
void clearFields()
Removes all the fields from this card.
void setSelected(bool selected)
Sets the card as selected.
void setCaption(const TQString &caption)
Sets the caption of the card.
void showFullString(const TQPoint &pos, CardViewTip *tip)
Called by the parent card view when the mouse has been resting for a certain amount of time.
virtual void repaintCard()
Repaints the card.
CardViewItem(CardView *parent, const TQString &caption=TQString())
Constructor.
TQPair< TQString, TQString > Field
A single field in the card view.
int height(bool allowCache=true) const
TQString fieldValue(const TQString &label) const
void insertField(const TQString &label, const TQString &value)
Adds a field to the card.
Field * fieldAt(const TQPoint &itempos) const
The CardView is a method of displaying data in cards.
void returnPressed(CardViewItem *)
Emitted when the return key is pressed in an item.
void setDrawColSeparators(bool enabled)
Sets if the column separator should be drawn.
CardViewItem * itemAt(const TQPoint &viewPos) const
void setDrawCardBorder(bool enabled)
Sets if the border around a card should be draw.
int separatorWidth() const
void setShowEmptyFields(bool show)
Sets if fields with no value should be drawn (of cause the label only, but it allows for embedded edi...
CardViewItem * itemAfter(const CardViewItem *item) const
void setItemSpacing(uint spacing)
Sets the item spacing.
void currentChanged(CardViewItem *)
Emitted when the current item changes.
bool drawColSeparators() const
void clear()
Clears the view and deletes all card view items.
void setMaxFieldLines(int howmany)
Sets the maximum number of lines to display pr field.
void ensureItemVisible(const CardViewItem *item)
Ensures that the given item is in the viewable area of the widget.
void contextMenuRequested(CardViewItem *, const TQPoint &)
Emitted when the context menu is requested in some way.
void setSelectionMode(SelectionMode mode)
Sets the selection mode.
CardViewItem * firstItem() const
CardViewItem * currentItem() const
CardViewItem * findItem(const TQString &text, const TQString &label, TQt::StringComparisonMode compare=TQt::BeginsWith) const
Attempts to find the first item matching the params.
void setFont(const TQFont &fnt)
Reimplementation from TQWidget.
TQFont headerFont() const
CardViewItem * selectedItem() const
TQRect itemRect(const CardViewItem *item) const
void setCurrentItem(CardViewItem *item)
Sets the CardViewItem item to the current item in the view.
bool isSelected(CardViewItem *item) const
void doubleClicked(CardViewItem *)
Emitted whenever the user double clicks on an item.
void executed(CardViewItem *)
Emitted whenever the user 'executes' an item.
void drawContents(TQPainter *p, int clipx, int clipy, int clipw, int cliph)
Determines which cards intersect that region and tells them to paint themselves.
uint columnWidth() const
Returns the amounts of pixels required for one column.
void calcLayout()
Does the math based on the bounding rect of the cards to properly lay the cards out on the screen.
void contentsWheelEvent(TQWheelEvent *)
Changes the direction the canvas scolls.
void setHeaderFont(const TQFont &fnt)
Sets the header font.
void setSeparatorWidth(int width)
Sets the column separator width.
int maxFieldLines() const
void takeItem(CardViewItem *item)
Takes the item from the view.
void setItemMargin(uint margin)
Sets the internal item margin.
void setDrawFieldLabels(bool enabled)
Sets if the field labels should be drawn.
void selectAll(bool state)
Selects or deselects all items.
bool drawCardBorder() const
void setLayoutDirty(bool dirty)
Sets the layout to dirty and calls for a repaint.
void insertItem(CardViewItem *item)
Inserts the item into the card view.
void selectionChanged()
Emitted whenever the selection changes.
void clicked(CardViewItem *)
This method is emitted whenever an item is clicked.
void repaintItem(const CardViewItem *item)
Repaints the given item.
void setItemWidth(int width)
Sets the width made available to card items.
void selectionChanged(CardViewItem *)
Same as above method, only it carries the item that was selected.
void resizeEvent(TQResizeEvent *)
Sets the layout to dirty and repaints.
bool drawFieldLabels() const
SelectionMode selectionMode() const
bool showEmptyFields() const
void setSelected(CardViewItem *item, bool selected)
Selects or deselects the given item.
CardView(TQWidget *parent, const char *name)
Constructor.
virtual void startDrag()
Overload this method to be told when a drag should be started.