38#define LB_ARRAY_GRANULARITY 16
41#define LB_SCROLL_TIMEOUT 50
47#define LBS_DISPLAYCHANGED 0x80000000
91#define IS_OWNERDRAW(descr) \
92 ((descr)->style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE))
94#define HAS_STRINGS(descr) \
95 (!IS_OWNERDRAW(descr) || ((descr)->style & LBS_HASSTRINGS))
98#define IS_MULTISELECT(descr) \
99 ((descr)->style & (LBS_MULTIPLESEL|LBS_EXTENDEDSEL) && \
100 !((descr)->style & LBS_NOSEL))
102#define SEND_NOTIFICATION(descr,code) \
103 (SendMessageW( (descr)->owner, WM_COMMAND, \
104 MAKEWPARAM( GetWindowLongPtrW((descr->self),GWLP_ID), (code)), (LPARAM)(descr->self) ))
106#define ISWIN31 (LOWORD(GetVersion()) == 0x0a03)
163 for (
i =
descr->top_item,
height = 0; i < descr->nb_items;
i++)
167 if (
i ==
descr->top_item)
return 1;
168 else return i -
descr->top_item;
186 if (max < descr->nb_items - 1)
max++;
296 TRACE(
"setting top item %d, scroll %d\n",
index, scroll);
314 diff -=
descr->items[
i].height;
319 diff +=
descr->items[
i].height;
384 if(
descr->item_height != 0)
385 remaining =
descr->height %
descr->item_height;
388 if ((
descr->height >
descr->item_height) && remaining)
390 TRACE(
"[%p]: changing height %d -> %d\n",
441 if (index < descr->top_item)
478 if (!
descr->nb_items)
return -1;
484 while (index < descr->nb_items)
501 if (
y >=
descr->item_height *
descr->page_size)
return -1;
510 if (
index < 0)
return 0;
537 if (!(
descr->UIState & UISF_HIDEFOCUS))
541 ERR(
"called with an out of bounds index %d(%d) in owner draw, Not good.\n",
index,
descr->nb_items);
560 if (!ignoreFocus && (
descr->focus_item ==
index) &&
566 TRACE(
"[%p]: drawitem %d (%s) action=%02x state=%02x rect=%s\n",
579 if (!(
descr->UIState & UISF_HIDEFOCUS))
589 TRACE(
"[%p]: painting %d (%s) action=%02x rect=%s\n",
613 if (!ignoreFocus && (
descr->focus_item ==
index) &&
631 descr->style &= ~LBS_NOREDRAW;
640 descr->style &= ~LBS_DISPLAYCHANGED;
658 HBRUSH
hbrush, oldBrush = 0;
699 if (
descr->focus_item == -1)
return;
700 if (!
descr->caret_on || !
descr->in_focus)
return;
768 for (
i = 0;
i <
descr->nb_tabs;
i++)
815 ERR(
"got an invalid buffer (Delphi bug?)\n" );
879 return exact ? -1 :
max;
903 if (*
str !=
'[')
res = -1;
904 else if (
p[1] ==
'-')
911 if (
str[1] ==
'-')
res = 1;
953#define CHECK_DRIVE(item) \
954 if ((item)->str[0] == '[') \
956 if (!strncmpiW( str, (item)->str+1, len )) return i; \
957 if (((item)->str[1] == '-') && !strncmpiW(str, (item)->str+2, len)) \
1030 RECT focusRect = {-1, -1, -1, -1};
1032 HBRUSH
hbrush, oldBrush = 0;
1039 else if (
descr->horz_pos)
1055 if (!
descr->nb_items && (
descr->focus_item != -1) &&
descr->caret_on &&
1069 for (
i =
descr->top_item; i < descr->nb_items;
i++)
1077 if (
i ==
descr->focus_item)
1100 col_pos =
descr->page_size - 1;
1110 if (focusRect.
top != focusRect.
bottom &&
1191 else return descr->item_height;
1241 if (!(diff =
descr->horz_pos -
pos))
return;
1307 const char *alphabet =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1314 ERR(
"unable to get DC.\n" );
1322 descr->avg_char_width = (sz.
cx / 26 + 1) / 2;
1338 TRACE(
"current top item %d, index %d, fully %d\n",
descr->top_item,
index, fully);
1340 if (index <= descr->top_item)
top =
index;
1344 if (!fully) cols +=
descr->column_width - 1;
1345 if (cols >=
descr->column_width) cols /=
descr->column_width;
1347 if (index < descr->top_item + (
descr->page_size * cols))
return;
1358 if (index < descr->top_item +
descr->page_size)
return;
1377 TRACE(
"old focus %d, index %d\n", oldfocus,
index);
1418 if (
descr->items[
i].selected)
continue;
1427 if (!
descr->items[
i].selected)
continue;
1441 TRACE(
"cur_sel=%d index=%d notify=%s\n",
1461 if (oldsel != -1)
descr->items[oldsel].selected =
FALSE;
1502 if (
descr->anchor_item != -1)
1537 if (!
descr->items) max_items = 0;
1539 if (
descr->nb_items == max_items)
1560 if (index < descr->nb_items)
1583 TRACE(
"[%p]: measure item %d (%s) = %d\n",
1594 if (
descr->nb_items == 1)
1599 descr->selected_item++;
1604 if (index <= descr->selected_item)
1606 descr->selected_item++;
1607 descr->focus_item = oldfocus;
1643 TRACE(
"[%p]: added item %d %s\n",
1660 if (!
descr->nb_items)
1708 if (index < descr->nb_items)
1735 descr->selected_item = -1;
1736 else if (index < descr->selected_item)
1738 descr->selected_item--;
1747 if (
descr->focus_item < 0)
descr->focus_item = 0;
1762 descr->nb_items = 0;
1763 descr->top_item = 0;
1764 descr->selected_item = -1;
1765 descr->focus_item = 0;
1766 descr->anchor_item = -1;
1791 else if (count < descr->nb_items)
1793 while (count < descr->nb_items)
1830 static const WCHAR bracketW[] = {
']',0 };
1835 if (!long_names &&
entry.cAlternateFileName[0])
1843#define ATTRIBS (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \
1844 FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE)
1850 if (!long_names &&
entry.cAlternateFileName[0])
1859 if (
ret <= maxinsert) maxinsert++;
else maxinsert =
ret;
1984 else if (
descr->horz_extent)
2025 UINT pulScrollLines = 3;
2030 if ((delta < 0 && descr->wheel_remain < 0) ||
2031 (delta > 0 &&
descr->wheel_remain > 0))
2032 descr->wheel_remain += delta;
2034 descr->wheel_remain = delta;
2036 if (
descr->wheel_remain && pulScrollLines)
2039 pulScrollLines =
min((
UINT)
descr->page_size, pulScrollLines);
2043 if (cLineScroll < 0)
2044 cLineScroll -=
descr->page_size;
2058 TRACE(
"[%p]: lbuttondown %d,%d item %d, focus item %d\n",
2061 if (!
descr->caret_on && (
descr->in_focus))
return 0;
2063 if (!
descr->in_focus)
2069 if (
index == -1)
return 0;
2161 RECT clientRect, screenRect;
2169 if(
PtInRect(&clientRect, mousePos))
2174 descr->lphc->droppedIndex =
descr->nb_items ?
descr->selected_item : -1;
2182 POINT screenMousePos;
2183 HWND hWndOldCapture;
2186 screenMousePos = mousePos;
2192 if(!
PtInRect(&screenRect, screenMousePos))
2207 if (
PtInRect( &clientRect, mousePos ))
2214 if (
PtInRect( &clientRect, mousePos ))
2220 if(nHitTestType != 0)
2223 MAKELONG(screenMousePos.
x, screenMousePos.
y));
2227 if(hWndOldCapture != 0)
2242 if (
descr->captured)
2315 if (!
descr->captured)
return;
2320 else if (
y >=
descr->item_height *
descr->page_size)
2328 else if (
x >=
descr->width)
2362 bForceSelection =
FALSE;
2369 if (caret == -2)
return 0;
2371 if (caret == -1)
switch(
key)
2376 bForceSelection =
FALSE;
2378 caret =
descr->focus_item -
descr->page_size;
2383 caret =
descr->focus_item - 1;
2384 if (caret < 0) caret = 0;
2389 bForceSelection =
FALSE;
2391 caret =
descr->focus_item +
descr->page_size;
2396 caret =
descr->focus_item + 1;
2397 if (caret >=
descr->nb_items) caret =
descr->nb_items - 1;
2408 if (caret < 0) caret = 0;
2418 if (caret >=
descr->nb_items) caret =
descr->nb_items - 1;
2424 caret =
descr->nb_items - 1;
2436 bForceSelection =
FALSE;
2438 if (bForceSelection)
2439 caret =
descr->focus_item;
2445 descr->anchor_item = caret;
2449 descr->selected_item = caret;
2482 if (caret == -2)
return 0;
2502 prev_flags =
descr->UIState;
2504 return prev_flags !=
descr->UIState;
2527 descr->nb_items = 0;
2528 descr->top_item = 0;
2529 descr->selected_item = -1;
2530 descr->focus_item = 0;
2531 descr->anchor_item = -1;
2532 descr->item_height = 1;
2533 descr->page_size = 1;
2534 descr->column_width = 150;
2535 descr->horz_extent = 0;
2536 descr->horz_pos = 0;
2539 descr->wheel_remain = 0;
2540 descr->caret_on = !lphc;
2569 descr->style &= ~LBS_NODATA;
2590 descr->item_height = mis.itemHeight ? mis.itemHeight : 1;
2634 ERR(
"Wrong window class for listbox! fnId 0x%x\n",pWnd->
fnid);
2659 TRACE(
"[%p]: msg %s wp %08lx lp %08lx\n",
2761 return descr->nb_items;
2787 return descr->nb_items;
2804 if (
descr->nb_items == 0)
2807 return descr->selected_item;
2808 if (
descr->selected_item != -1)
2809 return descr->selected_item;
2810 return descr->focus_item;
2814 return descr->top_item;
2833 if(
descr->nb_items == 0)
2870 return descr->focus_item;
2983 return descr->horz_extent;
2989 return descr->anchor_item;
3020 return descr->locale;
3042 if (
descr->caret_on)
3045 if ((
descr->focus_item != -1) && (
descr->in_focus))
3050 if (!
descr->caret_on)
3053 if ((
descr->focus_item != -1) && (
descr->in_focus))
3058 return descr->page_size;
3095 if (
descr->focus_item != -1)
3102 descr->wheel_remain = 0;
3103 if ((
descr->focus_item != -1) &&
descr->caret_on)
3150 descr->captured = captured;
3234 if( lphc )
return 0;
3250 case WM_UPDATEUISTATE:
3259 if (
descr->focus_item != -1)
3266 WARN(
"[%p]: unknown msg %04x wp %08lx lp %08lx\n",
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define LB_INSERTSTRING_LOWER
#define LB_INSERTSTRING_UPPER
#define LB_ADDSTRING_LOWER
#define LB_ADDSTRING_UPPER
static char selected[MAX_PATH+1]
BOOL COMBO_FlipListbox(LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton)
static LRESULT LISTBOX_RemoveItem(LB_DESCR *descr, INT index)
#define SEND_NOTIFICATION(descr, code)
static LRESULT LISTBOX_InsertString(LB_DESCR *descr, INT index, LPCWSTR str)
static void LISTBOX_DrawFocusRect(LB_DESCR *descr, BOOL on)
static void LISTBOX_SetHorizontalPos(LB_DESCR *descr, INT pos)
static LRESULT LISTBOX_HandleKeyDown(LB_DESCR *descr, DWORD key)
static LRESULT LISTBOX_SetCaretIndex(LB_DESCR *descr, INT index, BOOL fully_visible)
static BOOL LISTBOX_SetTabStops(LB_DESCR *descr, INT count, LPINT tabs)
static LRESULT LISTBOX_HandleLButtonUp(LB_DESCR *descr)
static void LISTBOX_DeleteItem(LB_DESCR *descr, INT index)
static void LISTBOX_InvalidateItems(LB_DESCR *descr, INT index)
static LRESULT LISTBOX_GetSelCount(const LB_DESCR *descr)
static void LISTBOX_SetRedraw(LB_DESCR *descr, BOOL on)
static void LISTBOX_InvalidateItemRect(LB_DESCR *descr, INT index)
static LRESULT LISTBOX_GetText(LB_DESCR *descr, INT index, LPWSTR buffer, BOOL unicode)
static LRESULT LISTBOX_SetCount(LB_DESCR *descr, INT count)
static LRESULT LISTBOX_InitStorage(LB_DESCR *descr, INT nb_items)
static void LISTBOX_MakeItemVisible(LB_DESCR *descr, INT index, BOOL fully)
static INT LISTBOX_FindFileStrPos(LB_DESCR *descr, LPCWSTR str)
static LRESULT LISTBOX_SetSelection(LB_DESCR *descr, INT index, BOOL on, BOOL send_notify)
static LRESULT LISTBOX_HandleLButtonDownCombo(LB_DESCR *descr, UINT msg, DWORD keys, INT x, INT y)
static LRESULT LISTBOX_HandleVScroll(LB_DESCR *descr, WORD scrollReq, WORD pos)
#define IS_MULTISELECT(descr)
static void LISTBOX_ResetContent(LB_DESCR *descr)
static LRESULT LISTBOX_HandleTimer(LB_DESCR *descr, INT index, TIMER_DIRECTION dir)
#define HAS_STRINGS(descr)
static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta)
static LRESULT LISTBOX_SetHorizontalExtent(LB_DESCR *descr, INT extent)
static LRESULT LISTBOX_InsertItem(LB_DESCR *descr, INT index, LPWSTR str, ULONG_PTR data)
static void LISTBOX_MoveCaret(LB_DESCR *descr, INT index, BOOL fully_visible)
static LRESULT LISTBOX_GetSelItems(const LB_DESCR *descr, INT max, LPINT array)
static LRESULT LISTBOX_Paint(LB_DESCR *descr, HDC hdc)
static void LISTBOX_UpdateScroll(LB_DESCR *descr)
static TIMER_DIRECTION LISTBOX_Timer
static LRESULT LISTBOX_SetTopItem(LB_DESCR *descr, INT index, BOOL scroll)
static INT LISTBOX_SetFont(LB_DESCR *descr, HFONT font)
static LRESULT LISTBOX_HandleHScroll(LB_DESCR *descr, WORD scrollReq, WORD pos)
static LRESULT LISTBOX_SelectItemRange(LB_DESCR *descr, INT first, INT last, BOOL on)
static void LISTBOX_RepaintItem(LB_DESCR *descr, INT index, UINT action)
static LRESULT LISTBOX_GetItemRect(const LB_DESCR *descr, INT index, RECT *rect)
static INT LISTBOX_FindString(LB_DESCR *descr, INT start, LPCWSTR str, BOOL exact)
static BOOL LISTBOX_Destroy(LB_DESCR *descr)
#define LB_ARRAY_GRANULARITY
static LRESULT LISTBOX_HandleSystemTimer(LB_DESCR *descr)
static LRESULT LISTBOX_Directory(LB_DESCR *descr, UINT attrib, LPCWSTR filespec, BOOL long_names)
static void LISTBOX_HandleMouseMove(LB_DESCR *descr, INT x, INT y)
static LRESULT LISTBOX_SetColumnWidth(LB_DESCR *descr, INT width)
#define CHECK_DRIVE(item)
static LRESULT LISTBOX_GetItemHeight(const LB_DESCR *descr, INT index)
#define LB_SCROLL_TIMEOUT
static INT LISTBOX_FindStringPos(LB_DESCR *descr, LPCWSTR str, BOOL exact)
static void LISTBOX_PaintItem(LB_DESCR *descr, HDC hdc, const RECT *rect, INT index, UINT action, BOOL ignoreFocus)
#define IS_OWNERDRAW(descr)
static INT LISTBOX_GetItemFromPoint(const LB_DESCR *descr, INT x, INT y)
static INT LISTBOX_lstrcmpiW(LCID lcid, LPCWSTR str1, LPCWSTR str2)
#define LBS_DISPLAYCHANGED
static LRESULT LISTBOX_HandleChar(LB_DESCR *descr, WCHAR charW)
static void LISTBOX_UpdatePage(LB_DESCR *descr)
static LRESULT LISTBOX_SetItemHeight(LB_DESCR *descr, INT index, INT height, BOOL repaint)
static void LISTBOX_UpdateSize(LB_DESCR *descr)
static INT LISTBOX_GetCurrentPageSize(const LB_DESCR *descr)
static INT LISTBOX_GetMaxTopIndex(const LB_DESCR *descr)
static BOOL LISTBOX_Create(HWND hwnd, LPHEADCOMBO lphc)
static LRESULT LISTBOX_HandleLButtonDown(LB_DESCR *descr, DWORD keys, INT x, INT y)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define WideCharToMultiByte
#define MultiByteToWideChar
#define ValidateHwnd(hwnd)
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLdouble GLdouble GLdouble GLdouble top
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
#define EXCEPTION_EXECUTE_HANDLER
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
<