ReactOS 0.4.16-dev-297-gc569aee
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))
Definition: inflate.c:139
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define WM_COMMAND
Definition: winuser.h:1743
#define GWLP_ID
Definition: winuser.h:863
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:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
#define SM_CXVSCROLL
Definition: winuser.h:964
#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 921 of file combo.c.

922{
923 HMONITOR monitor;
924 MONITORINFO mon_info;
925 RECT rect,r;
926 int nItems;
927 int nDroppedHeight;
928
929 TRACE("[%p]: drop down\n", lphc->self);
930
931 CB_NOTIFY( lphc, CBN_DROPDOWN );
932
933 /* set selection */
934
935 lphc->wState |= CBF_DROPPED;
936 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
937 {
938 lphc->droppedIndex = CBUpdateLBox( lphc, TRUE );
939
940 /* Update edit only if item is in the list */
941 if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0)
942 CBUpdateEdit( lphc, lphc->droppedIndex );
943 }
944 else
945 {
946 lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
947
949 lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex, 0);
950 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
951 }
952
953 /* now set popup position */
954 GetWindowRect( lphc->self, &rect );
955
956 /*
957 * If it's a dropdown, the listbox is offset
958 */
959 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
960 rect.left += COMBO_EDITBUTTONSPACE();
961
962 /* if the dropped height is greater than the total height of the dropped
963 items list, then force the drop down list height to be the total height
964 of the items in the dropped list */
965
966 /* And Remove any extra space (Best Fit) */
967 nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
968 /* if listbox length has been set directly by its handle */
969 GetWindowRect(lphc->hWndLBox, &r);
970 if (nDroppedHeight < r.bottom - r.top)
971 nDroppedHeight = r.bottom - r.top;
972 nItems = (int)SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
973
974 if (nItems > 0)
975 {
976 int nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
977
978 if (lphc->dwStyle & CBS_NOINTEGRALHEIGHT)
979 {
980 nDroppedHeight -= 1;
981 }
982 else
983 {
984 if (nItems > lphc->visibleItems)
985 nItems = lphc->visibleItems;
986 nDroppedHeight = nItems * nIHeight + COMBO_YBORDERSIZE();
987 }
988 }
989
990 r.left = rect.left;
991 r.top = rect.bottom;
992 r.right = r.left + lphc->droppedRect.right - lphc->droppedRect.left;
993 r.bottom = r.top + nDroppedHeight;
994
995 /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/
996 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
997 mon_info.cbSize = sizeof(mon_info);
998 GetMonitorInfoW( monitor, &mon_info );
999
1000 if (r.bottom > mon_info.rcWork.bottom)
1001 {
1002 r.top = max( rect.top - nDroppedHeight, mon_info.rcWork.top );
1003 r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom );
1004 }
1005
1006 SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top,
1008
1009
1010 if( !(lphc->wState & CBF_NOREDRAW) )
1012
1013 EnableWindow( lphc->hWndLBox, TRUE );
1014 if (GetCapture() != lphc->self)
1015 SetCapture(lphc->hWndLBox);
1016}
int nItems
Definition: appswitch.c:56
#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:851
#define CB_NOTIFY(lphc, code)
Definition: combo.c:50
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:885
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:3787
#define max(a, b)
Definition: svc.c:63
#define LB_CARETON
Definition: undocuser.h:51
#define LB_ERR
Definition: winuser.h:2435
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define LB_GETCOUNT
Definition: winuser.h:2041
#define SWP_NOACTIVATE
Definition: winuser.h:1245
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:1211
#define LB_SETTOPINDEX
Definition: winuser.h:2073
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:1223
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define RDW_ERASE
Definition: winuser.h:1214
#define CBN_DROPDOWN
Definition: winuser.h:1977
#define LB_GETITEMHEIGHT
Definition: winuser.h:2045
#define SWP_SHOWWINDOW
Definition: winuser.h:1251
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define LB_GETCURSEL
Definition: winuser.h:2042
#define RDW_INVALIDATE
Definition: winuser.h:1217

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:1356
static void CBCalcPlacement(HEADCOMBO *combo)
Definition: combo.c:317
#define SWP_NOMOVE
Definition: winuser.h:1247
#define SWP_NOZORDER
Definition: winuser.h:1250

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:3649
int32_t INT
Definition: typedefs.h:58
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
#define ODT_COMBOBOX
Definition: winuser.h:2542
#define WM_MEASUREITEM
Definition: winuser.h:1649

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

◆ CBPaintBorder()

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

Definition at line 746 of file combo.c.

747{
748 RECT clientRect;
749
750 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
751 {
752 GetClientRect(lphc->self, &clientRect);
753 }
754 else
755 {
756 clientRect = lphc->textRect;
757
760 }
761
762 DrawEdge(hdc, &clientRect, EDGE_SUNKEN, BF_RECT);
763}
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 555 of file combo.c.

556{
557 UINT buttonState = DFCS_SCROLLCOMBOBOX;
558
559 if (IsRectEmpty(&lphc->buttonRect))
560 return;
561
562 if( lphc->wState & CBF_NOREDRAW )
563 return;
564
565
566 if (lphc->wState & CBF_BUTTONDOWN)
567 buttonState |= DFCS_PUSHED;
568
569 if (CB_DISABLED(lphc))
570 buttonState |= DFCS_INACTIVE;
571
572 DrawFrameControl(hdc, &lphc->buttonRect, DFC_SCROLL, buttonState);
573}
#define CB_DISABLED(lphc)
Definition: combo.c:54
#define CBF_BUTTONDOWN
Definition: window.c:3465
#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 625 of file combo.c.

