Changeset 249 for trunk/src/plugins


Ignore:
Timestamp:
Jan 25, 2010, 3:18:36 PM (16 years ago)
Author:
lpino
Message:
  • Initial implementation work
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  
    33/*
    44 * OS/2 version.
    5  * Copyright (c) 2002, 2009 EclipseOS2 Team.
     5 * Copyright (c) 2002, 2010 EclipseOS2 Team.
    66 */
    77
     
    206206        state &= ~CANVAS;
    207207       
     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);
    208212        /* Set the checkbox image list */
    209213//      if ((style & SWT.CHECK) != 0) setCheckboxImageList ();
     
    225229}
    226230
    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         // }
     231void 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;
    236254        // TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT ();
    237255        // tvInsert.hParent = hParent;
     
    280298                // OS.InvalidateRect (handle, rect, false);
    281299        // }
    282 // }
     300}
    283301
    284302void createWidget () {
     
    287305}
    288306
    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
    293311/**
    294312 * Deselects all selected items in the receiver.
     
    10561074 */
    10571075 int widgetStyle () {
    1058          int bits = super.widgetStyle () | OS.CCS_MINIRECORDCORE;
     1076         int bits = super.widgetStyle () | OS.CCS_READONLY | OS.CCS_AUTOPOSITION;
    10591077//       bits |= OS.TVS_LINESATROOT | OS.TVS_HASLINES | OS.TVS_HASBUTTONS;
    10601078        // /*
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/TreeItem.java

    r239 r249  
    6666        super (parent, style);
    6767        this.parent = parent;
    68 //      parent.createItem (this, 0, OS.TVI_LAST);
     68        parent.createItem (this, 0, OS.CMA_END);
    6969}
    7070
     
    100100 * @see Widget#getStyle
    101101 */
    102 /* public TreeItem (Tree parent, int style, int index) {
     102 public TreeItem (Tree parent, int style, int index) {
    103103        super (parent, style);
    104104        if (index < 0) error (SWT.ERROR_INVALID_RANGE);
    105105        this.parent = parent;
    106         int hItem = OS.TVI_FIRST;
     106        int hItem = OS.CMA_FIRST;
    107107        if (index != 0) {
    108108                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));
    110112                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));
    112115                        count++;
    113116                }
     
    116119        parent.createItem (this, 0, hItem);
    117120}
    118  */
     121
    119122/**
    120123 * Constructs a new instance of this class given its parent
     
    151154        parent = parentItem.parent;
    152155        int hItem = parentItem.handle;
    153 //      parent.createItem (this, hItem, OS.TVI_LAST);
     156        parent.createItem (this, hItem, OS.CMA_END);
    154157}
    155158
     
    185188 * @see Widget#getStyle
    186189 */
    187 /* public TreeItem (TreeItem parentItem, int style, int index) {
     190 public TreeItem (TreeItem parentItem, int style, int index) {
    188191        super (checkNull (parentItem).parent, style);
    189192        if (index < 0) error (SWT.ERROR_INVALID_RANGE);
    190193        parent = parentItem.parent;
    191         int hItem = OS.TVI_FIRST;
     194        int hItem = OS.CMA_FIRST;
    192195        int hParent = parentItem.handle;
     196        RECORDCORE item = new RECORDCORE();
     197        OS.objcpy (item, parentItem.handle);
    193198        if (index != 0) {
    194199                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));
    196202                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);
    198204                        count++;
    199205                }
     
    202208        parent.createItem (this, hParent, hItem);
    203209}
    204  */
     210
    205211static TreeItem checkNull (TreeItem item) {
    206212        if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
Note: See TracChangeset for help on using the changeset viewer.