ReactOS  0.4.14-dev-57-g333b8f1
combo.c File Reference
#include <user32.h>
Include dependency graph for combo.c:

Go to the source code of this file.

Macros

#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
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (combo)
 
static BOOL COMBO_Init (void)
 
static LRESULT COMBO_NCCreate (HWND hwnd, LONG style)
 
static LRESULT COMBO_NCDestroy (LPHEADCOMBO lphc)
 
static INT CBGetTextAreaHeight (HWND hwnd, LPHEADCOMBO lphc)
 
static void CBForceDummyResize (LPHEADCOMBO lphc)
 
static void CBCalcPlacement (HWND hwnd, LPHEADCOMBO lphc, LPRECT lprEdit, LPRECT lprButton, LPRECT lprLB)
 
static void CBGetDroppedControlRect (LPHEADCOMBO lphc, LPRECT lpRect)
 
static LRESULT COMBO_Create (HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style, BOOL unicode)
 
static void CBPaintButton (LPHEADCOMBO lphc, HDC hdc, RECT rectButton)
 
static HBRUSH COMBO_PrepareColors (LPHEADCOMBO lphc, HDC hDC)
 
static void CBPaintText (LPHEADCOMBO lphc, HDC hdc_paint)
 
static void CBPaintBorder (HWND hwnd, const HEADCOMBO *lphc, HDC hdc)
 
static LRESULT COMBO_Paint (LPHEADCOMBO lphc, HDC hParamDC)
 
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_GetTextW (LPHEADCOMBO lphc, INT count, LPWSTR buf)
 
static LRESULT COMBO_GetTextA (LPHEADCOMBO lphc, INT count, LPSTR buf)
 
static void CBResetPos (LPHEADCOMBO lphc, const RECT *rectEdit, const RECT *rectLB, BOOL bRedraw)
 
static void COMBO_Size (LPHEADCOMBO 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, BOOL unicode)
 
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 charstrdupA (LPCSTR str)
 
LRESULT WINAPI ComboWndProc_common (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
 
BOOL WINAPI GetComboBoxInfo (HWND hwndCombo, PCOMBOBOXINFO pcbi)
 

Variables

static HBITMAP hComboBmp = 0
 
static UINT CBitHeight
 
static UINT CBitWidth
 
static const WCHAR comboboxW [] = {'C','o','m','b','o','B','o','x',0}
 
const struct builtin_class_descr COMBO_builtin_class
 

Macro Definition Documentation

◆ CB_DISABLED

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

Definition at line 36 of file combo.c.

◆ CB_GETTYPE

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

Definition at line 42 of file combo.c.

◆ CB_HASSTRINGS

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

Definition at line 38 of file combo.c.

◆ CB_HWND

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

Definition at line 39 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))
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GWLP_ID
Definition: winuser.h:854

Definition at line 32 of file combo.c.

◆ CB_OWNERDRAWN

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

Definition at line 37 of file combo.c.

◆ COMBO_EDITBUTTONSPACE

#define COMBO_EDITBUTTONSPACE ( )    0

Definition at line 60 of file combo.c.

◆ COMBO_XBORDERSIZE

#define COMBO_XBORDERSIZE ( )    2

Definition at line 58 of file combo.c.

◆ COMBO_YBORDERGAP

#define COMBO_YBORDERGAP   5

Definition at line 57 of file combo.c.

◆ COMBO_YBORDERSIZE

#define COMBO_YBORDERSIZE ( )    2

Definition at line 59 of file combo.c.

◆ EDIT_CONTROL_PADDING

#define EDIT_CONTROL_PADDING ( )    1

Definition at line 61 of file combo.c.

◆ ISWIN31

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

Definition at line 45 of file combo.c.

Function Documentation

◆ CBCalcPlacement()

static void CBCalcPlacement ( HWND  hwnd,
LPHEADCOMBO  lphc,
LPRECT  lprEdit,
LPRECT  lprButton,
LPRECT  lprLB 
)
static

Definition at line 328 of file combo.c.

334 {
335  /*
336  * Again, start with the client rectangle.
337  */
338  GetClientRect(hwnd, lprEdit);
339 
340  /*
341  * Remove the borders
342  */
344 
345  /*
346  * Chop off the bottom part to fit with the height of the text area.
347  */
348  lprEdit->bottom = lprEdit->top + CBGetTextAreaHeight(hwnd, lphc);
349 
350  /*
351  * The button starts the same vertical position as the text area.
352  */
353  CopyRect(lprButton, lprEdit);
354 
355  /*
356  * If the combobox is "simple" there is no button.
357  */
358  if( CB_GETTYPE(lphc) == CBS_SIMPLE )
359  lprButton->left = lprButton->right = lprButton->bottom = 0;
360  else
361  {
362  /*
363  * Let's assume the combobox button is the same width as the
364  * scrollbar button.
365  * size the button horizontally and cut-off the text area.
366  */
367  lprButton->left = lprButton->right - GetSystemMetrics(SM_CXVSCROLL);
368  lprEdit->right = lprButton->left;
369  }
370 
371  /*
372  * In the case of a dropdown, there is an additional spacing between the
373  * text area and the button.
374  */
375  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
376  {
377  lprEdit->right -= COMBO_EDITBUTTONSPACE();
378  }
379 
380  /*
381  * If we have an edit control, we space it away from the borders slightly.
382  */
383  if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
384  {
386  }
387 
388  /*
389  * Adjust the size of the listbox popup.
390  */
391  if( CB_GETTYPE(lphc) == CBS_SIMPLE )
392  {
393  /*
394  * Use the client rectangle to initialize the listbox rectangle
395  */
396  GetClientRect(hwnd, lprLB);
397 
398  /*
399  * Then, chop-off the top part.
400  */
401  lprLB->top = lprEdit->bottom + COMBO_YBORDERSIZE();
402  }
403  else
404  {
405  /*
406  * Make sure the dropped width is as large as the combobox itself.
407  */
408  if (lphc->droppedWidth < (lprButton->right + COMBO_XBORDERSIZE()))
409  {
410  lprLB->right = lprLB->left + (lprButton->right + COMBO_XBORDERSIZE());
411 
412  /*
413  * In the case of a dropdown, the popup listbox is offset to the right.
414  * so, we want to make sure it's flush with the right side of the
415  * combobox
416  */
417  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
418  lprLB->right -= COMBO_EDITBUTTONSPACE();
419  }
420  else
421  lprLB->right = lprLB->left + lphc->droppedWidth;
422  }
423 
424  /* don't allow negative window width */
425  if (lprEdit->right < lprEdit->left)
426  lprEdit->right = lprEdit->left;
427 
428  TRACE("\ttext\t= (%s)\n", wine_dbgstr_rect(lprEdit));
429 
430  TRACE("\tbutton\t= (%s)\n", wine_dbgstr_rect(lprButton));
431 
432  TRACE("\tlbox\t= (%s)\n", wine_dbgstr_rect(lprLB));
433 }
#define EDIT_CONTROL_PADDING()
Definition: combo.c:61
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static INT CBGetTextAreaHeight(HWND hwnd, LPHEADCOMBO lphc)
Definition: combo.c:202
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
LONG top
Definition: windef.h:292
#define CB_GETTYPE(lphc)
Definition: combo.c:42
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define CBS_SIMPLE
Definition: winuser.h:291
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
#define TRACE(s)
Definition: solgame.cpp:4
const char * wine_dbgstr_rect(const RECT *rect)
int WINAPI GetSystemMetrics(_In_ int)
INT droppedWidth
Definition: comctl32.h:148
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define CBS_DROPDOWN
Definition: winuser.h:283
#define COMBO_XBORDERSIZE()
Definition: combo.c:58
#define SM_CXVSCROLL
Definition: winuser.h:951
#define COMBO_YBORDERSIZE()
Definition: combo.c:59
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
LONG bottom
Definition: windef.h:294
#define COMBO_EDITBUTTONSPACE()
Definition: combo.c:60

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

◆ CBDropDown()

static void CBDropDown ( LPHEADCOMBO  lphc)
static

Definition at line 990 of file combo.c.

991 {
992  HMONITOR monitor;
993  MONITORINFO mon_info;
994  RECT rect,r;
995  int nItems = 0;
996  int nDroppedHeight;
997 
998  TRACE("[%p]: drop down\n", lphc->self);
999 
1000  CB_NOTIFY( lphc, CBN_DROPDOWN );
1001 
1002  /* set selection */
1003 
1004  lphc->wState |= CBF_DROPPED;
1005  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1006  {
1007  lphc->droppedIndex = CBUpdateLBox( lphc, TRUE );
1008 
1009  /* Update edit only if item is in the list */
1010  if( !(lphc->wState & CBF_CAPTURE) && lphc->droppedIndex >= 0)
1011  CBUpdateEdit( lphc, lphc->droppedIndex );
1012  }
1013  else
1014  {
1015  lphc->droppedIndex = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1016 
1018  (WPARAM)(lphc->droppedIndex == LB_ERR ? 0 : lphc->droppedIndex), 0 );
1019  SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1020  }
1021 
1022  /* now set popup position */
1023  GetWindowRect( lphc->self, &rect );
1024 
1025  /*
1026  * If it's a dropdown, the listbox is offset
1027  */
1028  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1029  rect.left += COMBO_EDITBUTTONSPACE();
1030 
1031  /* if the dropped height is greater than the total height of the dropped
1032  items list, then force the drop down list height to be the total height
1033  of the items in the dropped list */
1034 
1035  /* And Remove any extra space (Best Fit) */
1036  nDroppedHeight = lphc->droppedRect.bottom - lphc->droppedRect.top;
1037  /* if listbox length has been set directly by its handle */
1038  GetWindowRect(lphc->hWndLBox, &r);
1039  if (nDroppedHeight < r.bottom - r.top)
1040  nDroppedHeight = r.bottom - r.top;
1041  nItems = (int)SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
1042 
1043  if (nItems > 0)
1044  {
1045  int nHeight;
1046  int nIHeight;
1047 
1048  nIHeight = (int)SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, 0, 0);
1049 
1050  nHeight = nIHeight*nItems;
1051 
1052  if (nHeight < nDroppedHeight - COMBO_YBORDERSIZE())
1053  nDroppedHeight = nHeight + COMBO_YBORDERSIZE();
1054  }
1055 
1056  r.left = rect.left;
1057  r.top = rect.bottom;
1058  r.right = r.left + lphc->droppedRect.right - lphc->droppedRect.left;
1059  r.bottom = r.top + nDroppedHeight;
1060 
1061  /*If height of dropped rectangle gets beyond a screen size it should go up, otherwise down.*/
1062  monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
1063  mon_info.cbSize = sizeof(mon_info);
1064  GetMonitorInfoW( monitor, &mon_info );
1065 
1066  if (r.bottom > mon_info.rcWork.bottom)
1067  {
1068  r.top = max( rect.top - nDroppedHeight, mon_info.rcWork.top );
1069  r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom );
1070  }
1071 
1072  SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top,
1074 
1075 
1076  if( !(lphc->wState & CBF_NOREDRAW) )
1077  RedrawWindow( lphc->self, NULL, 0, RDW_INVALIDATE |
1079 
1080  EnableWindow( lphc->hWndLBox, TRUE );
1081  if (GetCapture() != lphc->self)
1082  SetCapture(lphc->hWndLBox);
1083 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define max(a, b)
Definition: svc.c:63
#define LB_CARETON
Definition: undocuser.h:50
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT wState
Definition: comctl32.h:141
LONG top
Definition: windef.h:292
RECT droppedRect
Definition: comctl32.h:145
#define HWND_TOPMOST
Definition: winuser.h:1194
#define CB_GETTYPE(lphc)
Definition: combo.c:42
INT droppedIndex
Definition: comctl32.h:146
UINT_PTR WPARAM
Definition: windef.h:207
LONG left
Definition: windef.h:291
#define CB_NOTIFY(lphc, code)
Definition: combo.c:32
LONG right
Definition: windef.h:293
& rect
Definition: startmenu.cpp:1413
#define LB_ERR
Definition: winuser.h:2407
HWND WINAPI GetCapture(void)
Definition: message.c:2879
int nItems
Definition: appswitch.c:56
smooth NULL
Definition: ftsmooth.c:416
#define LB_GETCOUNT
Definition: winuser.h:2020
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
#define LB_SETTOPINDEX
Definition: winuser.h:2052
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define RDW_ERASE
Definition: winuser.h:1197
#define LB_GETITEMHEIGHT
Definition: winuser.h:2024
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define CBN_DROPDOWN
Definition: winuser.h:1956
HWND WINAPI SetCapture(_In_ HWND hWnd)
HWND self
Definition: comctl32.h:136
DWORD cbSize
Definition: winuser.h:3758
#define CBS_DROPDOWN
Definition: winuser.h:283
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define min(a, b)
Definition: monoChain.cc:55
#define LB_GETCURSEL
Definition: winuser.h:2021
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define COMBO_YBORDERSIZE()
Definition: combo.c:59
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:952
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
LONG bottom
Definition: windef.h:294
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)
static INT CBUpdateLBox(LPHEADCOMBO lphc, BOOL bSelect)
Definition: combo.c:918
#define COMBO_EDITBUTTONSPACE()
Definition: combo.c:60
#define RDW_INVALIDATE
Definition: winuser.h:1200
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

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

◆ CBForceDummyResize()

static void CBForceDummyResize ( LPHEADCOMBO  lphc)
static

Definition at line 297 of file combo.c.

299 {
300  RECT windowRect;
301  int newComboHeight;
302 
303  newComboHeight = CBGetTextAreaHeight(lphc->self,lphc) + 2*COMBO_YBORDERSIZE();
304 
305  GetWindowRect(lphc->self, &windowRect);
306 
307  /*
308  * We have to be careful, resizing a combobox also has the meaning that the
309  * dropped rect will be resized. In this case, we want to trigger a resize
310  * to recalculate layout but we don't want to change the dropped rectangle
311  * So, we pass the height of text area of control as the height.
312  * this will cancel-out in the processing of the WM_WINDOWPOSCHANGING
313  * message.
314  */
315  SetWindowPos( lphc->self,
316  NULL,
317  0, 0,
318  windowRect.right - windowRect.left,
319  newComboHeight,
321 }
static INT CBGetTextAreaHeight(HWND hwnd, LPHEADCOMBO lphc)
Definition: combo.c:202
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
smooth NULL
Definition: ftsmooth.c:416
#define SWP_NOACTIVATE
Definition: winuser.h:1227
HWND self
Definition: comctl32.h:136
#define COMBO_YBORDERSIZE()
Definition: combo.c:59
#define SWP_NOMOVE
Definition: winuser.h:1229
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)

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

◆ CBGetDroppedControlRect()

