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 TRACE (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
;
130 COMBOEX_SetItem32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
132 /* COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); */
134 FIXME (comboex
, "(%p): stub\n", (LPVOID
)lParam
);
140 /* << COMBOEX_SetItem32W >> */
143 __inline__
static LRESULT
144 COMBOEX_Forward (WND
*wndPtr
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
146 COMBOEX_INFO
*infoPtr
= COMBOEX_GetInfoPtr(wndPtr
);
148 FIXME (comboex
, "(0x%x 0x%x 0x%lx): stub\n", uMsg
, wParam
, lParam
);
150 if (infoPtr
->hwndCombo
)
151 return SendMessage32A (infoPtr
->hwndCombo
, uMsg
, wParam
, lParam
);
158 COMBOEX_Create (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
160 COMBOEX_INFO
*infoPtr
;
163 /* allocate memory for info structure */
164 infoPtr
= (COMBOEX_INFO
*)COMCTL32_Alloc (sizeof(COMBOEX_INFO
));
165 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
167 if (infoPtr
== NULL
) {
168 ERR (listview
, "could not allocate info memory!\n");
172 if ((COMBOEX_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
173 ERR (listview
, "pointer assignment error!\n");
178 /* initialize info structure */
181 /* create combo box */
183 wndPtr
->dwStyle
& (CBS_SIMPLE
|CBS_DROPDOWN
|CBS_DROPDOWNLIST
|WS_CHILD
);
186 CreateWindow32A ("ComboBox", "",
187 WS_CHILD
| WS_VISIBLE
| CBS_OWNERDRAWFIXED
| dwComboStyle
,
188 0, 0, 0, 0, wndPtr
->hwndSelf
, (HMENU32
)1,
189 wndPtr
->hInstance
, NULL
);
197 COMBOEX_Destroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
199 COMBOEX_INFO
*infoPtr
= COMBOEX_GetInfoPtr(wndPtr
);
202 if (infoPtr
->hwndCombo
)
203 DestroyWindow32 (infoPtr
->hwndCombo
);
208 /* free comboex info data */
209 COMCTL32_Free (infoPtr
);
216 COMBOEX_Size (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
218 COMBOEX_INFO
*infoPtr
= COMBOEX_GetInfoPtr(wndPtr
);
221 GetClientRect32 (wndPtr
->hwndSelf
, &rect
);
223 MoveWindow32 (infoPtr
->hwndCombo
, 0, 0, rect
.right
-rect
.left
,
224 rect
.bottom
- rect
.top
, TRUE
);
231 COMBOEX_WindowProc (HWND32 hwnd
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
233 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
237 /* case CBEM_DELETEITEM: */
239 case CBEM_GETCOMBOCONTROL
:
240 return COMBOEX_GetComboControl (wndPtr
, wParam
, lParam
);
242 case CBEM_GETEDITCONTROL
:
243 return COMBOEX_GetEditControl (wndPtr
, wParam
, lParam
);
245 case CBEM_GETEXTENDEDSTYLE
:
246 return COMBOEX_GetExtendedStyle (wndPtr
, wParam
, lParam
);
248 case CBEM_GETIMAGELIST
:
249 return COMBOEX_GetImageList (wndPtr
, wParam
, lParam
);
251 /* case CBEM_GETITEM32A:
252 case CBEM_GETITEM32W:
253 case CBEM_GETUNICODEFORMAT:
254 case CBEM_HASEDITCHANGED:
257 case CBEM_INSERTITEM32A
:
258 return COMBOEX_InsertItem32A (wndPtr
, wParam
, lParam
);
260 /* case CBEM_INSERTITEM32W: */
262 case CBEM_SETEXTENDEDSTYLE
:
263 return COMBOEX_SetExtendedStyle (wndPtr
, wParam
, lParam
);
265 case CBEM_SETIMAGELIST
:
266 return COMBOEX_SetImageList (wndPtr
, wParam
, lParam
);
268 case CBEM_SETITEM32A
:
269 return COMBOEX_SetItem32A (wndPtr
, wParam
, lParam
);
271 /* case CBEM_SETITEM32W:
272 case CBEM_SETUNICODEFORMAT:
275 case CB_DELETESTRING32
:
276 case CB_FINDSTRINGEXACT32
:
279 case CB_GETDROPPEDCONTROLRECT32
:
280 case CB_GETDROPPEDSTATE32
:
281 case CB_GETITEMDATA32
:
282 case CB_GETITEMHEIGHT32
:
284 case CB_GETLBTEXTLEN32
:
285 case CB_GETEXTENDEDUI32
:
287 case CB_RESETCONTENT32
:
288 case CB_SELECTSTRING32
:
290 case CB_SETDROPPEDWIDTH32
:
291 case CB_SETEXTENDEDUI32
:
292 case CB_SETITEMDATA32
:
293 case CB_SETITEMHEIGHT32
:
294 case CB_SHOWDROPDOWN32
:
295 return COMBOEX_Forward (wndPtr
, uMsg
, wParam
, lParam
);
299 return COMBOEX_Create (wndPtr
, wParam
, lParam
);
302 return COMBOEX_Destroy (wndPtr
, wParam
, lParam
);
305 return COMBOEX_Size (wndPtr
, wParam
, lParam
);
309 ERR (comboex
, "unknown msg %04x wp=%08x lp=%08lx\n",
310 uMsg
, wParam
, lParam
);
311 return DefWindowProc32A (hwnd
, uMsg
, wParam
, lParam
);
318 COMBOEX_Register (VOID
)
320 WNDCLASS32A wndClass
;
322 if (GlobalFindAtom32A (WC_COMBOBOXEX32A
)) return;
324 ZeroMemory (&wndClass
, sizeof(WNDCLASS32A
));
325 wndClass
.style
= CS_GLOBALCLASS
;
326 wndClass
.lpfnWndProc
= (WNDPROC32
)COMBOEX_WindowProc
;
327 wndClass
.cbClsExtra
= 0;
328 wndClass
.cbWndExtra
= sizeof(COMBOEX_INFO
*);
329 wndClass
.hCursor
= LoadCursor32A (0, IDC_ARROW32A
);
330 wndClass
.hbrBackground
= (HBRUSH32
)(COLOR_WINDOW
+ 1);
331 wndClass
.lpszClassName
= WC_COMBOBOXEX32A
;
333 RegisterClass32A (&wndClass
);
338 COMBOEX_Unregister (VOID
)
340 if (GlobalFindAtom32A (WC_COMBOBOXEX32A
))
341 UnregisterClass32A (WC_COMBOBOXEX32A
, (HINSTANCE32
)NULL
);