SRCDIR = @srcdir@\r
VPATH = @srcdir@\r
MODULE = comctl32.dll\r
+IMPORTLIB = libcomctl32.$(IMPLIBEXT)\r
IMPORTS = user32 gdi32 advapi32 kernel32\r
DELAYIMPORTS = winmm\r
EXTRALIBS = $(LIBUNICODE)\r
}\r
\r
\r
+static INT COMBOEX_GetIndex(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)\r
+{\r
+ CBE_ITEMDATA *moving;\r
+ INT index;\r
+ \r
+ moving = infoPtr->items;\r
+ index = infoPtr->nb_items - 1;\r
+\r
+ while (moving && (moving != item)) {\r
+ moving = moving->next;\r
+ index--;\r
+ }\r
+ if (!moving || (index < 0)) {\r
+ ERR("COMBOBOXEX item structures broken. Please report!\n");\r
+ return -1;\r
+ }\r
+ return index;\r
+}\r
+\r
+\r
static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)\r
{\r
NMCOMBOBOXEXW nmce;\r
ZeroMemory(&nmce, sizeof(nmce));\r
nmce.ceItem.mask = CBEIF_TEXT;\r
nmce.ceItem.lParam = item->lParam;\r
+ nmce.ceItem.iItem = COMBOEX_GetIndex(infoPtr, item);\r
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);\r
\r
if (is_textW(nmce.ceItem.pszText)) {\r
ZeroMemory(&nmce, sizeof(nmce));\r
nmce.ceItem.mask = CBEIF_INDENT;\r
nmce.ceItem.lParam = item->lParam;\r
+ nmce.ceItem.iItem = dis->itemID;\r
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);\r
if (nmce.ceItem.mask & CBEIF_DI_SETITEM)\r
item->iIndent = nmce.ceItem.iIndent;\r
ZeroMemory(&nmce, sizeof(nmce));\r
nmce.ceItem.mask = (drawstate == ILD_NORMAL) ? CBEIF_IMAGE : CBEIF_SELECTEDIMAGE;\r
nmce.ceItem.lParam = item->lParam;\r
+ nmce.ceItem.iItem = dis->itemID;\r
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);\r
if (drawstate == ILD_NORMAL) {\r
if (nmce.ceItem.mask & CBEIF_DI_SETITEM) item->iImage = nmce.ceItem.iImage;\r
ZeroMemory(&nmce, sizeof(nmce));\r
nmce.ceItem.mask = CBEIF_OVERLAY;\r
nmce.ceItem.lParam = item->lParam;\r
+ nmce.ceItem.iItem = dis->itemID;\r
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);\r
if (nmce.ceItem.mask & CBEIF_DI_SETITEM)\r
item->iOverlay = nmce.ceItem.iOverlay;\r
if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,\r
0, KEY_WRITE, &newkey))) {\r
/* not present - what to do ??? */\r
- ERR("Can not open key, error=%d, attempting to create\n",\r
+ ERR("Could not open key, error=%d, attempting to create\n",\r
err);\r
if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,\r
0,\r
&newkey,\r
&dwdisp))) {\r
/* error - what to do ??? */\r
- ERR("(%lu %lu %lx %lx \"%s\" %p): Can not open key, error=%d\n",\r
+ ERR("(%lu %lu %lx %lx \"%s\" %p): Could not open key, error=%d\n",\r
mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags,\r
(DWORD)mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey),\r
mp->extview.lpfnCompare, err);\r
RECT *checkbox = &infoPtr->checkbox;\r
SIZE size;\r
COLORREF oldTextColor;\r
- SHORT fieldWidth;\r
+ SHORT fieldWidth = 0;\r
\r
/* draw control edge */\r
TRACE("\n");\r
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);\r
HEADER_ITEM *phdi = &infoPtr->items[iItem];\r
RECT r;\r
- INT oldBkMode;\r
+ INT oldBkMode, cxEdge = GetSystemMetrics(SM_CXEDGE);\r
\r
TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, infoPtr->bUnicode);\r
\r
else\r
DrawEdge (hdc, &r, EDGE_ETCHED, BF_BOTTOM | BF_RIGHT | BF_ADJUST);\r
\r
+ r.left -= cxEdge;\r
+ r.right += cxEdge;\r
+\r
if (phdi->fmt & HDF_OWNERDRAW) {\r
DRAWITEMSTRUCT dis;\r
dis.CtlType = ODT_HEADER;\r
SetBkMode(hdc, oldBkMode);\r
}\r
else {\r
- UINT uTextJustify = DT_LEFT;\r
+ UINT rw, rh, /* width and height of r */\r
+ *x = NULL, *w = NULL; /* x and width of the pic (bmp or img) which is part of cnt */\r
+ /* cnt,txt,img,bmp */\r
+ UINT cx, tx, ix, bx,\r
+ cw, tw, iw, bw;\r
+ BITMAP bmp;\r
+\r
+ cw = tw = iw = bw = 0;\r
+ rw = r.right - r.left;\r
+ rh = r.bottom - r.top;\r
+\r
+ if (phdi->fmt & HDF_STRING) {\r
+ RECT textRect;\r
\r
- if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)\r
- uTextJustify = DT_CENTER;\r
- else if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_RIGHT)\r
- uTextJustify = DT_RIGHT;\r
+ DrawTextW (hdc, phdi->pszText, -1,\r
+ &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);\r
+ cw = textRect.right - textRect.left + 2 * infoPtr->iMargin;\r
+ }\r
\r
- if ((phdi->fmt & HDF_BITMAP) && !(phdi->fmt & HDF_BITMAP_ON_RIGHT) && (phdi->hbm)) {\r
- BITMAP bmp;\r
- HDC hdcBitmap;\r
- INT yD, yS, cx, cy, rx, ry;\r
+ if ((phdi->fmt & HDF_IMAGE) && (infoPtr->himl)) {\r
+ iw = infoPtr->himl->cx + 2 * infoPtr->iMargin;\r
+ x = &ix;\r
+ w = &iw;\r
+ }\r
\r
+ if ((phdi->fmt & HDF_BITMAP) && (phdi->hbm)) {\r
GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);\r
-\r
- ry = r.bottom - r.top;\r
- rx = r.right - r.left;\r
-\r
- if (ry >= bmp.bmHeight) {\r
- cy = bmp.bmHeight;\r
- yD = r.top + (ry - bmp.bmHeight) / 2;\r
- yS = 0;\r
- }\r
- else {\r
- cy = ry;\r
- yD = r.top;\r
- yS = (bmp.bmHeight - ry) / 2;\r
-\r
+ bw = bmp.bmWidth + 2 * infoPtr->iMargin;\r
+ if (!iw) {\r
+ x = &bx;\r
+ w = &bw;\r
}\r
+ }\r
\r
- if (rx >= bmp.bmWidth + infoPtr->iMargin) {\r
- cx = bmp.bmWidth;\r
- }\r
- else {\r
- cx = rx - infoPtr->iMargin;\r
+ if (bw || iw)\r
+ cw += *w; \r
+\r
+ /* align cx using the unclipped cw */\r
+ if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_LEFT)\r
+ cx = r.left;\r
+ else if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)\r
+ cx = r.left + rw / 2 - cw / 2;\r
+ else /* HDF_RIGHT */\r
+ cx = r.right - cw;\r
+ \r
+ /* clip cx & cw */\r
+ if (cx < r.left)\r
+ cx = r.left;\r
+ if (cx + cw > r.right)\r
+ cw = r.right - cx;\r
+ \r
+ tx = cx + infoPtr->iMargin;\r
+ /* since cw might have changed we have to recalculate tw */\r
+ tw = cw - infoPtr->iMargin * 2;\r
+ \r
+ if (iw || bw) {\r
+ tw -= *w;\r
+ if (phdi->fmt & HDF_BITMAP_ON_RIGHT) {\r
+ /* put pic behind text */\r
+ *x = cx + tw + infoPtr->iMargin * 3;\r
+ } else {\r
+ *x = cx + infoPtr->iMargin;\r
+ /* move text behind pic */\r
+ tx += *w;\r
}\r
-\r
- hdcBitmap = CreateCompatibleDC (hdc);\r
- SelectObject (hdcBitmap, phdi->hbm);\r
- BitBlt (hdc, r.left + infoPtr->iMargin, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY);\r
- DeleteDC (hdcBitmap);\r
-\r
- r.left += (bmp.bmWidth + infoPtr->iMargin);\r
}\r
\r
-\r
- if ((phdi->fmt & HDF_BITMAP) && (phdi->fmt & HDF_BITMAP_ON_RIGHT) && (phdi->hbm)) {\r
- BITMAP bmp;\r
- HDC hdcBitmap;\r
- INT xD, yD, yS, cx, cy, rx, ry, tx;\r
- RECT textRect;\r
-\r
- GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);\r
-\r
- textRect = r;\r
- if (phdi->fmt & HDF_STRING) {\r
- DrawTextW (hdc, phdi->pszText, -1,\r
- &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);\r
- tx = textRect.right - textRect.left;\r
- }\r
+ if (iw && bw) {\r
+ /* since we're done with the layout we can\r
+ now calculate the position of bmp which\r
+ has no influence on alignment and layout\r
+ because of img */\r
+ if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_RIGHT)\r
+ bx = cx - bw + infoPtr->iMargin;\r
else\r
- tx = 0;\r
- ry = r.bottom - r.top;\r
- rx = r.right - r.left;\r
-\r
- if (ry >= bmp.bmHeight) {\r
- cy = bmp.bmHeight;\r
- yD = r.top + (ry - bmp.bmHeight) / 2;\r
- yS = 0;\r
- }\r
- else {\r
- cy = ry;\r
- yD = r.top;\r
- yS = (bmp.bmHeight - ry) / 2;\r
+ bx = cx + cw + infoPtr->iMargin;\r
+ }\r
\r
+ if (iw || bw) {\r
+ HDC hClipDC = GetDC(hwnd);\r
+ HRGN hClipRgn = CreateRectRgn(r.left, r.top, r.right, r.bottom);\r
+ SelectClipRgn(hClipDC, hClipRgn);\r
+ \r
+ if (bw) {\r
+ HDC hdcBitmap = CreateCompatibleDC (hClipDC);\r
+ SelectObject (hdcBitmap, phdi->hbm);\r
+ BitBlt (hClipDC, bx, r.top + ((INT)rh - bmp.bmHeight) / 2, \r
+ bmp.bmWidth, bmp.bmHeight, hdcBitmap, 0, 0, SRCCOPY);\r
+ DeleteDC (hdcBitmap);\r
}\r
\r
- if (r.left + tx + bmp.bmWidth + 2*infoPtr->iMargin <= r.right) {\r
- cx = bmp.bmWidth;\r
- xD = r.left + tx + infoPtr->iMargin;\r
- }\r
- else {\r
- if (rx >= bmp.bmWidth + infoPtr->iMargin ) {\r
- cx = bmp.bmWidth;\r
- xD = r.right - bmp.bmWidth - infoPtr->iMargin;\r
- r.right = xD - infoPtr->iMargin;\r
- }\r
- else {\r
- cx = rx - infoPtr->iMargin;\r
- xD = r.left;\r
- r.right = r.left;\r
- }\r
+ if (iw) {\r
+ ImageList_DrawEx (infoPtr->himl, phdi->iImage, hClipDC, \r
+ ix, r.top + ((INT)rh - infoPtr->himl->cy) / 2,\r
+ infoPtr->himl->cx, infoPtr->himl->cy, CLR_DEFAULT, CLR_DEFAULT, 0);\r
}\r
\r
- hdcBitmap = CreateCompatibleDC (hdc);\r
- SelectObject (hdcBitmap, phdi->hbm);\r
- BitBlt (hdc, xD, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY);\r
- DeleteDC (hdcBitmap);\r
+ DeleteObject(hClipRgn);\r
+ DeleteDC(hClipDC);\r
}\r
-\r
- if ((phdi->fmt & HDF_IMAGE) && !(phdi->fmt & HDF_BITMAP_ON_RIGHT) && (infoPtr->himl)) {\r
- r.left += infoPtr->iMargin;\r
- ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left, r.top + (r.bottom-r.top- infoPtr->himl->cy)/2,\r
- infoPtr->himl->cx, r.bottom-r.top, CLR_DEFAULT, CLR_DEFAULT, 0); \r
- r.left += infoPtr->himl->cx;\r
- }\r
-\r
- if ((phdi->fmt & HDF_IMAGE) && (phdi->fmt & HDF_BITMAP_ON_RIGHT) && (infoPtr->himl)) {\r
- RECT textRect;\r
- INT tx; \r
-\r
- textRect = r;\r
- if (phdi->fmt & HDF_STRING) {\r
- DrawTextW (hdc, phdi->pszText, -1,\r
- &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);\r
- tx = textRect.right - textRect.left;\r
- } \r
- else\r
- tx = 0;\r
-\r
- if (tx < (r.right-r.left - infoPtr->himl->cx - GetSystemMetrics(SM_CXEDGE)))\r
- ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left + tx + 2*infoPtr->iMargin,\r
- r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, infoPtr->himl->cx, r.bottom-r.top, \r
- CLR_DEFAULT, CLR_DEFAULT, 0);\r
- else {\r
- INT x = max(r.right - infoPtr->iMargin - infoPtr->himl->cx, r.left);\r
- INT cx = min(infoPtr->himl->cx, r.right-r.left - GetSystemMetrics(SM_CXEDGE));\r
- ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, x ,\r
- r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, cx, r.bottom-r.top, \r
- CLR_DEFAULT, CLR_DEFAULT, 0); \r
- r.right -= infoPtr->himl->cx - infoPtr->iMargin;\r
- }\r
- } \r
-\r
- if (((phdi->fmt & HDF_STRING)\r
+ \r
+ if (((phdi->fmt & HDF_STRING)\r
|| (!(phdi->fmt & (HDF_OWNERDRAW|HDF_STRING|HDF_BITMAP|\r
HDF_BITMAP_ON_RIGHT|HDF_IMAGE)))) /* no explicit format specified? */\r
&& (phdi->pszText)) {\r
- oldBkMode = SetBkMode(hdc, TRANSPARENT);\r
- r.left += infoPtr->iMargin;\r
- r.right -= infoPtr->iMargin;\r
+ oldBkMode = SetBkMode(hdc, TRANSPARENT);\r
SetTextColor (hdc, (bHotTrack) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);\r
+ r.left = tx;\r
+ r.right = tx + tw;\r
DrawTextW (hdc, phdi->pszText, -1,\r
- &r, uTextJustify|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);\r
+ &r, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);\r
if (oldBkMode != TRANSPARENT)\r
SetBkMode(hdc, oldBkMode);\r
}\r
BYTE CurrMod;\r
INT CaretPos;\r
DWORD ScanCode;\r
- WCHAR strNone[15]; /* hope its long enough ... */\r
+ WCHAR strNone[15]; /* hope it's long enough ... */\r
} HOTKEY_INFO;\r
\r
static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' };\r
* nothing\r
*\r
* NOTES\r
- * This function can NOT be used to reduce the number of images.\r
+ * This function CANNOT be used to reduce the number of images.\r
*/\r
static void\r
IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy)\r
{\r
HWND Self;\r
HWND Notify;\r
+ BOOL Enabled;\r
IPPART_INFO Part[4];\r
} IPADDRESS_INFO;\r
\r
static const WCHAR dotW[] = { '.', 0 };\r
RECT rect, rcPart;\r
POINT pt;\r
+ COLORREF bgCol, fgCol;\r
int i;\r
\r
TRACE("\n");\r
\r
GetClientRect (infoPtr->Self, &rect);\r
+\r
+ if (infoPtr->Enabled) {\r
+ bgCol = COLOR_WINDOW;\r
+ fgCol = COLOR_WINDOWTEXT;\r
+ } else {\r
+ bgCol = COLOR_3DFACE;\r
+ fgCol = COLOR_GRAYTEXT;\r
+ }\r
+ \r
+ FillRect (hdc, &rect, (HBRUSH) (bgCol+1));\r
DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);\r
+ \r
+ SetBkColor (hdc, GetSysColor(bgCol));\r
+ SetTextColor(hdc, GetSysColor(fgCol));\r
\r
for (i = 0; i < 3; i++) {\r
GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart);\r
edit.bottom = rcClient.bottom - 2;\r
\r
infoPtr->Self = hwnd;\r
+ infoPtr->Enabled = FALSE;\r
infoPtr->Notify = lpCreate->hwndParent;\r
\r
for (i = 0; i < 4; i++) {\r
}\r
\r
\r
+static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled)\r
+{\r
+ int i;\r
+\r
+ infoPtr->Enabled = enabled;\r
+\r
+ for (i = 0; i < 4; i++)\r
+ EnableWindow(infoPtr->Part[i].EditHwnd, enabled);\r
+\r
+ InvalidateRgn(infoPtr->Self, NULL, FALSE);\r
+ return 0;\r
+}\r
+\r
+\r
static LRESULT IPADDRESS_Paint (IPADDRESS_INFO *infoPtr, HDC hdc)\r
{\r
PAINTSTRUCT ps;\r
case WM_DESTROY:\r
return IPADDRESS_Destroy (infoPtr);\r
\r
+ case WM_ENABLE:\r
+ return IPADDRESS_Enable (infoPtr, (BOOL)wParam);\r
+ break;\r
+\r
case WM_PAINT:\r
return IPADDRESS_Paint (infoPtr, (HDC)wParam);\r
\r
* NOTES\r
*\r
* This code was audited for completeness against the documented features\r
- * of Comctl32.dll version 6.0 on Oct. 21, 2002, by Dimitrie O. Paun.\r
+ * of Comctl32.dll version 6.0 on May. 20, 2005, by James Hawkins.\r
* \r
* Unless otherwise noted, we believe this code to be complete, as per\r
* the specification mentioned above.\r
* \r
* TODO:\r
*\r
+ * Default Message Processing\r
+ * -- EN_KILLFOCUS should be handled in WM_COMMAND\r
+ * -- WM_CREATE: create the icon and small icon image lists at this point only if\r
+ * the LVS_SHAREIMAGELISTS style is not specified.\r
+ * -- WM_ERASEBKGND: forward this message to the parent window if the bkgnd\r
+ * color is CLR_NONE.\r
+ * -- WM_WINDOWPOSCHANGED: arrange the list items if the current view is icon\r
+ * or small icon and the LVS_AUTOARRANGE style is specified.\r
+ * -- WM_TIMER\r
+ * -- WM_WININICHANGE\r
+ *\r
* Features\r
* -- Hot item handling, mouse hovering\r
* -- Workareas support\r
* -- LVS_NOLABELWRAP\r
* -- LVS_NOSCROLL (see Q137520)\r
* -- LVS_SORTASCENDING, LVS_SORTDESCENDING\r
+ * -- LVS_ALIGNTOP\r
+ * -- LVS_TYPESTYLEMASK\r
*\r
* Extended Styles\r
* -- LVS_EX_BORDERSELECT\r
* -- LVN_ODFINDITEM\r
* -- LVN_SETDISPINFO\r
* -- NM_HOVER\r
+ * -- LVN_BEGINRDRAG\r
*\r
* Messages:\r
* -- LVM_CANCELEDITLABEL\r
* -- LVM_SORTGROUPS\r
* -- LVM_SORTITEMSEX\r
*\r
+ * Macros:\r
+ * -- ListView_GetCheckSate, ListView_SetCheckState\r
+ * -- ListView_GetHoverTime, ListView_SetHoverTime\r
+ * -- ListView_GetISearchString\r
+ * -- ListView_GetNumberOfWorkAreas\r
+ * -- ListView_GetOrigin\r
+ * -- ListView_GetTextBkColor\r
+ * -- ListView_GetUnicodeFormat, ListView_SetUnicodeFormat\r
+ * -- ListView_GetWorkAreas, ListView_SetWorkAreas\r
+ * -- ListView_SortItemsEx\r
+ *\r
+ * Functions:\r
+ * -- LVGroupComparE\r
+ *\r
* Known differences in message stream from native control (not known if\r
* these differences cause problems):\r
* LVM_INSERTITEM issues LVM_SETITEMSTATE and LVM_SETITEM in certain cases.\r
HIMAGELIST himlState;\r
BOOL bLButtonDown;\r
BOOL bRButtonDown;\r
+ POINT ptClickPos; /* point where the user clicked */ \r
BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */\r
INT nItemHeight;\r
INT nItemWidth;\r
static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL);\r
static HWND CreateEditLabelT(LISTVIEW_INFO *, LPCWSTR, DWORD, INT, INT, INT, INT, BOOL);\r
static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *, INT, HIMAGELIST);\r
+static INT LISTVIEW_HitTest(LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL);\r
\r
/******** Text handling functions *************************************/\r
\r
return bResult;\r
}\r
\r
+static BOOL LISTVIEW_GetItemAtPt(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)\r
+{\r
+ LVHITTESTINFO lvHitTestInfo;\r
+\r
+ ZeroMemory(&lvHitTestInfo, sizeof(lvHitTestInfo));\r
+ lvHitTestInfo.pt.x = pt.x;\r
+ lvHitTestInfo.pt.y = pt.y;\r
+\r
+ LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);\r
+\r
+ lpLVItem->mask = LVIF_PARAM;\r
+ lpLVItem->iItem = lvHitTestInfo.iItem;\r
+ lpLVItem->iSubItem = 0;\r
+\r
+ return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE);\r
+}\r
\r
/***\r
* DESCRIPTION:\r
*/\r
static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, INT x, INT y)\r
{\r
- if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)\r
- /* FIXME: select the item!!! */\r
- /*LISTVIEW_GetItemAtPt(infoPtr, pt)*/;\r
+ if (infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)\r
+ {\r
+ LVITEMW item;\r
+ POINT pt;\r
+\r
+ pt.x = x;\r
+ pt.y = y;\r
+\r
+ if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt))\r
+ LISTVIEW_SetSelection(infoPtr, item.iItem);\r
+ }\r
\r
return 0;\r
}\r
*/\r
static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)\r
{\r
- TRACKMOUSEEVENT trackinfo;\r
+ TRACKMOUSEEVENT trackinfo;\r
+\r
+ if (infoPtr->bLButtonDown && DragDetect(infoPtr->hwndSelf, infoPtr->ptClickPos))\r
+ {\r
+ LVHITTESTINFO lvHitTestInfo;\r
+ NMLISTVIEW nmlv;\r
+\r
+ lvHitTestInfo.pt = infoPtr->ptClickPos;\r
+ LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);\r
+\r
+ ZeroMemory(&nmlv, sizeof(nmlv));\r
+ nmlv.iItem = lvHitTestInfo.iItem;\r
+ nmlv.ptAction = infoPtr->ptClickPos;\r
+\r
+ notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv);\r
+\r
+ return 0;\r
+ } \r
\r
/* see if we are supposed to be tracking mouse hovering */\r
if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) {\r
return -1;\r
}\r
\r
+/***\r
+ * DESCRIPTION:\r
+ * Enables the listview control.\r
+ *\r
+ * PARAMETER(S):\r
+ * [I] infoPtr : valid pointer to the listview structure\r
+ * [I] bEnable : specifies whether to enable or disable the window\r
+ *\r
+ * RETURN:\r
+ * SUCCESS : TRUE\r
+ * FAILURE : FALSE\r
+ */\r
+static BOOL LISTVIEW_Enable(LISTVIEW_INFO *infoPtr, BOOL bEnable)\r
+{\r
+ if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)\r
+ InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);\r
+ return TRUE;\r
+}\r
+\r
/***\r
* DESCRIPTION:\r
* Erases the background of the listview control.\r
return 0;\r
}\r
\r
-\r
-/***\r
- * DESCRIPTION:\r
- * Track mouse/dragging\r
- *\r
- * PARAMETER(S):\r
- * [I] infoPtr : valid pointer to the listview structure\r
- * [I] pt : mouse coordinate\r
- *\r
- * RETURN:\r
- * Zero\r
- */\r
-static LRESULT LISTVIEW_TrackMouse(LISTVIEW_INFO *infoPtr, POINT pt)\r
-{\r
- INT cxDrag = GetSystemMetrics(SM_CXDRAG);\r
- INT cyDrag = GetSystemMetrics(SM_CYDRAG);\r
- RECT r;\r
- MSG msg;\r
-\r
- TRACE("\n");\r
-\r
- r.top = pt.y - cyDrag;\r
- r.left = pt.x - cxDrag;\r
- r.bottom = pt.y + cyDrag;\r
- r.right = pt.x + cxDrag;\r
-\r
- SetCapture(infoPtr->hwndSelf);\r
-\r
- while (1)\r
- {\r
- if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD))\r
- {\r
- if (msg.message == WM_MOUSEMOVE)\r
- {\r
- pt.x = (short)LOWORD(msg.lParam);\r
- pt.y = (short)HIWORD(msg.lParam);\r
- if (PtInRect(&r, pt))\r
- continue;\r
- else\r
- {\r
- ReleaseCapture();\r
- return 1;\r
- }\r
- }\r
- else if (msg.message >= WM_LBUTTONDOWN &&\r
- msg.message <= WM_RBUTTONDBLCLK)\r
- {\r
- break;\r
- }\r
-\r
- DispatchMessageW(&msg);\r
- }\r
-\r
- if (GetCapture() != infoPtr->hwndSelf)\r
- return 0;\r
- }\r
-\r
- ReleaseCapture();\r
- return 0;\r
-}\r
-\r
-\r
/***\r
* DESCRIPTION:\r
* Processes double click messages (left mouse button).\r
\r
if (!infoPtr->bFocus) SetFocus(infoPtr->hwndSelf);\r
\r
- /* set left button down flag */\r
+ /* set left button down flag and record the click position */\r
infoPtr->bLButtonDown = TRUE;\r
+ infoPtr->ptClickPos = pt;\r
\r
lvHitTestInfo.pt.x = x;\r
lvHitTestInfo.pt.y = y;\r
}\r
return 0;\r
}\r
- if (LISTVIEW_TrackMouse(infoPtr, lvHitTestInfo.pt))\r
- {\r
- NMLISTVIEW nmlv;\r
-\r
- ZeroMemory(&nmlv, sizeof(nmlv));\r
- nmlv.iItem = nItem;\r
- nmlv.ptAction.x = lvHitTestInfo.pt.x;\r
- nmlv.ptAction.y = lvHitTestInfo.pt.y;\r
-\r
- notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv);\r
-\r
- return 0;\r
- }\r
\r
if (infoPtr->dwStyle & LVS_SINGLESEL)\r
{\r
notify_listview(infoPtr, LVN_COLUMNCLICK, &nmlv);\r
}\r
break;\r
+\r
+ case HDN_DIVIDERDBLCLICKW:\r
+ case HDN_DIVIDERDBLCLICKA:\r
+ LISTVIEW_SetColumnWidth(infoPtr, lpnmh->iItem, LVSCW_AUTOSIZE);\r
+ break;\r
}\r
\r
return 0;\r
{\r
TRACE("infoPtr->bRedraw=%d, bRedraw=%d\n", infoPtr->bRedraw, bRedraw);\r
\r
- /* we can not use straight equality here because _any_ non-zero value is TRUE */\r
+ /* we cannot use straight equality here because _any_ non-zero value is TRUE */\r
if ((infoPtr->bRedraw && bRedraw) || (!infoPtr->bRedraw && !bRedraw)) return 0;\r
\r
infoPtr->bRedraw = bRedraw;\r
case WM_CREATE:\r
return LISTVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);\r
\r
+ case WM_ENABLE:\r
+ return LISTVIEW_Enable(infoPtr, (BOOL)wParam);\r
+\r
case WM_ERASEBKGND:\r
return LISTVIEW_EraseBkgnd(infoPtr, (HDC)wParam);\r
\r
SetTextColor(hdc, infoPtr->titletxt);\r
currentFont = SelectObject(hdc, infoPtr->hBoldFont);\r
\r
- /* titlemonth->left and right are set in MONTHCAL_UpdateSize */\r
- titlemonth->left = title->left;\r
- titlemonth->right = title->right;\r
-\r
GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,\r
buf1,countof(buf1));\r
wsprintfW(buf, fmt1W, buf1, infoPtr->currentYear);\r
\r
- if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth))\r
+ if(IntersectRect(&rcTemp, &(ps->rcPaint), title))\r
{\r
- DrawTextW(hdc, buf, strlenW(buf), titlemonth,\r
+ DrawTextW(hdc, buf, strlenW(buf), title,\r
DT_CENTER | DT_VCENTER | DT_SINGLELINE);\r
}\r
\r
- SelectObject(hdc, infoPtr->hFont);\r
-\r
/* titlemonth left/right contained rect for whole titletxt('June 1999')\r
* MCM_HitTestInfo wants month & year rects, so prepare these now.\r
*(no, we can't draw them separately; the whole text is centered)\r
*/\r
GetTextExtentPoint32W(hdc, buf, strlenW(buf), &size);\r
- titlemonth->left = title->right / 2 - size.cx / 2;\r
- titleyear->right = title->right / 2 + size.cx / 2;\r
+ titlemonth->left = title->right / 2 + title->left / 2 - size.cx / 2;\r
+ titleyear->right = title->right / 2 + title->left / 2 + size.cx / 2;\r
GetTextExtentPoint32W(hdc, buf1, strlenW(buf1), &size);\r
titlemonth->right = titlemonth->left + size.cx;\r
titleyear->left = titlemonth->right;\r
infoPtr->wdays.left = infoPtr->days.left = infoPtr->weeknums.right;\r
/* draw day abbreviations */\r
\r
+ SelectObject(hdc, infoPtr->hFont);\r
SetBkColor(hdc, infoPtr->monthbk);\r
SetTextColor(hdc, infoPtr->trailingtxt);\r
\r
wsprintfW(buf, fmt2W, buf1, buf2);\r
SelectObject(hdc, infoPtr->hBoldFont);\r
\r
+ DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE);\r
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rtoday))\r
{\r
- DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE);\r
DrawTextW(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE);\r
}\r
SelectObject(hdc, infoPtr->hFont);\r
0,\r
WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT,\r
infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,\r
- infoPtr->titleyear.right-infoPtr->titleyear.left,\r
+ infoPtr->titleyear.right-infoPtr->titleyear.left+4,\r
infoPtr->textHeight,\r
infoPtr->hwndSelf,\r
NULL,\r
NULL,\r
NULL);\r
+ SendMessageW( infoPtr->hWndYearEdit, WM_SETFONT, (WPARAM) infoPtr->hBoldFont, (LPARAM)TRUE);\r
infoPtr->hWndYearUpDown=CreateWindowExW(0,\r
UPDOWN_CLASSW,\r
0,\r
WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS,\r
- infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,\r
- 20,\r
+ infoPtr->titleyear.right+7,infoPtr->titlebtnnext.top,\r
+ 18,\r
infoPtr->textHeight,\r
infoPtr->hwndSelf,\r
NULL,\r
\r
xdiv = (dwStyle & MCS_WEEKNUMBERS) ? 8 : 7;\r
\r
- infoPtr->width_increment = size.cx * 2;\r
+ infoPtr->width_increment = size.cx * 2 + 4;\r
infoPtr->height_increment = infoPtr->textHeight;\r
left_offset = (rcClient.right - rcClient.left) - (infoPtr->width_increment * xdiv);\r
\r
/* initialize info structure */\r
/* FIXME: calculate systemtime ->> localtime(substract timezoneinfo) */\r
\r
- GetSystemTime(&infoPtr->todaysDate);\r
+ GetLocalTime(&infoPtr->todaysDate);\r
MONTHCAL_SetFirstDayOfWeek(infoPtr, (LPARAM)-1);\r
infoPtr->currentMonth = infoPtr->todaysDate.wMonth;\r
infoPtr->currentYear = infoPtr->todaysDate.wYear;\r
else\r
drawRect->bottom-=center_offset_h;\r
\r
- center_offset_v = ((drawRect->right - drawRect->left) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;\r
+ center_offset_v = ((drawRect->right - drawRect->left) - (rcText.bottom - rcText.top) + infoPtr->uVItemPadding) / 2;\r
}\r
else\r
{\r
drawRect->left += center_offset_h;\r
- center_offset_v = ((drawRect->bottom - drawRect->top) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;\r
+ center_offset_v = ((drawRect->bottom - drawRect->top) - (rcText.bottom - rcText.top) + infoPtr->uVItemPadding) / 2;\r
}\r
\r
if (center_offset_v < 0)\r
return 0;\r
}\r
\r
+static LRESULT TAB_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)\r
+{\r
+ if (!wParam)\r
+ return 0;\r
+ return WVR_ALIGNTOP;\r
+}\r
+\r
static inline LRESULT\r
TAB_SetItemExtra (TAB_INFO *infoPtr, INT cbInfo)\r
-{ \r
+{\r
if (!infoPtr || cbInfo <= 0)\r
return FALSE;\r
\r
case WM_NCHITTEST:\r
return TAB_NCHitTest(infoPtr, lParam);\r
\r
+ case WM_NCCALCSIZE:\r
+ return TAB_NCCalcSize(hwnd, wParam, lParam);\r
+\r
default:\r
if (uMsg >= WM_USER && uMsg < WM_APP)\r
WARN("unknown msg %04x wp=%08x lp=%08lx\n",\r
* forgets to specify TBSTYLE_TRANSPARENT but does specify either\r
* CCS_TOP or CCS_BOTTOM (_NOMOVEY and _TOP), then the control\r
* does *not* set TBSTYLE_TRANSPARENT even though it should!!!!\r
- * Some how, the only cases of this seem to be MFC programs.\r
+ * Somehow, the only cases of this seem to be MFC programs.\r
*\r
* Note also that the addition of _TRANSPARENT occurs *only* here. It\r
* does not occur in the WM_STYLECHANGING routine.\r
break;\r
\r
case WM_ENABLE:\r
- infoPtr->dwStyle &= ~WS_DISABLED;\r
- infoPtr->dwStyle |= (wParam ? 0 : WS_DISABLED);\r
- if (infoPtr->dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr);\r
+ if (wParam) {\r
+ infoPtr->dwStyle &= ~WS_DISABLED;\r
+ } else {\r
+ infoPtr->dwStyle |= WS_DISABLED;\r
+ UPDOWN_CancelMode (infoPtr);\r
+ }\r
InvalidateRect (infoPtr->Self, NULL, FALSE);\r
break;\r
\r