Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Windows widgets (built-in window classes) |
| 3 | * |
| 4 | * Copyright 1993 Alexandre Julliard |
Alexandre Julliard | 2787be8 | 1995-05-22 18:23:01 +0000 | [diff] [blame] | 5 | */ |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 6 | |
Jeff Garzik | c3e1f72 | 1999-02-19 15:42:11 +0000 | [diff] [blame] | 7 | #include <string.h> |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 8 | #include <assert.h> |
| 9 | |
Alexandre Julliard | fb9a919 | 1994-03-01 19:48:04 +0000 | [diff] [blame] | 10 | #include "win.h" |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 11 | #include "button.h" |
| 12 | #include "static.h" |
Alexandre Julliard | ecc3712 | 1994-11-22 16:31:29 +0000 | [diff] [blame] | 13 | #include "scroll.h" |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 14 | #include "desktop.h" |
| 15 | #include "mdi.h" |
| 16 | #include "gdi.h" |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 17 | #include "module.h" |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 18 | #include "heap.h" |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 19 | |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 20 | /* Window procedures */ |
| 21 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 22 | extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, |
| 23 | WPARAM wParam, LPARAM lParam ); |
| 24 | extern LRESULT WINAPI ComboWndProc( HWND hwnd, UINT msg, |
| 25 | WPARAM wParam, LPARAM lParam ); |
| 26 | extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg, |
| 27 | WPARAM wParam, LPARAM lParam ); |
| 28 | extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, |
| 29 | WPARAM wParam, LPARAM lParam ); |
| 30 | extern LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT msg, |
| 31 | WPARAM wParam, LPARAM lParam ); |
| 32 | extern LRESULT WINAPI IconTitleWndProc( HWND hwnd, UINT msg, |
| 33 | WPARAM wParam, LPARAM lParam ); |
Alexandre Julliard | da0cfb3 | 1996-12-01 17:17:47 +0000 | [diff] [blame] | 34 | |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 35 | /* Built-in classes */ |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 36 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 37 | static WNDCLASSA WIDGETS_BuiltinClasses[BIC32_NB_CLASSES] = |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 38 | { |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 39 | /* BIC32_BUTTON */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 40 | { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 41 | ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 42 | (HCURSOR)IDC_ARROWA, 0, 0, "Button" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 43 | /* BIC32_EDIT */ |
Alexandre Julliard | 75d86e1 | 1996-11-17 18:59:11 +0000 | [diff] [blame] | 44 | { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/, |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 45 | EditWndProc, 0, sizeof(void *), 0, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 46 | (HCURSOR)IDC_IBEAMA, 0, 0, "Edit" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 47 | /* BIC32_LISTBOX */ |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 48 | { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/, |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 49 | ListBoxWndProc, 0, sizeof(void *), 0, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 50 | (HCURSOR)IDC_ARROWA, 0, 0, "ListBox" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 51 | /* BIC32_COMBO */ |
| 52 | { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 53 | ComboWndProc, 0, sizeof(void *), 0, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 54 | (HCURSOR)IDC_ARROWA, 0, 0, "ComboBox" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 55 | /* BIC32_COMBOLB */ |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 56 | { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 57 | 0, sizeof(void *), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "ComboLBox" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 58 | /* BIC32_POPUPMENU */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 59 | { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, sizeof(HMENU), |
| 60 | 0, 0, (HCURSOR)IDC_ARROWA, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME }, |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 61 | /* BIC32_STATIC */ |
| 62 | { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 63 | 0, sizeof(STATICINFO), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "Static" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 64 | /* BIC32_SCROLL */ |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 65 | { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 66 | ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 67 | (HCURSOR)IDC_ARROWA, 0, 0, "ScrollBar"}, |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 68 | /* BIC32_MDICLIENT */ |
| 69 | { CS_GLOBALCLASS, MDIClientWndProc, |
| 70 | 0, sizeof(MDICLIENTINFO), 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, "MDIClient" }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 71 | /* BIC32_DESKTOP */ |
Patrik Stridvall | 8d8703c | 1999-02-04 14:05:38 +0000 | [diff] [blame] | 72 | { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOP), |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 73 | 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DESKTOP_CLASS_NAME }, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 74 | /* BIC32_DIALOG */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 75 | { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProcA, 0, DLGWINDOWEXTRA, |
| 76 | 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DIALOG_CLASS_NAME }, |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 77 | /* BIC32_ICONTITLE */ |
| 78 | { CS_GLOBALCLASS, IconTitleWndProc, 0, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 79 | 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, ICONTITLE_CLASS_NAME } |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 82 | static ATOM bicAtomTable[BIC32_NB_CLASSES]; |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 83 | |
| 84 | /*********************************************************************** |
| 85 | * WIDGETS_Init |
| 86 | * |
| 87 | * Initialize the built-in window classes. |
| 88 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 89 | BOOL WIDGETS_Init(void) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 90 | { |
| 91 | int i; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 92 | WNDCLASSA *cls = WIDGETS_BuiltinClasses; |
Alexandre Julliard | 940d58c | 1994-09-16 09:24:37 +0000 | [diff] [blame] | 93 | |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 94 | /* Create builtin classes */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 95 | |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 96 | for (i = 0; i < BIC32_NB_CLASSES; i++, cls++) |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 97 | { |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 98 | char name[20]; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 99 | /* Just to make sure the string is > 0x10000 */ |
Alexandre Julliard | a0b2b1d | 1997-11-16 17:38:29 +0000 | [diff] [blame] | 100 | strcpy( name, (char *)cls->lpszClassName ); |
| 101 | cls->lpszClassName = name; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 102 | cls->hCursor = LoadCursorA( 0, (LPCSTR)cls->hCursor ); |
| 103 | if (!(bicAtomTable[i] = RegisterClassA( cls ))) return FALSE; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Alexandre Julliard | 75a839a | 1993-07-15 11:13:45 +0000 | [diff] [blame] | 106 | return TRUE; |
| 107 | } |
Alexandre Julliard | 8cc3a5e | 1996-08-11 15:49:51 +0000 | [diff] [blame] | 108 | |
| 109 | |
| 110 | /*********************************************************************** |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 111 | * WIDGETS_IsControl32 |
| 112 | * |
| 113 | * Check whether pWnd is a built-in control or not. |
| 114 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 115 | BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls ) |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 116 | { |
| 117 | assert( cls < BIC32_NB_CLASSES ); |
| 118 | return (pWnd->class->atomName == bicAtomTable[cls]); |
| 119 | } |