1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.widgets.listview;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.abstractitemmodel;
19 import qt.core.coreevent;
20 import qt.core.itemselectionmodel;
21 import qt.core.namespace;
22 import qt.core.point;
23 import qt.core.rect;
24 import qt.core.size;
25 import qt.core.vector;
26 import qt.gui.event;
27 import qt.gui.region;
28 import qt.helpers;
29 import qt.widgets.abstractitemview;
30 import qt.widgets.styleoption;
31 import qt.widgets.widget;
32 
33 /+ QT_REQUIRE_CONFIG(listview); +/
34 
35 
36 extern(C++, class) struct QListViewPrivate;
37 
38 class /+ Q_WIDGETS_EXPORT +/ QListView : QAbstractItemView
39 {
40     mixin(Q_OBJECT);
41     /+ Q_PROPERTY(Movement movement READ movement WRITE setMovement)
42     Q_PROPERTY(Flow flow READ flow WRITE setFlow)
43     Q_PROPERTY(bool isWrapping READ isWrapping WRITE setWrapping)
44     Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
45     Q_PROPERTY(LayoutMode layoutMode READ layoutMode WRITE setLayoutMode)
46     Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
47     Q_PROPERTY(QSize gridSize READ gridSize WRITE setGridSize)
48     Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode)
49     Q_PROPERTY(int modelColumn READ modelColumn WRITE setModelColumn)
50     Q_PROPERTY(bool uniformItemSizes READ uniformItemSizes WRITE setUniformItemSizes)
51     Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize)
52     Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
53     Q_PROPERTY(bool selectionRectVisible READ isSelectionRectVisible WRITE setSelectionRectVisible)
54     Q_PROPERTY(Qt::Alignment itemAlignment READ itemAlignment WRITE setItemAlignment) +/
55 
56 public:
57     enum Movement { Static, Free, Snap }
58     /+ Q_ENUM(Movement) +/
59     enum Flow { LeftToRight, TopToBottom }
60     /+ Q_ENUM(Flow) +/
61     enum ResizeMode { Fixed, Adjust }
62     /+ Q_ENUM(ResizeMode) +/
63     enum LayoutMode { SinglePass, Batched }
64     /+ Q_ENUM(LayoutMode) +/
65     enum ViewMode { ListMode, IconMode }
66     /+ Q_ENUM(ViewMode) +/
67 
68     /+ explicit +/this(QWidget parent = null);
69     ~this();
70 
71     final void setMovement(Movement movement);
72     final Movement movement() const;
73 
74     final void setFlow(Flow flow);
75     final Flow flow() const;
76 
77     final void setWrapping(bool enable);
78     final bool isWrapping() const;
79 
80     final void setResizeMode(ResizeMode mode);
81     final ResizeMode resizeMode() const;
82 
83     final void setLayoutMode(LayoutMode mode);
84     final LayoutMode layoutMode() const;
85 
86     final void setSpacing(int space);
87     final int spacing() const;
88 
89     final void setBatchSize(int batchSize);
90     final int batchSize() const;
91 
92     final void setGridSize(ref const(QSize) size);
93     final QSize gridSize() const;
94 
95     final void setViewMode(ViewMode mode);
96     final ViewMode viewMode() const;
97 
98     final void clearPropertyFlags();
99 
100     final bool isRowHidden(int row) const;
101     final void setRowHidden(int row, bool hide);
102 
103     final void setModelColumn(int column);
104     final int modelColumn() const;
105 
106     final void setUniformItemSizes(bool enable);
107     final bool uniformItemSizes() const;
108 
109     final void setWordWrap(bool on);
110     final bool wordWrap() const;
111 
112     final void setSelectionRectVisible(bool show);
113     final bool isSelectionRectVisible() const;
114 
115     final void setItemAlignment(/+ Qt:: +/qt.core.namespace.Alignment alignment);
116     final /+ Qt:: +/qt.core.namespace.Alignment itemAlignment() const;
117 
118     override QRect visualRect(ref const(QModelIndex) index) const;
119     override void scrollTo(ref const(QModelIndex) index, ScrollHint hint = ScrollHint.EnsureVisible);
120     override QModelIndex indexAt(ref const(QPoint) p) const;
121 
122     override void doItemsLayout();
123     override void reset();
124     override void setRootIndex(ref const(QModelIndex) index);
125 
126 /+ Q_SIGNALS +/public:
127     @QSignal final void indexesMoved(ref const(QModelIndexList) indexes);
128 
129 protected:
130     this(ref QListViewPrivate , QWidget parent = null);
131 
132     override bool event(QEvent e);
133 
134     override void scrollContentsBy(int dx, int dy);
135 
136     final void resizeContents(int width, int height);
137     final QSize contentsSize() const;
138 
139     override void dataChanged(ref const(QModelIndex) topLeft, ref const(QModelIndex) bottomRight, ref const(QVector!(int)) roles = globalInitVar!(QVector!(int)));
140     override void rowsInserted(ref const(QModelIndex) parent, int start, int end);
141     override void rowsAboutToBeRemoved(ref const(QModelIndex) parent, int start, int end);
142 
143     override void mouseMoveEvent(QMouseEvent e);
144     override void mouseReleaseEvent(QMouseEvent e);
145 /+ #if QT_CONFIG(wheelevent) +/
146     override void wheelEvent(QWheelEvent e);
147 /+ #endif +/
148 
149     override void timerEvent(QTimerEvent e);
150     override void resizeEvent(QResizeEvent e);
151 /+ #if QT_CONFIG(draganddrop) +/
152     override void dragMoveEvent(QDragMoveEvent e);
153     override void dragLeaveEvent(QDragLeaveEvent e);
154     override void dropEvent(QDropEvent e);
155     override void startDrag(/+ Qt:: +/qt.core.namespace.DropActions supportedActions);
156 /+ #endif +/ // QT_CONFIG(draganddrop)
157 
158     override QStyleOptionViewItem viewOptions() const;
159     override void paintEvent(QPaintEvent e);
160 
161     override int horizontalOffset() const;
162     override int verticalOffset() const;
163     override QModelIndex moveCursor(CursorAction cursorAction, /+ Qt:: +/qt.core.namespace.KeyboardModifiers modifiers);
164     final QRect rectForIndex(ref const(QModelIndex) index) const;
165     final void setPositionForIndex(ref const(QPoint) position, ref const(QModelIndex) index);
166 
167     override void setSelection(ref const(QRect) rect, QItemSelectionModel.SelectionFlags command);
168     override QRegion visualRegionForSelection(ref const(QItemSelection) selection) const;
169     override QModelIndexList selectedIndexes() const;
170 
171     override void updateGeometries();
172 
173     override bool isIndexHidden(ref const(QModelIndex) index) const;
174 
175     override void selectionChanged(ref const(QItemSelection) selected, ref const(QItemSelection) deselected);
176     override void currentChanged(ref const(QModelIndex) current, ref const(QModelIndex) previous);
177 
178     override QSize viewportSizeHint() const;
179 
180 private:
181     final int visualIndex(ref const(QModelIndex) index) const;
182 
183     /+ Q_DECLARE_PRIVATE(QListView) +/
184     /+ Q_DISABLE_COPY(QListView) +/
185 }
186