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

📄 wdeftabc.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
                           WdeTabCObject *handle )
{
    if (new == NULL) {
        WdeWriteTrail("WdeTabCCopyObject: Invalid new object!");
        return ( FALSE );
    }

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

    if ( *new == NULL ) {
        WdeWriteTrail("WdeTabCCopyObject: 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("WdeTabCCopyObject: Control not created!");
        WdeMemFree ( (*new) );
        return ( FALSE );
    }

    return ( TRUE );
}

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

    *id = obj->object_id;

    return ( TRUE );
}

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

    *proc = WdeTabCSuperClassProc;

    return ( TRUE );
}

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

    *class = WWC_TABCONTROL;

    return ( TRUE );
}

BOOL WdeTabCDefine ( WdeTabCObject *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)WdeTabCSetDefineInfo;
    o_info.get_func  = (WdeGetProc)WdeTabCGetDefineInfo;
    o_info.hook_func = WdeTabCDefineHook;
    o_info.win       = NULL;

    return ( WdeControlDefine ( &o_info ) );
}

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

    // set the tab control options
    mask = GETCTL_STYLE( o_info->info.c.info ) & 0x0000ffff;
    if ( mask & TCS_FORCEICONLEFT ) {
        CheckDlgButton ( hDlg, IDB_TCS_FORCEICONLEFT, 1);
    }
    if ( mask & TCS_FORCELABELLEFT ) {
        CheckDlgButton ( hDlg, IDB_TCS_FORCELABELLEFT, 1);
        // insist on FORCEICONLEFT and FIXEDWIDTH and disable FORCEICONLEFT
        CheckDlgButton ( hDlg, IDB_TCS_FORCEICONLEFT, 1);
        CheckDlgButton ( hDlg, IDB_TCS_FIXEDWIDTH, 1);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCEICONLEFT), FALSE);
    }
    if ( mask & TCS_BUTTONS ) {
        CheckDlgButton ( hDlg, IDB_TCS_BUTTONS, 1);
    } else {
        CheckDlgButton ( hDlg, IDB_TCS_TABS, 1);
    }
    if ( mask & TCS_RAGGEDRIGHT ) {
        CheckDlgButton ( hDlg, IDB_TCS_RAGGEDRIGHT, 1);
    } else {
        CheckDlgButton ( hDlg, IDB_TCS_RIGHTJUSTIFY, 1);
    }
    if ( mask & TCS_MULTILINE ) {
        CheckDlgButton ( hDlg, IDB_TCS_MULTILINE, 1);
    } else {
        CheckDlgButton ( hDlg, IDB_TCS_SINGLELINE, 1);
        // force raggedright on and disable both it and right justify
        CheckDlgButton ( hDlg, IDB_TCS_RAGGEDRIGHT, 1);
        CheckDlgButton ( hDlg, IDB_TCS_RIGHTJUSTIFY, 0);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RAGGEDRIGHT), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RIGHTJUSTIFY), FALSE);
    }
    if ( mask & TCS_FIXEDWIDTH ) {
        CheckDlgButton ( hDlg, IDB_TCS_FIXEDWIDTH, 1);
        // force raggedright on and disable both it and right justify
        CheckDlgButton ( hDlg, IDB_TCS_RAGGEDRIGHT, 1);
        CheckDlgButton ( hDlg, IDB_TCS_RIGHTJUSTIFY, 0);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RAGGEDRIGHT), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RIGHTJUSTIFY), FALSE);
    } else {
        // turn off FORCE ... LEFT controls and disable them
        CheckDlgButton ( hDlg, IDB_TCS_FORCEICONLEFT, 0);
        CheckDlgButton ( hDlg, IDB_TCS_FORCELABELLEFT, 0);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCEICONLEFT), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCELABELLEFT), FALSE);
    }
    if ( mask & TCS_FOCUSONBUTTONDOWN ) {
        CheckDlgButton ( hDlg, IDB_TCS_FOCUSONBUTTONDOWN, 1);
    }
    if ( mask & TCS_OWNERDRAWFIXED ) {
        CheckDlgButton ( hDlg, IDB_TCS_OWNERDRAWFIXED, 1);
    }
    if ( mask & TCS_TOOLTIPS ) {
        CheckDlgButton ( hDlg, IDB_TCS_TOOLTIPS, 1);
    }
    if ( mask & TCS_FOCUSNEVER ) {
        CheckDlgButton ( hDlg, IDB_TCS_FOCUSNEVER, 1);
    }

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

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

    // get the tab control settings
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_FORCEICONLEFT ) ) {
        mask |= TCS_FORCEICONLEFT;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_FORCELABELLEFT ) ) {
        mask |= TCS_FORCELABELLEFT;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_BUTTONS ) ) {
        mask |= TCS_BUTTONS;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_MULTILINE ) ) {
        mask |= TCS_MULTILINE;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_RAGGEDRIGHT ) ) {
        mask |= TCS_RAGGEDRIGHT;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_FIXEDWIDTH ) ) {
        mask |= TCS_FIXEDWIDTH;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_FOCUSONBUTTONDOWN ) ) {
        mask |= TCS_FOCUSONBUTTONDOWN;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_OWNERDRAWFIXED ) ) {
        mask |= TCS_OWNERDRAWFIXED;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_TOOLTIPS ) ) {
        mask |= TCS_TOOLTIPS;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TCS_FOCUSNEVER ) ) {
        mask |= TCS_FOCUSNEVER;
    }

    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 WdeTabCDefineHook( HWND hDlg, UINT message,
                        WPARAM wParam, LPARAM lParam, DialogStyle mask )
{
#ifdef __NT__XX
    BOOL processed;
    WORD wp;

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

    processed = FALSE;

    if ( ( message == WM_COMMAND ) &&
         ( GET_WM_COMMAND_CMD(wParam,lParam) == BN_CLICKED ) ) {
        wp = LOWORD ( wParam );
        switch ( wp ) {
           case IDB_TCS_FIXEDWIDTH:
                if (IsDlgButtonChecked(hDlg,IDB_TCS_FIXEDWIDTH)) {
                    // force raggedright on and disable both controls
                    CheckDlgButton ( hDlg, IDB_TCS_RAGGEDRIGHT, 1);
                    CheckDlgButton ( hDlg, IDB_TCS_RIGHTJUSTIFY, 0);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RAGGEDRIGHT), FALSE);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RIGHTJUSTIFY), FALSE);
                    // enable the FORCE...LEFT controls
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCEICONLEFT), TRUE);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCELABELLEFT), TRUE);
                } else {
                    // enable RAGGEDRIGHT and RIGHTJUSTIFY controls
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RAGGEDRIGHT), TRUE);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RIGHTJUSTIFY), TRUE);
                    // disable the FORCE...LEFT controls
                    CheckDlgButton ( hDlg, IDB_TCS_FORCEICONLEFT, 0);
                    CheckDlgButton ( hDlg, IDB_TCS_FORCELABELLEFT, 0);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCEICONLEFT), FALSE);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCELABELLEFT), FALSE);
                }
                processed = TRUE;
                break;

           case IDB_TCS_FORCELABELLEFT:
                if (IsDlgButtonChecked(hDlg, IDB_TCS_FORCELABELLEFT)) {
                    // turn on FORCEICONLEFT as well, and disable it
                    CheckDlgButton ( hDlg, IDB_TCS_FORCEICONLEFT, 1);
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCEICONLEFT), FALSE);
                } else {
                    // enable the FORCEICONLEFT control
                    EnableWindow ( GetDlgItem(hDlg, IDB_TCS_FORCEICONLEFT), TRUE);
                }
                processed = TRUE;
                break;

           case IDB_TCS_MULTILINE:
           case IDB_TCS_SINGLELINE:
                if (!IsDlgButtonChecked(hDlg,IDB_TCS_FIXEDWIDTH)) {
                    if (IsDlgButtonChecked(hDlg, IDB_TCS_MULTILINE)) {
                        // enable the RAGGEDRIGHT and RIGHTJUSTIFY control
                        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RAGGEDRIGHT), TRUE);
                        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RIGHTJUSTIFY), TRUE);
                    } else {
                        // force RAGGEDRIGHT and disable it and RIGHTJUSTIFY
                        CheckDlgButton ( hDlg, IDB_TCS_RAGGEDRIGHT, 1);
                        CheckDlgButton ( hDlg, IDB_TCS_RIGHTJUSTIFY, 0);
                        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RAGGEDRIGHT), FALSE);
                        EnableWindow ( GetDlgItem(hDlg, IDB_TCS_RIGHTJUSTIFY), FALSE);
                    }
                }
                processed = TRUE;
                break;
        }
    }

    return( processed );
#else
    _wde_touch(hDlg);
    _wde_touch(message);
    _wde_touch(wParam);
    _wde_touch(lParam);
    _wde_touch(mask);
    return ( FALSE );
#endif
}

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


⌨️ 快捷键说明

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