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

📄 wdefstat.c

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:

    (*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("WdeStaticCopyObject: Control not created!");
        WdeMemFree ( (*new) );
        return ( FALSE );
    }

    return ( TRUE );
}

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

    *id = obj->object_id;

    return ( TRUE );
}

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

    *proc = WdeStaticSuperClassProc;

    return ( TRUE );
}

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

    *class = "static";

    return ( TRUE );
}

BOOL WdeStaticDefine ( WdeStaticObject *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;
    o_info.set_func   = (WdeSetProc)WdeStaticSetDefineInfo;
    o_info.get_func   = (WdeGetProc)WdeStaticGetDefineInfo;
    o_info.hook_func  = NULL;
    o_info.win        = NULL;

    return ( WdeControlDefine ( &o_info ) );
}

void WdeStaticSetDefineInfo ( WdeDefineObjectInfo *o_info, HWND hDlg )
{
    OBJ_ID   id;
    DialogStyle mask;

    id   = o_info->obj_id;

    mask = GETCTL_STYLE( o_info->info.c.info ) & ( 0x0000ffff ^ SS_NOPREFIX );

    if ( id  == FRAME_OBJ ) {
#if __NT__XX
        mask &= 0x0000ffff ^ SS_SUNKEN;
#endif
        if ( mask == SS_BLACKRECT ) {
            CheckDlgButton ( hDlg, IDB_SS_BLACKRECT, 1);
        } else if ( mask == SS_GRAYRECT ) {
            CheckDlgButton ( hDlg, IDB_SS_GRAYRECT, 1);
        } else if ( mask == SS_WHITERECT ) {
            CheckDlgButton ( hDlg, IDB_SS_WHITERECT, 1);
        } else if ( mask == SS_BLACKFRAME ) {
            CheckDlgButton ( hDlg, IDB_SS_BLACKFRAME, 1);
        } else if ( mask == SS_GRAYFRAME ) {
            CheckDlgButton ( hDlg, IDB_SS_GRAYFRAME, 1);
        } else if ( mask == SS_WHITEFRAME ) {
            CheckDlgButton ( hDlg, IDB_SS_WHITEFRAME, 1);
#if __NT__XX
        } else if ( mask == SS_ETCHEDFRAME ) {
            CheckDlgButton ( hDlg, IDB_SS_ETCHEDFRAME, 1);
        } else if ( mask == SS_ETCHEDHORZ ) {
            CheckDlgButton ( hDlg, IDB_SS_ETCHEDHORZ, 1);
        } else if ( mask == SS_ETCHEDVERT ) {
            CheckDlgButton ( hDlg, IDB_SS_ETCHEDVERT, 1);
#endif
        } else {
            WdeWriteTrail("WdeStaticSetDefineInfo: Bad Frame mask!");
        }

#if __NT__XX
        if( GETCTL_STYLE( o_info->info.c.info ) & SS_SUNKEN ) {
            CheckDlgButton ( hDlg, IDB_SS_SUNKEN, 1);
        }
#endif

    } else if ( id  == TEXT_OBJ ) {

#if __NT__XX
        mask &= 0x0000ffff ^ SS_NOTIFY;
        mask &= 0x0000ffff ^ SS_SUNKEN;
#endif

        if ( mask == SS_LEFT ) {
            CheckDlgButton ( hDlg, IDB_SS_LEFT, 1);
        } else if ( mask == SS_CENTER ) {
            CheckDlgButton ( hDlg, IDB_SS_CENTER, 1);
        } else if ( mask == SS_RIGHT ) {
            CheckDlgButton ( hDlg, IDB_SS_RIGHT, 1);
        } else if ( mask == SS_SIMPLE ) {
            CheckDlgButton ( hDlg, IDB_SS_SIMPLE, 1);
        } else if ( mask == SS_LEFTNOWORDWRAP ) {
            CheckDlgButton ( hDlg, IDB_SS_LEFTNOWORDWRAP, 1);
        } else {
            WdeWriteTrail("WdeStaticSetDefineInfo: Bad Text mask!");
        }

        if( GETCTL_STYLE( o_info->info.c.info ) & SS_NOPREFIX ) {
            CheckDlgButton ( hDlg, IDB_SS_NOPREFIX, 1);
        }
#if __NT__XX
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_NOTIFY), TRUE );
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_SUNKEN), TRUE );
        if( GETCTL_STYLE( o_info->info.c.info ) & SS_NOTIFY ) {
            CheckDlgButton ( hDlg, IDB_SS_NOTIFY, 1);
        }
        if( GETCTL_STYLE( o_info->info.c.info ) & SS_SUNKEN ) {
            CheckDlgButton ( hDlg, IDB_SS_SUNKEN, 1);
        }