626{
627 RECT rectEdit = lphc->textRect;
628 INT id, size = 0;
629 LPWSTR pText = NULL;
630
631 TRACE("\n");
632
633 /* follow Windows combobox that sends a bunch of text
634 * inquiries to its listbox while processing WM_PAINT. */
635
636 if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR )
637 {
638 size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
639 if (size == LB_ERR)
640 FIXME("LB_ERR probably not handled yet\n");
641 if ((pText = heap_alloc((size + 1) * sizeof(WCHAR))))
642 {
643 /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
645 pText[size] = '\0'; /* just in case */
646 } else return;
647 }
648
649 if( lphc->wState & CBF_EDIT )
650 {
651 static const WCHAR empty_stringW[] = { 0 };
653 if( lphc->wState & CBF_FOCUSED )
655 }
656 else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self ))
657 {
658 /* paint text field ourselves */
659 HDC hdc = hdc_paint ? hdc_paint : GetDC(lphc->self);
660 UINT itemState = ODS_COMBOBOXEDIT;
661 HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
662 HBRUSH hPrevBrush, hBkgBrush;
663
664 /*
665 * Give ourselves some space.
666 */
667 InflateRect( &rectEdit, -1, -1 );
668
669 hBkgBrush = COMBO_PrepareColors( lphc, hdc );
670 hPrevBrush = SelectObject( hdc, hBkgBrush );
671 FillRect( hdc, &rectEdit, hBkgBrush );
672
673 if( CB_OWNERDRAWN(lphc) )
674 {
675 DRAWITEMSTRUCT dis;
676 HRGN clipRegion;
677 UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
678
679 /* setup state for DRAWITEM message. Owner will highlight */
680 if ( (lphc->wState & CBF_FOCUSED) &&
681 !(lphc->wState & CBF_DROPPED) )
682 itemState |= ODS_SELECTED | ODS_FOCUS;
683
684 if (!IsWindowEnabled(lphc->self)) itemState |= ODS_DISABLED;
685
686 dis.CtlType = ODT_COMBOBOX;
687 dis.CtlID = ctlid;
688 dis.hwndItem = lphc->self;
690 dis.itemID = id;
691 dis.itemState = itemState;
692 dis.hDC = hdc;
693 dis.rcItem = rectEdit;
694 dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, id, 0);
695
696 /*
697 * Clip the DC and have the parent draw the item.
698 */
699 clipRegion = set_control_clipping( hdc, &rectEdit );
700
701 SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
702
703 SelectClipRgn( hdc, clipRegion );
704 if (clipRegion) DeleteObject( clipRegion );
705 }
706 else
707 {
708 static const WCHAR empty_stringW[] = { 0 };
709
710 if ( (lphc->wState & CBF_FOCUSED) &&
711 !(lphc->wState & CBF_DROPPED) ) {
712
713 /* highlight */
717 }
718
720 rectEdit.left + 1,
721 rectEdit.top + 1,
723 &rectEdit,
725
726 if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
727 DrawFocusRect( hdc, &rectEdit );
728 }
729
730 if( hPrevFont )
731 SelectObject(hdc, hPrevFont );
732
733 if( hPrevBrush )
734 SelectObject( hdc, hPrevBrush );
735
736 if( !hdc_paint )
737 ReleaseDC( lphc->self, hdc );
738 }
739
741}
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:583
#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:3096
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:918
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define ODS_DISABLED
Definition: winuser.h:2550
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2548
#define LB_GETITEMDATA
Definition: winuser.h:2044
#define ODA_DRAWENTIRE
Definition: winuser.h:2545
#define LB_GETTEXT
Definition: winuser.h:2052
#define COLOR_HIGHLIGHT
Definition: winuser.h:929
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1648
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:930
HDC WINAPI GetDC(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2021
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define LB_GETTEXTLEN
Definition: winuser.h:2053
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define ODS_FOCUS
Definition: winuser.h:2552
__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 1093 of file combo.c.

1094 {
1095 InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
1096 UpdateWindow(lphc->self);
1097}
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 1356 of file combo.c.

1357{
1358 BOOL drop = CB_GETTYPE(combo) != CBS_SIMPLE;
1359
1360 /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
1361 * sizing messages */
1362 if (combo->wState & CBF_EDIT)
1363 SetWindowPos(combo->hWndEdit, 0, combo->textRect.left, combo->textRect.top,
1364 combo->textRect.right - combo->textRect.left,
1365 combo->textRect.bottom - combo->textRect.top,
1366 SWP_NOZORDER | SWP_NOACTIVATE | (drop ? SWP_NOREDRAW : 0));
1367
1368 SetWindowPos(combo->hWndLBox, 0, combo->droppedRect.left, combo->droppedRect.top,
1369 combo->droppedRect.right - combo->droppedRect.left,
1370 combo->droppedRect.bottom - combo->droppedRect.top,
1371 SWP_NOACTIVATE | SWP_NOZORDER | (drop ? SWP_NOREDRAW : 0));
1372
1373 if (drop)
1374 {
1375 if (combo->wState & CBF_DROPPED)
1376 {
1377 combo->wState &= ~CBF_DROPPED;
1378 ShowWindow(combo->hWndLBox, SW_HIDE);
1379 }
1380
1381 if (!(combo->wState & CBF_NOREDRAW))
1383 }
1384}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SW_HIDE
Definition: winuser.h:771
#define SWP_NOREDRAW
Definition: winuser.h:1249
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 1023 of file combo.c.

1024{
1025 HWND hWnd = lphc->self;
1026
1027 TRACE("[%p]: sel ok? [%i] dropped? [%i]\n",
1028 lphc->self, ok, (INT)(lphc->wState & CBF_DROPPED));
1029
1031
1032 if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
1033 {
1034
1035 if( lphc->wState & CBF_DROPPED )
1036 {
1037 RECT rect;
1038
1039 lphc->wState &= ~CBF_DROPPED;
1040 ShowWindow( lphc->hWndLBox, SW_HIDE );
1041
1042 if(GetCapture() == lphc->hWndLBox)
1043 {
1045 }
1046
1047 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1048 {
1049 rect = lphc->buttonRect;
1050 }
1051 else
1052 {
1053 if( bButton )
1054 {
1055 UnionRect( &rect,
1056 &lphc->buttonRect,
1057 &lphc->textRect);
1058 }
1059 else
1060 rect = lphc->textRect;
1061
1062 bButton = TRUE;
1063 }
1064
1065 if( bButton && !(lphc->wState & CBF_NOREDRAW) )
1068 CB_NOTIFY( lphc, CBN_CLOSEUP );
1069 }
1070 }
1071}
#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:1225
#define CBN_CLOSEUP
Definition: winuser.h:1975
#define CBN_SELENDOK
Definition: winuser.h:1984
#define CBN_SELENDCANCEL
Definition: winuser.h:1983
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 885 of file combo.c.

886{
887 INT length;
888 LPWSTR pText = NULL;
889 static const WCHAR empty_stringW[] = { 0 };
890
891 TRACE("\t %i\n", index );
892
893 if( index >= 0 ) /* got an entry */
894 {
896 if( length != LB_ERR)
897 {
898 if ((pText = heap_alloc((length + 1) * sizeof(WCHAR))))
900 }
901 }
902
903 if( CB_HASSTRINGS(lphc) )
904 {
908 }
909
910 if( lphc->wState & CBF_FOCUSED )
911 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
912
913 heap_free( pText );
914}
#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:1620

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

◆ CBUpdateLBox()

static INT CBUpdateLBox ( LPHEADCOMBO  lphc,
BOOL  bSelect 
)
static

Definition at line 851 of file combo.c.

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

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 1150 of file combo.c.

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

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 if( lphc->owner || !(style & WS_VISIBLE) )
429 {
430 UINT lbeStyle = 0;
431 UINT lbeExStyle = 0;
432
433 /*
434 * Initialize the dropped rect to the size of the client area of the
435 * control and then, force all the areas of the combobox to be
436 * recalculated.
437 */
438 GetClientRect( hwnd, &lphc->droppedRect );
439 CBCalcPlacement(lphc);
440
441 /*
442 * Adjust the position of the popup listbox if it's necessary
443 */
444 if ( CB_GETTYPE(lphc) != CBS_SIMPLE )
445 {
447
448 /*
449 * If it's a dropdown, the listbox is offset
450 */
451 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
453
454 if (lphc->droppedRect.bottom < lphc->droppedRect.top)
455 lphc->droppedRect.bottom = lphc->droppedRect.top;
456 if (lphc->droppedRect.right < lphc->droppedRect.left)
457 lphc->droppedRect.right = lphc->droppedRect.left;
458 MapWindowPoints( hwnd, 0, (LPPOINT)&lphc->droppedRect, 2 );
459 }
460
461 /* create listbox popup */
462
465
466 if( lphc->dwStyle & CBS_SORT )
467 lbeStyle |= LBS_SORT;
468 if( lphc->dwStyle & CBS_HASSTRINGS )
469 lbeStyle |= LBS_HASSTRINGS;
470 if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT )
471 lbeStyle |= LBS_NOINTEGRALHEIGHT;
472 if( lphc->dwStyle & CBS_DISABLENOSCROLL )
473 lbeStyle |= LBS_DISABLENOSCROLL;
474
475 if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */
476 {
477 lbeStyle |= WS_VISIBLE;
478
479 /*
480 * In win 95 look n feel, the listbox in the simple combobox has
481 * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
482 */
483 lbeStyle &= ~WS_BORDER;
484 lbeExStyle |= WS_EX_CLIENTEDGE;
485 }
486 else
487 {
488 lbeExStyle |= (WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
489 }
490
491 lphc->hWndLBox = CreateWindowExW(lbeExStyle, clbName, NULL, lbeStyle,
492 lphc->droppedRect.left, lphc->droppedRect.top, lphc->droppedRect.right - lphc->droppedRect.left,
495 if( lphc->hWndLBox )
496 {
497 BOOL bEdit = TRUE;
499
500 if( lphc->wState & CBF_EDIT )
501 {
502 if( lphc->dwStyle & CBS_OEMCONVERT )
503 lbeStyle |= ES_OEMCONVERT;
504 if( lphc->dwStyle & CBS_AUTOHSCROLL )
505 lbeStyle |= ES_AUTOHSCROLL;
506 if( lphc->dwStyle & CBS_LOWERCASE )
507 lbeStyle |= ES_LOWERCASE;
508 else if( lphc->dwStyle & CBS_UPPERCASE )
509 lbeStyle |= ES_UPPERCASE;
510
511 if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
512
513 lphc->hWndEdit = CreateWindowExW(0, editName, NULL, lbeStyle,
514 lphc->textRect.left, lphc->textRect.top,
515 lphc->textRect.right - lphc->textRect.left,
516 lphc->textRect.bottom - lphc->textRect.top,
519 if( !lphc->hWndEdit )
520 bEdit = FALSE;
521 }
522
523 if( bEdit )
524 {
525 if( CB_GETTYPE(lphc) != CBS_SIMPLE )
526 {
527 /* Now do the trick with parent */
529 /*
530 * If the combo is a dropdown, we must resize the control
531 * to fit only the text area and button. To do this,
532 * we send a dummy resize and the WM_WINDOWPOSCHANGING message
533 * will take care of setting the height for us.
534 */
535 CBForceDummyResize(lphc);
536 }
537
538 TRACE("init done\n");
539 return 0;
540 }
541 ERR("edit control failure.\n");
542 } else ERR("listbox failure.\n");
543 } else ERR("no owner for visible combo.\n");
544
545 /* CreateWindow() will send WM_NCDESTROY to cleanup */
546
547 return -1;
548}
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 classlist)
Definition: system.c:835
#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:63
#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:859
#define HWND_DESKTOP
Definition: winuser.h:1212
#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 1078 of file combo.c.

1079{
1080 if( lphc->wState & CBF_DROPPED )
1081 {
1082 CBRollUp( lphc, ok, bRedrawButton );
1083 return FALSE;
1084 }
1085
1086 CBDropDown( lphc );
1087 return TRUE;
1088}
static void CBDropDown(LPHEADCOMBO lphc)
Definition: combo.c:921

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 1445 of file combo.c.

1446{
1447 lphc->hFont = hFont;
1448 lphc->item_height = combo_get_text_height(lphc);
1449
1450 /*
1451 * Propagate to owned windows.
1452 */
1453 if( lphc->wState & CBF_EDIT )
1454 SendMessageW(lphc->hWndEdit, WM_SETFONT, (WPARAM)hFont, bRedraw);
1455 SendMessageW(lphc->hWndLBox, WM_SETFONT, (WPARAM)hFont, bRedraw);
1456
1457 /*
1458 * Redo the layout of the control.
1459 */
1460 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1461 {
1462 CBCalcPlacement(lphc);
1463
1464 CBResetPos(lphc);
1465 }
1466 else
1467 {
1468 CBForceDummyResize(lphc);
1469 }
1470}
HFONT hFont
Definition: main.c:53
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_SETFONT
Definition: winuser.h:1653

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}
Definition: time.h:68
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 1641 of file combo.c.

