ReactOS 0.4.16-dev-336-gb667d82
comboex.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
Include dependency graph for comboex.c:

Go to the source code of this file.

Classes

struct  _CBE_ITEMDATA
 
struct  COMBOEX_INFO
 

Macros

#define WCBE_ACTEDIT
 
#define WCBE_EDITCHG   0x00000002 /* Edit issued EN_CHANGE */
 
#define WCBE_EDITHASCHANGED   (WCBE_ACTEDIT | WCBE_EDITCHG)
 
#define WCBE_EDITFOCUSED   0x00000004 /* Edit control has focus */
 
#define WCBE_MOUSECAPTURED   0x00000008 /* Combo has captured mouse */
 
#define WCBE_MOUSEDRAGGED   0x00000010 /* User has dragged in combo */
 
#define ID_CB_EDIT   1001
 
#define ODS_COMBOEXLBOX   0x4000
 
#define CBE_EXTRA   3
 
#define CBE_INDENT   10
 
#define CBE_STARTOFFSET   6
 
#define CBE_SEP   4
 
#define COMBO_SUBCLASSID   1
 
#define EDIT_SUBCLASSID   2
 
#define COMBOEX_GetInfoPtr(hwnd)   ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0))
 

Typedefs

typedef struct _CBE_ITEMDATA CBE_ITEMDATA
 
typedef INT(WINAPIcmp_func_t) (LPCWSTR, LPCWSTR)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (comboex)
 
static LRESULT CALLBACK COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR ref_data)
 
static LRESULT CALLBACK COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR ref_data)
 
static LRESULT COMBOEX_Destroy (COMBOEX_INFO *infoPtr)
 
static BOOL is_textW (LPCWSTR str)
 
static BOOL is_textA (LPCSTR str)
 
static LPCSTR debugstr_txt (LPCWSTR str)
 
static void COMBOEX_DumpItem (CBE_ITEMDATA const *item)
 
static void COMBOEX_DumpInput (COMBOBOXEXITEMW const *input)
 
static CBE_ITEMDATAget_item_data (const COMBOEX_INFO *infoPtr, INT index)
 
static cmp_func_t get_cmp_func (COMBOEX_INFO const *infoPtr)
 
static INT COMBOEX_Notify (const COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr)
 
static INT COMBOEX_NotifyItem (const COMBOEX_INFO *infoPtr, UINT code, NMCOMBOBOXEXW *hdr)
 
static INT COMBOEX_NotifyEndEdit (const COMBOEX_INFO *infoPtr, NMCBEENDEDITW *neew, LPCWSTR wstr)
 
static void COMBOEX_NotifyDragBegin (const COMBOEX_INFO *infoPtr, LPCWSTR wstr)
 
static void COMBOEX_FreeText (CBE_ITEMDATA *item)
 
static INT COMBOEX_GetIndex (COMBOEX_INFO const *infoPtr, CBE_ITEMDATA const *item)
 
static LPCWSTR COMBOEX_GetText (const COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
 
static void COMBOEX_GetComboFontSize (const COMBOEX_INFO *infoPtr, SIZE *size)
 
static void COMBOEX_CopyItem (const CBE_ITEMDATA *item, COMBOBOXEXITEMW *cit)
 
static void COMBOEX_AdjustEditPos (const COMBOEX_INFO *infoPtr)
 
static void COMBOEX_ReSize (const COMBOEX_INFO *infoPtr)
 
static void COMBOEX_SetEditText (const COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
 
static CBE_ITEMDATACOMBOEX_FindItem (COMBOEX_INFO *infoPtr, INT_PTR index)
 
static UINT COMBOEX_GetListboxText (COMBOEX_INFO *infoPtr, INT_PTR n, LPWSTR buf)
 
static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT_PTR index)
 
static BOOL COMBOEX_GetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
 
static BOOL COMBOEX_GetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
 
static BOOL COMBOEX_HasEditChanged (COMBOEX_INFO const *infoPtr)
 
static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *cit)
 
static INT COMBOEX_InsertItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
 
static DWORD COMBOEX_SetExtendedStyle (COMBOEX_INFO *infoPtr, DWORD mask, DWORD style)
 
static HIMAGELIST COMBOEX_SetImageList (COMBOEX_INFO *infoPtr, HIMAGELIST himl)
 
static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, const COMBOBOXEXITEMW *cit)
 
static BOOL COMBOEX_SetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
 
static BOOL COMBOEX_SetUnicodeFormat (COMBOEX_INFO *infoPtr, BOOL value)
 
static INT COMBOEX_FindStringExact (const COMBOEX_INFO *infoPtr, INT start, LPCWSTR str)
 
static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT_PTR index)
 
static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT_PTR index)
 
static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT_PTR index, DWORD_PTR data)
 
static INT COMBOEX_SetItemHeight (COMBOEX_INFO const *infoPtr, INT index, UINT height)
 
static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs)
 
static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam)
 
static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT const *dis)
 
static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *dis)
 
static void COMBOEX_ResetContent (COMBOEX_INFO *infoPtr)
 
static LRESULT COMBOEX_Enable (COMBOEX_INFO *infoPtr, BOOL enable)
 
static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO const *infoPtr, MEASUREITEMSTRUCT *mis)
 
static LRESULT COMBOEX_NCCreate (HWND hwnd)
 
static LRESULT COMBOEX_NotifyFormat (COMBOEX_INFO *infoPtr, LPARAM lParam)
 
static LRESULT COMBOEX_Size (COMBOEX_INFO *infoPtr, INT width, INT height)
 
static LRESULT COMBOEX_SetFont (COMBOEX_INFO *infoPtr, HFONT font, BOOL redraw)
 
static LRESULT COMBOEX_SetRedraw (const COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT COMBOEX_WindowPosChanging (const COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
 
static LRESULT WINAPI COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void COMBOEX_Register (void)
 
void COMBOEX_Unregister (void)
 

Macro Definition Documentation

◆ CBE_EXTRA

#define CBE_EXTRA   3

Definition at line 97 of file comboex.c.

◆ CBE_INDENT

#define CBE_INDENT   10

Definition at line 100 of file comboex.c.

◆ CBE_SEP

#define CBE_SEP   4

Definition at line 106 of file comboex.c.

◆ CBE_STARTOFFSET

#define CBE_STARTOFFSET   6

Definition at line 103 of file comboex.c.

◆ COMBO_SUBCLASSID

#define COMBO_SUBCLASSID   1

Definition at line 108 of file comboex.c.

◆ COMBOEX_GetInfoPtr

#define COMBOEX_GetInfoPtr (   hwnd)    ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0))

Definition at line 111 of file comboex.c.

◆ EDIT_SUBCLASSID

#define EDIT_SUBCLASSID   2

Definition at line 109 of file comboex.c.

◆ ID_CB_EDIT

#define ID_CB_EDIT   1001

Definition at line 79 of file comboex.c.

◆ ODS_COMBOEXLBOX

#define ODS_COMBOEXLBOX   0x4000

Definition at line 92 of file comboex.c.

◆ WCBE_ACTEDIT

#define WCBE_ACTEDIT
Value:
0x00000001 /* Edit active i.e.
* CBEN_BEGINEDIT issued
* but CBEN_ENDEDIT{A|W}
* not yet issued. */

Definition at line 72 of file comboex.c.

◆ WCBE_EDITCHG

#define WCBE_EDITCHG   0x00000002 /* Edit issued EN_CHANGE */

Definition at line 73 of file comboex.c.

◆ WCBE_EDITFOCUSED

#define WCBE_EDITFOCUSED   0x00000004 /* Edit control has focus */

Definition at line 75 of file comboex.c.

◆ WCBE_EDITHASCHANGED

#define WCBE_EDITHASCHANGED   (WCBE_ACTEDIT | WCBE_EDITCHG)

Definition at line 74 of file comboex.c.

◆ WCBE_MOUSECAPTURED

#define WCBE_MOUSECAPTURED   0x00000008 /* Combo has captured mouse */

Definition at line 76 of file comboex.c.

◆ WCBE_MOUSEDRAGGED

#define WCBE_MOUSEDRAGGED   0x00000010 /* User has dragged in combo */

Definition at line 77 of file comboex.c.

Typedef Documentation

◆ CBE_ITEMDATA

◆ cmp_func_t

typedef INT(WINAPI * cmp_func_t) (LPCWSTR, LPCWSTR)

Definition at line 118 of file comboex.c.

Function Documentation

◆ COMBOEX_AdjustEditPos()

static void COMBOEX_AdjustEditPos ( const COMBOEX_INFO infoPtr)
static

Definition at line 370 of file comboex.c.

374{
375 SIZE mysize;
376 INT x, y, w, h, xioff;
377 RECT rect;
378
379 if (!infoPtr->hwndEdit) return;
380
381 if (infoPtr->himl && !(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGEINDENT)) {
382 IMAGEINFO iinfo;
383 iinfo.rcImage.left = iinfo.rcImage.right = 0;
384 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
385 xioff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;
386 } else xioff = 0;
387
388 GetClientRect (infoPtr->hwndCombo, &rect);
389 InflateRect (&rect, -2, -2);
390 InvalidateRect (infoPtr->hwndCombo, &rect, TRUE);
391
392 /* reposition the Edit control based on whether icon exists */
393 COMBOEX_GetComboFontSize (infoPtr, &mysize);
394 TRACE("Combo font x=%d, y=%d\n", mysize.cx, mysize.cy);
395 x = xioff + CBE_STARTOFFSET + 1;
396 w = rect.right-rect.left - x - GetSystemMetrics(SM_CXVSCROLL) - 1;
397 h = mysize.cy + 1;
398 y = rect.bottom - h - 1;
399
400 TRACE("Combo client (%s), setting Edit to (%d,%d)-(%d,%d)\n",
401 wine_dbgstr_rect(&rect), x, y, x + w, y + h);
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define CBE_STARTOFFSET
Definition: comboex.c:103
static void COMBOEX_GetComboFontSize(const COMBOEX_INFO *infoPtr, SIZE *size)
Definition: comboex.c:325
#define CBE_SEP
Definition: comboex.c:106
#define TRUE
Definition: types.h:120
BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl, INT i, IMAGEINFO *pImageInfo)
Definition: imagelist.c:2088
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define CBES_EX_NOEDITIMAGEINDENT
Definition: commctrl.h:3857
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
DWORD dwExtStyle
Definition: comboex.c:59
HWND hwndEdit
Definition: comboex.c:58
HWND hwndCombo
Definition: comboex.c:57
HIMAGELIST himl
Definition: comboex.c:54
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
#define SM_CXVSCROLL
Definition: winuser.h:964
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)

Referenced by COMBOEX_Create(), and COMBOEX_SetExtendedStyle().

◆ COMBOEX_ComboWndProc()

static LRESULT CALLBACK COMBOEX_ComboWndProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
UINT_PTR  uId,
DWORD_PTR  ref_data 
)
static

Definition at line 1810 of file comboex.c.

