wpi_win.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 1,198 行 · 第 1/4 页

H
1,198
字号
    #define _wpi_freeprocinstance( proc ) FreeProcInstance( (FARPROC)proc )

    #define _wpi_getclassproc( class ) (class)->lpfnWndProc

    #define _wpi_getcreateparms( lpcs ) (lpcs)->lpCreateParams

    #define _wpi_callwindowproc( proc, hwnd, msg, parm1, parm2 ) \
        CallWindowProc( proc, hwnd, msg, parm1, parm2 )

    #define _wpi_setclassproc( class, proc ) \
        (class)->lpfnWndProc = (WNDPROC) (proc)

    #define _wpi_setclassinst( class, inst ) (class)->hInstance = (inst)

    #define _wpi_setclassname( class, name ) (class)->lpszClassName = (name)

    #define _wpi_setclassstyle( class, wpi_style ) (class)->style = (wpi_style)

    #define _wpi_setclassbackground( class, background ) \
        (class)->hbrBackground = (background)

    #define _wpi_setclassextra( class, extra ) \
        (class)->cbWndExtra = (extra)

    #define _wpi_enddialog( hwnd, result ) EndDialog( hwnd, result )

    #define _wpi_dialogbox( parent, proc, inst, res_id, data ) \
        DialogBoxParam( inst, res_id, parent, (DLGPROC)proc, (DWORD)(LPARAM)(data) )

    #define _wpi_setstretchbltmode( mem, mode ) SetStretchBltMode( mem, mode )

    #define _wpi_stretchblt( dest, x_dest, y_dest, cx_dest, cy_dest, src, \
                                x_src, y_src, cx_src, cy_src, rop )  \
        StretchBlt( dest, x_dest, y_dest, cx_dest, cy_dest, \
                                src, x_src, y_src, cx_src, cy_src, rop )

extern void _wpi_setrectvalues( WPI_RECT *rect, WPI_RECTDIM in_left,
            WPI_RECTDIM in_top, WPI_RECTDIM in_right, WPI_RECTDIM in_bottom );
extern void _wpi_getrectvalues( WPI_RECT rect, WPI_RECTDIM *left,
                WPI_RECTDIM *top, WPI_RECTDIM *right, WPI_RECTDIM *bottom );
extern void _wpi_setwrectvalues( WPI_RECT *rect, WPI_RECTDIM in_left,
            WPI_RECTDIM in_top, WPI_RECTDIM in_right, WPI_RECTDIM in_bottom );
extern void _wpi_getwrectvalues( WPI_RECT rect, WPI_RECTDIM *left,
                WPI_RECTDIM *top, WPI_RECTDIM *right, WPI_RECTDIM *bottom);
extern void _wpi_setintrectvalues( WPI_RECT *rect, int in_left, int in_top,
                                                int in_right, int in_bottom );
extern void _wpi_getintrectvalues( WPI_RECT rect, int *left, int *top,
                                                    int *right, int *bottom );
extern void _wpi_setintwrectvalues( WPI_RECT *rect, int in_left, int in_top,
                                                int in_right, int in_bottom );
