ReactOS 0.4.15-dev-7693-gd0e2924
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 "wine/unicode.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 98 of file comboex.c.

◆ CBE_INDENT

#define CBE_INDENT   10

Definition at line 101 of file comboex.c.

◆ CBE_SEP

#define CBE_SEP   4

Definition at line 107 of file comboex.c.

◆ CBE_STARTOFFSET

#define CBE_STARTOFFSET   6

Definition at line 104 of file comboex.c.

◆ COMBO_SUBCLASSID

#define COMBO_SUBCLASSID   1

Definition at line 109 of file comboex.c.

◆ COMBOEX_GetInfoPtr

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

Definition at line 112 of file comboex.c.

◆ EDIT_SUBCLASSID

#define EDIT_SUBCLASSID   2

Definition at line 110 of file comboex.c.

◆ ID_CB_EDIT

#define ID_CB_EDIT   1001

Definition at line 80 of file comboex.c.

◆ ODS_COMBOEXLBOX

#define ODS_COMBOEXLBOX   0x4000

Definition at line 93 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 73 of file comboex.c.

◆ WCBE_EDITCHG

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

Definition at line 74 of file comboex.c.

◆ WCBE_EDITFOCUSED

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

Definition at line 76 of file comboex.c.

◆ WCBE_EDITHASCHANGED

#define WCBE_EDITHASCHANGED   (WCBE_ACTEDIT | WCBE_EDITCHG)

Definition at line 75 of file comboex.c.

◆ WCBE_MOUSECAPTURED

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

Definition at line 77 of file comboex.c.

◆ WCBE_MOUSEDRAGGED

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

Definition at line 78 of file comboex.c.

Typedef Documentation

◆ CBE_ITEMDATA

◆ cmp_func_t

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

Definition at line 119 of file comboex.c.

Function Documentation

◆ COMBOEX_AdjustEditPos()

static void COMBOEX_AdjustEditPos ( const COMBOEX_INFO infoPtr)
static

Definition at line 371 of file comboex.c.