1815{
1816 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr ((HWND)ref_data);
1817 NMCBEENDEDITW cbeend;
1818 NMMOUSE nmmse;
1819 COLORREF obkc;
1820 HDC hDC;
1821 HWND focusedhwnd;
1822 RECT rect;
1823 POINT pt;
1824 WCHAR edit_text[260];
1825
1826 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx, info_ptr=%p\n",
1827 hwnd, uMsg, wParam, lParam, infoPtr);
1828
1829 if (uMsg == WM_NCDESTROY)
1831
1832 if (!infoPtr)
1833 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
1834
1835 switch (uMsg)
1836 {
1837 case WM_DRAWITEM:
1838 /*
1839 * The only way this message should come is from the
1840 * child Listbox issuing the message. Flag this so
1841 * that ComboEx knows this is listbox.
1842 */
1843 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
1844 break;
1845
1846 case WM_ERASEBKGND:
1847 hDC = (HDC) wParam;
1850 TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
1851 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
1852 SetBkColor (hDC, obkc);
1853 break;
1854
1855 case WM_SETCURSOR:
1856 /*
1857 * WM_NOTIFY to comboex parent (rebar)
1858 * with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001
1859 * CallWindowProc (previous)
1860 */
1861 nmmse.dwItemSpec = 0;
1862 nmmse.dwItemData = 0;
1863 nmmse.pt.x = 0;
1864 nmmse.pt.y = 0;
1865 nmmse.dwHitInfo = lParam;
1866 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);
1867 break;
1868
1869 case WM_LBUTTONDOWN:
1871 rect.bottom = rect.top + SendMessageW(infoPtr->hwndSelf,
1872 CB_GETITEMHEIGHT, -1, 0);
1873 rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL);
1874 pt.x = (short)LOWORD(lParam);
1875 pt.y = (short)HIWORD(lParam);
1876 if (PtInRect(&rect, pt))
1877 break;
1878
1879 infoPtr->flags |= WCBE_MOUSECAPTURED;
1881 return 0;
1882
1883 case WM_LBUTTONUP:
1884 if (!(infoPtr->flags & WCBE_MOUSECAPTURED))
1885 break;
1886
1888 infoPtr->flags &= ~WCBE_MOUSECAPTURED;
1889 if (infoPtr->flags & WCBE_MOUSEDRAGGED) {
1890 infoPtr->flags &= ~WCBE_MOUSEDRAGGED;
1891 } else {
1893 }
1894 return 0;
1895
1896 case WM_MOUSEMOVE:
1897 if ( (infoPtr->flags & WCBE_MOUSECAPTURED) &&
1898 !(infoPtr->flags & WCBE_MOUSEDRAGGED)) {
1899 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1900 COMBOEX_NotifyDragBegin(infoPtr, edit_text);
1901 infoPtr->flags |= WCBE_MOUSEDRAGGED;
1902 }
1903 break;
1904
1905 case WM_COMMAND:
1906 switch (HIWORD(wParam)) {
1907
1908 case EN_UPDATE:
1909 /* traces show that COMBOEX does not issue CBN_EDITUPDATE
1910 * on the EN_UPDATE
1911 */
1912 return 0;
1913
1914 case EN_KILLFOCUS:
1915 focusedhwnd = GetFocus();
1916 if (infoPtr->flags & WCBE_ACTEDIT) {
1917 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1918 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
1919 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
1920 CB_GETCURSEL, 0, 0);
1921 cbeend.iWhy = CBENF_KILLFOCUS;
1922
1923 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1924 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) return 0;
1925 }
1926 /* possible CB_GETCURSEL */
1927 InvalidateRect (infoPtr->hwndCombo, 0, 0);
1928 if (focusedhwnd)
1930 (WPARAM)focusedhwnd, 0);
1931 return 0;
1932
1933 case EN_SETFOCUS: {
1934 NMHDR hdr;
1935
1936 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
1937 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
1938 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr);
1939 infoPtr->flags |= WCBE_ACTEDIT;
1940 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */
1941 return 0;
1942 }
1943
1944 case EN_CHANGE: {
1945 LPCWSTR lastwrk;
1946 cmp_func_t cmptext = get_cmp_func(infoPtr);
1947
1949 CB_GETCURSEL, 0, 0);
1950
1951 /* lstrlenW( lastworkingURL ) */
1952
1953 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1954 if (selected == -1) {
1955 lastwrk = infoPtr->edit.pszText;
1956 }
1957 else {
1959 lastwrk = COMBOEX_GetText(infoPtr, item);
1960 }
1961
1962 TRACE("handling EN_CHANGE, selected = %ld, selected_text=%s\n",
1963 selected, debugstr_w(lastwrk));
1964 TRACE("handling EN_CHANGE, edittext=%s\n",
1965 debugstr_w(edit_text));
1966
1967 /* cmptext is between lastworkingURL and GetWindowText */
1968 if (cmptext (lastwrk, edit_text)) {
1969 /* strings not equal -- indicate edit has changed */
1970 infoPtr->flags |= WCBE_EDITCHG;
1971 }
1973 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
1975 (LPARAM)infoPtr->hwndSelf);
1976 return 0;
1977 }
1978
1979 case LBN_SELCHANGE:
1980 default:
1981 break;
1982 }/* fall through */
1983 default:
1984 ;
1985 }
static HDC hDC
Definition: 3dtext.c:33
#define WCBE_EDITCHG
Definition: comboex.c:73
#define COMBOEX_GetInfoPtr(hwnd)
Definition: comboex.c:111
static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:444
static INT COMBOEX_Notify(const COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr)
Definition: comboex.c:170
INT(WINAPI * cmp_func_t)(LPCWSTR, LPCWSTR)
Definition: comboex.c:118
static void COMBOEX_NotifyDragBegin(const COMBOEX_INFO *infoPtr, LPCWSTR wstr)
Definition: comboex.c:239
#define WCBE_MOUSECAPTURED
Definition: comboex.c:76
static INT COMBOEX_NotifyEndEdit(const COMBOEX_INFO *infoPtr, NMCBEENDEDITW *neew, LPCWSTR wstr)
Definition: comboex.c:219
#define WCBE_ACTEDIT
Definition: comboex.c:72
#define ODS_COMBOEXLBOX
Definition: comboex.c:92
static LRESULT CALLBACK COMBOEX_ComboWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR ref_data)
Definition: comboex.c:1810
#define WCBE_MOUSEDRAGGED
Definition: comboex.c:77
static cmp_func_t get_cmp_func(COMBOEX_INFO const *infoPtr)
Definition: comboex.c:165
static LPCWSTR COMBOEX_GetText(const COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
Definition: comboex.c:288
#define COMBO_SUBCLASSID
Definition: comboex.c:108
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID)
Definition: commctrl.c:1397
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1503
static char selected[MAX_PATH+1]
Definition: dirdlg.c:7
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define pt(x, y)
Definition: drawing.c:79
char hdr[14]
Definition: iptest.cpp:33
#define debugstr_w
Definition: kernel32.h:32
static HDC
Definition: imagelist.c:88
static ATOM item
Definition: dde.c:856
#define LOWORD(l)
Definition: pedump.c:82
#define NM_SETCURSOR
Definition: commctrl.h:142
#define CBEN_BEGINEDIT
Definition: commctrl.h:3879
#define CBENF_KILLFOCUS
Definition: commctrl.h:3892
HWND hwndNotify
Definition: comboex.c:56
DWORD flags
Definition: comboex.c:61
CBE_ITEMDATA edit
Definition: comboex.c:67
HWND hwndSelf
Definition: comboex.c:55
COLORREF clrWindow
Definition: comctl32.h:182
int iNewSelection
Definition: commctrl.h:3918
LPWSTR pszText
Definition: comboex.c:41
POINT pt
Definition: commctrl.h:166
DWORD_PTR dwItemData
Definition: commctrl.h:165
DWORD_PTR dwItemSpec
Definition: commctrl.h:164
LPARAM dwHitInfo
Definition: commctrl.h:167
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
int32_t INT_PTR
Definition: typedefs.h:64
#define HIWORD(l)
Definition: typedefs.h:247
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
HWND WINAPI GetFocus(void)
Definition: window.c:1865
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define EN_KILLFOCUS
Definition: winuser.h:2028
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define CB_SHOWDROPDOWN
Definition: winuser.h:1973
#define CB_GETITEMHEIGHT
Definition: winuser.h:1954
#define EN_SETFOCUS
Definition: winuser.h:2030
#define EN_UPDATE
Definition: winuser.h:2031
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_DRAWITEM
Definition: winuser.h:1648
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define EM_SETSEL
Definition: winuser.h:2021
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define LBN_SELCHANGE
Definition: winuser.h:2078
#define WM_NCDESTROY
Definition: winuser.h:1687
#define WM_SETCURSOR
Definition: winuser.h:1639
int WINAPI GetDlgCtrlID(_In_ HWND)
#define CB_GETCURSEL
Definition: winuser.h:1946
#define WM_KILLFOCUS
Definition: winuser.h:1617
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBN_EDITCHANGE
Definition: winuser.h:1978
#define EN_CHANGE
Definition: winuser.h:2025
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by COMBOEX_ComboWndProc(), and COMBOEX_Create().

◆ COMBOEX_Command()

static LRESULT COMBOEX_Command ( COMBOEX_INFO infoPtr,
WPARAM  wParam 
)
static

Definition at line 1067 of file comboex.c.

