Moved ...Resource16 routines to loader/resource.c.
[wine] / include / win.h
1 /*
2  * Window definitions
3  *
4  * Copyright 1993 Alexandre Julliard
5  */
6
7 #ifndef __WINE_WIN_H
8 #define __WINE_WIN_H
9
10 #include "ts_xlib.h"
11
12 #include "ldt.h"
13 #include "class.h"
14 #include "winproc.h"
15
16 #define WND_MAGIC     0x444e4957  /* 'WIND' */
17
18   /* Built-in class names (see _Undocumented_Windows_ p.418) */
19 #define POPUPMENU_CLASS_NAME "#32768"  /* PopupMenu */
20 #define DESKTOP_CLASS_NAME   "#32769"  /* Desktop */
21 #define DIALOG_CLASS_NAME    "#32770"  /* Dialog */
22 #define WINSWITCH_CLASS_NAME "#32771"  /* WinSwitch */
23 #define ICONTITLE_CLASS_NAME "#32772"  /* IconTitle */
24
25 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768)  /* PopupMenu */
26 #define DESKTOP_CLASS_ATOM   ((ATOM)32769)       /* Desktop */
27 #define DIALOG_CLASS_ATOM    MAKEINTATOM(32770)  /* Dialog */
28 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771)  /* WinSwitch */
29 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772)  /* IconTitle */
30
31 /* Built-in 32-bit classes */
32 typedef enum
33 {
34     BIC32_BUTTON,
35     BIC32_EDIT,
36     BIC32_LISTBOX,
37     BIC32_COMBO,
38     BIC32_COMBOLB,
39     BIC32_POPUPMENU,
40     BIC32_STATIC,
41     BIC32_SCROLL,
42     BIC32_MDICLIENT,
43     BIC32_DESKTOP,
44     BIC32_DIALOG,
45     BIC32_ICONTITLE,
46     BIC32_NB_CLASSES
47 } BUILTIN_CLASS32;
48
49   /* PAINT_RedrawWindow() control flags */
50 #define RDW_C_USEHRGN           0x0001
51 #define RDW_C_DELETEHRGN        0x0002
52
53 struct tagDCE;
54 struct _WND_DRIVER;
55
56 typedef struct tagWND
57 {
58     struct tagWND *next;          /* Next sibling */
59     struct tagWND *child;         /* First child */
60     struct tagWND *parent;        /* Window parent (from CreateWindow) */
61     struct tagWND *owner;         /* Window owner */
62     CLASS         *class;         /* Window class */
63     HWINDOWPROC    winproc;       /* Window procedure */
64     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
65     HWND32         hwndSelf;      /* Handle of this window */
66     HINSTANCE32    hInstance;     /* Window hInstance (from CreateWindow) */
67     RECT32         rectClient;    /* Client area rel. to parent client area */
68     RECT32         rectWindow;    /* Whole window rel. to parent client area */
69     LPSTR          text;          /* Window text */
70     void          *pVScroll;      /* Vertical scroll-bar info */
71     void          *pHScroll;      /* Horizontal scroll-bar info */
72     void          *pProp;         /* Pointer to properties list */
73     struct tagDCE *dce;           /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
74     HGLOBAL16      hmemTaskQ;     /* Task queue global memory handle */
75     HRGN16         hrgnUpdate;    /* Update region */
76     HWND32         hwndLastActive;/* Last active popup hwnd */
77     DWORD          dwStyle;       /* Window style (from CreateWindow) */
78     DWORD          dwExStyle;     /* Extended style (from CreateWindowEx) */
79     UINT32         wIDmenu;       /* ID or hmenu (from CreateWindow) */
80     DWORD          helpContext;   /* Help context ID */
81     WORD           flags;         /* Misc. flags (see below) */
82     Window         window;        /* X window (only for top-level windows) */
83     HMENU16        hSysMenu;      /* window's copy of System Menu */
84     DWORD          userdata;      /* User private data */
85     struct _WND_DRIVER *pDriver;  /* Window driver */
86     XExposeEvent  *expose_event;  /* Deferred expose event */
87     DWORD          wExtra[1];     /* Window extra bytes */
88 } WND;
89
90 typedef struct _WND_DRIVER
91 {
92     BOOL32 (*pCreateWindow)(WND *, CLASS *, CREATESTRUCT32A *, BOOL32);
93     WND*   (*pSetParent)(WND *, WND *);
94 } WND_DRIVER;
95
96 /* X11 windows driver */
97 /* FIXME: does not belong here */
98 extern WND_DRIVER X11DRV_WND_Driver;
99
100 typedef struct
101 {
102     RECT16         rectNormal;
103     POINT16        ptIconPos;
104     POINT16        ptMaxPos;
105     HWND16         hwndIconTitle;
106 } INTERNALPOS, *LPINTERNALPOS;
107
108   /* WND flags values */
109 #define WIN_NEEDS_BEGINPAINT   0x0001 /* WM_PAINT sent to window */
110 #define WIN_NEEDS_ERASEBKGND   0x0002 /* WM_ERASEBKGND must be sent to window*/
111 #define WIN_NEEDS_NCPAINT      0x0004 /* WM_NCPAINT must be sent to window */
112 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
113 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
114 /* Used to have WIN_NO_REDRAW  0x0020 here */
115 #define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
116 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
117 #define WIN_MANAGED            0x0100 /* Window managed by the X wm */
118 #define WIN_ISDIALOG           0x0200 /* Window is a dialog */
119 #define WIN_ISWIN32            0x0400 /* Understands Win32 messages */
120 #define WIN_SAVEUNDER_OVERRIDE 0x0800
121
122   /* BuildWinArray() flags */
123 #define BWA_SKIPDISABLED        0x0001
124 #define BWA_SKIPHIDDEN          0x0002
125 #define BWA_SKIPOWNED           0x0004
126 #define BWA_SKIPICONIC          0x0008
127
128   /* Window functions */
129 extern WND*   WIN_FindWndPtr( HWND32 hwnd );
130 extern WND*   WIN_GetDesktop(void);
131 extern void   WIN_DumpWindow( HWND32 hwnd );
132 extern void   WIN_WalkWindows( HWND32 hwnd, int indent );
133 extern Window WIN_GetXWindow( HWND32 hwnd );
134 extern BOOL32 WIN_UnlinkWindow( HWND32 hwnd );
135 extern BOOL32 WIN_LinkWindow( HWND32 hwnd, HWND32 hwndInsertAfter );
136 extern HWND32 WIN_FindWinToRepaint( HWND32 hwnd, HQUEUE16 hQueue );
137 extern BOOL32 WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew);
138 extern BOOL32 WIN_CreateDesktopWindow(void);
139 extern HWND32 WIN_GetTopParent( HWND32 hwnd );
140 extern WND*   WIN_GetTopParentPtr( WND* pWnd );
141 extern BOOL32 WIN_IsWindowDrawable(WND*, BOOL32 );
142 extern HINSTANCE32 WIN_GetWindowInstance( HWND32 hwnd );
143 extern WND**  WIN_BuildWinArray( WND *wndPtr, UINT32 bwa, UINT32* pnum );
144
145 extern HWND32 CARET_GetHwnd(void);
146 extern void CARET_GetRect(LPRECT32 lprc);  /* windows/caret.c */
147
148 extern BOOL16 DRAG_QueryUpdate( HWND32, SEGPTR, BOOL32 );
149 extern void DEFWND_SetText( WND *wndPtr, LPCSTR text );
150 extern HBRUSH32 DEFWND_ControlColor( HDC32 hDC, UINT16 ctlType );     /* windows/defwnd.c */
151
152 extern void PROPERTY_RemoveWindowProps( WND *pWnd );                  /* windows/property.c */
153
154 extern BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate,
155                                   HRGN32 hrgnUpdate, UINT32 flags,
156                                   UINT32 control );                   /* windows/painting.c */
157
158 /* controls/widgets.c */
159 extern BOOL32 WIDGETS_Init( void );
160 extern BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls );  
161
162 /* controls/icontitle.c */
163 extern HWND32 ICONTITLE_Create( WND* );
164 extern BOOL32 ICONTITLE_Init( void );
165
166 /* windows/focus.c */
167 extern void FOCUS_SetXFocus( HWND32 );
168 extern void FOCUS_SwitchFocus( HWND32 , HWND32 );
169
170 extern Display * display;
171 extern Screen * screen;
172 extern Window rootWindow;
173
174 #endif  /* __WINE_WIN_H */