- Timestamp:
- Jan 25, 2010, 3:18:36 PM (16 years ago)
- Location:
- trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Tree.java
r239 r249 3 3 /* 4 4 * OS/2 version. 5 * Copyright (c) 2002, 20 09EclipseOS2 Team.5 * Copyright (c) 2002, 2010 EclipseOS2 Team. 6 6 */ 7 7 … … 206 206 state &= ~CANVAS; 207 207 208 /* Set the container's view */ 209 CNRINFO cnrInfo = new CNRINFO(); 210 cnrInfo.flWindowAttr = OS.CV_TREE | OS.CV_ICON; 211 OS.WinSendMsg(handle, OS.CM_SETCNRINFO, cnrInfo, OS.CMA_FLWINDOWATTR); 208 212 /* Set the checkbox image list */ 209 213 // if ((style & SWT.CHECK) != 0) setCheckboxImageList (); … … 225 229 } 226 230 227 // void createItem (TreeItem item, int hParent, int hInsertAfter) { 228 // item.foreground = item.background = -1; 229 // int id = 0; 230 // while (id < items.length && items [id] != null) id++; 231 // if (id == items.length) { 232 // TreeItem [] newItems = new TreeItem [items.length + 4]; 233 // System.arraycopy (items, 0, newItems, 0, items.length); 234 // items = newItems; 235 // } 231 void createItem (TreeItem item, int hParent, int hInsertAfter) { 232 item.foreground = item.background = -1; 233 int id = 0; 234 while (id < items.length && items [id] != null) id++; 235 if (id == items.length) { 236 TreeItem [] newItems = new TreeItem [items.length + 4]; 237 System.arraycopy (items, 0, newItems, 0, items.length); 238 items = newItems; 239 } 240 int hItem = OS.WinSendMsg(handle, OS.CM_ALLOCRECORD, 0, 1); 241 item.handle = hItem; 242 RECORDCORE struct = new RECORDCORE(); 243 OS.objcpy(struct, hItem); 244 RECORDINSERT recsIn = new RECORDINSERT(); 245 recsIn.pRecordParent = hParent; 246 recsIn.pRecordOrder = hInsertAfter; 247 recsIn.zOrder = OS.CMA_TOP; 248 recsIn.fInvalidateRecord = OS.TRUE; 249 recsIn.cRecordsInsert = 1; 250 /* Insert the item */ 251 int count = OS.WinSendMsg(handle, OS.CM_INSERTRECORD, struct, recsIn); 252 if (count == 0) error (SWT.ERROR_ITEM_NOT_ADDED); 253 items [id] = item; 236 254 // TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT (); 237 255 // tvInsert.hParent = hParent; … … 280 298 // OS.InvalidateRect (handle, rect, false); 281 299 // } 282 //}300 } 283 301 284 302 void createWidget () { … … 287 305 } 288 306 289 /*int defaultBackground () {290 return OS. GetSysColor (OS.COLOR_WINDOW);291 } 292 */ 307 int defaultBackground () { 308 return OS.WinQuerySysColor(super.handle, OS.SYSCLR_WINDOW, 0); 309 } 310 293 311 /** 294 312 * Deselects all selected items in the receiver. … … 1056 1074 */ 1057 1075 int widgetStyle () { 1058 int bits = super.widgetStyle () | OS.CCS_ MINIRECORDCORE;1076 int bits = super.widgetStyle () | OS.CCS_READONLY | OS.CCS_AUTOPOSITION; 1059 1077 // bits |= OS.TVS_LINESATROOT | OS.TVS_HASLINES | OS.TVS_HASBUTTONS; 1060 1078 // /* -
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/TreeItem.java
r239 r249 66 66 super (parent, style); 67 67 this.parent = parent; 68 // parent.createItem (this, 0, OS.TVI_LAST);68 parent.createItem (this, 0, OS.CMA_END); 69 69 } 70 70 … … 100 100 * @see Widget#getStyle 101 101 */ 102 /*public TreeItem (Tree parent, int style, int index) {102 public TreeItem (Tree parent, int style, int index) { 103 103 super (parent, style); 104 104 if (index < 0) error (SWT.ERROR_INVALID_RANGE); 105 105 this.parent = parent; 106 int hItem = OS. TVI_FIRST;106 int hItem = OS.CMA_FIRST; 107 107 if (index != 0) { 108 108 int count = 1, hwnd = parent.handle; 109 hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); 109 RECORDCORE item = new RECORDCORE(); 110 // hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0); 111 hItem = OS.WinSendMsg (hwnd, OS.CM_QUERYRECORD, item, OS.MPFROM2SHORT((short)OS.CMA_FIRST, (short)OS.CMA_ITEMORDER)); 110 112 while (hItem != 0 && count < index) { 111 hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); 113 // hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); 114 hItem = OS.WinSendMsg (hwnd, OS.CM_QUERYRECORD, item, OS.MPFROM2SHORT((short)OS.CMA_NEXT, (short)OS.CMA_ITEMORDER)); 112 115 count++; 113 116 } … … 116 119 parent.createItem (this, 0, hItem); 117 120 } 118 */ 121 119 122 /** 120 123 * Constructs a new instance of this class given its parent … … 151 154 parent = parentItem.parent; 152 155 int hItem = parentItem.handle; 153 // parent.createItem (this, hItem, OS.TVI_LAST);156 parent.createItem (this, hItem, OS.CMA_END); 154 157 } 155 158 … … 185 188 * @see Widget#getStyle 186 189 */ 187 /*public TreeItem (TreeItem parentItem, int style, int index) {190 public TreeItem (TreeItem parentItem, int style, int index) { 188 191 super (checkNull (parentItem).parent, style); 189 192 if (index < 0) error (SWT.ERROR_INVALID_RANGE); 190 193 parent = parentItem.parent; 191 int hItem = OS. TVI_FIRST;194 int hItem = OS.CMA_FIRST; 192 195 int hParent = parentItem.handle; 196 RECORDCORE item = new RECORDCORE(); 197 OS.objcpy (item, parentItem.handle); 193 198 if (index != 0) { 194 199 int count = 1, hwnd = parent.handle; 195 hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent); 200 // hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent); 201 hItem = OS.WinSendMsg (hwnd, OS.CM_QUERYRECORD, item, OS.MPFROM2SHORT((short)OS.CMA_FIRSTCHILD, (short)OS.CMA_ITEMORDER)); 196 202 while (hItem != 0 && count < index) { 197 hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);203 // hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem); 198 204 count++; 199 205 } … … 202 208 parent.createItem (this, hParent, hItem); 203 209 } 204 */ 210 205 211 static TreeItem checkNull (TreeItem item) { 206 212 if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
Note:
See TracChangeset
for help on using the changeset viewer.