wpi_win.h

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

H
1,198
字号
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  WHEN YOU FIGURE OUT WHAT THIS FILE DOES, PLEASE
*               DESCRIBE IT HERE!
*
****************************************************************************/


/*************************************************************************
 * FUNCTIONS
 *      NOTE- When adding macros to this file, be sure to append them to the
 *            END of the file.  This file will eventually be converted to
 *            a library.  The method of conversion will be from the start
 *            of the file to the end.
 *************************************************************************/

    #define GlobalUnlockCheck( hmem ) GlobalUnlock( hmem )

    #define LocalUnlockCheck( hmem ) LocalUnlock( hmem )


    #define WPI_MAKEPOINT(wp, lp, pt) MAKE_POINT( pt, lp );

    #define _wpi_isrectempty( inst, prect ) \
                      IsRectEmpty( prect )

    #define _wpi_intersectrect( inst, prdest, prsrc1, prsrc2 ) \
                                IntersectRect( prdest, prsrc1, prsrc2 )

extern void _wpi_setpoint( WPI_POINT *pt, int x, int y );

#ifdef __NT__
    #define _wpi_moveto( pres, point ) MoveToEx( pres, (point)->x, (point)->y, NULL )
#else
    #define _wpi_moveto( pres, point ) MoveTo( pres, (point)->x, (point)->y )
#endif

    #define _wpi_movetoex( pres, point, extra ) \
        MoveToEx( pres, (point)->x, (point)->y, extra )

    #define _wpi_lineto( pres, point ) LineTo( pres, (point)->x, (point)->y )

    #define _wpi_setpixel( pres, x, y, colour ) SetPixel( pres, x, y, colour )

    #define _wpi_devicecapableinch( pres, what ) GetDeviceCaps( pres, what )

    #define _wpi_getcurrenttime( inst ) GetCurrentTime()

extern void _wpi_getcurrpos( WPI_PRES pres, WPI_POINT *pt );

    #define _wpi_createsolidbrush( colour ) CreateSolidBrush( colour )

    #define _wpi_createnullbrush( ) GetStockObject( NULL_BRUSH )

    #define _wpi_deletenullbrush( brush ) \
        // nothing

    #define _wpi_createnullpen( ) GetStockObject( NULL_PEN )

    #define _wpi_deletenullpen( pen ) \
        // nothing

    #define _wpi_polygon( pres, pts, num_pts ) Polygon( pres, pts, num_pts )

    #define _wpi_gpipop( pres, num ) \
        // nothing

    #define _wpi_preserveattrs( pres ) \
        // nothing

extern void _wpi_getpaintrect( PAINTSTRUCT *ps, WPI_RECT *rect );

    #define _wpi_muldiv( a, b, c ) MulDiv( a, b, c )

