Changeset 146 for trunk/src


Ignore:
Timestamp:
Jun 2, 2009, 5:40:15 PM (16 years ago)
Author:
lpino
Message:
  • More work toward implementing Scale class
Location:
trunk/src/plugins/org.eclipse.swt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT PI/pm/library/swt.c

    r137 r146  
    376376    if (pszName) releasePSZBytes(env, pszName, c_pszName);
    377377    if (pszClass) releasePSZBytes(env, pszClass, c_pszClass);
     378
     379    return hwnd;
     380}
     381
     382JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_pm_OS_WinCreateWindow__ILorg_eclipse_swt_internal_pm_PSZ_2Lorg_eclipse_swt_internal_pm_PSZ_2IIIIIIIILorg_eclipse_swt_internal_pm_SLDCDATA_2I
     383        (JNIEnv *env, jclass that, jint hwndParent, jobject pszClass,
     384            jobject pszName, jint flStyle, jint x, jint y, jint cx, jint cy, jint hwndOwner,
     385            jint hwndInsertBehind, jint id, jobject pCtlData, jint pPresParams)
     386{
     387    PSZ c_pszClass = NULL;
     388    PSZ c_pszName = NULL;
     389    SLDCDATA c_pCtrlData, *c_ppCtrlData = NULL;
     390    jint hwnd;
     391
     392    DEBUG_CALL("WinCreateWindow\n")
     393
     394    if (pszClass) c_pszClass = getPSZBytes(env, pszClass);
     395    if (pszName) c_pszName = getPSZBytes(env, pszName);
     396    if (pCtlData)
     397        c_ppCtrlData = getSLDCDATAFields(env, pCtlData, &c_pCtrlData, &PGLOB(SLDCDATAFc));
     398
     399
     400    hwnd = (jint)WinCreateWindow((HWND)hwndParent, c_pszClass, c_pszName, flStyle,
     401        x, y, cx, cy, hwndOwner, hwndInsertBehind, id, (PVOID)c_ppCtrlData, (PVOID)pPresParams);
     402
     403    if (pszName) releasePSZBytes(env, pszName, c_pszName);
     404    if (pszClass) releasePSZBytes(env, pszClass, c_pszClass);
     405    if (pCtlData)
     406        setSLDCDATAFields(env, pCtlData, c_ppCtrlData, &PGLOB(SLDCDATAFc));   
    378407
    379408    return hwnd;
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT PI/pm/org/eclipse/swt/internal/pm/OS.java

    r139 r146  
    22402240    PSZ pszName, int flStyle, int x, int y, int cx, int cy, int hwndOwner,
    22412241    int hwndInsertBehind, int id, int pCtlData, int pPresParams);
     2242public static final native int WinCreateWindow (int hwndParent, PSZ pszClass,
     2243    PSZ pszName, int flStyle, int x, int y, int cx, int cy, int hwndOwner,
     2244    int hwndInsertBehind, int id, SLDCDATA pCtlData, int pPresParams);
    22422245public static final native boolean WinDestroyWindow (int hwnd);
    22432246public static final native int WinDefWindowProc (int hwnd, int ulMsgid,
  • trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Scale.java

    r143 r146  
    11package org.eclipse.swt.widgets;
     2
     3/*
     4 * OS/2 version.
     5 * Copyright (c) 2002, 2009 EclipseOS2 Team.
     6 */
    27
    38/*
     
    3338
    3439public class Scale extends Control {
    35         static final int TrackBarProc =0;
    36 //      static final TCHAR TrackBarClass = new TCHAR (0, OS.TRACKBAR_CLASS, true);
     40        static final int TrackBarProc;
    3741        static final PSZ TrackBarClass = PSZ.getAtom (OS.WC_SLIDER);
    38 //      static {
    39 //              WNDCLASS lpWndClass = new WNDCLASS ();
    40 //              OS.GetClassInfo (0, TrackBarClass, lpWndClass);
    41 //              TrackBarProc = lpWndClass.lpfnWndProc;
    42 //      }
     42        static {
     43                CLASSINFO lpWndClass = new CLASSINFO ();
     44                OS.WinQueryClassInfo (OS.NULLHANDLE, TrackBarClass, lpWndClass);
     45                TrackBarProc = lpWndClass.pfnWindowProc;
     46        }
    4347
    4448/**
     
    7276 */
    7377public Scale (Composite parent, int style) {
    74 //      super (parent, checkStyle (style));
     78        super (parent, checkStyle (style));
    7579}
    7680
     
    9498 * @see #removeSelectionListener
    9599 */
    96 //public void addSelectionListener(SelectionListener listener) {
    97 //      checkWidget ();
    98 //      if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
    99 //      TypedListener typedListener = new TypedListener (listener);
    100 //      addListener (SWT.Selection,typedListener);
    101 //      addListener (SWT.DefaultSelection,typedListener);
    102 //}
    103 //
     100public void addSelectionListener(SelectionListener listener) {
     101        checkWidget ();
     102        if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
     103        TypedListener typedListener = new TypedListener (listener);
     104        addListener (SWT.Selection,typedListener);
     105        addListener (SWT.DefaultSelection,typedListener);
     106}
     107
    104108int callWindowProc (int msg, int mp1, int mp2) {
    105109        if (handle == 0) return 0;
    106110        return OS.WinCallWindowProc(TrackBarProc, handle, msg, mp1, mp2);
    107111}
    108 //
    109 //static int checkStyle (int style) {
    110 //      return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
    111 //}
    112 //
     112
     113static int checkStyle (int style) {
     114        return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
     115}
     116
    113117//public Point computeSize (int wHint, int hHint, boolean changed) {
    114118//      checkWidget ();
     
    130134//      return new Point (width, height);
    131135//}
    132 //
    133 //void createHandle () {
    134 //      super.createHandle ();
     136
     137void createHandle () {
     138        super.createHandle ();
    135139//      OS.SendMessage (handle, OS.TBM_SETRANGEMAX, 0, 100);
    136140//      OS.SendMessage (handle, OS.TBM_SETPAGESIZE, 0, 10);
    137141//      OS.SendMessage (handle, OS.TBM_SETTICFREQ, 10, 0);
    138 //}
    139 //
    140 //int defaultForeground () {
    141 //      return OS.GetSysColor (OS.COLOR_BTNFACE);
    142 //}
    143 //
     142}
     143
     144int defaultForeground () {
     145        return OS.WinQuerySysColor(handle, OS.SYSCLR_SCROLLBAR, 0);
     146}
     147
    144148///**
    145149// * Returns the amount that the receiver's value will be
Note: See TracChangeset for help on using the changeset viewer.