summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-04 21:17:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-04 21:17:37 +0000
commite693f1d803f736478a30dd76c6748839796fca77 (patch)
treea98fa46db871e9edbf2f9ef4de566228daee299c /plugins/Clist_modern
parentf1bbd65bbaa4291c194244424668aa16c357ca0f (diff)
standardizing the control over checkboxes in clist
git-svn-id: http://svn.miranda-ng.org/main/trunk@9682 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h33
-rw-r--r--plugins/Clist_modern/src/init.cpp1
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp8
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp8
4 files changed, 30 insertions, 20 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index 3dca9f0ca8..aadbddc498 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -264,42 +264,43 @@ void ToolbarButtonUnloadModule();
// INTERFACES
void cliCheckCacheItem(ClcCacheEntry *pdnce);
-void cliFreeCacheItem( ClcCacheEntry *p );
-void cliRebuildEntireList(HWND hwnd,ClcData *dat);
-void cliRecalcScrollBar(HWND hwnd,ClcData *dat);
+void cliFreeCacheItem(ClcCacheEntry *p);
+void cliRebuildEntireList(HWND hwnd, ClcData *dat);
+void cliRecalcScrollBar(HWND hwnd, ClcData *dat);
void CLUI_cliOnCreateClc(void);
int cli_AddItemToGroup(ClcGroup *group, int iAboveItem);
-int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText);
+int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText);
int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly);
int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk);
-int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex);
-int cli_IconFromStatusMode(const char *szProto,int nStatus, MCONTACT hContact);
+int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact);
int cli_GetContactIcon(MCONTACT hContact);
int cli_RemoveEvent(MCONTACT hContact, HANDLE hDbEvent);
-void cli_AddContactToTree(HWND hwnd,ClcData *dat,MCONTACT hContact,int updateTotalCount,int checkHideOffline);
+void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline);
void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem);
-void cli_FreeContact( ClcContact* );
-void cli_FreeGroup( ClcGroup* );
+void cli_FreeContact(ClcContact*);
+void cli_FreeGroup(ClcGroup*);
char* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact);
-void cli_ChangeContactIcon(MCONTACT hContact,int iIcon,int add);
-LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wParam, LPARAM lParam);
-struct CListEvent* cliCreateEvent( void );
+void cli_ChangeContactIcon(MCONTACT hContact, int iIcon, int add);
+void cli_SetContactCheckboxes(ClcContact*, int);
+LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
+struct CListEvent* cliCreateEvent(void);
struct CListEvent* cli_AddEvent(CLISTEVENT *cle);
LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
int cliShowHide(WPARAM wParam, LPARAM lParam);
-BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
-int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2);
+BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase);
+int cliCompareContacts(const ClcContact *contact1, const ClcContact *contact2);
int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount);
int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
-void cliCluiProtocolStatusChanged(int status,const char * proto);
+void cliCluiProtocolStatusChanged(int status, const char * proto);
HMENU cliBuildGroupPopupMenu(ClcGroup *group);
void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact);
void cliCheckCacheItem(ClcCacheEntry *pdnce);
void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat);
void CLUI_cli_LoadCluiGlobalOpts(void);
INT_PTR cli_TrayIconProcessMessage(WPARAM wParam, LPARAM lParam);
-BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
+BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase);
ClcContact* cliCreateClcContact( void );
ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact);
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index 7736c45cf6..8387f6f17d 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -190,6 +190,7 @@ static HRESULT SubclassClistInterface()
pcli->pfnFreeContact = cli_FreeContact;
pcli->pfnFreeGroup = cli_FreeGroup;
pcli->pfnChangeContactIcon = cli_ChangeContactIcon;
+ pcli->pfnSetContactCheckboxes = cli_SetContactCheckboxes;
pcli->pfnTrayIconProcessMessage = cli_TrayIconProcessMessage;
pcli->pfnSaveStateAndRebuildList = cli_SaveStateAndRebuildList;
pcli->pfnContactListControlWndProc = cli_ContactListControlWndProc;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 55ff08eb3c..27d53a83cf 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -903,12 +903,12 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam
}
if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) {
- contact->flags ^= CONTACTF_CHECKED;
- for (int i = 0; i < contact->SubAllocated; i++)
- contact->subcontacts[i].flags ^= CONTACTF_CHECKED;
+ int bNewState = (contact->flags & CONTACTF_CHECKED) == 0; // inversion
if (contact->type == CLCIT_GROUP)
- pcli->pfnSetGroupChildCheckboxes(contact->group, contact->flags&CONTACTF_CHECKED);
+ pcli->pfnSetGroupChildCheckboxes(contact->group, bNewState);
+ else
+ pcli->pfnSetContactCheckboxes(contact, bNewState);
pcli->pfnRecalculateGroupCheckboxes(hwnd, dat);
CLUI__cliInvalidateRect(hwnd, NULL, FALSE);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 02812c1d09..a4ed57af90 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -630,6 +630,14 @@ void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact)
}
}
+void cli_SetContactCheckboxes(ClcContact *cc, int checked)
+{
+ corecli.pfnSetContactCheckboxes(cc, checked);
+
+ for (int i = 0; i < cc->SubAllocated; i++)
+ corecli.pfnSetContactCheckboxes(&cc->subcontacts[i], checked);
+}
+
char* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact)
{
return corecli.pfnGetGroupCountsText(dat, contact);