#else
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_NOTIFY), FALSE );
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_SUNKEN), FALSE );
#endif

    } else if  ( id  == ICON_OBJ ) {

#if __NT__XX
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_ICON), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_BITMAP), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_ENHMETAFILE), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_CENTERIMAGE), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_RIGHTJUST), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_REALSIZEIMAGE), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_SUNKEN), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_NOTIFY), TRUE);

        mask = GETCTL_STYLE( o_info->info.c.info ) & 0x0000000f;
        if( mask == SS_ICON ) {
            CheckDlgButton ( hDlg, IDB_SS_ICON, 1);
        } else if( mask == SS_BITMAP ) {
            CheckDlgButton ( hDlg, IDB_SS_BITMAP, 1);
        } else if( mask == SS_ENHMETAFILE ) {
            CheckDlgButton ( hDlg, IDB_SS_ENHMETAFILE, 1);
        } else {
            WdeWriteTrail("WdeStaticSetDefineInfo: Bad Image mask!");
        }
        if ( GETCTL_STYLE( o_info->info.c.info ) & SS_CENTERIMAGE ) {
            CheckDlgButton ( hDlg, IDB_SS_CENTERIMAGE, 1);
        }
        if ( GETCTL_STYLE( o_info->info.c.info ) & SS_RIGHTJUST ) {
            CheckDlgButton ( hDlg, IDB_SS_RIGHTJUST, 1);
        }
        if ( GETCTL_STYLE( o_info->info.c.info ) & SS_REALSIZEIMAGE ) {
            CheckDlgButton ( hDlg, IDB_SS_REALSIZEIMAGE, 1);
        }
        if ( GETCTL_STYLE( o_info->info.c.info ) & SS_SUNKEN ) {
            CheckDlgButton ( hDlg, IDB_SS_SUNKEN, 1);
        }
        if ( GETCTL_STYLE( o_info->info.c.info ) & SS_NOTIFY ) {
            CheckDlgButton ( hDlg, IDB_SS_NOTIFY, 1);
        }
#else
        // only leave the ICON radio button on
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_ICON), TRUE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_BITMAP), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_ENHMETAFILE), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_CENTERIMAGE), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_RIGHTJUST), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_REALSIZEIMAGE), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_SUNKEN), FALSE);
        EnableWindow ( GetDlgItem(hDlg, IDB_SS_NOTIFY), FALSE);

        if ( mask != SS_ICON ) {
            WdeWriteTrail("WdeStaticSetDefineInfo: Bad Icon mask!");
        }
#endif
    } else {
        WdeWriteTrail("WdeStaticSetDefineInfo: Bad OBJ_ID!");
    }

    WdeEXSetDefineInfo ( o_info, hDlg );
}

