ReactOS 0.4.15-dev-7924-g5949c20
checklist.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for checklist.c:

Go to the source code of this file.

Classes

struct  _CHECKITEM
 
struct  _CHECKLISTWND
 

Macros

#define NDEBUG
 
#define CI_TEXT_MARGIN_WIDTH   (8)
 
#define CI_TEXT_MARGIN_HEIGHT   (3)
 
#define CI_TEXT_SELECTIONMARGIN   (1)
 
#define TIMER_ID_SETHITFOCUS   (1)
 
#define TIMER_ID_RESETQUICKSEARCH   (2)
 
#define DEFAULT_QUICKSEARCH_SETFOCUS_DELAY   (2000)
 
#define DEFAULT_QUICKSEARCH_RESET_DELAY   (3000)
 

Typedefs

typedef struct _CHECKITEM CHECKITEM
 
typedef struct _CHECKITEMPCHECKITEM
 
typedef struct _CHECKLISTWND CHECKLISTWND
 
typedef struct _CHECKLISTWNDPCHECKLISTWND
 

Functions

static VOID EscapeQuickSearch (IN PCHECKLISTWND infoPtr)
 
static VOID ChangeCheckItemFocus (IN PCHECKLISTWND infoPtr, IN PCHECKITEM NewFocus, IN UINT NewFocusBox)
 
static LRESULT NotifyControlParent (IN PCHECKLISTWND infoPtr, IN UINT code, IN OUT PVOID data)
 
static PCHECKITEM FindCheckItemByIndex (IN PCHECKLISTWND infoPtr, IN INT Index)
 
static INT FindCheckItemIndexByAccessMask (IN PCHECKLISTWND infoPtr, IN ACCESS_MASK AccessMask)
 