375{
376 SIZE mysize;
377 INT x, y, w, h, xioff;
378 RECT rect;
379
380 if (!infoPtr->hwndEdit) return;
381
382 if (infoPtr->himl && !(infoPtr->dwExtStyle & CBES_EX_NOEDITIMAGEINDENT)) {
383 IMAGEINFO iinfo;
384 iinfo.rcImage.left = iinfo.rcImage.right = 0;
385 ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo);
386 xioff = iinfo.rcImage.right - iinfo.rcImage.left + CBE_SEP;
387 } else xioff = 0;
388
389 GetClientRect (infoPtr->hwndCombo, &rect);
390 InflateRect (&rect, -2, -2);
391 InvalidateRect (infoPtr->hwndCombo, &rect, TRUE);
392
393 /* reposition the Edit control based on whether icon exists */
394 COMBOEX_GetComboFontSize (infoPtr, &mysize);
395 TRACE("Combo font x=%d, y=%d\n", mysize.cx, mysize.cy);
396 x = xioff + CBE_STARTOFFSET + 1;
397 w = rect.right-rect.left - x - GetSystemMetrics(SM_CXVSCROLL) - 1;
398 h = mysize.cy + 1;
399 y = rect.bottom - h - 1;
400
401 TRACE("Combo client (%s), setting Edit to (%d,%d)-(%d,%d)\n",
402 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:104
static void COMBOEX_GetComboFontSize(const COMBOEX_INFO *infoPtr, SIZE *size)
Definition: comboex.c:326
#define CBE_SEP
Definition: comboex.c:107
#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:3852
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
DWORD dwExtStyle
Definition: comboex.c:60
HWND hwndEdit
Definition: comboex.c:59
HWND hwndCombo
Definition: comboex.c:58
HIMAGELIST himl
Definition: comboex.c:55
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:960
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 1811 of file comboex.c.

1816{
1817 COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr ((HWND)ref_data);
1818 NMCBEENDEDITW cbeend;
1819 NMMOUSE nmmse;
1820 COLORREF obkc;
1821 HDC hDC;
1822 HWND focusedhwnd;
1823 RECT rect;
1824 POINT pt;
1825 WCHAR edit_text[260];
1826
1827 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx, info_ptr=%p\n",
1828 hwnd, uMsg, wParam, lParam, infoPtr);
1829
1830 if (uMsg == WM_NCDESTROY)
1832
1833 if (!infoPtr)
1834 return DefSubclassProc(hwnd, uMsg, wParam, lParam);
1835
1836 switch (uMsg)
1837 {
1838 case WM_DRAWITEM:
1839 /*
1840 * The only way this message should come is from the
1841 * child Listbox issuing the message. Flag this so
1842 * that ComboEx knows this is listbox.
1843 */
1844 ((DRAWITEMSTRUCT *)lParam)->itemState |= ODS_COMBOEXLBOX;
1845 break;
1846
1847 case WM_ERASEBKGND:
1848 hDC = (HDC) wParam;
1851 TRACE("erasing (%s)\n", wine_dbgstr_rect(&rect));
1852 ExtTextOutW (hDC, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0);
1853 SetBkColor (hDC, obkc);
1854 break;
1855
1856 case WM_SETCURSOR:
1857 /*
1858 * WM_NOTIFY to comboex parent (rebar)
1859 * with NM_SETCURSOR with extra words of 0,0,0,0,0x02010001
1860 * CallWindowProc (previous)
1861 */
1862 nmmse.dwItemSpec = 0;
1863 nmmse.dwItemData = 0;
1864 nmmse.pt.x = 0;
1865 nmmse.pt.y = 0;
1866 nmmse.dwHitInfo = lParam;
1867 COMBOEX_Notify (infoPtr, NM_SETCURSOR, (NMHDR *)&nmmse);
1868 break;
1869
1870 case WM_LBUTTONDOWN:
1872 rect.bottom = rect.top + SendMessageW(infoPtr->hwndSelf,
1873 CB_GETITEMHEIGHT, -1, 0);
1874 rect.left = rect.right - GetSystemMetrics(SM_CXVSCROLL);
1875 pt.x = (short)LOWORD(lParam);
1876 pt.y = (short)HIWORD(lParam);
1877 if (PtInRect(&rect, pt))
1878 break;
1879
1880 infoPtr->flags |= WCBE_MOUSECAPTURED;
1882 return 0;
1883
1884 case WM_LBUTTONUP:
1885 if (!(infoPtr->flags & WCBE_MOUSECAPTURED))
1886 break;
1887
1889 infoPtr->flags &= ~WCBE_MOUSECAPTURED;
1890 if (infoPtr->flags & WCBE_MOUSEDRAGGED) {
1891 infoPtr->flags &= ~WCBE_MOUSEDRAGGED;
1892 } else {
1894 }
1895 return 0;
1896
1897 case WM_MOUSEMOVE:
1898 if ( (infoPtr->flags & WCBE_MOUSECAPTURED) &&
1899 !(infoPtr->flags & WCBE_MOUSEDRAGGED)) {
1900 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1901 COMBOEX_NotifyDragBegin(infoPtr, edit_text);
1902 infoPtr->flags |= WCBE_MOUSEDRAGGED;
1903 }
1904 break;
1905
1906 case WM_COMMAND:
1907 switch (HIWORD(wParam)) {
1908
1909 case EN_UPDATE:
1910 /* traces show that COMBOEX does not issue CBN_EDITUPDATE
1911 * on the EN_UPDATE
1912 */
1913 return 0;
1914
1915 case EN_KILLFOCUS:
1916 focusedhwnd = GetFocus();
1917 if (infoPtr->flags & WCBE_ACTEDIT) {
1918 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1919 cbeend.fChanged = (infoPtr->flags & WCBE_EDITCHG);
1920 cbeend.iNewSelection = SendMessageW (infoPtr->hwndCombo,
1921 CB_GETCURSEL, 0, 0);
1922 cbeend.iWhy = CBENF_KILLFOCUS;
1923
1924 infoPtr->flags &= ~(WCBE_ACTEDIT | WCBE_EDITCHG);
1925 if (COMBOEX_NotifyEndEdit (infoPtr, &cbeend, edit_text)) return 0;
1926 }
1927 /* possible CB_GETCURSEL */
1928 InvalidateRect (infoPtr->hwndCombo, 0, 0);
1929 if (focusedhwnd)
1931 (WPARAM)focusedhwnd, 0);
1932 return 0;
1933
1934 case EN_SETFOCUS: {
1935 NMHDR hdr;
1936
1937 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, 0);
1938 SendMessageW (infoPtr->hwndEdit, EM_SETSEL, 0, -1);
1939 COMBOEX_Notify (infoPtr, CBEN_BEGINEDIT, &hdr);
1940 infoPtr->flags |= WCBE_ACTEDIT;
1941 infoPtr->flags &= ~WCBE_EDITCHG; /* no change yet */
1942 return 0;
1943 }
1944
1945 case EN_CHANGE: {
1946 LPCWSTR lastwrk;
1947 cmp_func_t cmptext = get_cmp_func(infoPtr);
1948
1950 CB_GETCURSEL, 0, 0);
1951
1952 /* lstrlenW( lastworkingURL ) */
1953
1954 GetWindowTextW (infoPtr->hwndEdit, edit_text, 260);
1955 if (selected == -1) {
1956 lastwrk = infoPtr->edit.pszText;
1957 }
1958 else {
1960 lastwrk = COMBOEX_GetText(infoPtr, item);
1961 }
1962
1963 TRACE("handling EN_CHANGE, selected = %ld, selected_text=%s\n",
1964 selected, debugstr_w(lastwrk));
1965 TRACE("handling EN_CHANGE, edittext=%s\n",
1966 debugstr_w(edit_text));
1967
1968 /* cmptext is between lastworkingURL and GetWindowText */
1969 if (cmptext (lastwrk, edit_text)) {
1970 /* strings not equal -- indicate edit has changed */
1971 infoPtr->flags |= WCBE_EDITCHG;
1972 }
1974 MAKEWPARAM(GetDlgCtrlID (infoPtr->hwndSelf),
1976 (LPARAM)infoPtr->hwndSelf);
1977 return 0;
1978 }
1979
1980 case LBN_SELCHANGE:
1981 default:
1982 break;
1983 }/* fall through */
1984 default:
1985 ;
1986 }
static HDC hDC
Definition: 3dtext.c:33
#define WCBE_EDITCHG
Definition: comboex.c:74
#define COMBOEX_GetInfoPtr(hwnd)
Definition: comboex.c:112
static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:445
static INT COMBOEX_Notify(const COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr)
Definition: comboex.c:171
INT(WINAPI * cmp_func_t)(LPCWSTR, LPCWSTR)
Definition: comboex.c:119
static void COMBOEX_NotifyDragBegin(const COMBOEX_INFO *infoPtr, LPCWSTR wstr)
Definition: comboex.c:240
#define WCBE_MOUSECAPTURED
Definition: comboex.c:77
static INT COMBOEX_NotifyEndEdit(const COMBOEX_INFO *infoPtr, NMCBEENDEDITW *neew, LPCWSTR wstr)
Definition: comboex.c:220
#define WCBE_ACTEDIT
Definition: comboex.c:73
#define ODS_COMBOEXLBOX
Definition: comboex.c:93
static LRESULT CALLBACK COMBOEX_ComboWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR ref_data)
Definition: comboex.c:1811
#define WCBE_MOUSEDRAGGED
Definition: comboex.c:78
static cmp_func_t get_cmp_func(COMBOEX_INFO const *infoPtr)
Definition: comboex.c:166
static LPCWSTR COMBOEX_GetText(const COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
Definition: comboex.c:289
#define COMBO_SUBCLASSID
Definition: comboex.c:109
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:1390
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1496
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:92
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:3874
#define CBENF_KILLFOCUS
Definition: commctrl.h:3887
HWND hwndNotify
Definition: comboex.c:57
DWORD flags
Definition: comboex.c:62
CBE_ITEMDATA edit
Definition: comboex.c:68
HWND hwndSelf
Definition: comboex.c:56
COLORREF clrWindow
Definition: comctl32.h:176
int iNewSelection
Definition: commctrl.h:3913
LPWSTR pszText
Definition: comboex.c:42
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:1412
_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:1893
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define WM_ERASEBKGND
Definition: winuser.h:1624
#define MAKEWPARAM(l, h)
Definition: winuser.h:4008
#define EN_KILLFOCUS
Definition: winuser.h:2024
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define CB_SHOWDROPDOWN
Definition: winuser.h:1969
#define CB_GETITEMHEIGHT
Definition: winuser.h:1950
#define EN_SETFOCUS
Definition: winuser.h:2026
#define EN_UPDATE
Definition: winuser.h:2027
#define WM_COMMAND
Definition: winuser.h:1739
#define WM_MOUSEMOVE
Definition: winuser.h:1774
#define WM_LBUTTONDOWN
Definition: winuser.h:1775
#define WM_DRAWITEM
Definition: winuser.h:1644
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define EM_SETSEL
Definition: winuser.h:2017
#define WM_LBUTTONUP
Definition: winuser.h:1776
#define LBN_SELCHANGE
Definition: winuser.h:2074
#define WM_NCDESTROY
Definition: winuser.h:1683
#define WM_SETCURSOR
Definition: winuser.h:1635
int WINAPI GetDlgCtrlID(_In_ HWND)
#define CB_GETCURSEL
Definition: winuser.h:1942
#define WM_KILLFOCUS
Definition: winuser.h:1613
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CBN_EDITCHANGE
Definition: winuser.h:1974
#define EN_CHANGE
Definition: winuser.h:2021
__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 1068 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_CopyItem()

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

Definition at line 342 of file comboex.c.

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

◆ COMBOEX_Create()

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

Definition at line 947 of file comboex.c.

951{
952 static const WCHAR NIL[] = { 0 };
953 COMBOEX_INFO *infoPtr;
954 LOGFONTW mylogfont;
955 RECT win_rect;
956 INT i;
957
958 /* allocate memory for info structure */
959 infoPtr = Alloc (sizeof(COMBOEX_INFO));
960 if (!infoPtr) return -1;
961
962 /* initialize info structure */
963 /* note that infoPtr is allocated zero-filled */
964
965 infoPtr->hwndSelf = hwnd;
966 infoPtr->selected = -1;
967
968 infoPtr->unicode = IsWindowUnicode (hwnd);
969 infoPtr->hwndNotify = cs->hwndParent;
970
971 i = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
972 if ((i != NFR_ANSI) && (i != NFR_UNICODE)) {
973 WARN("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i);
974 i = NFR_ANSI;
975 }
976 infoPtr->NtfUnicode = (i == NFR_UNICODE);
977
978 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
979
980 if (TRACE_ON(comboex)) {
984 TRACE("EX window=(%s), client=(%s)\n",
986 }
987
988 /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */
989 /* specified. It then creates its own version of the EDIT control */
990 /* and makes the ComboBox the parent. This is because a normal */
991 /* DROPDOWNLIST does not have an EDIT control, but we need one. */
992 /* We also need to place the edit control at the proper location */
993 /* (allow space for the icons). */
994
1000 cs->y, cs->x, cs->cx, cs->cy, hwnd,
1003
1005 (DWORD_PTR)hwnd);
1006 infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
1007
1008 /*
1009 * Now create our own EDIT control so we can position it.
1010 * It is created only for CBS_DROPDOWN style
1011 */
1012 if ((cs->style & CBS_DROPDOWNLIST) == CBS_DROPDOWN) {
1013 infoPtr->hwndEdit = CreateWindowExW (0, WC_EDITW, NIL,
1015 0, 0, 0, 0, /* will set later */
1016 infoPtr->hwndCombo,
1019
1021 (DWORD_PTR)hwnd);
1022
1023 infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0);
1024 }
1025
1026 /*
1027 * Locate the default font if necessary and then set it in
1028 * all associated controls
1029 */
1030 if (!infoPtr->font) {
1032 &mylogfont, 0);
1033 infoPtr->font = infoPtr->defaultFont = CreateFontIndirectW (&mylogfont);
1034 }
1035 SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0);
1036 if (infoPtr->hwndEdit) {
1037 SendMessageW (infoPtr->hwndEdit, WM_SETFONT, (WPARAM)infoPtr->font, 0);
1039 }
1040
1041 COMBOEX_ReSize (infoPtr);
1042
1043 /* Above is fairly certain, below is much less certain. */
1044
1045 GetWindowRect(hwnd, &win_rect);
1046
1047 if (TRACE_ON(comboex)) {
1048 RECT client, rect;
1050 GetWindowRect(infoPtr->hwndCombo, &rect);
1051 TRACE("EX window=(%s) client=(%s) CB wnd=(%s)\n",
1054 }
1055 SetWindowPos(infoPtr->hwndCombo, HWND_TOP, 0, 0,
1056 win_rect.right - win_rect.left, win_rect.bottom - win_rect.top,
1058
1059 GetWindowRect(infoPtr->hwndCombo, &win_rect);
1060 TRACE("CB window=(%s)\n", wine_dbgstr_rect(&win_rect));
1061 SetWindowPos(hwnd, HWND_TOP, 0, 0,
1062 win_rect.right - win_rect.left, win_rect.bottom - win_rect.top,
1064
1065 COMBOEX_AdjustEditPos (infoPtr);
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
#define WARN(fmt,...)
Definition: debug.h:112
static void COMBOEX_ReSize(const COMBOEX_INFO *infoPtr)
Definition: comboex.c:405
static LRESULT CALLBACK COMBOEX_EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR ref_data)
Definition: comboex.c:1654
static void COMBOEX_AdjustEditPos(const COMBOEX_INFO *infoPtr)
Definition: comboex.c:371
#define EDIT_SUBCLASSID
Definition: comboex.c:110
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1261
#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:4687
#define WC_COMBOBOXW
Definition: commctrl.h:4717
static FILE * client
Definition: client.c:41
BOOL NtfUnicode
Definition: comboex.c:67
BOOL unicode
Definition: comboex.c:66
HFONT font
Definition: comboex.c:64
HFONT defaultFont
Definition: comboex.c:63
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:1241
#define SWP_NOREDRAW
Definition: winuser.h:1245
#define GetWindowLongPtrW
Definition: winuser.h:4828
#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:1243
#define EC_USEFONTINFO
Definition: winuser.h:2607
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1379
#define WM_GETFONT
Definition: winuser.h:1650
#define GWLP_HINSTANCE
Definition: winuser.h:855
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define HWND_TOP
Definition: winuser.h:1206
#define WM_SETFONT
Definition: winuser.h:1649
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:4315
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define NFR_ANSI
Definition: winuser.h:2457
#define GWLP_ID
Definition: winuser.h:859
#define SWP_NOZORDER
Definition: winuser.h:1246
#define SetWindowLongPtrW
Definition: winuser.h:5345
#define NFR_UNICODE
Definition: winuser.h:2458
#define GWL_STYLE
Definition: winuser.h:851
#define EM_SETMARGINS
Definition: winuser.h:2011
#define NF_QUERY
Definition: winuser.h:2459

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_DeleteItem()

static INT COMBOEX_DeleteItem ( COMBOEX_INFO infoPtr,
INT_PTR  index 
)
static

Definition at line 509 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_Destroy()

static LRESULT COMBOEX_Destroy ( COMBOEX_INFO infoPtr)
static

Definition at line 1499 of file comboex.c.

1503{
1504 if (infoPtr->hwndCombo)
1506
1507 if (infoPtr->hwndEdit)
1509
1510 COMBOEX_FreeText (&infoPtr->edit);
1511 COMBOEX_ResetContent (infoPtr);
1512
1513 if (infoPtr->defaultFont)
1514 DeleteObject (infoPtr->defaultFont);
1515
1516 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
1517
1518 /* free comboex info data */
1519 Free (infoPtr);
static void COMBOEX_ResetContent(COMBOEX_INFO *infoPtr)
Definition: comboex.c:1478
static void COMBOEX_FreeText(CBE_ITEMDATA *item)
Definition: comboex.c:260
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 1256 of file comboex.c.

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

152{
153 TRACE("input - mask=%08x, iItem=%ld, pszText=%p, cchTM=%d, iImage=%d\n",
154 input->mask, input->iItem, input->pszText, input->cchTextMax,
155 input->iImage);
156 if (input->mask & CBEIF_TEXT)
157 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 137 of file comboex.c.

141{
142 TRACE("item %p - mask=%08x, pszText=%p, cchTM=%d, iImage=%d\n",
143 item, item->mask, item->pszText, item->cchTextMax, item->iImage);
144 TRACE("item %p - iSelectedImage=%d, iOverlay=%d, iIndent=%d, lParam=%08lx\n",
145 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 1654 of file comboex.c.

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

Referenced by COMBOEX_Create().

◆ COMBOEX_Enable()

static LRESULT COMBOEX_Enable ( COMBOEX_INFO infoPtr,
BOOL  enable 
)
static

Definition at line 1522 of file comboex.c.

1526{
1527 TRACE("hwnd=%p, enable=%s\n", infoPtr->hwndSelf, enable ? "TRUE":"FALSE");
1528
1529 if (infoPtr->hwndEdit)
1530 EnableWindow(infoPtr->hwndEdit, enable);
1531
1532 EnableWindow(infoPtr->hwndCombo, enable);
1533
1534 /* Force the control to repaint when the enabled state changes. */
1535 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 445 of file comboex.c.

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

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 832 of file comboex.c.

836{
837 INT i;
838 cmp_func_t cmptext = get_cmp_func(infoPtr);
839 INT count = SendMessageW (infoPtr->hwndCombo, CB_GETCOUNT, 0, 0);
840
841 /* now search from after starting loc and wrapping back to start */
842 for(i=start+1; i<count; i++) {
843 CBE_ITEMDATA *item = get_item_data(infoPtr, i);
844 if ((LRESULT)item == CB_ERR) continue;
845 if (cmptext(COMBOEX_GetText(infoPtr, item), str) == 0) return i;
846 }
847 for(i=0; i<=start; i++) {
848 CBE_ITEMDATA *item = get_item_data(infoPtr, i);
849 if ((LRESULT)item == CB_ERR) continue;
850 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 260 of file comboex.c.

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

◆ COMBOEX_GetComboFontSize()

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

Definition at line 326 of file comboex.c.

330{
331 static const WCHAR strA[] = { 'A', 0 };
332 HFONT nfont, ofont;
333 HDC mydc;
334
335 mydc = GetDC (0); /* why the entire screen???? */
336 nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0);
337 ofont = SelectObject (mydc, nfont);
338 GetTextExtentPointW (mydc, strA, 1, size);
339 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:1539
HDC WINAPI GetDC(_In_opt_ HWND)

◆ COMBOEX_GetIndex()

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

Definition at line 269 of file comboex.c.

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

◆ COMBOEX_GetItemA()

static BOOL COMBOEX_GetItemA ( COMBOEX_INFO infoPtr,
COMBOBOXEXITEMA cit 
)
static

Definition at line 545 of file comboex.c.

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

857{
858 CBE_ITEMDATA const *item1;
859 CBE_ITEMDATA const *item2;
860 DWORD_PTR ret = 0;
861
862 item1 = get_item_data(infoPtr, index);
863 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
864 item2 = COMBOEX_FindItem (infoPtr, index);
865 if (item2 != item1) {
866 ERR("data structures damaged!\n");
867 return CB_ERR;
868 }
869 if (item1->mask & CBEIF_LPARAM) ret = item1->lParam;
870 TRACE("returning 0x%08lx\n", ret);
871 } else {
873 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 524 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_GetListboxText()

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

Definition at line 471 of file comboex.c.

475{
477 LPCWSTR str;
478
479 item = COMBOEX_FindItem(infoPtr, n);
480 if (!item)
481 return 0;
482
483 str = COMBOEX_GetText(infoPtr, item);
484 if (!str)
485 {
486 if (buf)
487 {
488 if (infoPtr->unicode)
489 buf[0] = 0;
490 else
491 *((LPSTR)buf) = 0;
492 }
493 return 0;
494 }
495
496 if (infoPtr->unicode)
497 {
498 if (buf)
499 lstrcpyW(buf, str);
500 return lstrlenW(str);
501 }
502 else
503 {
504 UINT r;
505 r = WideCharToMultiByte(CP_ACP, 0, str, -1, (LPSTR)buf, 0x40000000, NULL, NULL);
506 if (r) r--;
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
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 289 of file comboex.c.

293{
294 NMCOMBOBOXEXW nmce;
295 LPWSTR text, buf;
296 INT len;
297
298 if (item->pszText != LPSTR_TEXTCALLBACKW)
299 return item->pszText;
300
301 ZeroMemory(&nmce, sizeof(nmce));
302 nmce.ceItem.mask = CBEIF_TEXT;
303 nmce.ceItem.lParam = item->lParam;
304 nmce.ceItem.iItem = COMBOEX_GetIndex(infoPtr, item);
305 COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
306
307 if (is_textW(nmce.ceItem.pszText)) {
308 len = MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, NULL, 0);
309 buf = Alloc ((len + 1)*sizeof(WCHAR));
310 if (buf)
312 if (nmce.ceItem.mask & CBEIF_DI_SETITEM) {
314 item->pszText = buf;
315 } else {
316 Free(item->pszTemp);
317 item->pszTemp = buf;
318 }
319 text = buf;
320 } else
321 text = nmce.ceItem.pszText;
322
323 if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
static INT COMBOEX_GetIndex(COMBOEX_INFO const *infoPtr, CBE_ITEMDATA const *item)
Definition: comboex.c:269
#define MultiByteToWideChar
Definition: compat.h:110
const WCHAR * text
Definition: package.c:1799
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2380
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 580 of file comboex.c.

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_InsertItemA()

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

Definition at line 671 of file comboex.c.

675{
676 COMBOBOXEXITEMW citW;
677 LPWSTR wstr = NULL;
678 INT ret;
679
680 memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA));
681 if (cit->mask & CBEIF_TEXT && is_textA(cit->pszText)) {
682 INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
683 wstr = Alloc ((len + 1)*sizeof(WCHAR));
684 if (!wstr) return -1;
685 MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
686 citW.pszText = wstr;
687 }
688 ret = COMBOEX_InsertItemW(infoPtr, &citW);
689
690 Free(wstr);
static INT COMBOEX_InsertItemW(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *cit)
Definition: comboex.c:586
static BOOL is_textA(LPCSTR str)
Definition: comboex.c:126
#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 586 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_MeasureItem()

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

Definition at line 1538 of file comboex.c.

1542{
1543 static const WCHAR strW[] = { 'W', 0 };
1544 SIZE mysize;
1545 HDC hdc;
1546
1547 hdc = GetDC (0);
1548 GetTextExtentPointW (hdc, strW, 1, &mysize);
1549 ReleaseDC (0, hdc);
1550 mis->itemHeight = mysize.cy + CBE_EXTRA;
1551
1552 TRACE("adjusted height hwnd=%p, height=%d\n",
1553 infoPtr->hwndSelf, mis->itemHeight);
#define CBE_EXTRA
Definition: comboex.c:98
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 1556 of file comboex.c.

1560{
1561 /* WARNING: The COMBOEX_INFO structure is not yet created */
1562 DWORD oldstyle, newstyle;
1563
1564 oldstyle = (DWORD)GetWindowLongW (hwnd, GWL_STYLE);
1565 newstyle = oldstyle & ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER);
1566 if (newstyle != oldstyle) {
1567 TRACE("req style %08x, resetting style %08x\n",
1568 oldstyle, newstyle);
1569 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 171 of file comboex.c.

171 : lstrcmpiW;
172}
173
174static INT COMBOEX_Notify (const COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr)
175{
176 hdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
177 hdr->hwndFrom = infoPtr->hwndSelf;
178 hdr->code = code;
179 if (infoPtr->NtfUnicode)
180 return SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, 0, (LPARAM)hdr);
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#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 240 of file comboex.c.

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

Referenced by COMBOEX_ComboWndProc().

◆ COMBOEX_NotifyEndEdit()

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

Definition at line 220 of file comboex.c.

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

Referenced by COMBOEX_ComboWndProc().

◆ COMBOEX_NotifyFormat()

static LRESULT COMBOEX_NotifyFormat ( COMBOEX_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 1572 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_NotifyItem()

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

Definition at line 184 of file comboex.c.

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

◆ COMBOEX_Register()

void COMBOEX_Register ( void  )

Definition at line 2169 of file comboex.c.

2173{
2174 WNDCLASSW wndClass;
2175
2176 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2177 wndClass.style = CS_GLOBALCLASS;
2179 wndClass.cbClsExtra = 0;
2180 wndClass.cbWndExtra = sizeof(COMBOEX_INFO *);
2181 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2182 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2183 wndClass.lpszClassName = WC_COMBOBOXEXW;
static LRESULT WINAPI COMBOEX_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: comboex.c:1990
#define WC_COMBOBOXEXW
Definition: commctrl.h:3781
LPCWSTR lpszClassName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3182
int cbClsExtra
Definition: winuser.h:3177
UINT style
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3176
int cbWndExtra
Definition: winuser.h:3178
HCURSOR hCursor
Definition: winuser.h:3181
#define COLOR_WINDOW
Definition: winuser.h:917
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2088
#define CS_GLOBALCLASS
Definition: winuser.h:652

Referenced by DllMain().

◆ COMBOEX_ResetContent()

static void COMBOEX_ResetContent ( COMBOEX_INFO infoPtr)
static

Definition at line 1478 of file comboex.c.

1482{
1483 if (infoPtr->items)
1484 {
1486
1487 item = infoPtr->items;
1488 while (item) {
1489 next = item->next;
1491 Free (item);
1492 item = next;
1493 }
1494 infoPtr->items = 0;
1495 }
1496
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 405 of file comboex.c.

409{
410 SIZE mysize;
411 LONG cy;
412 IMAGEINFO iinfo;
413
414 COMBOEX_GetComboFontSize (infoPtr, &mysize);
415 cy = mysize.cy + CBE_EXTRA;
416 if (infoPtr->himl && ImageList_GetImageInfo(infoPtr->himl, 0, &iinfo)) {
417 cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy);
418 TRACE("upgraded height due to image: height=%d\n", cy);
419 }
420 SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, -1, cy);
421 if (infoPtr->hwndCombo) {
423 if ( !(infoPtr->flags & CBES_EX_NOSIZELIMIT)) {
424 RECT comboRect, ourRect;
425 GetWindowRect(infoPtr->hwndCombo, &comboRect);
426 GetWindowRect(infoPtr->hwndSelf, &ourRect);
427 if (comboRect.bottom > ourRect.bottom)
428 SetWindowPos( infoPtr->hwndSelf, 0, 0, 0, ourRect.right - ourRect.left,
429 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:3854
#define max(a, b)
Definition: svc.c:63
#define CB_SETITEMHEIGHT
Definition: winuser.h:1966

Referenced by COMBOEX_Create().

◆ COMBOEX_SetCursel()

static INT COMBOEX_SetCursel ( COMBOEX_INFO infoPtr,
INT_PTR  index 
)
static

Definition at line 876 of file comboex.c.

880{
882 INT sel;
883
884 if (!(item = COMBOEX_FindItem(infoPtr, index)))
885 return SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0);
886
887 TRACE("selecting item %ld text=%s\n", index, debugstr_txt(item->pszText));
888 infoPtr->selected = index;
889
890 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 433 of file comboex.c.

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

◆ COMBOEX_SetExtendedStyle()

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

Definition at line 694 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetFont()

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

Definition at line 1594 of file comboex.c.

1598{
1599 infoPtr->font = font;
1600 SendMessageW( infoPtr->hwndCombo, WM_SETFONT, (WPARAM)font, 0 );
1601 if (infoPtr->hwndEdit) SendMessageW( infoPtr->hwndEdit, WM_SETFONT, (WPARAM)font, 0 );
1602 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 728 of file comboex.c.

732{
733 HIMAGELIST himlTemp = infoPtr->himl;
734
735 TRACE("\n");
736
737 infoPtr->himl = himl;
738
739 COMBOEX_ReSize (infoPtr);
740 InvalidateRect (infoPtr->hwndCombo, NULL, TRUE);
741
742 /* 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 795 of file comboex.c.

799{
800 COMBOBOXEXITEMW citW;
801 LPWSTR wstr = NULL;
802 BOOL ret;
803
804 memcpy(&citW, cit, sizeof(COMBOBOXEXITEMA));
805 if ((cit->mask & CBEIF_TEXT) && is_textA(cit->pszText)) {
806 INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0);
807 wstr = Alloc ((len + 1)*sizeof(WCHAR));
808 if (!wstr) return FALSE;
809 MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len);
810 citW.pszText = wstr;
811 }
812 ret = COMBOEX_SetItemW(infoPtr, &citW);
813
814 Free(wstr);
static BOOL COMBOEX_SetItemW(COMBOEX_INFO *infoPtr, const COMBOBOXEXITEMW *cit)
Definition: comboex.c:744
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 893 of file comboex.c.

897{
899 CBE_ITEMDATA const *item2;
900
901 item1 = get_item_data(infoPtr, index);
902 if ((item1 != NULL) && ((LRESULT)item1 != CB_ERR)) {
903 item2 = COMBOEX_FindItem (infoPtr, index);
904 if (item2 != item1) {
905 ERR("data structures damaged!\n");
906 return CB_ERR;
907 }
908 item1->mask |= CBEIF_LPARAM;
909 item1->lParam = data;
910 TRACE("setting lparam to 0x%08lx\n", data);
911 return 0;
912 }
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 915 of file comboex.c.

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

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

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_SetUnicodeFormat()

static BOOL COMBOEX_SetUnicodeFormat ( COMBOEX_INFO infoPtr,
BOOL  value 
)
static

Definition at line 817 of file comboex.c.

821{
822 BOOL bTemp = infoPtr->unicode;
823
824 TRACE("to %s, was %s\n", value ? "TRUE":"FALSE", bTemp ? "TRUE":"FALSE");
825
826 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 1583 of file comboex.c.

1587{
1588 TRACE("(width=%d, height=%d)\n", width, height);
1589
1590 MoveWindow (infoPtr->hwndCombo, 0, 0, width, height, TRUE);
1591
1592 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 2186 of file comboex.c.

Referenced by DllMain().

◆ COMBOEX_WindowPosChanging()

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

Definition at line 1612 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ COMBOEX_WindowProc()

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

Definition at line 1990 of file comboex.c.

1994{
1996
1997 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, uMsg, wParam, lParam);
1998
1999 if (!infoPtr) {
2000 if (uMsg == WM_CREATE)
2002 if (uMsg == WM_NCCREATE)
2004 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2005 }
2006
2007 switch (uMsg)
2008 {
2009 case CBEM_DELETEITEM:
2010 return COMBOEX_DeleteItem (infoPtr, wParam);
2011
2013 return (LRESULT)infoPtr->hwndCombo;
2014
2016 return (LRESULT)infoPtr->hwndEdit;
2017
2019 return infoPtr->dwExtStyle;
2020
2021 case CBEM_GETIMAGELIST:
2022 return (LRESULT)infoPtr->himl;
2023
2024 case CBEM_GETITEMA:
2025 return (LRESULT)COMBOEX_GetItemA (infoPtr, (COMBOBOXEXITEMA *)lParam);
2026
2027 case CBEM_GETITEMW:
2028 return (LRESULT)COMBOEX_GetItemW (infoPtr, (COMBOBOXEXITEMW *)lParam);
2029
2031 return infoPtr->unicode;
2032
2034 return COMBOEX_HasEditChanged (infoPtr);
2035
2036 case CBEM_INSERTITEMA:
2037 return COMBOEX_InsertItemA (infoPtr, (COMBOBOXEXITEMA *)lParam);
2038
2039 case CBEM_INSERTITEMW:
2040 return COMBOEX_InsertItemW (infoPtr, (COMBOBOXEXITEMW *)lParam);
2041
2042 case CBEM_SETEXSTYLE:
2044 return COMBOEX_SetExtendedStyle (infoPtr, (DWORD)wParam, (DWORD)lParam);
2045
2046 case CBEM_SETIMAGELIST:
2047 return (LRESULT)COMBOEX_SetImageList (infoPtr, (HIMAGELIST)lParam);
2048
2049 case CBEM_SETITEMA:
2050 return COMBOEX_SetItemA (infoPtr, (COMBOBOXEXITEMA *)lParam);
2051
2052 case CBEM_SETITEMW:
2053 return COMBOEX_SetItemW (infoPtr, (COMBOBOXEXITEMW *)lParam);
2054
2056 return COMBOEX_SetUnicodeFormat (infoPtr, wParam);
2057
2058 /*case CBEM_SETWINDOWTHEME:
2059 FIXME("CBEM_SETWINDOWTHEME: stub\n");*/
2060
2061 case WM_SETTEXT:
2062 case WM_GETTEXT:
2063 case WM_GETTEXTLENGTH:
2064 return SendMessageW(infoPtr->hwndEdit, uMsg, wParam, lParam);
2065
2066 case CB_GETLBTEXT:
2067 return COMBOEX_GetListboxText(infoPtr, wParam, (LPWSTR)lParam);
2068
2069 case CB_GETLBTEXTLEN:
2070 return COMBOEX_GetListboxText(infoPtr, wParam, NULL);
2071
2072 case CB_RESETCONTENT:
2073 COMBOEX_ResetContent(infoPtr);
2074 /* fall through */
2075
2076/* Combo messages we are not sure if we need to process or just forward */
2078 case CB_GETITEMHEIGHT:
2079 case CB_GETEXTENDEDUI:
2080 case CB_LIMITTEXT:
2081 case CB_SELECTSTRING:
2082
2083/* Combo messages OK to just forward to the regular COMBO */
2084 case CB_GETCOUNT:
2085 case CB_GETCURSEL:
2086 case CB_GETDROPPEDSTATE:
2087 case CB_SETDROPPEDWIDTH:
2088 case CB_SETEXTENDEDUI:
2089 case CB_SHOWDROPDOWN:
2090 return SendMessageW (infoPtr->hwndCombo, uMsg, wParam, lParam);
2091
2092/* Combo messages we need to process specially */
2093 case CB_FINDSTRINGEXACT:
2094 return COMBOEX_FindStringExact (infoPtr, (INT)wParam, (LPCWSTR)lParam);
2095
2096 case CB_GETITEMDATA:
2097 return COMBOEX_GetItemData (infoPtr, (INT)wParam);
2098
2099 case CB_SETCURSEL:
2100 return COMBOEX_SetCursel (infoPtr, (INT)wParam);
2101
2102 case CB_SETITEMDATA:
2103 return COMBOEX_SetItemData (infoPtr, (INT)wParam, (DWORD_PTR)lParam);
2104
2105 case CB_SETITEMHEIGHT:
2106 return COMBOEX_SetItemHeight (infoPtr, (INT)wParam, (UINT)lParam);
2107
2108
2109
2110/* Window messages passed to parent */
2111 case WM_COMMAND:
2112 return COMBOEX_Command (infoPtr, wParam);
2113
2114 case WM_NOTIFY:
2115 if (infoPtr->NtfUnicode)
2116 return SendMessageW (infoPtr->hwndNotify, uMsg, wParam, lParam);
2117 else
2118 return SendMessageA (infoPtr->hwndNotify, uMsg, wParam, lParam);
2119
2120
2121/* Window messages we need to process */
2122 case WM_DELETEITEM:
2123 return COMBOEX_WM_DeleteItem (infoPtr, (DELETEITEMSTRUCT *)lParam);
2124
2125 case WM_DRAWITEM:
2126 return COMBOEX_DrawItem (infoPtr, (DRAWITEMSTRUCT *)lParam);
2127
2128 case WM_DESTROY:
2129 return COMBOEX_Destroy (infoPtr);
2130
2131 case WM_ENABLE:
2132 return COMBOEX_Enable (infoPtr, (BOOL)wParam);
2133
2134 case WM_MEASUREITEM:
2135 return COMBOEX_MeasureItem (infoPtr, (MEASUREITEMSTRUCT *)lParam);
2136
2137 case WM_NOTIFYFORMAT:
2138 return COMBOEX_NotifyFormat (infoPtr, lParam);
2139
2140 case WM_SIZE:
2141 return COMBOEX_Size (infoPtr, LOWORD(lParam), HIWORD(lParam));
2142
2143 case WM_GETFONT:
2144 return (LRESULT)infoPtr->font;
2145
2146 case WM_SETFONT:
2147 return COMBOEX_SetFont( infoPtr, (HFONT)wParam, LOWORD(lParam) != 0 );
2148
2149 case WM_SETREDRAW:
2150 return COMBOEX_SetRedraw(infoPtr, wParam, lParam);
2151
2153 return COMBOEX_WindowPosChanging (infoPtr, (WINDOWPOS *)lParam);
2154
2155 case WM_SETFOCUS:
2156 if (infoPtr->hwndEdit) SetFocus( infoPtr->hwndEdit );
2157 else SetFocus( infoPtr->hwndCombo );
2158 return 0;
2159
2160 case WM_SYSCOLORCHANGE:
2162 return 0;
2163
2164 default:
2165 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
2166 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:795
static LRESULT COMBOEX_Command(COMBOEX_INFO *infoPtr, WPARAM wParam)
Definition: comboex.c:1068
static INT COMBOEX_FindStringExact(const COMBOEX_INFO *infoPtr, INT start, LPCWSTR str)
Definition: comboex.c:832
static LRESULT COMBOEX_MeasureItem(COMBOEX_INFO const *infoPtr, MEASUREITEMSTRUCT *mis)
Definition: comboex.c:1538
static INT COMBOEX_SetItemHeight(COMBOEX_INFO const *infoPtr, INT index, UINT height)
Definition: comboex.c:915
static LRESULT COMBOEX_SetFont(COMBOEX_INFO *infoPtr, HFONT font, BOOL redraw)
Definition: comboex.c:1594
static BOOL COMBOEX_HasEditChanged(COMBOEX_INFO const *infoPtr)
Definition: comboex.c:580
static DWORD COMBOEX_SetExtendedStyle(COMBOEX_INFO *infoPtr, DWORD mask, DWORD style)
Definition: comboex.c:694
static LRESULT COMBOEX_NCCreate(HWND hwnd)
Definition: comboex.c:1556
static INT COMBOEX_InsertItemA(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit)
Definition: comboex.c:671
static LRESULT COMBOEX_SetRedraw(const COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: comboex.c:1604
static LRESULT COMBOEX_WindowPosChanging(const COMBOEX_INFO *infoPtr, WINDOWPOS *wp)
Definition: comboex.c:1612
static LRESULT COMBOEX_Enable(COMBOEX_INFO *infoPtr, BOOL enable)
Definition: comboex.c:1522
static DWORD_PTR COMBOEX_SetItemData(COMBOEX_INFO *infoPtr, INT_PTR index, DWORD_PTR data)
Definition: comboex.c:893
static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, INT_PTR n, LPWSTR buf)
Definition: comboex.c:471
static LRESULT COMBOEX_Create(HWND hwnd, CREATESTRUCTA const *cs)
Definition: comboex.c:947
static INT COMBOEX_SetCursel(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:876
static LRESULT COMBOEX_NotifyFormat(COMBOEX_INFO *infoPtr, LPARAM lParam)
Definition: comboex.c:1572
static DWORD_PTR COMBOEX_GetItemData(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:853
static BOOL COMBOEX_SetUnicodeFormat(COMBOEX_INFO *infoPtr, BOOL value)
Definition: comboex.c:817
static BOOL COMBOEX_WM_DeleteItem(COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT const *dis)
Definition: comboex.c:1209
static HIMAGELIST COMBOEX_SetImageList(COMBOEX_INFO *infoPtr, HIMAGELIST himl)
Definition: comboex.c:728
static LRESULT COMBOEX_Destroy(COMBOEX_INFO *infoPtr)
Definition: comboex.c:1499
static INT COMBOEX_DeleteItem(COMBOEX_INFO *infoPtr, INT_PTR index)
Definition: comboex.c:509
static BOOL COMBOEX_GetItemA(COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA *cit)
Definition: comboex.c:545
static LRESULT COMBOEX_DrawItem(COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *dis)
Definition: comboex.c:1256
static LRESULT COMBOEX_Size(COMBOEX_INFO *infoPtr, INT width, INT height)
Definition: comboex.c:1583
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586
#define WM_APP
Definition: eventvwr.h:73
#define CBEM_GETUNICODEFORMAT
Definition: commctrl.h:3839
#define CBEM_HASEDITCHANGED
Definition: commctrl.h:3840
#define CBEM_GETITEMW
Definition: commctrl.h:3843
#define CBEM_GETIMAGELIST
Definition: commctrl.h:3828
#define CBEM_SETITEMW
Definition: commctrl.h:3842
#define CBEM_GETCOMBOCONTROL
Definition: commctrl.h:3832
#define CBEM_DELETEITEM
Definition: commctrl.h:3831
#define CBEM_SETEXTENDEDSTYLE
Definition: commctrl.h:3835
#define CBEM_SETIMAGELIST
Definition: commctrl.h:3827
#define CBEM_INSERTITEMA
Definition: commctrl.h:3826
#define CBEM_INSERTITEMW
Definition: commctrl.h:3841
#define CBEM_SETEXSTYLE
Definition: commctrl.h:3834
#define CBEM_SETUNICODEFORMAT
Definition: commctrl.h:3838
#define CBEM_GETITEMA
Definition: commctrl.h:3829
#define CBEM_GETEXTENDEDSTYLE
Definition: commctrl.h:3837
#define CBEM_SETITEMA
Definition: commctrl.h:3830
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3833
#define CB_SELECTSTRING
Definition: winuser.h:1959
#define CB_SETITEMDATA
Definition: winuser.h:1965
#define WM_GETTEXTLENGTH
Definition: winuser.h:1618
#define CB_SETDROPPEDWIDTH
Definition: winuser.h:1961
#define CB_GETLBTEXTLEN
Definition: winuser.h:1952
#define CB_GETLBTEXT
Definition: winuser.h:1951
#define WM_ENABLE
Definition: winuser.h:1614
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1660
#define WM_CREATE
Definition: winuser.h:1607
#define WM_SIZE
Definition: winuser.h:1610
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1617
#define CB_RESETCONTENT
Definition: winuser.h:1958
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1939
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1625
#define WM_DELETEITEM
Definition: winuser.h:1646
#define WM_NCCREATE
Definition: winuser.h:1682
#define CB_GETDROPPEDCONTROLRECT
Definition: winuser.h:1943
#define CB_GETITEMDATA
Definition: winuser.h:1949
#define WM_MEASUREITEM
Definition: winuser.h:1645
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1944
#define CB_GETEXTENDEDUI
Definition: winuser.h:1947
#define CB_LIMITTEXT
Definition: winuser.h:1957
#define WM_USER
Definition: winuser.h:1894
#define WM_DESTROY
Definition: winuser.h:1608
#define CB_SETEXTENDEDUI
Definition: winuser.h:1963

◆ COMBOEX_WM_DeleteItem()

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

Definition at line 1209 of file comboex.c.

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

Referenced by COMBOEX_WindowProc().

◆ debugstr_txt()

static LPCSTR debugstr_txt ( LPCWSTR  str)
inlinestatic

Definition at line 131 of file comboex.c.

135{

◆ get_cmp_func()

static cmp_func_t get_cmp_func ( COMBOEX_INFO const infoPtr)
inlinestatic

Definition at line 166 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 160 of file comboex.c.

164{

Referenced by COMBOEX_FindStringExact().

◆ is_textA()

static BOOL is_textA ( LPCSTR  str)
inlinestatic

Definition at line 126 of file comboex.c.

◆ is_textW()

static BOOL is_textW ( LPCWSTR  str)
inlinestatic

Definition at line 121 of file comboex.c.

Referenced by COMBOEX_NotifyItem().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( comboex  )