Changeset 267 for trunk/src/plugins/org.eclipse.swt
- Timestamp:
- May 7, 2011, 12:56:05 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Scale.java
r214 r267 3 3 /* 4 4 * OS/2 version. 5 * Copyright (c) 2002, 20 09EclipseOS2 Team.5 * Copyright (c) 2002, 2011 EclipseOS2 Team. 6 6 */ 7 7 … … 82 82 this.parent = parent; 83 83 this.style = checkStyle (style); 84 maxRange = 100;85 minRange = 0;86 increment = 10;87 84 88 85 SLDCDATA sldcData = new SLDCDATA(); 89 86 sldcData.usScale1Increments = 10; 90 87 sldcData.usScale1Spacing = 0; 91 // sldcData.usScale2Increments = 10;92 // sldcData.usScale2Spacing = 0;93 88 94 89 handle = OS.WinCreateWindow ( … … 97 92 windowTitle (), 98 93 widgetStyle (), 99 0, parent.getHeight (), 0,0,94 0, parent.getHeight (), 150, 80, 100 95 parent.handle, 101 96 OS.HWND_BOTTOM, … … 115 110 super.setForegroundPixel (OS.CLR_DEFAULT); 116 111 super.setBackgroundPixel (OS.CLR_DEFAULT); 117 118 112 } 119 113 … … 213 207 } 214 208 215 / //**216 //* Returns the minimum value which the receiver will allow.217 //*218 //* @return the minimum219 //*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 */ 225 219 public int getMinimum () { 226 220 checkWidget (); … … 228 222 } 229 223 230 / //**231 //* Returns the amount that the receiver's value will be232 //* modified by when the page increment/decrement areas233 //* are selected.234 //*235 //* @return the page increment236 //*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 */ 242 236 public int getPageIncrement () { 243 237 checkWidget (); 244 238 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 */ 258 251 public int getSelection () { 259 252 checkWidget (); … … 265 258 } 266 259 267 / //**268 //* Removes the listener from the collection of listeners who will269 //* be notified when the receiver's value changes.270 //*271 //* @param listener the listener which should no longer be notified272 //*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 SelectionListener282 //* @see #addSelectionListener283 //*/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 */ 284 277 public void removeSelectionListener(SelectionListener listener) { 285 278 checkWidget (); … … 290 283 } 291 284 292 / //**293 //* Sets the amount that the receiver's value will be294 //* modified by when the up/down (or right/left) arrows295 //* are pressed to the argument, which must be at least296 //* 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 */ 305 298 public void setIncrement (int increment) { 306 299 checkWidget (); … … 312 305 } 313 306 314 / //**315 //* Sets the maximum value which the receiver will allow316 //* to be the argument which must be greater than or317 //* 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 */ 326 319 public void setMaximum (int value) { 327 320 checkWidget (); 328 // int minimum = OS.SendMessage (handle, OS.TBM_GETRANGEMIN, 0, 0);329 321 if (0 <= minRange && minRange < value) { 330 322 maxRange = value; … … 332 324 } 333 325 334 / //**335 //* Sets the minimum value which the receiver will allow336 //* to be the argument which must be greater than or337 //* 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 */ 346 338 public void setMinimum (int value) { 347 339 checkWidget (); 348 // int maximum = OS.SendMessage (handle, OS.TBM_GETRANGEMAX, 0, 0);349 340 if (0 <= value && value < maxRange) { 350 m axRange = value;341 minRange = value; 351 342 } 352 343 } 353 344 354 / //**355 //* Sets the amount that the receiver's value will be356 //* modified by when the page increment/decrement areas357 //* are selected to the argument, which must be at least358 //* 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 */ 367 358 public void setPageIncrement (int pageIncrement) { 368 359 checkWidget (); … … 374 365 } 375 366 376 / //**377 //* Sets the single <em>selection</em> that is the receiver's378 //* value to the argument which must be greater than or equal379 //* 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 */ 388 379 public void setSelection (int value) { 389 380 checkWidget (); … … 392 383 int totalPixels = OS.SHORT2FROMMP(pixels) -1; 393 384 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); 395 386 } 396 387 … … 409 400 } 410 401 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); 434 409 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.