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.treewidgetitemiterator; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.flags; 19 import qt.core.scopedpointer; 20 import qt.helpers; 21 import qt.widgets.treewidget; 22 23 /+ QT_REQUIRE_CONFIG(treewidget); 24 25 26 class QTreeWidget; 27 class QTreeWidgetItem; +/ 28 extern(C++, class) struct QTreeModel; 29 30 extern(C++, class) struct QTreeWidgetItemIteratorPrivate; 31 extern(C++, class) struct /+ Q_WIDGETS_EXPORT +/ QTreeWidgetItemIterator 32 { 33 private: 34 /+ friend class QTreeModel; +/ 35 36 public: 37 enum IteratorFlag { 38 All = 0x00000000, 39 Hidden = 0x00000001, 40 NotHidden = 0x00000002, 41 Selected = 0x00000004, 42 Unselected = 0x00000008, 43 Selectable = 0x00000010, 44 NotSelectable = 0x00000020, 45 DragEnabled = 0x00000040, 46 DragDisabled = 0x00000080, 47 DropEnabled = 0x00000100, 48 DropDisabled = 0x00000200, 49 HasChildren = 0x00000400, 50 NoChildren = 0x00000800, 51 Checked = 0x00001000, 52 NotChecked = 0x00002000, 53 Enabled = 0x00004000, 54 Disabled = 0x00008000, 55 Editable = 0x00010000, 56 NotEditable = 0x00020000, 57 UserFlag = 0x01000000 // The first flag that can be used by the user. 58 } 59 /+ Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) +/ 60 alias IteratorFlags = QFlags!(IteratorFlag); 61 @disable this(this); 62 this(ref const(QTreeWidgetItemIterator) it); 63 /+ explicit +/this(QTreeWidget widget, IteratorFlags flags = IteratorFlag.All); 64 /+ explicit +/this(QTreeWidgetItem item, IteratorFlags flags = IteratorFlag.All); 65 ~this(); 66 67 /+ref QTreeWidgetItemIterator operator =(ref const(QTreeWidgetItemIterator) it);+/ 68 69 ref QTreeWidgetItemIterator opUnary(string op)() if(op == "++"); 70 /+pragma(inline, true) const(QTreeWidgetItemIterator) operator ++(int) 71 { 72 QTreeWidgetItemIterator it = this; 73 ++(this); 74 return it; 75 }+/ 76 pragma(inline, true) ref QTreeWidgetItemIterator opOpAssign(string op)(int n) if(op == "+") 77 { 78 if (n < 0) 79 return (this) -= (-n); 80 while (current && n--) 81 ++(this); 82 return this; 83 } 84 85 ref QTreeWidgetItemIterator opUnary(string op)() if(op == "--"); 86 /+pragma(inline, true) const(QTreeWidgetItemIterator) operator --(int) 87 { 88 QTreeWidgetItemIterator it = this; 89 --(this); 90 return it; 91 }+/ 92 pragma(inline, true) ref QTreeWidgetItemIterator opOpAssign(string op)(int n) if(op == "-") 93 { 94 if (n < 0) 95 return (this) += (-n); 96 while (current && n--) 97 --(this); 98 return this; 99 } 100 101 pragma(inline, true) QTreeWidgetItem opUnary(string op)() const if(op == "*") 102 { 103 return current; 104 } 105 106 private: 107 bool matchesFlags(const(QTreeWidgetItem) item) const; 108 QScopedPointer!(QTreeWidgetItemIteratorPrivate) d_ptr; 109 QTreeWidgetItem current; 110 IteratorFlags flags; 111 /+ Q_DECLARE_PRIVATE(QTreeWidgetItemIterator) +/ 112 } 113 /+pragma(inline, true) QFlags!(QTreeWidgetItemIterator.IteratorFlags.enum_type) operator |(QTreeWidgetItemIterator.IteratorFlags.enum_type f1, QTreeWidgetItemIterator.IteratorFlags.enum_type f2)/+noexcept+/{return QFlags!(QTreeWidgetItemIterator.IteratorFlags.enum_type)(f1)|f2;}+/ 114 /+pragma(inline, true) QFlags!(QTreeWidgetItemIterator.IteratorFlags.enum_type) operator |(QTreeWidgetItemIterator.IteratorFlags.enum_type f1, QFlags!(QTreeWidgetItemIterator.IteratorFlags.enum_type) f2)/+noexcept+/{return f2|f1;}+/ 115 /+pragma(inline, true) QIncompatibleFlag operator |(QTreeWidgetItemIterator.IteratorFlags.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/ 116 117 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags) +/