From e693f1d803f736478a30dd76c6748839796fca77 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 4 Jul 2014 21:17:37 +0000 Subject: standardizing the control over checkboxes in clist git-svn-id: http://svn.miranda-ng.org/main/trunk@9682 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clc.h | 1 + src/modules/clist/clcutils.cpp | 26 ++++++++++++++------------ src/modules/clist/clistcore.cpp | 1 + 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 9bd95c3c9d..acb5279007 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -95,6 +95,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour); void fnLoadClcOptions(HWND hwnd, struct ClcData *dat); void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat); void fnSetGroupChildCheckboxes(ClcGroup *group, int checked); +void fnSetContactCheckboxes(ClcContact *cc, int checked); void fnInvalidateItem(HWND hwnd, struct ClcData *dat, int iItem); int fnGetRowBottomY(struct ClcData *dat, int item); diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 470936f9e4..92ed6de693 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -818,22 +818,24 @@ void fnRecalculateGroupCheckboxes(HWND, struct ClcData *dat) } } +void fnSetContactCheckboxes(ClcContact *cc, int checked) +{ + if (checked) + cc->flags |= CONTACTF_CHECKED; + else + cc->flags &= ~CONTACTF_CHECKED; +} + void fnSetGroupChildCheckboxes(ClcGroup *group, int checked) { for (int i=0; i < group->cl.count; i++) { - if (group->cl.items[i]->type == CLCIT_GROUP) { - cli.pfnSetGroupChildCheckboxes(group->cl.items[i]->group, checked); - if (checked) - group->cl.items[i]->flags |= CONTACTF_CHECKED; - else - group->cl.items[i]->flags &= ~CONTACTF_CHECKED; - } - else if (group->cl.items[i]->type == CLCIT_CONTACT) { - if (checked) - group->cl.items[i]->flags |= CONTACTF_CHECKED; - else - group->cl.items[i]->flags &= ~CONTACTF_CHECKED; + ClcContact *cc = group->cl.items[i]; + if (cc->type == CLCIT_GROUP) { + cli.pfnSetGroupChildCheckboxes(cc->group, checked); + cli.pfnSetContactCheckboxes(cc, checked); } + else if (cc->type == CLCIT_CONTACT) + cli.pfnSetContactCheckboxes(cc, checked); } } diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index 89f6770927..156f1149f7 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -127,6 +127,7 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM) cli.pfnLoadClcOptions = fnLoadClcOptions; cli.pfnRecalculateGroupCheckboxes = fnRecalculateGroupCheckboxes; cli.pfnSetGroupChildCheckboxes = fnSetGroupChildCheckboxes; + cli.pfnSetContactCheckboxes = fnSetContactCheckboxes; cli.pfnInvalidateItem = fnInvalidateItem; cli.pfnGetRowBottomY = fnGetRowBottomY; cli.pfnGetRowHeight = fnGetRowHeight; -- cgit v1.2.3