1071{
1072 LRESULT lret;
1074 CBE_ITEMDATA *item = 0;
1075 WCHAR wintext[520];
1076 INT cursel, n;
1077 INT_PTR oldItem;
1078 NMCBEENDEDITW cbeend;
1079 DWORD oldflags;
1080 HWND parent = infoPtr->hwndNotify;
1081
1082 TRACE("for command %d\n", command);
1083
1084 switch (command)
1085 {
1086 case CBN_DROPDOWN:
1087 SetFocus (infoPtr->hwndCombo);
1088 ShowWindow (infoPtr->hwndEdit, SW_HIDE);
1089 infoPtr->flags |= WCBE_ACTEDIT;
1090 return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
1091 case CBN_CLOSEUP:
1093 ShowWindow (infoPtr->hwndEdit, SW_SHOW);
1094 InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
1095 if (infoPtr->hwndEdit) InvalidateRect (infoPtr->hwndEdit, 0, TRUE);
1096 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
1097 if (cursel == -1) {
1098 cmp_func_t cmptext = get_cmp_func(infoPtr);
1099 /* find match from edit against those in Combobox */
1100 GetWindowTextW (infoPtr->hwndEdit, wintext, 520);
1101 n = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);
1102 for (cursel = 0; cursel < n; cursel++){
1103 item = get_item_data(infoPtr, cursel);
1104 if ((INT_PTR)item == CB_ERR) break;
1105 if (!cmptext(COMBOEX_GetText(infoPtr, item), wintext)) break;
1106 }
1107 if ((cursel == n) || ((INT_PTR)item == CB_ERR)) {
1108 TRACE("failed to find match??? item=%p cursel=%d\n",
1109 item, cursel);
1110 if (infoPtr->hwndEdit) SetFocus(infoPtr->hwndEdit);
1111 return 0;
1112 }
1113 }
1114 else {
1115 item = get_item_data(infoPtr, cursel);
1116 if ((INT_PTR)item == CB_ERR) {
1117 TRACE("failed to find match??? item=%p cursel=%d\n",
1118 item, cursel);
1119 if (infoPtr->hwndEdit) SetFocus(infoPtr->hwndEdit);
1120 return 0;
1121 }
1122 }
1123
1124 /* Save flags for testing and reset them */
1125 oldflags = infoPtr->flags;
1126 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1127
1128 if (oldflags & WCBE_ACTEDIT) {
1129 cbeend.fChanged = (oldflags & WCBE_EDITCHG);
1130 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
1131 CB_GETCURSEL, 0, 0);
1132 cbeend.iWhy = CBENF_DROPDOWN;
1133
1134 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, COMBOEX_GetText(infoPtr, item))) return 0;
1135 }
1136
1137 /* if selection has changed the set the new current selection */
1138 cursel = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
1139 if ((oldflags & WCBE_EDITCHG) || (cursel != infoPtr->selected)) {
1140 infoPtr->selected = cursel;
1141 SendMessageW (infoPtr->hwndSelf, CB_SETCURSEL, cursel, 0);
1142 SetFocus(infoPtr->hwndCombo);
1143 }
1144 return 0;
1145
1146 case CBN_SELCHANGE:
1147 /*
1148 * CB_GETCURSEL(Combo)
1149 * CB_GETITEMDATA(Combo) < simulated by COMBOEX_FindItem
1150 * lstrlenA
1151 * WM_SETTEXT(Edit)
1152 * WM_GETTEXTLENGTH(Edit)
1153 * WM_GETTEXT(Edit)
1154 * EM_SETSEL(Edit, 0,0)
1155 * WM_GETTEXTLENGTH(Edit)
1156 * WM_GETTEXT(Edit)
1157 * EM_SETSEL(Edit, 0,len)
1158 * return WM_COMMAND to parent
1159 */
1160 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
1161 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
1162 ERR("item %ld not found. Problem!\n", oldItem);
1163 break;
1164 }
1165 infoPtr->selected = oldItem;
1166 COMBOEX_SetEditText (infoPtr, item);
1167 return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
1168
1169 case CBN_SELENDOK:
1170 case CBN_SELENDCANCEL:
1171 /*
1172 * We have to change the handle since we are the control
1173 * issuing the message. IE4 depends on this.
1174 */
1175 return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
1176
1177 case CBN_KILLFOCUS:
1179 if (infoPtr->flags & WCBE_ACTEDIT) {
1180 GetWindowTextW (infoPtr->hwndEdit, wintext, 260);
1181 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
1182 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
1183 CB_GETCURSEL, 0, 0);
1184 cbeend.iWhy = CBENF_KILLFOCUS;
1185
1186 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1187 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, wintext)) return 0;
1188 }
1189 /* possible CB_GETCURSEL */
1190 InvalidateRect (infoPtr->hwndCombo, 0, 0);
1191 return 0;
1192
1193 case CBN_SETFOCUS:
1194 return SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
1195
1196 default:
1197 /*
1198 * We have to change the handle since we are the control
1199 * issuing the message. IE4 depends on this.
1200 * We also need to set the focus back to the Edit control
1201 * after passing the command to the parent of the ComboEx.
1202 */
1203 lret = SendMessageW (parent, WM_COMMAND, wParam, (LPARAM)infoPtr->hwndSelf);
1204 if (infoPtr->hwndEdit) SetFocus(infoPtr->hwndEdit);
1205 return lret;
#define ERR(fmt,...)
Definition: precomp.h:57
static void COMBOEX_SetEditText(const COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
Definition: comboex.c:432
static CBE_ITEMDATA * get_item_data(const COMBOEX_INFO *infoPtr, INT index)
Definition: comboex.c:159
r parent
Definition: btrfs.c:3010
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble n
Definition: glext.h:7729
#define CBENF_DROPDOWN
Definition: commctrl.h:3895
INT selected
Definition: comboex.c:60
LONG_PTR LRESULT
Definition: windef.h:209
#define SW_HIDE
Definition: winuser.h:771
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CBN_SETFOCUS
Definition: winuser.h:1985
#define CB_ERR
Definition: winuser.h:2438
#define CB_SETCURSEL
Definition: winuser.h:1964
#define CB_GETCOUNT
Definition: winuser.h:1945
#define CBN_SELCHANGE
Definition: winuser.h:1982
#define CBN_CLOSEUP
Definition: winuser.h:1975
#define CBN_DROPDOWN
Definition: winuser.h:1977
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CBN_KILLFOCUS
Definition: winuser.h:1981
#define CBN_SELENDOK
Definition: winuser.h:1984
#define SW_SHOW
Definition: winuser.h:778
#define CBN_SELENDCANCEL
Definition: winuser.h:1983

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_CopyItem()

static void COMBOEX_CopyItem ( const CBE_ITEMDATA item,
COMBOBOXEXITEMW cit 
)
static

Definition at line 341 of file comboex.c.

345{
346 if (cit->mask & CBEIF_TEXT) {
347 /*
348 * when given a text buffer actually use that buffer
349 */
350 if (cit->pszText) {
351 if (is_textW(item->pszText))
352 lstrcpynW(cit->pszText, item->pszText, cit->cchTextMax);
353 else
354 cit->pszText[0] = 0;
355 } else {
356 cit->pszText = item->pszText;
357 cit->cchTextMax = item->cchTextMax;
358 }
359 }
360 if (cit->mask & CBEIF_IMAGE)
361 cit->iImage = item->iImage;
362 if (cit->mask & CBEIF_SELECTEDIMAGE)
363 cit->iSelectedImage = item->iSelectedImage;
364 if (cit->mask & CBEIF_OVERLAY)
365 cit->iOverlay = item->iOverlay;
366 if (cit->mask & CBEIF_INDENT)
367 cit->iIndent = item->iIndent;
static BOOL is_textW(LPCWSTR str)
Definition: comboex.c:120
#define lstrcpynW
Definition: compat.h:738
#define CBEIF_IMAGE
Definition: commctrl.h:3792
#define CBEIF_SELECTEDIMAGE
Definition: commctrl.h:3793
#define CBEIF_TEXT
Definition: commctrl.h:3791
#define CBEIF_INDENT
Definition: commctrl.h:3795
#define CBEIF_OVERLAY
Definition: commctrl.h:3794

◆ COMBOEX_Create()

static LRESULT COMBOEX_Create ( HWND  hwnd,
CREATESTRUCTA const cs 
)
static

Definition at line 946 of file comboex.c.

950{
951 static const WCHAR NIL[] = { 0 };
952 COMBOEX_INFO *infoPtr;
953 LOGFONTW mylogfont;
954 RECT win_rect;
955 INT i;
956
957 /* allocate memory for info structure */
958 infoPtr = Alloc (sizeof(COMBOEX_INFO));
959 if (!infoPtr) return -1;
960
961 /* initialize info structure */
962 /* note that infoPtr is allocated zero-filled */
963
964 infoPtr->hwndSelf = hwnd;
965 infoPtr->selected = -1;
966
967 infoPtr->unicode = IsWindowUnicode (hwnd);
968 infoPtr->hwndNotify = cs->hwndParent;
969
970 i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
971 if ((i != NFR_ANSI) && (i != NFR_UNICODE)) {
972 WARN("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
973 i = NFR_ANSI;
974 }
975 infoPtr->NtfUnicode = (i == NFR_UNICODE);
976
977 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
978
979 if (TRACE_ON(comboex)) {
983 TRACE("EX window=(%s), client=(%s)\n",
985 }
986
987 /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */
988 /* specified. It then creates its own version of the EDIT control */
989 /* and makes the ComboBox the parent. This is because a normal */
990 /* DROPDOWNLIST does not have an EDIT control, but we need one. */
991 /* We also need to place the edit control at the proper location */
992 /* (allow space for the icons). */
993
999 cs->y, cs->x, cs->cx, cs->cy, hwnd,
1002
1004 (DWORD_PTR)hwnd);
1005 infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
1006
1007 /*
1008 * Now create our own EDIT control so we can position it.
1009 * It is created only for CBS_DROPDOWN style
1010 */
1011 if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) {
1012 infoPtr->hwndEdit = CreateWindowExW (0, WC_EDITW, NIL,
1014 0, 0, 0, 0, /* will set later */
1015 infoPtr->hwndCombo,
1018
1020 (DWORD_PTR)hwnd);
1021
1022 infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0);
1023 }
1024
1025 /*
1026 * Locate the default font if necessary and then set it in
1027 * all associated controls
1028 */
1029 if (!infoPtr->font) {
1031 &mylogfont, 0);
1032 infoPtr->font = infoPtr->defaultFont = CreateFontIndirectW (&mylogfont);
1033 }
1034 SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0);
1035 if (infoPtr->hwndEdit) {
1036 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);
1038 }
1039
1040 COMBOEX_ReSize (infoPtr);
1041
1042 /* Above is fairly certain, below is much less certain. */
1043
1044 GetWindowRect(hwnd, &win_rect);
1045
1046 if (TRACE_ON(comboex)) {
1047 RECT client, rect;
1049 GetWindowRect(infoPtr->hwndCombo, &rect);
1050 TRACE("EX window=(%s) client=(%s) CB wnd=(%s)\n",
1053 }
1054 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 0, 0,
1055 win_rect.right - win_rect.left, win_rect.bottom - win_rect.top,
1057
1058 GetWindowRect(infoPtr->hwndCombo, &win_rect);
1059 TRACE("CB window=(%s)\n", wine_dbgstr_rect(&win_rect));
1060 SetWindowPos(hwnd, HWND_TOP, 0, 0,
1061 win_rect.right - win_rect.left, win_rect.bottom - win_rect.top,
1063
1064 COMBOEX_AdjustEditPos (infoPtr);
#define WARN(fmt,...)
Definition: precomp.h:61
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
static void COMBOEX_ReSize(const COMBOEX_INFO *infoPtr)
Definition: comboex.c:404
static LRESULT CALLBACK COMBOEX_EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR ref_data)
Definition: comboex.c:1653
static void COMBOEX_AdjustEditPos(const COMBOEX_INFO *infoPtr)
Definition: comboex.c:370
#define EDIT_SUBCLASSID
Definition: comboex.c:109
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1268
#define NULL
Definition: types.h:112
#define TRACE_ON(x)
Definition: compat.h:75
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 i
Definition: glfuncs.h:248
#define cs
Definition: i386-dis.c:442
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define WS_CHILD
Definition: pedump.c:617
#define WS_VSCROLL
Definition: pedump.c:627
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WC_EDITW
Definition: commctrl.h:4692
#define WC_COMBOBOXW
Definition: commctrl.h:4722
static FILE * client
Definition: client.c:41
BOOL NtfUnicode
Definition: comboex.c:66
BOOL unicode
Definition: comboex.c:65
HFONT font
Definition: comboex.c:63
HFONT defaultFont
Definition: comboex.c:62
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
#define NIL
Definition: trio.c:106
uint32_t DWORD_PTR
Definition: typedefs.h:65
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define CBS_OWNERDRAWFIXED
Definition: winuser.h:289
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#define SWP_NOREDRAW
Definition: winuser.h:1249
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define CBS_NOINTEGRALHEIGHT
Definition: winuser.h:287
#define CBS_DROPDOWNLIST
Definition: winuser.h:284
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)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define SWP_NOMOVE
Definition: winuser.h:1247
#define EC_USEFONTINFO
Definition: winuser.h:2611
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1383
#define WM_GETFONT
Definition: winuser.h:1654
#define GWLP_HINSTANCE
Definition: winuser.h:859
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define HWND_TOP
Definition: winuser.h:1210
#define WM_SETFONT
Definition: winuser.h:1653
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define CBS_DROPDOWN
Definition: winuser.h:283
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4319
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define NFR_ANSI
Definition: winuser.h:2461
#define GWLP_ID
Definition: winuser.h:863
#define SWP_NOZORDER
Definition: winuser.h:1250
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define NFR_UNICODE
Definition: winuser.h:2462
#define GWL_STYLE
Definition: winuser.h:855
#define EM_SETMARGINS
Definition: winuser.h:2015
#define NF_QUERY
Definition: winuser.h:2463

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_DeleteItem()

static INT COMBOEX_DeleteItem ( COMBOEX_INFO infoPtr,
INT_PTR  index 
)
static

Definition at line 508 of file comboex.c.