static INT CheckItemToIndex (IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
 
static PCHECKITEM FindCheckItem (IN PCHECKLISTWND infoPtr, IN LPWSTR SearchText)
 
static PCHECKITEM FindFirstEnabledCheckBox (IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
 
static PCHECKITEM FindLastEnabledCheckBox (IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
 
static PCHECKITEM FindPreviousEnabledCheckBox (IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
 
static PCHECKITEM FindNextEnabledCheckBox (IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
 
static PCHECKITEM FindEnabledCheckBox (IN PCHECKLISTWND infoPtr, IN BOOL ReverseSearch, OUT UINT *CheckBox)
 
static PCHECKITEM PtToCheckItemBox (IN PCHECKLISTWND infoPtr, IN PPOINT ppt, OUT UINT *CheckBox, OUT BOOL *DirectlyInCheckBox)
 
static VOID ClearCheckItems (IN PCHECKLISTWND infoPtr)
 
static BOOL DeleteCheckItem (IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
 
static PCHECKITEM AddCheckItem (IN PCHECKLISTWND infoPtr, IN LPWSTR Name, IN DWORD State, IN ACCESS_MASK AccessMask, OUT INT *Index)
 
static UINT ClearCheckBoxes (IN PCHECKLISTWND infoPtr)
 
static VOID UpdateControl (IN PCHECKLISTWND infoPtr)
 
static VOID UpdateCheckItem (IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
 
static VOID MakeCheckItemVisible (IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
 
static UINT GetIdealItemHeight (IN PCHECKLISTWND infoPtr)
 
static HFONT RetChangeControlFont (IN PCHECKLISTWND infoPtr, IN HFONT hFont, IN BOOL Redraw)
 
static VOID PaintControl (IN PCHECKLISTWND infoPtr, IN HDC hDC, IN PRECT rcUpdate)
 
static VOID UpdateCheckItemBox (IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item, IN UINT ItemBox)
 
static BOOL ChangeCheckBox (IN PCHECKLISTWND infoPtr, IN PCHECKITEM CheckItem, IN UINT CheckItemBox)
 
static VOID DisplayCaret (IN PCHECKLISTWND infoPtr)
 
static VOID RemoveCaret (IN PCHECKLISTWND infoPtr)
 
static VOID KillQuickSearchTimers (IN PCHECKLISTWND infoPtr)
 
static VOID MapItemToRect (IN PCHECKLISTWND infoPtr, IN PCHECKITEM CheckItem, OUT RECT *prcItem)
 
static VOID UpdateCaretPos (IN PCHECKLISTWND infoPtr)
 
static VOID ChangeSearchHit (IN PCHECKLISTWND infoPtr, IN PCHECKITEM NewHit)
 
static BOOL QuickSearchFindHit (IN PCHECKLISTWND infoPtr, IN WCHAR c)
 
static LRESULT CALLBACK CheckListWndProc (IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL RegisterCheckListControl (IN HINSTANCE hInstance)
 
VOID UnregisterCheckListControl (HINSTANCE hInstance)
 

Variables

static const WCHAR szCheckListWndClass [] = L"CHECKLIST_ACLUI"
 

Macro Definition Documentation

◆ CI_TEXT_MARGIN_HEIGHT

#define CI_TEXT_MARGIN_HEIGHT   (3)

Definition at line 42 of file checklist.c.

◆ CI_TEXT_MARGIN_WIDTH

#define CI_TEXT_MARGIN_WIDTH   (8)

Definition at line 41 of file checklist.c.

◆ CI_TEXT_SELECTIONMARGIN

#define CI_TEXT_SELECTIONMARGIN   (1)

Definition at line 43 of file checklist.c.

◆ DEFAULT_QUICKSEARCH_RESET_DELAY

#define DEFAULT_QUICKSEARCH_RESET_DELAY   (3000)

Definition at line 49 of file checklist.c.

◆ DEFAULT_QUICKSEARCH_SETFOCUS_DELAY

#define DEFAULT_QUICKSEARCH_SETFOCUS_DELAY   (2000)

Definition at line 48 of file checklist.c.

◆ NDEBUG

#define NDEBUG

Definition at line 36 of file checklist.c.

◆ TIMER_ID_RESETQUICKSEARCH

#define TIMER_ID_RESETQUICKSEARCH   (2)

Definition at line 46 of file checklist.c.

◆ TIMER_ID_SETHITFOCUS

#define TIMER_ID_SETHITFOCUS   (1)

Definition at line 45 of file checklist.c.

Typedef Documentation

◆ CHECKITEM

◆ CHECKLISTWND

◆ PCHECKITEM

◆ PCHECKLISTWND

Function Documentation

◆ AddCheckItem()

static PCHECKITEM AddCheckItem ( IN PCHECKLISTWND  infoPtr,
IN LPWSTR  Name,
IN DWORD  State,
IN ACCESS_MASK  AccessMask,
OUT INT Index 
)
static

Definition at line 505 of file checklist.c.

510{
511 PCHECKITEM CurItem;
512 INT i;
513 PCHECKITEM *PrevPtr = &infoPtr->CheckItemListHead;
515 0,
516 sizeof(CHECKITEM) + (wcslen(Name) * sizeof(WCHAR)));
517 if (Item != NULL)
518 {
519 for (CurItem = infoPtr->CheckItemListHead, i = 0;
520 CurItem != NULL;
521 CurItem = CurItem->Next)
522 {
523 PrevPtr = &CurItem->Next;
524 i++;
525 }
526
527 Item->Next = NULL;
528 Item->AccessMask = AccessMask;
529 Item->State = State & CIS_MASK;
530 wcscpy(Item->Name,
531 Name);
532
533 *PrevPtr = Item;
534 infoPtr->CheckItemCount++;
535
536 if (Index != NULL)
537 {
538 *Index = i;
539 }
540 }
541
542 return Item;
543}
#define NULL
Definition: types.h:112
#define CIS_MASK
Definition: precomp.h:125
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
struct _CHECKITEM * Next
Definition: checklist.c:53
int32_t INT
Definition: typedefs.h:58
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CheckListWndProc().

◆ ChangeCheckBox()

static BOOL ChangeCheckBox ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  CheckItem,
IN UINT  CheckItemBox 
)
static

Definition at line 1174 of file checklist.c.

1177{
1178 NMCHANGEITEMCHECKBOX CheckData;
1179 DWORD OldState = CheckItem->State;
1180 DWORD CheckedBit = ((infoPtr->FocusedCheckItemBox == CLB_DENY) ? CIS_DENY : CIS_ALLOW);
1181 BOOL Checked = (CheckItem->State & CheckedBit) != 0;
1182
1183 CheckData.OldState = OldState;
1184 CheckData.NewState = (Checked ? OldState & ~CheckedBit : OldState | CheckedBit);
1185 CheckData.CheckBox = infoPtr->FocusedCheckItemBox;
1186 CheckData.Checked = !Checked;
1187
1188 if (NotifyControlParent(infoPtr,
1190 &CheckData) != (LRESULT)-1)
1191 {
1192 CheckItem->State = CheckData.NewState;
1193 }
1194
1195 return (CheckItem->State != OldState);
1196}
static LRESULT NotifyControlParent(IN PCHECKLISTWND infoPtr, IN UINT code, IN OUT PVOID data)
Definition: checklist.c:112
#define CIS_ALLOW
Definition: precomp.h:117
#define CIS_DENY
Definition: precomp.h:118
#define CLB_DENY
Definition: precomp.h:123
#define CLN_CHANGINGITEMCHECKBOX
Definition: precomp.h:140
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ Checked
Definition: olepro.idl:92
#define LRESULT
Definition: ole.h:14

Referenced by CheckListWndProc().

◆ ChangeCheckItemFocus()

static VOID ChangeCheckItemFocus ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  NewFocus,
IN UINT  NewFocusBox 
)
static

Definition at line 1069 of file checklist.c.

1072{
1073 if (NewFocus != infoPtr->FocusedCheckItem)
1074 {
1075 PCHECKITEM OldFocus = infoPtr->FocusedCheckItem;
1076 infoPtr->FocusedCheckItem = NewFocus;
1077 infoPtr->FocusedCheckItemBox = NewFocusBox;
1078
1079 if (OldFocus != NULL)
1080 {
1081 UpdateCheckItem(infoPtr,
1082 OldFocus);
1083 }
1084 }
1085 else
1086 {
1087 infoPtr->FocusedCheckItemBox = NewFocusBox;
1088 }
1089
1090 if (NewFocus != NULL)
1091 {
1092 MakeCheckItemVisible(infoPtr,
1093 NewFocus);
1094 UpdateCheckItem(infoPtr,
1095 NewFocus);
1096 }
1097}
static VOID UpdateCheckItem(IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
Definition: checklist.c:602
static VOID MakeCheckItemVisible(IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
Definition: checklist.c:640

Referenced by CheckListWndProc(), DeleteCheckItem(), and QuickSearchFindHit().

◆ ChangeSearchHit()

static VOID ChangeSearchHit ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  NewHit 
)
static

Definition at line 1336 of file checklist.c.

1338{
1339 PCHECKITEM OldHit = infoPtr->QuickSearchHitItem;
1340
1341 infoPtr->QuickSearchHitItem = NewHit;
1342
1343 if (OldHit != NewHit)
1344 {
1345 /* scroll to the new search hit */
1346 MakeCheckItemVisible(infoPtr,
1347 NewHit);
1348
1349 /* repaint the old hit if present and visible */
1350 if (OldHit != NULL)
1351 {
1352 UpdateCheckItem(infoPtr,
1353 OldHit);
1354 }
1355 else
1356 {
1357 /* show the caret the first time we find an item */
1358 DisplayCaret(infoPtr);
1359 }
1360 }
1361
1362 UpdateCaretPos(infoPtr);
1363
1364 UpdateCheckItem(infoPtr,
1365 NewHit);
1366
1367 /* kill the reset timer and restart the set hit focus timer */
1368 KillTimer(infoPtr->hSelf,
1370 if (infoPtr->QuickSearchSetFocusDelay != 0)
1371 {
1372 SetTimer(infoPtr->hSelf,
1374 infoPtr->QuickSearchSetFocusDelay,
1375 NULL);
1376 }
1377}
#define TIMER_ID_SETHITFOCUS
Definition: checklist.c:45
static VOID UpdateCaretPos(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:1268
static VOID DisplayCaret(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:1199
#define TIMER_ID_RESETQUICKSEARCH
Definition: checklist.c:46
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by QuickSearchFindHit().

◆ CheckItemToIndex()

static INT CheckItemToIndex ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  Item 
)
static

Definition at line 185 of file checklist.c.

187{
188 PCHECKITEM CurItem;
189 INT Index;
190
191 for (CurItem = infoPtr->CheckItemListHead, Index = 0;
192 CurItem != NULL;
193 CurItem = CurItem->Next, Index++)
194 {
195 if (CurItem == Item)
196 {
197 return Index;
198 }
199 }
200
201 return -1;
202}

Referenced by MakeCheckItemVisible(), MapItemToRect(), UpdateCheckItem(), and UpdateCheckItemBox().

◆ CheckListWndProc()

static LRESULT CALLBACK CheckListWndProc ( IN HWND  hwnd,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1478 of file checklist.c.

1482{
1483 PCHECKLISTWND infoPtr;
1484 LRESULT Ret;
1485
1487 0);
1488
1489 if (infoPtr == NULL && uMsg != WM_CREATE)
1490 {
1491 goto HandleDefaultMessage;
1492 }
1493
1494 Ret = 0;
1495
1496 switch (uMsg)
1497 {
1498 case WM_PAINT:
1499 {
1500 HDC hdc;
1501 RECT rcUpdate;
1502 PAINTSTRUCT ps;
1503
1504 if (GetUpdateRect(hwnd,
1505 &rcUpdate,
1506 FALSE))
1507 {
1508 hdc = (wParam != 0 ? (HDC)wParam : BeginPaint(hwnd, &ps));
1509
1510 if (hdc != NULL)
1511 {
1512 PaintControl(infoPtr,
1513 hdc,
1514 &rcUpdate);
1515
1516 if (wParam == 0)
1517 {
1518 EndPaint(hwnd,
1519 &ps);
1520 }
1521 }
1522 }
1523 break;
1524 }
1525
1526 case WM_MOUSEMOVE:
1527 {
1528 POINT pt;
1529 BOOL InCheckBox;
1530 HWND hWndCapture = GetCapture();
1531
1532 pt.x = (LONG)LOWORD(lParam);
1533 pt.y = (LONG)HIWORD(lParam);
1534
1535#if SUPPORT_UXTHEME
1536 /* handle hovering checkboxes */
1537 if (hWndCapture == NULL && infoPtr->ThemeHandle != NULL)
1538 {
1539 TRACKMOUSEEVENT tme;
1540 PCHECKITEM HotTrackItem;
1541 UINT HotTrackItemBox;
1542
1543 HotTrackItem = PtToCheckItemBox(infoPtr,
1544 &pt,
1545 &HotTrackItemBox,
1546 &InCheckBox);
1547 if (HotTrackItem != NULL && InCheckBox)
1548 {
1549 if (infoPtr->HoveredCheckItem != HotTrackItem ||
1550 infoPtr->HoveredCheckItemBox != HotTrackItemBox)
1551 {
1552 ChangeCheckItemHotTrack(infoPtr,
1553 HotTrackItem,
1554 HotTrackItemBox);
1555 }
1556 }
1557 else
1558 {
1559 ChangeCheckItemHotTrack(infoPtr,
1560 NULL,
1561 0);
1562 }
1563
1564 tme.cbSize = sizeof(tme);
1565 tme.dwFlags = TME_LEAVE;
1566 tme.hwndTrack = hwnd;
1567 tme.dwHoverTime = infoPtr->HoverTime;
1568
1569 TrackMouseEvent(&tme);
1570 }
1571#endif
1572
1573 if (hWndCapture == hwnd && infoPtr->FocusedCheckItem != NULL)
1574 {
1575 PCHECKITEM PtItem;
1576 UINT PtItemBox;
1577 UINT OldPushed;
1578
1579 PtItem = PtToCheckItemBox(infoPtr,
1580 &pt,
1581 &PtItemBox,
1582 &InCheckBox);
1583
1584 OldPushed = infoPtr->FocusedPushed;
1585 infoPtr->FocusedPushed = InCheckBox && infoPtr->FocusedCheckItem == PtItem &&
1586 infoPtr->FocusedCheckItemBox == PtItemBox;
1587
1588 if (OldPushed != infoPtr->FocusedPushed)
1589 {
1590 UpdateCheckItemBox(infoPtr,
1591 infoPtr->FocusedCheckItem,
1592 infoPtr->FocusedCheckItemBox);
1593 }
1594 }
1595
1596 break;
1597 }
1598
1599 case WM_VSCROLL:
1600 {
1601 SCROLLINFO ScrollInfo;
1602
1603 ScrollInfo.cbSize = sizeof(ScrollInfo);
1604 ScrollInfo.fMask = SIF_RANGE | SIF_POS;
1605
1606 if (GetScrollInfo(hwnd,
1607 SB_VERT,
1608 &ScrollInfo))
1609 {
1610 INT OldPos = ScrollInfo.nPos;
1611
1612 switch (LOWORD(wParam))
1613 {
1614 case SB_BOTTOM:
1615 ScrollInfo.nPos = ScrollInfo.nMax;
1616 break;
1617
1618 case SB_LINEDOWN:
1619 if (ScrollInfo.nPos < ScrollInfo.nMax)
1620 {
1621 ScrollInfo.nPos++;
1622 }
1623 break;
1624
1625 case SB_LINEUP:
1626 if (ScrollInfo.nPos > 0)
1627 {
1628 ScrollInfo.nPos--;
1629 }
1630 break;
1631
1632 case SB_PAGEDOWN:
1633 {
1634 RECT rcClient;
1635 INT ScrollLines;
1636
1637 /* don't use ScrollInfo.nPage because we should only scroll
1638 down by the number of completely visible list entries.
1639 nPage however also includes the partly cropped list
1640 item at the bottom of the control */
1641
1643 &rcClient);
1644
1645 ScrollLines = max(1,
1646 (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight);
1647
1648 if (ScrollInfo.nPos + ScrollLines <= ScrollInfo.nMax)
1649 {
1650 ScrollInfo.nPos += ScrollLines;
1651 }
1652 else
1653 {
1654 ScrollInfo.nPos = ScrollInfo.nMax;
1655 }
1656 break;
1657 }
1658
1659 case SB_PAGEUP:
1660 {
1661 RECT rcClient;
1662 INT ScrollLines;
1663
1664 /* don't use ScrollInfo.nPage because we should only scroll
1665 down by the number of completely visible list entries.
1666 nPage however also includes the partly cropped list
1667 item at the bottom of the control */
1668
1670 &rcClient);
1671
1672 ScrollLines = max(1,
1673 (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight);
1674
1675 if (ScrollInfo.nPos >= ScrollLines)
1676 {
1677 ScrollInfo.nPos -= ScrollLines;
1678 }
1679 else
1680 {
1681 ScrollInfo.nPos = 0;
1682 }
1683 break;
1684 }
1685
1686 case SB_THUMBPOSITION:
1687 case SB_THUMBTRACK:
1688 {
1689 ScrollInfo.nPos = HIWORD(wParam);
1690 break;
1691 }
1692
1693 case SB_TOP:
1694 ScrollInfo.nPos = 0;
1695 break;
1696 }
1697
1698 if (OldPos != ScrollInfo.nPos)
1699 {
1700 ScrollInfo.fMask = SIF_POS;
1701
1702 ScrollInfo.nPos = SetScrollInfo(hwnd,
1703 SB_VERT,
1704 &ScrollInfo,
1705 TRUE);
1706
1707 if (OldPos != ScrollInfo.nPos)
1708 {
1710 0,
1711 (OldPos - ScrollInfo.nPos) * infoPtr->ItemHeight,
1712 NULL,
1713 NULL,
1714 NULL,
1715 NULL,
1717
1719 NULL,
1720 NULL,
1722 }
1723 }
1724 }
1725 break;
1726 }
1727
1728 case CLM_ADDITEM:
1729 {
1730 INT Index = -1;
1731 PCHECKITEM Item = AddCheckItem(infoPtr,
1732 (LPWSTR)lParam,
1733 CIS_NONE,
1735 &Index);
1736 if (Item != NULL)
1737 {
1738 UpdateControl(infoPtr);
1739 Ret = (LRESULT)Index;
1740 }
1741 else
1742 {
1743 Ret = (LRESULT)-1;
1744 }
1745 break;
1746 }
1747
1748 case CLM_DELITEM:
1749 {
1751 wParam);
1752 if (Item != NULL)
1753 {
1754 Ret = DeleteCheckItem(infoPtr,
1755 Item);
1756 if (Ret)
1757 {
1758 UpdateControl(infoPtr);
1759 }
1760 }
1761 else
1762 {
1763 Ret = FALSE;
1764 }
1765 break;
1766 }
1767
1768 case CLM_SETITEMSTATE:
1769 {
1771 wParam);
1772 if (Item != NULL)
1773 {
1774 DWORD OldState = Item->State;
1775 Item->State = (DWORD)lParam & CIS_MASK;
1776
1777 if (Item->State != OldState)
1778 {
1779 /* revert the focus if the currently focused item is about
1780 to be disabled */
1781 if (Item == infoPtr->FocusedCheckItem &&
1782 (Item->State & CIS_DISABLED))
1783 {
1784 if (infoPtr->FocusedCheckItemBox == CLB_DENY)
1785 {
1786 if (Item->State & CIS_DENYDISABLED)
1787 {
1788 infoPtr->FocusedCheckItem = NULL;
1789 }
1790 }
1791 else
1792 {
1793 if (Item->State & CIS_ALLOWDISABLED)
1794 {
1795 infoPtr->FocusedCheckItem = NULL;
1796 }
1797 }
1798 }
1799
1800 UpdateControl(infoPtr);
1801 }
1802 Ret = TRUE;
1803 }
1804 break;
1805 }
1806
1807 case CLM_GETITEMCOUNT:
1808 {
1809 Ret = infoPtr->CheckItemCount;
1810 break;
1811 }
1812
1813 case CLM_CLEAR:
1814 {
1815 ClearCheckItems(infoPtr);
1816 UpdateControl(infoPtr);
1817 break;
1818 }
1819
1821 {
1822 infoPtr->CheckBoxLeft[wParam != CLB_DENY] = (INT)lParam;
1823 UpdateControl(infoPtr);
1824 Ret = 1;
1825 break;
1826 }
1827
1829 {
1830 Ret = (LRESULT)infoPtr->CheckBoxLeft[wParam != CLB_DENY];
1831 break;
1832 }
1833
1835 {
1836 Ret = (LRESULT)ClearCheckBoxes(infoPtr);
1837 if (Ret)
1838 {
1839 UpdateControl(infoPtr);
1840 }
1841 break;
1842 }
1843
1845 {
1846 if (wParam == 0)
1847 {
1848 EscapeQuickSearch(infoPtr);
1849 }
1850 infoPtr->QuickSearchEnabled = (wParam != 0);
1851 break;
1852 }
1853
1855 {
1856 infoPtr->QuickSearchResetDelay = (UINT)wParam;
1857 break;
1858 }
1859
1861 {
1863 break;
1864 }
1865
1867 {
1870 break;
1871 }
1872
1873 case WM_SETFONT:
1874 {
1875 Ret = (LRESULT)RetChangeControlFont(infoPtr,
1876 (HFONT)wParam,
1877 (BOOL)LOWORD(lParam));
1878 break;
1879 }
1880
1881 case WM_GETFONT:
1882 {
1883 Ret = (LRESULT)infoPtr->hFont;
1884 break;
1885 }
1886
1887 case WM_STYLECHANGED:
1888 {
1889 if (wParam == (WPARAM)GWL_STYLE)
1890 {
1891 UpdateControl(infoPtr);
1892 }
1893 break;
1894 }
1895
1896 case WM_ENABLE:
1897 {
1898 EscapeQuickSearch(infoPtr);
1899
1900 UpdateControl(infoPtr);
1901 break;
1902 }
1903
1904 case WM_MOUSEWHEEL:
1905 {
1906 SHORT ScrollDelta;
1907 UINT ScrollLines = 3;
1908
1909 SystemParametersInfo(SPI_GETWHEELSCROLLLINES,
1910 0,
1911 &ScrollLines,
1912 0);
1913 ScrollDelta = 0 - (SHORT)HIWORD(wParam);
1914
1915 if (ScrollLines != 0 &&
1916 abs(ScrollDelta) >= WHEEL_DELTA)
1917 {
1918 SCROLLINFO ScrollInfo;
1919
1920 ScrollInfo.cbSize = sizeof(ScrollInfo);
1921 ScrollInfo.fMask = SIF_RANGE | SIF_POS;
1922
1923 if (GetScrollInfo(hwnd,
1924 SB_VERT,
1925 &ScrollInfo))
1926 {
1927 INT OldPos = ScrollInfo.nPos;
1928
1929 ScrollInfo.nPos += (ScrollDelta / WHEEL_DELTA) * ScrollLines;
1930 if (ScrollInfo.nPos < 0)
1931 ScrollInfo.nPos = 0;
1932 else if (ScrollInfo.nPos > ScrollInfo.nMax)
1933 ScrollInfo.nPos = ScrollInfo.nMax;
1934
1935 if (OldPos != ScrollInfo.nPos)
1936 {
1937 ScrollInfo.fMask = SIF_POS;
1938
1939 ScrollInfo.nPos = SetScrollInfo(hwnd,
1940 SB_VERT,
1941 &ScrollInfo,
1942 TRUE);
1943
1944 if (OldPos != ScrollInfo.nPos)
1945 {
1947 0,
1948 (OldPos - ScrollInfo.nPos) * infoPtr->ItemHeight,
1949 NULL,
1950 NULL,
1951 NULL,
1952 NULL,
1954
1956 NULL,
1957 NULL,
1959 }
1960 }
1961 }
1962 }
1963 break;
1964 }
1965
1966 case WM_SETFOCUS:
1967 {
1968 infoPtr->HasFocus = TRUE;
1969
1970 if (infoPtr->FocusedCheckItem == NULL)
1971 {
1972 BOOL Shift = GetKeyState(VK_SHIFT) & 0x8000;
1973 infoPtr->FocusedCheckItem = FindEnabledCheckBox(infoPtr,
1974 Shift,
1975 &infoPtr->FocusedCheckItemBox);
1976 }
1977 if (infoPtr->FocusedCheckItem != NULL)
1978 {
1979 MakeCheckItemVisible(infoPtr,
1980 infoPtr->FocusedCheckItem);
1981
1982 UpdateCheckItem(infoPtr,
1983 infoPtr->FocusedCheckItem);
1984 }
1985 break;
1986 }
1987
1988 case WM_KILLFOCUS:
1989 {
1990 EscapeQuickSearch(infoPtr);
1991
1992 infoPtr->HasFocus = FALSE;
1993 if (infoPtr->FocusedCheckItem != NULL)
1994 {
1995 infoPtr->FocusedPushed = FALSE;
1996
1997 UpdateCheckItem(infoPtr,
1998 infoPtr->FocusedCheckItem);
1999 }
2000 break;
2001 }
2002
2003 case WM_LBUTTONDBLCLK:
2004 case WM_LBUTTONDOWN:
2005 case WM_MBUTTONDOWN:
2006 case WM_RBUTTONDOWN:
2007 {
2008 if (IsWindowEnabled(hwnd))
2009 {
2010 PCHECKITEM NewFocus;
2011 UINT NewFocusBox = 0;
2012 BOOL InCheckBox;
2013 POINT pt;
2014 BOOL ChangeFocus, Capture = FALSE;
2015
2016 pt.x = (LONG)LOWORD(lParam);
2017 pt.y = (LONG)HIWORD(lParam);
2018
2019 NewFocus = PtToCheckItemBox(infoPtr,
2020 &pt,
2021 &NewFocusBox,
2022 &InCheckBox);
2023 if (NewFocus != NULL)
2024 {
2025 if (NewFocus->State & ((NewFocusBox != CLB_DENY) ? CIS_ALLOWDISABLED : CIS_DENYDISABLED))
2026 {
2027 /* the user clicked on a disabled checkbox, try to set
2028 the focus to the other one or not change it at all */
2029
2030 InCheckBox = FALSE;
2031
2032 ChangeFocus = ((NewFocus->State & CIS_DISABLED) != CIS_DISABLED);
2033 if (ChangeFocus)
2034 {
2035 NewFocusBox = ((NewFocusBox != CLB_DENY) ? CLB_DENY : CLB_ALLOW);
2036 }
2037 }
2038 else
2039 {
2040 ChangeFocus = TRUE;
2041 }
2042
2043 if (InCheckBox && ChangeFocus && GetCapture() == NULL &&
2044 (uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONDBLCLK))
2045 {
2046 infoPtr->FocusedPushed = TRUE;
2047 Capture = TRUE;
2048 }
2049 }
2050 else
2051 {
2052 ChangeFocus = TRUE;
2053 }
2054
2055 if (ChangeFocus)
2056 {
2057 if (infoPtr->QuickSearchEnabled && infoPtr->QuickSearchHitItem != NULL &&
2058 infoPtr->QuickSearchHitItem != NewFocus)
2059 {
2060 EscapeQuickSearch(infoPtr);
2061 }
2062
2063 ChangeCheckItemFocus(infoPtr,
2064 NewFocus,
2065 NewFocusBox);
2066 }
2067
2068 if (!infoPtr->HasFocus)
2069 {
2070 SetFocus(hwnd);
2071 }
2072
2073 if (Capture)
2074 {
2076 }
2077 }
2078 break;
2079 }
2080
2081 case WM_LBUTTONUP:
2082 {
2083 if (GetCapture() == hwnd)
2084 {
2085 if (infoPtr->FocusedCheckItem != NULL && infoPtr->FocusedPushed)
2086 {
2087 PCHECKITEM PtItem;
2088 UINT PtItemBox;
2089 BOOL InCheckBox;
2090 POINT pt;
2091
2092 pt.x = (LONG)LOWORD(lParam);
2093 pt.y = (LONG)HIWORD(lParam);
2094
2095 infoPtr->FocusedPushed = FALSE;
2096
2097 PtItem = PtToCheckItemBox(infoPtr,
2098 &pt,
2099 &PtItemBox,
2100 &InCheckBox);
2101
2102 if (PtItem == infoPtr->FocusedCheckItem && InCheckBox &&
2103 PtItemBox == infoPtr->FocusedCheckItemBox)
2104 {
2105 UINT OtherBox = ((PtItemBox == CLB_ALLOW) ? CLB_DENY : CLB_ALLOW);
2106 DWORD OtherStateMask = ((OtherBox == CLB_ALLOW) ?
2109 DWORD OtherStateOld = PtItem->State & OtherStateMask;
2110 if (ChangeCheckBox(infoPtr,
2111 PtItem,
2112 PtItemBox) &&
2113 ((PtItem->State & OtherStateMask) != OtherStateOld))
2114 {
2115 UpdateCheckItemBox(infoPtr,
2116 infoPtr->FocusedCheckItem,
2117 OtherBox);
2118 }
2119 }
2120
2121 UpdateCheckItemBox(infoPtr,
2122 infoPtr->FocusedCheckItem,
2123 infoPtr->FocusedCheckItemBox);
2124 }
2125
2127 }
2128 break;
2129 }
2130
2131 case WM_KEYDOWN:
2132 {
2133 switch (wParam)
2134 {
2135 case VK_SPACE:
2136 {
2137 if (GetCapture() == NULL &&
2138 !QuickSearchFindHit(infoPtr,
2139 L' '))
2140 {
2141 if (infoPtr->FocusedCheckItem != NULL &&
2142 (infoPtr->QuickSearchHitItem == NULL ||
2143 infoPtr->QuickSearchHitItem == infoPtr->FocusedCheckItem))
2144 {
2145 UINT OldPushed = infoPtr->FocusedPushed;
2146 infoPtr->FocusedPushed = TRUE;
2147
2148 if (infoPtr->FocusedPushed != OldPushed)
2149 {
2150 MakeCheckItemVisible(infoPtr,
2151 infoPtr->FocusedCheckItem);
2152
2153 UpdateCheckItemBox(infoPtr,
2154 infoPtr->FocusedCheckItem,
2155 infoPtr->FocusedCheckItemBox);
2156 }
2157 }
2158 }
2159 break;
2160 }
2161
2162 case VK_RETURN:
2163 {
2164 if (GetCapture() == NULL &&
2165 !QuickSearchFindHit(infoPtr,
2166 L'\n'))
2167 {
2168 if (infoPtr->FocusedCheckItem != NULL &&
2169 infoPtr->QuickSearchHitItem == NULL)
2170 {
2171 UINT OtherBox;
2172 DWORD OtherStateMask;
2173 DWORD OtherStateOld;
2174
2175 MakeCheckItemVisible(infoPtr,
2176 infoPtr->FocusedCheckItem);
2177
2178 OtherBox = ((infoPtr->FocusedCheckItemBox == CLB_ALLOW) ? CLB_DENY : CLB_ALLOW);
2179 OtherStateMask = ((OtherBox == CLB_ALLOW) ?
2182 OtherStateOld = infoPtr->FocusedCheckItem->State & OtherStateMask;
2183 if (ChangeCheckBox(infoPtr,
2184 infoPtr->FocusedCheckItem,
2185 infoPtr->FocusedCheckItemBox))
2186 {
2187 UpdateCheckItemBox(infoPtr,
2188 infoPtr->FocusedCheckItem,
2189 infoPtr->FocusedCheckItemBox);
2190 if ((infoPtr->FocusedCheckItem->State & OtherStateMask) != OtherStateOld)
2191 {
2192 UpdateCheckItemBox(infoPtr,
2193 infoPtr->FocusedCheckItem,
2194 OtherBox);
2195 }
2196 }
2197 }
2198 }
2199 break;
2200 }
2201
2202 case VK_TAB:
2203 {
2204 if (GetCapture() == NULL)
2205 {
2206 PCHECKITEM NewFocus;
2207 UINT NewFocusBox = 0;
2208 BOOL Shift = GetKeyState(VK_SHIFT) & 0x8000;
2209
2210 EscapeQuickSearch(infoPtr);
2211
2212 NewFocus = FindEnabledCheckBox(infoPtr,
2213 Shift,
2214 &NewFocusBox);
2215
2216 /* update the UI status */
2218 GA_PARENT),
2219 WM_CHANGEUISTATE,
2220 MAKEWPARAM(UIS_INITIALIZE,
2221 0),
2222 0);
2223
2224 ChangeCheckItemFocus(infoPtr,
2225 NewFocus,
2226 NewFocusBox);
2227 }
2228 break;
2229 }
2230
2231 default:
2232 {
2233 goto HandleDefaultMessage;
2234 }
2235 }
2236 break;
2237 }
2238
2239 case WM_KEYUP:
2240 {
2241 if (wParam == VK_SPACE && IsWindowEnabled(hwnd) &&
2242 infoPtr->FocusedCheckItem != NULL &&
2243 infoPtr->FocusedPushed)
2244 {
2245 UINT OtherBox = ((infoPtr->FocusedCheckItemBox == CLB_ALLOW) ? CLB_DENY : CLB_ALLOW);
2246 DWORD OtherStateMask = ((OtherBox == CLB_ALLOW) ?
2249 DWORD OtherStateOld = infoPtr->FocusedCheckItem->State & OtherStateMask;
2250
2251 infoPtr->FocusedPushed = FALSE;
2252
2253 if (ChangeCheckBox(infoPtr,
2254 infoPtr->FocusedCheckItem,
2255 infoPtr->FocusedCheckItemBox))
2256 {
2257 UpdateCheckItemBox(infoPtr,
2258 infoPtr->FocusedCheckItem,
2259 infoPtr->FocusedCheckItemBox);
2260
2261 if ((infoPtr->FocusedCheckItem->State & OtherStateMask) != OtherStateOld)
2262 {
2263 UpdateCheckItemBox(infoPtr,
2264 infoPtr->FocusedCheckItem,
2265 OtherBox);
2266 }
2267 }
2268 }
2269 break;
2270 }
2271
2272 case WM_GETDLGCODE:
2273 {
2274 INT virtKey;
2275
2276 Ret = 0;
2277 virtKey = (lParam != 0 ? (INT)((LPMSG)lParam)->wParam : 0);
2278 switch (virtKey)
2279 {
2280 case VK_RETURN:
2281 {
2282 if (infoPtr->QuickSearchEnabled && infoPtr->QuickSearchHitItem != NULL)
2283 {
2285 }
2286 else
2287 {
2288 Ret |= DLGC_WANTMESSAGE;
2289 }
2290 break;
2291 }
2292
2293 case VK_TAB:
2294 {
2295 UINT CheckBox;
2296 BOOL EnabledBox;
2297 BOOL Shift = GetKeyState(VK_SHIFT) & 0x8000;
2298
2299 EnabledBox = FindEnabledCheckBox(infoPtr,
2300 Shift,
2301 &CheckBox) != NULL;
2302 Ret |= (EnabledBox ? DLGC_WANTTAB : DLGC_WANTCHARS);
2303 break;
2304 }
2305
2306 default:
2307 {
2308 if (infoPtr->QuickSearchEnabled)
2309 {
2310 Ret |= DLGC_WANTCHARS;
2311 }
2312 break;
2313 }
2314 }
2315 break;
2316 }
2317
2318 case WM_CHAR:
2319 {
2320 QuickSearchFindHit(infoPtr,
2321 (WCHAR)wParam);
2322 break;
2323 }
2324
2325 case WM_SYSCOLORCHANGE:
2326 {
2327 infoPtr->TextColor[0] = GetSysColor(COLOR_GRAYTEXT);
2328 infoPtr->TextColor[1] = GetSysColor(COLOR_WINDOWTEXT);
2329 break;
2330 }
2331
2332#if SUPPORT_UXTHEME
2333 case WM_MOUSELEAVE:
2334 {
2335 if (infoPtr->HoveredCheckItem != NULL)
2336 {
2337 /* reset and repaint the hovered check item box */
2338 ChangeCheckItemHotTrack(infoPtr,
2339 NULL,
2340 0);
2341 }
2342 break;
2343 }
2344
2345 case WM_THEMECHANGED:
2346 {
2347 if (infoPtr->ThemeHandle != NULL)
2348 {
2349 CloseThemeData(infoPtr->ThemeHandle);
2350 infoPtr->ThemeHandle = NULL;
2351 }
2352 if (IsAppThemed())
2353 {
2354 infoPtr->ThemeHandle = OpenThemeData(infoPtr->hSelf,
2355 L"BUTTON");
2356 }
2357 break;
2358 }
2359#endif
2360
2361 case WM_SETTINGCHANGE:
2362 {
2363 DWORD OldCaretWidth = infoPtr->CaretWidth;
2364
2365#if SUPPORT_UXTHEME
2366 /* update the hover time */
2367 if (!SystemParametersInfo(SPI_GETMOUSEHOVERTIME,
2368 0,
2369 &infoPtr->HoverTime,
2370 0))
2371 {
2372 infoPtr->HoverTime = HOVER_DEFAULT;
2373 }
2374#endif
2375
2376 /* update the caret */
2377 if (!SystemParametersInfo(SPI_GETCARETWIDTH,
2378 0,
2379 &infoPtr->CaretWidth,
2380 0))
2381 {
2382 infoPtr->CaretWidth = 2;
2383 }
2384 if (OldCaretWidth != infoPtr->CaretWidth && infoPtr->ShowingCaret)
2385 {
2386 DestroyCaret();
2388 NULL,
2389 infoPtr->CaretWidth,
2390 infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT));
2391 }
2392 break;
2393 }
2394
2395 case WM_SIZE:
2396 {
2397 UpdateControl(infoPtr);
2398 break;
2399 }
2400
2401 case WM_UPDATEUISTATE:
2402 {
2403 DWORD OldUIState = infoPtr->UIState;
2404
2405 switch (LOWORD(wParam))
2406 {
2407 case UIS_SET:
2408 infoPtr->UIState |= HIWORD(wParam);
2409 break;
2410
2411 case UIS_CLEAR:
2412 infoPtr->UIState &= ~(HIWORD(wParam));
2413 break;
2414 }
2415
2416 if (OldUIState != infoPtr->UIState)
2417 {
2418 if (infoPtr->FocusedCheckItem != NULL)
2419 {
2420 UpdateCheckItemBox(infoPtr,
2421 infoPtr->FocusedCheckItem,
2422 infoPtr->FocusedCheckItemBox);
2423 }
2424 }
2425 break;
2426 }
2427
2428 case WM_TIMER:
2429 {
2430 switch (wParam)
2431 {
2433 {
2434 /* kill the timer */
2436 wParam);
2437
2438 if (infoPtr->QuickSearchEnabled && infoPtr->QuickSearchHitItem != NULL)
2439 {
2440 /* change the focus to the hit item, this item has to have
2441 at least one enabled checkbox! */
2442 ChangeCheckItemFocus(infoPtr,
2443 infoPtr->QuickSearchHitItem,
2445
2446 /* start the timer to reset quicksearch */
2447 if (infoPtr->QuickSearchResetDelay != 0)
2448 {
2449 SetTimer(hwnd,
2451 infoPtr->QuickSearchResetDelay,
2452 NULL);
2453 }
2454 }
2455 break;
2456 }
2458 {
2459 /* kill the timer */
2461 wParam);
2462
2463 /* escape quick search */
2464 EscapeQuickSearch(infoPtr);
2465 break;
2466 }
2467 }
2468 break;
2469 }
2470
2471 case WM_CREATE:
2472 {
2473 infoPtr = HeapAlloc(GetProcessHeap(),
2474 0,
2475 sizeof(CHECKLISTWND));
2476 if (infoPtr != NULL)
2477 {
2478 RECT rcClient;
2479
2480 infoPtr->hSelf = hwnd;
2481 infoPtr->hNotify = ((LPCREATESTRUCTW)lParam)->hwndParent;
2482
2484 0,
2485 (DWORD_PTR)infoPtr);
2486
2487 infoPtr->CheckItemListHead = NULL;
2488 infoPtr->CheckItemCount = 0;
2489
2490 if (!SystemParametersInfo(SPI_GETCARETWIDTH,
2491 0,
2492 &infoPtr->CaretWidth,
2493 0))
2494 {
2495 infoPtr->CaretWidth = 2;
2496 }
2497 infoPtr->ItemHeight = 10;
2498 infoPtr->ShowingCaret = FALSE;
2499
2500 infoPtr->HasFocus = FALSE;
2501 infoPtr->FocusedCheckItem = NULL;
2502 infoPtr->FocusedCheckItemBox = 0;
2503 infoPtr->FocusedPushed = FALSE;
2504
2505 infoPtr->TextColor[0] = GetSysColor(COLOR_GRAYTEXT);
2506 infoPtr->TextColor[1] = GetSysColor(COLOR_WINDOWTEXT);
2507
2509 &rcClient);
2510
2511 infoPtr->CheckBoxLeft[0] = rcClient.right - 30;
2512 infoPtr->CheckBoxLeft[1] = rcClient.right - 15;
2513
2514 infoPtr->QuickSearchEnabled = FALSE;
2515 infoPtr->QuickSearchText[0] = L'\0';
2516
2519
2520#if SUPPORT_UXTHEME
2521 infoPtr->HoveredCheckItem = NULL;
2522 infoPtr->HoveredCheckItemBox = 0;
2523 if (!SystemParametersInfo(SPI_GETMOUSEHOVERTIME,
2524 0,
2525 &infoPtr->HoverTime,
2526 0))
2527 {
2528 infoPtr->HoverTime = HOVER_DEFAULT;
2529 }
2530
2531 if (IsAppThemed())
2532 {
2533 infoPtr->ThemeHandle = OpenThemeData(infoPtr->hSelf,
2534 L"BUTTON");
2535 }
2536 else
2537 {
2538 infoPtr->ThemeHandle = NULL;
2539 }
2540#endif
2541
2542 infoPtr->UIState = SendMessage(hwnd,
2543 WM_QUERYUISTATE,
2544 0,
2545 0);
2546 }
2547 else
2548 {
2549 Ret = -1;
2550 }
2551 break;
2552 }
2553
2554 case WM_DESTROY:
2555 {
2556 if (infoPtr->ShowingCaret)
2557 {
2558 DestroyCaret();
2559 }
2560
2561 ClearCheckItems(infoPtr);
2562
2563#if SUPPORT_UXTHEME
2564 if (infoPtr->ThemeHandle != NULL)
2565 {
2566 CloseThemeData(infoPtr->ThemeHandle);
2567 }
2568#endif
2569
2571 0,
2572 infoPtr);
2574 0,
2575 (DWORD_PTR)NULL);
2576 break;
2577 }
2578
2579 default:
2580 {
2581HandleDefaultMessage:
2582 Ret = DefWindowProc(hwnd,
2583 uMsg,
2584 wParam,
2585 lParam);
2586 break;
2587 }
2588 }
2589
2590 return Ret;
2591}
struct _Capture Capture
Definition: capture.h:24
#define CI_TEXT_MARGIN_HEIGHT
Definition: checklist.c:42
static PCHECKITEM AddCheckItem(IN PCHECKLISTWND infoPtr, IN LPWSTR Name, IN DWORD State, IN ACCESS_MASK AccessMask, OUT INT *Index)
Definition: checklist.c:505
static VOID EscapeQuickSearch(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:1309
static VOID ChangeCheckItemFocus(IN PCHECKLISTWND infoPtr, IN PCHECKITEM NewFocus, IN UINT NewFocusBox)
Definition: checklist.c:1069
static UINT ClearCheckBoxes(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:546
static BOOL QuickSearchFindHit(IN PCHECKLISTWND infoPtr, IN WCHAR c)
Definition: checklist.c:1380
static BOOL ChangeCheckBox(IN PCHECKLISTWND infoPtr, IN PCHECKITEM CheckItem, IN UINT CheckItemBox)
Definition: checklist.c:1174
static BOOL DeleteCheckItem(IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
Definition: checklist.c:457
struct _CHECKLISTWND * PCHECKLISTWND
#define DEFAULT_QUICKSEARCH_SETFOCUS_DELAY
Definition: checklist.c:48
static HFONT RetChangeControlFont(IN PCHECKLISTWND infoPtr, IN HFONT hFont, IN BOOL Redraw)
Definition: checklist.c:737
#define DEFAULT_QUICKSEARCH_RESET_DELAY
Definition: checklist.c:49
static PCHECKITEM PtToCheckItemBox(IN PCHECKLISTWND infoPtr, IN PPOINT ppt, OUT UINT *CheckBox, OUT BOOL *DirectlyInCheckBox)
Definition: checklist.c:387
static INT FindCheckItemIndexByAccessMask(IN PCHECKLISTWND infoPtr, IN ACCESS_MASK AccessMask)
Definition: checklist.c:162
static VOID UpdateCheckItemBox(IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item, IN UINT ItemBox)
Definition: checklist.c:1100
static VOID UpdateControl(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:566
static PCHECKITEM FindEnabledCheckBox(IN PCHECKLISTWND infoPtr, IN BOOL ReverseSearch, OUT UINT *CheckBox)
Definition: checklist.c:366
static PCHECKITEM FindCheckItemByIndex(IN PCHECKLISTWND infoPtr, IN INT Index)
Definition: checklist.c:137
static VOID PaintControl(IN PCHECKLISTWND infoPtr, IN HDC hDC, IN PRECT rcUpdate)
Definition: checklist.c:790
static VOID ClearCheckItems(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:438
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CIS_DISABLED
Definition: precomp.h:120
#define CLM_CLEARCHECKBOXES
Definition: precomp.h:133
#define CIS_NONE
Definition: precomp.h:119
#define CLM_ENABLEQUICKSEARCH
Definition: precomp.h:135
#define CIS_ALLOWDISABLED
Definition: precomp.h:115
#define CLM_SETCHECKBOXCOLUMN
Definition: precomp.h:131
#define CLM_SETQUICKSEARCH_TIMEOUT_SETFOCUS
Definition: precomp.h:137
#define CLM_ADDITEM
Definition: precomp.h:127
#define CLB_ALLOW
Definition: precomp.h:122
#define CLM_DELITEM
Definition: precomp.h:128
#define CLM_GETITEMCOUNT
Definition: precomp.h:129
#define CLM_SETITEMSTATE
Definition: precomp.h:134
#define CLM_CLEAR
Definition: precomp.h:130
#define CLM_GETCHECKBOXCOLUMN
Definition: precomp.h:132
#define CLM_SETQUICKSEARCH_TIMEOUT_RESET
Definition: precomp.h:136
#define CLM_FINDITEMBYACCESSMASK
Definition: precomp.h:138
#define CIS_DENYDISABLED
Definition: precomp.h:113
#define HeapFree(x, y, z)
Definition: compat.h:735
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
#define pt(x, y)
Definition: drawing.c:79
#define abs(i)
Definition: fconv.c:206
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
#define INT
Definition: polytest.cpp:20
#define TME_LEAVE
Definition: commctrl.h:4981
#define HOVER_DEFAULT
Definition: commctrl.h:4986
#define WM_MOUSELEAVE
Definition: commctrl.h:4975
#define DefWindowProc
Definition: ros2win.h:31
DWORD State
Definition: checklist.c:55
INT CheckBoxLeft[2]
Definition: checklist.c:74
PCHECKITEM FocusedCheckItem
Definition: checklist.c:70
DWORD CaretWidth
Definition: checklist.c:81
UINT ShowingCaret
Definition: checklist.c:96
UINT FocusedPushed
Definition: checklist.c:94
COLORREF TextColor[2]
Definition: checklist.c:73
UINT QuickSearchResetDelay
Definition: checklist.c:79
UINT HasFocus
Definition: checklist.c:93
INT ItemHeight
Definition: checklist.c:68
PCHECKITEM QuickSearchHitItem
Definition: checklist.c:76
WCHAR QuickSearchText[65]
Definition: checklist.c:77
HWND hNotify
Definition: checklist.c:62
PCHECKITEM CheckItemListHead
Definition: checklist.c:65
UINT FocusedCheckItemBox
Definition: checklist.c:71
DWORD UIState
Definition: checklist.c:83
UINT QuickSearchSetFocusDelay
Definition: checklist.c:78
UINT CheckItemCount
Definition: checklist.c:66
UINT QuickSearchEnabled
Definition: checklist.c:95
HFONT hFont
Definition: checklist.c:63
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
#define max(a, b)
Definition: svc.c:63
#define WHEEL_DELTA
Definition: treelist.c:99
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define WM_MOUSEWHEEL
Definition: treelist.c:96
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_PAINT
Definition: winuser.h:1620
HWND WINAPI SetCapture(_In_ HWND hWnd)
DWORD WINAPI GetSysColor(_In_ int)
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define SB_THUMBTRACK
Definition: winuser.h:573
#define VK_TAB
Definition: winuser.h:2199
#define WM_ENABLE
Definition: winuser.h:1615
#define SB_LINEUP
Definition: winuser.h:564
#define WM_KEYUP
Definition: winuser.h:1716
#define COLOR_GRAYTEXT
Definition: winuser.h:932
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define COLOR_WINDOWTEXT
Definition: winuser.h:921
#define WM_VSCROLL
Definition: winuser.h:1744
#define SW_SCROLLCHILDREN
Definition: winuser.h:2578
#define SIF_RANGE
Definition: winuser.h:1235
#define WM_CREATE
Definition: winuser.h:1608
#define DLGC_WANTCHARS
Definition: winuser.h:2618
#define DLGC_WANTTAB
Definition: winuser.h:2611
#define VK_SPACE
Definition: winuser.h:2219
#define WM_SIZE
Definition: winuser.h:1611
#define SB_VERT
Definition: winuser.h:553
#define SB_BOTTOM
Definition: winuser.h:577
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
#define SW_INVALIDATE
Definition: winuser.h:2579
#define WM_SETFOCUS
Definition: winuser.h:1613
#define GA_PARENT
Definition: winuser.h:2788
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define RDW_UPDATENOW
Definition: winuser.h:1220
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define RDW_ERASE
Definition: winuser.h:1211
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
#define RDW_NOCHILDREN
Definition: winuser.h:1222
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define WM_GETFONT
Definition: winuser.h:1651
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
#define WM_SETTINGCHANGE
Definition: winuser.h:1629
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define VK_RETURN
Definition: winuser.h:2201
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_SETFONT
Definition: winuser.h:1650
#define WM_TIMER
Definition: winuser.h:1742
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SendMessage
Definition: winuser.h:5843
#define SB_LINEDOWN
Definition: winuser.h:565
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WM_CHAR
Definition: winuser.h:1717
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define SB_TOP
Definition: winuser.h:578
#define SIF_POS
Definition: winuser.h:1234
#define VK_SHIFT
Definition: winuser.h:2202
#define DLGC_WANTMESSAGE
Definition: winuser.h:2613
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
#define WM_DESTROY
Definition: winuser.h:1609
#define WM_KEYDOWN
Definition: winuser.h:1715
BOOL WINAPI CreateCaret(_In_ HWND, _In_opt_ HBITMAP, _In_ int, _In_ int)
BOOL WINAPI DestroyCaret(void)
Definition: caret.c:35
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SystemParametersInfo
Definition: winuser.h:5858
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define WM_KILLFOCUS
Definition: winuser.h:1614
struct tagCREATESTRUCTW * LPCREATESTRUCTW
#define SB_PAGEUP
Definition: winuser.h:568
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
#define WM_GETDLGCODE
Definition: winuser.h:1689
#define WM_MBUTTONDOWN
Definition: winuser.h:1782
SHORT WINAPI GetKeyState(_In_ int)
#define SB_THUMBPOSITION
Definition: winuser.h:572
_In_ ULONG Shift
Definition: rtlfuncs.h:2681
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RegisterCheckListControl().

◆ ClearCheckBoxes()

static UINT ClearCheckBoxes ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 546 of file checklist.c.

547{
548 PCHECKITEM CurItem;
549 UINT nUpdated = 0;
550
551 for (CurItem = infoPtr->CheckItemListHead;
552 CurItem != NULL;
553 CurItem = CurItem->Next)
554 {
555 if (CurItem->State & (CIS_ALLOW | CIS_DENY))
556 {
557 CurItem->State &= ~(CIS_ALLOW | CIS_DENY);
558 nUpdated++;
559 }
560 }
561
562 return nUpdated;
563}

Referenced by CheckListWndProc().

◆ ClearCheckItems()

static VOID ClearCheckItems ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 438 of file checklist.c.

439{
440 PCHECKITEM CurItem, NextItem;
441
442 CurItem = infoPtr->CheckItemListHead;
443 while (CurItem != NULL)
444 {
445 NextItem = CurItem->Next;
447 0,
448 CurItem);
449 CurItem = NextItem;
450 }
451
452 infoPtr->CheckItemListHead = NULL;
453 infoPtr->CheckItemCount = 0;
454}
static LPDATABLOCK_HEADER NextItem(LPDBLIST lpList)
Definition: clist.c:42

Referenced by CheckListWndProc().

◆ DeleteCheckItem()

static BOOL DeleteCheckItem ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  Item 
)
static

Definition at line 457 of file checklist.c.

459{
460 PCHECKITEM CurItem;
461 PCHECKITEM *PrevPtr = &infoPtr->CheckItemListHead;
462
463 for (CurItem = infoPtr->CheckItemListHead;
464 CurItem != NULL;
465 CurItem = CurItem->Next)
466 {
467 if (CurItem == Item)
468 {
469 if (Item == infoPtr->QuickSearchHitItem && infoPtr->QuickSearchEnabled)
470 {
471 EscapeQuickSearch(infoPtr);
472 }
473
474#if SUPPORT_UXTHEME
475 if (Item == infoPtr->HoveredCheckItem)
476 {
477 ChangeCheckItemHotTrack(infoPtr,
478 NULL,
479 0);
480 }
481#endif
482
483 if (Item == infoPtr->FocusedCheckItem)
484 {
485 ChangeCheckItemFocus(infoPtr,
486 NULL,
487 0);
488 }
489
490 *PrevPtr = CurItem->Next;
492 0,
493 CurItem);
494 infoPtr->CheckItemCount--;
495 return TRUE;
496 }
497
498 PrevPtr = &CurItem->Next;
499 }
500
501 return FALSE;
502}

Referenced by CheckListWndProc().

◆ DisplayCaret()

static VOID DisplayCaret ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 1199 of file checklist.c.

1200{
1201 if (IsWindowEnabled(infoPtr->hSelf) && !infoPtr->ShowingCaret)
1202 {
1203 infoPtr->ShowingCaret = TRUE;
1204
1205 CreateCaret(infoPtr->hSelf,
1206 NULL,
1207 infoPtr->CaretWidth,
1208 infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT));
1209
1210 ShowCaret(infoPtr->hSelf);
1211 }
1212}
BOOL WINAPI ShowCaret(_In_opt_ HWND)

Referenced by ChangeSearchHit().

◆ EscapeQuickSearch()

static VOID EscapeQuickSearch ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 1309 of file checklist.c.

1310{
1311 if (infoPtr->QuickSearchEnabled && infoPtr->QuickSearchHitItem != NULL)
1312 {
1313 PCHECKITEM OldHit = infoPtr->QuickSearchHitItem;
1314
1315 infoPtr->QuickSearchHitItem = NULL;
1316 infoPtr->QuickSearchText[0] = L'\0';
1317
1318 /* scroll back to the focused item */
1319 if (infoPtr->FocusedCheckItem != NULL)
1320 {
1321 MakeCheckItemVisible(infoPtr,
1322 infoPtr->FocusedCheckItem);
1323 }
1324
1325 /* repaint the old search hit item if it's still visible */
1326 UpdateCheckItem(infoPtr,
1327 OldHit);
1328
1329 KillQuickSearchTimers(infoPtr);
1330
1331 RemoveCaret(infoPtr);
1332 }
1333}
static VOID RemoveCaret(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:1215
static VOID KillQuickSearchTimers(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:1227

Referenced by CheckListWndProc(), DeleteCheckItem(), and QuickSearchFindHit().

◆ FindCheckItem()

static PCHECKITEM FindCheckItem ( IN PCHECKLISTWND  infoPtr,
IN LPWSTR  SearchText 
)
static

Definition at line 205 of file checklist.c.

207{
208 PCHECKITEM CurItem;
209 SIZE_T Count = wcslen(SearchText);
210
211 for (CurItem = infoPtr->CheckItemListHead;
212 CurItem != NULL;
213 CurItem = CurItem->Next)
214 {
215 if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED &&
216 !_wcsnicmp(CurItem->Name,
217 SearchText, Count))
218 {
219 break;
220 }
221 }
222
223 return CurItem;
224}
int Count
Definition: noreturn.cpp:7
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
WCHAR Name[1]
Definition: checklist.c:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by QuickSearchFindHit().

◆ FindCheckItemByIndex()

static PCHECKITEM FindCheckItemByIndex ( IN PCHECKLISTWND  infoPtr,
IN INT  Index 
)
static

Definition at line 137 of file checklist.c.

139{
141
142 if (Index >= 0)
143 {
144 for (Item = infoPtr->CheckItemListHead;
145 Item != NULL;
146 Item = Item->Next)
147 {
148 if (Index == 0)
149 {
150 Found = Item;
151 break;
152 }
153
154 Index--;
155 }
156 }
157
158 return Found;
159}
return Found
Definition: dirsup.c:1270

Referenced by CheckListWndProc(), PaintControl(), and PtToCheckItemBox().

◆ FindCheckItemIndexByAccessMask()

static INT FindCheckItemIndexByAccessMask ( IN PCHECKLISTWND  infoPtr,
IN ACCESS_MASK  AccessMask 
)
static

Definition at line 162 of file checklist.c.

164{
166 INT Index = 0, Found = -1;
167
168 for (Item = infoPtr->CheckItemListHead;
169 Item != NULL;
170 Item = Item->Next)
171 {
172 if (Item->AccessMask == AccessMask)
173 {
174 Found = Index;
175 break;
176 }
177
178 Index++;
179 }
180
181 return Found;
182}

Referenced by CheckListWndProc().

◆ FindEnabledCheckBox()

static PCHECKITEM FindEnabledCheckBox ( IN PCHECKLISTWND  infoPtr,
IN BOOL  ReverseSearch,
OUT UINT CheckBox 
)
static

Definition at line 366 of file checklist.c.

369{
371
372 if (ReverseSearch)
373 {
375 CheckBox);
376 }
377 else
378 {
380 CheckBox);
381 }
382
383 return Item;
384}
static PCHECKITEM FindNextEnabledCheckBox(IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
Definition: checklist.c:323
static PCHECKITEM FindPreviousEnabledCheckBox(IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
Definition: checklist.c:274

Referenced by CheckListWndProc().

◆ FindFirstEnabledCheckBox()

static PCHECKITEM FindFirstEnabledCheckBox ( IN PCHECKLISTWND  infoPtr,
OUT UINT CheckBox 
)
static

Definition at line 227 of file checklist.c.

229{
230 PCHECKITEM CurItem;
231
232 for (CurItem = infoPtr->CheckItemListHead;
233 CurItem != NULL;
234 CurItem = CurItem->Next)
235 {
236 if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED)
237 {
238 /* return the Allow checkbox in case both check boxes are enabled! */
239 *CheckBox = ((!(CurItem->State & CIS_ALLOWDISABLED)) ? CLB_ALLOW : CLB_DENY);
240 break;
241 }
242 }
243
244 return CurItem;
245}

Referenced by FindNextEnabledCheckBox().

◆ FindLastEnabledCheckBox()

static PCHECKITEM FindLastEnabledCheckBox ( IN PCHECKLISTWND  infoPtr,
OUT UINT CheckBox 
)
static

Definition at line 248 of file checklist.c.

250{
251 PCHECKITEM CurItem;
252 PCHECKITEM LastEnabledItem = NULL;
253
254 for (CurItem = infoPtr->CheckItemListHead;
255 CurItem != NULL;
256 CurItem = CurItem->Next)
257 {
258 if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED)
259 {
260 LastEnabledItem = CurItem;
261 }
262 }
263
264 if (LastEnabledItem != NULL)
265 {
266 /* return the Deny checkbox in case both check boxes are enabled! */
267 *CheckBox = ((!(LastEnabledItem->State & CIS_DENYDISABLED)) ? CLB_DENY : CLB_ALLOW);
268 }
269
270 return LastEnabledItem;
271}

Referenced by FindPreviousEnabledCheckBox().

◆ FindNextEnabledCheckBox()

static PCHECKITEM FindNextEnabledCheckBox ( IN PCHECKLISTWND  infoPtr,
OUT UINT CheckBox 
)
static

Definition at line 323 of file checklist.c.

325{
327
328 if (infoPtr->FocusedCheckItem != NULL)
329 {
330 Item = infoPtr->FocusedCheckItem;
331
332 if (infoPtr->FocusedCheckItemBox != CLB_DENY &&
333 !(Item->State & CIS_DENYDISABLED))
334 {
335 /* currently an Allow checkbox is focused. return the Deny checkbox
336 if it's enabled */
337 *CheckBox = CLB_DENY;
338 }
339 else
340 {
341 Item = Item->Next;
342
343 while (Item != NULL)
344 {
345 if ((Item->State & CIS_DISABLED) != CIS_DISABLED)
346 {
347 /* return the Allow checkbox in case both check boxes are enabled! */
348 *CheckBox = ((!(Item->State & CIS_ALLOWDISABLED)) ? CLB_ALLOW : CLB_DENY);
349 break;
350 }
351
352 Item = Item->Next;
353 }
354 }
355 }
356 else
357 {
359 CheckBox);
360 }
361
362 return Item;
363}
static PCHECKITEM FindFirstEnabledCheckBox(IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
Definition: checklist.c:227

Referenced by FindEnabledCheckBox().

◆ FindPreviousEnabledCheckBox()

static PCHECKITEM FindPreviousEnabledCheckBox ( IN PCHECKLISTWND  infoPtr,
OUT UINT CheckBox 
)
static

Definition at line 274 of file checklist.c.

276{
278
279 if (infoPtr->FocusedCheckItem != NULL)
280 {
281 Item = infoPtr->FocusedCheckItem;
282
283 if (infoPtr->FocusedCheckItemBox == CLB_DENY &&
284 !(Item->State & CIS_ALLOWDISABLED))
285 {
286 /* currently an Deny checkbox is focused. return the Allow checkbox
287 if it's enabled */
288 *CheckBox = CLB_ALLOW;
289 }
290 else
291 {
292 PCHECKITEM CurItem;
293
294 Item = NULL;
295
296 for (CurItem = infoPtr->CheckItemListHead;
297 CurItem != infoPtr->FocusedCheckItem;
298 CurItem = CurItem->Next)
299 {
300 if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED)
301 {
302 Item = CurItem;
303 }
304 }
305
306 if (Item != NULL)
307 {
308 /* return the Deny checkbox in case both check boxes are enabled! */
309 *CheckBox = ((!(Item->State & CIS_DENYDISABLED)) ? CLB_DENY : CLB_ALLOW);
310 }
311 }
312 }
313 else
314 {
316 CheckBox);
317 }
318
319 return Item;
320}
static PCHECKITEM FindLastEnabledCheckBox(IN PCHECKLISTWND infoPtr, OUT UINT *CheckBox)
Definition: checklist.c:248