1642{
1643 if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO)))
1644 return FALSE;
1645
1646 pcbi->rcItem = lphc->textRect;
1647 pcbi->rcButton = lphc->buttonRect;
1648 pcbi->stateButton = 0;
1649 if (lphc->wState & CBF_BUTTONDOWN)
1651 if (IsRectEmpty(&lphc->buttonRect))
1653 pcbi->hwndCombo = lphc->self;
1654 pcbi->hwndItem = lphc->hWndEdit;
1655 pcbi->hwndList = lphc->hWndLBox;
1656 return TRUE;
1657}
DWORD stateButton
Definition: winuser.h:3715
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2868
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2880

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_GetText()

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

Definition at line 1307 of file combo.c.

1308{
1309 INT length;
1310
1311 if( lphc->wState & CBF_EDIT )
1312 return SendMessageW( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1313
1314 /* get it from the listbox */
1315
1316 if (!count || !buf) return 0;
1317 if( lphc->hWndLBox )
1318 {
1319 INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1320 if (idx == LB_ERR) goto error;
1322 if (length == LB_ERR) goto error;
1323
1324 /* 'length' is without the terminating character */
1325 if (length >= count)
1326 {
1327 WCHAR *lpBuffer = heap_alloc((length + 1) * sizeof(WCHAR));
1328 if (!lpBuffer) goto error;
1330
1331 /* truncate if buffer is too short */
1332 if (length != LB_ERR)
1333 {
1335 length = count;
1336 }
1338 }
1340
1341 if (length == LB_ERR) return 0;
1342 return length;
1343 }
1344
1345 error: /* error - truncate string, return zero */
1346 buf[0] = 0;
1347 return 0;
1348}
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#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
#define WM_GETTEXT
Definition: winuser.h:1621

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
Definition: bl.h:1331
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:2215
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 1259 of file combo.c.

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

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_KillFocus()

static void COMBO_KillFocus ( LPHEADCOMBO  lphc)
static

Definition at line 1124 of file combo.c.

1125{
1126 HWND hWnd = lphc->self;
1127
1128 if( lphc->wState & CBF_FOCUSED )
1129 {
1130 CBRollUp( lphc, FALSE, TRUE );
1131 if( IsWindow( hWnd ) )
1132 {
1133 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1134 SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
1135
1136 lphc->wState &= ~CBF_FOCUSED;
1137
1138 /* redraw text */
1139 if( !(lphc->wState & CBF_EDIT) )
1140 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1141
1142 CB_NOTIFY( lphc, CBN_KILLFOCUS );
1143 }
1144 }
1145}
#define LB_CARETOFF
Definition: undocuser.h:52
#define CBN_KILLFOCUS
Definition: winuser.h:1981

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

◆ COMBO_LButtonDown()

static void COMBO_LButtonDown ( LPHEADCOMBO  lphc,
LPARAM  lParam 
)
static

Definition at line 1529 of file combo.c.

1530{
1531 POINT pt;
1532 BOOL bButton;
1533 HWND hWnd = lphc->self;
1534
1535 pt.x = (short)LOWORD(lParam);
1536 pt.y = (short)HIWORD(lParam);
1537 bButton = PtInRect(&lphc->buttonRect, pt);
1538
1539 if( (CB_GETTYPE(lphc) == CBS_DROPDOWNLIST) ||
1540 (bButton && (CB_GETTYPE(lphc) == CBS_DROPDOWN)) )
1541 {
1542 lphc->wState |= CBF_BUTTONDOWN;
1543 if( lphc->wState & CBF_DROPPED )
1544 {
1545 /* got a click to cancel selection */
1546
1547 lphc->wState &= ~CBF_BUTTONDOWN;
1548 CBRollUp( lphc, TRUE, FALSE );
1549 if( !IsWindow( hWnd ) ) return;
1550
1551 if( lphc->wState & CBF_CAPTURE )
1552 {
1553 lphc->wState &= ~CBF_CAPTURE;
1555 }
1556 }
1557 else
1558 {
1559 /* drop down the listbox and start tracking */
1560
1561 lphc->wState |= CBF_CAPTURE;
1562 SetCapture( hWnd );
1563 CBDropDown( lphc );
1564 }
1565 if( bButton ) CBRepaintButton( lphc );
1566 }
1567}
static void CBRepaintButton(LPHEADCOMBO lphc)
Definition: combo.c:1093
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 1574 of file combo.c.

1575{
1576 if( lphc->wState & CBF_CAPTURE )
1577 {
1578 lphc->wState &= ~CBF_CAPTURE;
1579 if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1580 {
1581 INT index = CBUpdateLBox( lphc, TRUE );
1582 /* Update edit only if item is in the list */
1583 if(index >= 0)
1584 {
1585 lphc->wState |= CBF_NOLBSELECT;
1586 CBUpdateEdit( lphc, index );
1587 lphc->wState &= ~CBF_NOLBSELECT;
1588 }
1589 }
1591 SetCapture(lphc->hWndLBox);
1592 }
1593
1594 if( lphc->wState & CBF_BUTTONDOWN )
1595 {
1596 lphc->wState &= ~CBF_BUTTONDOWN;
1597 CBRepaintButton( lphc );
1598 }
1599}

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_MouseMove()

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

Definition at line 1607 of file combo.c.

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

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:5358
#define GWL_STYLE
Definition: winuser.h:855
#define GWL_EXSTYLE
Definition: winuser.h:854

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 805 of file combo.c.

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

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_PrepareColors()

static HBRUSH COMBO_PrepareColors ( LPHEADCOMBO  lphc,
HDC  hDC 
)
static

Definition at line 583 of file combo.c.

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

Referenced by CBPaintText(), and COMBO_Paint().

◆ COMBO_Register()

void COMBO_Register ( void  )

Definition at line 2116 of file combo.c.

2117{
2118 WNDCLASSW wndClass;
2119
2120 memset(&wndClass, 0, sizeof(wndClass));
2122 wndClass.lpfnWndProc = COMBO_WindowProc;
2123 wndClass.cbClsExtra = 0;
2124 wndClass.cbWndExtra = sizeof(HEADCOMBO *);
2125 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
2126 wndClass.hbrBackground = NULL;
2127 wndClass.lpszClassName = WC_COMBOBOXW;
2128 RegisterClassW(&wndClass);
2129}
static LRESULT CALLBACK COMBO_WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: combo.c:1659
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
#define CS_VREDRAW
Definition: winuser.h:658
#define CS_HREDRAW
Definition: winuser.h:653
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define CS_PARENTDC
Definition: winuser.h:656

Referenced by DllMain().

◆ COMBO_SelectString()

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

Definition at line 1511 of file combo.c.

1512{
1514 if( index >= 0 )
1515 {
1516 if( lphc->wState & CBF_EDIT )
1517 CBUpdateEdit( lphc, index );
1518 else
1519 {
1520 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1521 }
1522 }
1523 return (LRESULT)index;
1524}
#define index(s, c)
Definition: various.h:29
GLuint start
Definition: gl.h:1545
LONG_PTR LRESULT
Definition: windef.h:209
#define LB_SELECTSTRING
Definition: winuser.h:2059

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_SetFocus()

static void COMBO_SetFocus ( LPHEADCOMBO  lphc)
static

Definition at line 1102 of file combo.c.

1103{
1104 if( !(lphc->wState & CBF_FOCUSED) )
1105 {
1106 if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1107 SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1108
1109 /* This is wrong. Message sequences seem to indicate that this
1110 is set *after* the notify. */
1111 /* lphc->wState |= CBF_FOCUSED; */
1112
1113 if( !(lphc->wState & CBF_EDIT) )
1114 InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1115
1116 CB_NOTIFY( lphc, CBN_SETFOCUS );
1117 lphc->wState |= CBF_FOCUSED;
1118 }
1119}
#define CBN_SETFOCUS
Definition: winuser.h:1985

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 1476 of file combo.c.

1477{
1478 LRESULT lRet = CB_ERR;
1479
1480 if( index == -1 ) /* set text field height */
1481 {
1482 if( height < 32768 )
1483 {
1484 lphc->item_height = height + 2; /* Is the 2 for 2*EDIT_CONTROL_PADDING? */
1485
1486 /*
1487 * Redo the layout of the control.
1488 */
1489 if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1490 {
1491 CBCalcPlacement(lphc);
1492
1493 CBResetPos(lphc);
1494 }
1495 else
1496 {
1497 CBForceDummyResize(lphc);
1498 }
1499
1500 lRet = height;
1501 }
1502 }
1503 else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */
1505 return lRet;
1506}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define CB_ERR
Definition: winuser.h:2438
#define LB_SETITEMHEIGHT
Definition: winuser.h:2069

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_Size()

static void COMBO_Size ( HEADCOMBO lphc)
static

Definition at line 1390 of file combo.c.

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

Referenced by COMBO_WindowProc(), and ComboWndProc_common().

◆ COMBO_ThemedPaint()

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

Definition at line 765 of file combo.c.

766{
767 int button_state;
768 RECT frame;
769
770 /* paint border */
771 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
772 GetClientRect(lphc->self, &frame);
773 else
774 {
775 frame = lphc->textRect;
778 }
779
781
782 /* Paint button */
783 if (!IsRectEmpty(&lphc->buttonRect))
784 {
785 if (!IsWindowEnabled(lphc->self))
786 button_state = CBXS_DISABLED;
787 else if (lphc->wState & CBF_BUTTONDOWN)
788 button_state = CBXS_PRESSED;
789 else if (lphc->wState & CBF_HOT)
790 button_state = CBXS_HOT;
791 else
792 button_state = CBXS_NORMAL;
793 DrawThemeBackground(theme, hdc, CP_DROPDOWNBUTTON, button_state, &lphc->buttonRect, NULL);
794 }
795
797 CBPaintText(lphc, hdc);
798
799 return 0;
800}
@ 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 1659 of file combo.c.

1660{
1661 HEADCOMBO *lphc = (HEADCOMBO *)GetWindowLongPtrW( hwnd, 0 );
1662 HTHEME theme;
1663
1664 TRACE("[%p]: msg %#x wp %08lx lp %08lx\n", hwnd, message, wParam, lParam );
1665
1666 if (!IsWindow(hwnd)) return 0;
1667
1668 if (lphc || message == WM_NCCREATE)
1669 switch(message)
1670 {
1671 case WM_NCCREATE:
1672 {
1673 LONG style = ((CREATESTRUCTW *)lParam)->style;
1674 return COMBO_NCCreate(hwnd, style);
1675 }
1676
1677 case WM_NCDESTROY:
1678 COMBO_NCDestroy(lphc);
1679 break;/* -> DefWindowProc */
1680
1681 case WM_CREATE:
1682 {
1684 LONG style;
1685
1686 hwndParent = ((CREATESTRUCTW *)lParam)->hwndParent;
1687 style = ((CREATESTRUCTW *)lParam)->style;
1688 return COMBO_Create(hwnd, lphc, hwndParent, style);
1689 }
1690
1691 case WM_DESTROY:
1692 theme = GetWindowTheme( hwnd );
1693 CloseThemeData( theme );
1694 break;
1695
1696 case WM_THEMECHANGED:
1697 theme = GetWindowTheme( hwnd );
1698 CloseThemeData( theme );
1700 break;
1701
1702 case WM_PRINTCLIENT:
1703 case WM_PAINT:
1704 {
1705 LRESULT ret = 0;
1706 PAINTSTRUCT ps;
1707 HDC hdc;
1708
1709 hdc = wParam ? (HDC)wParam : BeginPaint(hwnd, &ps);
1710
1711 if (hdc && !(lphc->wState & CBF_NOREDRAW))
1712 {
1713 HTHEME theme = GetWindowTheme(hwnd);
1714
1715 if (theme)
1716 ret = COMBO_ThemedPaint(theme, lphc, hdc);
1717 else
1718 ret = COMBO_Paint(lphc, hdc);
1719 }
1720
1721 if (!wParam)
1722 EndPaint(hwnd, &ps);
1723
1724 return ret;
1725 }
1726 case WM_ERASEBKGND:
1727 /* do all painting in WM_PAINT like Windows does */
1728 return 1;
1729
1730 case WM_GETDLGCODE:
1731 {
1733 if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
1734 {
1735 int vk = (int)((LPMSG)lParam)->wParam;
1736
1737 if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
1739 }
1740 return result;
1741 }
1742
1743 case WM_SIZE:
1744 COMBO_Size( lphc );
1745 return TRUE;
1746
1747 case WM_SETFONT:
1748 COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
1749 return TRUE;
1750
1751 case WM_GETFONT:
1752 return (LRESULT)lphc->hFont;
1753
1754 case WM_SETFOCUS:
1755 if (lphc->wState & CBF_EDIT)
1756 {
1757 SetFocus( lphc->hWndEdit );
1758 /* The first time focus is received, select all the text */
1759 if (!(lphc->wState & CBF_BEENFOCUSED))
1760 {
1761 SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
1762 lphc->wState |= CBF_BEENFOCUSED;
1763 }
1764 }
1765 else
1766 COMBO_SetFocus( lphc );
1767 return TRUE;
1768
1769 case WM_KILLFOCUS:
1770 {
1771 HWND hwndFocus = (HWND)wParam;
1772 if (!hwndFocus || (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox))
1773 COMBO_KillFocus( lphc );
1774 return TRUE;
1775 }
1776
1777 case WM_COMMAND:
1778 return COMBO_Command( lphc, wParam, (HWND)lParam );
1779
1780 case WM_GETTEXT:
1781 return COMBO_GetText( lphc, wParam, (LPWSTR)lParam );
1782
1783 case WM_SETTEXT:
1784 case WM_GETTEXTLENGTH:
1785 case WM_CLEAR:
1786 if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
1787 {
1788 int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1789 if (j == -1) return 0;
1790 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
1791 }
1792 else if ( lphc->wState & CBF_EDIT )
1793 {
1794 LRESULT ret;
1795 lphc->wState |= CBF_NOEDITNOTIFY;
1797 lphc->wState &= ~CBF_NOEDITNOTIFY;
1798 return ret;
1799 }
1800 else
1801 return CB_ERR;
1802
1803 case WM_CUT:
1804 case WM_PASTE:
1805 case WM_COPY:
1806 if (lphc->wState & CBF_EDIT)
1807 return SendMessageW(lphc->hWndEdit, message, wParam, lParam);
1808 else return CB_ERR;
1809
1810 case WM_DRAWITEM:
1811 case WM_DELETEITEM:
1812 case WM_COMPAREITEM:
1813 case WM_MEASUREITEM:
1814 return COMBO_ItemOp(lphc, message, lParam);
1815
1816 case WM_ENABLE:
1817 if (lphc->wState & CBF_EDIT)
1818 EnableWindow( lphc->hWndEdit, (BOOL)wParam );
1819 EnableWindow( lphc->hWndLBox, (BOOL)wParam );
1820
1821 /* Force the control to repaint when the enabled state changes. */
1822 InvalidateRect(lphc->self, NULL, TRUE);
1823 return TRUE;
1824
1825 case WM_SETREDRAW:
1826 if (wParam)
1827 lphc->wState &= ~CBF_NOREDRAW;
1828 else
1829 lphc->wState |= CBF_NOREDRAW;
1830
1831 if ( lphc->wState & CBF_EDIT )
1834 return 0;
1835
1836 case WM_SYSKEYDOWN:
1837 if ( KEYDATA_ALT & HIWORD(lParam) )
1838 if( wParam == VK_UP || wParam == VK_DOWN )
1839#ifdef __REACTOS__
1840 {
1841#endif
1842 COMBO_FlipListbox( lphc, FALSE, FALSE );
1843 return 0;
1844#ifdef __REACTOS__
1845 }
1846 break;
1847#endif
1848
1849 case WM_KEYDOWN:
1850 if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
1851 (lphc->wState & CBF_DROPPED))
1852 {
1853 CBRollUp( lphc, wParam == VK_RETURN, FALSE );
1854 return TRUE;
1855 }
1856 else if ((wParam == VK_F4) && !(lphc->wState & CBF_EUI))
1857 {
1858 COMBO_FlipListbox( lphc, FALSE, FALSE );
1859 return TRUE;
1860 }
1861 /* fall through */
1862 case WM_CHAR:
1863 case WM_IME_CHAR:
1864 {
1865 HWND hwndTarget;
1866
1867#ifdef __REACTOS__
1868 if (lphc->wState & CBF_DROPPED)
1869 lphc->wState |= CBF_NOROLLUP;
1870#endif
1871 if ( lphc->wState & CBF_EDIT )
1872 hwndTarget = lphc->hWndEdit;
1873 else
1874 hwndTarget = lphc->hWndLBox;
1875
1876 return SendMessageW(hwndTarget, message, wParam, lParam);
1877 }
1878
1879 case WM_LBUTTONDOWN:
1880 if ( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
1881 if ( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
1882 return TRUE;
1883
1884 case WM_LBUTTONUP:
1885 COMBO_LButtonUp( lphc );
1886 return TRUE;
1887
1888 case WM_MOUSEMOVE:
1889 if (!IsRectEmpty(&lphc->buttonRect))
1890 {
1891 POINT pt;
1892
1893 pt.x = (short)LOWORD(lParam);
1894 pt.y = (short)HIWORD(lParam);
1895
1896 if (PtInRect(&lphc->buttonRect, pt))
1897 {
1898 if (!(lphc->wState & CBF_HOT))
1899 {
1900 lphc->wState |= CBF_HOT;
1902 }
1903 }
1904 else if (lphc->wState & CBF_HOT)
1905 {
1906 lphc->wState &= ~CBF_HOT;
1908 }
1909 }
1910
1911 if ( lphc->wState & CBF_CAPTURE )
1912 COMBO_MouseMove( lphc, wParam, lParam );
1913 return TRUE;
1914
1915 case WM_MOUSEWHEEL:
1916 if (wParam & (MK_SHIFT | MK_CONTROL))
1918
1919 if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
1920 if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
1921 return TRUE;
1922
1923 case WM_CTLCOLOR:
1924 case WM_CTLCOLORMSGBOX:
1925 case WM_CTLCOLOREDIT:
1926 case WM_CTLCOLORLISTBOX:
1927 case WM_CTLCOLORBTN:
1928 case WM_CTLCOLORDLG:
1930 case WM_CTLCOLORSTATIC:
1931 return SendMessageW(lphc->owner, message, wParam, lParam);
1932
1933 /* Combo messages */
1934 case CB_ADDSTRING:
1935 if (lphc->dwStyle & CBS_LOWERCASE)
1937 else if (lphc->dwStyle & CBS_UPPERCASE)
1939 return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
1940
1941 case CB_INSERTSTRING:
1942 if (lphc->dwStyle & CBS_LOWERCASE)
1944 else if (lphc->dwStyle & CBS_UPPERCASE)
1947
1948 case CB_DELETESTRING:
1949 return SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
1950
1951 case CB_SELECTSTRING:
1952 return COMBO_SelectString(lphc, (INT)wParam, lParam);
1953
1954 case CB_FINDSTRING:
1956
1957 case CB_FINDSTRINGEXACT:
1959
1960 case CB_SETITEMHEIGHT:
1961 return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
1962
1963 case CB_GETITEMHEIGHT:
1964 if ((INT)wParam >= 0) /* listbox item */
1965 return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
1966 return CBGetTextAreaHeight(lphc, FALSE);
1967
1968 case CB_RESETCONTENT:
1970
1971 if ((lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc))
1972 {
1973 static const WCHAR empty_stringW[] = { 0 };
1975 }
1976 else
1977 InvalidateRect(lphc->self, NULL, TRUE);
1978 return TRUE;
1979
1980 case CB_INITSTORAGE:
1982
1984 return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
1985
1988
1989 case CB_GETTOPINDEX:
1990 return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
1991
1992 case CB_GETLOCALE:
1993 return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
1994
1995 case CB_SETLOCALE:
1996 return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
1997
1998 case CB_SETDROPPEDWIDTH:
1999 if ((CB_GETTYPE(lphc) == CBS_SIMPLE) || (INT)wParam >= 32768)
2000 return CB_ERR;
2001
2002 /* new value must be higher than combobox width */
2003 if ((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
2004 lphc->droppedWidth = wParam;
2005 else if (wParam)
2006 lphc->droppedWidth = 0;
2007
2008 /* recalculate the combobox area */
2009 CBCalcPlacement(lphc);
2010
2011 /* fall through */
2012 case CB_GETDROPPEDWIDTH:
2013 if (lphc->droppedWidth)
2014 return lphc->droppedWidth;
2015 return lphc->droppedRect.right - lphc->droppedRect.left;
2016
2018 if (lParam)
2020 return CB_OKAY;
2021
2022 case CB_GETDROPPEDSTATE:
2023 return (lphc->wState & CBF_DROPPED) != 0;
2024
2025 case CB_DIR:
2026 return SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam);
2027
2028 case CB_SHOWDROPDOWN:
2029 if (CB_GETTYPE(lphc) != CBS_SIMPLE)
2030 {
2031 if (wParam)
2032 {
2033 if (!(lphc->wState & CBF_DROPPED))
2034 CBDropDown( lphc );
2035 }
2036 else if (lphc->wState & CBF_DROPPED)
2037 CBRollUp( lphc, FALSE, TRUE );
2038 }
2039 return TRUE;
2040
2041 case CB_GETCOUNT:
2042 return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
2043
2044 case CB_GETCURSEL:
2045 return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
2046
2047 case CB_SETCURSEL:
2049 if (lParam >= 0)
2051
2052 /* no LBN_SELCHANGE in this case, update manually */
2053 CBPaintText(lphc, NULL);
2054 lphc->wState &= ~CBF_SELCHANGE;
2055 return lParam;
2056
2057 case CB_GETLBTEXT:
2058 return SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
2059
2060 case CB_GETLBTEXTLEN:
2061 return SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
2062
2063 case CB_GETITEMDATA:
2064 return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
2065
2066 case CB_SETITEMDATA:
2068
2069 case CB_GETEDITSEL:
2070 /* Edit checks passed parameters itself */
2071 if (lphc->wState & CBF_EDIT)
2072 return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
2073 return CB_ERR;
2074
2075 case CB_SETEDITSEL:
2076 if (lphc->wState & CBF_EDIT)
2078 return CB_ERR;
2079
2080 case CB_SETEXTENDEDUI:
2081 if (CB_GETTYPE(lphc) == CBS_SIMPLE )
2082 return CB_ERR;
2083 if (wParam)
2084 lphc->wState |= CBF_EUI;
2085 else
2086 lphc->wState &= ~CBF_EUI;
2087 return CB_OKAY;
2088
2089 case CB_GETEXTENDEDUI:
2090 return (lphc->wState & CBF_EUI) != 0;
2091
2092 case CB_GETCOMBOBOXINFO:
2093 return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
2094
2095 case CB_LIMITTEXT:
2096 if (lphc->wState & CBF_EDIT)
2098 return TRUE;
2099
2100 case CB_GETMINVISIBLE:
2101 return lphc->visibleItems;
2102
2103 case CB_SETMINVISIBLE:
2104 lphc->visibleItems = (INT)wParam;
2105 return TRUE;
2106
2107 default:
2108 if (message >= WM_USER)
2109 WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n", message - WM_USER, wParam, lParam );
2110 break;
2111 }
2112
2114}
#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:805
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:1390
static void COMBO_LButtonDown(LPHEADCOMBO lphc, LPARAM lParam)
Definition: combo.c:1529
static void COMBO_MouseMove(LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam)
Definition: combo.c:1607
static LRESULT COMBO_GetComboBoxInfo(const HEADCOMBO *lphc, COMBOBOXINFO *pcbi)
Definition: combo.c:1641
static LRESULT COMBO_Command(LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd)
Definition: combo.c:1150
static void COMBO_LButtonUp(LPHEADCOMBO lphc)
Definition: combo.c:1574
static LRESULT COMBO_ThemedPaint(HTHEME theme, HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:765
#define KEYDATA_ALT
Definition: combo.c:43
static LRESULT COMBO_ItemOp(LPHEADCOMBO lphc, UINT msg, LPARAM lParam)
Definition: combo.c:1259
static LRESULT COMBO_SelectString(LPHEADCOMBO lphc, INT start, LPARAM pText)
Definition: combo.c:1511
BOOL COMBO_FlipListbox(LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton)
Definition: combo.c:1078
static LRESULT COMBO_SetItemHeight(LPHEADCOMBO lphc, INT index, INT height)
Definition: combo.c:1476
static LRESULT COMBO_GetText(HEADCOMBO *lphc, INT count, LPWSTR buf)
Definition: combo.c:1307
static void COMBO_Font(LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw)
Definition: combo.c:1445
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
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
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
WORD vk
Definition: input.c:77
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
int ret
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define WM_PAINT
Definition: winuser.h:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define CB_SELECTSTRING
Definition: winuser.h:1963
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define CB_GETHORIZONTALEXTENT
Definition: winuser.h:1952
#define MK_SHIFT
Definition: winuser.h:2372
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1965
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2038
#define CB_GETLBTEXTLEN
Definition: winuser.h:1956
#define EM_LIMITTEXT
Definition: winuser.h:2003
#define CB_GETLBTEXT
Definition: winuser.h:1955
#define WM_ENABLE
Definition: winuser.h:1618
#define WM_PASTE
Definition: winuser.h:1866
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2067
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_OKAY
Definition: winuser.h:2437
#define WM_CREATE
Definition: winuser.h:1611
#define DLGC_WANTCHARS
Definition: winuser.h:2621
#define CB_SHOWDROPDOWN
Definition: winuser.h:1973
#define CB_GETITEMHEIGHT
Definition: winuser.h:1954
#define EM_GETSEL
Definition: winuser.h:2000
#define CB_SETHORIZONTALEXTENT
Definition: winuser.h:1968
#define LB_DIR
Definition: winuser.h:2036
#define WM_SIZE
Definition: winuser.h:1614
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
#define CB_INITSTORAGE
Definition: winuser.h:1959
#define CB_SETCURSEL
Definition: winuser.h:1964
#define LB_GETTOPINDEX
Definition: winuser.h:2054
#define VK_UP
Definition: winuser.h:2228
#define WM_SETFOCUS
Definition: winuser.h:1616
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define LB_GETLOCALE
Definition: winuser.h:2048
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1774
#define WM_CUT
Definition: winuser.h:1864
#define LB_SETLOCALE
Definition: winuser.h:2070
#define CB_RESETCONTENT
Definition: winuser.h:1962
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1943
#define LB_ADDSTRING
Definition: winuser.h:2034
#define CB_DIR
Definition: winuser.h:1941
#define CB_GETCOUNT
Definition: winuser.h:1945
#define WM_GETFONT
Definition: winuser.h:1654
#define CB_GETDROPPEDWIDTH
Definition: winuser.h:1949
#define CB_GETCOMBOBOXINFO
Definition: winuser.h:1944
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1769
#define CB_SETLOCALE
Definition: winuser.h:1971
#define WM_NCCREATE
Definition: winuser.h:1686
#define WM_CTLCOLORBTN
Definition: winuser.h:1772
#define WM_IME_CHAR
Definition: winuser.h:1837
#define LB_RESETCONTENT
Definition: winuser.h:2058
#define LB_DELETESTRING
Definition: winuser.h:2035
#define VK_RETURN
Definition: winuser.h:2204
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1947
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MK_CONTROL
Definition: winuser.h:2373
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define LB_GETHORIZONTALEXTENT
Definition: winuser.h:2043
#define DLGC_WANTARROWS
Definition: winuser.h:2613
#define LB_INSERTSTRING
Definition: winuser.h:2056
#define CB_ADDSTRING
Definition: winuser.h:1939
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define CB_SETEDITSEL
Definition: winuser.h:1966
#define VK_F4
Definition: winuser.h:2261
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1948
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define WM_CHAR
Definition: winuser.h:1720
#define LB_SETITEMDATA
Definition: winuser.h:2068
#define WM_NCDESTROY
Definition: winuser.h:1687
#define CB_GETEXTENDEDUI
Definition: winuser.h:1951
#define VK_DOWN
Definition: winuser.h:2230
#define WM_COPY
Definition: winuser.h:1865
#define CB_GETTOPINDEX
Definition: winuser.h:1958
#define CB_LIMITTEXT
Definition: winuser.h:1961
#define WM_USER
Definition: winuser.h:1898
#define CB_GETEDITSEL
Definition: winuser.h:1950
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1771
#define DLGC_WANTMESSAGE
Definition: winuser.h:2616
#define WM_DESTROY
Definition: winuser.h:1612
#define CB_FINDSTRING
Definition: winuser.h:1942
#define WM_CLEAR
Definition: winuser.h:1867
#define WM_KEYDOWN
Definition: winuser.h:1718
#define CB_SETEXTENDEDUI
Definition: winuser.h:1967
#define CB_INSERTSTRING
Definition: winuser.h:1960
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define CB_GETCURSEL
Definition: winuser.h:1946
#define CB_DELETESTRING
Definition: winuser.h:1940
#define CB_GETLOCALE
Definition: winuser.h:1957
#define CB_SETITEMHEIGHT
Definition: winuser.h:1970
#define LB_INITSTORAGE
Definition: winuser.h:2055
#define VK_ESCAPE
Definition: winuser.h:2217
#define WM_CTLCOLORDLG
Definition: winuser.h:1773
#define WM_KILLFOCUS
Definition: winuser.h:1617
#define WM_SYSKEYDOWN
Definition: winuser.h:1722
#define WM_GETDLGCODE
Definition: winuser.h:1692
#define WM_SETREDRAW
Definition: winuser.h:1619
LPWSTR WINAPI CharUpperW(_Inout_ LPWSTR)

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().