ReactOS 0.4.16-dev-2293-g4d8327b
combo.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "uxtheme.h"
#include "vssym32.h"
#include "commctrl.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "comctl32.h"
Include dependency graph for combo.c:

Go to the source code of this file.

Macros

#define OEMRESOURCE
 
#define KEYDATA_ALT   0x2000
 
#define KEYDATA_PREVSTATE   0x4000
 
#define CB_NOTIFY(lphc, code)
 
#define CB_DISABLED(lphc)   (!IsWindowEnabled((lphc)->self))
 
#define CB_OWNERDRAWN(lphc)   ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
 
#define CB_HASSTRINGS(lphc)   ((lphc)->dwStyle & CBS_HASSTRINGS)
 
#define CB_HWND(lphc)   ((lphc)->self)
 
#define CB_GETTYPE(lphc)   ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
 
#define ISWIN31   (LOWORD(GetVersion()) == 0x0a03)
 
#define COMBO_YBORDERGAP   5
 
#define COMBO_XBORDERSIZE()   2
 
#define COMBO_YBORDERSIZE()   2
 
#define COMBO_EDITBUTTONSPACE()   0
 
#define EDIT_CONTROL_PADDING()   1
 
#define ID_CB_LISTBOX   1000
 
#define ID_CB_EDIT   1001
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (combo)
 
static void CBCalcPlacement (HEADCOMBO *combo)
 
static void CBResetPos (HEADCOMBO *combo)
 
static BOOL COMBO_Init (void)
 
static LRESULT COMBO_NCCreate (HWND hwnd, LONG style)
 
static LRESULT COMBO_NCDestroy (HEADCOMBO *lphc)
 
static INT combo_get_text_height (const HEADCOMBO *combo)
 
static INT CBGetTextAreaHeight (HEADCOMBO *lphc, BOOL clip_item_height)
 
static void CBForceDummyResize (LPHEADCOMBO lphc)
 
static void CBGetDroppedControlRect (LPHEADCOMBO lphc, LPRECT lpRect)
 
static LRESULT COMBO_Create (HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style)
 
static void CBPaintButton (HEADCOMBO *lphc, HDC hdc)
 
static HBRUSH COMBO_PrepareColors (LPHEADCOMBO lphc, HDC hDC)
 
static void CBPaintText (HEADCOMBO *lphc, HDC hdc_paint)
 
static void CBPaintBorder (const HEADCOMBO *lphc, HDC hdc)
 
static LRESULT COMBO_ThemedPaint (HTHEME theme, HEADCOMBO *lphc, HDC hdc)
 
static LRESULT COMBO_Paint (HEADCOMBO *lphc, HDC hdc)
 
static INT CBUpdateLBox (LPHEADCOMBO lphc, BOOL bSelect)
 
static void CBUpdateEdit (LPHEADCOMBO lphc, INT index)
 
static void CBDropDown (LPHEADCOMBO lphc)
 
static void CBRollUp (LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
 
BOOL COMBO_FlipListbox (LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton)
 
static void CBRepaintButton (LPHEADCOMBO lphc)
 
static void COMBO_SetFocus (LPHEADCOMBO lphc)
 
static void COMBO_KillFocus (LPHEADCOMBO lphc)
 
static LRESULT COMBO_Command (LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd)
 
static LRESULT COMBO_ItemOp (LPHEADCOMBO lphc, UINT msg, LPARAM lParam)
 
static LRESULT COMBO_GetText (HEADCOMBO *lphc, INT count, LPWSTR buf)
 
static void COMBO_Size (HEADCOMBO *lphc)
 
static void COMBO_Font (LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw)
 
static LRESULT COMBO_SetItemHeight (LPHEADCOMBO lphc, INT index, INT height)
 
static LRESULT COMBO_SelectString (LPHEADCOMBO lphc, INT start, LPARAM pText)
 
static void COMBO_LButtonDown (LPHEADCOMBO lphc, LPARAM lParam)
 
static void COMBO_LButtonUp (LPHEADCOMBO lphc)
 
static void COMBO_MouseMove (LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam)
 
static LRESULT COMBO_GetComboBoxInfo (const HEADCOMBO *lphc, COMBOBOXINFO *pcbi)
 
static LRESULT CALLBACK COMBO_WindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
void COMBO_Register (void)
 

Variables

static HBITMAP hComboBmp = 0
 
static UINT CBitHeight
 
static UINT CBitWidth
 

Macro Definition Documentation

◆ CB_DISABLED

#define CB_DISABLED (   lphc)    (!IsWindowEnabled((lphc)->self))

Definition at line 54 of file combo.c.

◆ CB_GETTYPE

#define CB_GETTYPE (   lphc)    ((lphc)->dwStyle & (CBS_DROPDOWNLIST))

Definition at line 58 of file combo.c.

◆ CB_HASSTRINGS

#define CB_HASSTRINGS (   lphc)    ((lphc)->dwStyle & CBS_HASSTRINGS)

Definition at line 56 of file combo.c.

◆ CB_HWND

#define CB_HWND (   lphc)    ((lphc)->self)

Definition at line 57 of file combo.c.

◆ CB_NOTIFY

#define CB_NOTIFY (   lphc,
  code 
)
Value:
(SendMessageW((lphc)->owner, WM_COMMAND, \
MAKEWPARAM(GetWindowLongPtrW((lphc)->self,GWLP_ID), (code)), (LPARAM)(lphc)->self))
LONG_PTR LPARAM
Definition: minwindef.h:175
Definition: inflate.c:139
#define MAKEWPARAM(l, h)
Definition: winuser.h:4111
#define GetWindowLongPtrW
Definition: winuser.h:4931
#define WM_COMMAND
Definition: winuser.h:1768
#define GWLP_ID
Definition: winuser.h:871
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Definition at line 50 of file combo.c.

◆ CB_OWNERDRAWN

#define CB_OWNERDRAWN (   lphc)    ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))

Definition at line 55 of file combo.c.

◆ COMBO_EDITBUTTONSPACE

#define COMBO_EDITBUTTONSPACE ( )    0

Definition at line 75 of file combo.c.

◆ COMBO_XBORDERSIZE

#define COMBO_XBORDERSIZE ( )    2

Definition at line 73 of file combo.c.

◆ COMBO_YBORDERGAP

#define COMBO_YBORDERGAP   5

Definition at line 72 of file combo.c.

◆ COMBO_YBORDERSIZE

#define COMBO_YBORDERSIZE ( )    2

Definition at line 74 of file combo.c.

◆ EDIT_CONTROL_PADDING

#define EDIT_CONTROL_PADDING ( )    1

Definition at line 76 of file combo.c.

◆ ID_CB_EDIT

#define ID_CB_EDIT   1001

Definition at line 79 of file combo.c.

◆ ID_CB_LISTBOX

#define ID_CB_LISTBOX   1000

Definition at line 78 of file combo.c.

◆ ISWIN31

#define ISWIN31   (LOWORD(GetVersion()) == 0x0a03)

Definition at line 60 of file combo.c.

◆ KEYDATA_ALT

#define KEYDATA_ALT   0x2000

Definition at line 43 of file combo.c.

◆ KEYDATA_PREVSTATE

#define KEYDATA_PREVSTATE   0x4000

Definition at line 44 of file combo.c.

◆ OEMRESOURCE

#define OEMRESOURCE

Definition at line 26 of file combo.c.

Function Documentation

◆ CBCalcPlacement()

static void CBCalcPlacement ( HEADCOMBO combo)
static

Definition at line 317 of file combo.c.

318{
319 /* Start with the client rectangle. */
320 GetClientRect(combo->self, &combo->textRect);
321
322 /* Remove the borders */
324
325 /* Chop off the bottom part to fit with the height of the text area. */
326 combo->textRect.bottom = combo->textRect.top + CBGetTextAreaHeight(combo, FALSE);
327
328 /* The button starts the same vertical position as the text area. */
329 combo->buttonRect = combo->textRect;
330
331 /* If the combobox is "simple" there is no button. */
332 if (CB_GETTYPE(combo) == CBS_SIMPLE)
333 combo->buttonRect.left = combo->buttonRect.right = combo->buttonRect.bottom = 0;
334 else
335 {
336 /*
337 * Let's assume the combobox button is the same width as the
338 * scrollbar button.
339 * size the button horizontally and cut-off the text area.
340 */
342 combo->textRect.right = combo->buttonRect.left;
343 }
344
345 /* In the case of a dropdown, there is an additional spacing between the text area and the button. */
346 if (CB_GETTYPE(combo) == CBS_DROPDOWN)
348
349 /* If we have an edit control, we space it away from the borders slightly. */
350 if (CB_GETTYPE(combo) != CBS_DROPDOWNLIST)
352
353 /* Adjust the size of the listbox popup. */
354 if (CB_GETTYPE(combo) == CBS_SIMPLE)
355 {
356 GetClientRect(combo->self, &combo->droppedRect);
357 combo->droppedRect.top = combo->textRect.bottom + COMBO_YBORDERSIZE();
358 }
359 else
360 {
361 /* Make sure the dropped width is as large as the combobox itself. */
362 if (combo->droppedWidth < (combo->buttonRect.right + COMBO_XBORDERSIZE()))
363 {
364 combo->droppedRect.right = combo->droppedRect.left + (combo->buttonRect.right + COMBO_XBORDERSIZE());
365
366 /* In the case of a dropdown, the popup listbox is offset to the right. We want to make sure it's flush
367 with the right side of the combobox */
368 if (CB_GETTYPE(combo) == CBS_DROPDOWN)
370 }
371 else
372 combo->droppedRect.right = combo->droppedRect.left + combo->droppedWidth;
373 }
374
375 /* Disallow negative window width */
376 if (combo->textRect.right < combo->textRect.left)
377 combo->textRect.right = combo->textRect.left;
378
379 TRACE("text %s, button %s, lbox %s.\n", wine_dbgstr_rect(&combo->textRect), wine_dbgstr_rect(&combo->buttonRect),
381}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define FALSE
Definition: types.h:117
#define COMBO_EDITBUTTONSPACE()
Definition: combo.c:75
static INT CBGetTextAreaHeight(HEADCOMBO *lphc, BOOL clip_item_height)
Definition: combo.c:206
#define EDIT_CONTROL_PADDING()
Definition: combo.c:76
#define CB_GETTYPE(lphc)
Definition: combo.c:58
#define COMBO_YBORDERSIZE()
Definition: combo.c:74
#define COMBO_XBORDERSIZE()
Definition: combo.c:73
#define TRACE(s)
Definition: solgame.cpp:4
RECT buttonRect
Definition: comctl32.h:158
RECT textRect
Definition: comctl32.h:157
RECT droppedRect
Definition: comctl32.h:159
HWND self
Definition: comctl32.h:150
INT droppedWidth
Definition: comctl32.h:162
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
#define SM_CXVSCROLL
Definition: winuser.h:972
#define CBS_SIMPLE
Definition: winuser.h:291
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CBS_DROPDOWN
Definition: winuser.h:283
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)

Referenced by CBForceDummyResize(), COMBO_Create(), COMBO_Font(), COMBO_SetItemHeight(), COMBO_Size(), COMBO_WindowProc(), and ComboWndProc_common().

◆ CBDropDown()

static void CBDropDown ( LPHEADCOMBO  lphc)
static

Definition at line 925 of file combo.c.

