1 module libwasm.bindings.TreeContentView;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.DataTransfer;
7 import libwasm.bindings.Element;
8 import libwasm.bindings.LegacyQueryInterface;
9 import libwasm.bindings.TreeColumn;
10 import libwasm.bindings.TreeView;
11 
12 @safe:
13 nothrow:
14 
15 struct TreeContentView {
16   nothrow:
17   JsHandle handle;
18   alias handle this;
19   this(Handle h) {
20     this.handle = JsHandle(h);
21   }
22   auto getItemAtIndex()(int row) {
23     return recastOpt!(Element)(Object_Call_int__OptionalHandle(this.handle, "getItemAtIndex", row));
24   }
25   int getIndexOfItem(T0)(scope auto ref Optional!(T0) item) if (isTOrPointer!(T0, Element)) {
26     return Serialize_Object_VarArgCall!int(this.handle, "getIndexOfItem", "Optional!Handle", tuple(!item.empty, cast(Handle)item.front._parent));
27   }
28   int rowCount()() {
29     return Object_Getter__int(this.handle, "rowCount");
30   }
31   void selection(T0)(scope auto ref Optional!(T0) selection) if (isTOrPointer!(T0, nsITreeSelection)) {
32     Serialize_Object_VarArgCall!void(this.handle, "selection", "Optional!Handle", tuple(!selection.empty, cast(Handle)selection.front.handle));
33   }
34   auto selection()() {
35     return recastOpt!(nsITreeSelection)(Object_Getter__OptionalHandle(this.handle, "selection"));
36   }
37   string getRowProperties()(int row) {
38     return Serialize_Object_VarArgCall!string(this.handle, "getRowProperties", "int", tuple(row));
39   }
40   string getCellProperties()(int row, scope ref TreeColumn column) {
41     return Serialize_Object_VarArgCall!string(this.handle, "getCellProperties", "int;Handle", tuple(row, cast(Handle)column.handle));
42   }
43   string getColumnProperties()(scope ref TreeColumn column) {
44     return Serialize_Object_VarArgCall!string(this.handle, "getColumnProperties", "Handle", tuple(cast(Handle)column.handle));
45   }
46   bool isContainer()(int row) {
47     return Serialize_Object_VarArgCall!bool(this.handle, "isContainer", "int", tuple(row));
48   }
49   bool isContainerOpen()(int row) {
50     return Serialize_Object_VarArgCall!bool(this.handle, "isContainerOpen", "int", tuple(row));
51   }
52   bool isContainerEmpty()(int row) {
53     return Serialize_Object_VarArgCall!bool(this.handle, "isContainerEmpty", "int", tuple(row));
54   }
55   bool isSeparator()(int row) {
56     return Serialize_Object_VarArgCall!bool(this.handle, "isSeparator", "int", tuple(row));
57   }
58   bool isSorted()() {
59     return Object_Getter__bool(this.handle, "isSorted");
60   }
61   enum short DROP_BEFORE = -1;
62   enum short DROP_ON = 0;
63   enum short DROP_AFTER = 1;
64   bool canDrop(T2)(int row, int orientation, scope auto ref Optional!(T2) dataTransfer) if (isTOrPointer!(T2, DataTransfer)) {
65     return Serialize_Object_VarArgCall!bool(this.handle, "canDrop", "int;int;Optional!Handle", tuple(row, orientation, !dataTransfer.empty, cast(Handle)dataTransfer.front.handle));
66   }
67   void drop(T2)(int row, int orientation, scope auto ref Optional!(T2) dataTransfer) if (isTOrPointer!(T2, DataTransfer)) {
68     Serialize_Object_VarArgCall!void(this.handle, "drop", "int;int;Optional!Handle", tuple(row, orientation, !dataTransfer.empty, cast(Handle)dataTransfer.front.handle));
69   }
70   int getParentIndex()(int row) {
71     return Serialize_Object_VarArgCall!int(this.handle, "getParentIndex", "int", tuple(row));
72   }
73   bool hasNextSibling()(int row, int afterIndex) {
74     return Serialize_Object_VarArgCall!bool(this.handle, "hasNextSibling", "int;int", tuple(row, afterIndex));
75   }
76   int getLevel()(int row) {
77     return Serialize_Object_VarArgCall!int(this.handle, "getLevel", "int", tuple(row));
78   }
79   string getImageSrc()(int row, scope ref TreeColumn column) {
80     return Serialize_Object_VarArgCall!string(this.handle, "getImageSrc", "int;Handle", tuple(row, cast(Handle)column.handle));
81   }
82   string getCellValue()(int row, scope ref TreeColumn column) {
83     return Serialize_Object_VarArgCall!string(this.handle, "getCellValue", "int;Handle", tuple(row, cast(Handle)column.handle));
84   }
85   string getCellText()(int row, scope ref TreeColumn column) {
86     return Serialize_Object_VarArgCall!string(this.handle, "getCellText", "int;Handle", tuple(row, cast(Handle)column.handle));
87   }
88   void setTree(T0)(scope auto ref Optional!(T0) tree) if (isTOrPointer!(T0, XULTreeElement)) {
89     Serialize_Object_VarArgCall!void(this.handle, "setTree", "Optional!Handle", tuple(!tree.empty, cast(Handle)tree.front.handle));
90   }
91   void toggleOpenState()(int row) {
92     Object_Call_int__void(this.handle, "toggleOpenState", row);
93   }
94   void cycleHeader()(scope ref TreeColumn column) {
95     Object_Call_Handle__void(this.handle, "cycleHeader", column.handle);
96   }
97   void selectionChanged()() {
98     Object_Call__void(this.handle, "selectionChanged");
99   }
100   void cycleCell()(int row, scope ref TreeColumn column) {
101     Serialize_Object_VarArgCall!void(this.handle, "cycleCell", "int;Handle", tuple(row, cast(Handle)column.handle));
102   }
103   bool isEditable()(int row, scope ref TreeColumn column) {
104     return Serialize_Object_VarArgCall!bool(this.handle, "isEditable", "int;Handle", tuple(row, cast(Handle)column.handle));
105   }
106   void setCellValue()(int row, scope ref TreeColumn column, string value) {
107     Serialize_Object_VarArgCall!void(this.handle, "setCellValue", "int;Handle;string", tuple(row, cast(Handle)column.handle, value));
108   }
109   void setCellText()(int row, scope ref TreeColumn column, string value) {
110     Serialize_Object_VarArgCall!void(this.handle, "setCellText", "int;Handle;string", tuple(row, cast(Handle)column.handle, value));
111   }
112   void performAction()(string action) {
113     Object_Call_string__void(this.handle, "performAction", action);
114   }
115   void performActionOnRow()(string action, int row) {
116     Serialize_Object_VarArgCall!void(this.handle, "performActionOnRow", "string;int", tuple(action, row));
117   }
118   void performActionOnCell()(string action, int row, scope ref TreeColumn column) {
119     Serialize_Object_VarArgCall!void(this.handle, "performActionOnCell", "string;int;Handle", tuple(action, row, cast(Handle)column.handle));
120   }
121   auto QueryInterface(T0)(scope auto ref T0 iid) {
122     // Any
123     Handle _handle_iid = getOrCreateHandle(iid);
124     auto result = nsISupports(Object_Call_Handle__Handle(this.handle, "QueryInterface", _handle_iid));
125     dropHandle!(T0)(_handle_iid);
126     return result;
127   }
128 }
129 
130