summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/klistview.h
Side-by-side diff
Diffstat (limited to 'microkde/kdeui/klistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/klistview.h121
1 files changed, 66 insertions, 55 deletions
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index 9f0d9fd..2176525 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -11,35 +11,46 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLISTVIEW_H
#define KLISTVIEW_H
-#include <qlistview.h>
-
-#include <qptrlist.h>
+#include <q3listview.h>
+
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QDragLeaveEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <QDragEnterEvent>
//US
class QDropEvent;
class QDragLeaveEvent;
class QDragMoveEvent;
class QDragEnterEvent;
-class QDragObject;
+class Q3DragObject;
class KConfig;
class KLineEdit;
/**
* This Widget extends the functionality of QListView to honor the system
* wide settings for Single Click/Double Click mode, AutoSelection and
* ChangeCursorOverLink (TM).
*
* There is a new signal executed(). It gets connected to either
* @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE
* wide Single Click/Double Click settings. It is strongly recommended that
* you use this signal instead of the above mentioned. This way you dont
* need to care about the current settings.
@@ -48,25 +59,25 @@ class KLineEdit;
*
* Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true)
* and connect it to a suitable slot.
* To see where you are dropping, @ref setDropVisualizer(true).
* And also you'll need @ref acceptDrag(QDropEvent*)
*
* KListView is drag-enabled, too: to benefit from that you've got derive from it.
* Reimplement @ref dragObject() and (possibly) @ref startDrag(),
* and @ref setDragEnabled(true).
*
* @version $Id$
*/
-class KListView : public QListView
+class KListView : public Q3ListView
{
Q_OBJECT
Q_ENUMS( SelectionModeExt )
Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
@@ -97,33 +108,33 @@ public:
* item to (including) the item one page up
*
* The combinations work the same with SHIFT instead of CTRL, except
* that if you start selecting something using SHIFT everything selected
* before will be deselected first.
*
* Additionally the current item is always selected automatically when
* navigating using the keyboard, except other items were selected explicitely.
*
* This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected
*/
enum SelectionModeExt {
- Single = QListView::Single,
- Multi = QListView::Multi,
- Extended = QListView::Extended,
- NoSelection = QListView::NoSelection,
+ Single = Q3ListView::Single,
+ Multi = Q3ListView::Multi,
+ Extended = Q3ListView::Extended,
+ NoSelection = Q3ListView::NoSelection,
FileManager
};
void repaintContents( bool erase = true )
{
- QScrollView::repaintContents( contentsX(), contentsY(),
+ Q3ScrollView::repaintContents( contentsX(), contentsY(),
visibleWidth(), visibleHeight(), erase );
};
/**
* Constructor.
*
* The parameters @p parent and @p name are handled by
* @ref QListView, as usual.
*/
KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true );
/**
* Destructor.
@@ -152,44 +163,44 @@ public:
virtual bool isExecuteArea( const QPoint& point );
/**
* Same thing, but from an x coordinate only. This only checks if x is in
* the first column (if all columns don't show focus), without testing if
* the y coordinate is over an item or not.
*/
bool isExecuteArea( int x );
/**
* @return a list containing the currently selected items.
*/
- QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
+ Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
/**
* Arbitrarily move @p item to @p parent, positioned immediately after item @p after.
*/
- void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after);
+ void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after);
/**
* @return the last item (not child!) of this listview.
*
* @see lastChild()
*/
- QListViewItem *lastItem() const;
+ Q3ListViewItem *lastItem() const;
/**
* @return the last child of this listview.
*
* @see lastItem()
*/
- QListViewItem* lastChild () const;
+ Q3ListViewItem* lastChild () const;
/**
* @return the lineedit used for inline renaming.
* Use that to setup a @ref KCompletion or @ref QValidator for the lineedit
*
* @since 3.2
*/
KLineEdit* renameLineEdit() const;
/**
* @returns if it is legal to move items in the list view. True by default.
*
@@ -267,32 +278,32 @@ public:
* @return the "extended" selection mode of this listview.
*
* @see SelectionModeExt
* @see setSelectionModeExt
*/
SelectionModeExt selectionModeExt () const;
/**
* Returns the index of @p item within the item tree or -1 if
* @p item doesn't exist in this list view. This function takes
* all items into account not only the visible ones.
*/
- int itemIndex( const QListViewItem *item ) const;
+ int itemIndex( const Q3ListViewItem *item ) const;
/**
* Returns the item of @p index within the item tree or 0 if
* @p index doesn't exist in this list view. This function takes
* all items into account not only the visible ones.
*/
- QListViewItem* itemAtIndex(int index);
+ Q3ListViewItem* itemAtIndex(int index);
/**
* @deprecated
* @see #setFullWidth()
*/
void setFullWidth();
/**
* Let the last column fit exactly all the available width.
*
* @see #fullWidth()
*/
@@ -305,25 +316,25 @@ public:
*/
bool fullWidth() const;
/**
* Reimplemented for full width support
*
* @see #removeColumn()
*/
virtual int addColumn(const QString& label, int width = -1);
/**
* Reimplemented for full width support
*/
- virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1);
+ virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1);
/**
* Reimplemented for full width support
*
* @see #addColumn()
*/
virtual void removeColumn(int index);
/**
* sets the alternate background background color.
* This only has an effect if the items are KListViewItems
*
* @param c the color to use for every other item. Set to an invalid
@@ -379,108 +390,108 @@ public:
signals:
/**
* This signal is emitted whenever the user executes an listview item.
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listview item.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*/
- void executed( QListViewItem *item );
+ void executed( Q3ListViewItem *item );
/**
* This signal is emitted whenever the user executes an listview item.
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listview item.
* @param pos is the position where the user has clicked
* @param c is the column into which the user clicked.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*/
- void executed( QListViewItem *item, const QPoint &pos, int c );
+ void executed( Q3ListViewItem *item, const QPoint &pos, int c );
/**
* This signal gets emitted whenever the user double clicks into the
* listview.
* @param item is the pointer to the clicked listview item.
* @param pos is the position where the user has clicked, and
* @param c is the column into which the user clicked.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*
* This signal is more or less here for the sake of completeness.
* You should normally not need to use this. In most cases its better
* to use @ref #executed() instead.
*/
- void doubleClicked( QListViewItem *item, const QPoint &pos, int c );
- void contextRequest( QListViewItem *item, const QPoint &pos, int c );
+ void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c );
+ void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c );
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* @param e is the drop event itself (it has already been accepted)
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items)
*
* @see #acceptDrop()
*/
- void dropped (QDropEvent * e, QListViewItem *after);
+ void dropped (QDropEvent * e, Q3ListViewItem *after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This is an overloaded version of the above (provided to simplify
* processing drops outside of the class).
*
* @param list is the listview
* @param e is the drop event itself (it has already been accepted)
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (KListView* list, QDropEvent* e, QListViewItem* after);
+ void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This function also provides a parent, in the event that your listview
* is a tree
* @param list is the listview
* @param e is the drop event itself (it has already been accepted)
* @param parent the item that is to be the parent of the new item
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after);
+ void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This function also provides a parent, in the event that your listview
* is a tree
* @param e is the drop event itself (it has already been accepted)
* @param parent the item that is to be the parent of the new item
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after);
+ void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
/**
* This signal is emitted when ever the user moves an item in the list via
* DnD.
* If more than one item is moved at the same time, this signal is only emitted
* once.
*/
void moved();
/**
* Connect to this signal if you want to do some preprocessing before
* a move is made, for example, to disable sorting
@@ -493,76 +504,76 @@ signals:
/**
* This signal is emitted when ever the user moves an item in the list via
* DnD.
* If more than one item is moved at the same time, @p afterFirst and
* @p afterNow will reflect what was true before the move.
* This differs from @ref moved(), so be careful. All the items will have been
* moved before @ref moved() is emitted, which is not true in this method. // FIXME
* @param item the item that was moved
* @param afterFirst the item that parameter item was in before the move, in the list
* @param afterNow the item it's currently after.
*/
- void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow);
+ void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow);
/**
* This signal is emitted after all the items have been moved. It reports info for
* each and every item moved, in order. The first element in @p items associates
* with the first of afterFirst and afterNow.
*/
- void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow);
+ void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow);
/**
* This signal gets emitted when an item is renamed via in-place renaming.
*
* @param item is the renamed item.
* @param str is the new value of column @p col.
* @param col is the renamed column.
*/
- void itemRenamed(QListViewItem* item, const QString &str, int col);
+ void itemRenamed(Q3ListViewItem* item, const QString &str, int col);
/**
* Same as above, but without the extra information.
*/
- void itemRenamed(QListViewItem* item);
+ void itemRenamed(Q3ListViewItem* item);
void signalDelete();
/**
* This signal is emitted when the shortcut key for popup-menus is pressed.
*
* Normally you should not use this, just connect a slot to signal
* @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly
* handle showing context menus regardless of settings.
*
* @param list is this listview.
* @param item is the @ref currentItem() at the time the key was pressed. May be 0L.
*/
- void menuShortCutPressed (KListView* list, QListViewItem* item);
+ void menuShortCutPressed (KListView* list, Q3ListViewItem* item);
/**
* This signal is emitted whenever a context-menu should be shown for item @p i.
* It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click).
*
* @param l is this listview.
* @param i is the item for which the menu should be shown. May be 0L.
* @param p is the point at which the menu should be shown.
*/
- void contextMenu (KListView* l, QListViewItem* i, const QPoint& p);
+ void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p);
public slots:
/**
* Rename column @p c of @p item.
*/
- virtual void rename(QListViewItem *item, int c);
+ virtual void rename(Q3ListViewItem *item, int c);
/**
* By default, if you called setItemsRenameable(true),
* only the first column is renameable.
* Use this function to enable the feature on other columns.
*
* If you want more intelligent (dynamic) selection,
* you'll have to derive from KListView,
* and override @ref rename() and call only call it
* if you want the item to be renamed.
*/
void setRenameable (int column, bool yesno=true);
@@ -664,41 +675,41 @@ protected:
return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
}
/**
* An overloaded version of below(const QRect&, const QPoint&).
*
* It differs from the above only in what arguments it takes.
*
* @param i the item whose rect() is passed to the above function.
* @param p is translated from contents coordinates to viewport coordinates
* before being passed to the above function.
*/
- inline bool below (QListViewItem* i, const QPoint& p)
+ inline bool below (Q3ListViewItem* i, const QPoint& p)
{
return below (itemRect(i), contentsToViewport(p));
}
/**
* Reimplemented to reload the alternate background in palette changes.
* @internal
*/
virtual bool event( QEvent * );
/**
* Emit signal @ref #executed.
* @internal
*/
//US I added buttonstate to pass the current keyboard status
- void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c);
+ void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void focusInEvent(QFocusEvent* fe);
/**
* Reimplemented for internal reasons.
@@ -712,30 +723,30 @@ protected:
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void leaveEvent( QEvent *e );
/**
* @return the tooltip for @p column of @p item.
*/
- virtual QString tooltip(QListViewItem* item, int column) const;
+ virtual QString tooltip(Q3ListViewItem* item, int column) const;
/**
* @return whether the tooltip for @p column of @p item shall be shown at point @p pos.
*/
- virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const;
+ virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const;
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDragMoveEvent (QDragMoveEvent *event);
/**
* Reimplemented for internal reasons.
@@ -796,49 +807,49 @@ protected:
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDragEnterEvent (QDragEnterEvent *);
/**
* @return a dragobject encoding the current selection.
*
* @see setDragEnabled()
*/
- virtual QDragObject *dragObject();
+ virtual Q3DragObject *dragObject();
/**
* @return true if the @p event provides some acceptable
* format.
* A common mistake is to forget the "const" in your reimplementation
*/
virtual bool acceptDrag (QDropEvent* event) const;
/**
* Paint the drag line. If painter is null, don't try to :)
*
* If after == 0 then the marker should be drawn at the top.
*
* @return the rectangle that you painted to.
*/
- virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after);
+ virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after);
/**
* Paint the drag rectangle. If painter is null, don't try to :)
*
*
* @return the rectangle that you painted to.
*/
- virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item);
+ virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item);
/**
* This method calls @ref dragObject() and starts the drag.
*
* Reimplement it to do fancy stuff like setting a pixmap or
* using a non-default DragMode
*/
virtual void startDrag();
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
@@ -877,52 +888,52 @@ protected:
/**
* Reimplemented for setFullWidth()
*/
virtual void viewportResizeEvent(QResizeEvent* e);
protected slots:
/**
* Update internal settings whenever the global ones change.
* @internal
*/
void slotSettingsChanged(int);
- void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c );
- void doneEditing(QListViewItem *item, int row);
+ void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c );
+ void doneEditing(Q3ListViewItem *item, int row);
/**
* Repaint the rect where I was drawing the drop line.
*/
void cleanDropVisualizer();
/**
* Repaint the rect where I was drawing the drop rectangle.
*/
void cleanItemHighlighter();
/**
* Emit the @ref contextMenu signal. This slot is for mouse actions.
*/
- void emitContextMenu (QListViewItem*, const QPoint&, int);
+ void emitContextMenu (Q3ListViewItem*, const QPoint&, int);
/**
* Emit the @ref #contextMenu signal. This slot is for key presses.
*/
- void emitContextMenu (KListView*, QListViewItem*);
+ void emitContextMenu (KListView*, Q3ListViewItem*);
/**
* Accessory slot for AutoSelect
* @internal
*/
- void slotOnItem( QListViewItem *item );
+ void slotOnItem( Q3ListViewItem *item );
/**
* Accessory slot for AutoSelect/ChangeCursorOverItem
* @internal
*/
void slotOnViewport();
/**
* Process AutoSelection.
* @internal
*/
void slotAutoSelect();
@@ -930,33 +941,33 @@ protected slots:
void slotDragExpand();
/**
* Reacts to header changes in full width mode
* @internal
*/
void slotHeaderChanged();
protected:
/**
* Handle dropEvent when itemsMovable() is set to true.
*/
- virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme);
+ virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme);
/**
* Where is the nearest QListViewItem that I'm going to drop?
*
* FIXME KDE 4.0: Make this method const so it can be called from an
* acceptDrag method without ugly casts
*/
- virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after);
+ virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after);
/**
* A special keyPressEvent (for FileManager selection mode).
*/
void fileManagerKeyPressEvent (QKeyEvent*);
/**
* Convert the depth of an item into its indentation in pixels
*/
int depthToPixels( int depth );
private:
@@ -965,57 +976,57 @@ protected:
virtual void virtual_hook( int id, void* data );
private:
class KListViewPrivate;
KListViewPrivate *d;
};
/**
* A listview item with support for alternate background colours. It is
* a drop-in replacement for @ref QListViewItem
*
* @short listview item with alternate background colour support
*/
-class KListViewItem : public QListViewItem
+class KListViewItem : public Q3ListViewItem
{
public:
/**
* constructors. The semantics remain as in @ref QListViewItem.
* Although they accept a @ref QListViewItem as parent, please
* don't mix KListViewItem (or subclasses) with QListViewItem
* (or subclasses).
*/
- KListViewItem(QListView *parent);
- KListViewItem(QListViewItem *parent);
- KListViewItem(QListView *parent, QListViewItem *after);
- KListViewItem(QListViewItem *parent, QListViewItem *after);
+ KListViewItem(Q3ListView *parent);
+ KListViewItem(Q3ListViewItem *parent);
+ KListViewItem(Q3ListView *parent, Q3ListViewItem *after);
+ KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after);
- KListViewItem(QListView *parent,
+ KListViewItem(Q3ListView *parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListViewItem *parent,
+ KListViewItem(Q3ListViewItem *parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListView *parent, QListViewItem *after,
+ KListViewItem(Q3ListView *parent, Q3ListViewItem *after,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListViewItem *parent, QListViewItem *after,
+ KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
virtual ~KListViewItem();
/**
* retuns true if this item is to be drawn with the alternate background
*/
bool isAlternate();
/**