926{
927 HMONITOR monitor;
928 MONITORINFO mon_info;
929 RECT rect,r;
930 int nItems;
931 int nDroppedHeight;
932
933 TRACE("[%p]: drop down\n", lphc->self);
934
935 CB_NOTIFY( lphc, CBN_DROPDOWN );
936
937 /* set selection */
938
939 lphc->wState |= CBF_DROPPED;
940 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
941 {
942 lphc->droppedIndex = CBUpdateLBox( lphc, TRUE );
943
944 /* Update edit only if item is in the list */
945 if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0)
946 CBUpdateEdit( lphc, lphc->droppedIndex );
947 }
948 else
949 {
950 lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
951
953 lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex, 0);
954 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
955 }
956
957 /* now set popup position */
958 GetWindowRect( lphc->self, &rect );
959
960 /*
961 * If it's a dropdown, the listbox is offset
962 */
963 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
964 rect.left += COMBO_EDITBUTTONSPACE();
965
966 /* if the dropped height is greater than the total height of the dropped
967 items list, then force the drop down list height to be the total height
968 of the items in the dropped list */
969
970 /* And Remove any extra space (Best Fit) */
971 nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
972 /* if listbox length has been set directly by its handle */
973 GetWindowRect(lphc->hWndLBox, &r);
974 if (nDroppedHeight < r.bottom - r.top)
975 nDroppedHeight = r.bottom - r.top;
976 nItems = (int)SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
977
978 if (nItems > 0)
979 {
980 int nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
981
982 if (lphc->dwStyle & CBS_NOINTEGRALHEIGHT)
983 {
984#ifdef __REACTOS__
985 nDroppedHeight = min(nItems * nIHeight + COMBO_YBORDERSIZE(), nDroppedHeight - 1);
986#else
987 nDroppedHeight -= 1;
988#endif
989 }
990 else
991 {
992 if (nItems > lphc->visibleItems)
993 nItems = lphc->visibleItems;
994 nDroppedHeight = nItems * nIHeight + COMBO_YBORDERSIZE();
995 }
996 }
997
998 r.left = rect.left;
999 r.top = rect.bottom;
1000 r.right = r.left + lphc->droppedRect.right - lphc->droppedRect.left;
1001 r.bottom = r.top + nDroppedHeight;
1002
1003 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/
1004 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
1005 mon_info.cbSize = sizeof(mon_info);
1006 GetMonitorInfoW( monitor, &mon_info );
1007
1008 if (r.bottom > mon_info.rcWork.bottom)
1009 {
1010 r.top = max( rect.top - nDroppedHeight, mon_info.rcWork.top );
1011 r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom );
1012 }
1013
1014 SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top,
1016
1017
1018 if( !(lphc->wState & CBF_NOREDRAW) )
1020
1021 EnableWindow( lphc->hWndLBox, TRUE );
1022 if (GetCapture() != lphc->self)
1023 SetCapture(lphc->hWndLBox);
1024}
int nItems
Definition: appswitch.c:55
#define CBF_DROPPED
Definition: controls.h:45
#define CBF_NOREDRAW
Definition: controls.h:54
#define CBF_CAPTURE
Definition: controls.h:50
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static INT CBUpdateLBox(LPHEADCOMBO lphc, BOOL bSelect)
Definition: combo.c:855
#define CB_NOTIFY(lphc, code)
Definition: combo.c:50
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:889
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define min(a, b)
Definition: monoChain.cc:55
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
& rect
Definition: startmenu.cpp:1413
UINT wState
Definition: comctl32.h:155
HWND hWndLBox
Definition: comctl32.h:154
INT visibleItems
Definition: comctl32.h:164
INT droppedIndex
Definition: comctl32.h:160
UINT dwStyle
Definition: comctl32.h:152
DWORD cbSize
Definition: winuser.h:3886
#define max(a, b)
Definition: svc.c:63
#define LB_CARETON
Definition: undocuser.h:53
#define LB_ERR
Definition: winuser.h:2468
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define LB_GETCOUNT
Definition: winuser.h:2067
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define CBS_NOINTEGRALHEIGHT
Definition: winuser.h:287
#define HWND_TOPMOST
Definition: winuser.h:1219
#define LB_SETTOPINDEX
Definition: winuser.h:2106
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define RDW_UPDATENOW
Definition: winuser.h:1231
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define RDW_ERASE
Definition: winuser.h:1222
#define CBN_DROPDOWN
Definition: winuser.h:2003
#define LB_GETITEMHEIGHT
Definition: winuser.h:2071
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define LB_GETCURSEL
Definition: winuser.h:2068
#define RDW_INVALIDATE
Definition: winuser.h:1225

Referenced by COMBO_FlipListbox(), COMBO_LButtonDown(), COMBO_WindowProc(), and ComboWndProc_common().

◆ CBForceDummyResize()

static void CBForceDummyResize ( LPHEADCOMBO  lphc)
static

Definition at line 282 of file combo.c.