extern void _wpi_getintwrectvalues( WPI_RECT rect, int *left, int *top,
                                                    int *right, int *bottom);

    #define _wpi_convertheight( height, window_top, window_bottom ) height

    #define _wpi_cvth_y( y, h ) (y)

    #define _wpi_cvth_pt( pt, h )

    #define _wpi_cvth_rect( rect, h )

    #define _wpi_cvth_wanchor( y, wh, ph ) (y)

    #define _wpi_cvts_y( y ) (y)

    #define _wpi_cvtc_y( hwnd, y ) (y)

    #define _wpi_cvtc_rect( hwnd, rect ) //nothing

    #define _wpi_cvts_pt( pt )

    #define _wpi_cvts_rect( rect, h )

    #define _wpi_cvts_wanchor( y, wh ) (y)

    #define _wpi_borderrect( pres, rect, brush, fore, back ) \
        FrameRect( pres, rect, brush )

    #define _wpi_getdlgctrlid( hwnd ) GetDlgCtrlID( hwnd )

    #define _wpi_getwindowid( hwnd ) GetDlgCtrlID( hwnd )

    #define _wpi_isrightid( hwnd, id ) ( id == GetDlgCtrlID(hwnd) )

    #define _wpi_messagebox( parent, text, title, style ) \
                                    MessageBox( parent, text, title, style )

    #define _wpi_createrectrgn( pres, rects ) \
        CreateRectRgnIndirect( rects )

    #define _wpi_deletecliprgn( pres, rgn ) DeleteObject( rgn )

    #define _wpi_selectcliprgn( pres, rgn ) SelectClipRgn( pres, rgn )

    #define _wpi_getboss( hwnd ) GetWindowWord( hwnd, GWW_HWNDPARENT )

    #define _wpi_getparent( hwnd ) GetParent( hwnd )

    #define _wpi_setparent( win, parent ) SetParent( win, parent )

    #define _wpi_ischild( hwnd1, hwnd2 ) IsChild( hwnd1, hwnd2 )

    #define _wpi_getowner( hwnd ) GetWindow( hwnd, GW_OWNER )

    #define _wpi_setowner( win, parent ) SetParent( win, parent )

    #define _wpi_getvk( parm1, parm2 ) (parm1)

    #define _wpi_getmousex( parm1, parm2 ) LOWORD( parm2 )

    #define _wpi_getmousey( parm1, parm2 ) HIWORD( parm2 )

    #define _wpi_getwmsizex( parm1, parm2 ) LOWORD( parm2 )

    #define _wpi_getwmsizey( parm1, parm2 ) HIWORD( parm2 )

    #define _wpi_ismsgsetfocus( msg, parm2 ) ( (msg) == WM_SETFOCUS )

    #define _wpi_ismsgkillfocus( msg, parm2 ) ( (msg) == WM_KILLFOCUS )

    #define _wpi_ismsgkeydown( msg, parm1 ) ( (msg) == WM_KEYDOWN )

    #define _wpi_ismsgkeyup( msg, parm1 ) ( (msg) == WM_KEYUP )

    #define _wpi_isdown( parm1, parm2 ) ( (parm1) & MK_LBUTTON )

    #define _wpi_fileopen( filename, format ) _lopen( filename, format )

    #define _wpi_filecreate( filename, format ) _lcreat( filename, 0 )

    #define _wpi_fileclose( file_hdl ) _lclose( file_hdl )

    #define _wpi_filewrite( hfile, buf, size ) _lwrite( hfile, buf, size )

    #define _wpi_fileread( hfile, buf, size ) _lread( hfile, buf, size )

    #define _wpi_isdialogmessage( wpi_hwnd, wpi_msg ) \
                                        IsDialogMessage( wpi_hwnd, wpi_msg )

    #define _wpi_ismessage( msg, id ) ( (msg).message == (id) )

    #define _wpi_isntdblclk( parm1, parm2 ) \
                 (GET_WM_COMMAND_CMD( parm1, parm2 ) != LBN_DBLCLK)

    #define _wpi_createbrush( log_brush ) CreateBrushIndirect( log_brush )

    #define _wpi_deletebrush( brush )  DeleteObject( brush )

#ifdef __NT__
    #define _wpi_setbrushorigin( pres, pt ) SetBrushOrgEx( pres, (pt)->x, (pt)->y, NULL )
#else
    #define _wpi_setbrushorigin( pres, pt ) SetBrushOrg( pres, (pt)->x, (pt)->y )
#endif

    #define _wpi_setlogbrushsolid( plogbrush ) (plogbrush)->lbStyle = BS_SOLID

    #define _wpi_setlogbrushnull( plogbrush ) (plogbrush)->lbStyle = BS_NULL

    #define _wpi_setlogbrushhollow( plbrush ) (plbrush)->lbStyle = BS_HOLLOW

    #define _wpi_setlogbrushstyle( plogbrush, style ) \
                                            (plogbrush)->lbStyle = style

    #define _wpi_setlogbrushsymbol( plogbrush, symbol ) \
                                            (plogbrush)->lbHatch = symbol

    #define _wpi_setlogbrushcolour( plogbrush, colour ) \
                                            (plogbrush)->lbColor = colour

    #define _wpi_logbrushcolour( brush ) (plogbrush)->lbColor

    #define _wpi_drawfocusrect( pres, rect ) DrawFocusRect( pres, rect )

    #define _wpi_rectangle( pres, left, top, right, bottom ) \
        Rectangle( pres, left, top, right, bottom )

    #define _wpi_getstockobject( object ) GetStockObject( object )

    #define _wpi_dlgbaseheight( inst, size ) \
        *(size) = HIWORD( GetDialogBaseUnits() );

    #define _wpi_dlgbasewidth( inst, size ) \
        *(size) = LOWORD( GetDialogBaseUnits() );

extern void _wpi_setqmsgvalues( WPI_QMSG *qmsg, HWND hwnd, WPI_MSG wpi_msg,
                        WPI_PARAM1 wparam, WPI_PARAM2 lparam, ULONG wpi_time,
                        WPI_POINT pt );
