Changeset 214 for trunk/src


Ignore:
Timestamp:
Oct 23, 2009, 8:54:00 PM (16 years ago)
Author:
lpino
Message:
  • Fix the computeSize method. Now the ControlExample initiates the Scale with the correct size
File:
1 edited

Legend:

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

    r155 r214  
    8080 */
    8181public Scale (Composite parent, int style) {
    82 //      super (parent, checkStyle (style));
    8382    this.parent = parent;
    84     this.style = style;
     83    this.style = checkStyle (style);
    8584    maxRange = 100;
    8685    minRange = 0;
     
    9089    sldcData.usScale1Increments = 10;
    9190    sldcData.usScale1Spacing = 0;
     91//    sldcData.usScale2Increments = 10;
     92//    sldcData.usScale2Spacing = 0;
    9293
    9394    handle = OS.WinCreateWindow (
     
    107108    OS.WinSetWindowUShort (handle, OS.QWS_ID, (short)(handle & 0xFFFF));
    108109    OS.WinSendMsg(handle, OS.SLM_SETTICKSIZE, OS.MPFROM2SHORT((short)OS.SMA_SETALLTICKS, (short)6), 0);
    109 
     110//    OS.WinSendMsg(handle, OS.SLM_SETSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SHAFTDIMENSIONS, (short)0), 3);
     111//    OS.WinSendMsg(handle, OS.SLM_SETSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SLIDERARMDIMENSIONS, (short)0), 3);
    110112    super.register ();
    111113    super.subclass ();
     
    160162        int tick = OS.WinSendMsg(handle, OS.SLM_QUERYTICKSIZE, 1, 0);
    161163        if ((style & SWT.HORIZONTAL) != 0) {
    162                 width += OS.SHORT1FROMMP(shaftLength) + 10;
    163                 height += OS.SHORT2FROMMP(arm) + tick;
     164                width += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CXHSCROLLARROW ) * 10;
     165                height += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYHSCROLL) + tick + OS.SHORT2FROMMP(arm);
    164166        } else {
    165                 width += OS.SHORT2FROMMP(arm) + tick;
    166                 height += OS.SHORT1FROMMP(shaftLength) + 10;
     167                width += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CXVSCROLL) + tick + OS.SHORT2FROMMP(arm);
     168                height += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYVSCROLLARROW ) * 10;
    167169        }
    168170        if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
     
    179181}
    180182
    181 ///**
    182 // * Returns the amount that the receiver's value will be
    183 // * modified by when the up/down (or right/left) arrows
    184 // * are pressed.
    185 // *
    186 // * @return the increment
    187 // *
    188 // * @exception SWTException <ul>
    189 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    190 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    191 // * </ul>
    192 // */
     183/**
     184 * Returns the amount that the receiver's value will be
     185 * modified by when the up/down (or right/left) arrows
     186 * are pressed.
     187 *
     188 * @return the increment
     189 *
     190 * @exception SWTException <ul>
     191 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     192 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     193 * </ul>
     194 */
    193195public int getIncrement () {
    194196        checkWidget ();
     
    196198}
    197199
    198 ///**
    199 // * Returns the maximum value which the receiver will allow.
    200 // *
    201 // * @return the maximum
    202 // *
    203 // * @exception SWTException <ul>
    204 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    205 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    206 // * </ul>
    207 // */
     200/**
     201 * Returns the maximum value which the receiver will allow.
     202 *
     203 * @return the maximum
     204 *
     205 * @exception SWTException <ul>
     206 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     207 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     208 * </ul>
     209 */
    208210public int getMaximum () {
    209211        checkWidget ();
     
    394396
    395397int widgetStyle () {
    396         int bits = super.widgetStyle () | OS.SLS_CENTER | OS.SLS_HOMELEFT | OS.SLS_PRIMARYSCALE1;
    397         if ((style & SWT.VERTICAL) != 0) return bits | OS.SLS_VERTICAL | OS.SLS_HOMETOP;
    398         return bits;
     398        int bits = super.widgetStyle () | OS.SLS_CENTER | OS.SLS_PRIMARYSCALE1 | OS.WS_TABSTOP;// | OS.SLS_PRIMARYSCALE2;
     399        if ((style & SWT.HORIZONTAL) != 0) return bits | OS.SLS_HORIZONTAL | OS.SLS_HOMELEFT;
     400        return bits | OS.SLS_VERTICAL | OS.SLS_HOMETOP;
    399401}
    400402
     
    410412    int code = OS.SHORT2FROMMP(mp1);
    411413    int pos = mp2;
    412     if (code == OS.SLN_KILLFOCUS || code == OS.SLN_SETFOCUS) return null;
     414//    if (code == OS.SLN_KILLFOCUS || code == OS.SLN_SETFOCUS) return null;
    413415    Event event = new Event ();
    414416        switch (code) {
     
    426428//              case OS.TB_PAGEDOWN:            event.detail = SWT.PAGE_DOWN;  break;
    427429//              case OS.TB_PAGEUP:              event.detail = SWT.PAGE_UP;  break;
     430                case OS.SLN_SETFOCUS:
     431                case OS.SLN_KILLFOCUS:
     432                        sendEvent(code == OS.SLN_SETFOCUS ? SWT.FocusIn : SWT.FocusOut);
     433                        if(isDisposed()) return MRESULT.ZERO;
     434                        break;
    428435        }
    429436    sendEvent (SWT.Selection, event);
Note: See TracChangeset for help on using the changeset viewer.