Ignore:
Timestamp:
May 7, 2011, 12:56:05 AM (14 years ago)
Author:
lpino
Message:
  • Fixes and cleaning
File:
1 edited

Legend:

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

    r214 r267  
    33/*
    44 * OS/2 version.
    5  * Copyright (c) 2002, 2009 EclipseOS2 Team.
     5 * Copyright (c) 2002, 2011 EclipseOS2 Team.
    66 */
    77
     
    8282    this.parent = parent;
    8383    this.style = checkStyle (style);
    84     maxRange = 100;
    85     minRange = 0;
    86     increment = 10;
    8784
    8885    SLDCDATA sldcData = new SLDCDATA();
    8986    sldcData.usScale1Increments = 10;
    9087    sldcData.usScale1Spacing = 0;
    91 //    sldcData.usScale2Increments = 10;
    92 //    sldcData.usScale2Spacing = 0;
    9388
    9489    handle = OS.WinCreateWindow (
     
    9792        windowTitle (),
    9893        widgetStyle (),
    99         0, parent.getHeight (), 0, 0,
     94        0, parent.getHeight (), 150, 80,
    10095        parent.handle,
    10196        OS.HWND_BOTTOM,
     
    115110    super.setForegroundPixel (OS.CLR_DEFAULT);
    116111    super.setBackgroundPixel (OS.CLR_DEFAULT);
    117 
    118112}
    119113
     
    213207}
    214208
    215 ///**
    216 // * Returns the minimum value which the receiver will allow.
    217 // *
    218 // * @return the minimum
    219 // *
    220 // * @exception SWTException <ul>
    221 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    222 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    223 // * </ul>
    224 // */
     209/**
     210 * Returns the minimum value which the receiver will allow.
     211 *
     212 * @return the minimum
     213 *
     214 * @exception SWTException <ul>
     215 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     216 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     217 * </ul>
     218 */
    225219public int getMinimum () {
    226220        checkWidget ();
     
    228222}
    229223
    230 ///**
    231 // * Returns the amount that the receiver's value will be
    232 // * modified by when the page increment/decrement areas
    233 // * are selected.
    234 // *
    235 // * @return the page increment
    236 // *
    237 // * @exception SWTException <ul>
    238 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    239 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    240 // * </ul>
    241 // */
     224/**
     225 * Returns the amount that the receiver's value will be
     226 * modified by when the page increment/decrement areas
     227 * are selected.
     228 *
     229 * @return the page increment
     230 *
     231 * @exception SWTException <ul>
     232 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     233 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     234 * </ul>
     235*/
    242236public int getPageIncrement () {
    243237        checkWidget ();
    244238        return increment;
    245 //      return OS.SendMessage (handle, OS.TBM_GETPAGESIZE, 0, 0);
    246 }
    247 
    248 ///**
    249 // * Returns the single <em>selection</em> that is the receiver's position.
    250 // *
    251 // * @return the selection
    252 // *
    253 // * @exception SWTException <ul>
    254 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    255 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    256 // * </ul>
    257 // */
     239}
     240
     241/**
     242 * Returns the single <em>selection</em> that is the receiver's position.
     243 *
     244 * @return the selection
     245 *
     246 * @exception SWTException <ul>
     247 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     248 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     249 * </ul>
     250*/
    258251public int getSelection () {
    259252        checkWidget ();
     
    265258}
    266259
    267 ///**
    268 // * Removes the listener from the collection of listeners who will
    269 // * be notified when the receiver's value changes.
    270 // *
    271 // * @param listener the listener which should no longer be notified
    272 // *
    273 // * @exception IllegalArgumentException <ul>
    274 // *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
    275 // * </ul>
    276 // * @exception SWTException <ul>
    277 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    278 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    279 // * </ul>
    280 // *
    281 // * @see SelectionListener
    282 // * @see #addSelectionListener
    283 // */
     260/**
     261 * Removes the listener from the collection of listeners who will
     262 * be notified when the receiver's value changes.
     263 *
     264 * @param listener the listener which should no longer be notified
     265 *
     266 * @exception IllegalArgumentException <ul>
     267 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
     268 * </ul>
     269 * @exception SWTException <ul>
     270 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     271 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     272 * </ul>
     273 *
     274 * @see SelectionListener
     275 * @see #addSelectionListener
     276*/
    284277public void removeSelectionListener(SelectionListener listener) {
    285278        checkWidget ();
     
    290283}
    291284
    292 ///**
    293 // * Sets the amount that the receiver's value will be
    294 // * modified by when the up/down (or right/left) arrows
    295 // * are pressed to the argument, which must be at least
    296 // * one.
    297 // *
    298 // * @param value the new increment (must be greater than zero)
    299 // *
    300 // * @exception SWTException <ul>
    301 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    302 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    303 // * </ul>
    304 // */
     285/**
     286 * Sets the amount that the receiver's value will be
     287 * modified by when the up/down (or right/left) arrows
     288 * are pressed to the argument, which must be at least
     289 * one.
     290 *
     291 * @param value the new increment (must be greater than zero)
     292 *
     293 * @exception SWTException <ul>
     294 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     295 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     296 * </ul>
     297*/
    305298public void setIncrement (int increment) {
    306299        checkWidget ();
     
    312305}
    313306
    314 ///**
    315 // * Sets the maximum value which the receiver will allow
    316 // * to be the argument which must be greater than or
    317 // * equal to zero.
    318 // *
    319 // * @param value the new maximum (must be zero or greater)
    320 // *
    321 // * @exception SWTException <ul>
    322 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    323 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    324 // * </ul>
    325 // */
     307/**
     308 * Sets the maximum value which the receiver will allow
     309 * to be the argument which must be greater than or
     310 * equal to zero.
     311 *
     312 * @param value the new maximum (must be zero or greater)
     313 *
     314 * @exception SWTException <ul>
     315 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     316 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     317 * </ul>
     318 */
    326319public void setMaximum (int value) {
    327320        checkWidget ();
    328 //      int minimum = OS.SendMessage (handle, OS.TBM_GETRANGEMIN, 0, 0);
    329321        if (0 <= minRange && minRange < value) {
    330322                maxRange = value;
     
    332324}
    333325
    334 ///**
    335 // * Sets the minimum value which the receiver will allow
    336 // * to be the argument which must be greater than or
    337 // * equal to zero.
    338 // *
    339 // * @param value the new minimum (must be zero or greater)
    340 // *
    341 // * @exception SWTException <ul>
    342 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    343 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    344 // * </ul>
    345 // */
     326/**
     327 * Sets the minimum value which the receiver will allow
     328 * to be the argument which must be greater than or
     329 * equal to zero.
     330 *
     331 * @param value the new minimum (must be zero or greater)
     332 *
     333 * @exception SWTException <ul>
     334 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     335 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     336 * </ul>
     337 */
    346338public void setMinimum (int value) {
    347339        checkWidget ();
    348 //      int maximum = OS.SendMessage (handle, OS.TBM_GETRANGEMAX, 0, 0);
    349340        if (0 <= value && value < maxRange) {
    350                 maxRange = value;
     341                minRange = value;
    351342        }
    352343}
    353344
    354 ///**
    355 // * Sets the amount that the receiver's value will be
    356 // * modified by when the page increment/decrement areas
    357 // * are selected to the argument, which must be at least
    358 // * one.
    359 // *
    360 // * @return the page increment (must be greater than zero)
    361 // *
    362 // * @exception SWTException <ul>
    363 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    364 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    365 // * </ul>
    366 // */
     345/**
     346 * Sets the amount that the receiver's value will be
     347 * modified by when the page increment/decrement areas
     348 * are selected to the argument, which must be at least
     349 * one.
     350 *
     351 * @return the page increment (must be greater than zero)
     352 *
     353 * @exception SWTException <ul>
     354 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     355 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     356 * </ul>
     357*/
    367358public void setPageIncrement (int pageIncrement) {
    368359        checkWidget ();
     
    374365}
    375366
    376 ///**
    377 // * Sets the single <em>selection</em> that is the receiver's
    378 // * value to the argument which must be greater than or equal
    379 // * to zero.
    380 // *
    381 // * @param value the new selection (must be zero or greater)
    382 // *
    383 // * @exception SWTException <ul>
    384 // *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
    385 // *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
    386 // * </ul>
    387 // */
     367/**
     368 * Sets the single <em>selection</em> that is the receiver's
     369 * value to the argument which must be greater than or equal
     370 * to zero.
     371 *
     372 * @param value the new selection (must be zero or greater)
     373 *
     374 * @exception SWTException <ul>
     375 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
     376 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
     377 * </ul>
     378 */
    388379public void setSelection (int value) {
    389380        checkWidget ();
     
    392383        int totalPixels = OS.SHORT2FROMMP(pixels) -1;
    393384        int pixelPos = ((value*totalPixels)/maxRange);
    394         OS.WinSendMsg(handle, OS.SLM_SETSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SLIDERARMPOSITION, (short)OS.SMA_RANGEVALUE), pixelPos);
     385        OS.WinSendMsg(handle, OS.SLM_SETSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SLIDERARMPOSITION, (short)OS.SMA_RANGEVALUE), (short)pixelPos);
    395386}
    396387
     
    409400}
    410401
    411 MRESULT wmControlChild (int mp1, int mp2) {
    412     int code = OS.SHORT2FROMMP(mp1);
    413     int pos = mp2;
    414 //    if (code == OS.SLN_KILLFOCUS || code == OS.SLN_SETFOCUS) return null;
    415     Event event = new Event ();
    416         switch (code) {
    417 //              /*
    418 //              * This line is intentionally commented.  Do not set the detail
    419 //              * field to DRAG to indicate that the dragging has ended when the
    420 //              * scroll bar is finally positioned in TB_THUMBPOSITION.
    421 //              */
    422 ////            case OS.TB_THUMBPOSITION:       break;
    423                 case OS.SLN_SLIDERTRACK:                event.detail = SWT.DRAG;  break;
    424 //              case OS.TB_TOP:                         event.detail = SWT.HOME;  break;
    425 //              case OS.TB_BOTTOM:              event.detail = SWT.END;  break;
    426 //              case OS.TB_LINEDOWN:            event.detail = SWT.ARROW_DOWN;  break;
    427 //              case OS.TB_LINEUP:              event.detail = SWT.ARROW_UP;  break;
    428 //              case OS.TB_PAGEDOWN:            event.detail = SWT.PAGE_DOWN;  break;
    429 //              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;
     402 MRESULT wmControlChild (int mp1, int mp2) {
     403     int code = OS.SHORT2FROMMP(mp1);
     404     int pos = mp2;
     405     Event event = new Event ();
     406     switch (code) {
     407                case OS.SLN_SLIDERTRACK:
     408                        postEvent (SWT.Selection);
    434409                        break;
    435         }
    436     sendEvent (SWT.Selection, event);
    437     return null;
    438 }
    439 
    440 }
     410                 // case OS.SLN_CHANGE:
     411                        // // event.detail = SWT.DRAG;
     412                        // postEvent (SWT.Selection);
     413                        // break;
     414
     415                 case OS.SLN_SETFOCUS:
     416                 case OS.SLN_KILLFOCUS:
     417                         sendEvent(code == OS.SLN_SETFOCUS ? SWT.FocusIn : SWT.FocusOut);
     418                         if(isDisposed()) return MRESULT.ZERO;
     419                         break;
     420         }
     421     return super.wmControlChild (mp1, mp2);;
     422 }
     423
     424}
Note: See TracChangeset for help on using the changeset viewer.