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

📄 wdeftvw.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
        WdeWriteTrail ("WdeTViewInit: Alloc of control failed!");
        return( FALSE );
    }

    /* set up the default control structure */
    SETCTL_STYLE( WdeDefaultTView, WS_BORDER | WS_VISIBLE | WS_TABSTOP | WS_GROUP );
    SETCTL_ID( WdeDefaultTView, 0 );
    SETCTL_EXTRABYTES( WdeDefaultTView, 0 );
    SETCTL_SIZEX( WdeDefaultTView, 0 );
    SETCTL_SIZEY( WdeDefaultTView, 0 );
    SETCTL_SIZEW( WdeDefaultTView, 0 );
    SETCTL_SIZEH( WdeDefaultTView, 0 );
    SETCTL_TEXT( WdeDefaultTView, NULL );
    SETCTL_CLASSID( WdeDefaultTView, WdeStrToControlClass( WWC_TREEVIEW ) );

    WdeTViewDispatch = MakeProcInstance((FARPROC)WdeTViewDispatcher,
                                           WdeGetAppInstance());
    return( TRUE );
}

void WdeTViewFini ( void )
{
    WdeFreeDialogBoxControl ( &WdeDefaultTView );
    FreeProcInstance        ( WdeTViewDispatch );
}

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

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

    WdeMemFree( obj );

    return ( TRUE );
}

BOOL WdeTViewValidateAction ( WdeTViewObject *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( WdeTViewActions[i].id == *act ) {
            return ( TRUE );
        }
    }

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

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

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

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

    return ( TRUE );
}

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

    *id = obj->object_id;

    return ( TRUE );
}

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

    *proc = WdeTViewSuperClassProc;

    return ( TRUE );
}

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

    *class = WWC_TREEVIEW;

    return ( TRUE );
}

BOOL WdeTViewDefine ( WdeTViewObject *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)WdeTViewSetDefineInfo;
    o_info.get_func  = (WdeGetProc)WdeTViewGetDefineInfo;
    o_info.hook_func = WdeTViewDefineHook;
    o_info.win       = NULL;

    return ( WdeControlDefine ( &o_info ) );
}

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

    // set the tree view options
    mask = GETCTL_STYLE( o_info->info.c.info ) & 0x000000ff;
    if ( mask & TVS_HASBUTTONS ) {
        CheckDlgButton ( hDlg, IDB_TVS_HASBUTTONS, 1);
    }
    if ( mask & TVS_HASLINES ) {
        CheckDlgButton ( hDlg, IDB_TVS_HASLINES, 1);
    }
    if ( mask & TVS_LINESATROOT ) {
        CheckDlgButton ( hDlg, IDB_TVS_LINESATROOT, 1);
    }
    if ( mask & TVS_EDITLABELS ) {
        CheckDlgButton ( hDlg, IDB_TVS_EDITLABELS, 1);
    }
    if ( mask & TVS_DISABLEDRAGDROP ) {
        CheckDlgButton ( hDlg, IDB_TVS_DISABLEDRAGDROP, 1);
    }
    if ( mask & TVS_SHOWSELALWAYS ) {
        CheckDlgButton ( hDlg, IDB_TVS_SHOWSELALWAYS, 1);
    }

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

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

    // get the tree view control settings
    if ( IsDlgButtonChecked ( hDlg, IDB_TVS_HASBUTTONS ) ) {
        mask |= TVS_HASBUTTONS;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TVS_HASLINES ) ) {
        mask |= TVS_HASLINES;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TVS_LINESATROOT ) ) {
        mask |= TVS_LINESATROOT;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TVS_EDITLABELS ) ) {
        mask |= TVS_EDITLABELS;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TVS_DISABLEDRAGDROP ) ) {
        mask |= TVS_DISABLEDRAGDROP;
    }
    if ( IsDlgButtonChecked ( hDlg, IDB_TVS_SHOWSELALWAYS ) ) {
        mask |= TVS_SHOWSELALWAYS;
    }

    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 WdeTViewDefineHook( 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 WdeTViewSuperClassProc( HWND hWnd, UINT message,
                                         WPARAM wParam,
                                         LPARAM lParam )
{
    if( !WdeProcessMouse( hWnd, message, wParam, lParam ) ) {
        return( CallWindowProc( WdeOriginalTViewProc,
                                 hWnd, message, wParam, lParam ) );
    }
    return( FALSE );
}


⌨️ 快捷键说明

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