Referenced by FindEnabledCheckBox().

◆ GetIdealItemHeight()

static UINT GetIdealItemHeight ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 705 of file checklist.c.

706{
707 HDC hdc = GetDC(infoPtr->hSelf);
708 if(hdc != NULL)
709 {
710 UINT height;
712 HGDIOBJ hOldFont = SelectObject(hdc,
713 infoPtr->hFont);
714
716 &tm))
717 {
718 height = tm.tmHeight;
719 }
720 else
721 {
722 height = 2;
723 }
724
726 hOldFont);
727
728 ReleaseDC(infoPtr->hSelf,
729 hdc);
730
731 return height;
732 }
733 return 0;
734}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
Definition: time.h:68
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define GetTextMetrics
Definition: wingdi.h:4474
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by RetChangeControlFont().

◆ KillQuickSearchTimers()

static VOID KillQuickSearchTimers ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 1227 of file checklist.c.

1228{
1229 KillTimer(infoPtr->hSelf,
1231 KillTimer(infoPtr->hSelf,
1233}

Referenced by EscapeQuickSearch().

◆ MakeCheckItemVisible()

static VOID MakeCheckItemVisible ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  Item 
)
static

Definition at line 640 of file checklist.c.

642{
643 RECT rcClient;
644 INT VisibleFirst, VisibleItems, NewPos;
645 INT Index = CheckItemToIndex(infoPtr,
646 Item);
647 if (Index != -1)
648 {
649 VisibleFirst = GetScrollPos(infoPtr->hSelf,
650 SB_VERT);
651
652 if (Index <= VisibleFirst)
653 {
654 NewPos = Index;
655 }
656 else
657 {
658 GetClientRect(infoPtr->hSelf,
659 &rcClient);
660
661 VisibleItems = (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight;
662 if (Index - VisibleItems + 1 > VisibleFirst)
663 {
664 NewPos = Index - VisibleItems + 1;
665 }
666 else
667 {
668 NewPos = VisibleFirst;
669 }
670 }
671
672 if (VisibleFirst != NewPos)
673 {
674 SCROLLINFO ScrollInfo;
675
676 ScrollInfo.cbSize = sizeof(ScrollInfo);
677 ScrollInfo.fMask = SIF_POS;
678 ScrollInfo.nPos = NewPos;
679 NewPos = SetScrollInfo(infoPtr->hSelf,
680 SB_VERT,
681 &ScrollInfo,
682 TRUE);
683
684 if (VisibleFirst != NewPos)
685 {
686 ScrollWindowEx(infoPtr->hSelf,
687 0,
688 (NewPos - VisibleFirst) * infoPtr->ItemHeight,
689 NULL,
690 NULL,
691 NULL,
692 NULL,
694
695 RedrawWindow(infoPtr->hSelf,
696 NULL,
697 NULL,
699 }
700 }
701 }
702}
static INT CheckItemToIndex(IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item)
Definition: checklist.c:185
if(dx< 0)
Definition: linetemp.h:194
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
#define RDW_INVALIDATE
Definition: winuser.h:1214

Referenced by ChangeCheckItemFocus(), ChangeSearchHit(), CheckListWndProc(), and EscapeQuickSearch().

◆ MapItemToRect()

static VOID MapItemToRect ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  CheckItem,
OUT RECT prcItem 
)
static

Definition at line 1236 of file checklist.c.

1239{
1240 INT Index = CheckItemToIndex(infoPtr,
1241 CheckItem);
1242 if (Index != -1)
1243 {
1244 RECT rcClient;
1245 INT VisibleFirst;
1246
1247 GetClientRect(infoPtr->hSelf,
1248 &rcClient);
1249
1250 VisibleFirst = GetScrollPos(infoPtr->hSelf,
1251 SB_VERT);
1252
1253 prcItem->left = rcClient.left;
1254 prcItem->right = rcClient.right;
1255 prcItem->top = (Index - VisibleFirst) * infoPtr->ItemHeight;
1256 prcItem->bottom = prcItem->top + infoPtr->ItemHeight;
1257 }
1258 else
1259 {
1260 prcItem->left = 0;
1261 prcItem->top = 0;
1262 prcItem->right = 0;
1263 prcItem->bottom = 0;
1264 }
1265}
LONG left
Definition: windef.h:306

Referenced by UpdateCaretPos().

◆ NotifyControlParent()

static LRESULT NotifyControlParent ( IN PCHECKLISTWND  infoPtr,
IN UINT  code,
IN OUT PVOID  data 
)
static

Definition at line 112 of file checklist.c.

115{
116 LRESULT Ret = 0;
117
118 if (infoPtr->hNotify != NULL)
119 {
120 LPNMHDR pnmh = (LPNMHDR)data;
121
122 pnmh->hwndFrom = infoPtr->hSelf;
123 pnmh->idFrom = GetWindowLongPtr(infoPtr->hSelf,
124 GWLP_ID);
125 pnmh->code = code;
126
127 Ret = SendMessage(infoPtr->hNotify,
128 WM_NOTIFY,
129 (WPARAM)pnmh->idFrom,
130 (LPARAM)pnmh);
131 }
132
133 return Ret;
134}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WM_NOTIFY
Definition: richedit.h:61
Definition: inflate.c:139
UINT_PTR idFrom
Definition: winuser.h:3158
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
LONG_PTR LPARAM
Definition: windef.h:208
struct tagNMHDR * LPNMHDR
#define GWLP_ID
Definition: winuser.h:860

Referenced by ChangeCheckBox().

◆ PaintControl()

static VOID PaintControl ( IN PCHECKLISTWND  infoPtr,
IN HDC  hDC,
IN PRECT  rcUpdate 
)
static

Definition at line 790 of file checklist.c.

793{
794 INT ScrollPos;
795 PCHECKITEM FirstItem, Item;
796 RECT rcClient;
797 UINT VisibleFirstIndex = rcUpdate->top / infoPtr->ItemHeight;
798 UINT LastTouchedIndex = rcUpdate->bottom / infoPtr->ItemHeight;
799
801 rcUpdate,
802 (HBRUSH)(COLOR_WINDOW + 1));
803
804 GetClientRect(infoPtr->hSelf,
805 &rcClient);
806
807 ScrollPos = GetScrollPos(infoPtr->hSelf,
808 SB_VERT);
809
810 FirstItem = FindCheckItemByIndex(infoPtr,
811 ScrollPos + VisibleFirstIndex);
812 if (FirstItem != NULL)
813 {
814 RECT TextRect, ItemRect, CheckBox;
815 HFONT hOldFont;
816 DWORD CurrentIndex;
817 COLORREF OldTextColor;
818 BOOL Enabled, PrevEnabled, IsPushed;
819 POINT hOldBrushOrg;
820#if SUPPORT_UXTHEME
821 HRESULT hDrawResult;
822 BOOL ItemHovered;
823#endif
824
825 Enabled = IsWindowEnabled(infoPtr->hSelf);
826 PrevEnabled = Enabled;
827
828 ItemRect.left = 0;
829 ItemRect.right = rcClient.right;
830 ItemRect.top = VisibleFirstIndex * infoPtr->ItemHeight;
831
832 TextRect.left = ItemRect.left + CI_TEXT_MARGIN_WIDTH;
833 TextRect.right = ItemRect.right - CI_TEXT_MARGIN_WIDTH;
834 TextRect.top = ItemRect.top + CI_TEXT_MARGIN_HEIGHT;
835
837 ItemRect.left,
838 ItemRect.top,
839 &hOldBrushOrg);
840
841 OldTextColor = SetTextColor(hDC,
842 infoPtr->TextColor[Enabled]);
843
844 hOldFont = SelectObject(hDC,
845 infoPtr->hFont);
846
847 for (Item = FirstItem, CurrentIndex = VisibleFirstIndex;
848 Item != NULL && CurrentIndex <= LastTouchedIndex;
849 Item = Item->Next, CurrentIndex++)
850 {
851 TextRect.bottom = TextRect.top + infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT);
852 ItemRect.bottom = ItemRect.top + infoPtr->ItemHeight;
853
855 ItemRect.left,
856 ItemRect.top,
857 NULL);
858
859 if (Enabled && PrevEnabled != ((Item->State & CIS_DISABLED) != CIS_DISABLED))
860 {
861 PrevEnabled = ((Item->State & CIS_DISABLED) != CIS_DISABLED);
862
864 infoPtr->TextColor[PrevEnabled]);
865 }
866
867#if SUPPORT_UXTHEME
868 ItemHovered = (Enabled && infoPtr->HoveredCheckItem == Item);
869#endif
870
871 if (infoPtr->QuickSearchHitItem == Item)
872 {
873 COLORREF OldBkColor, OldFgColor;
874 SIZE TextSize;
875 SIZE_T TextLen, HighlightLen = wcslen(infoPtr->QuickSearchText);
876
877 /* highlight the quicksearch text */
879 Item->Name,
880 HighlightLen,
881 &TextSize))
882 {
883 COLORREF HighlightTextColor, HighlightBackground;
884 RECT rcHighlight = TextRect;
885
886 HighlightTextColor = GetSysColor(COLOR_HIGHLIGHTTEXT);
887 HighlightBackground = GetSysColor(COLOR_HIGHLIGHT);
888
889 rcHighlight.right = rcHighlight.left + TextSize.cx;
890
891 InflateRect(&rcHighlight,
892 0,
894
895 OldBkColor = SetBkColor(hDC,
896 HighlightBackground);
897 OldFgColor = SetTextColor(hDC,
898 HighlightTextColor);
899
900 /* draw the highlighted text */
902 Item->Name,
903 HighlightLen,
904 &rcHighlight,
906
908 OldBkColor);
910 OldFgColor);
911
912 /* draw the remaining part of the text */
913 TextLen = wcslen(Item->Name);
914 if (HighlightLen < TextLen)
915 {
916 rcHighlight.left = rcHighlight.right;
917 rcHighlight.right = TextRect.right;
918
920 Item->Name + HighlightLen,
921 -1,
922 &rcHighlight,
924 }
925 }
926 }
927 else
928 {
929 /* draw the text */
931 Item->Name,
932 -1,
933 &TextRect,
935 }
936
937 CheckBox.top = TextRect.top;
938 CheckBox.bottom = TextRect.bottom;
939
940 /* draw the Allow checkbox */
941 IsPushed = (Enabled && Item == infoPtr->FocusedCheckItem && infoPtr->HasFocus &&
942 !(Item->State & CIS_ALLOWDISABLED) && infoPtr->FocusedCheckItemBox != CLB_DENY &&
943 infoPtr->FocusedPushed);
944
945 CheckBox.left = infoPtr->CheckBoxLeft[CLB_ALLOW] - ((TextRect.bottom - TextRect.top) / 2);
946 CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top);
947#if SUPPORT_UXTHEME
948 if (infoPtr->ThemeHandle != NULL)
949 {
950 INT BtnState = CalculateCheckBoxStyle(Item->State & CIS_ALLOW,
951 Enabled && !(Item->State & CIS_ALLOWDISABLED),
952 (ItemHovered && infoPtr->HoveredCheckItemBox != CLB_DENY),
953 IsPushed);
954
955
956 hDrawResult = DrawThemeBackground(infoPtr->ThemeHandle,
957 hDC,
959 BtnState,
960 &CheckBox,
961 NULL);
962
963 }
964 else
965 {
966 hDrawResult = E_FAIL;
967 }
968
969 /* draw the standard checkbox if no themes are enabled or drawing the
970 themed control failed */
971 if (FAILED(hDrawResult))
972#endif
973 {
975 &CheckBox,
978 ((Item->State & CIS_ALLOWDISABLED) || !Enabled ? DFCS_INACTIVE : 0) |
979 ((Item->State & CIS_ALLOW) ? DFCS_CHECKED : 0) |
980 (IsPushed ? DFCS_PUSHED : 0));
981 }
982 if (Item == infoPtr->FocusedCheckItem && !(infoPtr->UIState & UISF_HIDEFOCUS) &&
983 infoPtr->HasFocus &&
984 infoPtr->FocusedCheckItemBox != CLB_DENY)
985 {
986 RECT rcFocus = CheckBox;
987
988 InflateRect (&rcFocus,
991
993 &rcFocus);
994 }
995
996 /* draw the Deny checkbox */
997 IsPushed = (Enabled && Item == infoPtr->FocusedCheckItem && infoPtr->HasFocus &&
998 !(Item->State & CIS_DENYDISABLED) && infoPtr->FocusedCheckItemBox == CLB_DENY &&
999 infoPtr->FocusedPushed);
1000
1001 CheckBox.left = infoPtr->CheckBoxLeft[CLB_DENY] - ((TextRect.bottom - TextRect.top) / 2);
1002 CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top);
1003#if SUPPORT_UXTHEME
1004 if (infoPtr->ThemeHandle != NULL)
1005 {
1006 INT BtnState = CalculateCheckBoxStyle(Item->State & CIS_DENY,
1007 Enabled && !(Item->State & CIS_DENYDISABLED),
1008 (ItemHovered && infoPtr->HoveredCheckItemBox == CLB_DENY),
1009 IsPushed);
1010
1011 hDrawResult = DrawThemeBackground(infoPtr->ThemeHandle,
1012 hDC,
1014 BtnState,
1015 &CheckBox,
1016 NULL);
1017
1018 }
1019 else
1020 {
1021 hDrawResult = E_FAIL;
1022 }
1023
1024 /* draw the standard checkbox if no themes are enabled or drawing the
1025 themed control failed */
1026 if (FAILED(hDrawResult))
1027#endif
1028 {
1030 &CheckBox,
1031 DFC_BUTTON,
1033 ((Item->State & CIS_DENYDISABLED) || !Enabled ? DFCS_INACTIVE : 0) |
1034 ((Item->State & CIS_DENY) ? DFCS_CHECKED : 0) |
1035 (IsPushed ? DFCS_PUSHED : 0));
1036 }
1037 if (infoPtr->HasFocus && !(infoPtr->UIState & UISF_HIDEFOCUS) &&
1038 Item == infoPtr->FocusedCheckItem &&
1039 infoPtr->FocusedCheckItemBox == CLB_DENY)
1040 {
1041 RECT rcFocus = CheckBox;
1042
1043 InflateRect (&rcFocus,
1046
1048 &rcFocus);
1049 }
1050
1051 TextRect.top += infoPtr->ItemHeight;
1052 ItemRect.top += infoPtr->ItemHeight;
1053 }
1054
1056 hOldFont);
1057
1059 OldTextColor);
1060
1062 hOldBrushOrg.x,
1063 hOldBrushOrg.y,
1064 NULL);
1065 }
1066}
static HDC hDC
Definition: 3dtext.c:33
#define CI_TEXT_MARGIN_WIDTH
Definition: checklist.c:41
#define CI_TEXT_SELECTIONMARGIN
Definition: checklist.c:43
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
#define FAILED(hr)
Definition: intsafe.h:51
@ Enabled
Definition: mountmgr.h:159
LONG cx
Definition: kdterminal.h:27
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define BP_CHECKBOX
Definition: treelist.c:145
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI SetBrushOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define GetTextExtentPoint32
Definition: wingdi.h:4472
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define DT_NOPREFIX
Definition: winuser.h:537
#define COLOR_WINDOW
Definition: winuser.h:918
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
#define DT_SINGLELINE
Definition: winuser.h:540
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define DFCS_INACTIVE
Definition: winuser.h:502
#define DFC_BUTTON
Definition: winuser.h:476
#define DrawText
Definition: winuser.h:5771
#define DT_LEFT
Definition: winuser.h:534
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927
#define DT_VCENTER
Definition: winuser.h:543
#define DFCS_CHECKED
Definition: winuser.h:504
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define DFCS_PUSHED
Definition: winuser.h:503

