4 * Copyright 1998, 1999 Eric Kohl
7 * This is just a dummy control. An author is needed! Any volunteers?
8 * I will only improve this control once in a while.
9 * Eric <ekohl@abo.rhein-zeitung.de>
13 * - All notifications.
16 * - should include "combo.h"
24 #define ID_CB_EDIT 1001
26 #define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)GetWindowLongA (hwnd, 0))
29 /* << COMBOEX_DeleteItem >> */
32 __inline__ static LRESULT
33 COMBOEX_GetComboControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
35 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
37 TRACE (comboex, "\n");
39 return (LRESULT)infoPtr->hwndCombo;
43 __inline__ static LRESULT
44 COMBOEX_GetEditControl (HWND hwnd, WPARAM wParam, LPARAM lParam)
46 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
48 if ((GetWindowLongA (hwnd, GWL_STYLE) & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
51 TRACE (comboex, "-- 0x%x\n", GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT));
53 return (LRESULT)GetDlgItem (infoPtr->hwndCombo, ID_CB_EDIT);
57 __inline__ static LRESULT
58 COMBOEX_GetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
60 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
62 return (LRESULT)infoPtr->dwExtStyle;
66 __inline__ static LRESULT
67 COMBOEX_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
69 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
71 TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
73 return (LRESULT)infoPtr->himl;
80 COMBOEX_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
82 /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */
84 FIXME (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
92 COMBOEX_SetExtendedStyle (HWND hwnd, WPARAM wParam, LPARAM lParam)
94 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
97 TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
99 dwTemp = infoPtr->dwExtStyle;
102 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
105 infoPtr->dwExtStyle = (DWORD)lParam;
107 /* FIXME: repaint?? */
109 return (LRESULT)dwTemp;
113 __inline__ static LRESULT
114 COMBOEX_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
116 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
119 TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
121 himlTemp = infoPtr->himl;
122 infoPtr->himl = (HIMAGELIST)lParam;
124 return (LRESULT)himlTemp;
129 COMBOEX_SetItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
131 /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd); */
133 FIXME (comboex, "(%p): stub\n", (LPVOID)lParam);
139 /* << COMBOEX_SetItem32W >> */
142 __inline__ static LRESULT
143 COMBOEX_Forward (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
145 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
147 FIXME (comboex, "(0x%x 0x%x 0x%lx): stub\n", uMsg, wParam, lParam);
149 if (infoPtr->hwndCombo)
150 return SendMessageA (infoPtr->hwndCombo, uMsg, wParam, lParam);
157 COMBOEX_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
159 COMBOEX_INFO *infoPtr;
162 /* allocate memory for info structure */
163 infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO));
164 if (infoPtr == NULL) {
165 ERR (listview, "could not allocate info memory!\n");
169 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
172 /* initialize info structure */
175 /* create combo box */
176 dwComboStyle = GetWindowLongA (hwnd, GWL_STYLE) &
177 (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
179 infoPtr->hwndCombo = CreateWindowA ("ComboBox", "",
180 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
181 0, 0, 0, 0, hwnd, (HMENU)1,
182 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
189 COMBOEX_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
191 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
194 if (infoPtr->hwndCombo)
195 DestroyWindow (infoPtr->hwndCombo);
200 /* free comboex info data */
201 COMCTL32_Free (infoPtr);
208 COMBOEX_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
210 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwnd);
213 GetClientRect (hwnd, &rect);
215 MoveWindow (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
216 rect.bottom - rect.top, TRUE);
223 COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
227 /* case CBEM_DELETEITEM: */
229 case CBEM_GETCOMBOCONTROL:
230 return COMBOEX_GetComboControl (hwnd, wParam, lParam);
232 case CBEM_GETEDITCONTROL:
233 return COMBOEX_GetEditControl (hwnd, wParam, lParam);
235 case CBEM_GETEXTENDEDSTYLE:
236 return COMBOEX_GetExtendedStyle (hwnd, wParam, lParam);
238 case CBEM_GETIMAGELIST:
239 return COMBOEX_GetImageList (hwnd, wParam, lParam);
241 /* case CBEM_GETITEM32A:
242 case CBEM_GETITEM32W:
243 case CBEM_GETUNICODEFORMAT:
244 case CBEM_HASEDITCHANGED:
247 case CBEM_INSERTITEMA:
248 return COMBOEX_InsertItemA (hwnd, wParam, lParam);
250 /* case CBEM_INSERTITEM32W: */
252 case CBEM_SETEXTENDEDSTYLE:
253 return COMBOEX_SetExtendedStyle (hwnd, wParam, lParam);
255 case CBEM_SETIMAGELIST:
256 return COMBOEX_SetImageList (hwnd, wParam, lParam);
259 return COMBOEX_SetItemA (hwnd, wParam, lParam);
261 /* case CBEM_SETITEM32W:
262 case CBEM_SETUNICODEFORMAT:
265 case CB_DELETESTRING:
266 case CB_FINDSTRINGEXACT:
269 case CB_GETDROPPEDCONTROLRECT:
270 case CB_GETDROPPEDSTATE:
272 case CB_GETITEMHEIGHT:
274 case CB_GETLBTEXTLEN:
275 case CB_GETEXTENDEDUI:
277 case CB_RESETCONTENT:
278 case CB_SELECTSTRING:
280 case CB_SETDROPPEDWIDTH:
281 case CB_SETEXTENDEDUI:
283 case CB_SETITEMHEIGHT:
284 case CB_SHOWDROPDOWN:
285 return COMBOEX_Forward (hwnd, uMsg, wParam, lParam);
289 return COMBOEX_Create (hwnd, wParam, lParam);
292 return COMBOEX_Destroy (hwnd, wParam, lParam);
295 return COMBOEX_Size (hwnd, wParam, lParam);
299 ERR (comboex, "unknown msg %04x wp=%08x lp=%08lx\n",
300 uMsg, wParam, lParam);
301 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
308 COMBOEX_Register (VOID)
312 if (GlobalFindAtomA (WC_COMBOBOXEXA)) return;
314 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
315 wndClass.style = CS_GLOBALCLASS;
316 wndClass.lpfnWndProc = (WNDPROC)COMBOEX_WindowProc;
317 wndClass.cbClsExtra = 0;
318 wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
319 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
320 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
321 wndClass.lpszClassName = WC_COMBOBOXEXA;
323 RegisterClassA (&wndClass);
328 COMBOEX_Unregister (VOID)
330 if (GlobalFindAtomA (WC_COMBOBOXEXA))
331 UnregisterClassA (WC_COMBOBOXEXA, (HINSTANCE)NULL);