Changeset 266 for trunk/src


Ignore:
Timestamp:
May 7, 2011, 12:49:30 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/ProgressBar.java

    r265 r266  
    7171*/
    7272public 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);
    75101}
    76102
     
    88114        int border = getBorderWidth ();
    89115        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);
    93116        if ((style & SWT.HORIZONTAL) != 0) {
    94117                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);
    96119        } 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);
    98121                height += OS.WinQuerySysValue (OS.HWND_DESKTOP, OS.SV_CYVSCROLLARROW ) * 10;
    99122        }
    100         if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
     123        if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
    101124        if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
    102125        return new Point (width, height);
     
    152175*/
    153176public 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;   
    156183}
    157184
     
    192219//      OS.SendMessage (handle, OS.PBM_SETBARCOLOR, 0, pixel);
    193220//}
    194 //
    195 ///**
    196 // * Sets the maximum value which the receiver will allow
    197 // * to be the argument which must be greater than or
    198 // * 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 */
    207234public void setMaximum (int value) {
    208235        checkWidget ();
     
    258285
    259286int 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;
    262290        return bits | OS.SLS_VERTICAL | OS.SLS_HOMETOP;
    263291}
     
    271299}
    272300
    273 MRESULT wmDrawChild (int mp1, int mp2) {
     301/*MRESULT wmDrawChild (int mp1, int mp2) {
    274302    OWNERITEM struct = new OWNERITEM();
    275303    OS.objcpy(struct, mp2);
    276304    System.out.println("ProgressBar:WM_DRAWITEM");
    277305    return null;
    278 /*
     306
    279307switch(SHORT1FROMMP(mp1)){
    280308case SLD_VOLUME:
     
    297325}
    298326
    299 break; */
    300 }
    301 }
     327break;
     328}
     329*/
     330}
Note: See TracChangeset for help on using the changeset viewer.