Referenced by CheckListWndProc().

◆ PtToCheckItemBox()

static PCHECKITEM PtToCheckItemBox ( IN PCHECKLISTWND  infoPtr,
IN PPOINT  ppt,
OUT UINT CheckBox,
OUT BOOL DirectlyInCheckBox 
)
static

Definition at line 387 of file checklist.c.

391{
392 INT FirstVisible, Index;
394
395 FirstVisible = GetScrollPos(infoPtr->hSelf,
396 SB_VERT);
397
398 Index = FirstVisible + (ppt->y / infoPtr->ItemHeight);
399
400 Item = FindCheckItemByIndex(infoPtr,
401 Index);
402 if (Item != NULL)
403 {
404 INT cx;
405
406 cx = infoPtr->CheckBoxLeft[CLB_ALLOW] +
407 ((infoPtr->CheckBoxLeft[CLB_DENY] - infoPtr->CheckBoxLeft[CLB_ALLOW]) / 2);
408
409 *CheckBox = ((ppt->x <= cx) ? CLB_ALLOW : CLB_DENY);
410
411 if (DirectlyInCheckBox != NULL)
412 {
413 INT y = ppt->y % infoPtr->ItemHeight;
414 INT cxBox = infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT);
415
416 if ((y >= CI_TEXT_MARGIN_HEIGHT &&
417 y < infoPtr->ItemHeight - CI_TEXT_MARGIN_HEIGHT) &&
418
419 (((ppt->x >= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (cxBox / 2))) &&
420 (ppt->x < (infoPtr->CheckBoxLeft[CLB_ALLOW] - (cxBox / 2) + cxBox)))
421 ||
422 ((ppt->x >= (infoPtr->CheckBoxLeft[CLB_DENY] - (cxBox / 2))) &&
423 (ppt->x < (infoPtr->CheckBoxLeft[CLB_DENY] - (cxBox / 2) + cxBox)))))
424 {
425 *DirectlyInCheckBox = TRUE;
426 }
427 else
428 {
429 *DirectlyInCheckBox = FALSE;
430 }
431 }
432 }
433
434 return Item;
435}
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:585