void _wpi_setmaxtracksize( WPI_MINMAXINFO _W386FAR *info, int width, int height );
void _wpi_setmintracksize( WPI_MINMAXINFO _W386FAR *info, int width, int height );

    #define _wpi_setdoubleclicktime( rate ) SetDoubleClickTime( rate )

    #define _wpi_iswindowenabled( hwnd ) IsWindowEnabled( hwnd )

    #define _wpi_ellipse( pres, x1, y1, x2, y2 ) Ellipse( pres, x1, y1, x2, y2 )

    #define _wpi_lptodp( pres, line, num ) LPtoDP( pres, line, num )

    #define _wpi_dptolp( pres, line, num ) DPtoLP( pres, line, num )

    #define _wpi_setmapmode( pres, what ) SetMapMode( pres, what )

    #define _wpi_getcurrenttask( ) GetCurrentTask()

    #define _wpi_getrvalue( color ) GetRValue( color )

    #define _wpi_getgvalue( color ) GetGValue( color )

    #define _wpi_getbvalue( color ) GetBValue( color )

    #define _wpi_getrgb( red, green, blue ) RGB( red, green, blue )

    #define _wpi_getmessage( inst, pmsg, hwnd, first, last ) \
        GetMessage( pmsg, hwnd, first, last )

    #define _wpi_translatemessage( msg ) TranslateMessage( msg )

    #define _wpi_postquitmessage( parm ) PostQuitMessage( parm )

    #define _wpi_setmodhandle( name, inst ) *inst = *inst;

    #define _wpi_issameinst( inst1, inst2 ) ( inst1 == inst2 )

    #define _wpi_setwpiinst( inst, mod_handle, ret ) *(ret) = (HANDLE)(inst);

    #define _wpi_dispatchmessage( inst, msg ) DispatchMessage( msg )

    #define _wpi_postmessage( hwnd, msg, parm1, parm2 ) \
                                        PostMessage( hwnd, msg, parm1, parm2 )

    #define _wpi_postappmessage( hmq, msg, parm1, parm2 ) \
                                        PostAppMessage( hmq, msg, parm1, parm2 )

    #define _wpi_peekmessage( inst, qmsg, hwnd, min, max, remove ) \
                                PeekMessage( qmsg, hwnd, min, max, remove )

    #define _wpi_sendmessage( hwnd, msgid, parm1, parm2 ) \
                                SendMessage( hwnd, msgid, parm1, parm2 )

    #define _wpi_senddlgitemmessage( hwnd, item, msgid, parm1, parm2 ) \
                        SendDlgItemMessage( hwnd, item, msgid, parm1, parm2 )

    #define _wpi_getdlgitemcbtext( hwnd, item, selection, len, text ) \
        _wpi_senddlgitemmessage( hwnd, item, CB_GETLBTEXT, \
                        selection, (DWORD)(LPSTR) text )

    #define _wpi_getdlgitemlbtext( hwnd, item, selection, len, text ) \
        _wpi_senddlgitemmessage( hwnd, item, LB_GETTEXT, \
                        selection, (DWORD)(LPSTR) text )

    #define _wpi_setdlgitemtext( hwnd, item, text ) \
                                            SetDlgItemText( hwnd, item, text )

    #define _wpi_getdlgitemtext( hwnd, item, text, size ) \
                                        GetDlgItemText( hwnd, item, text, size )

    #define _wpi_getdlgitemshort( hwnd, item, ptrans, issigned ) \
                            (short)GetDlgItemInt( hwnd, item, ptrans, issigned )

    #define _wpi_getdlgitemint( hwnd, item, ftrns, signed ) \
        GetDlgItemInt( hwnd, item, ftrns, signed )

    #define _wpi_setdlgitemshort( hwnd, item, value, signed  ) \
        SetDlgItemInt( hwnd, item, value, signed );

    #define _wpi_setdlgitemint( hwnd, item, value, signed  ) \
        SetDlgItemInt( hwnd, item, value, signed );

    #define _wpi_ret_wminitdlg( bool_val ) ( (WPI_DLGRESULT) bool_val )

extern void _wpi_preparemono( WPI_PRES hdc, WPI_COLOUR colour,
                                                    WPI_COLOUR back_colour );

    #define _wpi_torgbmode( pres ) \
                // do nothing

    #define _wpi_bitblt( dest, x_pos, y_pos, width, height, source, new_x, new_y, format ) \
        BitBlt( dest, x_pos, y_pos, width, height, source, new_x, new_y, format );

    #define _wpi_patblt( dest, x, y, cx, cy, format ) \
        PatBlt( dest, x, y, cx, cy, format );

    #define _wpi_createos2normpres( pres, inst, hwnd ) pres = 0

    #define _wpi_deleteos2normpres( pres ) pres = 0

extern WPI_PRES _wpi_createcompatiblepres( WPI_PRES pres, WPI_INST inst, HDC *hdc );

    #define _wpi_deletepres( pres, hdc ) DeleteDC( pres )

    #define _wpi_deletecompatiblepres( pres, hdc ) DeleteDC( pres )

    #define _wpi_selectbitmap( pres, new_bmp ) SelectObject( pres, new_bmp )

    #define _wpi_getoldbitmap( pres, bmp ) SelectObject( pres, bmp )

    #define _wpi_deletebitmap( bmp ) DeleteObject( bmp )

    #define _wpi_translateaccelerator( inst, hwnd, accel, msg ) \
                                    TranslateAccelerator( hwnd, accel, msg )

    #define _wpi_loadaccelerators( inst, id ) LoadAccelerators( inst, id )

    #define _wpi_getscreenpres() GetDC( GetDesktopWindow() )

    #define _wpi_releasescreenpres( hps ) ReleaseDC( GetDesktopWindow(), hps )

    #define _wpi_loadbitmap( inst, id ) LoadBitmap( inst, id )

