⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdefupdn.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
    SETCTL_STYLE( WdeDefaultUpDn, WS_BORDER | WS_VISIBLE | WS_TABSTOP | WS_GROUP );
    SETCTL_ID( WdeDefaultUpDn, 0 );
    SETCTL_EXTRABYTES( WdeDefaultUpDn, 0 );
    SETCTL_SIZEX( WdeDefaultUpDn, 0 );
    SETCTL_SIZEY( WdeDefaultUpDn, 0 );
    SETCTL_SIZEW( WdeDefaultUpDn, 0 );
    SETCTL_SIZEH( WdeDefaultUpDn, 0 );
    SETCTL_TEXT( WdeDefaultUpDn, NULL );
    SETCTL_CLASSID( WdeDefaultUpDn, WdeStrToControlClass( WUPDOWN_CLASS ) );

    WdeUpDnDispatch = MakeProcInstance((FARPROC)WdeUpDnDispatcher,
                                           WdeGetAppInstance());
    return( TRUE );
}

void WdeUpDnFini ( void )
{
    WdeFreeDialogBoxControl ( &WdeDefaultUpDn );
    FreeProcInstance        ( WdeUpDnDispatch );
}

BOOL WdeUpDnDestroy ( WdeUpDnObject *obj, BOOL *flag, void *p2 )
{
    /* touch unused vars to get rid of warning */
    _wde_touch(p2);

    if ( !Forward ( obj->control, DESTROY, flag, NULL ) ) {
        WdeWriteTrail("WdeUpDnDestroy: Control DESTROY failed");
        return ( FALSE );
    }

    WdeMemFree( obj );

    return ( TRUE );
}

BOOL WdeUpDnValidateAction ( WdeUpDnObject *obj, ACTION *act, void *p2 )
{
    int     i;

    /* touch unused vars to get rid of warning */
    _wde_touch(p2);

    for ( i = 0; i < MAX_ACTIONS; i++ ) {
        if( WdeUpDnActions[i].id == *act ) {
            return ( TRUE );
        }
    }

    return ( ValidateAction( (OBJPTR) obj->control, *act, p2 ) );
}

BOOL WdeUpDnCopyObject ( WdeUpDnObject *obj, WdeUpDnObject **new,
                           WdeUpDnObject *handle )
{
    if (new == NULL) {
        WdeWriteTrail("WdeUpDnCopyObject: Invalid new object!");
        return ( FALSE );
    }

    *new = (WdeUpDnObject *) WdeMemAlloc ( sizeof(WdeUpDnObject) );

    if ( *new == NULL ) {
        WdeWriteTrail("WdeUpDnCopyObject: Object malloc failed");
        return ( FALSE );
    }

    (*new)->dispatcher    = obj->dispatcher;
    (*new)->object_id     = obj->object_id;

    if ( handle ==  NULL ) {
        (*new)->object_handle = *new;
    } else {
        (*new)->object_handle = handle;
    }

    if (!CopyObject(obj->control, &((*new)->control), (*new)->object_handle)) {
        WdeWriteTrail("WdeUpDnCopyObject: Control not created!");
        WdeMemFree ( (*new) );
        return ( FALSE );
    }

    return ( TRUE );
}

BOOL WdeUpDnIdentify ( WdeUpDnObject *obj, OBJ_ID *id, void *p2 )
{
    /* touch unused vars to get rid of warning */
    _wde_touch(p2);

    *id = obj->object_id;

    return ( TRUE );
}

BOOL WdeUpDnGetWndProc( WdeUpDnObject *obj, WNDPROC *proc, void *p2 )
{
    /* touch unused vars to get rid of warning */
    _wde_touch(obj);
    _wde_touch(p2);

    *proc = WdeUpDnSuperClassProc;

    return ( TRUE );
}

BOOL WdeUpDnGetWindowClass ( WdeUpDnObject *obj, char **class, void *p2 )
{
    /* touch unused vars to get rid of warning */
    _wde_touch(obj);
    _wde_touch(p2);

    *class = WUPDOWN_CLASS;

    return ( TRUE );
}

