kernelbase: Check pointer validity in unsafe_ptr_from_HLOCAL.
[wine.git] / dlls / user32 / controls.h
blobffa131e9d63637eb6d67e9bbcb057d0135f0b117
1 /*
2 * User controls definitions
4 * Copyright 2000 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * 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
21 #ifndef __WINE_CONTROLS_H
22 #define __WINE_CONTROLS_H
24 #include "winuser.h"
25 #include "../win32u/ntuser_private.h"
27 /* Built-in class descriptor */
28 struct builtin_class_descr
30 LPCWSTR name; /* class name */
31 UINT style; /* class style */
32 enum builtin_winprocs proc;
33 INT extra; /* window extra bytes */
34 ULONG_PTR cursor; /* cursor id */
35 HBRUSH brush; /* brush or system color */
38 extern const struct builtin_class_descr BUTTON_builtin_class DECLSPEC_HIDDEN;
39 extern const struct builtin_class_descr COMBO_builtin_class DECLSPEC_HIDDEN;
40 extern const struct builtin_class_descr COMBOLBOX_builtin_class DECLSPEC_HIDDEN;
41 extern const struct builtin_class_descr DIALOG_builtin_class DECLSPEC_HIDDEN;
42 extern const struct builtin_class_descr DESKTOP_builtin_class DECLSPEC_HIDDEN;
43 extern const struct builtin_class_descr EDIT_builtin_class DECLSPEC_HIDDEN;
44 extern const struct builtin_class_descr ICONTITLE_builtin_class DECLSPEC_HIDDEN;
45 extern const struct builtin_class_descr LISTBOX_builtin_class DECLSPEC_HIDDEN;
46 extern const struct builtin_class_descr MDICLIENT_builtin_class DECLSPEC_HIDDEN;
47 extern const struct builtin_class_descr MENU_builtin_class DECLSPEC_HIDDEN;
48 extern const struct builtin_class_descr MESSAGE_builtin_class DECLSPEC_HIDDEN;
49 extern const struct builtin_class_descr SCROLL_builtin_class DECLSPEC_HIDDEN;
50 extern const struct builtin_class_descr STATIC_builtin_class DECLSPEC_HIDDEN;
51 extern const struct builtin_class_descr IME_builtin_class DECLSPEC_HIDDEN;
53 extern LRESULT WINAPI ImeWndProcA(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
54 extern LRESULT WINAPI ImeWndProcW(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
55 extern LRESULT WINAPI DesktopWndProc(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
56 extern LRESULT WINAPI IconTitleWndProc(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
57 extern LRESULT WINAPI PopupMenuWndProc(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
58 extern LRESULT WINAPI MessageWndProc(HWND,UINT,WPARAM,LPARAM) DECLSPEC_HIDDEN;
60 /* Wow handlers */
62 /* the structures must match the corresponding ones in user.exe */
63 struct wow_handlers16
65 LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
66 LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
67 LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
68 LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
69 LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
70 LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
71 LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
72 DWORD (*wait_message)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
73 HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL);
74 LRESULT (*call_window_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
75 LRESULT (*call_dialog_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
78 struct wow_handlers32
80 LRESULT (*button_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
81 LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
82 LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
83 LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
84 LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
85 LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
86 LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
87 DWORD (*wait_message)(DWORD,const HANDLE*,DWORD,DWORD,DWORD);
88 HWND (*create_window)(CREATESTRUCTW*,LPCWSTR,HINSTANCE,BOOL);
89 HWND (*get_win_handle)(HWND);
90 WNDPROC (*alloc_winproc)(WNDPROC,BOOL);
91 struct tagDIALOGINFO *(*get_dialog_info)(HWND,BOOL);
92 INT (*dialog_box_loop)(HWND,HWND);
95 extern struct wow_handlers16 wow_handlers DECLSPEC_HIDDEN;
97 extern LRESULT ButtonWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
98 extern LRESULT ComboWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
99 extern LRESULT EditWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
100 extern LRESULT ListBoxWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
101 extern LRESULT MDIClientWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
102 extern LRESULT ScrollBarWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
103 extern LRESULT StaticWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
105 /* Class functions */
106 struct tagCLASS; /* opaque structure */
107 struct tagWND;
108 extern ATOM get_int_atom_value( UNICODE_STRING *name ) DECLSPEC_HIDDEN;
109 extern void register_builtin_classes(void) DECLSPEC_HIDDEN;
110 extern void register_desktop_class(void) DECLSPEC_HIDDEN;
112 /* defwnd proc */
113 extern HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ) DECLSPEC_HIDDEN;
115 /* desktop */
116 extern BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern ) DECLSPEC_HIDDEN;
118 /* menu controls */
119 extern HWND MENU_IsMenuActive(void) DECLSPEC_HIDDEN;
120 extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
121 INT orgX, INT orgY ) DECLSPEC_HIDDEN;
122 extern BOOL MENU_SetMenu(HWND, HMENU) DECLSPEC_HIDDEN;
123 extern void MENU_TrackMouseMenuBar( HWND hwnd, INT ht, POINT pt ) DECLSPEC_HIDDEN;
124 extern void MENU_TrackKbdMenuBar( HWND hwnd, UINT wParam, WCHAR wChar ) DECLSPEC_HIDDEN;
125 extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, HWND hwnd ) DECLSPEC_HIDDEN;
126 extern void MENU_EndMenu(HWND) DECLSPEC_HIDDEN;
127 extern void free_menu_items( void *ptr ) DECLSPEC_HIDDEN;
129 /* nonclient area */
130 extern LRESULT NC_HandleNCPaint( HWND hwnd , HRGN clip) DECLSPEC_HIDDEN;
131 extern LRESULT NC_HandleNCActivate( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
132 extern void NC_HandleNCCalcSize( HWND hwnd, WPARAM wParam, RECT *winRect ) DECLSPEC_HIDDEN;
133 extern LRESULT NC_HandleNCHitTest( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN;
134 extern LRESULT NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
135 extern LRESULT NC_HandleNCMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
136 extern LRESULT NC_HandleNCMouseLeave( HWND hwnd ) DECLSPEC_HIDDEN;
137 extern LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
138 extern LRESULT NC_HandleNCLButtonDblClk( HWND hwnd, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
139 extern LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
140 extern LRESULT NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) DECLSPEC_HIDDEN;
141 extern BOOL NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) DECLSPEC_HIDDEN;
142 extern void NC_GetSysPopupPos( HWND hwnd, RECT* rect ) DECLSPEC_HIDDEN;
144 /* scrollbar */
146 extern void SCROLL_DrawNCScrollBar( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ) DECLSPEC_HIDDEN;
147 extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar, enum SCROLL_HITTEST hit_test,
148 const struct SCROLL_TRACKING_INFO *tracking_info, BOOL arrows,
149 BOOL interior ) DECLSPEC_HIDDEN;
150 extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar, UINT msg, POINT pt ) DECLSPEC_HIDDEN;
151 extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ) DECLSPEC_HIDDEN;
153 /* combo box */
155 #define ID_CB_LISTBOX 1000
156 #define ID_CB_EDIT 1001
158 /* internal flags */
159 #define CBF_DROPPED 0x0001
160 #define CBF_BUTTONDOWN 0x0002
161 #define CBF_NOROLLUP 0x0004
162 #define CBF_MEASUREITEM 0x0008
163 #define CBF_FOCUSED 0x0010
164 #define CBF_CAPTURE 0x0020
165 #define CBF_EDIT 0x0040
166 #define CBF_NORESIZE 0x0080
167 #define CBF_NOTIFY 0x0100
168 #define CBF_NOREDRAW 0x0200
169 #define CBF_SELCHANGE 0x0400
170 #define CBF_NOEDITNOTIFY 0x1000
171 #define CBF_NOLBSELECT 0x2000 /* do not change current selection */
172 #define CBF_BEENFOCUSED 0x4000 /* has it ever had focus */
173 #define CBF_EUI 0x8000
175 /* combo state struct */
176 typedef struct
178 HWND self;
179 HWND owner;
180 UINT dwStyle;
181 HWND hWndEdit;
182 HWND hWndLBox;
183 UINT wState;
184 HFONT hFont;
185 RECT textRect;
186 RECT buttonRect;
187 RECT droppedRect;
188 INT droppedIndex;
189 INT fixedOwnerDrawHeight;
190 INT droppedWidth; /* not used unless set explicitly */
191 INT item_height;
192 } HEADCOMBO,*LPHEADCOMBO;
194 extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL ) DECLSPEC_HIDDEN;
196 /* Dialog info structure (note: shared with user.exe) */
197 typedef struct tagDIALOGINFO
199 HWND hwndFocus; /* Current control with focus */
200 HFONT hUserFont; /* Dialog font */
201 HMENU hMenu; /* Dialog menu */
202 UINT xBaseUnit; /* Dialog units (depends on the font) */
203 UINT yBaseUnit;
204 INT idResult; /* EndDialog() result / default pushbutton ID */
205 UINT flags; /* EndDialog() called for this dialog */
206 } DIALOGINFO;
208 #define DF_END 0x0001
210 extern DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create ) DECLSPEC_HIDDEN;
211 extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner ) DECLSPEC_HIDDEN;
213 HRGN set_control_clipping( HDC hdc, const RECT *rect ) DECLSPEC_HIDDEN;
215 #endif /* __WINE_CONTROLS_H */