Referenced by CheckListWndProc().

◆ QuickSearchFindHit()

static BOOL QuickSearchFindHit ( IN PCHECKLISTWND  infoPtr,
IN WCHAR  c 
)
static

Definition at line 1380 of file checklist.c.

1382{
1383 if (infoPtr->QuickSearchEnabled)
1384 {
1385 BOOL Ret = FALSE;
1386 PCHECKITEM NewHit;
1387
1388 switch (c)
1389 {
1390 case '\r':
1391 case '\n':
1392 {
1393 Ret = infoPtr->QuickSearchHitItem != NULL;
1394 if (Ret)
1395 {
1396 /* NOTE: QuickSearchHitItem definitely has at least one
1397 enabled check box, the user can't search for disabled
1398 check items */
1399
1400 ChangeCheckItemFocus(infoPtr,
1401 infoPtr->QuickSearchHitItem,
1402 ((!(infoPtr->QuickSearchHitItem->State & CIS_ALLOWDISABLED)) ? CLB_ALLOW : CLB_DENY));
1403
1404 EscapeQuickSearch(infoPtr);
1405 }
1406 break;
1407 }
1408
1409 case VK_BACK:
1410 {
1411 if (infoPtr->QuickSearchHitItem != NULL)
1412 {
1413 INT SearchLen = wcslen(infoPtr->QuickSearchText);
1414 if (SearchLen > 0)
1415 {
1416 /* delete the last character */
1417 infoPtr->QuickSearchText[--SearchLen] = L'\0';
1418
1419 if (SearchLen > 0)
1420 {
1421 /* search again */
1422 NewHit = FindCheckItem(infoPtr,
1423 infoPtr->QuickSearchText);
1424
1425 if (NewHit != NULL)
1426 {
1427 /* change the search hit */
1428 ChangeSearchHit(infoPtr,
1429 NewHit);
1430
1431 Ret = TRUE;
1432 }
1433 }
1434 }
1435
1436 if (!Ret)
1437 {
1438 EscapeQuickSearch(infoPtr);
1439 }
1440 }
1441 break;
1442 }
1443
1444 default:
1445 {
1446 INT SearchLen = wcslen(infoPtr->QuickSearchText);
1447 if (SearchLen < (INT)(sizeof(infoPtr->QuickSearchText) / sizeof(infoPtr->QuickSearchText[0])) - 1)
1448 {
1449 infoPtr->QuickSearchText[SearchLen++] = c;
1450 infoPtr->QuickSearchText[SearchLen] = L'\0';
1451
1452 NewHit = FindCheckItem(infoPtr,
1453 infoPtr->QuickSearchText);
1454 if (NewHit != NULL)
1455 {
1456 /* change the search hit */
1457 ChangeSearchHit(infoPtr,
1458 NewHit);
1459
1460 Ret = TRUE;
1461 }
1462 else
1463 {
1464 /* reset the input */
1465 infoPtr->QuickSearchText[--SearchLen] = L'\0';
1466 }
1467 }
1468 break;
1469 }
1470 }
1471 return Ret;
1472 }
1473
1474 return FALSE;
1475}
static VOID ChangeSearchHit(IN PCHECKLISTWND infoPtr, IN PCHECKITEM NewHit)
Definition: checklist.c:1336
static PCHECKITEM FindCheckItem(IN PCHECKLISTWND infoPtr, IN LPWSTR SearchText)
Definition: checklist.c:205
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define VK_BACK
Definition: winuser.h:2198