512{
513 TRACE("(index=%ld)\n", index);
514
515 /* if item number requested does not exist then return failure */
516 if ((index >= infoPtr->nb_items) || (index < 0)) return CB_ERR;
517 if (!COMBOEX_FindItem(infoPtr, index)) return CB_ERR;
518
519 /* doing this will result in WM_DELETEITEM being issued */
GLuint index
Definition: glext.h:6031
INT nb_items
Definition: comboex.c:64
#define CB_DELETESTRING
Definition: winuser.h:1940

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_Destroy()

static LRESULT COMBOEX_Destroy ( COMBOEX_INFO infoPtr)
static

Definition at line 1498 of file comboex.c.

1502{
1503 if (infoPtr->hwndCombo)
1505
1506 if (infoPtr->hwndEdit)
1508
1509 COMBOEX_FreeText (&infoPtr->edit);
1510 COMBOEX_ResetContent (infoPtr);
1511
1512 if (infoPtr->defaultFont)
1513 DeleteObject (infoPtr->defaultFont);
1514
1515 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
1516
1517 /* free comboex info data */
1518 Free (infoPtr);
static void COMBOEX_ResetContent(COMBOEX_INFO *infoPtr)
Definition: comboex.c:1477
static void COMBOEX_FreeText(CBE_ITEMDATA *item)
Definition: comboex.c:259
pKey DeleteObject()
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_DrawItem()

static LRESULT COMBOEX_DrawItem ( COMBOEX_INFO infoPtr,
DRAWITEMSTRUCT const dis 
)
static

Definition at line 1255 of file comboex.c.

1259{
1260 static const WCHAR nil[] = { 0 };
1262 SIZE txtsize;
1263 RECT rect;
1264 LPCWSTR str = nil;
1265 UINT xbase, x, y;
1266 INT len;
1267 COLORREF nbkc, ntxc, bkc, txc;
1268 int drawimage, drawstate, xioff, selected;
1269
1270 TRACE("DRAWITEMSTRUCT: CtlType=0x%08x CtlID=0x%08x\n",
1271 dis->CtlType, dis->CtlID);
1272 TRACE("itemID=0x%08x itemAction=0x%08x itemState=0x%08x\n",
1273 dis->itemID, dis->itemAction, dis->itemState);
1274 TRACE("hWnd=%p hDC=%p (%s) itemData=0x%08lx\n",
1275 dis->hwndItem, dis->hDC, wine_dbgstr_rect(&dis->rcItem), dis->itemData);
1276
1277 /* MSDN says: */
1278 /* "itemID - Specifies the menu item identifier for a menu */
1279 /* item or the index of the item in a list box or combo box. */
1280 /* For an empty list box or combo box, this member can be -1. */
1281 /* This allows the application to draw only the focus */
1282 /* rectangle at the coordinates specified by the rcItem */
1283 /* member even though there are no items in the control. */
1284 /* This indicates to the user whether the list box or combo */
1285 /* box has the focus. How the bits are set in the itemAction */
1286 /* member determines whether the rectangle is to be drawn as */
1287 /* though the list box or combo box has the focus. */
1288 if (dis->itemID == 0xffffffff) {
1289 if ( ( (dis->itemAction & ODA_FOCUS) && (dis->itemState & ODS_SELECTED)) ||
1290 ( (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) && (dis->itemState & ODS_FOCUS) ) ) {
1291
1292 TRACE("drawing item -1 special focus, rect=(%s)\n",
1293 wine_dbgstr_rect(&dis->rcItem));
1294 }
1295 else if ((dis->CtlType == ODT_COMBOBOX) &&
1296 (dis->itemAction == ODA_DRAWENTIRE)) {
1297 /* draw of edit control data */
1298
1299 if (TRACE_ON(comboex)) {
1300 RECT exrc, cbrc, edrc;
1301 GetWindowRect (infoPtr->hwndSelf, &exrc);
1302 GetWindowRect (infoPtr->hwndCombo, &cbrc);
1303 SetRect(&edrc, -1, -1, -1, -1);
1304 if (infoPtr->hwndEdit) GetWindowRect (infoPtr->hwndEdit, &edrc);
1305 TRACE("window rects ex=(%s), cb=(%s), ed=(%s)\n",
1306 wine_dbgstr_rect(&exrc), wine_dbgstr_rect(&cbrc),
1307 wine_dbgstr_rect(&edrc));
1308 }
1309 }
1310 else {
1311 ERR("NOT drawing item -1 special focus, rect=(%s), action=%08x, state=%08x\n",
1312 wine_dbgstr_rect(&dis->rcItem),
1313 dis->itemAction, dis->itemState);
1314 return 0;
1315 }
1316 }
1317
1318 /* If draw item is -1 (edit control) setup the item pointer */
1319 if (dis->itemID == 0xffffffff) {
1320 item = &infoPtr->edit;
1321
1322 if (infoPtr->hwndEdit) {
1323 /* free previous text of edit item */
1325 item->mask &= ~CBEIF_TEXT;
1326 if( (len = GetWindowTextLengthW(infoPtr->hwndEdit)) ) {
1327 item->mask |= CBEIF_TEXT;
1328 item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
1329 if (item->pszText)
1330 GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1);
1331
1332 TRACE("edit control hwndEdit=%p, text len=%d str=%s\n",
1333 infoPtr->hwndEdit, len, debugstr_txt(item->pszText));
1334 }
1335 }
1336 }
1337
1338
1339 /* if the item pointer is not set, then get the data and locate it */
1340 if (!item) {
1341 item = get_item_data(infoPtr, dis->itemID);
1342 if (item == (CBE_ITEMDATA *)CB_ERR) {
1343 ERR("invalid item for id %d\n", dis->itemID);
1344 return 0;
1345 }
1346 }
1347
1348 if (TRACE_ON(comboex)) COMBOEX_DumpItem (item);
1349
1350 xbase = CBE_STARTOFFSET;
1351 if ((item->mask & CBEIF_INDENT) && (dis->itemState & ODS_COMBOEXLBOX)) {
1352 INT indent = item->iIndent;
1353 if (indent == I_INDENTCALLBACK) {
1354 NMCOMBOBOXEXW nmce;
1355 ZeroMemory(&nmce, sizeof(nmce));
1356 nmce.ceItem.mask = CBEIF_INDENT;
1357 nmce.ceItem.lParam = item->lParam;
1358 nmce.ceItem.iItem = dis->itemID;
1359 COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
1360 if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
1361 item->iIndent = nmce.ceItem.iIndent;
1362 indent = nmce.ceItem.iIndent;
1363 }
1364 xbase += (indent * CBE_INDENT);
1365 }
1366
1367 drawimage = -2;
1368 drawstate = ILD_NORMAL;
1369 selected = infoPtr->selected == dis->itemID;
1370
1371 if (item->mask & CBEIF_IMAGE)
1372 drawimage = item->iImage;
1373 if (item->mask & CBEIF_SELECTEDIMAGE && selected)
1374 drawimage = item->iSelectedImage;
1375 if (dis->itemState & ODS_COMBOEXLBOX) {
1376 /* drawing listbox entry */
1377 if (dis->itemState & ODS_SELECTED)
1378 drawstate = ILD_SELECTED;
1379 } else {
1380 /* drawing combo/edit entry */
1381 if (IsWindowVisible(infoPtr->hwndEdit)) {
1382 /* if we have an edit control, the slave the
1383 * selection state to the Edit focus state
1384 */
1385 if (infoPtr->flags & WCBE_EDITFOCUSED)
1386 drawstate = ILD_SELECTED;
1387 } else
1388 /* if we don't have an edit control, use
1389 * the requested state.
1390 */
1391 if (dis->itemState & ODS_SELECTED)
1392 drawstate = ILD_SELECTED;
1393 }
1394
1395 if (infoPtr->himl && !(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGEINDENT)) {
1396 IMAGEINFO iinfo;
1397 iinfo.rcImage.left = iinfo.rcImage.right = 0;
1398 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
1399 xioff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;
1400 } else xioff = 0;
1401
1402 /* setup pointer to text to be drawn */
1403 str = COMBOEX_GetText(infoPtr, item);
1404 if (!str) str = nil;
1405
1406 len = lstrlenW (str);
1407 GetTextExtentPoint32W (dis->hDC, str, len, &txtsize);
1408
1409 if (dis->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)) {
1410 int overlay = item->iOverlay;
1411
1412 if (drawimage == I_IMAGECALLBACK) {
1413 NMCOMBOBOXEXW nmce;
1414 ZeroMemory(&nmce, sizeof(nmce));
1416 nmce.ceItem.lParam = item->lParam;
1417 nmce.ceItem.iItem = dis->itemID;
1418 COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
1419 if (!selected) {
1420 if (nmce.ceItem.mask & CBEIF_DI_SETITEM) item->iImage = nmce.ceItem.iImage;
1421 drawimage = nmce.ceItem.iImage;
1422 } else {
1423 if (nmce.ceItem.mask & CBEIF_DI_SETITEM) item->iSelectedImage = nmce.ceItem.iSelectedImage;
1424 drawimage = nmce.ceItem.iSelectedImage;
1425 }
1426 }
1427
1428 if (overlay == I_IMAGECALLBACK) {
1429 NMCOMBOBOXEXW nmce;
1430 ZeroMemory(&nmce, sizeof(nmce));
1431 nmce.ceItem.mask = CBEIF_OVERLAY;
1432 nmce.ceItem.lParam = item->lParam;
1433 nmce.ceItem.iItem = dis->itemID;
1434 COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
1435 if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
1436 item->iOverlay = nmce.ceItem.iOverlay;
1437 overlay = nmce.ceItem.iOverlay;
1438 }
1439
1440 if (drawimage >= 0 &&
1442 if (overlay > 0) ImageList_SetOverlayImage (infoPtr->himl, overlay, 1);
1443 ImageList_Draw (infoPtr->himl, drawimage, dis->hDC, xbase, dis->rcItem.top,
1444 drawstate | (overlay > 0 ? INDEXTOOVERLAYMASK(1) : 0));
1445 }
1446
1447 /* now draw the text */
1448 if (!IsWindowVisible (infoPtr->hwndEdit)) {
1449 nbkc = (dis->itemState & ODS_SELECTED) ?
1451 bkc = SetBkColor (dis->hDC, nbkc);
1452 ntxc = (dis->itemState & ODS_SELECTED) ?
1454 txc = SetTextColor (dis->hDC, ntxc);
1455 x = xbase + xioff;
1456 y = dis->rcItem.top +
1457 (dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
1458 SetRect(&rect, x, dis->rcItem.top + 1, x + txtsize.cx, dis->rcItem.bottom - 1);
1459 TRACE("drawing item %d text, rect=(%s)\n",
1460 dis->itemID, wine_dbgstr_rect(&rect));
1461 ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,
1462 &rect, str, len, 0);
1463 SetBkColor (dis->hDC, bkc);
1464 SetTextColor (dis->hDC, txc);
1465 }
1466 }
1467
1468 if (dis->itemAction & ODA_FOCUS) {
1469 rect.left = xbase + xioff - 1;
1470 rect.right = rect.left + txtsize.cx + 2;
1471 rect.top = dis->rcItem.top;
1472 rect.bottom = dis->rcItem.bottom;
1473 DrawFocusRect(dis->hDC, &rect);
1474 }
#define WCBE_EDITFOCUSED
Definition: comboex.c:75
static LPCSTR debugstr_txt(LPCWSTR str)
Definition: comboex.c:130
static void COMBOEX_DumpItem(CBE_ITEMDATA const *item)
Definition: comboex.c:136
#define CBE_INDENT
Definition: comboex.c:100
static INT COMBOEX_NotifyItem(const COMBOEX_INFO *infoPtr, UINT code, NMCOMBOBOXEXW *hdr)
Definition: comboex.c:183
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
BOOL WINAPI ImageList_SetOverlayImage(HIMAGELIST himl, INT iImage, INT iOverlay)
Definition: imagelist.c:3180
static const WCHAR indent[]
Definition: object.c:1156
#define lstrlenW
Definition: compat.h:750
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
#define I_IMAGECALLBACK
Definition: commctrl.h:2390
#define ILD_NORMAL
Definition: commctrl.h:417
#define CBES_EX_NOEDITIMAGE
Definition: commctrl.h:3856
#define CBEIF_DI_SETITEM
Definition: commctrl.h:3798
#define INDEXTOOVERLAYMASK(i)
Definition: commctrl.h:425
#define CBEN_GETDISPINFOW
Definition: commctrl.h:3883
#define ILD_SELECTED
Definition: commctrl.h:430
#define I_INDENTCALLBACK
Definition: commctrl.h:2335
const WCHAR * str
#define nil
Definition: compat.h:23
COLORREF clrHighlightText
Definition: comctl32.h:176
COLORREF clrWindowText
Definition: comctl32.h:183
COLORREF clrHighlight
Definition: comctl32.h:175
COMBOBOXEXITEMW ceItem
Definition: commctrl.h:3869
#define ZeroMemory
Definition: winbase.h:1737
#define ETO_CLIPPED
Definition: wingdi.h:648
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define ODT_COMBOBOX
Definition: winuser.h:2542
#define ODS_SELECTED
Definition: winuser.h:2548
#define ODA_DRAWENTIRE
Definition: winuser.h:2545
#define ODA_FOCUS
Definition: winuser.h:2547
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define ODA_SELECT
Definition: winuser.h:2546
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define ODS_FOCUS
Definition: winuser.h:2552
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_DumpInput()

static void COMBOEX_DumpInput ( COMBOBOXEXITEMW const input)
static

Definition at line 147 of file comboex.c.

151{
152 TRACE("input - mask=%08x, iItem=%ld, pszText=%p, cchTM=%d, iImage=%d\n",
153 input->mask, input->iItem, input->pszText, input->cchTextMax,
154 input->iImage);
155 if (input->mask & CBEIF_TEXT)
156 TRACE("input - pszText=<%s>\n", debugstr_txt(input->pszText));
GLenum GLenum GLenum input
Definition: glext.h:9031

◆ COMBOEX_DumpItem()

static void COMBOEX_DumpItem ( CBE_ITEMDATA const item)
static

Definition at line 136 of file comboex.c.

140{
141 TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n",
142 item, item->mask, item->pszText, item->cchTextMax, item->iImage);
143 TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
144 item, item->iSelectedImage, item->iOverlay, item->iIndent, item->lParam);

◆ COMBOEX_EditWndProc()

static LRESULT CALLBACK COMBOEX_EditWndProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
UINT_PTR  uId,
DWORD_PTR  ref_data 
)
static

Definition at line 1653 of file comboex.c.

1658{
1659 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr ((HWND)ref_data);
1660 NMCBEENDEDITW cbeend;
1661 WCHAR edit_text[260];
1662 COLORREF obkc;
1663 HDC hDC;
1664 RECT rect;
1665 LRESULT lret;
1666
1667 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx, info_ptr=%p\n",
1668 hwnd, uMsg, wParam, lParam, infoPtr);
1669
1670 if (uMsg == WM_NCDESTROY)
1672
1673 if (!infoPtr)
1674 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
1675
1676 switch (uMsg)
1677 {
1678
1679 case WM_CHAR:
1680 /* handle (ignore) the return character */
1681 if (wParam == VK_RETURN) return 0;
1682 /* all other characters pass into the real Edit */
1683 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
1684
1685 case WM_ERASEBKGND:
1686 hDC = (HDC) wParam;
1689 TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
1690 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
1691 SetBkColor (hDC, obkc);
1692 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
1693
1694 case WM_KEYDOWN: {
1695 INT_PTR oldItem, selected;
1697
1698 switch ((INT)wParam)
1699 {
1700 case VK_ESCAPE:
1701 TRACE("special code for VK_ESCAPE\n");
1702
1703 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1704
1705 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1706 cbeend.fChanged = FALSE;
1707 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
1708 CB_GETCURSEL, 0, 0);
1709 cbeend.iWhy = CBENF_ESCAPE;
1710
1711 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) return 0;
1712 oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0);
1713 InvalidateRect (infoPtr->hwndCombo, 0, 0);
1714 if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) {
1715 ERR("item %ld not found. Problem!\n", oldItem);
1716 break;
1717 }
1718 infoPtr->selected = oldItem;
1719 COMBOEX_SetEditText (infoPtr, item);
1720 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
1722 break;
1723
1724 case VK_RETURN:
1725 TRACE("special code for VK_RETURN\n");
1726
1727 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1728
1729 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1730 selected = SendMessageW (infoPtr->hwndCombo,
1731 CB_GETCURSEL, 0, 0);
1732
1733 if (selected != -1) {
1734 cmp_func_t cmptext = get_cmp_func(infoPtr);
1735 item = COMBOEX_FindItem (infoPtr, selected);
1736 TRACE("handling VK_RETURN, selected = %ld, selected_text=%s\n",
1737 selected, debugstr_txt(item->pszText));
1738 TRACE("handling VK_RETURN, edittext=%s\n",
1739 debugstr_w(edit_text));
1740 if (cmptext (COMBOEX_GetText(infoPtr, item), edit_text)) {
1741 /* strings not equal -- indicate edit has changed */
1742 selected = -1;
1743 }
1744 }
1745
1746 cbeend.iNewSelection = selected;
1747 cbeend.fChanged = TRUE;
1748 cbeend.iWhy = CBENF_RETURN;
1749 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) {
1750 /* abort the change, restore previous */
1751 TRACE("Notify requested abort of change\n");
1752 COMBOEX_SetEditText (infoPtr, &infoPtr->edit);
1753 RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE |
1755 return 0;
1756 }
1757 oldItem = SendMessageW (infoPtr->hwndCombo,CB_GETCURSEL, 0, 0);
1758 if (oldItem != -1) {
1759 /* if something is selected, then deselect it */
1760 SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, -1, 0);
1761 }
1762 InvalidateRect (infoPtr->hwndCombo, 0, 0);
1763 SetFocus(infoPtr->hwndEdit);
1764 break;
1765
1766 case VK_UP:
1767 case VK_DOWN:
1768 {
1769 INT step = wParam == VK_DOWN ? 1 : -1;
1770
1771 oldItem = SendMessageW (infoPtr->hwndSelf, CB_GETCURSEL, 0, 0);
1772 if (oldItem >= 0 && oldItem + step >= 0)
1773 SendMessageW (infoPtr->hwndSelf, CB_SETCURSEL, oldItem + step, 0);
1774 return 0;
1775 }
1776 default:
1777 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
1778 }
1779 return 0;
1780 }
1781
1782 case WM_SETFOCUS:
1783 /* remember the focus to set state of icon */
1784 lret = DefSubclassProc(hwnd, uMsg, wParam, lParam);
1785 infoPtr->flags |= WCBE_EDITFOCUSED;
1786 return lret;
1787
1788 case WM_KILLFOCUS:
1789 /*
1790 * do NOTIFY CBEN_ENDEDIT with CBENF_KILLFOCUS
1791 */
1792 infoPtr->flags &= ~WCBE_EDITFOCUSED;
1793 if (infoPtr->flags & WCBE_ACTEDIT) {
1794 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1795
1796 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1797 cbeend.fChanged = FALSE;
1798 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
1799 CB_GETCURSEL, 0, 0);
1800 cbeend.iWhy = CBENF_KILLFOCUS;
1801
1802 COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text);
1803 }
1804 /* fall through */
1805
1806 default:
#define FALSE
Definition: types.h:117
#define CBENF_RETURN
Definition: commctrl.h:3893
#define CBENF_ESCAPE
Definition: commctrl.h:3894
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define VK_UP
Definition: winuser.h:2228
#define WM_SETFOCUS
Definition: winuser.h:1616
#define RDW_ERASE
Definition: winuser.h:1214
#define VK_RETURN
Definition: winuser.h:2204
#define WM_CHAR
Definition: winuser.h:1720
#define VK_DOWN
Definition: winuser.h:2230
#define WM_KEYDOWN
Definition: winuser.h:1718
#define VK_ESCAPE
Definition: winuser.h:2217
#define RDW_INVALIDATE
Definition: winuser.h:1217