extern void _wpi_getbitmapdim( HBITMAP bmp, int *pwidth, int *pheight );

    #define _wpi_getpres( hdl ) GetDC( hdl )

    #define _wpi_releasepres( hdl, pres ) ReleaseDC( hdl, pres )

    #define _wpi_createcompatiblebitmap( pres, width, height ) \
        CreateCompatibleBitmap( pres, width, height )

    #define _wpi_preparesyscolour( format ) \
        // nothing

    #define _wpi_getsyscolour( format ) GetSysColor( format )

    #define _wpi_getwindowrect( hwnd, rect ) GetWindowRect( hwnd, rect )

    #define _wpi_getdlgitem( parent, id ) GetDlgItem( parent, id )

    #define _wpi_screentoclient( hdl, pt ) ScreenToClient( hdl, pt )

    #define _wpi_clienttoscreen( hdl, pt ) ClientToScreen( hdl, pt )

    #define _wpi_mapwindowpoints( hfrom, hto, ppts, num ) \
                                MapWindowPoints( hfrom, hto, ppts, num )

    #define _wpi_getcursorpos( pt ) GetCursorPos( pt )

    #define _wpi_clipcursor( rect ) ClipCursor( rect )

    #define _wpi_getnearestcolor( pres, colour ) GetNearestColor( pres, colour )

    #define _wpi_offsetrect( inst, rect, x, y ) OffsetRect( rect, x, y )

    #define _wpi_fillrect( pres, rect, colour, brush ) \
        FillRect( pres, rect, brush );

    #define _wpi_beginpaint( hwnd, pres, paint ) BeginPaint( hwnd, paint )

    #define _wpi_endpaint( hwnd, pres, paint ) EndPaint( hwnd, paint )

    #define _wpi_createwindow( class, name, frame_style, create_flags, \
                    client_style, x, y, width, height, parent, menu, inst, \
                    pparam, pframe_hwnd ) \
        CreateWindow( (class), (name), (frame_style) | (create_flags) | \
                (client_style), x, y, width, height, parent, menu, inst, \
                pparam )

    #define _wpi_createobjwindow( class, name, style, x, y, width, height, \
                        parent, menu, inst, pparam, pframe ) \
        CreateWindow( class, name, style, x, y, width, height, parent, menu, \
                                                                inst, pparam )

    #define _wpi_getwindowtext( hwnd, text, size ) \
                                            GetWindowText( hwnd, text, size )

    #define _wpi_getwindowword( hwnd, id ) GetWindowWord( hwnd, id )

    #define _wpi_setwindowword( hwnd, id, data ) SetWindowWord( hwnd, id, data )

    #define _wpi_getwindowlong( hwnd, id ) GetWindowLong( hwnd, id )

    #define _wpi_setwindowlong( hwnd, id, data ) SetWindowLong( hwnd, id, data )

    #define _wpi_registerclass( class ) RegisterClass( class )

    #define _wpi_unregisterclass( name, inst ) UnregisterClass( name, inst )

    #define _wpi_getclassinfo( inst, name, info ) \
                                            GetClassInfo( NULL, name, info )

    #define _wpi_makeprocinstance( proc, inst ) MakeProcInstance( proc, inst )

    #define _wpi_makeenumprocinstance( proc, inst ) \
                                    (WPI_ENUMPROC)MakeProcInstance( (FARPROC)proc, inst )

    #define _wpi_makelineddaprocinstance( proc, inst ) \
                                    (WPI_LINEDDAPROC)MakeProcInstance( (FARPROC)proc, inst )

    #define _wpi_defdlgproc( hwnd, msg, mp1, mp2 ) FALSE

⌨️ 快捷键说明

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