4 * Copyright 1998 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"
25 #define ID_CB_EDIT 1001
27 #define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)wndPtr->wExtra[0])
30 // << COMBOEX_DeleteItem >>
33 __inline__ static LRESULT
34 COMBOEX_GetComboControl (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
36 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
38 TRACE (comboex, "\n");
40 return (LRESULT)infoPtr->hwndCombo;
44 __inline__ static LRESULT
45 COMBOEX_GetEditControl (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
47 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
49 if ((wndPtr->dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWN)
52 FIXME (comboex, "-- 0x%x\n", GetDlgItem32 (infoPtr->hwndCombo, ID_CB_EDIT));
54 return (LRESULT)GetDlgItem32 (infoPtr->hwndCombo, ID_CB_EDIT);
58 __inline__ static LRESULT
59 COMBOEX_GetExtendedStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
61 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
63 return (LRESULT)infoPtr->dwExtStyle;
67 __inline__ static LRESULT
68 COMBOEX_GetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
70 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
72 TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
74 return (LRESULT)infoPtr->himl;
81 COMBOEX_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
83 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
85 FIXME (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
93 COMBOEX_SetExtendedStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
95 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
98 TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
100 dwTemp = infoPtr->dwExtStyle;
103 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam;
106 infoPtr->dwExtStyle = (DWORD)lParam;
108 /* FIXME: repaint?? */
110 return (LRESULT)dwTemp;
114 __inline__ static LRESULT
115 COMBOEX_SetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
117 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
120 TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam);
122 himlTemp = infoPtr->himl;
123 infoPtr->himl = (HIMAGELIST)lParam;
125 return (LRESULT)himlTemp;
132 COMBOEX_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
134 COMBOEX_INFO *infoPtr;
137 /* allocate memory for info structure */
138 infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO));
139 wndPtr->wExtra[0] = (DWORD)infoPtr;
141 if (infoPtr == NULL) {
142 ERR (listview, "could not allocate info memory!\n");
146 if ((COMBOEX_INFO*)wndPtr->wExtra[0] != infoPtr) {
147 ERR (listview, "pointer assignment error!\n");
152 /* initialize info structure */
155 /* create combo box */
157 wndPtr->dwStyle & (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD);
160 CreateWindow32A ("ComboBox", "",
161 WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle,
162 0, 0, 0, 0, wndPtr->hwndSelf, (HMENU32)1,
163 wndPtr->hInstance, NULL);
171 COMBOEX_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
173 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
176 if (infoPtr->hwndCombo)
177 DestroyWindow32 (infoPtr->hwndCombo);
182 /* free comboex info data */
183 COMCTL32_Free (infoPtr);
190 COMBOEX_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
192 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr);
195 GetClientRect32 (wndPtr->hwndSelf, &rect);
197 MoveWindow32 (infoPtr->hwndCombo, 0, 0, rect.right -rect.left,
198 rect.bottom - rect.top, TRUE);
205 COMBOEX_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
207 WND *wndPtr = WIN_FindWndPtr(hwnd);
211 // case CBEM_DELETEITEM:
213 case CBEM_GETCOMBOCONTROL:
214 return COMBOEX_GetComboControl (wndPtr, wParam, lParam);
216 case CBEM_GETEDITCONTROL:
217 return COMBOEX_GetEditControl (wndPtr, wParam, lParam);
219 case CBEM_GETEXTENDEDSTYLE:
220 return COMBOEX_GetExtendedStyle (wndPtr, wParam, lParam);
222 case CBEM_GETIMAGELIST:
223 return COMBOEX_GetImageList (wndPtr, wParam, lParam);
225 // case CBEM_GETITEM32A:
226 // case CBEM_GETITEM32W:
227 // case CBEM_GETUNICODEFORMAT:
228 // case CBEM_HASEDITCHANGED:
230 case CBEM_INSERTITEM32A:
231 return COMBOEX_InsertItem32A (wndPtr, wParam, lParam);
233 // case CBEM_INSERTITEM32W:
235 case CBEM_SETEXTENDEDSTYLE:
236 return COMBOEX_SetExtendedStyle (wndPtr, wParam, lParam);
238 case CBEM_SETIMAGELIST:
239 return COMBOEX_SetImageList (wndPtr, wParam, lParam);
241 // case CBEM_SETITEM32A:
242 // case CBEM_SETITEM32W:
243 // case CBEM_SETUNICODEFORMAT:
247 return COMBOEX_Create (wndPtr, wParam, lParam);
250 return COMBOEX_Destroy (wndPtr, wParam, lParam);
253 return COMBOEX_Size (wndPtr, wParam, lParam);
257 ERR (comboex, "unknown msg %04x wp=%08x lp=%08lx\n",
258 uMsg, wParam, lParam);
259 return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
266 COMBOEX_Register (VOID)
268 WNDCLASS32A wndClass;
270 if (GlobalFindAtom32A (WC_COMBOBOXEX32A)) return;
272 ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
273 wndClass.style = CS_GLOBALCLASS;
274 wndClass.lpfnWndProc = (WNDPROC32)COMBOEX_WindowProc;
275 wndClass.cbClsExtra = 0;
276 wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
277 wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);
278 wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
279 wndClass.lpszClassName = WC_COMBOBOXEX32A;
281 RegisterClass32A (&wndClass);
286 COMBOEX_Unregister (VOID)
288 if (GlobalFindAtom32A (WC_COMBOBOXEX32A))
289 UnregisterClass32A (WC_COMBOBOXEX32A, (HINSTANCE32)NULL);