void WdeStaticGetDefineInfo ( WdeDefineObjectInfo *o_info, HWND hDlg )
{
    OBJ_ID   id;
    DialogStyle mask;

    id   = o_info->obj_id;

    mask = 0;

    if ( id  == FRAME_OBJ ) {

        if ( IsDlgButtonChecked ( hDlg, IDB_SS_BLACKRECT ) ) {
            mask = SS_BLACKRECT;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_GRAYRECT ) ) {
            mask = SS_GRAYRECT;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_WHITERECT ) ) {
            mask = SS_WHITERECT;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_BLACKFRAME ) ) {
            mask = SS_BLACKFRAME;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_GRAYFRAME ) ) {
            mask = SS_GRAYFRAME;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_WHITEFRAME ) ) {
            mask = SS_WHITEFRAME;
#if __NT__XX
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_ETCHEDFRAME ) ) {
            mask = SS_ETCHEDFRAME;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_ETCHEDHORZ ) ) {
            mask = SS_ETCHEDHORZ;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_ETCHEDVERT ) ) {
            mask = SS_ETCHEDVERT;
#endif
        } else {
            WdeWriteTrail("WdeStaticGetDefineInfo: Bad Frame style!");
            return;
        }

#if __NT__XX
        if ( IsDlgButtonChecked ( hDlg, IDB_SS_SUNKEN ) ) {
            mask |= SS_SUNKEN;
        }
#endif
    } else if ( id  == TEXT_OBJ ) {

        if ( IsDlgButtonChecked ( hDlg, IDB_SS_LEFT ) ) {
            mask = SS_LEFT;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_CENTER ) ) {
            mask = SS_CENTER;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_RIGHT ) ) {
            mask = SS_RIGHT;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_SIMPLE ) ) {
            mask = SS_SIMPLE;
        } else if ( IsDlgButtonChecked ( hDlg, IDB_SS_LEFTNOWORDWRAP ) ) {
            mask = SS_LEFTNOWORDWRAP;
        } else {
            WdeWriteTrail("WdeStaticGetDefineInfo: Bad Text style!");
            return;
        }

        if ( IsDlgButtonChecked ( hDlg, IDB_SS_NOPREFIX ) ) {
            mask |= SS_NOPREFIX;
        }
#if __NT__XX
        if ( IsDlgButtonChecked ( hDlg, IDB_SS_NOTIFY ) ) {
            mask |= SS_NOTIFY;
        }
        if ( IsDlgButtonChecked ( hDlg, IDB_SS_SUNKEN ) ) {
            mask |= SS_SUNKEN;
        }
#endif

    } else if  ( id  == ICON_OBJ ) {

#if __NT__XX
        if( IsDlgButtonChecked ( hDlg, IDB_SS_ICON ) ) {
            mask = SS_ICON;
        } else if( IsDlgButtonChecked ( hDlg, IDB_SS_BITMAP ) ) {
            mask = SS_BITMAP;
        } else if( IsDlgButtonChecked ( hDlg, IDB_SS_ENHMETAFILE ) ) {
            mask = SS_ENHMETAFILE;
        } else {
            WdeWriteTrail("WdeStaticSetDefineInfo: Bad Image mask!");
        }

        if ( IsDlgButtonChecked( hDlg, IDB_SS_CENTERIMAGE ) ) {
            mask |= SS_CENTERIMAGE;
        }
        if ( IsDlgButtonChecked( hDlg, IDB_SS_RIGHTJUST ) ) {
            mask |= SS_RIGHTJUST;
        }
        if ( IsDlgButtonChecked( hDlg, IDB_SS_REALSIZEIMAGE ) ) {
            mask |= SS_REALSIZEIMAGE;
        }
        if ( IsDlgButtonChecked( hDlg, IDB_SS_SUNKEN ) ) {
            mask |= SS_SUNKEN;
        }
        if ( IsDlgButtonChecked( hDlg, IDB_SS_NOTIFY ) ) {
            mask |= SS_NOTIFY;
        }
#else
        mask = SS_ICON;
#endif

    } else {
        WdeWriteTrail("WdeButtonGetDefineInfo: Bad OBJ_ID!");
        return;
    }

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

    // set the extended mask - same for Frame, Icon (Image) and Text
    WdeEXSetDefineInfo ( o_info, hDlg );
    return;
}

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

⌨️ 快捷键说明

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