283{
284 RECT windowRect;
285 int newComboHeight;
286
287 newComboHeight = CBGetTextAreaHeight(lphc, FALSE) + 2*COMBO_YBORDERSIZE();
288
289 GetWindowRect(lphc->self, &windowRect);
290
291 /*
292 * We have to be careful, resizing a combobox also has the meaning that the
293 * dropped rect will be resized. In this case, we want to trigger a resize
294 * to recalculate layout but we don't want to change the dropped rectangle
295 * So, we pass the height of text area of control as the height.
296 * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
297 * message.
298 */
299 lphc->wState |= CBF_NORESIZE;
300 SetWindowPos( lphc->self,
301 NULL,
302 0, 0,
303 windowRect.right - windowRect.left,
304 newComboHeight,
306 lphc->wState &= ~CBF_NORESIZE;
307
308 CBCalcPlacement(lphc);
309 CBResetPos(lphc);
310}
#define CBF_NORESIZE
Definition: controls.h:52
static void CBResetPos(HEADCOMBO *combo)
Definition: combo.c:1364
static void CBCalcPlacement(HEADCOMBO *combo)
Definition: combo.c:317
#define SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by COMBO_Create(), COMBO_Font(), and COMBO_SetItemHeight().

◆ CBGetDroppedControlRect()

static void CBGetDroppedControlRect ( LPHEADCOMBO  lphc,
LPRECT  lpRect 
)
static

Definition at line 386 of file combo.c.

387{
388 /* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
389 of the combo box and the lower right corner of the listbox */
390
391 GetWindowRect(lphc->self, lpRect);
392
393 lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
394 lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
395
396}

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ CBGetTextAreaHeight()

static INT CBGetTextAreaHeight ( HEADCOMBO lphc,
BOOL  clip_item_height 
)
static

Definition at line 206 of file combo.c.

207{
208 INT item_height, text_height;
209
210 if (clip_item_height && !CB_OWNERDRAWN(lphc))
211 {
212 text_height = combo_get_text_height(lphc);
213 if (lphc->item_height < text_height)
214 lphc->item_height = text_height;
215 }
216 item_height = lphc->item_height;
217
218
219 /*
220 * Check the ownerdraw case if we haven't asked the parent the size
221 * of the item yet.
222 */
223 if ( CB_OWNERDRAWN(lphc) &&
224 (lphc->wState & CBF_MEASUREITEM) )
225 {
226 MEASUREITEMSTRUCT measureItem;
227 RECT clientRect;
228 INT originalItemHeight = item_height;
229 UINT id = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
230
231 /*
232 * We use the client rect for the width of the item.
233 */
234 GetClientRect(lphc->self, &clientRect);
235
236 lphc->wState &= ~CBF_MEASUREITEM;
237
238 /*
239 * Send a first one to measure the size of the text area
240 */
241 measureItem.CtlType = ODT_COMBOBOX;
242 measureItem.CtlID = id;
243 measureItem.itemID = -1;
244 measureItem.itemWidth = clientRect.right;
245 measureItem.itemHeight = item_height - 6; /* ownerdrawn cb is taller */
246 measureItem.itemData = 0;
247 SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
248 item_height = 6 + measureItem.itemHeight;
249
250 /*
251 * Send a second one in the case of a fixed ownerdraw list to calculate the
252 * size of the list items. (we basically do this on behalf of the listbox)
253 */
254 if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
255 {
256 measureItem.CtlType = ODT_COMBOBOX;
257 measureItem.CtlID = id;
258 measureItem.itemID = 0;
259 measureItem.itemWidth = clientRect.right;
260 measureItem.itemHeight = originalItemHeight;
261 measureItem.itemData = 0;
262 SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
263 lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
264 }
265
266 /*
267 * Keep the size for the next time
268 */
269 lphc->item_height = item_height;
270 }
271
272 return item_height;
273}
#define CBF_MEASUREITEM
Definition: controls.h:48
#define CB_OWNERDRAWN(lphc)
Definition: combo.c:55
static INT combo_get_text_height(const HEADCOMBO *combo)
Definition: combo.c:175
GLuint id
Definition: glext.h:5910
unsigned int UINT
Definition: ndis.h:50
INT fixedOwnerDrawHeight
Definition: comctl32.h:161
HWND owner
Definition: comctl32.h:151
INT item_height
Definition: comctl32.h:163
ULONG_PTR itemData
Definition: winuser.h:3748
int32_t INT
Definition: typedefs.h:58
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
#define ODT_COMBOBOX
Definition: winuser.h:2575
#define WM_MEASUREITEM
Definition: winuser.h:1674

Referenced by CBCalcPlacement(), CBForceDummyResize(), COMBO_Size(), COMBO_WindowProc(), and ComboWndProc_common().

◆ CBPaintBorder()

static void CBPaintBorder ( const HEADCOMBO lphc,
HDC  hdc 
)
static

Definition at line 750 of file combo.c.

751{
752 RECT clientRect;
753
754 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
755 {
756 GetClientRect(lphc->self, &clientRect);
757 }
758 else
759 {
760 clientRect = lphc->textRect;
761
764 }
765
766 DrawEdge(hdc, &clientRect, EDGE_SUNKEN, BF_RECT);
767}
HDC hdc
Definition: main.c:9
#define EDGE_SUNKEN
Definition: winuser.h:451
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_RECT
Definition: winuser.h:462

Referenced by COMBO_Paint().

◆ CBPaintButton()

static void CBPaintButton ( HEADCOMBO lphc,
HDC  hdc 
)
static

Definition at line 559 of file combo.c.

560{
561 UINT buttonState = DFCS_SCROLLCOMBOBOX;
562
563 if (IsRectEmpty(&lphc->buttonRect))
564 return;
565
566 if( lphc->wState & CBF_NOREDRAW )
567 return;
568
569
570 if (lphc->wState & CBF_BUTTONDOWN)
571 buttonState |= DFCS_PUSHED;
572
573 if (CB_DISABLED(lphc))
574 buttonState |= DFCS_INACTIVE;
575
576 DrawFrameControl(hdc, &lphc->buttonRect, DFC_SCROLL, buttonState);
577}
#define CB_DISABLED(lphc)
Definition: combo.c:54
#define CBF_BUTTONDOWN
Definition: window.c:3481
#define DFC_SCROLL
Definition: winuser.h:475
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_INACTIVE
Definition: winuser.h:502
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define DFCS_SCROLLCOMBOBOX
Definition: winuser.h:493
#define DFCS_PUSHED
Definition: winuser.h:503

Referenced by COMBO_Paint().

◆ CBPaintText()

static void CBPaintText ( HEADCOMBO lphc,
HDC  hdc_paint 
)
static

Definition at line 629 of file combo.c.

630{
631 RECT rectEdit = lphc->textRect;
632 INT id, size = 0;
633 LPWSTR pText = NULL;
634
635 TRACE("\n");
636
637 /* follow Windows combobox that sends a bunch of text
638 * inquiries to its listbox while processing WM_PAINT. */
639
640 if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR )
641 {
642 size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
643 if (size == LB_ERR)
644 FIXME("LB_ERR probably not handled yet\n");
645 if ((pText = heap_alloc((size + 1) * sizeof(WCHAR))))
646 {
647 /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
649 pText[size] = '\0'; /* just in case */
650 } else return;
651 }
652
653 if( lphc->wState & CBF_EDIT )
654 {
655 static const WCHAR empty_stringW[] = { 0 };
657 if( lphc->wState & CBF_FOCUSED )
659 }
660 else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self ))
661 {
662 /* paint text field ourselves */
663 HDC hdc = hdc_paint ? hdc_paint : GetDC(lphc->self);
664 UINT itemState = ODS_COMBOBOXEDIT;
665 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
666 HBRUSH hPrevBrush, hBkgBrush;
667
668 /*
669 * Give ourselves some space.
670 */
671 InflateRect( &rectEdit, -1, -1 );
672
673 hBkgBrush = COMBO_PrepareColors( lphc, hdc );
674 hPrevBrush = SelectObject( hdc, hBkgBrush );
675 FillRect( hdc, &rectEdit, hBkgBrush );
676
677 if( CB_OWNERDRAWN(lphc) )
678 {
679 DRAWITEMSTRUCT dis;
680 HRGN clipRegion;
681 UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
682
683 /* setup state for DRAWITEM message. Owner will highlight */
684 if ( (lphc->wState & CBF_FOCUSED) &&
685 !(lphc->wState & CBF_DROPPED) )
686 itemState |= ODS_SELECTED | ODS_FOCUS;
687
688 if (!IsWindowEnabled(lphc->self)) itemState |= ODS_DISABLED;
689
690 dis.CtlType = ODT_COMBOBOX;
691 dis.CtlID = ctlid;
692 dis.hwndItem = lphc->self;
694 dis.itemID = id;
695 dis.itemState = itemState;
696 dis.hDC = hdc;
697 dis.rcItem = rectEdit;
698 dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, id, 0);
699
700 /*
701 * Clip the DC and have the parent draw the item.
702 */
703 clipRegion = set_control_clipping( hdc, &rectEdit );
704
705 SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
706
707 SelectClipRgn( hdc, clipRegion );
708 if (clipRegion) DeleteObject( clipRegion );
709 }
710 else
711 {
712 static const WCHAR empty_stringW[] = { 0 };
713
714 if ( (lphc->wState & CBF_FOCUSED) &&
715 !(lphc->wState & CBF_DROPPED) ) {
716
717 /* highlight */
721 }
722
724 rectEdit.left + 1,
725 rectEdit.top + 1,
727 &rectEdit,
729
730 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
731 DrawFocusRect( hdc, &rectEdit );
732 }
733
734 if( hPrevFont )
735 SelectObject(hdc, hPrevFont );
736
737 if( hPrevBrush )
738 SelectObject( hdc, hPrevBrush );
739
740 if( !hdc_paint )
741 ReleaseDC( lphc->self, hdc );
742 }
743
745}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define FIXME(fmt,...)
Definition: precomp.h:53
#define CBF_EDIT
Definition: controls.h:51
#define CBF_FOCUSED
Definition: controls.h:49
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:242
static HBRUSH COMBO_PrepareColors(LPHEADCOMBO lphc, HDC hDC)
Definition: combo.c:587
#define CB_HASSTRINGS(lphc)
Definition: combo.c:56
pKey DeleteObject()
GLsizeiptr size
Definition: glext.h:5919
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HWND hWndEdit
Definition: comctl32.h:153
HFONT hFont
Definition: comctl32.h:156
ULONG_PTR itemData
Definition: winuser.h:3195
LPCSTR pText
Definition: txtscale.cpp:79
#define MAXLONG
Definition: umtypes.h:116
static const WCHAR empty_stringW[]
Definition: edit.c:173
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define ETO_CLIPPED
Definition: wingdi.h:648
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define ODS_DISABLED
Definition: winuser.h:2583
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2581
#define LB_GETITEMDATA
Definition: winuser.h:2070
#define ODA_DRAWENTIRE
Definition: winuser.h:2578
#define LB_GETTEXT
Definition: winuser.h:2085
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1673
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
HDC WINAPI GetDC(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2047
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define LB_GETTEXTLEN
Definition: winuser.h:2086
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define ODS_FOCUS
Definition: winuser.h:2585
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by COMBO_Command(), COMBO_Paint(), COMBO_ThemedPaint(), COMBO_WindowProc(), and ComboWndProc_common().

◆ CBRepaintButton()

static void CBRepaintButton ( LPHEADCOMBO  lphc)
static

Definition at line 1101 of file combo.c.

1102 {
1103 InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
1104 UpdateWindow(lphc->self);
1105}
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by COMBO_LButtonDown(), COMBO_LButtonUp(), and COMBO_MouseMove().

◆ CBResetPos()

static void CBResetPos ( HEADCOMBO combo)
static

Definition at line 1364 of file combo.c.

1365{
1366 BOOL drop = CB_GETTYPE(combo) != CBS_SIMPLE;
1367
1368 /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
1369 * sizing messages */
1370 if (combo->wState & CBF_EDIT)
1371 SetWindowPos(combo->hWndEdit, 0, combo->textRect.left, combo->textRect.top,
1372 combo->textRect.right - combo->textRect.left,
1373 combo->textRect.bottom - combo->textRect.top,
1374 SWP_NOZORDER | SWP_NOACTIVATE | (drop ? SWP_NOREDRAW : 0));
1375
1376 SetWindowPos(combo->hWndLBox, 0, combo->droppedRect.left, combo->droppedRect.top,
1377 combo->droppedRect.right - combo->droppedRect.left,
1378 combo->droppedRect.bottom - combo->droppedRect.top,
1379 SWP_NOACTIVATE | SWP_NOZORDER | (drop ? SWP_NOREDRAW : 0));
1380
1381 if (drop)
1382 {
1383 if (combo->wState & CBF_DROPPED)
1384 {
1385 combo->wState &= ~CBF_DROPPED;
1386 ShowWindow(combo->hWndLBox, SW_HIDE);
1387 }
1388
1389 if (!(combo->wState & CBF_NOREDRAW))
1391 }
1392}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SW_HIDE
Definition: winuser.h:779
#define SWP_NOREDRAW
Definition: winuser.h:1257
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)

Referenced by CBForceDummyResize(), COMBO_Font(), COMBO_SetItemHeight(), and COMBO_Size().

◆ CBRollUp()

static void CBRollUp ( LPHEADCOMBO  lphc,
BOOL  ok,
BOOL  bButton 
)
static

Definition at line 1031 of file combo.c.

1032{
1033 HWND hWnd = lphc->self;
1034
1035 TRACE("[%p]: sel ok? [%i] dropped? [%i]\n",
1036 lphc->self, ok, (INT)(lphc->wState & CBF_DROPPED));
1037
1039
1040 if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
1041 {
1042
1043 if( lphc->wState & CBF_DROPPED )
1044 {
1045 RECT rect;
1046
1047 lphc->wState &= ~CBF_DROPPED;
1048 ShowWindow( lphc->hWndLBox, SW_HIDE );
1049
1050 if(GetCapture() == lphc->hWndLBox)
1051 {
1053 }
1054
1055 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1056 {
1057 rect = lphc->buttonRect;
1058 }
1059 else
1060 {
1061 if( bButton )
1062 {
1063 UnionRect( &rect,
1064 &lphc->buttonRect,
1065 &lphc->textRect);
1066 }
1067 else
1068 rect = lphc->textRect;
1069
1070 bButton = TRUE;
1071 }
1072
1073 if( bButton && !(lphc->wState & CBF_NOREDRAW) )
1076 CB_NOTIFY( lphc, CBN_CLOSEUP );
1077 }
1078 }
1079}
#define ok(value,...)
Definition: atltest.h:57
HWND hWnd
Definition: settings.c:17
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define RDW_NOCHILDREN
Definition: winuser.h:1233
#define CBN_CLOSEUP
Definition: winuser.h:2001
#define CBN_SELENDOK
Definition: winuser.h:2010
#define CBN_SELENDCANCEL
Definition: winuser.h:2009
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)

Referenced by COMBO_Command(), COMBO_FlipListbox(), COMBO_KillFocus(), COMBO_LButtonDown(), COMBO_WindowProc(), and ComboWndProc_common().

◆ CBUpdateEdit()

static void CBUpdateEdit ( LPHEADCOMBO  lphc,
INT  index 
)
static

Definition at line 889 of file combo.c.

890{
891 INT length;
892 LPWSTR pText = NULL;
893 static const WCHAR empty_stringW[] = { 0 };
894
895 TRACE("\t %i\n", index );
896
897 if( index >= 0 ) /* got an entry */
898 {
900 if( length != LB_ERR)
901 {
902 if ((pText = heap_alloc((length + 1) * sizeof(WCHAR))))
904 }
905 }
906
907 if( CB_HASSTRINGS(lphc) )
908 {
912 }
913
914 if( lphc->wState & CBF_FOCUSED )
915 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
916
917 heap_free( pText );
918}
#define CBF_NOLBSELECT
Definition: controls.h:57
#define CBF_NOEDITNOTIFY
Definition: controls.h:56
GLuint index
Definition: glext.h:6031
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define WM_SETTEXT
Definition: winuser.h:1645

Referenced by CBDropDown(), COMBO_Command(), COMBO_LButtonUp(), and COMBO_SelectString().

◆ CBUpdateLBox()

static INT CBUpdateLBox ( LPHEADCOMBO  lphc,
BOOL  bSelect 
)
static

Definition at line 855 of file combo.c.

856{
857 INT length, idx;
858 LPWSTR pText = NULL;
859
860 idx = LB_ERR;
862
863 if (length > 0)
864 pText = heap_alloc((length + 1) * sizeof(WCHAR));
865
866 TRACE("\t edit text length %i\n", length );
867
868 if( pText )
869 {
870 GetWindowTextW( lphc->hWndEdit, pText, length + 1);
872 heap_free( pText );
873 }
874
875 SendMessageW(lphc->hWndLBox, LB_SETCURSEL, bSelect ? idx : -1, 0);
876
877 /* probably superfluous but Windows sends this too */
878 SendMessageW(lphc->hWndLBox, LB_SETCARETINDEX, idx < 0 ? 0 : idx, 0);
879 SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, idx < 0 ? 0 : idx, 0);
880
881 return idx;
882}
unsigned int idx
Definition: utils.c:41
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define LB_FINDSTRING
Definition: winuser.h:2063
#define LB_SETCURSEL
Definition: winuser.h:2099
#define LB_SETCARETINDEX
Definition: winuser.h:2096

Referenced by CBDropDown(), COMBO_Command(), COMBO_LButtonUp(), and COMBO_MouseMove().

◆ COMBO_Command()

static LRESULT COMBO_Command ( LPHEADCOMBO  lphc,
WPARAM  wParam,
HWND  hWnd 
)
static

Definition at line 1158 of file combo.c.