static void CBGetDroppedControlRect ( LPHEADCOMBO  lphc,
LPRECT  lpRect 
)
static

Definition at line 438 of file combo.c.

439 {
440  /* In windows, CB_GETDROPPEDCONTROLRECT returns the upper left corner
441  of the combo box and the lower right corner of the listbox */
442 
443  GetWindowRect(lphc->self, lpRect);
444 
445  lpRect->right = lpRect->left + lphc->droppedRect.right - lphc->droppedRect.left;
446  lpRect->bottom = lpRect->top + lphc->droppedRect.bottom - lphc->droppedRect.top;
447 
448 }
LONG top
Definition: windef.h:292
RECT droppedRect
Definition: comctl32.h:145
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
HWND self
Definition: comctl32.h:136
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)

Referenced by ComboWndProc_common().

◆ CBGetTextAreaHeight()

static INT CBGetTextAreaHeight ( HWND  hwnd,
LPHEADCOMBO  lphc 
)
static

Definition at line 202 of file combo.c.

205 {
206  INT iTextItemHeight;
207 
208  if( lphc->editHeight ) /* explicitly set height */
209  {
210  iTextItemHeight = lphc->editHeight;
211  }
212  else
213  {
214  TEXTMETRICW tm;
215  HDC hDC = GetDC(hwnd);
216  HFONT hPrevFont = 0;
217  INT baseUnitY;
218 
219  if (lphc->hFont)
220  hPrevFont = SelectObject( hDC, lphc->hFont );
221 
223 
224  baseUnitY = tm.tmHeight;
225 
226  if( hPrevFont )
227  SelectObject( hDC, hPrevFont );
228 
229  ReleaseDC(hwnd, hDC);
230 
231  iTextItemHeight = baseUnitY + 4;
232  }
233 
234  /*
235  * Check the ownerdraw case if we haven't asked the parent the size
236  * of the item yet.
237  */
238  if ( CB_OWNERDRAWN(lphc) &&
239  (lphc->wState & CBF_MEASUREITEM) )
240  {
241  MEASUREITEMSTRUCT measureItem;
242  RECT clientRect;
243  INT originalItemHeight = iTextItemHeight;
244  UINT id = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
245 
246  /*
247  * We use the client rect for the width of the item.
248  */
249  GetClientRect(hwnd, &clientRect);
250 
251  lphc->wState &= ~CBF_MEASUREITEM;
252 
253  /*
254  * Send a first one to measure the size of the text area
255  */
256  measureItem.CtlType = ODT_COMBOBOX;
257  measureItem.CtlID = id;
258  measureItem.itemID = -1;
259  measureItem.itemWidth = clientRect.right;
260  measureItem.itemHeight = iTextItemHeight - 6; /* ownerdrawn cb is taller */
261  measureItem.itemData = 0;
262  SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
263  iTextItemHeight = 6 + measureItem.itemHeight;
264 
265  /*
266  * Send a second one in the case of a fixed ownerdraw list to calculate the
267  * size of the list items. (we basically do this on behalf of the listbox)
268  */
269  if (lphc->dwStyle & CBS_OWNERDRAWFIXED)
270  {
271  measureItem.CtlType = ODT_COMBOBOX;
272  measureItem.CtlID = id;
273  measureItem.itemID = 0;
274  measureItem.itemWidth = clientRect.right;
275  measureItem.itemHeight = originalItemHeight;
276  measureItem.itemData = 0;
277  SendMessageW(lphc->owner, WM_MEASUREITEM, id, (LPARAM)&measureItem);
278  lphc->fixedOwnerDrawHeight = measureItem.itemHeight;
279  }
280 
281  /*
282  * Keep the size for the next time
283  */
284  lphc->editHeight = iTextItemHeight;
285  }
286 
287  return iTextItemHeight;
288 }
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
#define ODT_COMBOBOX
Definition: winuser.h:2514
HDC WINAPI GetDC(_In_opt_ HWND)
INT editHeight
Definition: comctl32.h:149
UINT wState
Definition: comctl32.h:141
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG right
Definition: windef.h:293
int32_t INT
Definition: typedefs.h:56
INT fixedOwnerDrawHeight
Definition: comctl32.h:147
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_MEASUREITEM
Definition: winuser.h:1628
HFONT hFont
Definition: comctl32.h:142
#define CB_OWNERDRAWN(lphc)
Definition: combo.c:37
ULONG_PTR itemData
Definition: winuser.h:3620
Definition: time.h:76
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
HWND owner
Definition: comctl32.h:137
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
GLenum GLuint id
Definition: glext.h:5579
#define GWLP_ID
Definition: winuser.h:854
UINT dwStyle
Definition: comctl32.h:138

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

◆ CBPaintBorder()

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

Definition at line 831 of file combo.c.

835 {
836  RECT clientRect;
837 
838  if (CB_GETTYPE(lphc) != CBS_SIMPLE)
839  {
840  GetClientRect(hwnd, &clientRect);
841  }
842  else
843  {
844  CopyRect(&clientRect, &lphc->textRect);
845 
848  }
849 
850  DrawEdge(hdc, &clientRect, EDGE_SUNKEN, BF_RECT);
851 }
#define EDIT_CONTROL_PADDING()
Definition: combo.c:61
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define CB_GETTYPE(lphc)
Definition: combo.c:42
#define BF_RECT
Definition: winuser.h:462
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define CBS_SIMPLE
Definition: winuser.h:291
RECT textRect
Definition: comctl32.h:143
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define COMBO_XBORDERSIZE()
Definition: combo.c:58
#define COMBO_YBORDERSIZE()
Definition: combo.c:59
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define EDGE_SUNKEN
Definition: winuser.h:451

Referenced by COMBO_Paint().

◆ CBPaintButton()

static void CBPaintButton ( LPHEADCOMBO  lphc,
HDC  hdc,
RECT  rectButton 
)
static

Definition at line 626 of file combo.c.

627 {
628  UINT buttonState = DFCS_SCROLLCOMBOBOX;
629 
630  if( lphc->wState & CBF_NOREDRAW )
631  return;
632 
633 
634  if (lphc->wState & CBF_BUTTONDOWN)
635  buttonState |= DFCS_PUSHED;
636 
637  if (CB_DISABLED(lphc))
638  buttonState |= DFCS_INACTIVE;
639 
640  DrawFrameControl(hdc, &rectButton, DFC_SCROLL, buttonState);
641 }
UINT wState
Definition: comctl32.h:141
#define DFCS_INACTIVE
Definition: winuser.h:502
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_PUSHED
Definition: winuser.h:503
#define CB_DISABLED(lphc)
Definition: combo.c:36
HDC hdc
Definition: main.c:9
#define DFCS_SCROLLCOMBOBOX
Definition: winuser.h:493
unsigned int UINT
Definition: ndis.h:50
#define DFC_SCROLL
Definition: winuser.h:475

Referenced by COMBO_Paint().

◆ CBPaintText()

static void CBPaintText ( LPHEADCOMBO  lphc,
HDC  hdc_paint 
)
static

Definition at line 700 of file combo.c.

703 {
704  RECT rectEdit = lphc->textRect;
705  INT id, size = 0;
706  LPWSTR pText = NULL;
707 
708  TRACE("\n");
709 
710  /* follow Windows combobox that sends a bunch of text
711  * inquiries to its listbox while processing WM_PAINT. */
712 
713  if( (id = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0) ) != LB_ERR )
714  {
715  size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
716  if (size == LB_ERR)
717  FIXME("LB_ERR probably not handled yet\n");
718  if( (pText = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR))) )
719  {
720  /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
722  pText[size] = '\0'; /* just in case */
723  } else return;
724  }
725 
726  if( lphc->wState & CBF_EDIT )
727  {
728  static const WCHAR empty_stringW[] = { 0 };
729  if( CB_HASSTRINGS(lphc) ) SetWindowTextW( lphc->hWndEdit, pText ? pText : empty_stringW );
730  if( lphc->wState & CBF_FOCUSED )
732  }
733  else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self ))
734  {
735  /* paint text field ourselves */
736  HDC hdc = hdc_paint ? hdc_paint : GetDC(lphc->self);
737  UINT itemState = ODS_COMBOBOXEDIT;
738  HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0;
739  HBRUSH hPrevBrush, hBkgBrush;
740 
741  /*
742  * Give ourselves some space.
743  */
744  InflateRect( &rectEdit, -1, -1 );
745 
746  hBkgBrush = COMBO_PrepareColors( lphc, hdc );
747  hPrevBrush = SelectObject( hdc, hBkgBrush );
748  FillRect( hdc, &rectEdit, hBkgBrush );
749 
750  if( CB_OWNERDRAWN(lphc) )
751  {
752  DRAWITEMSTRUCT dis;
753  HRGN clipRegion;
754  UINT ctlid = (UINT)GetWindowLongPtrW( lphc->self, GWLP_ID );
755 
756  /* setup state for DRAWITEM message. Owner will highlight */
757  if ( (lphc->wState & CBF_FOCUSED) &&
758  !(lphc->wState & CBF_DROPPED) )
759  itemState |= ODS_SELECTED | ODS_FOCUS;
760 
761  if (!IsWindowEnabled(lphc->self)) itemState |= ODS_DISABLED;
762 
763  dis.CtlType = ODT_COMBOBOX;
764  dis.CtlID = ctlid;
765  dis.hwndItem = lphc->self;
767  dis.itemID = id;
768  dis.itemState = itemState;
769  dis.hDC = hdc;
770  dis.rcItem = rectEdit;
771  dis.itemData = SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, id, 0);
772 
773  /*
774  * Clip the DC and have the parent draw the item.
775  */
776  clipRegion = set_control_clipping( hdc, &rectEdit );
777 
778  SendMessageW(lphc->owner, WM_DRAWITEM, ctlid, (LPARAM)&dis );
779 
780  SelectClipRgn( hdc, clipRegion );
781  if (clipRegion) DeleteObject( clipRegion );
782  }
783  else
784  {
785  static const WCHAR empty_stringW[] = { 0 };
786 
787  if ( (lphc->wState & CBF_FOCUSED) &&
788  !(lphc->wState & CBF_DROPPED) ) {
789 
790  /* highlight */
794  }
795 
796  ExtTextOutW( hdc,
797  rectEdit.left + 1,
798  rectEdit.top + 1,
800  &rectEdit,
801  pText ? pText : empty_stringW , size, NULL );
802 
803 #ifdef __REACTOS__
804  if(lphc->wState & CBF_FOCUSED &&
805  !(lphc->wState & CBF_DROPPED) &&
806  !(lphc->UIState & UISF_HIDEFOCUS))
807 #else
808  if(lphc->wState & CBF_FOCUSED && !(lphc->wState & CBF_DROPPED))
809 #endif
810  DrawFocusRect( hdc, &rectEdit );
811  }
812 
813  if( hPrevFont )
814  SelectObject(hdc, hPrevFont );
815 
816  if( hPrevBrush )
817  SelectObject( hdc, hPrevBrush );
818 
819  if( !hdc_paint )
820  ReleaseDC( lphc->self, hdc );
821  }
822 #ifdef __REACTOS__
823  if (pText)
824 #endif
825  HeapFree( GetProcessHeap(), 0, pText );
826 }
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)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
LPCSTR pText
Definition: txtscale.cpp:79
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define ODT_COMBOBOX
Definition: winuser.h:2514
#define MAXLONG
Definition: umtypes.h:116
HDC WINAPI GetDC(_In_opt_ HWND)
#define LB_GETITEMDATA
Definition: winuser.h:2023
UINT wState
Definition: comctl32.h:141
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
ULONG_PTR itemData
Definition: winuser.h:3067
HWND hWndEdit
Definition: comctl32.h:139
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ODS_FOCUS
Definition: winuser.h:2524
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
static HBRUSH COMBO_PrepareColors(LPHEADCOMBO lphc, HDC hDC)
Definition: combo.c:651
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG left
Definition: windef.h:291
#define CB_HASSTRINGS(lphc)
Definition: combo.c:38
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
int32_t INT
Definition: typedefs.h:56
DWORD WINAPI GetSysColor(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
LONG UIState
Definition: window.c:3257
#define ETO_OPAQUE
Definition: wingdi.h:646
#define LB_ERR
Definition: winuser.h:2407
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define ETO_CLIPPED
Definition: wingdi.h:647
#define LB_GETTEXTLEN
Definition: winuser.h:2032
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
#define ODA_DRAWENTIRE
Definition: winuser.h:2517
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ODS_DISABLED
Definition: winuser.h:2522
#define EM_SETSEL
Definition: winuser.h:2000
HFONT hFont
Definition: comctl32.h:142
#define LB_GETTEXT
Definition: winuser.h:2031
HDC hdc
Definition: main.c:9
#define CB_OWNERDRAWN(lphc)
Definition: combo.c:37
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
unsigned int UINT
Definition: ndis.h:50
HWND owner
Definition: comctl32.h:137
#define WM_DRAWITEM
Definition: winuser.h:1627
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define ODS_SELECTED
Definition: winuser.h:2520
GLenum GLuint id
Definition: glext.h:5579
BOOL WINAPI IsWindowVisible(_In_ HWND)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
static const WCHAR empty_stringW[]
Definition: edit.c:166
#define HeapFree(x, y, z)
Definition: compat.h:394
#define GWLP_ID
Definition: winuser.h:854

Referenced by COMBO_Paint(), and ComboWndProc_common().

◆ CBRepaintButton()

static void CBRepaintButton ( LPHEADCOMBO  lphc)
static

Definition at line 1160 of file combo.c.

1161  {
1162  InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
1163  UpdateWindow(lphc->self);
1164 }
#define TRUE
Definition: types.h:120
BOOL WINAPI UpdateWindow(_In_ HWND)
RECT buttonRect
Definition: comctl32.h:144
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND self
Definition: comctl32.h:136

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

◆ CBResetPos()

static void CBResetPos ( LPHEADCOMBO  lphc,
const RECT rectEdit,
const RECT rectLB,
BOOL  bRedraw 
)
static

Definition at line 1484 of file combo.c.

1489 {
1490  BOOL bDrop = (CB_GETTYPE(lphc) != CBS_SIMPLE);
1491 
1492  /* NOTE: logs sometimes have WM_LBUTTONUP before a cascade of
1493  * sizing messages */
1494 
1495  if( lphc->wState & CBF_EDIT )
1496  SetWindowPos( lphc->hWndEdit, 0,
1497  rectEdit->left, rectEdit->top,
1498  rectEdit->right - rectEdit->left,
1499  rectEdit->bottom - rectEdit->top,
1500  SWP_NOZORDER | SWP_NOACTIVATE | ((bDrop) ? SWP_NOREDRAW : 0) );
1501 
1502  SetWindowPos( lphc->hWndLBox, 0,
1503  rectLB->left, rectLB->top,
1504  rectLB->right - rectLB->left,
1505  rectLB->bottom - rectLB->top,
1506  SWP_NOACTIVATE | SWP_NOZORDER | ((bDrop) ? SWP_NOREDRAW : 0) );
1507 
1508  if( bDrop )
1509  {
1510  if( lphc->wState & CBF_DROPPED )
1511  {
1512  lphc->wState &= ~CBF_DROPPED;
1513  ShowWindow( lphc->hWndLBox, SW_HIDE );
1514  }
1515 
1516  if( bRedraw && !(lphc->wState & CBF_NOREDRAW) )
1517  RedrawWindow( lphc->self, NULL, 0,
1519  }
1520 }
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define SW_HIDE
Definition: winuser.h:762
UINT wState
Definition: comctl32.h:141
LONG top
Definition: windef.h:292
HWND hWndEdit
Definition: comctl32.h:139
#define CB_GETTYPE(lphc)
Definition: combo.c:42
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LONG right
Definition: windef.h:293
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CBS_SIMPLE
Definition: winuser.h:291
smooth NULL
Definition: ftsmooth.c:416
HWND hWndLBox
Definition: comctl32.h:140
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define RDW_ERASE
Definition: winuser.h:1197
HWND self
Definition: comctl32.h:136
#define SWP_NOREDRAW
Definition: winuser.h:1231
#define RDW_UPDATENOW
Definition: winuser.h:1206
LONG bottom
Definition: windef.h:294
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define RDW_INVALIDATE
Definition: winuser.h:1200

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

◆ CBRollUp()

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

Definition at line 1090 of file combo.c.

1091 {
1092  HWND hWnd = lphc->self;
1093 
1094  TRACE("[%p]: sel ok? [%i] dropped? [%i]\n",
1095  lphc->self, ok, (INT)(lphc->wState & CBF_DROPPED));
1096 
1097  CB_NOTIFY( lphc, (ok) ? CBN_SELENDOK : CBN_SELENDCANCEL );
1098 
1099  if( IsWindow( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
1100  {
1101 
1102  if( lphc->wState & CBF_DROPPED )
1103  {
1104  RECT rect;
1105 
1106  lphc->wState &= ~CBF_DROPPED;
1107  ShowWindow( lphc->hWndLBox, SW_HIDE );
1108 
1109  if(GetCapture() == lphc->hWndLBox)
1110  {
1111  ReleaseCapture();
1112  }
1113 
1114  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1115  {
1116  rect = lphc->buttonRect;
1117  }
1118  else
1119  {
1120  if( bButton )
1121  {
1122  UnionRect( &rect,
1123  &lphc->buttonRect,
1124  &lphc->textRect);
1125  }
1126  else
1127  rect = lphc->textRect;
1128 
1129  bButton = TRUE;
1130  }
1131 
1132  if( bButton && !(lphc->wState & CBF_NOREDRAW) )
1135  CB_NOTIFY( lphc, CBN_CLOSEUP );
1136  }
1137  }
1138 }
#define RDW_NOCHILDREN
Definition: winuser.h:1208
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define TRUE
Definition: types.h:120
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SW_HIDE
Definition: winuser.h:762
UINT wState
Definition: comctl32.h:141
HWND hWnd
Definition: settings.c:17
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CB_NOTIFY(lphc, code)
Definition: combo.c:32
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
#define CBN_SELENDOK
Definition: winuser.h:1963
HWND WINAPI GetCapture(void)
Definition: message.c:2879
#define CBS_SIMPLE
Definition: winuser.h:291
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
#define RDW_ERASE
Definition: winuser.h:1197
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define CBN_SELENDCANCEL
Definition: winuser.h:1962
HWND self
Definition: comctl32.h:136
#define CBS_DROPDOWN
Definition: winuser.h:283
#define ok(value,...)
Definition: atltest.h:57
#define RDW_UPDATENOW
Definition: winuser.h:1206
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define CBN_CLOSEUP
Definition: winuser.h:1954
#define RDW_INVALIDATE
Definition: winuser.h:1200

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

◆ CBUpdateEdit()

static void CBUpdateEdit ( LPHEADCOMBO  lphc,
INT  index 
)
static

Definition at line 952 of file combo.c.

953 {
954  INT length;
955  LPWSTR pText = NULL;
956  static const WCHAR empty_stringW[] = { 0 };
957 
958  TRACE("\t %i\n", index );
959 
960  if( index >= 0 ) /* got an entry */
961  {
963  if( length != LB_ERR)
964  {
965  if( (pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR))) )
966  {
968  }
969  }
970  }
971 
972  if( CB_HASSTRINGS(lphc) )
973  {
976  lphc->wState &= ~(CBF_NOEDITNOTIFY | CBF_NOLBSELECT);
977  }
978 
979  if( lphc->wState & CBF_FOCUSED )
980  SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
981 
982  HeapFree( GetProcessHeap(), 0, pText );
983 }
LPCSTR pText
Definition: txtscale.cpp:79
UINT wState
Definition: comctl32.h:141
HWND hWndEdit
Definition: comctl32.h:139
UINT_PTR WPARAM
Definition: windef.h:207
#define CB_HASSTRINGS(lphc)
Definition: combo.c:38
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2407
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define LB_GETTEXTLEN
Definition: winuser.h:2032
#define WM_SETTEXT
Definition: winuser.h:1599
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define EM_SETSEL
Definition: winuser.h:2000
#define LB_GETTEXT
Definition: winuser.h:2031
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const WCHAR empty_stringW[]
Definition: edit.c:166
#define HeapFree(x, y, z)
Definition: compat.h:394

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

◆ CBUpdateLBox()

static INT CBUpdateLBox ( LPHEADCOMBO  lphc,
BOOL  bSelect 
)
static

Definition at line 918 of file combo.c.

919 {
920  INT length, idx;
921  LPWSTR pText = NULL;
922 
923  idx = LB_ERR;
924  length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
925 
926  if( length > 0 )
927  pText = HeapAlloc( GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
928 
929  TRACE("\t edit text length %i\n", length );
930 
931  if( pText )
932  {
933  GetWindowTextW( lphc->hWndEdit, pText, length + 1);
935  HeapFree( GetProcessHeap(), 0, pText );
936  }
937 
938  SendMessageW(lphc->hWndLBox, LB_SETCURSEL, (WPARAM)(bSelect ? idx : -1), 0);
939 
940  /* probably superfluous but Windows sends this too */
941  SendMessageW(lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0);
942  SendMessageW(lphc->hWndLBox, LB_SETTOPINDEX, (WPARAM)(idx < 0 ? 0 : idx), 0);
943 
944  return idx;
945 }
#define LB_SETCURSEL
Definition: winuser.h:2045
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define LB_SETCARETINDEX
Definition: winuser.h:2042
LPCSTR pText
Definition: txtscale.cpp:79
HWND hWndEdit
Definition: comctl32.h:139
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2407
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define LB_SETTOPINDEX
Definition: winuser.h:2052
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define LB_FINDSTRING
Definition: winuser.h:2016
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

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

1218 {
1219  if ( lphc->wState & CBF_EDIT && lphc->hWndEdit == hWnd )
1220  {
1221  /* ">> 8" makes gcc generate jump-table instead of cmp ladder */
1222 
1223  switch( HIWORD(wParam) >> 8 )
1224  {
1225  case (EN_SETFOCUS >> 8):
1226 
1227  TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
1228 
1229  COMBO_SetFocus( lphc );
1230  break;
1231 
1232  case (EN_KILLFOCUS >> 8):
1233 
1234  TRACE("[%p]: edit [%p] lost focus\n", lphc->self, lphc->hWndEdit );
1235 
1236  /* NOTE: it seems that Windows' edit control sends an
1237  * undocumented message WM_USER + 0x1B instead of this
1238  * notification (only when it happens to be a part of
1239  * the combo). ?? - AK.
1240  */
1241 
1242  COMBO_KillFocus( lphc );
1243  break;
1244 
1245 
1246  case (EN_CHANGE >> 8):
1247  /*
1248  * In some circumstances (when the selection of the combobox
1249  * is changed for example) we don't want the EN_CHANGE notification
1250  * to be forwarded to the parent of the combobox. This code
1251  * checks a flag that is set in these occasions and ignores the
1252  * notification.
1253  */
1254  if (lphc->wState & CBF_NOLBSELECT)
1255  {
1256  lphc->wState &= ~CBF_NOLBSELECT;
1257  }
1258  else
1259  {
1260  CBUpdateLBox( lphc, lphc->wState & CBF_DROPPED );
1261  }
1262 
1263  if (!(lphc->wState & CBF_NOEDITNOTIFY))
1264  CB_NOTIFY( lphc, CBN_EDITCHANGE );
1265  break;
1266 
1267  case (EN_UPDATE >> 8):
1268  if (!(lphc->wState & CBF_NOEDITNOTIFY))
1269  CB_NOTIFY( lphc, CBN_EDITUPDATE );
1270  break;
1271 
1272  case (EN_ERRSPACE >> 8):
1273  CB_NOTIFY( lphc, CBN_ERRSPACE );
1274  }
1275  }
1276  else if( lphc->hWndLBox == hWnd )
1277  {
1278  switch( (short)HIWORD(wParam) )
1279  {
1280  case LBN_ERRSPACE:
1281  CB_NOTIFY( lphc, CBN_ERRSPACE );
1282  break;
1283 
1284  case LBN_DBLCLK:
1285  CB_NOTIFY( lphc, CBN_DBLCLK );
1286  break;
1287 
1288  case LBN_SELCHANGE:
1289  case LBN_SELCANCEL:
1290 
1291  TRACE("[%p]: lbox selection change [%x]\n", lphc->self, lphc->wState );
1292 
1293  /* do not roll up if selection is being tracked
1294  * by arrow keys in the dropdown listbox */
1295  if (!(lphc->wState & CBF_NOROLLUP))
1296  {
1297  CBRollUp( lphc, (HIWORD(wParam) == LBN_SELCHANGE), TRUE );
1298  }
1299  else lphc->wState &= ~CBF_NOROLLUP;
1300 
1301  CB_NOTIFY( lphc, CBN_SELCHANGE );
1302 
1303  if( HIWORD(wParam) == LBN_SELCHANGE)
1304  {
1305  if( lphc->wState & CBF_EDIT )
1306  {
1307  INT index = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1308  lphc->wState |= CBF_NOLBSELECT;
1309  CBUpdateEdit( lphc, index );
1310  /* select text in edit, as Windows does */
1311  SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
1312  }
1313  else
1314  {
1315  InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1316  UpdateWindow(lphc->self);
1317  }
1318  }
1319  break;
1320 
1321  case LBN_SETFOCUS:
1322  case LBN_KILLFOCUS:
1323  /* nothing to do here since ComboLBox always resets the focus to its
1324  * combo/edit counterpart */
1325  break;
1326  }
1327  }
1328  return 0;
1329 }
static void COMBO_KillFocus(LPHEADCOMBO lphc)
Definition: combo.c:1191
#define TRUE
Definition: types.h:120
UINT wState
Definition: comctl32.h:141
#define LBN_SETFOCUS
Definition: winuser.h:2058
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
HWND hWndEdit
Definition: comctl32.h:139
#define CB_NOTIFY(lphc, code)
Definition: combo.c:32
#define LBN_SELCHANGE
Definition: winuser.h:2057
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
#define LBN_SELCANCEL
Definition: winuser.h:2056
#define EN_KILLFOCUS
Definition: winuser.h:2007
#define EN_SETFOCUS
Definition: winuser.h:2009
#define CBN_DBLCLK
Definition: winuser.h:1955
#define EN_ERRSPACE
Definition: winuser.h:2005
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
#define CBN_EDITCHANGE
Definition: winuser.h:1957
#define EM_SETSEL
Definition: winuser.h:2000
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define LBN_ERRSPACE
Definition: winuser.h:2054
#define LBN_DBLCLK
Definition: winuser.h:2053
#define CBN_ERRSPACE
Definition: winuser.h:1959
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
#define CBN_SELCHANGE
Definition: winuser.h:1961
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:952
#define CBN_EDITUPDATE
Definition: winuser.h:1958
#define HIWORD(l)
Definition: typedefs.h:246
#define EN_UPDATE
Definition: winuser.h:2010
static INT CBUpdateLBox(LPHEADCOMBO lphc, BOOL bSelect)
Definition: combo.c:918
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1090
#define LBN_KILLFOCUS
Definition: winuser.h:2055
static void COMBO_SetFocus(LPHEADCOMBO lphc)
Definition: combo.c:1169
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by ComboWndProc_common().

◆ COMBO_Create()

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

Definition at line 453 of file combo.c.

455 {
456  static const WCHAR clbName[] = {'C','o','m','b','o','L','B','o','x',0};
457  static const WCHAR editName[] = {'E','d','i','t',0};
458 
459  if( !CB_GETTYPE(lphc) ) lphc->dwStyle |= CBS_SIMPLE;
460  if( CB_GETTYPE(lphc) != CBS_DROPDOWNLIST ) lphc->wState |= CBF_EDIT;
461 
462  lphc->owner = hwndParent;
463 
464  /*
465  * The item height and dropped width are not set when the control
466  * is created.
467  */
468  lphc->droppedWidth = lphc->editHeight = 0;
469 
470  /*
471  * The first time we go through, we want to measure the ownerdraw item
472  */
473  lphc->wState |= CBF_MEASUREITEM;
474 
475  /* M$ IE 3.01 actually creates (and rapidly destroys) an ownerless combobox */
476 
477  if( lphc->owner || !(style & WS_VISIBLE) )
478  {
479  UINT lbeStyle = 0;
480  UINT lbeExStyle = 0;
481 
482  /*
483  * Initialize the dropped rect to the size of the client area of the
484  * control and then, force all the areas of the combobox to be
485  * recalculated.
486  */
487  GetClientRect( hwnd, &lphc->droppedRect );
488  CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
489 
490  /*
491  * Adjust the position of the popup listbox if it's necessary
492  */
493  if ( CB_GETTYPE(lphc) != CBS_SIMPLE )
494  {
495  lphc->droppedRect.top = lphc->textRect.bottom + COMBO_YBORDERSIZE();
496 
497  /*
498  * If it's a dropdown, the listbox is offset
499  */
500  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
502 
503  if (lphc->droppedRect.bottom < lphc->droppedRect.top)
504  lphc->droppedRect.bottom = lphc->droppedRect.top;
505  if (lphc->droppedRect.right < lphc->droppedRect.left)
506  lphc->droppedRect.right = lphc->droppedRect.left;
507  MapWindowPoints( hwnd, 0, (LPPOINT)&lphc->droppedRect, 2 );
508  }
509 
510  /* create listbox popup */
511 
514 
515  if( lphc->dwStyle & CBS_SORT )
516  lbeStyle |= LBS_SORT;
517  if( lphc->dwStyle & CBS_HASSTRINGS )
518  lbeStyle |= LBS_HASSTRINGS;
519  if( lphc->dwStyle & CBS_NOINTEGRALHEIGHT )
520  lbeStyle |= LBS_NOINTEGRALHEIGHT;
521  if( lphc->dwStyle & CBS_DISABLENOSCROLL )
522  lbeStyle |= LBS_DISABLENOSCROLL;
523 
524  if( CB_GETTYPE(lphc) == CBS_SIMPLE ) /* child listbox */
525  {
526  lbeStyle |= WS_VISIBLE;
527 
528  /*
529  * In win 95 look n feel, the listbox in the simple combobox has
530  * the WS_EXCLIENTEDGE style instead of the WS_BORDER style.
531  */
532  lbeStyle &= ~WS_BORDER;
533  lbeExStyle |= WS_EX_CLIENTEDGE;
534  }
535  else
536  {
537  lbeExStyle |= (WS_EX_TOPMOST | WS_EX_TOOLWINDOW);
538  }
539 
540  if (unicode)
541  lphc->hWndLBox = CreateWindowExW(lbeExStyle, clbName, NULL, lbeStyle,
542  lphc->droppedRect.left,
543  lphc->droppedRect.top,
544  lphc->droppedRect.right - lphc->droppedRect.left,
545  lphc->droppedRect.bottom - lphc->droppedRect.top,
548  else
549  lphc->hWndLBox = CreateWindowExA(lbeExStyle, "ComboLBox", NULL, lbeStyle,
550  lphc->droppedRect.left,
551  lphc->droppedRect.top,
552  lphc->droppedRect.right - lphc->droppedRect.left,
553  lphc->droppedRect.bottom - lphc->droppedRect.top,
556 
557  if( lphc->hWndLBox )
558  {
559  BOOL bEdit = TRUE;
560  lbeStyle = WS_CHILD | WS_VISIBLE | ES_NOHIDESEL | ES_LEFT | ES_COMBO;
561 
562  if( lphc->wState & CBF_EDIT )
563  {
564  if( lphc->dwStyle & CBS_OEMCONVERT )
565  lbeStyle |= ES_OEMCONVERT;
566  if( lphc->dwStyle & CBS_AUTOHSCROLL )
567  lbeStyle |= ES_AUTOHSCROLL;
568  if( lphc->dwStyle & CBS_LOWERCASE )
569  lbeStyle |= ES_LOWERCASE;
570  else if( lphc->dwStyle & CBS_UPPERCASE )
571  lbeStyle |= ES_UPPERCASE;
572 
573  if (!IsWindowEnabled(hwnd)) lbeStyle |= WS_DISABLED;
574 
575  if (unicode)
576  lphc->hWndEdit = CreateWindowExW(0, editName, NULL, lbeStyle,
577  lphc->textRect.left, lphc->textRect.top,
578  lphc->textRect.right - lphc->textRect.left,
579  lphc->textRect.bottom - lphc->textRect.top,
582  else
583  lphc->hWndEdit = CreateWindowExA(0, "Edit", NULL, lbeStyle,
584  lphc->textRect.left, lphc->textRect.top,
585  lphc->textRect.right - lphc->textRect.left,
586  lphc->textRect.bottom - lphc->textRect.top,
589 
590  if( !lphc->hWndEdit )
591  bEdit = FALSE;
592  }
593 
594  if( bEdit )
595  {
596  if( CB_GETTYPE(lphc) != CBS_SIMPLE )
597  {
598  /* Now do the trick with parent */
600  /*
601  * If the combo is a dropdown, we must resize the control
602  * to fit only the text area and button. To do this,
603  * we send a dummy resize and the WM_WINDOWPOSCHANGING message
604  * will take care of setting the height for us.
605  */
606  CBForceDummyResize(lphc);
607  }
608 
609  TRACE("init done\n");
610  return 0;
611  }
612  ERR("edit control failure.\n");
613  } else ERR("listbox failure.\n");
614  } else ERR("no owner for visible combo.\n");
615 
616  /* CreateWindow() will send WM_NCDESTROY to cleanup */
617 
618  return -1;
619 }
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_DISABLED
Definition: pedump.c:621
#define CBS_SORT
Definition: winuser.h:292
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
static void CBCalcPlacement(HWND hwnd, LPHEADCOMBO lphc, LPRECT lprEdit, LPRECT lprButton, LPRECT lprLB)
Definition: combo.c:328
INT editHeight
Definition: comctl32.h:149
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)
#define LBS_HASSTRINGS
Definition: pedump.c:684
UINT wState
Definition: comctl32.h:141
LONG top
Definition: windef.h:292
HWND hWndEdit
Definition: comctl32.h:139
#define ES_COMBO
Definition: edit.c:29
#define LBS_SORT
Definition: pedump.c:679
RECT droppedRect
Definition: comctl32.h:145
#define ID_CB_LISTBOX
Definition: combo.c:79
#define LBS_COMBOBOX
Definition: winuser.h:324
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
#define CBS_AUTOHSCROLL
Definition: winuser.h:281
#define WS_CHILD
Definition: pedump.c:617
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG left
Definition: windef.h:291
#define CBS_OEMCONVERT
Definition: winuser.h:288
LONG right
Definition: windef.h:293
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define CBS_OWNERDRAWVARIABLE
Definition: winuser.h:290
#define LBS_NOINTEGRALHEIGHT
Definition: pedump.c:686
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CBS_SIMPLE
Definition: winuser.h:291
#define ES_UPPERCASE
Definition: pedump.c:668
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define CBS_HASSTRINGS
Definition: winuser.h:285
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ES_NOHIDESEL
Definition: pedump.c:673
INT droppedWidth
Definition: comctl32.h:148
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 WS_EX_TOPMOST
Definition: pedump.c:647
#define CBS_UPPERCASE
Definition: winuser.h:293
#define ERR(fmt,...)
Definition: debug.h:109
#define ID_CB_EDIT
Definition: combo.c:80
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
static void CBForceDummyResize(LPHEADCOMBO lphc)
Definition: combo.c:297
#define WS_BORDER
Definition: pedump.c:625
#define LBS_NOTIFY
Definition: pedump.c:678
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define CBS_LOWERCASE
Definition: winuser.h:286
#define LBS_DISABLENOSCROLL
Definition: pedump.c:690
#define CBS_DROPDOWN
Definition: winuser.h:283
#define HWND_DESKTOP
Definition: winuser.h:1195
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
HWND owner
Definition: comctl32.h:137
#define GWLP_HINSTANCE
Definition: winuser.h:850
#define ES_OEMCONVERT
Definition: pedump.c:674
#define COMBO_YBORDERSIZE()
Definition: combo.c:59
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR 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)
LONG bottom
Definition: windef.h:294
Arabic default style
Definition: afstyles.h:93
#define ES_LEFT
Definition: pedump.c:664
#define WS_VISIBLE
Definition: pedump.c:620
#define CBS_NOINTEGRALHEIGHT
Definition: winuser.h:287
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define COMBO_EDITBUTTONSPACE()
Definition: combo.c:60
#define ES_AUTOHSCROLL
Definition: pedump.c:672
UINT dwStyle
Definition: comctl32.h:138
#define CBS_DISABLENOSCROLL
Definition: winuser.h:282
#define ES_LOWERCASE
Definition: pedump.c:669

Referenced by ComboWndProc_common().

◆ COMBO_FlipListbox()

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

Definition at line 1145 of file combo.c.

1146 {
1147  if( lphc->wState & CBF_DROPPED )
1148  {
1149  CBRollUp( lphc, ok, bRedrawButton );
1150  return FALSE;
1151  }
1152 
1153  CBDropDown( lphc );
1154  return TRUE;
1155 }
#define TRUE
Definition: types.h:120
UINT wState
Definition: comctl32.h:141
static void CBDropDown(LPHEADCOMBO lphc)
Definition: combo.c:990
#define ok(value,...)
Definition: atltest.h:57
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1090

◆ COMBO_Font()

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

Definition at line 1578 of file combo.c.

1579 {
1580  /*
1581  * Set the font
1582  */
1583  lphc->hFont = hFont;
1584 
1585  /*
1586  * Propagate to owned windows.
1587  */
1588  if( lphc->wState & CBF_EDIT )
1589  SendMessageW(lphc->hWndEdit, WM_SETFONT, (WPARAM)hFont, bRedraw);
1590  SendMessageW(lphc->hWndLBox, WM_SETFONT, (WPARAM)hFont, bRedraw);
1591 
1592  /*
1593  * Redo the layout of the control.
1594  */
1595  if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1596  {
1597  CBCalcPlacement(lphc->self,
1598  lphc,
1599  &lphc->textRect,
1600  &lphc->buttonRect,
1601  &lphc->droppedRect);
1602 
1603  CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
1604  }
1605  else
1606  {
1607  CBForceDummyResize(lphc);
1608  }
1609 }
#define TRUE
Definition: types.h:120
static void CBCalcPlacement(HWND hwnd, LPHEADCOMBO lphc, LPRECT lprEdit, LPRECT lprButton, LPRECT lprLB)
Definition: combo.c:328
UINT wState
Definition: comctl32.h:141
HWND hWndEdit
Definition: comctl32.h:139
RECT droppedRect
Definition: comctl32.h:145
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
UINT_PTR WPARAM
Definition: windef.h:207
HFONT hFont
Definition: main.c:53
#define CBS_SIMPLE
Definition: winuser.h:291
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
HFONT hFont
Definition: comctl32.h:142
static void CBForceDummyResize(LPHEADCOMBO lphc)
Definition: combo.c:297
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETFONT
Definition: winuser.h:1632
static void CBResetPos(LPHEADCOMBO lphc, const RECT *rectEdit, const RECT *rectLB, BOOL bRedraw)
Definition: combo.c:1484

Referenced by ComboWndProc_common().

◆ COMBO_GetComboBoxInfo()

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

Definition at line 1785 of file combo.c.

1786 {
1787  if (!pcbi || (pcbi->cbSize < sizeof(COMBOBOXINFO)))
1788  return FALSE;
1789 
1790  pcbi->rcItem = lphc->textRect;
1791  pcbi->rcButton = lphc->buttonRect;
1792  pcbi->stateButton = 0;
1793  if (lphc->wState & CBF_BUTTONDOWN)
1795  if (IsRectEmpty(&lphc->buttonRect))
1797  pcbi->hwndCombo = lphc->self;
1798  pcbi->hwndItem = lphc->hWndEdit;
1799  pcbi->hwndList = lphc->hWndLBox;
1800  return TRUE;
1801 }
#define TRUE
Definition: types.h:120
UINT wState
Definition: comctl32.h:141
HWND hWndEdit
Definition: comctl32.h:139
RECT buttonRect
Definition: comctl32.h:144
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2839
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
DWORD stateButton
Definition: winuser.h:3686
HWND self
Definition: comctl32.h:136
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2851

Referenced by ComboWndProc_common().

◆ COMBO_GetTextA()

static LRESULT COMBO_GetTextA ( LPHEADCOMBO  lphc,
INT  count,
LPSTR  buf 
)
static

Definition at line 1434 of file combo.c.

1435 {
1436  INT length;
1437 
1438  if( lphc->wState & CBF_EDIT )
1439  return SendMessageA( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1440 
1441  /* get it from the listbox */
1442 
1443  if (!count || !buf) return 0;
1444  if( lphc->hWndLBox )
1445  {
1446  INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1447  if (idx == LB_ERR) goto error;
1448  length = SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, idx, 0 );
1449  if (length == LB_ERR) goto error;
1450 
1451  /* 'length' is without the terminating character */
1452  if (length >= count)
1453  {
1454  LPSTR lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) );
1455  if (!lpBuffer) goto error;
1457 
1458  /* truncate if buffer is too short */
1459  if (length != LB_ERR)
1460  {
1461  lstrcpynA( buf, lpBuffer, count );
1462  length = count;
1463  }
1464  HeapFree( GetProcessHeap(), 0, lpBuffer );
1465  }
1466  else length = SendMessageA(lphc->hWndLBox, LB_GETTEXT, idx, (LPARAM)buf);
1467 
1468  if (length == LB_ERR) return 0;
1469  return length;
1470  }
1471 
1472  error: /* error - truncate string, return zero */
1473  buf[0] = 0;
1474  return 0;
1475 }
#define error(str)
Definition: mkdosfs.c:1605
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
UINT wState
Definition: comctl32.h:141
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hWndEdit
Definition: comctl32.h:139
char * LPSTR
Definition: xmlstorage.h:182
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2407
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
unsigned int idx
Definition: utils.c:41
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETTEXTLEN
Definition: winuser.h:2032
HWND hWndLBox
Definition: comctl32.h:140
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define LB_GETTEXT
Definition: winuser.h:2031
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
#define lstrcpynA
Definition: compat.h:408
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ComboWndProc_common().

◆ COMBO_GetTextW()

static LRESULT COMBO_GetTextW ( LPHEADCOMBO  lphc,
INT  count,
LPWSTR  buf 
)
static

Definition at line 1384 of file combo.c.

1385 {
1386  INT length;
1387 
1388  if( lphc->wState & CBF_EDIT )
1389  return SendMessageW( lphc->hWndEdit, WM_GETTEXT, count, (LPARAM)buf );
1390 
1391  /* get it from the listbox */
1392 
1393  if (!count || !buf) return 0;
1394  if( lphc->hWndLBox )
1395  {
1396  INT idx = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1397  if (idx == LB_ERR) goto error;
1398  length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, idx, 0 );
1399  if (length == LB_ERR) goto error;
1400 
1401  /* 'length' is without the terminating character */
1402  if (length >= count)
1403  {
1404  LPWSTR lpBuffer = HeapAlloc(GetProcessHeap(), 0, (length + 1) * sizeof(WCHAR));
1405  if (!lpBuffer) goto error;
1407 
1408  /* truncate if buffer is too short */
1409  if (length != LB_ERR)
1410  {
1411  lstrcpynW( buf, lpBuffer, count );
1412  length = count;
1413  }
1414  HeapFree( GetProcessHeap(), 0, lpBuffer );
1415  }
1416  else length = SendMessageW(lphc->hWndLBox, LB_GETTEXT, idx, (LPARAM)buf);
1417 
1418  if (length == LB_ERR) return 0;
1419  return length;
1420  }
1421 
1422  error: /* error - truncate string, return zero */
1423  buf[0] = 0;
1424  return 0;
1425 }
#define error(str)
Definition: mkdosfs.c:1605
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
UINT wState
Definition: comctl32.h:141
#define WM_GETTEXT
Definition: winuser.h:1600
HWND hWndEdit
Definition: comctl32.h:139
int32_t INT
Definition: typedefs.h:56
#define lstrcpynW
Definition: compat.h:397
#define LB_ERR
Definition: winuser.h:2407
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
unsigned int idx
Definition: utils.c:41
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETTEXTLEN
Definition: winuser.h:2032
HWND hWndLBox
Definition: comctl32.h:140
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define LB_GETTEXT
Definition: winuser.h:2031
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ComboWndProc_common().

◆ COMBO_Init()

static BOOL COMBO_Init ( void  )
static

Definition at line 88 of file combo.c.

89 {
90  HDC hDC;
91 
92  if( hComboBmp ) return TRUE;
93  if( (hDC = CreateCompatibleDC(0)) )
94  {
95  BOOL bRet = FALSE;
97  {
98  BITMAP bm;
99  HBITMAP hPrevB;
100  RECT r;
101 
102  GetObjectW( hComboBmp, sizeof(bm), &bm );
103  CBitHeight = bm.bmHeight;
104  CBitWidth = bm.bmWidth;
105 
106  TRACE("combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
107 
108  hPrevB = SelectObject( hDC, hComboBmp);
109  SetRect( &r, 0, 0, CBitWidth, CBitHeight );
110  InvertRect( hDC, &r );
111  SelectObject( hDC, hPrevB );
112  bRet = TRUE;
113  }
114  DeleteDC( hDC );
115  return bRet;
116  }
117  return FALSE;
118 }
#define TRUE
Definition: types.h:120
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static UINT CBitWidth
Definition: combo.c:51
BOOL WINAPI InvertRect(_In_ HDC, _In_ LPCRECT)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define OBM_COMBO
Definition: winuser.h:1102
static HBITMAP hComboBmp
Definition: combo.c:50
static HDC hDC
Definition: 3dtext.c:33
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2132
Definition: bl.h:1331
static UINT CBitHeight
Definition: combo.c:51
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by COMBO_NCCreate().

◆ COMBO_ItemOp()

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

Definition at line 1336 of file combo.c.

1337 {
1338  HWND hWnd = lphc->self;
1340 
1341  TRACE("[%p]: ownerdraw op %04x\n", lphc->self, msg );
1342 
1343  switch( msg )
1344  {
1345  case WM_DELETEITEM:
1346  {
1348  lpIS->CtlType = ODT_COMBOBOX;
1349  lpIS->CtlID = id;
1350  lpIS->hwndItem = hWnd;
1351  break;
1352  }
1353  case WM_DRAWITEM:
1354  {
1356  lpIS->CtlType = ODT_COMBOBOX;
1357  lpIS->CtlID = id;
1358  lpIS->hwndItem = hWnd;
1359  break;
1360  }
1361  case WM_COMPAREITEM:
1362  {
1364  lpIS->CtlType = ODT_COMBOBOX;
1365  lpIS->CtlID = id;
1366  lpIS->hwndItem = hWnd;
1367  break;
1368  }
1369  case WM_MEASUREITEM:
1370  {
1372  lpIS->CtlType = ODT_COMBOBOX;
1373  lpIS->CtlID = id;
1374  break;
1375  }
1376  }
1377  return SendMessageW(lphc->owner, msg, id, lParam);
1378 }
#define ODT_COMBOBOX
Definition: winuser.h:2514
HWND hWnd
Definition: settings.c:17
#define GetWindowLongPtrW
Definition: winuser.h:4730
static UINT msg
Definition: combo.c:716
#define WM_DELETEITEM
Definition: winuser.h:1629
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_MEASUREITEM
Definition: winuser.h:1628
#define WM_COMPAREITEM
Definition: winuser.h:1637
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
HWND owner
Definition: comctl32.h:137
#define WM_DRAWITEM
Definition: winuser.h:1627
GLenum GLuint id
Definition: glext.h:5579
LPARAM lParam
Definition: combotst.c:139
#define GWLP_ID
Definition: winuser.h:854

Referenced by ComboWndProc_common().

◆ COMBO_KillFocus()

static void COMBO_KillFocus ( LPHEADCOMBO  lphc)
static

Definition at line 1191 of file combo.c.

1192 {
1193  HWND hWnd = lphc->self;
1194 
1195  if( lphc->wState & CBF_FOCUSED )
1196  {
1197  CBRollUp( lphc, FALSE, TRUE );
1198  if( IsWindow( hWnd ) )
1199  {
1200  if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1201  SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
1202 
1203  lphc->wState &= ~CBF_FOCUSED;
1204 
1205  /* redraw text */
1206  if( !(lphc->wState & CBF_EDIT) )
1207  InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1208 
1209  CB_NOTIFY( lphc, CBN_KILLFOCUS );
1210  }
1211  }
1212 }
#define TRUE
Definition: types.h:120
BOOL WINAPI IsWindow(_In_opt_ HWND)
UINT wState
Definition: comctl32.h:141
HWND hWnd
Definition: settings.c:17
#define CB_GETTYPE(lphc)
Definition: combo.c:42
#define CB_NOTIFY(lphc, code)
Definition: combo.c:32
#define CBN_KILLFOCUS
Definition: winuser.h:1960
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define LB_CARETOFF
Definition: undocuser.h:51
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1090

Referenced by COMBO_Command(), and ComboWndProc_common().

◆ COMBO_LButtonDown()

static void COMBO_LButtonDown ( LPHEADCOMBO  lphc,
LPARAM  lParam 
)
static

Definition at line 1673 of file combo.c.

1674 {
1675  POINT pt;
1676  BOOL bButton;
1677  HWND hWnd = lphc->self;
1678 
1679  pt.x = (short)LOWORD(lParam);
1680  pt.y = (short)HIWORD(lParam);
1681  bButton = PtInRect(&lphc->buttonRect, pt);
1682 
1683  if( (CB_GETTYPE(lphc) == CBS_DROPDOWNLIST) ||
1684  (bButton && (CB_GETTYPE(lphc) == CBS_DROPDOWN)) )
1685  {
1686  lphc->wState |= CBF_BUTTONDOWN;
1687  if( lphc->wState & CBF_DROPPED )
1688  {
1689  /* got a click to cancel selection */
1690 
1691  lphc->wState &= ~CBF_BUTTONDOWN;
1692  CBRollUp( lphc, TRUE, FALSE );
1693  if( !IsWindow( hWnd ) ) return;
1694 
1695  if( lphc->wState & CBF_CAPTURE )
1696  {
1697  lphc->wState &= ~CBF_CAPTURE;
1698  ReleaseCapture();
1699  }
1700  }
1701  else
1702  {
1703  /* drop down the listbox and start tracking */
1704 
1705  lphc->wState |= CBF_CAPTURE;
1706  SetCapture( hWnd );
1707  CBDropDown( lphc );
1708  }
1709  if( bButton ) CBRepaintButton( lphc );
1710  }
1711 }
#define TRUE
Definition: types.h:120
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define pt(x, y)
Definition: drawing.c:79
UINT wState
Definition: comctl32.h:141
HWND hWnd
Definition: settings.c:17
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
static void CBRepaintButton(LPHEADCOMBO lphc)
Definition: combo.c:1160
static void CBDropDown(LPHEADCOMBO lphc)
Definition: combo.c:990
HWND WINAPI SetCapture(_In_ HWND hWnd)
HWND self
Definition: comctl32.h:136
#define CBS_DROPDOWN
Definition: winuser.h:283
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define HIWORD(l)
Definition: typedefs.h:246
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1090

Referenced by ComboWndProc_common().

◆ COMBO_LButtonUp()

static void COMBO_LButtonUp ( LPHEADCOMBO  lphc)
static

Definition at line 1718 of file combo.c.

1719 {
1720  if( lphc->wState & CBF_CAPTURE )
1721  {
1722  lphc->wState &= ~CBF_CAPTURE;
1723  if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
1724  {
1725  INT index = CBUpdateLBox( lphc, TRUE );
1726  /* Update edit only if item is in the list */
1727  if(index >= 0)
1728  {
1729  lphc->wState |= CBF_NOLBSELECT;
1730  CBUpdateEdit( lphc, index );
1731  lphc->wState &= ~CBF_NOLBSELECT;
1732  }
1733  }
1734  ReleaseCapture();
1735  SetCapture(lphc->hWndLBox);
1736  }
1737 
1738  if( lphc->wState & CBF_BUTTONDOWN )
1739  {
1740  lphc->wState &= ~CBF_BUTTONDOWN;
1741  CBRepaintButton( lphc );
1742  }
1743 }
#define TRUE
Definition: types.h:120
UINT wState
Definition: comctl32.h:141
#define CB_GETTYPE(lphc)
Definition: combo.c:42
int32_t INT
Definition: typedefs.h:56
GLuint index
Definition: glext.h:6031
HWND hWndLBox
Definition: comctl32.h:140
static void CBRepaintButton(LPHEADCOMBO lphc)
Definition: combo.c:1160
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define CBS_DROPDOWN
Definition: winuser.h:283
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:952
static INT CBUpdateLBox(LPHEADCOMBO lphc, BOOL bSelect)
Definition: combo.c:918

Referenced by ComboWndProc_common().

◆ COMBO_MouseMove()

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

Definition at line 1751 of file combo.c.

1752 {
1753  POINT pt;
1754  RECT lbRect;
1755 
1756  pt.x = (short)LOWORD(lParam);
1757  pt.y = (short)HIWORD(lParam);
1758 
1759  if( lphc->wState & CBF_BUTTONDOWN )
1760  {
1761  BOOL bButton;
1762 
1763  bButton = PtInRect(&lphc->buttonRect, pt);
1764 
1765  if( !bButton )
1766  {
1767  lphc->wState &= ~CBF_BUTTONDOWN;
1768  CBRepaintButton( lphc );
1769  }
1770  }
1771 
1772  GetClientRect( lphc->hWndLBox, &lbRect );
1773  MapWindowPoints( lphc->self, lphc->hWndLBox, &pt, 1 );
1774  if( PtInRect(&lbRect, pt) )
1775  {
1776  lphc->wState &= ~CBF_CAPTURE;
1777  ReleaseCapture();
1778  if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) CBUpdateLBox( lphc, TRUE );
1779 
1780  /* hand over pointer tracking */
1782  }
1783 }
#define TRUE
Definition: types.h:120
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define pt(x, y)
Definition: drawing.c:79
UINT wState
Definition: comctl32.h:141
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
WPARAM wParam
Definition: combotst.c:138
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND hWndLBox
Definition: comctl32.h:140
static void CBRepaintButton(LPHEADCOMBO lphc)
Definition: combo.c:1160
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND self
Definition: comctl32.h:136
#define CBS_DROPDOWN
Definition: winuser.h:283
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888
#define HIWORD(l)
Definition: typedefs.h:246
static INT CBUpdateLBox(LPHEADCOMBO lphc, BOOL bSelect)
Definition: combo.c:918
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ComboWndProc_common().

◆ COMBO_NCCreate()

static LRESULT COMBO_NCCreate ( HWND  hwnd,
LONG  style 
)
static

Definition at line 135 of file combo.c.

136 {
137  LPHEADCOMBO lphc;
138 
139  if (COMBO_Init() && (lphc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HEADCOMBO))) )
140  {
141  lphc->self = hwnd;
142  SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc );
143 
144 #ifdef __REACTOS__
145  COMBO_update_uistate(lphc);
146 #endif
147 
148  /* some braindead apps do try to use scrollbar/border flags */
149 
150  lphc->dwStyle = style & ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
152 
153  /*
154  * We also have to remove the client edge style to make sure
155  * we don't end-up with a non client area.
156  */
159 
161  lphc->dwStyle |= CBS_HASSTRINGS;
163  lphc->wState |= CBF_NOTIFY;
164 
165  TRACE("[%p], style = %08x\n", lphc, lphc->dwStyle );
166  return TRUE;
167  }
168  return FALSE;
169 }
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
UINT wState
Definition: comctl32.h:141
#define GWL_EXSTYLE
Definition: winuser.h:845
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define CBS_OWNERDRAWVARIABLE
Definition: winuser.h:290
#define CBS_HASSTRINGS
Definition: winuser.h:285
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WS_HSCROLL
Definition: pedump.c:628
static BOOL COMBO_Init(void)
Definition: combo.c:88
#define GWL_STYLE
Definition: winuser.h:846
#define WS_BORDER
Definition: pedump.c:625
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
HWND self
Definition: comctl32.h:136
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_VSCROLL
Definition: pedump.c:627
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SetWindowLongPtrW
Definition: winuser.h:5247
Arabic default style
Definition: afstyles.h:93
UINT dwStyle
Definition: comctl32.h:138

Referenced by ComboWndProc_common().

◆ COMBO_NCDestroy()

static LRESULT COMBO_NCDestroy ( LPHEADCOMBO  lphc)
static

Definition at line 174 of file combo.c.

175 {
176 
177  if( lphc )
178  {
179  TRACE("[%p]: freeing storage\n", lphc->self);
180 
181  if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox )
182  DestroyWindow( lphc->hWndLBox );
183 
184  SetWindowLongPtrW( lphc->self, 0, 0 );
185  HeapFree( GetProcessHeap(), 0, lphc );
186  }
187  return 0;
188 }
#define CB_GETTYPE(lphc)
Definition: combo.c:42
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CBS_SIMPLE
Definition: winuser.h:291
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
HWND self
Definition: comctl32.h:136
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by ComboWndProc_common().

◆ COMBO_Paint()

static LRESULT COMBO_Paint ( LPHEADCOMBO  lphc,
HDC  hParamDC 
)
static

Definition at line 856 of file combo.c.

857 {
858  PAINTSTRUCT ps;
859  HDC hDC;
860 
861  hDC = (hParamDC) ? hParamDC
862  : BeginPaint( lphc->self, &ps);
863 
864  TRACE("hdc=%p\n", hDC);
865 
866  if( hDC && !(lphc->wState & CBF_NOREDRAW) )
867  {
868  HBRUSH hPrevBrush, hBkgBrush;
869 
870  /*
871  * Retrieve the background brush and select it in the
872  * DC.
873  */
874  hBkgBrush = COMBO_PrepareColors(lphc, hDC);
875 
876  hPrevBrush = SelectObject( hDC, hBkgBrush );
877  if (!(lphc->wState & CBF_EDIT))
878  FillRect(hDC, &lphc->textRect, hBkgBrush);
879 
880  /*
881  * In non 3.1 look, there is a sunken border on the combobox
882  */
883  CBPaintBorder(lphc->self, lphc, hDC);
884 
885  if( !IsRectEmpty(&lphc->buttonRect) )
886  {
887  CBPaintButton(lphc, hDC, lphc->buttonRect);
888  }
889 
890  /* paint the edit control padding area */
891  if (CB_GETTYPE(lphc) != CBS_DROPDOWNLIST)
892  {
893  RECT rPadEdit = lphc->textRect;
894 
896 
897  FrameRect( hDC, &rPadEdit, GetSysColorBrush(COLOR_WINDOW) );
898  }
899 
900  if( !(lphc->wState & CBF_EDIT) )
901  CBPaintText( lphc, hDC );
902 
903  if( hPrevBrush )
904  SelectObject( hDC, hPrevBrush );
905  }
906 
907  if( !hParamDC )
908  EndPaint(lphc->self, &ps);
909 
910  return 0;
911 }
#define EDIT_CONTROL_PADDING()
Definition: combo.c:61
static void CBPaintButton(LPHEADCOMBO lphc, HDC hdc, RECT rectButton)
Definition: combo.c:626
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
static void CBPaintBorder(HWND hwnd, const HEADCOMBO *lphc, HDC hdc)
Definition: combo.c:831
UINT wState
Definition: comctl32.h:141
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
static HBRUSH COMBO_PrepareColors(LPHEADCOMBO lphc, HDC hDC)
Definition: combo.c:651
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define COLOR_WINDOW
Definition: winuser.h:908
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
RECT textRect
Definition: comctl32.h:143
#define TRACE(s)
Definition: solgame.cpp:4
static void CBPaintText(LPHEADCOMBO lphc, HDC hdc_paint)
Definition: combo.c:700
static HDC hDC
Definition: 3dtext.c:33
HWND self
Definition: comctl32.h:136
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)

Referenced by ComboWndProc_common().

◆ COMBO_PrepareColors()

static HBRUSH COMBO_PrepareColors ( LPHEADCOMBO  lphc,
HDC  hDC 
)
static

Definition at line 651 of file combo.c.

654 {
655  HBRUSH hBkgBrush;
656 
657  /*
658  * Get the background brush for this control.
659  */
660  if (CB_DISABLED(lphc))
661  {
662 #ifdef __REACTOS__
663  hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLORSTATIC);
664 #else
665  hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLORSTATIC,
666  (WPARAM)hDC, (LPARAM)lphc->self );
667 #endif
668  /*
669  * We have to change the text color since WM_CTLCOLORSTATIC will
670  * set it to the "enabled" color. This is the same behavior as the
671  * edit control
672  */
674  }
675  else
676  {
677  /* FIXME: In which cases WM_CTLCOLORLISTBOX should be sent? */
678 #ifdef __REACTOS__
679  hBkgBrush = GetControlColor(lphc->owner, lphc->self, hDC, WM_CTLCOLOREDIT);
680 #else
681  hBkgBrush = (HBRUSH)SendMessageW(lphc->owner, WM_CTLCOLOREDIT,
682  (WPARAM)hDC, (LPARAM)lphc->self );
683 #endif
684  }
685 
686  /*
687  * Catch errors.
688  */
689  if( !hBkgBrush )
690  hBkgBrush = GetSysColorBrush(COLOR_WINDOW);
691 
692  return hBkgBrush;
693 }
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
UINT_PTR WPARAM
Definition: windef.h:207
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:145
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_DISABLED(lphc)
Definition: combo.c:36
#define COLOR_GRAYTEXT
Definition: winuser.h:922
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
static HDC hDC
Definition: 3dtext.c:33
HWND self
Definition: comctl32.h:136
#define WM_CTLCOLOREDIT
Definition: winuser.h:1749
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND owner
Definition: comctl32.h:137
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by CBPaintText(), and COMBO_Paint().

◆ COMBO_SelectString()

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

Definition at line 1654 of file combo.c.

1655 {
1656  INT index = unicode ? SendMessageW(lphc->hWndLBox, LB_SELECTSTRING, (WPARAM)start, pText) :
1657  SendMessageA(lphc->hWndLBox, LB_SELECTSTRING, (WPARAM)start, pText);
1658  if( index >= 0 )
1659  {
1660  if( lphc->wState & CBF_EDIT )
1661  CBUpdateEdit( lphc, index );
1662  else
1663  {
1664  InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1665  }
1666  }
1667  return (LRESULT)index;
1668 }
#define TRUE
Definition: types.h:120
LPCSTR pText
Definition: txtscale.cpp:79
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT wState
Definition: comctl32.h:141
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT
Definition: typedefs.h:56
#define LB_SELECTSTRING
Definition: winuser.h:2038
GLuint index
Definition: glext.h:6031
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define index(s, c)
Definition: various.h:29
HWND self
Definition: comctl32.h:136
GLuint start
Definition: gl.h:1545
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void CBUpdateEdit(LPHEADCOMBO lphc, INT index)
Definition: combo.c:952
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by ComboWndProc_common().

◆ COMBO_SetFocus()

static void COMBO_SetFocus ( LPHEADCOMBO  lphc)
static

Definition at line 1169 of file combo.c.

1170 {
1171  if( !(lphc->wState & CBF_FOCUSED) )
1172  {
1173  if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
1174  SendMessageW(lphc->hWndLBox, LB_CARETON, 0, 0);
1175 
1176  /* This is wrong. Message sequences seem to indicate that this
1177  is set *after* the notify. */
1178  /* lphc->wState |= CBF_FOCUSED; */
1179 
1180  if( !(lphc->wState & CBF_EDIT) )
1181  InvalidateRect(lphc->self, &lphc->textRect, TRUE);
1182 
1183  CB_NOTIFY( lphc, CBN_SETFOCUS );
1184  lphc->wState |= CBF_FOCUSED;
1185  }
1186 }
#define CBN_SETFOCUS
Definition: winuser.h:1964
#define LB_CARETON
Definition: undocuser.h:50
#define TRUE
Definition: types.h:120
UINT wState
Definition: comctl32.h:141
#define CB_GETTYPE(lphc)
Definition: combo.c:42
#define CB_NOTIFY(lphc, code)
Definition: combo.c:32
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
RECT textRect
Definition: comctl32.h:143
HWND hWndLBox
Definition: comctl32.h:140
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by COMBO_Command(), and ComboWndProc_common().

◆ COMBO_SetItemHeight()

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

Definition at line 1615 of file combo.c.

1616 {
1617  LRESULT lRet = CB_ERR;
1618 
1619  if( index == -1 ) /* set text field height */
1620  {
1621  if( height < 32768 )
1622  {
1623  lphc->editHeight = height + 2; /* Is the 2 for 2*EDIT_CONTROL_PADDING? */
1624 
1625  /*
1626  * Redo the layout of the control.
1627  */
1628  if ( CB_GETTYPE(lphc) == CBS_SIMPLE)
1629  {
1630  CBCalcPlacement(lphc->self,
1631  lphc,
1632  &lphc->textRect,
1633  &lphc->buttonRect,
1634  &lphc->droppedRect);
1635 
1636  CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, TRUE );
1637  }
1638  else
1639  {
1640  CBForceDummyResize(lphc);
1641  }
1642 
1643  lRet = height;
1644  }
1645  }
1646  else if ( CB_OWNERDRAWN(lphc) ) /* set listbox item height */
1648  return lRet;
1649 }
#define TRUE
Definition: types.h:120
static void CBCalcPlacement(HWND hwnd, LPHEADCOMBO lphc, LPRECT lprEdit, LPRECT lprButton, LPRECT lprLB)
Definition: combo.c:328
INT editHeight
Definition: comctl32.h:149
RECT droppedRect
Definition: comctl32.h:145
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_SETITEMHEIGHT
Definition: winuser.h:2048
#define CBS_SIMPLE
Definition: winuser.h:291
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
RECT textRect
Definition: comctl32.h:143
#define CB_ERR
Definition: winuser.h:2410
HWND hWndLBox
Definition: comctl32.h:140
#define CB_OWNERDRAWN(lphc)
Definition: combo.c:37
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
static void CBForceDummyResize(LPHEADCOMBO lphc)
Definition: combo.c:297
HWND self
Definition: comctl32.h:136
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG_PTR LRESULT
Definition: windef.h:209
static void CBResetPos(LPHEADCOMBO lphc, const RECT *rectEdit, const RECT *rectLB, BOOL bRedraw)
Definition: combo.c:1484

Referenced by ComboWndProc_common().

◆ COMBO_Size()

static void COMBO_Size ( LPHEADCOMBO  lphc)
static

Definition at line 1526 of file combo.c.

1527 {
1528  /*
1529  * Those controls are always the same height. So we have to make sure
1530  * they are not resized to another value.
1531  */
1532  if( CB_GETTYPE(lphc) != CBS_SIMPLE )
1533  {
1534  int newComboHeight, curComboHeight, curComboWidth;
1535  RECT rc;
1536 
1537  GetWindowRect(lphc->self, &rc);
1538  curComboHeight = rc.bottom - rc.top;
1539  curComboWidth = rc.right - rc.left;
1540  newComboHeight = CBGetTextAreaHeight(lphc->self, lphc) + 2*COMBO_YBORDERSIZE();
1541 
1542  /*
1543  * Resizing a combobox has another side effect, it resizes the dropped
1544  * rectangle as well. However, it does it only if the new height for the
1545  * combobox is more than the height it should have. In other words,
1546  * if the application resizing the combobox only had the intention to resize
1547  * the actual control, for example, to do the layout of a dialog that is
1548  * resized, the height of the dropdown is not changed.
1549  */
1550  if( curComboHeight > newComboHeight )
1551  {
1552  TRACE("oldComboHeight=%d, newComboHeight=%d, oldDropBottom=%d, oldDropTop=%d\n",
1553  curComboHeight, newComboHeight, lphc->droppedRect.bottom,
1554  lphc->droppedRect.top);
1555  lphc->droppedRect.bottom = lphc->droppedRect.top + curComboHeight - newComboHeight;
1556  }
1557  /*
1558  * Restore original height
1559  */
1560  if( curComboHeight != newComboHeight )
1561  SetWindowPos(lphc->self, 0, 0, 0, curComboWidth, newComboHeight,
1563  }
1564 
1565  CBCalcPlacement(lphc->self,
1566  lphc,
1567  &lphc->textRect,
1568  &lphc->buttonRect,
1569  &lphc->droppedRect);
1570 
1571  CBResetPos( lphc, &lphc->textRect, &lphc->droppedRect, FALSE );
1572 }
static INT CBGetTextAreaHeight(HWND hwnd, LPHEADCOMBO lphc)
Definition: combo.c:202
static void CBCalcPlacement(HWND hwnd, LPHEADCOMBO lphc, LPRECT lprEdit, LPRECT lprButton, LPRECT lprLB)
Definition: combo.c:328
LONG top
Definition: windef.h:292
RECT droppedRect
Definition: comctl32.h:145
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
LONG left
Definition: windef.h:291
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:293
#define CBS_SIMPLE
Definition: winuser.h:291
RECT textRect
Definition: comctl32.h:143
#define TRACE(s)
Definition: solgame.cpp:4
#define SWP_NOACTIVATE
Definition: winuser.h:1227
HWND self
Definition: comctl32.h:136
#define SWP_NOREDRAW
Definition: winuser.h:1231
#define COMBO_YBORDERSIZE()
Definition: combo.c:59
LONG bottom
Definition: windef.h:294
#define SWP_NOMOVE
Definition: winuser.h:1229
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)
static void CBResetPos(LPHEADCOMBO lphc, const RECT *rectEdit, const RECT *rectLB, BOOL bRedraw)
Definition: combo.c:1484

Referenced by ComboWndProc_common().

◆ ComboWndProc_common()

LRESULT WINAPI ComboWndProc_common ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam,
BOOL  unicode 
)

Definition at line 1822 of file combo.c.