BOOL WdeUpDnDefine ( WdeUpDnObject *obj, POINT *pnt, void *p2 )
{
    WdeDefineObjectInfo  o_info;

    /* touch unused vars to get rid of warning */
    _wde_touch(pnt);
    _wde_touch(p2);

    o_info.obj       = obj->object_handle;
    o_info.obj_id    = obj->object_id;
    o_info.mask      = WS_VISIBLE | WS_DISABLED |
                        WS_TABSTOP | WS_GROUP | WS_BORDER;
    o_info.set_func  = (WdeSetProc)WdeUpDnSetDefineInfo;
    o_info.get_func  = (WdeGetProc)WdeUpDnGetDefineInfo;
    o_info.hook_func = WdeUpDnDefineHook;
    o_info.win       = NULL;

    return ( WdeControlDefine ( &o_info ) );
}

void WdeUpDnSetDefineInfo ( WdeDefineObjectInfo *o_info, HWND hDlg )
{
#ifdef __NT__XX
    DialogStyle mask;

    // set the up down control options
    mask = GETCTL_STYLE( o_info->info.c.info ) & 0x000000ff;
    if ( mask & UDS_WRAP ) {
        CheckDlgButton ( hDlg, IDB_UDS_WRAP, 1);
    }
    if ( mask & UDS_SETBUDDYINT ) {
        CheckDlgButton ( hDlg, IDB_UDS_SETBUDDYINT, 1);
    }
    if ( mask & UDS_AUTOBUDDY ) {
        CheckDlgButton ( hDlg, IDB_UDS_AUTOBUDDY, 1);
    }
    if ( mask & UDS_ARROWKEYS ) {
        CheckDlgButton ( hDlg, IDB_UDS_ARROWKEYS, 1);
    }
    if ( mask & UDS_HORZ ) {
        CheckDlgButton ( hDlg, IDB_UDS_HORZ, 1);
    }
    if ( mask & UDS_NOTHOUSANDS ) {
        CheckDlgButton ( hDlg, IDB_UDS_NOTHOUSANDS, 1);
    }
    if ( mask & UDS_ALIGNRIGHT ) {
        CheckDlgButton ( hDlg, IDB_UDS_ALIGNRIGHT, 1);
    } else {
        CheckDlgButton ( hDlg, IDB_UDS_ALIGNLEFT, 1);
    }

    // set the extended style controls only
    WdeEXSetDefineInfo( o_info, hDlg );
#else
    _wde_touch(o_info);
    _wde_touch(hDlg);
#endif
}

void WdeUpDnGetDefineInfo ( WdeDefineObjectInfo *o_info, HWND hDlg )
{
#ifdef __NT__XX
    DialogStyle mask = 0;

    // get the Up Down control settings
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_WRAP ) ) {
        mask |= UDS_WRAP;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_SETBUDDYINT ) ) {
        mask |= UDS_SETBUDDYINT;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_AUTOBUDDY ) ) {
        mask |= UDS_AUTOBUDDY;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_ARROWKEYS ) ) {
        mask |= UDS_ARROWKEYS;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_HORZ ) ) {
        mask |= UDS_HORZ;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_NOTHOUSANDS ) ) {
        mask |= UDS_NOTHOUSANDS;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_UDS_ALIGNRIGHT ) ) {
        mask |= UDS_ALIGNRIGHT;
    } else {
        mask |= UDS_ALIGNLEFT;
    }

    SETCTL_STYLE( o_info->info.c.info,
                  ( GETCTL_STYLE(o_info->info.c.info) & 0xffff0000 ) | mask );

    // get the extended control settings
    WdeEXGetDefineInfo ( o_info, hDlg );
#else
    _wde_touch(o_info);
    _wde_touch(hDlg);
#endif
}

BOOL WdeUpDnDefineHook( HWND hDlg, UINT message,
                        WPARAM wParam, LPARAM lParam, DialogStyle mask )
{
    BOOL processed;

    /* touch unused vars to get rid of warning */
    _wde_touch(hDlg);
    _wde_touch(message);
    _wde_touch(wParam);
    _wde_touch(lParam);
    _wde_touch(mask);

    processed = FALSE;

    return( processed );
}

LRESULT WINEXPORT WdeUpDnSuperClassProc( HWND hWnd, UINT message,
                                         WPARAM wParam,
                                         LPARAM lParam )
{
    if( !WdeProcessMouse( hWnd, message, wParam, lParam ) ) {
        return( CallWindowProc( WdeOriginalUpDnProc,
                                 hWnd, message, wParam, lParam ) );
    }
    return( FALSE );
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -