21#ifndef __ko_iconchooser_h__
22#define __ko_iconchooser_h__
24#include <tqgridview.h>
27#include <koffice_export.h>
33 virtual ~KoIconItem() {}
35 bool hasValidPixmap() {
return validPixmap; }
37 bool hasValidThumb() {
return validThumb; }
40 virtual int spacing()
const {
return 0; }
41 virtual void setSpacing(
int) {}
42 virtual TQPixmap &pixmap()
const = 0;
43 virtual TQPixmap &thumbPixmap()
const = 0;
45 virtual int compare(
const KoIconItem *)
const {
return 0; }
48class KoPixmapWidget :
public TQFrame
51 KoPixmapWidget(
const TQPixmap &aPixmap, TQWidget *parent = 0L,
const char *name = 0L);
55 void paintEvent(TQPaintEvent *e);
56 void mouseReleaseEvent( TQMouseEvent *e);
62class KOPAINTER_EXPORT KoIconChooser:
public TQGridView
68 KoIconChooser(TQSize iconSize, TQWidget *parent = 0L,
const char *name = 0L,
bool sort =
false);
69 virtual ~KoIconChooser();
71 bool autoDelete()
const {
return mIconList.autoDelete(); }
72 void setAutoDelete(
bool b) {mIconList.setAutoDelete(b); }
74 void addItem(KoIconItem *item);
75 bool removeItem(KoIconItem *item);
78 KoIconItem *currentItem();
79 void setCurrentItem(KoIconItem *item);
81 void setDragEnabled(
bool allow) { mDragEnabled = allow; }
82 bool dragEnabled()
const {
return mDragEnabled; }
84 KoIconItem *itemAt(
int row,
int col);
85 KoIconItem *itemAt(
int index);
88 void selected(KoIconItem *item);
91 void keyPressEvent(TQKeyEvent *e);
92 void mousePressEvent( TQMouseEvent *e);
93 void mouseReleaseEvent( TQMouseEvent *e);
94 void mouseMoveEvent( TQMouseEvent *e);
95 void resizeEvent(TQResizeEvent *e);
96 void paintCell(TQPainter *p,
int row,
int col);
97 virtual void startDrag();
100 int cellIndex(
int row,
int col);
101 void calculateCells();
102 void showFullPixmap(
const TQPixmap &pix,
const TQPoint &p);
103 int sortInsertionIndex(
const KoIconItem *item);
106 TQPtrList<KoIconItem> mIconList;
107 KoPixmapWidget *mPixmapWidget;
115 TQPoint mDragStartPos;
116 bool mMouseButtonDown;
124class KOPAINTER_EXPORT KoPatternChooser :
public TQWidget
129 KoPatternChooser(
const TQPtrList<KoIconItem> &list, TQWidget *parent,
const char *name = 0 );
132 KoIconItem *currentPattern();
133 void setCurrentPattern( KoIconItem * );
136 void addPattern( KoIconItem * );
137 void removePattern( KoIconItem * );
140 KoIconChooser *chooser;
143 void selected( KoIconItem * );
TDEAction * clear(const TQObject *recvr, const char *slot, TDEActionCollection *parent, const char *name=0)