1159{
1160 if ( lphc->wState & CBF_EDIT && lphc->hWndEdit == hWnd )
1161 {
1162 /* ">> 8" makes gcc generate jump-table instead of cmp ladder */
1163
1164 switch( HIWORD(wParam) >> 8 )
1165 {
1166 case (EN_SETFOCUS >> 8):
1167
1168 TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
1169
1170 COMBO_SetFocus( lphc );
1171 break;
1172
1173 case (EN_KILLFOCUS >> 8):
1174
1175 TRACE("[%p]: edit [%p] lost focus\n", lphc->self, lphc->hWndEdit );
1176
1177 /* NOTE: it seems that Windows' edit control sends an
1178 * undocumented message WM_USER + 0x1B instead of this
1179 * notification (only when it happens to be a part of
1180 * the combo). ?? - AK.
1181 */
1182
1183 COMBO_KillFocus( lphc );
1184 break;
1185
1186
1187 case (EN_CHANGE >> 8):
1188 /*
1189 * In some circumstances (when the selection of the combobox
1190 * is changed for example) we don't want the EN_CHANGE notification
1191 * to be forwarded to the parent of the combobox. This code
1192 * checks a flag that is set in these occasions and ignores the
1193 * notification.
1194 */
1195 if (lphc->wState & CBF_NOLBSELECT)
1196 {
1197 lphc->wState &= ~CBF_NOLBSELECT;
1198 }
1199 else
1200 {
1201 CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );
1202 }
1203
1204 if (!(lphc->wState & CBF_NOEDITNOTIFY))
1205 CB_NOTIFY( lphc, CBN_EDITCHANGE );
1206 break;
1207
1208 case (EN_UPDATE >> 8):
1209 if (!(lphc->wState & CBF_NOEDITNOTIFY))
1210 CB_NOTIFY( lphc, CBN_EDITUPDATE );
1211 break;
1212
1213 case (EN_ERRSPACE >> 8):
1214 CB_NOTIFY( lphc, CBN_ERRSPACE );
1215 }
1216 }
1217 else if( lphc->hWndLBox == hWnd )
1218 {
1219 switch( (short)HIWORD(wParam) )
1220 {
1221 case LBN_ERRSPACE:
1222 CB_NOTIFY( lphc, CBN_ERRSPACE );
1223 break;
1224
1225 case LBN_DBLCLK:
1226 CB_NOTIFY( lphc, CBN_DBLCLK );
1227 break;
1228
1229 case LBN_SELCHANGE:
1230 case LBN_SELCANCEL:
1231
1232 TRACE("[%p]: lbox selection change [%x]\n", lphc->self, lphc->wState );
1233
1234 /* do not roll up if selection is being tracked
1235 * by arrow keys in the dropdown listbox */
1236 if (!(lphc->wState & CBF_NOROLLUP))
1237 {
1238 CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE );
1239 }
1240 else lphc->wState &= ~CBF_NOROLLUP;
1241
1242 CB_NOTIFY( lphc, CBN_SELCHANGE );
1243
1244 if( HIWORD(wParam) == LBN_SELCHANGE)
1245 {
1246 if( lphc->wState & CBF_EDIT )
1247 lphc->wState |= CBF_NOLBSELECT;
1248 CBPaintText( lphc, NULL );
1249 }
1250 break;
1251
1252 case LBN_SETFOCUS:
1253 case LBN_KILLFOCUS:
1254 /* nothing to do here since ComboLBox always resets the focus to its
1255 * combo/edit counterpart */
1256 break;
1257 }
1258 }
1259 return 0;
1260}
WPARAM wParam
Definition: combotst.c:138
#define CBF_NOROLLUP
Definition: controls.h:47
static void COMBO_KillFocus(LPHEADCOMBO lphc)
Definition: combo.c:1132
static void COMBO_SetFocus(LPHEADCOMBO lphc)
Definition: combo.c:1110
static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
Definition: combo.c:629
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1031
#define HIWORD(l)
Definition: typedefs.h:247
#define LBN_ERRSPACE
Definition: winuser.h:2108
#define CBN_ERRSPACE
Definition: winuser.h:2006
#define EN_KILLFOCUS
Definition: winuser.h:2054
#define LBN_SELCANCEL
Definition: winuser.h:2110
#define LBN_DBLCLK
Definition: winuser.h:2107
#define EN_SETFOCUS
Definition: winuser.h:2056
#define EN_UPDATE
Definition: winuser.h:2057
#define LBN_SETFOCUS
Definition: winuser.h:2112
#define CBN_EDITUPDATE
Definition: winuser.h:2005
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define LBN_SELCHANGE
Definition: winuser.h:2111
#define CBN_DBLCLK
Definition: winuser.h:2002
#define LBN_KILLFOCUS
Definition: winuser.h:2109
#define EN_ERRSPACE
Definition: winuser.h:2052
#define CBN_EDITCHANGE
Definition: winuser.h:2004
#define EN_CHANGE
Definition: winuser.h:2051

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_Create()

static LRESULT COMBO_Create ( HWND  hwnd,
LPHEADCOMBO  lphc,
HWND  hwndParent,
LONG  style 
)
static

Definition at line 401 of file combo.c.

402{
403 static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
404 static const WCHAR editName[] = {'E','d','i','t',0};
405
407 if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
408 if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
409
410 lphc->owner = hwndParent;
411
412 lphc->droppedWidth = 0;
413
415
416 /*
417 * The first time we go through, we want to measure the ownerdraw item
418 */
419 lphc->wState |= CBF_MEASUREITEM;
420
421 /*
422 * Per default the comctl32 version of combo shows up to 30 items
423 */
424 lphc->visibleItems = 30;
425
426 /* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
427
428#ifdef __REACTOS__
429 if(TRUE)
430#else
431 if( lphc->owner || !(style & WS_VISIBLE) )
432#endif
433 {
434 UINT lbeStyle = 0;
435 UINT lbeExStyle = 0;
436
437 /*
438 * Initialize the dropped rect to the size of the client area of the
439 * control and then, force all the areas of the combobox to be
440 * recalculated.
441 */
442 GetClientRect( hwnd, &lphc->droppedRect );
443 CBCalcPlacement(lphc);
444
445 /*
446 * Adjust the position of the popup listbox if it's necessary
447 */
448 if ( CB_GETTYPE(lphc) != CBS_SIMPLE )
449 {
451
452 /*
453 * If it's a dropdown, the listbox is offset
454 */
455 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
457
458 if (lphc->droppedRect.bottom < lphc->droppedRect.top)
459 lphc->droppedRect.bottom = lphc->droppedRect.top;
460 if (lphc->droppedRect.right < lphc->droppedRect.left)
461 lphc->droppedRect.right = lphc->droppedRect.left;
462 MapWindowPoints( hwnd, 0, (LPPOINT)&lphc->droppedRect, 2 );
463 }
464
465 /* create listbox popup */
466
469
470 if( lphc->dwStyle & CBS_SORT )
471 lbeStyle |= LBS_SORT;
472 if( lphc->dwStyle & CBS_HASSTRINGS )
473 lbeStyle |= LBS_HASSTRINGS;
474 if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT )
475 lbeStyle |= LBS_NOINTEGRALHEIGHT;
476 if( lphc->dwStyle & CBS_DISABLENOSCROLL )
477 lbeStyle |= LBS_DISABLENOSCROLL;
478
479 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */
480 {
481 lbeStyle |= WS_VISIBLE;
482
483 /*
484 * In win 95 look n feel, the listbox in the simple combobox has
485 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
486 */
487 lbeStyle &= ~WS_BORDER;
488 lbeExStyle |= WS_EX_CLIENTEDGE;
489 }
490 else
491 {
492 lbeExStyle |= (WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
493 }
494
495 lphc->hWndLBox = CreateWindowExW(lbeExStyle, clbName, NULL, lbeStyle,
496 lphc->droppedRect.left, lphc->droppedRect.top, lphc->droppedRect.right - lphc->droppedRect.left,
499 if( lphc->hWndLBox )
500 {
501 BOOL bEdit = TRUE;
503
504 if( lphc->wState & CBF_EDIT )
505 {
506 if( lphc->dwStyle & CBS_OEMCONVERT )
507 lbeStyle |= ES_OEMCONVERT;
508 if( lphc->dwStyle & CBS_AUTOHSCROLL )
509 lbeStyle |= ES_AUTOHSCROLL;
510 if( lphc->dwStyle & CBS_LOWERCASE )
511 lbeStyle |= ES_LOWERCASE;
512 else if( lphc->dwStyle & CBS_UPPERCASE )
513 lbeStyle |= ES_UPPERCASE;
514
515 if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
516
517 lphc->hWndEdit = CreateWindowExW(0, editName, NULL, lbeStyle,
518 lphc->textRect.left, lphc->textRect.top,
519 lphc->textRect.right - lphc->textRect.left,
520 lphc->textRect.bottom - lphc->textRect.top,
523 if( !lphc->hWndEdit )
524 bEdit = FALSE;
525 }
526
527 if( bEdit )
528 {
529 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
530 {
531 /* Now do the trick with parent */
533 /*
534 * If the combo is a dropdown, we must resize the control
535 * to fit only the text area and button. To do this,
536 * we send a dummy resize and the WM_WINDOWPOSCHANGING message
537 * will take care of setting the height for us.
538 */
539 CBForceDummyResize(lphc);
540 }
541
542 TRACE("init done\n");
543 return 0;
544 }
545 ERR("edit control failure.\n");
546 } else ERR("listbox failure.\n");
547 } else ERR("no owner for visible combo.\n");
548
549 /* CreateWindow() will send WM_NCDESTROY to cleanup */
550
551 return -1;
552}
Arabic default style
Definition: afstyles.h:94
#define ERR(fmt,...)
Definition: precomp.h:57
static HWND hwndParent
Definition: cryptui.c:300
#define ID_CB_LISTBOX
Definition: combo.c:78
#define ID_CB_EDIT
Definition: combo.c:79
static void CBForceDummyResize(LPHEADCOMBO lphc)
Definition: combo.c:282
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
Definition: system.c:890
#define ES_COMBO
Definition: edit.c:29
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WS_CHILD
Definition: pedump.c:617
#define ES_LOWERCASE
Definition: pedump.c:669
#define LBS_DISABLENOSCROLL
Definition: pedump.c:690
#define LBS_SORT
Definition: pedump.c:679
#define ES_UPPERCASE
Definition: pedump.c:668
#define WS_BORDER
Definition: pedump.c:625
#define ES_NOHIDESEL
Definition: pedump.c:673
#define LBS_HASSTRINGS
Definition: pedump.c:684
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define WS_DISABLED
Definition: pedump.c:621
#define ES_LEFT
Definition: pedump.c:664
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define LBS_NOINTEGRALHEIGHT
Definition: pedump.c:686
#define LBS_NOTIFY
Definition: pedump.c:678
#define ES_OEMCONVERT
Definition: pedump.c:674
#define WC_COMBOBOXW
Definition: commctrl.h:4722
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CBS_AUTOHSCROLL
Definition: winuser.h:281
#define CBS_OWNERDRAWVARIABLE
Definition: winuser.h:290
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define CBS_DISABLENOSCROLL
Definition: winuser.h:282
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define HWND_DESKTOP
Definition: winuser.h:1220
#define LBS_COMBOBOX
Definition: winuser.h:324
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define CBS_LOWERCASE
Definition: winuser.h:286
#define CBS_HASSTRINGS
Definition: winuser.h:285
#define CBS_SORT
Definition: winuser.h:292
#define CBS_OEMCONVERT
Definition: winuser.h:288
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define CBS_UPPERCASE
Definition: winuser.h:293

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_FlipListbox()

BOOL COMBO_FlipListbox ( LPHEADCOMBO  lphc,
BOOL  ok,
BOOL  bRedrawButton 
)

Definition at line 1086 of file combo.c.

1087{
1088 if( lphc->wState & CBF_DROPPED )
1089 {
1090 CBRollUp( lphc, ok, bRedrawButton );
1091 return FALSE;
1092 }
1093
1094 CBDropDown( lphc );
1095 return TRUE;
1096}
static void CBDropDown(LPHEADCOMBO lphc)
Definition: combo.c:925

Referenced by COMBO_WindowProc(), ComboWndProc_common(), LISTBOX_HandleLButtonDownCombo(), LISTBOX_WindowProc(), and ListBoxWndProc_common().

◆ COMBO_Font()

static void COMBO_Font ( LPHEADCOMBO  lphc,
HFONT  hFont,
BOOL  bRedraw 
)
static

Definition at line 1453 of file combo.c.

1454{
1455 lphc->hFont = hFont;
1456 lphc->item_height = combo_get_text_height(lphc);
1457
1458 /*
1459 * Propagate to owned windows.
1460 */
1461 if( lphc->wState & CBF_EDIT )
1462 SendMessageW(lphc->hWndEdit, WM_SETFONT, (WPARAM)hFont, bRedraw);
1463 SendMessageW(lphc->hWndLBox, WM_SETFONT, (WPARAM)hFont, bRedraw);
1464
1465 /*
1466 * Redo the layout of the control.
1467 */
1468 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1469 {
1470 CBCalcPlacement(lphc);
1471
1472 CBResetPos(lphc);
1473 }
1474 else
1475 {
1476 CBForceDummyResize(lphc);
1477 }
1478}
HFONT hFont
Definition: main.c:53
UINT_PTR WPARAM
Definition: minwindef.h:174
#define WM_SETFONT
Definition: winuser.h:1678

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ combo_get_text_height()

static INT combo_get_text_height ( const HEADCOMBO combo)
static

Definition at line 175 of file combo.c.

176{
177 HDC hdc = GetDC(combo->self);
178 HFONT prev_font = 0;
180
181 if (combo->hFont)
182 prev_font = SelectObject(hdc, combo->hFont);
183
185
186 if (prev_font)
187 SelectObject(hdc, prev_font);
188
189 ReleaseDC(combo->self, hdc);
190
191 return tm.tmHeight + 4;
192}
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221

Referenced by CBGetTextAreaHeight(), COMBO_Create(), and COMBO_Font().

◆ COMBO_GetComboBoxInfo()

static LRESULT COMBO_GetComboBoxInfo ( const HEADCOMBO lphc,
COMBOBOXINFO pcbi 
)
static

Definition at line 1649 of file combo.c.

1650{
1651 if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO)))
1652 return FALSE;
1653
1654 pcbi->rcItem = lphc->textRect;
1655 pcbi->rcButton = lphc->buttonRect;
1656 pcbi->stateButton = 0;
1657 if (lphc->wState & CBF_BUTTONDOWN)
1659 if (IsRectEmpty(&lphc->buttonRect))
1661 pcbi->hwndCombo = lphc->self;
1662 pcbi->hwndItem = lphc->hWndEdit;
1663 pcbi->hwndList = lphc->hWndLBox;
1664 return TRUE;
1665}
DWORD stateButton
Definition: winuser.h:3814
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2967
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2979

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_GetText()