Referenced by CheckListWndProc().

◆ RegisterCheckListControl()

BOOL RegisterCheckListControl ( IN HINSTANCE  hInstance)

Definition at line 2594 of file checklist.c.

2595{
2596 WNDCLASS wc;
2597
2598 wc.style = CS_DBLCLKS;
2600 wc.cbClsExtra = 0;
2601 wc.cbWndExtra = sizeof(PCHECKLISTWND);
2602 wc.hInstance = hInstance;
2603 wc.hIcon = NULL;
2604 wc.hCursor = LoadCursor(NULL,
2605 (LPWSTR)IDC_ARROW);
2606 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
2607 wc.lpszMenuName = NULL;
2609
2610 return RegisterClass(&wc) != 0;
2611}
HINSTANCE hInstance
Definition: charmap.c:19
static LRESULT CALLBACK CheckListWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: checklist.c:1478
static const WCHAR szCheckListWndClass[]
Definition: checklist.c:39
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
#define LoadCursor
Definition: winuser.h:5812
#define RegisterClass
Definition: winuser.h:5836

Referenced by DllMain().

◆ RemoveCaret()

static VOID RemoveCaret ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 1215 of file checklist.c.

1216{
1217 if (IsWindowEnabled(infoPtr->hSelf) && infoPtr->ShowingCaret)
1218 {
1219 infoPtr->ShowingCaret = FALSE;
1220
1221 HideCaret(infoPtr->hSelf);
1222 DestroyCaret();
1223 }
1224}
BOOL WINAPI HideCaret(_In_opt_ HWND)

