Changeset 166 for trunk/src


Ignore:
Timestamp:
Jul 10, 2009, 11:37:28 PM (16 years ago)
Author:
lpino
Message:
  • Fix a lot of bugs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/TabItem.java

    r17 r166  
    239239//}
    240240
    241 //public void setText (String string) {
    242 //      checkWidget();
    243 //      if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
    244 //      int index = parent.indexOf (this);
    245 //      if (index == -1) return;
    246 //      super.setText (string);
    247 //      /*
    248 //      * Bug in Windows.  In version 6.00 of COMCTL32.DLL, tab
    249 //      * items with an image and a label that includes '&' cause
    250 //      * the tab to draw incorrectly (even when doubled '&&').
    251 //      * The image  overlaps the label.  The fix is to remove
    252 //      * all '&' characters from the string.
    253 //      */
    254 //      if (COMCTL32_MAJOR >= 6 && image != null) {
    255 //              if (text.indexOf ('&') != -1) {
    256 //                      int length = string.length ();
    257 //                      char[] text = new char [length];
    258 //                      string.getChars ( 0, length, text, 0);
    259 //                      int i = 0, j = 0;
    260 //                      for (i=0; i<length; i++) {
    261 //                              if (text[i] != '&') text [j++] = text [i];
    262 //                      }
    263 //                      if (j < i) string = new String (text, 0, j);
    264 //              }
    265 //      }
    266 //      int hwnd = parent.handle;
    267 //      int hHeap = OS.GetProcessHeap ();
    268 //      TCHAR buffer = new TCHAR (parent.getCodePage (), string, true);
    269 //      int byteCount = buffer.length () * TCHAR.sizeof;
    270 //      int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
    271 //      OS.MoveMemory (pszText, buffer, byteCount);
    272 //      TCITEM tcItem = new TCITEM ();
    273 //      tcItem.mask = OS.TCIF_TEXT;
    274 //      tcItem.pszText = pszText;
    275 //      int result = OS.SendMessage (hwnd, OS.TCM_SETITEM, index, tcItem);
    276 //      OS.HeapFree (hHeap, 0, pszText);
    277 //}
     241public void setText (String string) {
     242        checkWidget();
     243        if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
     244        int index = parent.indexOf (this);
     245        if (index == -1) return;
     246        super.setText (string);
     247        int hwnd = parent.handle;
     248         PSZ tabText = new PSZ(string);
     249         OS.WinSendMsg (hwnd, OS.BKM_SETTABTEXT, this.parent.itemsID[index], tabText);
     250         parent.setTabDimensions(tabText);
     251}
    278252
    279253/**
Note: See TracChangeset for help on using the changeset viewer.