1823 {
1825 #ifdef __REACTOS__
1826  PWND pWnd;
1827 
1828  pWnd = ValidateHwnd(hwnd);
1829  if (pWnd)
1830  {
1831  if (!pWnd->fnid)
1832  {
1834  }
1835  else
1836  {
1837  if (pWnd->fnid != FNID_COMBOBOX)
1838  {
1839  ERR("Wrong window class for ComboBox! fnId 0x%x\n",pWnd->fnid);
1840  return 0;
1841  }
1842  }
1843  }
1844 #endif
1845 
1846  TRACE("[%p]: msg %s wp %08lx lp %08lx\n",
1848 
1849 #ifndef __REACTOS__
1850  if (!IsWindow(hwnd)) return 0;
1851 #endif
1852 
1853  if( lphc || message == WM_NCCREATE )
1854  switch(message)
1855  {
1856 
1857  /* System messages */
1858 
1859  case WM_NCCREATE:
1860  {
1861  LONG style = unicode ? ((LPCREATESTRUCTW)lParam)->style :
1862  ((LPCREATESTRUCTA)lParam)->style;
1863  return COMBO_NCCreate(hwnd, style);
1864  }
1865  case WM_NCDESTROY:
1866  COMBO_NCDestroy(lphc);
1867 #ifdef __REACTOS__
1869 #endif
1870  break;/* -> DefWindowProc */
1871 
1872  case WM_CREATE:
1873  {
1874  HWND hwndParent;
1875  LONG style;
1876  if(unicode)
1877  {
1878  hwndParent = ((LPCREATESTRUCTW)lParam)->hwndParent;
1879  style = ((LPCREATESTRUCTW)lParam)->style;
1880  }
1881  else
1882  {
1883  hwndParent = ((LPCREATESTRUCTA)lParam)->hwndParent;
1884  style = ((LPCREATESTRUCTA)lParam)->style;
1885  }
1886  return COMBO_Create(hwnd, lphc, hwndParent, style, unicode);
1887  }
1888 
1889  case WM_PRINTCLIENT:
1890  /* Fallthrough */
1891  case WM_PAINT:
1892  /* wParam may contain a valid HDC! */
1893  return COMBO_Paint(lphc, (HDC)wParam);
1894 
1895  case WM_ERASEBKGND:
1896  /* do all painting in WM_PAINT like Windows does */
1897  return 1;
1898 
1899  case WM_GETDLGCODE:
1900  {
1902  if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
1903  {
1904  int vk = (int)((LPMSG)lParam)->wParam;
1905 
1906  if ((vk == VK_RETURN || vk == VK_ESCAPE) && (lphc->wState & CBF_DROPPED))
1908  }
1909  return result;
1910  }
1911  case WM_SIZE:
1912  if( lphc->hWndLBox &&
1913  !(lphc->wState & CBF_NORESIZE) ) COMBO_Size( lphc );
1914  return TRUE;
1915  case WM_SETFONT:
1916  COMBO_Font( lphc, (HFONT)wParam, (BOOL)lParam );
1917  return TRUE;
1918  case WM_GETFONT:
1919  return (LRESULT)lphc->hFont;
1920  case WM_SETFOCUS:
1921  if( lphc->wState & CBF_EDIT ) {
1922  SetFocus( lphc->hWndEdit );
1923  /* The first time focus is received, select all the text */
1924  if( !(lphc->wState & CBF_BEENFOCUSED) ) {
1925  SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
1926  lphc->wState |= CBF_BEENFOCUSED;
1927  }
1928  }
1929  else
1930  COMBO_SetFocus( lphc );
1931  return TRUE;
1932  case WM_KILLFOCUS:
1933  {
1934  HWND hwndFocus = WIN_GetFullHandle( (HWND)wParam );
1935  if( !hwndFocus ||
1936  (hwndFocus != lphc->hWndEdit && hwndFocus != lphc->hWndLBox ))
1937  COMBO_KillFocus( lphc );
1938  return TRUE;
1939  }
1940  case WM_COMMAND:
1941  return COMBO_Command( lphc, wParam, WIN_GetFullHandle( (HWND)lParam ) );
1942  case WM_GETTEXT:
1943  return unicode ? COMBO_GetTextW( lphc, wParam, (LPWSTR)lParam )
1944  : COMBO_GetTextA( lphc, wParam, (LPSTR)lParam );
1945  case WM_SETTEXT:
1946  case WM_GETTEXTLENGTH:
1947  case WM_CLEAR:
1948  if ((message == WM_GETTEXTLENGTH) && !ISWIN31 && !(lphc->wState & CBF_EDIT))
1949  {
1950  int j = SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
1951  if (j == -1) return 0;
1952  return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, j, 0) :
1953  SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, j, 0);
1954  }
1955  else if( lphc->wState & CBF_EDIT )
1956  {
1957  LRESULT ret;
1958  lphc->wState |= CBF_NOEDITNOTIFY;
1959  ret = unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
1960  SendMessageA(lphc->hWndEdit, message, wParam, lParam);
1961  lphc->wState &= ~CBF_NOEDITNOTIFY;
1962  return ret;
1963  }
1964  else return CB_ERR;
1965  case WM_CUT:
1966  case WM_PASTE:
1967  case WM_COPY:
1968  if( lphc->wState & CBF_EDIT )
1969  {
1970  return unicode ? SendMessageW(lphc->hWndEdit, message, wParam, lParam) :
1971  SendMessageA(lphc->hWndEdit, message, wParam, lParam);
1972  }
1973  else return CB_ERR;
1974 
1975  case WM_DRAWITEM:
1976  case WM_DELETEITEM:
1977  case WM_COMPAREITEM:
1978  case WM_MEASUREITEM:
1979  return COMBO_ItemOp(lphc, message, lParam);
1980  case WM_ENABLE:
1981  if( lphc->wState & CBF_EDIT )
1982  EnableWindow( lphc->hWndEdit, (BOOL)wParam );
1983  EnableWindow( lphc->hWndLBox, (BOOL)wParam );
1984 
1985  /* Force the control to repaint when the enabled state changes. */
1986  InvalidateRect(lphc->self, NULL, TRUE);
1987  return TRUE;
1988  case WM_SETREDRAW:
1989  if( wParam )
1990  lphc->wState &= ~CBF_NOREDRAW;
1991  else
1992  lphc->wState |= CBF_NOREDRAW;
1993 
1994  if( lphc->wState & CBF_EDIT )
1997  return 0;
1998  case WM_SYSKEYDOWN:
1999 #ifdef __REACTOS__
2000  if( KF_ALTDOWN & HIWORD(lParam) )
2001 #else
2002  if( KEYDATA_ALT & HIWORD(lParam) )
2003 #endif
2004  if( wParam == VK_UP || wParam == VK_DOWN )
2005  COMBO_FlipListbox( lphc, FALSE, FALSE );
2006  return 0;
2007 
2008  case WM_KEYDOWN:
2009  if ((wParam == VK_RETURN || wParam == VK_ESCAPE) &&
2010  (lphc->wState & CBF_DROPPED))
2011  {
2012  CBRollUp( lphc, wParam == VK_RETURN, FALSE );
2013  return TRUE;
2014  }
2015  else if ((wParam == VK_F4) && !(lphc->wState & CBF_EUI))
2016  {
2017  COMBO_FlipListbox( lphc, FALSE, FALSE );
2018  return TRUE;
2019  }
2020  /* fall through */
2021  case WM_CHAR:
2022  case WM_IME_CHAR:
2023  {
2024  HWND hwndTarget;
2025 
2026  if( lphc->wState & CBF_EDIT )
2027  hwndTarget = lphc->hWndEdit;
2028  else
2029  hwndTarget = lphc->hWndLBox;
2030 
2031  return unicode ? SendMessageW(hwndTarget, message, wParam, lParam) :
2032  SendMessageA(hwndTarget, message, wParam, lParam);
2033  }
2034  case WM_LBUTTONDOWN:
2035  if( !(lphc->wState & CBF_FOCUSED) ) SetFocus( lphc->self );
2036  if( lphc->wState & CBF_FOCUSED ) COMBO_LButtonDown( lphc, lParam );
2037  return TRUE;
2038  case WM_LBUTTONUP:
2039  COMBO_LButtonUp( lphc );
2040  return TRUE;
2041  case WM_MOUSEMOVE:
2042  if( lphc->wState & CBF_CAPTURE )
2043  COMBO_MouseMove( lphc, wParam, lParam );
2044  return TRUE;
2045 
2046  case WM_MOUSEWHEEL:
2047  if (wParam & (MK_SHIFT | MK_CONTROL))
2048  return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
2050 
2051  if (GET_WHEEL_DELTA_WPARAM(wParam) > 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_UP, 0);
2052  if (GET_WHEEL_DELTA_WPARAM(wParam) < 0) return SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0);
2053  return TRUE;
2054 
2055  /* Combo messages */
2056 
2057  case CB_ADDSTRING:
2058  if( unicode )
2059  {
2060  if( lphc->dwStyle & CBS_LOWERCASE )
2062  else if( lphc->dwStyle & CBS_UPPERCASE )
2064  return SendMessageW(lphc->hWndLBox, LB_ADDSTRING, 0, lParam);
2065  }
2066  else /* unlike the unicode version, the ansi version does not overwrite
2067  the string if converting case */
2068  {
2069  char *string = NULL;
2070  LRESULT ret;
2071  if( lphc->dwStyle & CBS_LOWERCASE )
2072  {
2073  string = strdupA((LPSTR)lParam);
2074  CharLowerA(string);
2075  }
2076 
2077  else if( lphc->dwStyle & CBS_UPPERCASE )
2078  {
2079  string = strdupA((LPSTR)lParam);
2080  CharUpperA(string);
2081  }
2082 
2083  ret = SendMessageA(lphc->hWndLBox, LB_ADDSTRING, 0, string ? (LPARAM)string : lParam);
2084  HeapFree(GetProcessHeap(), 0, string);
2085  return ret;
2086  }
2087  case CB_INSERTSTRING:
2088  if( unicode )
2089  {
2090  if( lphc->dwStyle & CBS_LOWERCASE )
2092  else if( lphc->dwStyle & CBS_UPPERCASE )
2095  }
2096  else
2097  {
2098  if( lphc->dwStyle & CBS_LOWERCASE )
2100  else if( lphc->dwStyle & CBS_UPPERCASE )
2102 
2104  }
2105  case CB_DELETESTRING:
2106  return unicode ? SendMessageW(lphc->hWndLBox, LB_DELETESTRING, wParam, 0) :
2107  SendMessageA(lphc->hWndLBox, LB_DELETESTRING, wParam, 0);
2108  case CB_SELECTSTRING:
2109  return COMBO_SelectString(lphc, (INT)wParam, lParam, unicode);
2110  case CB_FINDSTRING:
2111  return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam) :
2112  SendMessageA(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam);
2113  case CB_FINDSTRINGEXACT:
2114  return unicode ? SendMessageW(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam) :
2115  SendMessageA(lphc->hWndLBox, LB_FINDSTRINGEXACT, wParam, lParam);
2116  case CB_SETITEMHEIGHT:
2117  return COMBO_SetItemHeight( lphc, (INT)wParam, (INT)lParam);
2118  case CB_GETITEMHEIGHT:
2119  if( (INT)wParam >= 0 ) /* listbox item */
2120  return SendMessageW(lphc->hWndLBox, LB_GETITEMHEIGHT, wParam, 0);
2121  return CBGetTextAreaHeight(hwnd, lphc);
2122  case CB_RESETCONTENT:
2123  SendMessageW(lphc->hWndLBox, LB_RESETCONTENT, 0, 0);
2124  if( (lphc->wState & CBF_EDIT) && CB_HASSTRINGS(lphc) )
2125  {
2126  static const WCHAR empty_stringW[] = { 0 };
2128  }
2129  else
2130  InvalidateRect(lphc->self, NULL, TRUE);
2131  return TRUE;
2132  case CB_INITSTORAGE:
2135  return SendMessageW(lphc->hWndLBox, LB_GETHORIZONTALEXTENT, 0, 0);
2138  case CB_GETTOPINDEX:
2139  return SendMessageW(lphc->hWndLBox, LB_GETTOPINDEX, 0, 0);
2140  case CB_GETLOCALE:
2141  return SendMessageW(lphc->hWndLBox, LB_GETLOCALE, 0, 0);
2142  case CB_SETLOCALE:
2143  return SendMessageW(lphc->hWndLBox, LB_SETLOCALE, wParam, 0);
2144  case CB_SETDROPPEDWIDTH:
2145  if( (CB_GETTYPE(lphc) == CBS_SIMPLE) ||
2146  (INT)wParam >= 32768 )
2147  return CB_ERR;
2148  /* new value must be higher than combobox width */
2149  if((INT)wParam >= lphc->droppedRect.right - lphc->droppedRect.left)
2150  lphc->droppedWidth = wParam;
2151  else if(wParam)
2152  lphc->droppedWidth = 0;
2153 
2154  /* recalculate the combobox area */
2155  CBCalcPlacement(hwnd, lphc, &lphc->textRect, &lphc->buttonRect, &lphc->droppedRect );
2156 
2157  /* fall through */
2158  case CB_GETDROPPEDWIDTH:
2159  if( lphc->droppedWidth )
2160  return lphc->droppedWidth;
2161  return lphc->droppedRect.right - lphc->droppedRect.left;
2164  return CB_OKAY;
2165  case CB_GETDROPPEDSTATE:
2166  return (lphc->wState & CBF_DROPPED) != 0;
2167  case CB_DIR:
2168  return unicode ? SendMessageW(lphc->hWndLBox, LB_DIR, wParam, lParam) :
2169  SendMessageA(lphc->hWndLBox, LB_DIR, wParam, lParam);
2170 
2171  case CB_SHOWDROPDOWN:
2172  if( CB_GETTYPE(lphc) != CBS_SIMPLE )
2173  {
2174  if( wParam )
2175  {
2176  if( !(lphc->wState & CBF_DROPPED) )
2177  CBDropDown( lphc );
2178  }
2179  else
2180  if( lphc->wState & CBF_DROPPED )
2181  CBRollUp( lphc, FALSE, TRUE );
2182  }
2183  return TRUE;
2184  case CB_GETCOUNT:
2185  return SendMessageW(lphc->hWndLBox, LB_GETCOUNT, 0, 0);
2186  case CB_GETCURSEL:
2187  return SendMessageW(lphc->hWndLBox, LB_GETCURSEL, 0, 0);
2188  case CB_SETCURSEL:
2190  if( lParam >= 0 )
2192 
2193  /* no LBN_SELCHANGE in this case, update manually */
2194  CBPaintText( lphc, NULL );
2195  lphc->wState &= ~CBF_SELCHANGE;
2196  return lParam;
2197  case CB_GETLBTEXT:
2198  return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXT, wParam, lParam) :
2199  SendMessageA(lphc->hWndLBox, LB_GETTEXT, wParam, lParam);
2200  case CB_GETLBTEXTLEN:
2201  return unicode ? SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0) :
2202  SendMessageA(lphc->hWndLBox, LB_GETTEXTLEN, wParam, 0);
2203  case CB_GETITEMDATA:
2204  return SendMessageW(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0);
2205  case CB_SETITEMDATA:
2207  case CB_GETEDITSEL:
2208  /* Edit checks passed parameters itself */
2209  if( lphc->wState & CBF_EDIT )
2210  return SendMessageW(lphc->hWndEdit, EM_GETSEL, wParam, lParam);
2211  return CB_ERR;
2212  case CB_SETEDITSEL:
2213  if( lphc->wState & CBF_EDIT )
2214  return SendMessageW(lphc->hWndEdit, EM_SETSEL,
2216  return CB_ERR;
2217  case CB_SETEXTENDEDUI:
2218  if( CB_GETTYPE(lphc) == CBS_SIMPLE )
2219  return CB_ERR;
2220  if( wParam )
2221  lphc->wState |= CBF_EUI;
2222  else lphc->wState &= ~CBF_EUI;
2223  return CB_OKAY;
2224  case CB_GETEXTENDEDUI:
2225  return (lphc->wState & CBF_EUI) != 0;
2226  case CB_GETCOMBOBOXINFO:
2227  return COMBO_GetComboBoxInfo(lphc, (COMBOBOXINFO *)lParam);
2228  case CB_LIMITTEXT:
2229  if( lphc->wState & CBF_EDIT )
2230  return SendMessageW(lphc->hWndEdit, EM_LIMITTEXT, wParam, lParam);
2231  return TRUE;
2232 
2233 #ifdef __REACTOS__
2234  case WM_UPDATEUISTATE:
2235  if (unicode)
2237  else
2239 
2240  if (COMBO_update_uistate(lphc))
2241  {
2242  /* redraw text */
2243  if( !(lphc->wState & CBF_EDIT) )
2244  NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
2245  }
2246  break;
2247 
2248  case WM_CBLOSTTEXTFOCUS: /* undocumented message - deselects the text when focus is lost */
2249  if (lphc->hWndEdit != NULL)
2250  {
2251  SendMessage(lphc->self, WM_LBUTTONUP, 0, 0xFFFFFFFF);
2252  SendMessage(lphc->hWndEdit, EM_SETSEL, 0, 0);
2253  lphc->wState &= ~(CBF_FOCUSED | CBF_BEENFOCUSED);
2254  CB_NOTIFY(lphc, CBN_KILLFOCUS);
2255  }
2256  return TRUE;
2257 
2258 #endif
2259 
2260  default:
2261  if (message >= WM_USER)
2262  WARN("unknown msg WM_USER+%04x wp=%04lx lp=%08lx\n",
2263  message - WM_USER, wParam, lParam );
2264  break;
2265  }
2266  return unicode ? DefWindowProcW(hwnd, message, wParam, lParam) :
2268 }
#define EM_LIMITTEXT
Definition: winuser.h:1982
#define CB_GETTOPINDEX
Definition: winuser.h:1937
#define LB_SETCURSEL
Definition: winuser.h:2045
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define CB_SETITEMDATA
Definition: winuser.h:1948
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static INT CBGetTextAreaHeight(HWND hwnd, LPHEADCOMBO lphc)
Definition: combo.c:202
static void COMBO_KillFocus(LPHEADCOMBO lphc)
Definition: combo.c:1191
#define LB_SETLOCALE
Definition: winuser.h:2049
Definition: tftpd.h:59
#define CB_GETLBTEXTLEN
Definition: winuser.h:1935
#define TRUE
Definition: types.h:120
#define DLGC_WANTCHARS
Definition: winuser.h:2593
static void COMBO_Font(LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw)
Definition: combo.c:1578
#define LB_DIR
Definition: winuser.h:2015
#define FNID_COMBOBOX
Definition: ntuser.h:829
#define DLGC_WANTMESSAGE
Definition: winuser.h:2588
#define MK_SHIFT
Definition: winuser.h:2344
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1927
#define LB_FINDSTRINGEXACT
Definition: winuser.h:2017
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_CHAR
Definition: winuser.h:1699
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
#define LB_SETHORIZONTALEXTENT
Definition: winuser.h:2046
#define WM_CUT
Definition: winuser.h:1843
#define WM_IME_CHAR
Definition: winuser.h:1816
#define LB_ADDSTRING
Definition: winuser.h:2013
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define LB_GETHORIZONTALEXTENT
Definition: winuser.h:2022
static void CBCalcPlacement(HWND hwnd, LPHEADCOMBO lphc, LPRECT lprEdit, LPRECT lprButton, LPRECT lprLB)
Definition: combo.c:328
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1944
#define CB_SETHORIZONTALEXTENT
Definition: winuser.h:1947
#define CB_GETLBTEXT
Definition: winuser.h:1934
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define LB_GETITEMDATA
Definition: winuser.h:2023
#define CB_GETITEMDATA
Definition: winuser.h:1932
UINT wState
Definition: comctl32.h:141
#define WM_GETTEXT
Definition: winuser.h:1600
#define WARN(fmt,...)
Definition: debug.h:111
LPWSTR WINAPI CharLowerW(_Inout_ LPWSTR)
static LRESULT COMBO_Create(HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG style, BOOL unicode)
Definition: combo.c:453
static HDC
Definition: imagelist.c:92
#define WM_SETREDRAW
Definition: winuser.h:1598
static LRESULT COMBO_GetTextW(LPHEADCOMBO lphc, INT count, LPWSTR buf)
Definition: combo.c:1384
HWND hWndEdit
Definition: comctl32.h:139
#define WM_PASTE
Definition: winuser.h:1845
RECT droppedRect
Definition: comctl32.h:145
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CB_GETTYPE(lphc)
Definition: combo.c:42
RECT buttonRect
Definition: comctl32.h:144
#define VK_DOWN
Definition: winuser.h:2202
#define GetWindowLongPtrW
Definition: winuser.h:4730
LONG left
Definition: windef.h:291
#define CB_SETLOCALE
Definition: winuser.h:1950
#define FNID_DESTROY
Definition: ntuser.h:859
#define CB_NOTIFY(lphc, code)
Definition: combo.c:32
#define CB_HASSTRINGS(lphc)
Definition: combo.c:38
#define WM_CBLOSTTEXTFOCUS
Definition: undocuser.h:49
char * LPSTR
Definition: xmlstorage.h:182
#define VK_ESCAPE
Definition: winuser.h:2189
#define WM_CLEAR
Definition: winuser.h:1846
LONG right
Definition: windef.h:293
static void COMBO_LButtonDown(LPHEADCOMBO lphc, LPARAM lParam)
Definition: combo.c:1673
#define WM_NCCREATE
Definition: winuser.h:1665
BOOL NTAPI NtUserInvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase)
Definition: painting.c:2532
int32_t INT
Definition: typedefs.h:56
static LRESULT COMBO_SetItemHeight(LPHEADCOMBO lphc, INT index, INT height)
Definition: combo.c:1615
#define VK_RETURN
Definition: winuser.h:2176
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
#define WM_ENABLE
Definition: winuser.h:1597
LPWSTR WINAPI CharUpperW(_Inout_ LPWSTR)
#define WM_PRINTCLIENT
Definition: richedit.h:70
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static void COMBO_Size(LPHEADCOMBO lphc)
Definition: combo.c:1526
const char * SPY_GetMsgName(UINT msg, HWND hWnd)
Definition: spy.c:2218
#define CB_SETITEMHEIGHT
Definition: winuser.h:1949
LPSTR WINAPI CharLowerA(_Inout_ LPSTR)
#define EM_GETSEL
Definition: winuser.h:1979
#define CB_GETEDITSEL
Definition: winuser.h:1929
LPSTR WINAPI CharUpperA(_Inout_ LPSTR)
struct tagCREATESTRUCTA * LPCREATESTRUCTA
#define CB_INITSTORAGE
Definition: winuser.h:1938
#define LB_RESETCONTENT
Definition: winuser.h:2037
#define CB_GETDROPPEDWIDTH
Definition: winuser.h:1928
#define VK_UP
Definition: winuser.h:2200
#define WM_COPY
Definition: winuser.h:1844
DWORD fnid
Definition: ntuser.h:673
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define WM_DELETEITEM
Definition: winuser.h:1629
#define CB_SHOWDROPDOWN
Definition: winuser.h:1952
static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
Definition: combo.c:135
#define CBN_KILLFOCUS
Definition: winuser.h:1960
#define CBS_SIMPLE
Definition: winuser.h:291
#define VK_F4
Definition: winuser.h:2233
#define CB_ADDSTRING
Definition: winuser.h:1918
#define CB_INSERTSTRING
Definition: winuser.h:1939
#define CB_GETCOMBOBOXINFO
Definition: winuser.h:1923
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
static HWND hwndParent
Definition: cryptui.c:300
#define WM_KEYDOWN
Definition: winuser.h:1697
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_LIMITTEXT
Definition: winuser.h:1940
#define LB_GETTEXTLEN
Definition: winuser.h:2032
#define LB_GETCOUNT
Definition: winuser.h:2020
#define WM_SETTEXT
Definition: winuser.h:1599
#define CB_RESETCONTENT
Definition: winuser.h:1941
RECT textRect
Definition: comctl32.h:143
#define CB_ERR
Definition: winuser.h:2410
#define LB_INITSTORAGE
Definition: winuser.h:2034
static LRESULT COMBO_NCDestroy(LPHEADCOMBO lphc)
Definition: combo.c:174
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
HWND hWndLBox
Definition: comctl32.h:140
#define TRACE(s)
Definition: solgame.cpp:4
static void COMBO_MouseMove(LPHEADCOMBO lphc, WPARAM wParam, LPARAM lParam)
Definition: combo.c:1751
#define WM_KILLFOCUS
Definition: winuser.h:1596
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1926
#define GetProcessHeap()
Definition: compat.h:395
static LRESULT COMBO_SelectString(LPHEADCOMBO lphc, INT start, LPARAM pText, BOOL unicode)
Definition: combo.c:1654
#define LB_SETTOPINDEX
Definition: winuser.h:2052
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void CBGetDroppedControlRect(LPHEADCOMBO lphc, LPRECT lpRect)
Definition: combo.c:438
#define WM_SIZE
Definition: winuser.h:1593
#define WM_NCDESTROY
Definition: winuser.h:1666
#define EM_SETSEL
Definition: winuser.h:2000
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define WM_MEASUREITEM
Definition: winuser.h:1628
HFONT hFont
Definition: comctl32.h:142
#define LB_SETITEMDATA
Definition: winuser.h:2047
#define WM_PAINT
Definition: winuser.h:1602
#define CB_GETHORIZONTALEXTENT
Definition: winuser.h:1931
int ret
INT droppedWidth
Definition: comctl32.h:148
#define KEYDATA_ALT
Definition: combo.c:44
#define ISWIN31
Definition: combo.c:45
#define LB_GETTEXT
Definition: winuser.h:2031
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
static void CBDropDown(LPHEADCOMBO lphc)
Definition: combo.c:990
struct HEADCOMBO * LPHEADCOMBO
#define CB_SELECTSTRING
Definition: winuser.h:1942
static LRESULT COMBO_GetTextA(LPHEADCOMBO lphc, INT count, LPSTR buf)
Definition: combo.c:1434
#define LB_GETLOCALE
Definition: winuser.h:2027
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1877
#define LB_GETITEMHEIGHT
Definition: winuser.h:2024
static void CBPaintText(LPHEADCOMBO lphc, HDC hdc_paint)
Definition: combo.c:700
#define CBS_UPPERCASE
Definition: winuser.h:293
static LRESULT COMBO_Command(LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd)
Definition: combo.c:1217
static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC hParamDC)
Definition: combo.c:856
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
#define CB_OKAY
Definition: winuser.h:2409
static LRESULT COMBO_ItemOp(LPHEADCOMBO lphc, UINT msg, LPARAM lParam)
Definition: combo.c:1336
#define WM_COMPAREITEM
Definition: winuser.h:1637
#define LB_FINDSTRING
Definition: winuser.h:2016
BOOL COMBO_FlipListbox(LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton)
Definition: combo.c:1117
static void COMBO_LButtonUp(LPHEADCOMBO lphc)
Definition: combo.c:1718
HWND self
Definition: comctl32.h:136
#define CB_DIR
Definition: winuser.h:1920
#define CB_SETEDITSEL
Definition: winuser.h:1945
static LRESULT COMBO_GetComboBoxInfo(const HEADCOMBO *lphc, COMBOBOXINFO *pcbi)
Definition: combo.c:1785
#define CBS_LOWERCASE
Definition: winuser.h:286
#define LB_GETTOPINDEX
Definition: winuser.h:2033
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_LBUTTONUP
Definition: winuser.h:1759
struct tagCREATESTRUCTW * LPCREATESTRUCTW
#define CB_SETEXTENDEDUI
Definition: winuser.h:1946
#define CB_GETLOCALE
Definition: winuser.h:1936
#define LB_GETCURSEL
Definition: winuser.h:2021
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define MK_CONTROL
Definition: winuser.h:2345
#define KF_ALTDOWN
Definition: winuser.h:2424
#define WM_SETFONT
Definition: winuser.h:1632
#define WM_DRAWITEM
Definition: winuser.h:1627
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define SendMessage
Definition: winuser.h:5744
#define WM_CREATE
Definition: winuser.h:1590
#define CB_GETITEMHEIGHT
Definition: winuser.h:1933
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
#define HIWORD(l)
Definition: typedefs.h:246
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4122
#define CB_GETCOUNT
Definition: winuser.h:1924
#define CB_GETEXTENDEDUI
Definition: winuser.h:1930
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define WM_SETFOCUS
Definition: winuser.h:1595
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define CB_DELETESTRING
Definition: winuser.h:1919
LONG_PTR LRESULT
Definition: windef.h:209
Arabic default style
Definition: afstyles.h:93
#define LB_DELETESTRING
Definition: winuser.h:2014
GLuint64EXT * result
Definition: glext.h:11304
#define CB_FINDSTRING
Definition: winuser.h:1921
static const WCHAR empty_stringW[]
Definition: edit.c:166
#define LB_INSERTSTRING
Definition: winuser.h:2035
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static void CBRollUp(LPHEADCOMBO lphc, BOOL ok, BOOL bButton)
Definition: combo.c:1090
#define HeapFree(x, y, z)
Definition: compat.h:394
#define DLGC_WANTARROWS
Definition: winuser.h:2585
#define WIN_GetFullHandle(h)
Definition: user_x.h:108
UINT dwStyle
Definition: comctl32.h:138
static char * strdupA(LPCSTR str)
Definition: combo.c:1803
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static void COMBO_SetFocus(LPHEADCOMBO lphc)
Definition: combo.c:1169
signed short INT16
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by RegisterClientPFN().

◆ GetComboBoxInfo()

BOOL WINAPI GetComboBoxInfo ( HWND  hwndCombo,
PCOMBOBOXINFO  pcbi 
)

Definition at line 2298 of file combo.c.

2300 {
2301  TRACE("(%p, %p)\n", hwndCombo, pcbi);
2302 #ifdef __REACTOS__
2303  return NtUserGetComboBoxInfo(hwndCombo, pcbi);
2304 #else
2305  return SendMessageW(hwndCombo, CB_GETCOMBOBOXINFO, 0, (LPARAM)pcbi);
2306 #endif
2307 }
#define CB_GETCOMBOBOXINFO
Definition: winuser.h:1923
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
BOOL NTAPI NtUserGetComboBoxInfo(HWND hWnd, PCOMBOBOXINFO pcbi)
Definition: window.c:3273
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by get_combobox_info(), test_editselection(), test_editselection_focus(), test_listbox_size(), test_listbox_styles(), test_WM_LBUTTONDOWN(), and test_WS_VSCROLL().

◆ strdupA()

static char* strdupA ( LPCSTR  str)
static

Definition at line 1803 of file combo.c.

1804 {
1805  char *ret;
1806  DWORD len;
1807 
1808  if(!str) return NULL;
1809 
1810  len = strlen(str);
1811  ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
1812 #ifdef __REACTOS__
1813  if (ret != NULL)
1814 #endif
1815  memcpy(ret, str, len + 1);
1816  return ret;
1817 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722

Referenced by ComboWndProc_common().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( combo  )

Variable Documentation

◆ CBitHeight

UINT CBitHeight
static

Definition at line 51 of file combo.c.

Referenced by COMBO_Init().

◆ CBitWidth

UINT CBitWidth
static

Definition at line 51 of file combo.c.

Referenced by COMBO_Init().

◆ COMBO_builtin_class

const struct builtin_class_descr COMBO_builtin_class
Initial value:
=
{
WINPROC_COMBO,
sizeof(HEADCOMBO *),
0
}
#define CS_HREDRAW
Definition: winuser.h:648
#define CS_VREDRAW
Definition: winuser.h:653
#define CS_DBLCLKS
Definition: winuser.h:646
#define IDC_ARROW
Definition: winuser.h:682
#define CS_PARENTDC
Definition: winuser.h:651
static const WCHAR comboboxW[]
Definition: combo.c:66

Definition at line 67 of file combo.c.

◆ comboboxW

const WCHAR comboboxW[] = {'C','o','m','b','o','B','o','x',0}
static

Definition at line 66 of file combo.c.

◆ hComboBmp

HBITMAP hComboBmp = 0
static

Definition at line 50 of file combo.c.

Referenced by COMBO_Init().