Referenced by EscapeQuickSearch().

◆ RetChangeControlFont()

static HFONT RetChangeControlFont ( IN PCHECKLISTWND  infoPtr,
IN HFONT  hFont,
IN BOOL  Redraw 
)
static

Definition at line 737 of file checklist.c.

740{
741 HFONT hOldFont = infoPtr->hFont;
742 infoPtr->hFont = hFont;
743
744 if (hOldFont != hFont)
745 {
746 infoPtr->ItemHeight = (2 * CI_TEXT_MARGIN_HEIGHT) + GetIdealItemHeight(infoPtr);
747 }
748
749 if (infoPtr->ShowingCaret)
750 {
751 DestroyCaret();
752 CreateCaret(infoPtr->hSelf,
753 NULL,
754 0,
755 infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT));
756 }
757
758 UpdateControl(infoPtr);
759
760 return hOldFont;
761}
HFONT hFont
Definition: main.c:53
static UINT GetIdealItemHeight(IN PCHECKLISTWND infoPtr)
Definition: checklist.c:705

Referenced by CheckListWndProc().

◆ UnregisterCheckListControl()

VOID UnregisterCheckListControl ( HINSTANCE  hInstance)

Definition at line 2614 of file checklist.c.

2615{
2617 hInstance);
2618}
#define UnregisterClass
Definition: winuser.h:5861

