Changeset 266 for trunk/src/plugins
- Timestamp:
- May 7, 2011, 12:49:30 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/ProgressBar.java
r265 r266 71 71 */ 72 72 public ProgressBar (Composite parent, int style) { 73 super (parent, checkStyle (style)); 74 OS.WinSendMsg(handle, OS.SLM_SETSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SHAFTDIMENSIONS, (short)0), 15); 73 this.parent = parent; 74 this.style = checkStyle (style); 75 76 SLDCDATA sldcData = new SLDCDATA(); 77 sldcData.usScale1Increments = 10; 78 sldcData.usScale1Spacing = 0; 79 80 handle = OS.WinCreateWindow ( 81 parent.handle, 82 windowClass (), 83 windowTitle (), 84 widgetStyle (), 85 0, parent.getHeight (), 150, 80, 86 parent.handle, 87 OS.HWND_BOTTOM, 88 0, 89 sldcData, 90 0 91 ); 92 if (handle == 0) error (SWT.ERROR_NO_HANDLES); 93 94 OS.WinSetWindowUShort (handle, OS.QWS_ID, (short)(handle & 0xFFFF)); 95 OS.WinSendMsg(handle, OS.SLM_SETSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SHAFTDIMENSIONS, (short)0), 15); 96 super.register (); 97 super.subclass (); 98 super.setDefaultFont (); 99 super.setForegroundPixel (OS.CLR_DEFAULT); 100 super.setBackgroundPixel (OS.CLR_DEFAULT); 75 101 } 76 102 … … 88 114 int border = getBorderWidth (); 89 115 int width = border * 2, height = border * 2; 90 int shaftLength = OS.WinSendMsg(handle, OS.SLM_QUERYSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SHAFTDIMENSIONS, (short)OS.SMA_RANGEVALUE), 0);91 int arm = OS.WinSendMsg(handle, OS.SLM_QUERYSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SLIDERARMDIMENSIONS, (short)OS.SMA_RANGEVALUE), 0);92 int tick = OS.WinSendMsg(handle, OS.SLM_QUERYTICKSIZE, 1, 0);93 116 if ((style & SWT.HORIZONTAL) != 0) { 94 117 width += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CXHSCROLLARROW ) * 10; 95 height += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYHSCROLL) + tick + OS.SHORT2FROMMP(arm);118 height += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYHSCROLL); 96 119 } else { 97 width += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CXVSCROLL) + tick + OS.SHORT2FROMMP(arm);120 width += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CXVSCROLL); 98 121 height += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYVSCROLLARROW ) * 10; 99 122 } 100 if (wHint != SWT.DEFAULT) width = wHint + (border * 2);123 if (wHint != SWT.DEFAULT) width = wHint + (border * 2); 101 124 if (hHint != SWT.DEFAULT) height = hHint + (border * 2); 102 125 return new Point (width, height); … … 152 175 */ 153 176 public int getSelection () { 154 checkWidget (); 155 return position; 177 checkWidget (); 178 int pixelInfo = OS.WinSendMsg(handle, OS.SLM_QUERYSLIDERINFO, OS.MPFROM2SHORT((short)OS.SMA_SLIDERARMPOSITION, (short)OS.SMA_RANGEVALUE ), 0); 179 int posPixels = OS.SHORT1FROMMP(pixelInfo); 180 int totalPixels = OS.SHORT2FROMMP(pixelInfo) - 1; 181 int pos = ((maxRange*posPixels)/totalPixels); 182 return pos; 156 183 } 157 184 … … 192 219 // OS.SendMessage (handle, OS.PBM_SETBARCOLOR, 0, pixel); 193 220 //} 194 // 195 / //**196 //* Sets the maximum value which the receiver will allow197 //* to be the argument which must be greater than or198 //* equal to zero.199 //*200 //* @param value the new maximum (must be zero or greater)201 //*202 //* @exception SWTException <ul>203 //* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>204 //* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>205 //* </ul>206 //*/221 222 /** 223 * Sets the maximum value which the receiver will allow 224 * to be the argument which must be greater than or 225 * equal to zero. 226 * 227 * @param value the new maximum (must be zero or greater) 228 * 229 * @exception SWTException <ul> 230 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> 231 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> 232 * </ul> 233 */ 207 234 public void setMaximum (int value) { 208 235 checkWidget (); … … 258 285 259 286 int widgetStyle () { 260 int bits = super.widgetStyle () | OS.SLS_CENTER | OS.WS_TABSTOP | OS.SLS_RIBBONSTRIP | OS.SLS_READONLY | OS.SLS_PRIMARYSCALE1 | OS.SLS_OWNERDRAW; 261 if ((style & SWT.HORIZONTAL) != 0) return bits | OS.SLS_HORIZONTAL | OS.SLS_HOMELEFT; 287 int bits = super.widgetStyle () | OS.SLS_CENTER | OS.WS_TABSTOP | OS.SLS_RIBBONSTRIP | OS.SLS_READONLY | OS.SLS_PRIMARYSCALE1;// | OS.SLS_OWNERDRAW; 288 if ((style & SWT.HORIZONTAL) != 0) 289 return bits | OS.SLS_HORIZONTAL | OS.SLS_HOMELEFT; 262 290 return bits | OS.SLS_VERTICAL | OS.SLS_HOMETOP; 263 291 } … … 271 299 } 272 300 273 MRESULT wmDrawChild (int mp1, int mp2) {301 /*MRESULT wmDrawChild (int mp1, int mp2) { 274 302 OWNERITEM struct = new OWNERITEM(); 275 303 OS.objcpy(struct, mp2); 276 304 System.out.println("ProgressBar:WM_DRAWITEM"); 277 305 return null; 278 /* 306 279 307 switch(SHORT1FROMMP(mp1)){ 280 308 case SLD_VOLUME: … … 297 325 } 298 326 299 break; */ 300 } 301 } 327 break; 328 } 329 */ 330 }
Note:
See TracChangeset
for help on using the changeset viewer.