static LRESULT COMBO_GetText ( HEADCOMBO lphc,
INT  count,
LPWSTR  buf 
)
static

Definition at line 1315 of file combo.c.

1316{
1317 INT length;
1318
1319 if( lphc->wState & CBF_EDIT )
1320 return SendMessageW( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1321
1322 /* get it from the listbox */
1323
1324 if (!count || !buf) return 0;
1325 if( lphc->hWndLBox )
1326 {
1327 INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1328 if (idx == LB_ERR) goto error;
1330 if (length == LB_ERR) goto error;
1331
1332 /* 'length' is without the terminating character */
1333 if (length >= count)
1334 {
1335 WCHAR *lpBuffer = heap_alloc((length + 1) * sizeof(WCHAR));
1336 if (!lpBuffer) goto error;
1338
1339 /* truncate if buffer is too short */
1340 if (length != LB_ERR)
1341 {
1343 length = count;
1344 }
1346 }
1348
1349 if (length == LB_ERR) return 0;
1350 return length;
1351 }
1352
1353 error: /* error - truncate string, return zero */
1354 buf[0] = 0;
1355 return 0;
1356}
#define lstrcpynW
Definition: compat.h:738
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define error(str)
Definition: mkdosfs.c:1605
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
#define WM_GETTEXT
Definition: winuser.h:1646

Referenced by COMBO_WindowProc().

◆ COMBO_Init()

static BOOL COMBO_Init ( void  )
static

Definition at line 89 of file combo.c.

90{
91 HDC hDC;
92
93 if( hComboBmp ) return TRUE;
94 if( (hDC = CreateCompatibleDC(0)) )
95 {
96 BOOL bRet = FALSE;
97 if( (hComboBmp = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_COMBO))) )
98 {
99 BITMAP bm;
100 HBITMAP hPrevB;
101 RECT r;
102
103 GetObjectW( hComboBmp, sizeof(bm), &bm );
104 CBitHeight = bm.bmHeight;
105 CBitWidth = bm.bmWidth;
106
107 TRACE("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
108
109 hPrevB = SelectObject( hDC, hComboBmp);
110 SetRect( &r, 0, 0, CBitWidth, CBitHeight );
111 InvertRect( hDC, &r );
112 SelectObject( hDC, hPrevB );
113 bRet = TRUE;
114 }
115 DeleteDC( hDC );
116 return bRet;
117 }
118 return FALSE;
119}
static HDC hDC
Definition: 3dtext.c:33
static HBITMAP hComboBmp
Definition: combo.c:65
static UINT CBitWidth
Definition: combo.c:66
static UINT CBitHeight
Definition: combo.c:66
static HBITMAP
Definition: button.c:44
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI InvertRect(_In_ HDC, _In_ LPCRECT)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2532
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by COMBO_NCCreate().

◆ COMBO_ItemOp()

static LRESULT COMBO_ItemOp ( LPHEADCOMBO  lphc,
UINT  msg,
LPARAM  lParam 
)
static

Definition at line 1267 of file combo.c.

1268{
1269 HWND hWnd = lphc->self;
1271
1272 TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
1273
1274 switch( msg )
1275 {
1276 case WM_DELETEITEM:
1277 {
1279 lpIS->CtlType = ODT_COMBOBOX;
1280 lpIS->CtlID = id;
1281 lpIS->hwndItem = hWnd;
1282 break;
1283 }
1284 case WM_DRAWITEM:
1285 {
1287 lpIS->CtlType = ODT_COMBOBOX;
1288 lpIS->CtlID = id;
1289 lpIS->hwndItem = hWnd;
1290 break;
1291 }
1292 case WM_COMPAREITEM:
1293 {
1295 lpIS->CtlType = ODT_COMBOBOX;
1296 lpIS->CtlID = id;
1297 lpIS->hwndItem = hWnd;
1298 break;
1299 }
1300 case WM_MEASUREITEM:
1301 {
1303 lpIS->CtlType = ODT_COMBOBOX;
1304 lpIS->CtlID = id;
1305 break;
1306 }
1307 }
1308 return SendMessageW(lphc->owner, msg, id, lParam);
1309}
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
#define WM_DELETEITEM
Definition: winuser.h:1675
#define WM_COMPAREITEM
Definition: winuser.h:1683

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_KillFocus()

static void COMBO_KillFocus ( LPHEADCOMBO  lphc)
static

Definition at line 1132 of file combo.c.

1133{
1134 HWND hWnd = lphc->self;
1135
1136 if( lphc->wState & CBF_FOCUSED )
1137 {
1138 CBRollUp( lphc, FALSE, TRUE );
1139 if( IsWindow( hWnd ) )
1140 {
1141 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1142 SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
1143
1144 lphc->wState &= ~CBF_FOCUSED;
1145
1146 /* redraw text */
1147 if( !(lphc->wState & CBF_EDIT) )
1148 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1149
1150 CB_NOTIFY( lphc, CBN_KILLFOCUS );
1151 }
1152 }
1153}
#define LB_CARETOFF
Definition: undocuser.h:54
#define CBN_KILLFOCUS
Definition: winuser.h:2007

Referenced by COMBO_Command(), COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_LButtonDown()

static void COMBO_LButtonDown ( LPHEADCOMBO  lphc,
LPARAM  lParam 
)
static

Definition at line 1537 of file combo.c.

1538{
1539 POINT pt;
1540 BOOL bButton;
1541 HWND hWnd = lphc->self;
1542
1543 pt.x = (short)LOWORD(lParam);
1544 pt.y = (short)HIWORD(lParam);
1545 bButton = PtInRect(&lphc->buttonRect, pt);
1546
1547 if( (CB_GETTYPE(lphc) == CBS_DROPDOWNLIST) ||
1548 (bButton && (CB_GETTYPE(lphc) == CBS_DROPDOWN)) )
1549 {
1550 lphc->wState |= CBF_BUTTONDOWN;
1551 if( lphc->wState & CBF_DROPPED )
1552 {
1553 /* got a click to cancel selection */
1554
1555 lphc->wState &= ~CBF_BUTTONDOWN;
1556 CBRollUp( lphc, TRUE, FALSE );
1557 if( !IsWindow( hWnd ) ) return;
1558
1559 if( lphc->wState & CBF_CAPTURE )
1560 {
1561 lphc->wState &= ~CBF_CAPTURE;
1563 }
1564 }
1565 else
1566 {
1567 /* drop down the listbox and start tracking */
1568
1569 lphc->wState |= CBF_CAPTURE;
1570 SetCapture( hWnd );
1571 CBDropDown( lphc );
1572 }
1573 if( bButton ) CBRepaintButton( lphc );
1574 }
1575}
static void CBRepaintButton(LPHEADCOMBO lphc)
Definition: combo.c:1101
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
#define LOWORD(l)
Definition: pedump.c:82
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_LButtonUp()

static void COMBO_LButtonUp ( LPHEADCOMBO  lphc)
static

Definition at line 1582 of file combo.c.

1583{
1584 if( lphc->wState & CBF_CAPTURE )
1585 {
1586 lphc->wState &= ~CBF_CAPTURE;
1587 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1588 {
1589 INT index = CBUpdateLBox( lphc, TRUE );
1590 /* Update edit only if item is in the list */
1591 if(index >= 0)
1592 {
1593 lphc->wState |= CBF_NOLBSELECT;
1594 CBUpdateEdit( lphc, index );
1595 lphc->wState &= ~CBF_NOLBSELECT;
1596 }
1597 }
1599 SetCapture(lphc->hWndLBox);
1600 }
1601
1602 if( lphc->wState & CBF_BUTTONDOWN )
1603 {
1604 lphc->wState &= ~CBF_BUTTONDOWN;
1605 CBRepaintButton( lphc );
1606 }
1607}

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_MouseMove()