Referenced by DllMain().

◆ UpdateCaretPos()

static VOID UpdateCaretPos ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 1268 of file checklist.c.

1269{
1270 if (infoPtr->ShowingCaret && infoPtr->QuickSearchHitItem != NULL)
1271 {
1272 HDC hDC = GetDC(infoPtr->hSelf);
1273 if (hDC != NULL)
1274 {
1275 SIZE TextSize;
1276 HGDIOBJ hOldFont = SelectObject(hDC,
1277 infoPtr->hFont);
1278
1279 TextSize.cx = 0;
1280 TextSize.cy = 0;
1281
1282 if (infoPtr->QuickSearchText[0] == L'\0' ||
1284 infoPtr->QuickSearchHitItem->Name,
1285 wcslen(infoPtr->QuickSearchText),
1286 &TextSize))
1287 {
1288 RECT rcItem;
1289
1290 MapItemToRect(infoPtr,
1291 infoPtr->QuickSearchHitItem,
1292 &rcItem);
1293
1294 /* actually change the caret position */
1295 SetCaretPos(rcItem.left + CI_TEXT_MARGIN_WIDTH + TextSize.cx,
1296 rcItem.top + CI_TEXT_MARGIN_HEIGHT);
1297 }
1298
1300 hOldFont);
1301
1302 ReleaseDC(infoPtr->hSelf,
1303 hDC);
1304 }
1305 }
1306}
static VOID MapItemToRect(IN PCHECKLISTWND infoPtr, IN PCHECKITEM CheckItem, OUT RECT *prcItem)
Definition: checklist.c:1236
LONG cy
Definition: kdterminal.h:28
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)

Referenced by ChangeSearchHit().

◆ UpdateCheckItem()

static VOID UpdateCheckItem ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  Item 
)
static

Definition at line 602 of file checklist.c.

604{
605 RECT rcClient;
606 INT VisibleFirst, VisibleItems;
607 INT Index = CheckItemToIndex(infoPtr,
608 Item);
609 if (Index != -1)
610 {
611 VisibleFirst = GetScrollPos(infoPtr->hSelf,
612 SB_VERT);
613
614 if (Index >= VisibleFirst)
615 {
616 GetClientRect(infoPtr->hSelf,
617 &rcClient);
618
619 VisibleItems = ((rcClient.bottom - rcClient.top) + infoPtr->ItemHeight - 1) / infoPtr->ItemHeight;
620
621 if (Index <= VisibleFirst + VisibleItems)
622 {
623 RECT rcUpdate;
624
625 rcUpdate.left = rcClient.left;
626 rcUpdate.right = rcClient.right;
627 rcUpdate.top = (Index - VisibleFirst) * infoPtr->ItemHeight;
628 rcUpdate.bottom = rcUpdate.top + infoPtr->ItemHeight;
629
630 RedrawWindow(infoPtr->hSelf,
631 &rcUpdate,
632 NULL,
634 }
635 }
636 }
637}

Referenced by ChangeCheckItemFocus(), ChangeSearchHit(), CheckListWndProc(), and EscapeQuickSearch().

◆ UpdateCheckItemBox()

static VOID UpdateCheckItemBox ( IN PCHECKLISTWND  infoPtr,
IN PCHECKITEM  Item,
IN UINT  ItemBox 
)
static

Definition at line 1100 of file checklist.c.

1103{
1104 RECT rcClient;
1105 INT VisibleFirst, VisibleItems;
1106 INT Index = CheckItemToIndex(infoPtr,
1107 Item);
1108 if (Index != -1)
1109 {
1110 VisibleFirst = GetScrollPos(infoPtr->hSelf,
1111 SB_VERT);
1112
1113 if (Index >= VisibleFirst)
1114 {
1115 GetClientRect(infoPtr->hSelf,
1116 &rcClient);
1117
1118 VisibleItems = ((rcClient.bottom - rcClient.top) + infoPtr->ItemHeight - 1) / infoPtr->ItemHeight;
1119
1120 if (Index <= VisibleFirst + VisibleItems)
1121 {
1122 RECT rcUpdate;
1123
1124 rcUpdate.left = rcClient.left + infoPtr->CheckBoxLeft[ItemBox] - (infoPtr->ItemHeight / 2);
1125 rcUpdate.right = rcUpdate.left + infoPtr->ItemHeight;
1126 rcUpdate.top = ((Index - VisibleFirst) * infoPtr->ItemHeight);
1127 rcUpdate.bottom = rcUpdate.top + infoPtr->ItemHeight;
1128
1129 RedrawWindow(infoPtr->hSelf,
1130 &rcUpdate,
1131 NULL,
1133 }
1134 }
1135 }
1136}

Referenced by CheckListWndProc().

◆ UpdateControl()

static VOID UpdateControl ( IN PCHECKLISTWND  infoPtr)
static

Definition at line 566 of file checklist.c.

567{
568 RECT rcClient;
569 SCROLLINFO ScrollInfo;
570 INT VisibleItems;
571
572 GetClientRect(infoPtr->hSelf,
573 &rcClient);
574
575 ScrollInfo.cbSize = sizeof(ScrollInfo);
576 ScrollInfo.fMask = SIF_PAGE | SIF_RANGE;
577 ScrollInfo.nMin = 0;
578 ScrollInfo.nMax = infoPtr->CheckItemCount;
579 ScrollInfo.nPage = ((rcClient.bottom - rcClient.top) + infoPtr->ItemHeight - 1) / infoPtr->ItemHeight;
580 ScrollInfo.nPos = 0;
581 ScrollInfo.nTrackPos = 0;
582
583 VisibleItems = (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight;
584
585 if (ScrollInfo.nPage == (UINT)VisibleItems && ScrollInfo.nMax > 0)
586 {
587 ScrollInfo.nMax--;
588 }
589
590 SetScrollInfo(infoPtr->hSelf,
591 SB_VERT,
592 &ScrollInfo,
593 TRUE);
594
595 RedrawWindow(infoPtr->hSelf,
596 NULL,
597 NULL,
599}
#define SIF_PAGE
Definition: winuser.h:1233

Referenced by CheckListWndProc(), and RetChangeControlFont().

Variable Documentation

◆ szCheckListWndClass

const WCHAR szCheckListWndClass[] = L"CHECKLIST_ACLUI"
static

Definition at line 39 of file checklist.c.

Referenced by RegisterCheckListControl(), and UnregisterCheckListControl().