2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
21 /* Window procedures */
23 extern LRESULT
EditWndProc( HWND32 hwnd
, UINT32 msg
, WPARAM32 wParam
,
25 extern LRESULT
ComboWndProc( HWND32 hwnd
, UINT32 msg
, WPARAM32 wParam
,
27 extern LRESULT
ComboLBWndProc( HWND32 hwnd
, UINT32 msg
, WPARAM32 wParam
,
29 extern LRESULT
ListBoxWndProc( HWND32 hwnd
, UINT32 msg
, WPARAM32 wParam
,
31 extern LRESULT
PopupMenuWndProc( HWND32 hwnd
, UINT32 msg
, WPARAM32 wParam
,
33 extern LRESULT
IconTitleWndProc( HWND32 hwnd
, UINT32 msg
, WPARAM32 wParam
,
36 /* Win16 class info */
45 } BUILTIN_CLASS_INFO16
;
47 /* Win16 built-in classes */
49 static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16
[] =
51 { CS_GLOBALCLASS
, sizeof(MDICLIENTINFO
),
52 STOCK_LTGRAY_BRUSH
, "MDIClientWndProc", "MDIClient" }
55 #define NB_BUILTIN_CLASSES16 \
56 (sizeof(WIDGETS_BuiltinClasses16)/sizeof(WIDGETS_BuiltinClasses16[0]))
58 /* Win32 built-in classes */
60 static WNDCLASS32A WIDGETS_BuiltinClasses32
[BIC32_NB_CLASSES
] =
63 { CS_GLOBALCLASS
| CS_DBLCLKS
| CS_VREDRAW
| CS_HREDRAW
| CS_PARENTDC
,
64 ButtonWndProc
, 0, sizeof(BUTTONINFO
), 0, 0, IDC_ARROW
, 0, 0, "Button" },
66 { CS_GLOBALCLASS
| CS_DBLCLKS
/*| CS_PARENTDC*/,
67 EditWndProc
, 0, sizeof(void *), 0, 0, IDC_IBEAM
, 0, 0, "Edit" },
69 { CS_GLOBALCLASS
| CS_DBLCLKS
/*| CS_PARENTDC*/,
70 ListBoxWndProc
, 0, sizeof(void *), 0, 0, IDC_ARROW
, 0, 0, "ListBox" },
72 { CS_GLOBALCLASS
| CS_PARENTDC
| CS_DBLCLKS
,
73 ComboWndProc
, 0, sizeof(void *), 0, 0, IDC_ARROW
, 0, 0, "ComboBox" },
75 { CS_GLOBALCLASS
| CS_DBLCLKS
| CS_SAVEBITS
,
76 ComboLBWndProc
, 0, sizeof(void *), 0, 0, IDC_ARROW
, 0, 0, "ComboLBox" },
78 { CS_GLOBALCLASS
| CS_SAVEBITS
, PopupMenuWndProc
, 0,
79 sizeof(HMENU32
), 0, 0, IDC_ARROW
, NULL_BRUSH
, 0, POPUPMENU_CLASS_NAME
},
81 { CS_GLOBALCLASS
| CS_PARENTDC
, StaticWndProc
,
82 0, sizeof(STATICINFO
), 0, 0, IDC_ARROW
, 0, 0, "Static" },
84 { CS_GLOBALCLASS
| CS_DBLCLKS
| CS_VREDRAW
| CS_HREDRAW
| CS_PARENTDC
,
85 ScrollBarWndProc
, 0, sizeof(SCROLLBAR_INFO
), 0, 0, IDC_ARROW
, 0, 0, "ScrollBar"},
87 { CS_GLOBALCLASS
, DesktopWndProc
, 0, sizeof(DESKTOPINFO
),
88 0, 0, IDC_ARROW
, 0, 0, DESKTOP_CLASS_NAME
},
90 { CS_GLOBALCLASS
| CS_SAVEBITS
, DefDlgProc32A
, 0, DLGWINDOWEXTRA
,
91 0, 0, IDC_ARROW
, 0, 0, DIALOG_CLASS_NAME
},
93 { CS_GLOBALCLASS
, IconTitleWndProc
, 0, 0,
94 0, 0, IDC_ARROW
, 0, 0, ICONTITLE_CLASS_NAME
}
97 static ATOM bicAtomTable
[BIC32_NB_CLASSES
];
99 /* Win32 common controls */
101 static WNDCLASS32A WIDGETS_CommonControls32
[] =
103 { CS_GLOBALCLASS
| CS_VREDRAW
| CS_HREDRAW
, StatusWindowProc
, 0,
104 sizeof(STATUSWINDOWINFO
), 0, 0, 0, 0, 0, STATUSCLASSNAME32A
},
107 #define NB_COMMON_CONTROLS32 \
108 (sizeof(WIDGETS_CommonControls32)/sizeof(WIDGETS_CommonControls32[0]))
111 /***********************************************************************
114 * Initialize the built-in window classes.
116 BOOL32
WIDGETS_Init(void)
120 const BUILTIN_CLASS_INFO16
*info16
= WIDGETS_BuiltinClasses16
;
122 WNDCLASS32A
*class32
= WIDGETS_BuiltinClasses32
;
124 if (!(name
= SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE
;
126 /* Create 16-bit classes */
128 class16
.cbClsExtra
= 0;
129 class16
.hInstance
= 0;
131 class16
.hCursor
= LoadCursor16( 0, IDC_ARROW
);
132 class16
.lpszMenuName
= (SEGPTR
)0;
133 class16
.lpszClassName
= SEGPTR_GET(name
);
134 for (i
= 0; i
< NB_BUILTIN_CLASSES16
; i
++, info16
++)
136 class16
.style
= info16
->style
;
137 class16
.lpfnWndProc
= (WNDPROC16
)MODULE_GetWndProcEntry16( info16
->procName
);
138 class16
.cbWndExtra
= info16
->wndExtra
;
139 class16
.hbrBackground
= info16
->background
;
140 strcpy( name
, info16
->className
);
141 if (!RegisterClass16( &class16
)) return FALSE
;
144 /* Create 32-bit classes */
146 for (i
= 0; i
< BIC32_NB_CLASSES
; i
++, class32
++)
148 /* Just to make sure the string is > 0x10000 */
149 strcpy( name
, (char *)class32
->lpszClassName
);
150 class32
->lpszClassName
= name
;
151 class32
->hCursor
= LoadCursor16( 0, class32
->hCursor
);
152 if (!(bicAtomTable
[i
] = RegisterClass32A( class32
))) return FALSE
;
160 /***********************************************************************
161 * InitCommonControls (COMCTL32.15)
163 void InitCommonControls(void)
167 WNDCLASS32A
*class32
= WIDGETS_CommonControls32
;
169 for (i
= 0; i
< NB_COMMON_CONTROLS32
; i
++, class32
++)
171 /* Just to make sure the string is > 0x10000 */
172 strcpy( name
, (char *)class32
->lpszClassName
);
173 class32
->lpszClassName
= name
;
174 class32
->hCursor
= LoadCursor16( 0, IDC_ARROW
);
175 RegisterClass32A( class32
);
180 /***********************************************************************
181 * WIDGETS_IsControl32
183 * Check whether pWnd is a built-in control or not.
185 BOOL32
WIDGETS_IsControl32( WND
* pWnd
, BUILTIN_CLASS32 cls
)
187 assert( cls
< BIC32_NB_CLASSES
);
188 return (pWnd
->class->atomName
== bicAtomTable
[cls
]);