static void COMBO_MouseMove ( LPHEADCOMBO  lphc,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1615 of file combo.c.

1616{
1617 POINT pt;
1618 RECT lbRect;
1619
1620 pt.x = (short)LOWORD(lParam);
1621 pt.y = (short)HIWORD(lParam);
1622
1623 if( lphc->wState & CBF_BUTTONDOWN )
1624 {
1625 BOOL bButton;
1626
1627 bButton = PtInRect(&lphc->buttonRect, pt);
1628
1629 if( !bButton )
1630 {
1631 lphc->wState &= ~CBF_BUTTONDOWN;
1632 CBRepaintButton( lphc );
1633 }
1634 }
1635
1636 GetClientRect( lphc->hWndLBox, &lbRect );
1637 MapWindowPoints( lphc->self, lphc->hWndLBox, &pt, 1 );
1638 if( PtInRect(&lbRect, pt) )
1639 {
1640 lphc->wState &= ~CBF_CAPTURE;
1642 if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) CBUpdateLBox( lphc, TRUE );
1643
1644 /* hand over pointer tracking */
1646 }
1647}
#define WM_LBUTTONDOWN
Definition: winuser.h:1804

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_NCCreate()

static LRESULT COMBO_NCCreate ( HWND  hwnd,
LONG  style 
)
static

Definition at line 124 of file combo.c.

125{
126 HEADCOMBO *lphc;
127
128 if (COMBO_Init() && (lphc = heap_alloc_zero(sizeof(*lphc))))
129 {
130 lphc->self = hwnd;
131 SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc );
132
133 /* some braindead apps do try to use scrollbar/border flags */
134
137
138 /*
139 * We also have to remove the client edge style to make sure
140 * we don't end-up with a non client area.
141 */
144
146 lphc->dwStyle |= CBS_HASSTRINGS;
148 lphc->wState |= CBF_NOTIFY;
149
150 TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
151 return TRUE;
152 }
153 return FALSE;
154}
#define CBF_NOTIFY
Definition: controls.h:53
static BOOL COMBO_Init(void)
Definition: combo.c:89
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_HSCROLL
Definition: pedump.c:628
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SetWindowLongPtrW
Definition: winuser.h:5457
#define GWL_STYLE
Definition: winuser.h:863
#define GWL_EXSTYLE
Definition: winuser.h:862

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_NCDestroy()

static LRESULT COMBO_NCDestroy ( HEADCOMBO lphc)
static

Definition at line 159 of file combo.c.

160{
161 if (lphc)
162 {
163 TRACE("[%p]: freeing storage\n", lphc->self);
164
165 if ( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
166 DestroyWindow( lphc->hWndLBox );
167
168 SetWindowLongPtrW( lphc->self, 0, 0 );
169 heap_free( lphc );
170 }
171
172 return 0;
173}
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_Paint()

static LRESULT COMBO_Paint ( HEADCOMBO lphc,
HDC  hdc 
)
static

Definition at line 809 of file combo.c.

810{
811 HBRUSH hPrevBrush, hBkgBrush;
812
813 TRACE("hdc=%p\n", hdc);
814
815 /*
816 * Retrieve the background brush and select it in the
817 * DC.
818 */
819 hBkgBrush = COMBO_PrepareColors(lphc, hdc);
820 hPrevBrush = SelectObject(hdc, hBkgBrush);
821 if (!(lphc->wState & CBF_EDIT))
822 FillRect(hdc, &lphc->textRect, hBkgBrush);
823
824 /*
825 * In non 3.1 look, there is a sunken border on the combobox
826 */
827 CBPaintBorder(lphc, hdc);
828
829 CBPaintButton(lphc, hdc);
830
831 /* paint the edit control padding area */
832 if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
833 {
834 RECT rPadEdit = lphc->textRect;
835
837
839 }
840
841 if (!(lphc->wState & CBF_EDIT))
842 CBPaintText( lphc, hdc );
843
844 if (hPrevBrush)
845 SelectObject( hdc, hPrevBrush );
846
847 return 0;
848}
static void CBPaintBorder(const HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:750
static void CBPaintButton(HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:559
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)
#define COLOR_WINDOW
Definition: winuser.h:929

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_PrepareColors()

static HBRUSH COMBO_PrepareColors ( LPHEADCOMBO  lphc,
HDC  hDC 
)
static

Definition at line 587 of file combo.c.

590{
591 HBRUSH hBkgBrush;
592
593 /*
594 * Get the background brush for this control.
595 */
596 if (CB_DISABLED(lphc))
597 {
598 hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
599 (WPARAM)hDC, (LPARAM)lphc->self );
600
601 /*
602 * We have to change the text color since WM_CTLCOLORSTATIC will
603 * set it to the "enabled" color. This is the same behavior as the
604 * edit control
605 */
607 }
608 else
609 {
610 /* FIXME: In which cases WM_CTLCOLORLISTBOX should be sent? */
611 hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
612 (WPARAM)hDC, (LPARAM)lphc->self );
613 }
614
615 /*
616 * Catch errors.
617 */
618 if( !hBkgBrush )
619 hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
620
621 return hBkgBrush;
622}
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define COLOR_GRAYTEXT
Definition: winuser.h:943
#define WM_CTLCOLOREDIT
Definition: winuser.h:1795

Referenced by CBPaintText(), and COMBO_Paint().

◆ COMBO_Register()

void COMBO_Register ( void  )

Definition at line 2124 of file combo.c.

2125{
2126 WNDCLASSW wndClass;
2127
2128 memset(&wndClass, 0, sizeof(wndClass));
2130 wndClass.lpfnWndProc = COMBO_WindowProc;
2131 wndClass.cbClsExtra = 0;
2132 wndClass.cbWndExtra = sizeof(HEADCOMBO *);
2133 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2134 wndClass.hbrBackground = NULL;
2135 wndClass.lpszClassName = WC_COMBOBOXW;
2136 RegisterClassW(&wndClass);
2137}
static LRESULT CALLBACK COMBO_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: combo.c:1667
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3287
HBRUSH hbrBackground
Definition: winuser.h:3285
int cbClsExtra
Definition: winuser.h:3280
UINT style
Definition: winuser.h:3278
WNDPROC lpfnWndProc
Definition: winuser.h:3279
int cbWndExtra
Definition: winuser.h:3281
HCURSOR hCursor
Definition: winuser.h:3284
#define CS_VREDRAW
Definition: winuser.h:666
#define CS_HREDRAW
Definition: winuser.h:661
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
#define CS_DBLCLKS
Definition: winuser.h:659
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
#define CS_GLOBALCLASS
Definition: winuser.h:660
#define CS_PARENTDC
Definition: winuser.h:664

Referenced by DllMain().

◆ COMBO_SelectString()

static LRESULT COMBO_SelectString ( LPHEADCOMBO  lphc,
INT  start,
LPARAM  pText 
)
static

Definition at line 1519 of file combo.c.

1520{
1522 if( index >= 0 )
1523 {
1524 if( lphc->wState & CBF_EDIT )
1525 CBUpdateEdit( lphc, index );
1526 else
1527 {
1528 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1529 }
1530 }
1531 return (LRESULT)index;
1532}
#define index(s, c)
Definition: various.h:29
GLuint start
Definition: gl.h:1545
LONG_PTR LRESULT
Definition: minwindef.h:176
#define LB_SELECTSTRING
Definition: winuser.h:2092

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_SetFocus()

static void COMBO_SetFocus ( LPHEADCOMBO  lphc)
static

Definition at line 1110 of file combo.c.

1111{
1112 if( !(lphc->wState & CBF_FOCUSED) )
1113 {
1114 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1115 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1116
1117 /* This is wrong. Message sequences seem to indicate that this
1118 is set *after* the notify. */
1119 /* lphc->wState |= CBF_FOCUSED; */
1120
1121 if( !(lphc->wState & CBF_EDIT) )
1122 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1123
1124 CB_NOTIFY( lphc, CBN_SETFOCUS );
1125 lphc->wState |= CBF_FOCUSED;
1126 }
1127}
#define CBN_SETFOCUS
Definition: winuser.h:2011

Referenced by COMBO_Command(), COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_SetItemHeight()

static LRESULT COMBO_SetItemHeight ( LPHEADCOMBO  lphc,
INT  index,
INT  height 
)
static

Definition at line 1484 of file combo.c.

1485{
1486 LRESULT lRet = CB_ERR;
1487
1488 if( index == -1 ) /* set text field height */
1489 {
1490 if( height < 32768 )
1491 {
1492 lphc->item_height = height + 2; /* Is the 2 for 2*EDIT_CONTROL_PADDING? */
1493
1494 /*
1495 * Redo the layout of the control.
1496 */
1497 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1498 {
1499 CBCalcPlacement(lphc);
1500
1501 CBResetPos(lphc);
1502 }
1503 else
1504 {
1505 CBForceDummyResize(lphc);
1506 }
1507
1508 lRet = height;
1509 }
1510 }
1511 else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */
1513 return lRet;
1514}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define CB_ERR
Definition: winuser.h:2471
#define LB_SETITEMHEIGHT
Definition: winuser.h:2102

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_Size()

static void COMBO_Size ( HEADCOMBO lphc)
static

Definition at line 1398 of file combo.c.