extern void _wpi_getqmsgvalues( WPI_QMSG qmsg, HWND *hwnd, WPI_MSG *wpi_msg,
                        WPI_PARAM1 *wparam, WPI_PARAM2 *lparam, ULONG *wpi_time,
                        WPI_POINT *pt );

    #define _wpi_qmsgmessage( pwpi_qmsg ) ((pwpi_qmsg)->message)

    #define _wpi_qmsgparam1( pwpi_qmsg ) ((pwpi_qmsg)->wParam)

    #define _wpi_qmsgparam2( pwpi_qmsg ) ((pwpi_qmsg)->lParam)

    #define _wpi_drawhwnd( drw ) ((drw)->hwndItem)

    #define _wpi_drawpres( drw ) ((drw)->hDC)

extern void _wpi_suspendthread( UINT thread_id, WPI_QMSG *msg );

    #define _wpi_resumethread( thread_id ) \
                            PostAppMessage( thread_id, WM_QUIT, NULL, NULL )

    #define _wpi_settextcolor( pres, colour ) SetTextColor( pres, colour )

    #define _wpi_settextalign( pres, horiz_flags, vert_flags ) \
                            SetTextAlign( pres, (horiz_flags) | (vert_flags) )

    #define _wpi_textout( pres, left, top, text, len ) \
                                        TextOut( pres, left, top, text, len )

    #define _wpi_exttextout( hdc, x, y, opt, pr, str, len, spacing ) \
                           ExtTextOut( hdc, x, y, opt, pr, str, len, spacing )

    /***** _WPI_F_* Font Functions *****/
    /* These functions are a set of replacement WPI font functions
       which should work. All the other functions are crap; this
       is an attempt to do it right. DJP */

    #define _wpi_f_setfontitalic( font, style ) \
                        (font)->lfItalic = (style) ? -1 : 0

    #define _wpi_f_setfontunderline( font, style ) \
                        (font)->lfUnderline = (style) ? -1 : 0

    #define _wpi_f_setfontstrikeout( font, style ) \
                        (font)->lfStrikeOut = (style) ? -1 : 0

    #define _wpi_f_setfontbold( font, style ) \
                        (font)->lfWeight = (style) ? 700 : 400

    #define _wpi_f_getfontitalic( font ) \
                        ( (font)->lfItalic )

    #define _wpi_f_getfontunderline( font ) \
                        ( (font)->lfUnderline )


    #define _wpi_f_getfontstrikeout( font ) \
                        ( (font)->lfStrikeOut )

    #define _wpi_f_getfontbold( font ) \
                        ( ( (font)->lfWeight == 700 ) ? 1 : 0 )

    #define _wpi_f_setfontsize( font, point_size, pix_size ) \
        (font)->lfHeight = pix_size

    #define _wpi_f_getfontsize( font ) \
                        ( (font)->lfHeight )

    #define _wpi_f_default( font ) \
                        ( memset( font, 0, sizeof( *font ) ) )

    #define _wpi_f_setfontescapement( font, escapement ) \
                        (font)->lfEscapement = (escapement)

    #define _wpi_f_setfontorientation( font, orientation ) \
                        (font)->lfOrientation = (orientation)

    #define _wpi_f_setfontcharset( font, set ) \
                        (font)->lfCharSet = (set)

    #define _wpi_f_getfontcharset( font ) \
                        (font)->lfCharSet

    #define _wpi_f_setfontfacename( font, name ) \
                strcpy( (font)->lfFaceName, ( (name) != NULL ) ? (name) : "" )

    #define _wpi_f_getfontfacename( font ) \
                ( (font)->lfFaceName )

    #define _wpi_f_setfontprecision( font, out, clip ) \
        (font)->lfOutPrecision = (out); \
        (font)->lfClipPrecision = (clip);

    #define _wpi_f_setfontquality( font, quality ) \
        (font)->lfQuality = (quality);

    #define _wpi_f_setfontpitch( font, pitch ) \
        (font)->lfPitchAndFamily = (pitch);

    #define _wpi_f_deletefont( hfont ) \
                         DeleteObject( hfont )

    #define _wpi_f_selectfont( hdc, font ) SelectObject( hdc, font )

    #define _wpi_f_getoldfont( hdc, oldfont ) SelectObject( hdc, oldfont )

#ifdef __NT__
    #define _wpi_f_getsystemfont( hdc, font ) \
        GetObject( \
            GetStockObject( LOBYTE(LOWORD(GetVersion())) >= 4 ? \
            DEFAULT_GUI_FONT : SYSTEM_FONT ) \
            , sizeof( *(font) ), (font) )
#else
    #define _wpi_f_getsystemfont( hdc, font ) \
        GetObject( GetStockObject( SYSTEM_FONT ), sizeof( *(font) ), (font) )

⌨️ 快捷键说明

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