win.h 6.48 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4
/*
 * Window definitions
 *
 * Copyright 1993 Alexandre Julliard
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
19 20
 */

Alexandre Julliard's avatar
Alexandre Julliard committed
21 22
#ifndef __WINE_WIN_H
#define __WINE_WIN_H
Alexandre Julliard's avatar
Alexandre Julliard committed
23

24
#include <stdarg.h>
25 26 27 28
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
Alexandre Julliard's avatar
Alexandre Julliard committed
29

30
#include "user_private.h"
31
#include "wine/server_protocol.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
32

33
struct tagCLASS;
34
struct tagDIALOGINFO;
Alexandre Julliard's avatar
Alexandre Julliard committed
35

Alexandre Julliard's avatar
Alexandre Julliard committed
36 37
typedef struct tagWND
{
38
    struct user_object obj;       /* object header */
39
    HWND           parent;        /* Window parent */
40
    HWND           owner;         /* Window owner */
41
    struct tagCLASS *class;       /* Window class */
42
    struct dce    *dce;           /* DCE pointer */
43
    WNDPROC        winproc;       /* Window procedure */
44
    DWORD          tid;           /* Owner thread id */
45 46 47
    HINSTANCE      hInstance;     /* Window hInstance (from CreateWindow) */
    RECT           rectClient;    /* Client area rel. to parent client area */
    RECT           rectWindow;    /* Whole window rel. to parent client area */
48 49 50 51
    RECT           normal_rect;   /* Normal window rect saved when maximized/minimized */
    POINT          min_pos;       /* Position for minimized window */
    POINT          max_pos;       /* Position for maximized window */
    HWND           icon_title;    /* Icon title window */
52
    LPWSTR         text;          /* Window text */
53
    void          *pScroll;       /* Scroll-bar info */
Alexandre Julliard's avatar
Alexandre Julliard committed
54 55
    DWORD          dwStyle;       /* Window style (from CreateWindow) */
    DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
56
    UINT_PTR       wIDmenu;       /* ID or hmenu (from CreateWindow) */
Alexandre Julliard's avatar
Alexandre Julliard committed
57
    DWORD          helpContext;   /* Help context ID */
58
    UINT           flags;         /* Misc. flags (see below) */
59
    HMENU          hSysMenu;      /* window's copy of System Menu */
60 61
    HICON          hIcon;         /* window's icon */
    HICON          hIconSmall;    /* window's small icon */
62
    struct tagDIALOGINFO *dlgInfo;/* Dialog additional info (dialogs only) */
63
    int            cbWndExtra;    /* class cbWndExtra at window creation */
64
    DWORD_PTR      userdata;      /* User private data */
Alexandre Julliard's avatar
Alexandre Julliard committed
65
    DWORD          wExtra[1];     /* Window extra bytes */
Alexandre Julliard's avatar
Alexandre Julliard committed
66 67
} WND;

Alexandre Julliard's avatar
Alexandre Julliard committed
68
  /* WND flags values */
69 70 71 72
#define WIN_RESTORE_MAX           0x0001 /* Maximize when restoring */
#define WIN_NEED_SIZE             0x0002 /* Internal WM_SIZE is needed */
#define WIN_NCACTIVATED           0x0004 /* last WM_NCACTIVATE was positive */
#define WIN_ISMDICLIENT           0x0008 /* Window is an MDIClient */
73 74
#define WIN_ISUNICODE             0x0010 /* Window is Unicode */
#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
75
#define WIN_CHILDREN_MOVED        0x0040 /* children may have moved, ignore stored positions */
Alexandre Julliard's avatar
Alexandre Julliard committed
76

Alexandre Julliard's avatar
Alexandre Julliard committed
77
  /* Window functions */
78 79
extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN;
extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN;
80
extern WND *WIN_GetPtr( HWND hwnd ) DECLSPEC_HIDDEN;
81
extern HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN;
82 83 84 85
extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN;
extern HWND WIN_SetOwner( HWND hwnd, HWND owner ) DECLSPEC_HIDDEN;
extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPEC_HIDDEN;
86
extern BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN;
87
extern void map_window_region( HWND from, HWND to, HRGN hrgn ) DECLSPEC_HIDDEN;
88 89
extern LRESULT WIN_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN;
extern void WIN_DestroyThreadWindows( HWND hwnd ) DECLSPEC_HIDDEN;
90
extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ) DECLSPEC_HIDDEN;
91 92 93 94
extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL ) DECLSPEC_HIDDEN;
extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN;
extern LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOOL unicode ) DECLSPEC_HIDDEN;
extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ) DECLSPEC_HIDDEN;
95
extern HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK access ) DECLSPEC_HIDDEN;
Alexandre Julliard's avatar
Alexandre Julliard committed
96

97
/* user lock */
98 99
extern void USER_Lock(void) DECLSPEC_HIDDEN;
extern void USER_Unlock(void) DECLSPEC_HIDDEN;
100

101
/* to release pointers retrieved by WIN_GetPtr */
102
static inline void WIN_ReleasePtr( WND *ptr )
103 104 105 106 107
{
    USER_Unlock();
}

#define WND_OTHER_PROCESS ((WND *)1)  /* returned by WIN_GetPtr on unknown window handles */
108
#define WND_DESKTOP       ((WND *)2)  /* returned by WIN_GetPtr on the desktop window */
109

110
extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN;
111

112
extern BOOL WINPOS_RedrawIconTitle( HWND hWnd ) DECLSPEC_HIDDEN;
113
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POINT *minTrack,
114 115 116 117
                                  POINT *maxTrack ) DECLSPEC_HIDDEN;
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos) DECLSPEC_HIDDEN;
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest ) DECLSPEC_HIDDEN;
extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
118
extern UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect ) DECLSPEC_HIDDEN;
119
extern void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam ) DECLSPEC_HIDDEN;
120

121
extern BOOL set_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags,
122 123
                            const RECT *window_rect, const RECT *client_rect,
                            const RECT *valid_rects ) DECLSPEC_HIDDEN;
124

125 126 127 128 129 130 131 132
static inline void mirror_rect( const RECT *window_rect, RECT *rect )
{
    int width = window_rect->right - window_rect->left;
    int tmp = rect->left;
    rect->left = width - rect->right;
    rect->right = width - tmp;
}

Alexandre Julliard's avatar
Alexandre Julliard committed
133
#endif  /* __WINE_WIN_H */