Show
Ignore:
Timestamp:
05/17/08 11:34:28 (8 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Update to SWT 3.4M7

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/custom/TableCursor.d

    r212 r213  
    161161    Listener tableListener, resizeListener, disposeItemListener, disposeColumnListener; 
    162162 
     163    Color background = null; 
     164    Color foreground = null; 
     165 
    163166    // By default, invert the list selection colors 
    164167    static final int BACKGROUND = DWT.COLOR_LIST_SELECTION_TEXT; 
     
    254257    disposeItemListener = new class() Listener { 
    255258        public void handleEvent(Event event) { 
     259            unhookRowColumnListeners(); 
    256260            row = null; 
    257261            column = null; 
     
    261265    disposeColumnListener = new class() Listener { 
    262266        public void handleEvent(Event event) { 
     267            unhookRowColumnListeners(); 
    263268            row = null; 
    264269            column = null; 
     
    320325    table.removeListener(DWT.FocusIn, tableListener); 
    321326    table.removeListener(DWT.MouseDown, tableListener); 
    322     if (column !is null) { 
    323         column.removeListener(DWT.Dispose, disposeColumnListener); 
    324         column.removeListener(DWT.Move, resizeListener); 
    325         column.removeListener(DWT.Resize, resizeListener); 
    326         column = null; 
    327     } 
    328     if (row !is null) { 
    329         row.removeListener(DWT.Dispose, disposeItemListener); 
    330         row = null; 
    331     } 
     327    unhookRowColumnListeners(); 
    332328    ScrollBar hBar = table.getHorizontalBar(); 
    333329    if (hBar !is null) { 
     
    493489 
    494490void tableFocusIn(Event event) { 
    495     if (isDisposed()) 
    496         return; 
    497     if (isVisible()) 
     491    if (isDisposed()) return; 
     492    if (isVisible()) { 
     493        if (row is null && column is null) return; 
    498494        setFocus(); 
     495    } 
    499496} 
    500497 
     
    523520    TableColumn newColumn = null; 
    524521    int columnCount = table.getColumnCount(); 
    525     if (columnCount > 0) { 
     522    if (columnCount is 0) { 
     523        if ((table.getStyle() & DWT.FULL_SELECTION) is 0) { 
     524            Rectangle rect = item.getBounds(0); 
     525            rect.width += lineWidth; 
     526            rect.height += lineWidth; 
     527            if (!rect.contains(pt)) return; 
     528        } 
     529    } else { 
    526530        for (int i = 0; i < columnCount; i++) { 
    527531            Rectangle rect = item.getBounds(i); 
     
    534538        } 
    535539        if (newColumn is null) { 
     540            if ((table.getStyle() & DWT.FULL_SELECTION) is 0) return; 
    536541            newColumn = table.getColumn(0); 
    537542        } 
     
    639644} 
    640645/** 
     646 * Returns the background color that the receiver will use to draw. 
     647 * 
     648 * @return the receiver's background color 
     649 */ 
     650public Color getBackground() { 
     651    checkWidget(); 
     652    if (background is null) { 
     653        return getDisplay().getSystemColor(BACKGROUND); 
     654    } 
     655    return background; 
     656} 
     657/** 
     658 * Returns the foreground color that the receiver will use to draw. 
     659 * 
     660 * @return the receiver's foreground color 
     661 */ 
     662public Color getForeground() { 
     663    checkWidget(); 
     664    if (foreground is null) { 
     665        return getDisplay().getSystemColor(FOREGROUND); 
     666    } 
     667    return foreground; 
     668} 
     669/** 
    641670 * Returns the row over which the TableCursor is positioned. 
    642671 * 
     
    652681    return row; 
    653682} 
     683/** 
     684 * Sets the receiver's background color to the color specified 
     685 * by the argument, or to the default system color for the control 
     686 * if the argument is null. 
     687 * <p> 
     688 * Note: This operation is a hint and may be overridden by the platform. 
     689 * For example, on Windows the background of a Button cannot be changed. 
     690 * </p> 
     691 * @param color the new color (or null) 
     692 * 
     693 * @exception IllegalArgumentException <ul> 
     694 *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>  
     695 * </ul> 
     696 * @exception DWTException <ul> 
     697 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     698 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 
     699 * </ul> 
     700 */ 
    654701public override void setBackground (Color color) { 
    655     if (color is null) color = getDisplay().getSystemColor(BACKGROUND)
    656     super.setBackground(color); 
     702    background = color
     703    super.setBackground(getBackground()); 
    657704    redraw(); 
    658705} 
     706/** 
     707 * Sets the receiver's foreground color to the color specified 
     708 * by the argument, or to the default system color for the control 
     709 * if the argument is null. 
     710 * <p> 
     711 * Note: This operation is a hint and may be overridden by the platform. 
     712 * </p> 
     713 * @param color the new color (or null) 
     714 * 
     715 * @exception IllegalArgumentException <ul> 
     716 *    <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>  
     717 * </ul> 
     718 * @exception DWTException <ul> 
     719 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     720 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 
     721 * </ul> 
     722 */ 
    659723public override void setForeground (Color color) { 
    660     if (color is null) color = getDisplay().getSystemColor(FOREGROUND)
    661     super.setForeground(color); 
     724    foreground = color
     725    super.setForeground(getForeground()); 
    662726    redraw(); 
    663727} 
     
    708772    setRowColumn(table.indexOf(row), column, false); 
    709773} 
    710 
     774void unhookRowColumnListeners() { 
     775    if (column !is null) { 
     776        column.removeListener(DWT.Dispose, disposeColumnListener); 
     777        column.removeListener(DWT.Move, resizeListener); 
     778        column.removeListener(DWT.Resize, resizeListener); 
     779        column = null; 
     780    } 
     781    if (row !is null) { 
     782        row.removeListener(DWT.Dispose, disposeItemListener); 
     783        row = null; 
     784    } 
     785
     786