1399{
1400 if (!lphc->hWndLBox || (lphc->wState & CBF_NORESIZE))
1401 return;
1402
1403 /*
1404 * Those controls are always the same height. So we have to make sure
1405 * they are not resized to another value.
1406 */
1407 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
1408 {
1409 int newComboHeight, curComboHeight, curComboWidth;
1410 RECT rc;
1411
1412 GetWindowRect(lphc->self, &rc);
1413 curComboHeight = rc.bottom - rc.top;
1414 curComboWidth = rc.right - rc.left;
1415 newComboHeight = CBGetTextAreaHeight(lphc, TRUE) + 2*COMBO_YBORDERSIZE();
1416
1417 /*
1418 * Resizing a combobox has another side effect, it resizes the dropped
1419 * rectangle as well. However, it does it only if the new height for the
1420 * combobox is more than the height it should have. In other words,
1421 * if the application resizing the combobox only had the intention to resize
1422 * the actual control, for example, to do the layout of a dialog that is
1423 * resized, the height of the dropdown is not changed.
1424 */
1425 if( curComboHeight > newComboHeight )
1426 {
1427 TRACE("oldComboHeight=%d, newComboHeight=%d, oldDropBottom=%d, oldDropTop=%d\n",
1428 curComboHeight, newComboHeight, lphc->droppedRect.bottom,
1429 lphc->droppedRect.top);
1430 lphc->droppedRect.bottom = lphc->droppedRect.top + curComboHeight - newComboHeight;
1431 }
1432 /*
1433 * Restore original height
1434 */
1435 if (curComboHeight != newComboHeight)
1436 {
1437 lphc->wState |= CBF_NORESIZE;
1438 SetWindowPos(lphc->self, 0, 0, 0, curComboWidth, newComboHeight,
1440 lphc->wState &= ~CBF_NORESIZE;
1441 }
1442 }
1443
1444 CBCalcPlacement(lphc);
1445
1446 CBResetPos(lphc);
1447}

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_ThemedPaint()

static LRESULT COMBO_ThemedPaint ( HTHEME  theme,
HEADCOMBO lphc,
HDC  hdc 
)
static

Definition at line 769 of file combo.c.

770{
771 int button_state;
772 RECT frame;
773
774 /* paint border */
775 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
776 GetClientRect(lphc->self, &frame);
777 else
778 {
779 frame = lphc->textRect;
782 }
783
785
786 /* Paint button */
787 if (!IsRectEmpty(&lphc->buttonRect))
788 {
789 if (!IsWindowEnabled(lphc->self))
790 button_state = CBXS_DISABLED;
791 else if (lphc->wState & CBF_BUTTONDOWN)
792 button_state = CBXS_PRESSED;
793 else if (lphc->wState & CBF_HOT)
794 button_state = CBXS_HOT;
795 else
796 button_state = CBXS_NORMAL;
797 DrawThemeBackground(theme, hdc, CP_DROPDOWNBUTTON, button_state, &lphc->buttonRect, NULL);
798 }
799
801 CBPaintText(lphc, hdc);
802
803 return 0;
804}
@ CBF_HOT
Definition: comctl32.h:141
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
@ CBXS_PRESSED
Definition: vsstyle.h:178
@ CBXS_DISABLED
Definition: vsstyle.h:179
@ CBXS_NORMAL
Definition: vsstyle.h:176
@ CBXS_HOT
Definition: vsstyle.h:177
@ CP_DROPDOWNBUTTON
Definition: vsstyle.h:163

Referenced by COMBO_WindowProc().

◆ COMBO_WindowProc()

static LRESULT CALLBACK COMBO_WindowProc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1667 of file combo.c.

1668{
1669 HEADCOMBO *lphc = (HEADCOMBO *)GetWindowLongPtrW( hwnd, 0 );
1670 HTHEME theme;
1671
1672 TRACE("[%p]: msg %#x wp %08lx lp %08lx\n", hwnd, message, wParam, lParam );
1673
1674 if (!IsWindow(hwnd)) return 0;
1675
1676 if (lphc || message == WM_NCCREATE)
1677 switch(message)
1678 {
1679 case WM_NCCREATE:
1680 {
1681 LONG style = ((CREATESTRUCTW *)lParam)->style;
1682 return COMBO_NCCreate(hwnd, style);
1683 }
1684
1685 case WM_NCDESTROY:
1686 COMBO_NCDestroy(lphc);
1687 break;/* -> DefWindowProc */
1688
1689 case WM_CREATE:
1690 {
1692 LONG style;
1693
1694 hwndParent = ((CREATESTRUCTW *)lParam)->hwndParent;
1695 style = ((CREATESTRUCTW *)lParam)->style;
1696 return COMBO_Create(hwnd, lphc, hwndParent, style);
1697 }
1698
1699 case WM_DESTROY:
1700 theme = GetWindowTheme( hwnd );
1701 CloseThemeData( theme );
1702 break;
1703
1704 case WM_THEMECHANGED:
1705 theme = GetWindowTheme( hwnd );
1706 CloseThemeData( theme );
1708 break;
1709
1710 case WM_PRINTCLIENT:
1711 case WM_PAINT:
1712 {
1713 LRESULT ret = 0;
1714 PAINTSTRUCT ps;
1715 HDC hdc;
1716
1717 hdc = wParam ? (HDC)wParam : BeginPaint(hwnd, &ps);
1718
1719 if (hdc && !(lphc->wState & CBF_NOREDRAW))
1720 {
1721 HTHEME theme = GetWindowTheme(hwnd);
1722
1723 if (theme)
1724 ret = COMBO_ThemedPaint(theme, lphc, hdc);
1725 else
1726 ret = COMBO_Paint(lphc, hdc);
1727 }
1728
1729 if (!wParam)
1730 EndPaint(hwnd, &ps);
1731
1732 return ret;
1733 }
1734 case WM_ERASEBKGND:
1735 /* do all painting in WM_PAINT like Windows does */
1736 return 1;
1737
1738 case WM_GETDLGCODE:
1739 {
1741 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
1742 {
1743 int vk = (int)((LPMSG)lParam)->wParam;
1744
1745 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
1747 }
1748 return result;
1749 }
1750
1751 case WM_SIZE:
1752 COMBO_Size( lphc );
1753 return TRUE;
1754
1755 case WM_SETFONT:
1756 COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
1757 return TRUE;
1758
1759 case WM_GETFONT:
1760 return (LRESULT)lphc->hFont;
1761
1762 case WM_SETFOCUS:
1763 if (lphc->wState & CBF_EDIT)
1764 {
1765 SetFocus( lphc->hWndEdit );
1766 /* The first time focus is received, select all the text */
1767 if (!(lphc->wState & CBF_BEENFOCUSED))
1768 {
1769 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
1770 lphc->wState |= CBF_BEENFOCUSED;
1771 }
1772 }
1773 else
1774 COMBO_SetFocus( lphc );
1775 return TRUE;
1776
1777 case WM_KILLFOCUS:
1778 {
1779 HWND hwndFocus = (HWND)wParam;
1780 if (!hwndFocus || (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox))
1781 COMBO_KillFocus( lphc );
1782 return TRUE;
1783 }
1784
1785 case WM_COMMAND:
1786 return COMBO_Command( lphc, wParam, (HWND)lParam );
1787
1788 case WM_GETTEXT:
1789 return COMBO_GetText( lphc, wParam, (LPWSTR)lParam );
1790
1791 case WM_SETTEXT:
1792 case WM_GETTEXTLENGTH:
1793 case WM_CLEAR:
1794 if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
1795 {
1796 int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1797 if (j == -1) return 0;
1798 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
1799 }
1800 else if ( lphc->wState & CBF_EDIT )
1801 {
1802 LRESULT ret;
1803 lphc->wState |= CBF_NOEDITNOTIFY;
1805 lphc->wState &= ~CBF_NOEDITNOTIFY;
1806 return ret;
1807 }
1808 else
1809 return CB_ERR;
1810
1811 case WM_CUT:
1812 case WM_PASTE:
1813 case WM_COPY:
1814 if (lphc->wState & CBF_EDIT)
1815 return SendMessageW(lphc->hWndEdit, message, wParam, lParam);
1816 else return CB_ERR;
1817
1818 case WM_DRAWITEM:
1819 case WM_DELETEITEM:
1820 case WM_COMPAREITEM:
1821 case WM_MEASUREITEM:
1822 return COMBO_ItemOp(lphc, message, lParam);
1823
1824 case WM_ENABLE:
1825 if (lphc->wState & CBF_EDIT)
1826 EnableWindow( lphc->hWndEdit, (BOOL)wParam );
1827 EnableWindow( lphc->hWndLBox, (BOOL)wParam );
1828
1829 /* Force the control to repaint when the enabled state changes. */
1830 InvalidateRect(lphc->self, NULL, TRUE);
1831 return TRUE;
1832
1833 case WM_SETREDRAW:
1834 if (wParam)
1835 lphc->wState &= ~CBF_NOREDRAW;
1836 else
1837 lphc->wState |= CBF_NOREDRAW;
1838
1839 if ( lphc->wState & CBF_EDIT )
1842 return 0;
1843
1844 case WM_SYSKEYDOWN:
1845 if ( KEYDATA_ALT & HIWORD(lParam) )
1846 if( wParam == VK_UP || wParam == VK_DOWN )
1847#ifdef __REACTOS__
1848 {
1849#endif
1850 COMBO_FlipListbox( lphc, FALSE, FALSE );
1851 return 0;
1852#ifdef __REACTOS__
1853 }
1854 break;
1855#endif
1856
1857 case WM_KEYDOWN:
1858 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
1859 (lphc->wState & CBF_DROPPED))
1860 {
1861 CBRollUp( lphc, wParam == VK_RETURN, FALSE );
1862 return TRUE;
1863 }
1864 else if ((wParam == VK_F4) && !(lphc->wState & CBF_EUI))
1865 {
1866 COMBO_FlipListbox( lphc, FALSE, FALSE );
1867 return TRUE;
1868 }
1869 /* fall through */
1870 case WM_CHAR:
1871 case WM_IME_CHAR:
1872 {
1873 HWND hwndTarget;
1874
1875#ifdef __REACTOS__
1876 if (lphc->wState & CBF_DROPPED)
1877 lphc->wState |= CBF_NOROLLUP;
1878#endif
1879 if ( lphc->wState & CBF_EDIT )
1880 hwndTarget = lphc->hWndEdit;
1881 else
1882 hwndTarget = lphc->hWndLBox;
1883
1884 return SendMessageW(hwndTarget, message, wParam, lParam);
1885 }
1886
1887 case WM_LBUTTONDOWN:
1888 if ( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
1889 if ( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
1890 return TRUE;
1891
1892 case WM_LBUTTONUP:
1893 COMBO_LButtonUp( lphc );
1894 return TRUE;
1895
1896 case WM_MOUSEMOVE:
1897 if (!IsRectEmpty(&lphc->buttonRect))
1898 {
1899 POINT pt;
1900
1901 pt.x = (short)LOWORD(lParam);
1902 pt.y = (short)HIWORD(lParam);
1903
1904 if (PtInRect(&lphc->buttonRect, pt))
1905 {
1906 if (!(lphc->wState & CBF_HOT))
1907 {
1908 lphc->wState |= CBF_HOT;
1910 }
1911 }
1912 else if (lphc->wState & CBF_HOT)
1913 {
1914 lphc->wState &= ~CBF_HOT;
1916 }
1917 }
1918
1919 if ( lphc->wState & CBF_CAPTURE )
1920 COMBO_MouseMove( lphc, wParam, lParam );
1921 return TRUE;
1922
1923 case WM_MOUSEWHEEL:
1924 if (wParam & (MK_SHIFT | MK_CONTROL))
1926
1927 if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
1928 if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
1929 return TRUE;
1930
1931 case WM_CTLCOLOR:
1932 case WM_CTLCOLORMSGBOX:
1933 case WM_CTLCOLOREDIT:
1934 case WM_CTLCOLORLISTBOX:
1935 case WM_CTLCOLORBTN:
1936 case WM_CTLCOLORDLG:
1938 case WM_CTLCOLORSTATIC:
1939 return SendMessageW(lphc->owner, message, wParam, lParam);
1940
1941 /* Combo messages */
1942 case CB_ADDSTRING:
1943 if (lphc->dwStyle & CBS_LOWERCASE)
1945 else if (lphc->dwStyle & CBS_UPPERCASE)
1947 return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
1948
1949 case CB_INSERTSTRING:
1950 if (lphc->dwStyle & CBS_LOWERCASE)
1952 else if (lphc->dwStyle & CBS_UPPERCASE)
1955
1956 case CB_DELETESTRING:
1957 return SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
1958
1959 case CB_SELECTSTRING:
1960 return COMBO_SelectString(lphc, (INT)wParam, lParam);
1961
1962 case CB_FINDSTRING:
1964
1965 case CB_FINDSTRINGEXACT:
1967
1968 case CB_SETITEMHEIGHT:
1969 return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
1970
1971 case CB_GETITEMHEIGHT:
1972 if ((INT)wParam >= 0) /* listbox item */
1973 return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
1974 return CBGetTextAreaHeight(lphc, FALSE);
1975
1976 case CB_RESETCONTENT:
1978
1979 if ((lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc))
1980 {
1981 static const WCHAR empty_stringW[] = { 0 };
1983 }
1984 else
1985 InvalidateRect(lphc->self, NULL, TRUE);
1986 return TRUE;
1987
1988 case CB_INITSTORAGE:
1990
1992 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
1993
1996
1997 case CB_GETTOPINDEX:
1998 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
1999
2000 case CB_GETLOCALE:
2001 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
2002
2003 case CB_SETLOCALE:
2004 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
2005
2006 case CB_SETDROPPEDWIDTH:
2007 if ((CB_GETTYPE(lphc) == CBS_SIMPLE) || (INT)wParam >= 32768)
2008 return CB_ERR;
2009
2010 /* new value must be higher than combobox width */
2011 if ((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
2012 lphc->droppedWidth = wParam;
2013 else if (wParam)
2014 lphc->droppedWidth = 0;
2015
2016 /* recalculate the combobox area */
2017 CBCalcPlacement(lphc);
2018
2019 /* fall through */
2020 case CB_GETDROPPEDWIDTH:
2021 if (lphc->droppedWidth)
2022 return lphc->droppedWidth;
2023 return lphc->droppedRect.right - lphc->droppedRect.left;
2024
2026 if (lParam)
2028 return CB_OKAY;
2029
2030 case CB_GETDROPPEDSTATE:
2031 return (lphc->wState & CBF_DROPPED) != 0;
2032
2033 case CB_DIR:
2034 return SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam);
2035
2036 case CB_SHOWDROPDOWN:
2037 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
2038 {
2039 if (wParam)
2040 {
2041 if (!(lphc->wState & CBF_DROPPED))
2042 CBDropDown( lphc );
2043 }
2044 else if (lphc->wState & CBF_DROPPED)
2045 CBRollUp( lphc, FALSE, TRUE );
2046 }
2047 return TRUE;
2048
2049 case CB_GETCOUNT:
2050 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
2051
2052 case CB_GETCURSEL:
2053 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
2054
2055 case CB_SETCURSEL:
2057 if (lParam >= 0)
2059
2060 /* no LBN_SELCHANGE in this case, update manually */
2061 CBPaintText(lphc, NULL);
2062 lphc->wState &= ~CBF_SELCHANGE;
2063 return lParam;
2064
2065 case CB_GETLBTEXT:
2066 return SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
2067
2068 case CB_GETLBTEXTLEN:
2069 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
2070
2071 case CB_GETITEMDATA:
2072 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
2073
2074 case CB_SETITEMDATA:
2076
2077 case CB_GETEDITSEL:
2078 /* Edit checks passed parameters itself */
2079 if (lphc->wState & CBF_EDIT)
2080 return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
2081 return CB_ERR;
2082
2083 case CB_SETEDITSEL:
2084 if (lphc->wState & CBF_EDIT)
2086 return CB_ERR;
2087
2088 case CB_SETEXTENDEDUI:
2089 if (CB_GETTYPE(lphc) == CBS_SIMPLE )
2090 return CB_ERR;
2091 if (wParam)
2092 lphc->wState |= CBF_EUI;
2093 else
2094 lphc->wState &= ~CBF_EUI;
2095 return CB_OKAY;
2096
2097 case CB_GETEXTENDEDUI:
2098 return (lphc->wState & CBF_EUI) != 0;
2099
2100 case CB_GETCOMBOBOXINFO:
2101 return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
2102
2103 case CB_LIMITTEXT:
2104 if (lphc->wState & CBF_EDIT)
2106 return TRUE;
2107
2108 case CB_GETMINVISIBLE:
2109 return lphc->visibleItems;
2110
2111 case CB_SETMINVISIBLE:
2112 lphc->visibleItems = (INT)wParam;
2113 return TRUE;
2114
2115 default:
2116 if (message >= WM_USER)
2117 WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam );
2118 break;
2119 }
2120
2122}
#define WARN(fmt,...)
Definition: precomp.h:61
#define CBF_EUI
Definition: controls.h:59
#define CBF_BEENFOCUSED
Definition: controls.h:58
static LRESULT COMBO_Paint(HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:809
static LRESULT COMBO_NCDestroy(HEADCOMBO *lphc)
Definition: combo.c:159
static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
Definition: combo.c:124
#define ISWIN31
Definition: combo.c:60
static void COMBO_Size(HEADCOMBO *lphc)
Definition: combo.c:1398
static void COMBO_LButtonDown(LPHEADCOMBO lphc, LPARAM lParam)
Definition: combo.c:1537
static void COMBO_MouseMove(LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam)
Definition: combo.c:1615
static LRESULT COMBO_GetComboBoxInfo(const HEADCOMBO *lphc, COMBOBOXINFO *pcbi)
Definition: combo.c:1649
static LRESULT COMBO_Command(LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd)
Definition: combo.c:1158
static void COMBO_LButtonUp(LPHEADCOMBO lphc)
Definition: combo.c:1582
static LRESULT COMBO_ThemedPaint(HTHEME theme, HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:769
#define KEYDATA_ALT
Definition: combo.c:43
static LRESULT COMBO_ItemOp(LPHEADCOMBO lphc, UINT msg, LPARAM lParam)
Definition: combo.c:1267
static LRESULT COMBO_SelectString(LPHEADCOMBO lphc, INT start, LPARAM pText)
Definition: combo.c:1519
BOOL COMBO_FlipListbox(LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton)
Definition: combo.c:1086
static LRESULT COMBO_SetItemHeight(LPHEADCOMBO lphc, INT index, INT height)
Definition: combo.c:1484
static LRESULT COMBO_GetText(HEADCOMBO *lphc, INT count, LPWSTR buf)
Definition: combo.c:1315
static void COMBO_Font(LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw)
Definition: combo.c:1453
static void CBGetDroppedControlRect(LPHEADCOMBO lphc, LPRECT lpRect)
Definition: combo.c:386
static LRESULT COMBO_Create(HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style)
Definition: combo.c:401
HANDLE HWND
Definition: compat.h:19
LPWSTR WINAPI CharLowerW(WCHAR *str)
Definition: string.c:1092
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1205
unsigned short vk
Definition: console.c:118
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:920
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:1036
return ret
Definition: mutex.c:146
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
#define INT
Definition: polytest.cpp:20
#define CB_GETMINVISIBLE
Definition: commctrl.h:4727
#define CB_SETMINVISIBLE
Definition: commctrl.h:4726
#define WM_PRINTCLIENT
Definition: richedit.h:70
Definition: tftpd.h:60
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define WM_PAINT
Definition: winuser.h:1648
#define WM_ERASEBKGND
Definition: winuser.h:1653
#define CB_SELECTSTRING
Definition: winuser.h:1989
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define CB_GETHORIZONTALEXTENT
Definition: winuser.h:1978
#define MK_SHIFT
Definition: winuser.h:2405
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1991
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2064
#define CB_GETLBTEXTLEN
Definition: winuser.h:1982
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define CB_GETLBTEXT
Definition: winuser.h:1981
#define WM_ENABLE
Definition: winuser.h:1643
#define WM_PASTE
Definition: winuser.h:1891
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2100
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_OKAY
Definition: winuser.h:2470
#define WM_CREATE
Definition: winuser.h:1636
#define DLGC_WANTCHARS
Definition: winuser.h:2660
#define CB_SHOWDROPDOWN
Definition: winuser.h:1999
#define CB_GETITEMHEIGHT
Definition: winuser.h:1980
#define EM_GETSEL
Definition: winuser.h:2026
#define CB_SETHORIZONTALEXTENT
Definition: winuser.h:1994
#define LB_DIR
Definition: winuser.h:2062
#define WM_SIZE
Definition: winuser.h:1639
#define CB_INITSTORAGE
Definition: winuser.h:1985
#define CB_SETCURSEL
Definition: winuser.h:1990
#define LB_GETTOPINDEX
Definition: winuser.h:2087
#define VK_UP
Definition: winuser.h:2261
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define LB_GETLOCALE
Definition: winuser.h:2081
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1799
#define WM_CUT
Definition: winuser.h:1889
#define LB_SETLOCALE
Definition: winuser.h:2103
#define CB_RESETCONTENT
Definition: winuser.h:1988
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1969
#define LB_ADDSTRING
Definition: winuser.h:2060
#define CB_DIR
Definition: winuser.h:1967
#define CB_GETCOUNT
Definition: winuser.h:1971
#define WM_GETFONT
Definition: winuser.h:1679
#define CB_GETDROPPEDWIDTH
Definition: winuser.h:1975
#define CB_GETCOMBOBOXINFO
Definition: winuser.h:1970
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1794
#define CB_SETLOCALE
Definition: winuser.h:1997
#define WM_NCCREATE
Definition: winuser.h:1711
#define WM_CTLCOLORBTN
Definition: winuser.h:1797
#define WM_IME_CHAR
Definition: winuser.h:1862
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define LB_DELETESTRING
Definition: winuser.h:2061
#define VK_RETURN
Definition: winuser.h:2237
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1973
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MK_CONTROL
Definition: winuser.h:2406
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LB_GETHORIZONTALEXTENT
Definition: winuser.h:2069
#define DLGC_WANTARROWS
Definition: winuser.h:2652
#define LB_INSERTSTRING
Definition: winuser.h:2089
#define CB_ADDSTRING
Definition: winuser.h:1965
#define CB_GETITEMDATA
Definition: winuser.h:1979
#define CB_SETEDITSEL
Definition: winuser.h:1992
#define VK_F4
Definition: winuser.h:2294
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1974
#define WM_LBUTTONUP
Definition: winuser.h:1805
#define WM_CHAR
Definition: winuser.h:1745
#define LB_SETITEMDATA
Definition: winuser.h:2101
#define WM_NCDESTROY
Definition: winuser.h:1712
#define CB_GETEXTENDEDUI
Definition: winuser.h:1977
#define VK_DOWN
Definition: winuser.h:2263
#define WM_COPY
Definition: winuser.h:1890
#define CB_GETTOPINDEX
Definition: winuser.h:1984
#define CB_LIMITTEXT
Definition: winuser.h:1987
#define WM_USER
Definition: winuser.h:1923
#define CB_GETEDITSEL
Definition: winuser.h:1976
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1796
#define DLGC_WANTMESSAGE
Definition: winuser.h:2655
#define WM_DESTROY
Definition: winuser.h:1637
#define CB_FINDSTRING
Definition: winuser.h:1968
#define WM_CLEAR
Definition: winuser.h:1892
#define WM_KEYDOWN
Definition: winuser.h:1743
#define CB_SETEXTENDEDUI
Definition: winuser.h:1993
#define CB_INSERTSTRING
Definition: winuser.h:1986
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define CB_GETCURSEL
Definition: winuser.h:1972
#define CB_DELETESTRING
Definition: winuser.h:1966
#define CB_GETLOCALE
Definition: winuser.h:1983
#define CB_SETITEMHEIGHT
Definition: winuser.h:1996
#define LB_INITSTORAGE
Definition: winuser.h:2088
#define VK_ESCAPE
Definition: winuser.h:2250
#define WM_CTLCOLORDLG
Definition: winuser.h:1798
#define WM_KILLFOCUS
Definition: winuser.h:1642
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define WM_GETDLGCODE
Definition: winuser.h:1717
#define WM_SETREDRAW
Definition: winuser.h:1644

Referenced by COMBO_Register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( combo  )

Variable Documentation

◆ CBitHeight

UINT CBitHeight
static

Definition at line 66 of file combo.c.

Referenced by COMBO_Init().

◆ CBitWidth

UINT CBitWidth
static

Definition at line 66 of file combo.c.

Referenced by COMBO_Init().

◆ hComboBmp

HBITMAP hComboBmp = 0
static

Definition at line 65 of file combo.c.

Referenced by COMBO_Init().