Changeset 81

Show
Ignore:
Timestamp:
12/26/05 09:57:57 (3 years ago)
Author:
Shawn Liu
Message:

CBanner updated to SWT 3.10 now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/current/win32/import/dwt/all.d

    r76 r81  
    7777public import dwt.custom.busyindicator; 
    7878public import dwt.custom.cbanner; 
     79public import dwt.custom.cbannerlayout; 
    7980public import dwt.custom.ccombo; 
    8081public import dwt.custom.clabel; 
     82public import dwt.custom.clayoutdata; 
    8183public import dwt.custom.controleditor; 
    8284public import dwt.custom.ctabfolder; 
  • trunk/current/win32/import/dwt/custom/cbanner.d

    r76 r81  
    1111module dwt.custom.cbanner; 
    1212 
     13/** 
     14 * This class has been updated to Eclispe/SWT 3.10  
     15 * <Shawn Liu>  (2005.12.26) 
     16 */ 
     17 
    1318 
    1419private import dwt.dwt; 
    1520 
     21private import dwt.custom.cbannerlayout; 
    1622private import dwt.graphics.color; 
    1723private import dwt.graphics.cursor; 
     
    6773     
    6874    int rightWidth = DWT.DEFAULT; 
     75    int rightMinWidth = DWT.DEFAULT; 
     76    int rightMinHeight = DWT.DEFAULT; 
     77     
    6978    Cursor resizeCursor; 
    7079    boolean dragging = false; 
     
    7988    static int BEZIER_LEFT = 30; 
    8089    static int MIN_LEFT = 10; 
    81     static int MIN_RIGHT = 160; 
     90    // static int MIN_RIGHT = 160; 
    8291     
    8392    static int BORDER1 = DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW; 
     
    112121     
    113122    super(parent, checkStyle(style)); 
     123    super.setLayout(new CBannerLayout()); 
    114124    resizeCursor = new Cursor(getDisplay(), DWT.CURSOR_SIZEWE); 
    115125 
     
    172182    return polygon; 
    173183} 
     184 
    174185static int checkStyle (int style) { 
    175186    return DWT.NONE; 
    176187} 
     188 
     189/+ the following two removed @since 3.10 
     190 
    177191public Point computeSize(int wHint, int hHint, boolean changed) { 
    178192    checkWidget(); 
     
    228242    return new Rectangle(x, y, width, height); 
    229243} 
     244+/ 
     245 
    230246/** 
    231247* Returns the Control that appears on the bottom side of the banner. 
     
    281297    return right; 
    282298} 
     299 
     300/** 
     301 * Returns the minimum size of the control that appears on the right of the banner. 
     302 *  
     303 * @return the minimum size of the control that appears on the right of the banner 
     304 *  
     305 * @since 3.1 
     306 */ 
     307public Point getRightMinimumSize() { 
     308    checkWidget(); 
     309    return new Point(rightMinWidth, rightMinHeight); 
     310} 
     311 
    283312/** 
    284313 * Returns the width of the control that appears on the right of the banner. 
     
    291320    checkWidget(); 
    292321    if (right is null) return 0; 
    293     if (rightWidth == DWT.DEFAULT) return right.computeSize(DWT.DEFAULT, getSize().y).x; 
     322    if (rightWidth == DWT.DEFAULT) { 
     323        Point size = right.computeSize(DWT.DEFAULT, getSize().y, false); 
     324        return size.x; 
     325    } 
    294326    return rightWidth; 
    295327} 
     
    306338    return simple; 
    307339} 
     340 
     341/+ removed @since 3.1  
    308342public void layout (boolean changed) { 
    309343    checkWidget(); 
     
    371405    if (leftRect !is null) left.setBounds(leftRect); 
    372406} 
     407+/ 
     408 
    373409void onDispose() { 
    374410    if (resizeCursor !is null) resizeCursor.dispose(); 
     
    389425    if (dragging) { 
    390426        Point size = getSize(); 
     427//      if (!(0 < x && x < size.x)) return; 
     428//      rightWidth = size.x - x - rightDragDisplacement; 
     429//      rightWidth = Math.max(MIN_RIGHT, rightWidth); 
     430//      super.layout(); 
    391431        if (!(0 < x && x < size.x)) return; 
    392         rightWidth = size.x - x - rightDragDisplacement; 
    393         rightWidth = Math.max(MIN_RIGHT, rightWidth); 
    394         super.layout(); 
     432        rightWidth = Math.max(0, size.x - x - rightDragDisplacement); 
     433        if (rightMinWidth != DWT.DEFAULT) { 
     434            rightWidth = Math.max(rightMinWidth, rightWidth); 
     435        } 
     436        layout(false); 
    395437        return; 
    396438    } 
     
    416458    if (bottom !is null && (left !is null || right !is null)) { 
    417459        gc.setForeground(border1); 
    418         int y = bottom.getBounds().y - BORDER_BOTTOM - BORDER_STRIPE; 
     460//      int y = bottom.getBounds().y - BORDER_BOTTOM - BORDER_STRIPE; 
     461        int y = bottom.getBounds().y - BORDER_STRIPE - 1; 
    419462        gc.drawLine(0, y, size.x, y); 
    420463    } 
     
    482525void onResize() { 
    483526    updateCurve(getSize().y); 
    484   super.layout(); 
     527//    super.layout(); 
    485528} 
    486529/** 
     
    509552    } 
    510553    bottom = control; 
    511     super.layout(); 
     554    layout(false); 
    512555} 
    513556/** 
     
    555598    } 
    556599    left = control; 
    557     super.layout(); 
     600    layout(false); 
    558601} 
    559602/** 
     
    582625    } 
    583626    right = control; 
    584     super.layout(); 
    585 
     627    layout(false); 
     628
     629 
     630/** 
     631 * Set the minumum height of the control that appears on the right side of the banner. 
     632 *  
     633 * @param size the minimum size of the control on the right 
     634 *  
     635 * @exception SWTException <ul> 
     636 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 
     637 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 
     638 *    <li>ERROR_INVALID_ARGUMENT - if the size is null or the values of size are less than DWT.DEFAULT</li> 
     639 * </ul> 
     640 *  
     641 * @since 3.1 
     642 */ 
     643public void setRightMinimumSize(Point size) { 
     644    checkWidget(); 
     645    if (size is null || size.x < DWT.DEFAULT || size.y < DWT.DEFAULT)  
     646        DWT.error(__FILE__, __LINE__, DWT.ERROR_INVALID_ARGUMENT); 
     647    rightMinWidth = size.x; 
     648    rightMinHeight = size.y; 
     649
     650 
    586651/** 
    587652 * Set the width of the control control that appears on the right side of the banner. 
     
    600665    if (width < DWT.DEFAULT) DWT.error(__FILE__, __LINE__, DWT.ERROR_INVALID_ARGUMENT); 
    601666    rightWidth = width; 
    602     layout(true); 
     667    layout(false); 
    603668} 
    604669/** 
     
    626691        } 
    627692        updateCurve(getSize().y); 
    628         super.layout(); 
     693        layout(false); 
    629694        redraw(); 
    630695    }