Referenced by COMBOEX_Create().

◆ COMBOEX_Enable()

static LRESULT COMBOEX_Enable ( COMBOEX_INFO infoPtr,
BOOL  enable 
)
static

Definition at line 1521 of file comboex.c.

1525{
1526 TRACE("hwnd=%p, enable=%s\n", infoPtr->hwndSelf, enable ? "TRUE":"FALSE");
1527
1528 if (infoPtr->hwndEdit)
1529 EnableWindow(infoPtr->hwndEdit, enable);
1530
1531 EnableWindow(infoPtr->hwndCombo, enable);
1532
1533 /* Force the control to repaint when the enabled state changes. */
1534 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
GLboolean enable
Definition: glext.h:11120
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_FindItem()

static CBE_ITEMDATA * COMBOEX_FindItem ( COMBOEX_INFO infoPtr,
INT_PTR  index 
)
static

Definition at line 444 of file comboex.c.

448{
450 INT i;
451
452 if ((index >= infoPtr->nb_items) || (index < -1))
453 return NULL;
454 if (index == -1)
455 return &infoPtr->edit;
456 item = infoPtr->items;
457 i = infoPtr->nb_items - 1;
458
459 /* find the item in the list */
460 while (item && (i > index)) {
461 item = item->next;
462 i--;
463 }
464 if (!item || (i != index)) {
465 ERR("COMBOBOXEX item structures broken. Please report!\n");
466 return 0;
CBE_ITEMDATA * items
Definition: comboex.c:68

Referenced by COMBOEX_ComboWndProc(), and COMBOEX_GetListboxText().

◆ COMBOEX_FindStringExact()

static INT COMBOEX_FindStringExact ( const COMBOEX_INFO infoPtr,
INT  start,
LPCWSTR  str 
)
static

Definition at line 831 of file comboex.c.

835{
836 INT i;
837 cmp_func_t cmptext = get_cmp_func(infoPtr);
838 INT count = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);
839
840 /* now search from after starting loc and wrapping back to start */
841 for(i=start+1; i<count; i++) {
842 CBE_ITEMDATA *item = get_item_data(infoPtr, i);
843 if ((LRESULT)item == CB_ERR) continue;
844 if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i;
845 }
846 for(i=0; i<=start; i++) {
847 CBE_ITEMDATA *item = get_item_data(infoPtr, i);
848 if ((LRESULT)item == CB_ERR) continue;
849 if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i;
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_FreeText()

static void COMBOEX_FreeText ( CBE_ITEMDATA item)
static

Definition at line 259 of file comboex.c.

263{
264 if (is_textW(item->pszText)) Free(item->pszText);
265 item->pszText = NULL;

◆ COMBOEX_GetComboFontSize()

static void COMBOEX_GetComboFontSize ( const COMBOEX_INFO infoPtr,
SIZE size 
)
static

Definition at line 325 of file comboex.c.

329{
330 static const WCHAR strA[] = { 'A', 0 };
331 HFONT nfont, ofont;
332 HDC mydc;
333
334 mydc = GetDC (0); /* why the entire screen???? */
335 nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
336 ofont = SelectObject (mydc, nfont);
337 GetTextExtentPointW (mydc, strA, 1, size);
338 SelectObject (mydc, ofont);
GLsizeiptr size
Definition: glext.h:5919
char strA[12]
Definition: clipboard.c:2028
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI GetDC(_In_opt_ HWND)

◆ COMBOEX_GetIndex()

static INT COMBOEX_GetIndex ( COMBOEX_INFO const infoPtr,
CBE_ITEMDATA const item 
)
static

Definition at line 268 of file comboex.c.

272{
273 CBE_ITEMDATA const *moving;
274 INT index;
275
276 moving = infoPtr->items;
277 index = infoPtr->nb_items - 1;
278
279 while (moving && (moving != item)) {
280 moving = moving->next;
281 index--;
282 }
283 if (!moving || (index < 0)) {
284 ERR("COMBOBOXEX item structures broken. Please report!\n");
285 return -1;
#define index(s, c)
Definition: various.h:29
struct _CBE_ITEMDATA * next
Definition: comboex.c:39

◆ COMBOEX_GetItemA()

static BOOL COMBOEX_GetItemA ( COMBOEX_INFO infoPtr,
COMBOBOXEXITEMA cit 
)
static

Definition at line 544 of file comboex.c.

548{
549 COMBOBOXEXITEMW tmpcit;
550
551 TRACE("\n");
552
553 tmpcit.mask = cit->mask;
554 tmpcit.iItem = cit->iItem;
555 tmpcit.pszText = 0;
556 if(!COMBOEX_GetItemW (infoPtr, &tmpcit)) return FALSE;
557
558 if (cit->mask & CBEIF_TEXT)
559 {
560 if (is_textW(tmpcit.pszText) && cit->pszText)
561 WideCharToMultiByte(CP_ACP, 0, tmpcit.pszText, -1,
562 cit->pszText, cit->cchTextMax, NULL, NULL);
563 else if (cit->pszText) cit->pszText[0] = 0;
564 else cit->pszText = (LPSTR)tmpcit.pszText;
565 }
566
567 if (cit->mask & CBEIF_IMAGE)
568 cit->iImage = tmpcit.iImage;
569 if (cit->mask & CBEIF_SELECTEDIMAGE)
570 cit->iSelectedImage = tmpcit.iSelectedImage;
571 if (cit->mask & CBEIF_OVERLAY)
572 cit->iOverlay = tmpcit.iOverlay;
573 if (cit->mask & CBEIF_INDENT)
574 cit->iIndent = tmpcit.iIndent;
575 if (cit->mask & CBEIF_LPARAM)
576 cit->lParam = tmpcit.lParam;
static BOOL COMBOEX_GetItemW(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit)
Definition: comboex.c:523
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define CBEIF_LPARAM
Definition: commctrl.h:3796
char * LPSTR
Definition: xmlstorage.h:182

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_GetItemData()

static DWORD_PTR COMBOEX_GetItemData ( COMBOEX_INFO infoPtr,
INT_PTR  index 
)
static

Definition at line 852 of file comboex.c.

856{
857 CBE_ITEMDATA const *item1;
858 CBE_ITEMDATA const *item2;
859 DWORD_PTR ret = 0;
860
861 item1 = get_item_data(infoPtr, index);
862 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
863 item2 = COMBOEX_FindItem (infoPtr, index);
864 if (item2 != item1) {
865 ERR("data structures damaged!\n");
866 return CB_ERR;
867 }
868 if (item1->mask & CBEIF_LPARAM) ret = item1->lParam;
869 TRACE("returning 0x%08lx\n", ret);
870 } else {
872 TRACE("non-valid result from combo, returning 0x%08lx\n", ret);
static const struct metadata_item item1[]
Definition: metadata.c:2802
static const struct metadata_item item2[]
Definition: metadata.c:2807
#define DWORD_PTR
Definition: treelist.c:76
int ret

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_GetItemW()

static BOOL COMBOEX_GetItemW ( COMBOEX_INFO infoPtr,
COMBOBOXEXITEMW cit 
)
static

Definition at line 523 of file comboex.c.

527{
528 INT_PTR index = cit->iItem;
530
531 TRACE("\n");
532
533 /* if item number requested does not exist then return failure */
534 if ((index >= infoPtr->nb_items) || (index < -1)) return FALSE;
535
536 /* if the item is the edit control and there is no edit control, skip */
537 if ((index == -1) && !infoPtr->hwndEdit) return FALSE;
538
539 if (!(item = COMBOEX_FindItem(infoPtr, index))) return FALSE;
540
541 COMBOEX_CopyItem (item, cit);
static void COMBOEX_CopyItem(const CBE_ITEMDATA *item, COMBOBOXEXITEMW *cit)
Definition: comboex.c:341

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_GetListboxText()

static UINT COMBOEX_GetListboxText ( COMBOEX_INFO infoPtr,
INT_PTR  n,
LPWSTR  buf 
)
static

Definition at line 470 of file comboex.c.

474{
476 LPCWSTR str;
477
478 item = COMBOEX_FindItem(infoPtr, n);
479 if (!item)
480 return 0;
481
482 str = COMBOEX_GetText(infoPtr, item);
483 if (!str)
484 {
485 if (buf)
486 {
487 if (infoPtr->unicode)
488 buf[0] = 0;
489 else
490 *((LPSTR)buf) = 0;
491 }
492 return 0;
493 }
494
495 if (infoPtr->unicode)
496 {
497 if (buf)
498 lstrcpyW(buf, str);
499 return lstrlenW(str);
500 }
501 else
502 {
503 UINT r;
504 r = WideCharToMultiByte(CP_ACP, 0, str, -1, (LPSTR)buf, 0x40000000, NULL, NULL);
505 if (r) r--;
#define lstrcpyW
Definition: compat.h:749
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_GetText()

static LPCWSTR COMBOEX_GetText ( const COMBOEX_INFO infoPtr,
CBE_ITEMDATA item 
)
static

Definition at line 288 of file comboex.c.

292{
293 NMCOMBOBOXEXW nmce;
294 LPWSTR text, buf;
295 INT len;
296
297 if (item->pszText != LPSTR_TEXTCALLBACKW)
298 return item->pszText;
299
300 ZeroMemory(&nmce, sizeof(nmce));
301 nmce.ceItem.mask = CBEIF_TEXT;
302 nmce.ceItem.lParam = item->lParam;
303 nmce.ceItem.iItem = COMBOEX_GetIndex(infoPtr, item);
304 COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
305
306 if (is_textW(nmce.ceItem.pszText)) {
307 len = MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, NULL, 0);
308 buf = Alloc ((len + 1)*sizeof(WCHAR));
309 if (buf)
311 if (nmce.ceItem.mask & CBEIF_DI_SETITEM) {
313 item->pszText = buf;
314 } else {
315 Free(item->pszTemp);
316 item->pszTemp = buf;
317 }
318 text = buf;
319 } else
320 text = nmce.ceItem.pszText;
321
322 if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
static INT COMBOEX_GetIndex(COMBOEX_INFO const *infoPtr, CBE_ITEMDATA const *item)
Definition: comboex.c:268
#define MultiByteToWideChar
Definition: compat.h:110
const WCHAR * text
Definition: package.c:1794
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2385
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by COMBOEX_ComboWndProc(), COMBOEX_FindStringExact(), and COMBOEX_GetListboxText().

◆ COMBOEX_HasEditChanged()

static BOOL COMBOEX_HasEditChanged ( COMBOEX_INFO const infoPtr)
inlinestatic

Definition at line 579 of file comboex.c.

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_InsertItemA()

static INT COMBOEX_InsertItemA ( COMBOEX_INFO infoPtr,
COMBOBOXEXITEMA const cit 
)
static

Definition at line 670 of file comboex.c.

674{
675 COMBOBOXEXITEMW citW;
676 LPWSTR wstr = NULL;
677 INT ret;
678
679 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
680 if (cit->mask & CBEIF_TEXT && is_textA(cit->pszText)) {
681 INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
682 wstr = Alloc ((len + 1)*sizeof(WCHAR));
683 if (!wstr) return -1;
684 MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
685 citW.pszText = wstr;
686 }
687 ret = COMBOEX_InsertItemW(infoPtr, &citW);
688
689 Free(wstr);
static INT COMBOEX_InsertItemW(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *cit)
Definition: comboex.c:585
static BOOL is_textA(LPCSTR str)
Definition: comboex.c:125
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_InsertItemW()

static INT COMBOEX_InsertItemW ( COMBOEX_INFO infoPtr,
COMBOBOXEXITEMW const cit 
)
static

Definition at line 585 of file comboex.c.

589{
592 NMCOMBOBOXEXW nmcit;
593
594 TRACE("\n");
595
596 if (TRACE_ON(comboex)) COMBOEX_DumpInput (cit);
597
598 /* get real index of item to insert */
599 index = cit->iItem;
600 if (index == -1) index = infoPtr->nb_items;
601 if (index > infoPtr->nb_items) return -1;
602
603 /* get zero-filled space and chain it in */
604 if(!(item = Alloc (sizeof(*item)))) return -1;
605
606 /* locate position to insert new item in */
607 if (index == infoPtr->nb_items) {
608 /* fast path for iItem = -1 */
609 item->next = infoPtr->items;
610 infoPtr->items = item;
611 }
612 else {
613 INT i = infoPtr->nb_items-1;
614 CBE_ITEMDATA *moving = infoPtr->items;
615
616 while ((i > index) && moving) {
617 moving = moving->next;
618 i--;
619 }
620 if (!moving) {
621 ERR("COMBOBOXEX item structures broken. Please report!\n");
622 Free(item);
623 return -1;
624 }
625 item->next = moving->next;
626 moving->next = item;
627 }
628
629 /* fill in our hidden item structure */
630 item->mask = cit->mask;
631 if (item->mask & CBEIF_TEXT) {
632 INT len = 0;
633
634 if (is_textW(cit->pszText)) len = lstrlenW (cit->pszText);
635 if (len > 0) {
636 item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
637 if (!item->pszText) {
638 Free(item);
639 return -1;
640 }
641 lstrcpyW (item->pszText, cit->pszText);
642 }
643 else if (cit->pszText == LPSTR_TEXTCALLBACKW)
644 item->pszText = LPSTR_TEXTCALLBACKW;
645 item->cchTextMax = cit->cchTextMax;
646 }
647 if (item->mask & CBEIF_IMAGE)
648 item->iImage = cit->iImage;
649 if (item->mask & CBEIF_SELECTEDIMAGE)
650 item->iSelectedImage = cit->iSelectedImage;
651 if (item->mask & CBEIF_OVERLAY)
652 item->iOverlay = cit->iOverlay;
653 if (item->mask & CBEIF_INDENT)
654 item->iIndent = cit->iIndent;
655 if (item->mask & CBEIF_LPARAM)
656 item->lParam = cit->lParam;
657 infoPtr->nb_items++;
658
659 if (TRACE_ON(comboex)) COMBOEX_DumpItem (item);
660
661 SendMessageW (infoPtr->hwndCombo, CB_INSERTSTRING, cit->iItem, (LPARAM)item);
662
663 memset (&nmcit.ceItem, 0, sizeof(nmcit.ceItem));
664 nmcit.ceItem.mask=~0;
665 COMBOEX_CopyItem (item, &nmcit.ceItem);
666 COMBOEX_NotifyItem (infoPtr, CBEN_INSERTITEM, &nmcit);
667
static void COMBOEX_DumpInput(COMBOBOXEXITEMW const *input)
Definition: comboex.c:147
#define CBEN_INSERTITEM
Definition: commctrl.h:3877
#define memset(x, y, z)
Definition: compat.h:39
#define CB_INSERTSTRING
Definition: winuser.h:1960

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_MeasureItem()

static LRESULT COMBOEX_MeasureItem ( COMBOEX_INFO const infoPtr,
MEASUREITEMSTRUCT mis 
)
static

Definition at line 1537 of file comboex.c.

1541{
1542 static const WCHAR strW[] = { 'W', 0 };
1543 SIZE mysize;
1544 HDC hdc;
1545
1546 hdc = GetDC (0);
1547 GetTextExtentPointW (hdc, strW, 1, &mysize);
1548 ReleaseDC (0, hdc);
1549 mis->itemHeight = mysize.cy + CBE_EXTRA;
1550
1551 TRACE("adjusted height hwnd=%p, height=%d\n",
1552 infoPtr->hwndSelf, mis->itemHeight);
#define CBE_EXTRA
Definition: comboex.c:97
HDC hdc
Definition: main.c:9
WCHAR strW[12]
Definition: clipboard.c:2029
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_NCCreate()

static LRESULT COMBOEX_NCCreate ( HWND  hwnd)
static

Definition at line 1555 of file comboex.c.

1559{
1560 /* WARNING: The COMBOEX_INFO structure is not yet created */
1561 DWORD oldstyle, newstyle;
1562
1563 oldstyle = (DWORD)GetWindowLongW (hwnd, GWL_STYLE);
1564 newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER);
1565 if (newstyle != oldstyle) {
1566 TRACE("req style %08x, resetting style %08x\n",
1567 oldstyle, newstyle);
1568 SetWindowLongW (hwnd, GWL_STYLE, newstyle);
#define DWORD
Definition: nt_native.h:44
#define WS_BORDER
Definition: pedump.c:625
#define WS_HSCROLL
Definition: pedump.c:628
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_Notify()

static INT COMBOEX_Notify ( const COMBOEX_INFO infoPtr,
INT  code,
NMHDR hdr 
)
static

Definition at line 170 of file comboex.c.

170 : lstrcmpiW;
171}
172
173static INT COMBOEX_Notify (const COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr)
174{
175 hdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
176 hdr->hwndFrom = infoPtr->hwndSelf;
177 hdr->code = code;
178 if (infoPtr->NtfUnicode)
179 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr);
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4262
#define WM_NOTIFY
Definition: richedit.h:61
Definition: inflate.c:139

Referenced by COMBOEX_ComboWndProc(), and COMBOEX_NotifyItem().

◆ COMBOEX_NotifyDragBegin()

static void COMBOEX_NotifyDragBegin ( const COMBOEX_INFO infoPtr,
LPCWSTR  wstr 
)
static

Definition at line 239 of file comboex.c.

243{
244 /* Change the Text item from Unicode to ANSI if necessary for NOTIFY */
245 if (infoPtr->NtfUnicode) {
246 NMCBEDRAGBEGINW ndbw;
247
248 ndbw.iItemid = -1;
249 lstrcpynW(ndbw.szText, wstr, CBEMAXSTRLEN);
250 COMBOEX_Notify (infoPtr, CBEN_DRAGBEGINW, &ndbw.hdr);
251 } else {
252 NMCBEDRAGBEGINA ndba;
253
254 ndba.iItemid = -1;
255 WideCharToMultiByte (CP_ACP, 0, wstr, -1, ndba.szText, CBEMAXSTRLEN, 0, 0);
256
#define CBEMAXSTRLEN
Definition: commctrl.h:3897
#define CBEN_DRAGBEGINW
Definition: commctrl.h:3886
char szText[CBEMAXSTRLEN]
Definition: commctrl.h:3908
WCHAR szText[CBEMAXSTRLEN]
Definition: commctrl.h:3902

Referenced by COMBOEX_ComboWndProc().

◆ COMBOEX_NotifyEndEdit()

static INT COMBOEX_NotifyEndEdit ( const COMBOEX_INFO infoPtr,
NMCBEENDEDITW neew,
LPCWSTR  wstr 
)
static

Definition at line 219 of file comboex.c.

223{
224 /* Change the Text item from Unicode to ANSI if necessary for NOTIFY */
225 if (infoPtr->NtfUnicode) {
226 lstrcpynW(neew->szText, wstr, CBEMAXSTRLEN);
227 return COMBOEX_Notify (infoPtr, CBEN_ENDEDITW, &neew->hdr);
228 } else {
229 NMCBEENDEDITA neea;
230
231 neea.hdr = neew->hdr;
232 neea.fChanged = neew->fChanged;
233 neea.iNewSelection = neew->iNewSelection;
234 WideCharToMultiByte (CP_ACP, 0, wstr, -1, neea.szText, CBEMAXSTRLEN, 0, 0);
235 neea.iWhy = neew->iWhy;
236
#define CBEN_ENDEDITW
Definition: commctrl.h:3881
char szText[CBEMAXSTRLEN]
Definition: commctrl.h:3927
int iNewSelection
Definition: commctrl.h:3926
WCHAR szText[CBEMAXSTRLEN]
Definition: commctrl.h:3919

Referenced by COMBOEX_ComboWndProc().

◆ COMBOEX_NotifyFormat()

static LRESULT COMBOEX_NotifyFormat ( COMBOEX_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 1571 of file comboex.c.

1575{
1576 if (lParam == NF_REQUERY) {
1577 INT i = SendMessageW(infoPtr->hwndNotify,
1578 WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
1579 infoPtr->NtfUnicode = (i == NFR_UNICODE);
#define NF_REQUERY
Definition: winuser.h:2464

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_NotifyItem()

static INT COMBOEX_NotifyItem ( const COMBOEX_INFO infoPtr,
UINT  code,
NMCOMBOBOXEXW hdr 
)
static

Definition at line 183 of file comboex.c.

187{
188 /* Change the Text item from Unicode to ANSI if necessary for NOTIFY */
189 if (infoPtr->NtfUnicode)
190 return COMBOEX_Notify (infoPtr, code, &hdr->hdr);
191 else {
192 LPWSTR wstr = hdr->ceItem.pszText;
193 LPSTR astr = 0;
194 INT ret, len = 0;
195
196 if ((hdr->ceItem.mask & CBEIF_TEXT) && is_textW(wstr)) {
197 len = WideCharToMultiByte (CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL);
198 if (len > 0) {
199 astr = Alloc ((len + 1)*sizeof(CHAR));
200 if (!astr) return 0;
201 WideCharToMultiByte (CP_ACP, 0, wstr, -1, astr, len, 0, 0);
202 hdr->ceItem.pszText = (LPWSTR)astr;
203 }
204 }
205
209
210 ret = COMBOEX_Notify (infoPtr, code, (NMHDR *)hdr);
211
212 if (astr && hdr->ceItem.pszText == (LPWSTR)astr)
213 hdr->ceItem.pszText = wstr;
214
215 Free(astr);
216
#define CBEN_DRAGBEGINA
Definition: commctrl.h:3885
#define CBEN_ENDEDITA
Definition: commctrl.h:3880
#define CBEN_GETDISPINFOA
Definition: commctrl.h:3876
char CHAR
Definition: xmlstorage.h:175

◆ COMBOEX_Register()

void COMBOEX_Register ( void  )

Definition at line 2168 of file comboex.c.

2172{
2173 WNDCLASSW wndClass;
2174
2175 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2176 wndClass.style = CS_GLOBALCLASS;
2178 wndClass.cbClsExtra = 0;
2179 wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
2180 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2181 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2182 wndClass.lpszClassName = WC_COMBOBOXEXW;
static LRESULT WINAPI COMBOEX_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: comboex.c:1989
#define WC_COMBOBOXEXW
Definition: commctrl.h:3786
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
#define COLOR_WINDOW
Definition: winuser.h:921
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
#define CS_GLOBALCLASS
Definition: winuser.h:652

Referenced by DllMain().

◆ COMBOEX_ResetContent()

static void COMBOEX_ResetContent ( COMBOEX_INFO infoPtr)
static

Definition at line 1477 of file comboex.c.

1481{
1482 if (infoPtr->items)
1483 {
1485
1486 item = infoPtr->items;
1487 while (item) {
1488 next = item->next;
1490 Free (item);
1491 item = next;
1492 }
1493 infoPtr->items = 0;
1494 }
1495
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_ReSize()

static void COMBOEX_ReSize ( const COMBOEX_INFO infoPtr)
static

Definition at line 404 of file comboex.c.

408{
409 SIZE mysize;
410 LONG cy;
411 IMAGEINFO iinfo;
412
413 COMBOEX_GetComboFontSize (infoPtr, &mysize);
414 cy = mysize.cy + CBE_EXTRA;
415 if (infoPtr->himl && ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo)) {
416 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
417 TRACE("upgraded height due to image: height=%d\n", cy);
418 }
419 SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, -1, cy);
420 if (infoPtr->hwndCombo) {
422 if ( !(infoPtr->flags & CBES_EX_NOSIZELIMIT)) {
423 RECT comboRect, ourRect;
424 GetWindowRect(infoPtr->hwndCombo, &comboRect);
425 GetWindowRect(infoPtr->hwndSelf, &ourRect);
426 if (comboRect.bottom > ourRect.bottom)
427 SetWindowPos( infoPtr->hwndSelf, 0, 0, 0, ourRect.right - ourRect.left,
428 comboRect.bottom - comboRect.top,
long LONG
Definition: pedump.c:60
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define CBES_EX_NOSIZELIMIT
Definition: commctrl.h:3859
#define max(a, b)
Definition: svc.c:63
#define CB_SETITEMHEIGHT
Definition: winuser.h:1970

Referenced by COMBOEX_Create().

◆ COMBOEX_SetCursel()

static INT COMBOEX_SetCursel ( COMBOEX_INFO infoPtr,
INT_PTR  index 
)
static

Definition at line 875 of file comboex.c.

879{
881 INT sel;
882
883 if (!(item = COMBOEX_FindItem(infoPtr, index)))
884 return SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0);
885
886 TRACE("selecting item %ld text=%s\n", index, debugstr_txt(item->pszText));
887 infoPtr->selected = index;
888
889 sel = (INT)SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0);
#define INT
Definition: polytest.cpp:20

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetEditText()

static void COMBOEX_SetEditText ( const COMBOEX_INFO infoPtr,
CBE_ITEMDATA item 
)
static

Definition at line 432 of file comboex.c.

436{
437 if (!infoPtr->hwndEdit) return;
438
439 if (item->mask & CBEIF_TEXT) {
440 SendMessageW (infoPtr->hwndEdit, WM_SETTEXT, 0, (LPARAM)COMBOEX_GetText(infoPtr, item));
441 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
#define WM_SETTEXT
Definition: winuser.h:1620

◆ COMBOEX_SetExtendedStyle()

static DWORD COMBOEX_SetExtendedStyle ( COMBOEX_INFO infoPtr,
DWORD  mask,
DWORD  style 
)
static

Definition at line 693 of file comboex.c.

697{
698 DWORD dwTemp;
699
700 TRACE("(mask=x%08x, style=0x%08x)\n", mask, style);
701
702 dwTemp = infoPtr->dwExtStyle;
703
704 if (mask)
705 infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~mask) | style;
706 else
707 infoPtr->dwExtStyle = style;
708
709 /* see if we need to change the word break proc on the edit */
710 if ((infoPtr->dwExtStyle ^ dwTemp) & CBES_EX_PATHWORDBREAKPROC)
712 (infoPtr->dwExtStyle & CBES_EX_PATHWORDBREAKPROC) != 0);
713
714 /* test if the control's appearance has changed */
716 if ((infoPtr->dwExtStyle & mask) != (dwTemp & mask)) {
717 /* if state of EX_NOEDITIMAGE changes, invalidate all */
718 TRACE("EX_NOEDITIMAGE state changed to %d\n",
720 InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
721 COMBOEX_AdjustEditPos (infoPtr);
722 if (infoPtr->hwndEdit)
723 InvalidateRect (infoPtr->hwndEdit, NULL, TRUE);
724 }
Arabic default style
Definition: afstyles.h:94
LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet)
Definition: commctrl.c:1841
GLenum GLint GLuint mask
Definition: glext.h:6028
#define CBES_EX_PATHWORDBREAKPROC
Definition: commctrl.h:3858

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetFont()

static LRESULT COMBOEX_SetFont ( COMBOEX_INFO infoPtr,
HFONT  font,
BOOL  redraw 
)
static

Definition at line 1593 of file comboex.c.

1597{
1598 infoPtr->font = font;
1599 SendMessageW( infoPtr->hwndCombo, WM_SETFONT, (WPARAM)font, 0 );
1600 if (infoPtr->hwndEdit) SendMessageW( infoPtr->hwndEdit, WM_SETFONT, (WPARAM)font, 0 );
1601 COMBOEX_ReSize( infoPtr );
Definition: mk_font.cpp:20

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetImageList()

static HIMAGELIST COMBOEX_SetImageList ( COMBOEX_INFO infoPtr,
HIMAGELIST  himl 
)
static

Definition at line 727 of file comboex.c.

731{
732 HIMAGELIST himlTemp = infoPtr->himl;
733
734 TRACE("\n");
735
736 infoPtr->himl = himl;
737
738 COMBOEX_ReSize (infoPtr);
739 InvalidateRect (infoPtr->hwndCombo, NULL, TRUE);
740
741 /* reposition the Edit control based on whether icon exists */
HIMAGELIST himl

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetItemA()

static BOOL COMBOEX_SetItemA ( COMBOEX_INFO infoPtr,
COMBOBOXEXITEMA const cit 
)
static

Definition at line 794 of file comboex.c.

798{
799 COMBOBOXEXITEMW citW;
800 LPWSTR wstr = NULL;
801 BOOL ret;
802
803 memcpy(&citW, cit, sizeof(COMBOBOXEXITEMA));
804 if ((cit->mask & CBEIF_TEXT) && is_textA(cit->pszText)) {
805 INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
806 wstr = Alloc ((len + 1)*sizeof(WCHAR));
807 if (!wstr) return FALSE;
808 MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
809 citW.pszText = wstr;
810 }
811 ret = COMBOEX_SetItemW(infoPtr, &citW);
812
813 Free(wstr);
static BOOL COMBOEX_SetItemW(COMBOEX_INFO *infoPtr, const COMBOBOXEXITEMW *cit)
Definition: comboex.c:743
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetItemData()

static DWORD_PTR COMBOEX_SetItemData ( COMBOEX_INFO infoPtr,
INT_PTR  index,
DWORD_PTR  data 
)
static

Definition at line 892 of file comboex.c.

896{
898 CBE_ITEMDATA const *item2;
899
900 item1 = get_item_data(infoPtr, index);
901 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
902 item2 = COMBOEX_FindItem (infoPtr, index);
903 if (item2 != item1) {
904 ERR("data structures damaged!\n");
905 return CB_ERR;
906 }
907 item1->mask |= CBEIF_LPARAM;
908 item1->lParam = data;
909 TRACE("setting lparam to 0x%08lx\n", data);
910 return 0;
911 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetItemHeight()

static INT COMBOEX_SetItemHeight ( COMBOEX_INFO const infoPtr,
INT  index,
UINT  height 
)
static

Definition at line 914 of file comboex.c.

918{
919 RECT cb_wrect, cbx_wrect, cbx_crect;
920
921 /* First, lets forward the message to the normal combo control
922 just like Windows. */
923 if (infoPtr->hwndCombo)
924 if (SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT,
925 index, height) == CB_ERR) return CB_ERR;
926
927 GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
928 GetWindowRect (infoPtr->hwndSelf, &cbx_wrect);
929 GetClientRect (infoPtr->hwndSelf, &cbx_crect);
930 /* the height of comboex as height of the combo + comboex border */
931 height = cb_wrect.bottom-cb_wrect.top
932 + cbx_wrect.bottom-cbx_wrect.top
933 - (cbx_crect.bottom-cbx_crect.top);
934 TRACE("EX window=(%s), client=(%s)\n",
935 wine_dbgstr_rect(&cbx_wrect), wine_dbgstr_rect(&cbx_crect));
936 TRACE("CB window=(%s), EX setting=(0,0)-(%d,%d)\n",
937 wine_dbgstr_rect(&cbx_wrect), cbx_wrect.right-cbx_wrect.left, height);
938 SetWindowPos (infoPtr->hwndSelf, HWND_TOP, 0, 0,
939 cbx_wrect.right-cbx_wrect.left, height,
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetItemW()

static BOOL COMBOEX_SetItemW ( COMBOEX_INFO infoPtr,
const COMBOBOXEXITEMW cit 
)
static

Definition at line 743 of file comboex.c.

747{
748 INT_PTR index = cit->iItem;
750
751 if (TRACE_ON(comboex)) COMBOEX_DumpInput (cit);
752
753 /* if item number requested does not exist then return failure */
754 if ((index >= infoPtr->nb_items) || (index < -1)) return FALSE;
755
756 /* if the item is the edit control and there is no edit control, skip */
757 if ((index == -1) && !infoPtr->hwndEdit) return FALSE;
758
759 if (!(item = COMBOEX_FindItem(infoPtr, index))) return FALSE;
760
761 /* add/change stuff to the internal item structure */
762 item->mask |= cit->mask;
763 if (cit->mask & CBEIF_TEXT) {
764 INT len = 0;
765
767 if (is_textW(cit->pszText)) len = lstrlenW(cit->pszText);
768 if (len > 0) {
769 item->pszText = Alloc ((len + 1)*sizeof(WCHAR));
770 if (!item->pszText) return FALSE;
771 lstrcpyW(item->pszText, cit->pszText);
772 } else if (cit->pszText == LPSTR_TEXTCALLBACKW)
773 item->pszText = LPSTR_TEXTCALLBACKW;
774 item->cchTextMax = cit->cchTextMax;
775 }
776 if (cit->mask & CBEIF_IMAGE)
777 item->iImage = cit->iImage;
778 if (cit->mask & CBEIF_SELECTEDIMAGE)
779 item->iSelectedImage = cit->iSelectedImage;
780 if (cit->mask & CBEIF_OVERLAY)
781 item->iOverlay = cit->iOverlay;
782 if (cit->mask & CBEIF_INDENT)
783 item->iIndent = cit->iIndent;
784 if (cit->mask & CBEIF_LPARAM)
785 item->lParam = cit->lParam;
786
787 if (TRACE_ON(comboex)) COMBOEX_DumpItem (item);
788
789 /* if original request was to update edit control, do some fast foot work */
790 if (cit->iItem == -1 && cit->mask & CBEIF_TEXT) {
791 COMBOEX_SetEditText (infoPtr, item);

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetRedraw()

static LRESULT COMBOEX_SetRedraw ( const COMBOEX_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1603 of file comboex.c.

1607{
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1619

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetUnicodeFormat()

static BOOL COMBOEX_SetUnicodeFormat ( COMBOEX_INFO infoPtr,
BOOL  value 
)
static

Definition at line 816 of file comboex.c.

820{
821 BOOL bTemp = infoPtr->unicode;
822
823 TRACE("to %s, was %s\n", value ? "TRUE":"FALSE", bTemp ? "TRUE":"FALSE");
824
825 infoPtr->unicode = value;
Definition: pdh_main.c:94

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_Size()

static LRESULT COMBOEX_Size ( COMBOEX_INFO infoPtr,
INT  width,
INT  height 
)
static

Definition at line 1582 of file comboex.c.

1586{
1587 TRACE("(width=%d, height=%d)\n", width, height);
1588
1589 MoveWindow (infoPtr->hwndCombo, 0, 0, width, height, TRUE);
1590
1591 COMBOEX_AdjustEditPos (infoPtr);
GLint GLint GLsizei width
Definition: gl.h:1546
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_Unregister()

void COMBOEX_Unregister ( void  )

Definition at line 2185 of file comboex.c.

Referenced by DllMain().

◆ COMBOEX_WindowPosChanging()

static LRESULT COMBOEX_WindowPosChanging ( const COMBOEX_INFO infoPtr,
WINDOWPOS wp 
)
static

Definition at line 1611 of file comboex.c.

1615{
1616 RECT cbx_wrect, cbx_crect, cb_wrect;
1617 INT width, height;
1618
1619 GetWindowRect (infoPtr->hwndSelf, &cbx_wrect);
1620 GetClientRect (infoPtr->hwndSelf, &cbx_crect);
1621 GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
1622
1623 /* width is winpos value + border width of comboex */
1624 width = wp->cx
1625 + (cbx_wrect.right-cbx_wrect.left)
1626 - (cbx_crect.right-cbx_crect.left);
1627
1628 TRACE("winpos=(%d,%d %dx%d) flags=0x%08x\n",
1629 wp->x, wp->y, wp->cx, wp->cy, wp->flags);
1630 TRACE("EX window=(%s), client=(%s)\n",
1631 wine_dbgstr_rect(&cbx_wrect), wine_dbgstr_rect(&cbx_crect));
1632 TRACE("CB window=(%s), EX setting=(0,0)-(%d,%d)\n",
1633 wine_dbgstr_rect(&cbx_wrect), width, cb_wrect.bottom-cb_wrect.top);
1634
1635 if (width) SetWindowPos (infoPtr->hwndCombo, HWND_TOP, 0, 0,
1636 width,
1637 cb_wrect.bottom-cb_wrect.top,
1639
1640 GetWindowRect (infoPtr->hwndCombo, &cb_wrect);
1641
1642 /* height is combo window height plus border width of comboex */
1643 height = (cb_wrect.bottom-cb_wrect.top)
1644 + (cbx_wrect.bottom-cbx_wrect.top)
1645 - (cbx_crect.bottom-cbx_crect.top);
1646 wp->cy = height;
1647 if (infoPtr->hwndEdit) {
1648 COMBOEX_AdjustEditPos (infoPtr);
1649 InvalidateRect (infoPtr->hwndCombo, 0, TRUE);
1650 }
UINT flags
Definition: winuser.h:3597

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_WindowProc()

static LRESULT WINAPI COMBOEX_WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1989 of file comboex.c.

1993{
1995
1996 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, uMsg, wParam, lParam);
1997
1998 if (!infoPtr) {
1999 if (uMsg == WM_CREATE)
2001 if (uMsg == WM_NCCREATE)
2003 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2004 }
2005
2006 switch (uMsg)
2007 {
2008 case CBEM_DELETEITEM:
2009 return COMBOEX_DeleteItem (infoPtr, wParam);
2010
2012 return (LRESULT)infoPtr->hwndCombo;
2013
2015 return (LRESULT)infoPtr->hwndEdit;
2016
2018 return infoPtr->dwExtStyle;
2019
2020 case CBEM_GETIMAGELIST:
2021 return (LRESULT)infoPtr->himl;
2022
2023 case CBEM_GETITEMA:
2024 return (LRESULT)COMBOEX_GetItemA (infoPtr, (COMBOBOXEXITEMA *)lParam);
2025
2026 case CBEM_GETITEMW:
2027 return (LRESULT)COMBOEX_GetItemW (infoPtr, (COMBOBOXEXITEMW *)lParam);
2028
2030 return infoPtr->unicode;
2031
2033 return COMBOEX_HasEditChanged (infoPtr);
2034
2035 case CBEM_INSERTITEMA:
2036 return COMBOEX_InsertItemA (infoPtr, (COMBOBOXEXITEMA *)lParam);
2037
2038 case CBEM_INSERTITEMW:
2039 return COMBOEX_InsertItemW (infoPtr, (COMBOBOXEXITEMW *)lParam);
2040
2041 case CBEM_SETEXSTYLE:
2043 return COMBOEX_SetExtendedStyle (infoPtr, (DWORD)wParam, (DWORD)lParam);
2044
2045 case CBEM_SETIMAGELIST:
2046 return (LRESULT)COMBOEX_SetImageList (infoPtr, (HIMAGELIST)lParam);
2047
2048 case CBEM_SETITEMA:
2049 return COMBOEX_SetItemA (infoPtr, (COMBOBOXEXITEMA *)lParam);
2050
2051 case CBEM_SETITEMW:
2052 return COMBOEX_SetItemW (infoPtr, (COMBOBOXEXITEMW *)lParam);
2053
2055 return COMBOEX_SetUnicodeFormat (infoPtr, wParam);
2056
2057 /*case CBEM_SETWINDOWTHEME:
2058 FIXME("CBEM_SETWINDOWTHEME: stub\n");*/
2059
2060 case WM_SETTEXT:
2061 case WM_GETTEXT:
2062 case WM_GETTEXTLENGTH:
2063 return SendMessageW(infoPtr->hwndEdit, uMsg, wParam, lParam);
2064
2065 case CB_GETLBTEXT:
2066 return COMBOEX_GetListboxText(infoPtr, wParam, (LPWSTR)lParam);
2067
2068 case CB_GETLBTEXTLEN:
2069 return COMBOEX_GetListboxText(infoPtr, wParam, NULL);
2070
2071 case CB_RESETCONTENT:
2072 COMBOEX_ResetContent(infoPtr);
2073 /* fall through */
2074
2075/* Combo messages we are not sure if we need to process or just forward */
2077 case CB_GETITEMHEIGHT:
2078 case CB_GETEXTENDEDUI:
2079 case CB_LIMITTEXT:
2080 case CB_SELECTSTRING:
2081
2082/* Combo messages OK to just forward to the regular COMBO */
2083 case CB_GETCOUNT:
2084 case CB_GETCURSEL:
2085 case CB_GETDROPPEDSTATE:
2086 case CB_SETDROPPEDWIDTH:
2087 case CB_SETEXTENDEDUI:
2088 case CB_SHOWDROPDOWN:
2089 return SendMessageW (infoPtr->hwndCombo, uMsg, wParam, lParam);
2090
2091/* Combo messages we need to process specially */
2092 case CB_FINDSTRINGEXACT:
2093 return COMBOEX_FindStringExact (infoPtr, (INT)wParam, (LPCWSTR)lParam);
2094
2095 case CB_GETITEMDATA:
2096 return COMBOEX_GetItemData (infoPtr, (INT)wParam);
2097
2098 case CB_SETCURSEL:
2099 return COMBOEX_SetCursel (infoPtr, (INT)wParam);
2100
2101 case CB_SETITEMDATA:
2102 return COMBOEX_SetItemData (infoPtr, (INT)wParam, (DWORD_PTR)lParam);
2103
2104 case CB_SETITEMHEIGHT:
2105 return COMBOEX_SetItemHeight (infoPtr, (INT)wParam, (UINT)lParam);
2106
2107
2108
2109/* Window messages passed to parent */
2110 case WM_COMMAND:
2111 return COMBOEX_Command (infoPtr, wParam);
2112
2113 case WM_NOTIFY:
2114 if (infoPtr->NtfUnicode)
2115 return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
2116 else
2117 return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
2118
2119
2120/* Window messages we need to process */
2121 case WM_DELETEITEM:
2122 return COMBOEX_WM_DeleteItem (infoPtr, (DELETEITEMSTRUCT *)lParam);
2123
2124 case WM_DRAWITEM:
2125 return COMBOEX_DrawItem (infoPtr, (DRAWITEMSTRUCT *)lParam);
2126
2127 case WM_DESTROY:
2128 return COMBOEX_Destroy (infoPtr);
2129
2130 case WM_ENABLE:
2131 return COMBOEX_Enable (infoPtr, (BOOL)wParam);
2132
2133 case WM_MEASUREITEM:
2134 return COMBOEX_MeasureItem (infoPtr, (MEASUREITEMSTRUCT *)lParam);
2135
2136 case WM_NOTIFYFORMAT:
2137 return COMBOEX_NotifyFormat (infoPtr, lParam);
2138
2139 case WM_SIZE:
2140 return COMBOEX_Size (infoPtr, LOWORD(lParam), HIWORD(lParam));
2141
2142 case WM_GETFONT:
2143 return (LRESULT)infoPtr->font;
2144
2145 case WM_SETFONT:
2146 return COMBOEX_SetFont( infoPtr, (HFONT)wParam, LOWORD(lParam) != 0 );
2147
2148 case WM_SETREDRAW:
2149 return COMBOEX_SetRedraw(infoPtr, wParam, lParam);
2150
2152 return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam);
2153
2154 case WM_SETFOCUS:
2155 if (infoPtr->hwndEdit) SetFocus( infoPtr->hwndEdit );
2156 else SetFocus( infoPtr->hwndCombo );
2157 return 0;
2158
2159 case WM_SYSCOLORCHANGE:
2161 return 0;
2162
2163 default:
2164 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
2165 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",uMsg,wParam,lParam);
static BOOL COMBOEX_SetItemA(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
Definition: comboex.c:794
static LRESULT COMBOEX_Command(COMBOEX_INFO *infoPtr, WPARAM wParam)
Definition: comboex.c:1067
static INT COMBOEX_FindStringExact(const COMBOEX_INFO *infoPtr, INT start, LPCWSTR str)
Definition: comboex.c:831
static LRESULT COMBOEX_MeasureItem(COMBOEX_INFO const *infoPtr, MEASUREITEMSTRUCT *mis)
Definition: comboex.c:1537
static INT COMBOEX_SetItemHeight(COMBOEX_INFO const *infoPtr, INT index, UINT height)
Definition: comboex.c:914
static LRESULT COMBOEX_SetFont(COMBOEX_INFO *infoPtr, HFONT font, BOOL redraw)
Definition: comboex.c:1593
static BOOL COMBOEX_HasEditChanged(COMBOEX_INFO const *infoPtr)
Definition: comboex.c:579
static DWORD COMBOEX_SetExtendedStyle(COMBOEX_INFO *infoPtr, DWORD mask, DWORD style)
Definition: comboex.c:693
static LRESULT COMBOEX_NCCreate(HWND hwnd)
Definition: comboex.c:1555
static INT COMBOEX_InsertItemA(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
Definition: comboex.c:670
static LRESULT COMBOEX_SetRedraw(const COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: comboex.c:1603
static LRESULT COMBOEX_WindowPosChanging(const COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
Definition: comboex.c:1611
static LRESULT COMBOEX_Enable(COMBOEX_INFO *infoPtr, BOOL enable)
Definition: comboex.c:1521
static DWORD_PTR COMBOEX_SetItemData(COMBOEX_INFO *infoPtr, INT_PTR index, DWORD_PTR data)
Definition: comboex.c:892
static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, INT_PTR n, LPWSTR buf)
Definition: comboex.c:470
static LRESULT COMBOEX_Create(HWND hwnd, CREATESTRUCTA const *cs)
Definition: comboex.c:946
static INT COMBOEX_SetCursel(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:875
static LRESULT COMBOEX_NotifyFormat(COMBOEX_INFO *infoPtr, LPARAM lParam)
Definition: comboex.c:1571
static DWORD_PTR COMBOEX_GetItemData(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:852
static BOOL COMBOEX_SetUnicodeFormat(COMBOEX_INFO *infoPtr, BOOL value)
Definition: comboex.c:816
static BOOL COMBOEX_WM_DeleteItem(COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT const *dis)
Definition: comboex.c:1208
static HIMAGELIST COMBOEX_SetImageList(COMBOEX_INFO *infoPtr, HIMAGELIST himl)
Definition: comboex.c:727
static LRESULT COMBOEX_Destroy(COMBOEX_INFO *infoPtr)
Definition: comboex.c:1498
static INT COMBOEX_DeleteItem(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:508
static BOOL COMBOEX_GetItemA(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
Definition: comboex.c:544
static LRESULT COMBOEX_DrawItem(COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *dis)
Definition: comboex.c:1255
static LRESULT COMBOEX_Size(COMBOEX_INFO *infoPtr, INT width, INT height)
Definition: comboex.c:1582
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1593
#define WM_APP
Definition: eventvwr.h:73
#define CBEM_GETUNICODEFORMAT
Definition: commctrl.h:3844
#define CBEM_HASEDITCHANGED
Definition: commctrl.h:3845
#define CBEM_GETITEMW
Definition: commctrl.h:3848
#define CBEM_GETIMAGELIST
Definition: commctrl.h:3833
#define CBEM_SETITEMW
Definition: commctrl.h:3847
#define CBEM_GETCOMBOCONTROL
Definition: commctrl.h:3837
#define CBEM_DELETEITEM
Definition: commctrl.h:3836
#define CBEM_SETEXTENDEDSTYLE
Definition: commctrl.h:3840
#define CBEM_SETIMAGELIST
Definition: commctrl.h:3832
#define CBEM_INSERTITEMA
Definition: commctrl.h:3831
#define CBEM_INSERTITEMW
Definition: commctrl.h:3846
#define CBEM_SETEXSTYLE
Definition: commctrl.h:3839
#define CBEM_SETUNICODEFORMAT
Definition: commctrl.h:3843
#define CBEM_GETITEMA
Definition: commctrl.h:3834
#define CBEM_GETEXTENDEDSTYLE
Definition: commctrl.h:3842
#define CBEM_SETITEMA
Definition: commctrl.h:3835
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3838
#define CB_SELECTSTRING
Definition: winuser.h:1963
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define WM_GETTEXTLENGTH
Definition: winuser.h:1622
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1965
#define CB_GETLBTEXTLEN
Definition: winuser.h:1956
#define CB_GETLBTEXT
Definition: winuser.h:1955
#define WM_ENABLE
Definition: winuser.h:1618
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1664
#define WM_CREATE
Definition: winuser.h:1611
#define WM_SIZE
Definition: winuser.h:1614
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1621
#define CB_RESETCONTENT
Definition: winuser.h:1962
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1943
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
#define WM_DELETEITEM
Definition: winuser.h:1650
#define WM_NCCREATE
Definition: winuser.h:1686
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1947
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define WM_MEASUREITEM
Definition: winuser.h:1649
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1948
#define CB_GETEXTENDEDUI
Definition: winuser.h:1951
#define CB_LIMITTEXT
Definition: winuser.h:1961
#define WM_USER
Definition: winuser.h:1898
#define WM_DESTROY
Definition: winuser.h:1612
#define CB_SETEXTENDEDUI
Definition: winuser.h:1967

◆ COMBOEX_WM_DeleteItem()

static BOOL COMBOEX_WM_DeleteItem ( COMBOEX_INFO infoPtr,
DELETEITEMSTRUCT const dis 
)
static

Definition at line 1208 of file comboex.c.

1212{
1213 CBE_ITEMDATA *item, *olditem;
1214 NMCOMBOBOXEXW nmcit;
1215 UINT i;
1216
1217 TRACE("CtlType=%08x, CtlID=%08x, itemID=%08x, hwnd=%p, data=%08lx\n",
1218 dis->CtlType, dis->CtlID, dis->itemID, dis->hwndItem, dis->itemData);
1219
1220 if (dis->itemID >= infoPtr->nb_items) return FALSE;
1221
1222 olditem = infoPtr->items;
1223 i = infoPtr->nb_items - 1;
1224
1225 if (i == dis->itemID) {
1226 infoPtr->items = infoPtr->items->next;
1227 }
1228 else {
1229 item = olditem;
1230 i--;
1231
1232 /* find the prior item in the list */
1233 while (item->next && (i > dis->itemID)) {
1234 item = item->next;
1235 i--;
1236 }
1237 if (!item->next || (i != dis->itemID)) {
1238 ERR("COMBOBOXEX item structures broken. Please report!\n");
1239 return FALSE;
1240 }
1241 olditem = item->next;
1242 item->next = item->next->next;
1243 }
1244 infoPtr->nb_items--;
1245
1246 memset (&nmcit.ceItem, 0, sizeof(nmcit.ceItem));
1247 nmcit.ceItem.mask=~0;
1248 COMBOEX_CopyItem (olditem, &nmcit.ceItem);
1249 COMBOEX_NotifyItem (infoPtr, CBEN_DELETEITEM, &nmcit);
1250
1251 COMBOEX_FreeText(olditem);
1252 Free(olditem);
#define CBEN_DELETEITEM
Definition: commctrl.h:3878

Referenced by COMBOEX_WindowProc().

◆ debugstr_txt()

static LPCSTR debugstr_txt ( LPCWSTR  str)
inlinestatic

Definition at line 130 of file comboex.c.

134{

◆ get_cmp_func()

static cmp_func_t get_cmp_func ( COMBOEX_INFO const infoPtr)
inlinestatic

Definition at line 165 of file comboex.c.

Referenced by COMBOEX_ComboWndProc(), and COMBOEX_FindStringExact().

◆ get_item_data()

static CBE_ITEMDATA * get_item_data ( const COMBOEX_INFO infoPtr,
INT  index 
)
inlinestatic

Definition at line 159 of file comboex.c.

163{

Referenced by COMBOEX_FindStringExact().

◆ is_textA()

static BOOL is_textA ( LPCSTR  str)
inlinestatic

Definition at line 125 of file comboex.c.

◆ is_textW()

static BOOL is_textW ( LPCWSTR  str)
inlinestatic

Definition at line 120 of file comboex.c.

Referenced by COMBOEX_NotifyItem().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( comboex  )