diff options
author | George Hazan <george.hazan@gmail.com> | 2016-04-15 13:40:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-04-15 13:40:58 +0000 |
commit | 18f7e9261c885e953f220ba6836e8bca43a6fc88 (patch) | |
tree | 67cb94186914b97f1c0e8e815afffea7666b2510 /include | |
parent | d2dd1c6dddd3e690ad13d2b355de60d3724e8ec6 (diff) |
contact list groups:
- finally database is not used anymore (only as a settings' storage);
- MGROUP type introduced to replace HANDLE for group ids;
- MS_CLIST_GROUP* services became Clist_Group* functions;
- CLIST_INTERFACE members pfnGetGroupName & pfnRenameGroup also transformed into static Clist_Group* functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@16659 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include')
-rw-r--r-- | include/delphi/m_clist.inc | 129 | ||||
-rw-r--r-- | include/delphi/m_clistint.inc | 5 | ||||
-rw-r--r-- | include/m_clist.h | 86 | ||||
-rw-r--r-- | include/m_clistint.h | 5 | ||||
-rw-r--r-- | include/m_gui.h | 7 |
5 files changed, 48 insertions, 184 deletions
diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index 57f0f8440d..eeb564581d 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -33,23 +33,20 @@ const }
MS_CLIST_GETSTATUSMODE:PAnsiChar = 'CList/GetStatusMode';
-function Menu_BuildContactMenu(hContact:TMCONTACT) : HMENU; stdcall;
- external AppDll name 'Menu_BuildContactMenu';
+function Menu_BuildContactMenu(hContact:TMCONTACT) : HMENU; stdcall; external AppDll;
{
Affect : Modify an existing menu item, see notes
Returns: 0 on success, [non zero] on failure
}
-function Menu_ModifyItem(hMenu:HGENMENU; const name:PWideChar; icon:THANDLE=INVALID_HANDLE_VALUE; flags:int=-1) : int; stdcall;
- external AppDll name 'Menu_ModifyItem';
+function Menu_ModifyItem(hMenu:HGENMENU; const name:PWideChar; icon:THANDLE=INVALID_HANDLE_VALUE; flags:int=-1) : int; stdcall; external AppDll;
{
Notes : changes menu item's visibility
}
-procedure Menu_ShowItem(hMenu:HGENMENU; bShow:BYTE); stdcall;
- external AppDll name 'Menu_ShowItem';
+procedure Menu_ShowItem(hMenu:HGENMENU; bShow:BYTE); stdcall; external AppDll;
{
wParam : TMCONTACT
@@ -276,128 +273,12 @@ type const
ME_CLIST_GROUPCHANGE:PAnsiChar = 'CList/GroupChange';
- {
- checks that a group exists
- wParam : 0 (unused)
- lParam : (PWideChar)groupName
- returns 0 if a group is not found or group handle on success
- }
- MS_CLIST_GROUPEXISTS:PAnsiChar = 'CList/GroupExists';
-
- {
- wParam : HPARENTGROUP
- lParam : 0 or Pointer to new group name
- Affect : Create a new group and calls CLUI to display it, see notes
- Returns: A handle to the new group.
- Notes : If HPARENTGROUP is NULL(0) it will create a group at the root.
- Version: v0.1.1.0+
- }
- MS_CLIST_GROUPCREATE:PAnsiChar = 'CList/GroupCreate';
-
- {
- wParam : HGROUP
- lParam : 0
- Affect : Delete a group and call CLUI to display the change
- Returns: 0 on success, [non zero] on failure
- Version: v0.1.1.0+
- }
- MS_CLIST_GROUPDELETE:PAnsiChar = 'CList/GroupDelete';
-
- {
- wParam : HGROUP
- lParam : newState
- Affect : Change the expanded state flag for a group internally, see notes
- Returns: 0 on success, [non zero] on failure
- Notes : if newState is non zero then the group is expanded, 0 it's collapsed
- CLUI IS *NOT* called when the change is made.
- Version: v0.1.1.0+
- }
- MS_CLIST_GROUPSETEXPANDED:PAnsiChar = 'CList/GroupSetExpanded';
-
- {
- wParam : HGROUP
- lParam : MAKELPARAM(flags, flagsMask)
- Affect : Change the flag for a group, see notes
- Returns: 0 on success, [non zero] on failure
- Notes : only if flags given in flagsmask are altered,
- CLUI is called on change to GROUPF_HIDEOFFLINE
- Version: v0.1.2.1+
- }
- MS_CLIST_GROUPSETFLAGS:PAnsiChar = 'CList/GroupSetFlags';
-
- {
- wParam : HGROUP
- lParam : Pointer to a integer to be filled with expanded state
- Affect : get the name of a group, see notes
- Returns: a static buffer pointing to the name of the group
- returns NULL(0) if HGROUP is invalid.
- Notes : the returned buffer is only valid til the next call
- to this service, lParam can be NULL(0) if you don't
- want to know if the group is expanded
- Version: v0.1.1.0+
- }
- MS_CLIST_GROUPGETNAME:PAnsiChar = 'CList/GroupGetName';
-
- {
- wParam : HGROUP
- lParam : Pointer to flags
- Affect : Get the name of the group, see notes
- Returns: A static buffer pointing to the name of the group
- returns NULL(0) if HGROUP is invalid
- Note : this buffer is only valid til the next call to this service
- flags can be NULL(0), otherwise it'll return GROUPF_* constants
- Version: v0.1.2.1+
- }
- MS_CLIST_GROUPGETNAME2:PAnsiChar = 'CList/GroupGetName2';
-
GROUPF_EXPANDED = $04;
GROUPF_HIDEOFFLINE = $08;
- {
- wParam : HGROUP
- lParam : HBEFOREGROUP
- Affect : Move a group directly before another group
- Returns: the new handle of the group on success, NULL(0) on failure
- Notes : the order is represented by the order in which MS_CLUI_GROUPADDED
- is called, however UI's are free to ignore this order and sort
- if they wish.
- Version: v0.1.2.1+
- }
- MS_CLIST_GROUPMOVEBEFORE:PAnsiChar = 'CList/GroupMoveBefore';
- {
- wParam : HGROUP
- lParam : Pointer to a null terminated string containing the new name
- Affect : Rename a group internally, see notes
- Returns: 0 on success, [non zero] on failure
- Notes : this will fail if the group name is a duplicate of an existing
- a name, CLUI is not called when this change is made.
- Version: v0.1.1.0+
- }
- MS_CLIST_GROUPRENAME:PAnsiChar = 'CList/GroupRename';
-
- {
- wParam : 0
- lParam : 0
- Affect : Build a menu of the group tree, see notes
- Returns: Handle to the menu, NULL(0) on failure
- Notes : NULL be returned if the user doesn't have any groups
- the dwItemData of every menu item is the handle to that group.
- Menu item ID's are assigned starting at 100 in no particular order
- Version: v0.1.2.1+
- }
- MS_CLIST_GROUPBUILDMENU:PAnsiChar = 'CList/GroupBuildMenu';
-
- {
- wParam : newValue
- lParam : 0
- Affect : Changes the 'hide offline contacts' flag and calls CLUI, see notes
- Returns: 0 success, [non zero] on failure
- Notes : newValue is 0 to show all contacts, 1 to show only online contacts
- -1 to toggle the value
- Version: v0.1.1.0+
- }
- MS_CLIST_SETHIDEOFFLINE:PAnsiChar = 'CList/SetHideOffline';
+function Clist_GroupCreate(hParentGroup:integer; groupName:PWideChar) : integer; stdcall; external AppDll;
+const
{
wParam : TMCONTACT
lParam : 0
diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index dd9526d786..88fcb303ad 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -51,7 +51,6 @@ const INTM_NAMECHANGED = WM_USER+10;
INTM_ICONCHANGED = WM_USER+11;
INTM_GROUPCHANGED = WM_USER+12;
- INTM_GROUPSCHANGED = WM_USER+13;
INTM_CONTACTADDED = WM_USER+14;
INTM_CONTACTDELETED = WM_USER+15;
INTM_HIDDENCHANGED = WM_USER+16;
@@ -438,10 +437,6 @@ type (* docking.c *)
pfnDocking_ProcessWindowMessage : function (wParam:WPARAM; lParam:LPARAM):int; cdecl;
- (* group.c *)
- pfnGetGroupName : function (idx:int; var pdwFlags:dword):TChar; cdecl;
- pfnRenameGroup : function (groupID:int; newName:TChar):int; cdecl;
-
(* keyboard.c *)
pfnHotKeysRegister : function (hwnd:HWND):int; cdecl;
pfnHotKeysUnregister : procedure (hwnd:HWND); cdecl;
diff --git a/include/m_clist.h b/include/m_clist.h index a66e48cf45..1475fca43d 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -271,7 +271,7 @@ typedef struct { /////////////////////////////////////////////////////////////////////////////////////////
//processes a menu selection from a menu
//wParam = MAKEWPARAM(LOWORD(wParam from WM_COMMAND), flags)
-//lParam = (LPARAM)(HANDLE)hContact
+//lParam = (LPARAM)(MCONTACT)hContact
//returns TRUE if it processed the command, FALSE otherwise
//hContact is the currently selected contact. It it not used if this is a main
//menu command. If this is NULL and the command is a contact menu one, the
@@ -293,9 +293,9 @@ typedef struct { // Otherwise, you HAVE TO distinguish WM_COMMAND from clist menus and from youê internal menu and
// DO NOT call MS_CLIST_MENUPROCESSCOMMAND for non clist menus.
-
#define MPCF_CONTACTMENU 1 //test commands from a contact menu
#define MPCF_MAINMENU 2 //test commands from the main menu
+
#define MS_CLIST_MENUPROCESSCOMMAND "CList/MenuProcessCommand"
/////////////////////////////////////////////////////////////////////////////////////////
@@ -343,94 +343,77 @@ typedef struct { // lParam = pointer to CLISTGROUPCHANGE
typedef struct {
- int cbSize; //size in bytes of this structure
- TCHAR* pszOldName; //old group name
- TCHAR* pszNewName; //new group name
+ int cbSize; // size in bytes of this structure
+ TCHAR *pszOldName; // old group name, NULL if a new group was created
+ TCHAR *pszNewName; // new group name, NULL if an old group was deleted
} CLISTGROUPCHANGE;
#define ME_CLIST_GROUPCHANGE "CList/GroupChange"
/////////////////////////////////////////////////////////////////////////////////////////
// checks that a group exists
-// wParam = 0 (unused)
-// lParam = (TCHAR*)groupName
// returns 0 if a group is not found or group handle on success
-#define MS_CLIST_GROUPEXISTS "CList/GroupExists"
-__forceinline HANDLE Clist_GroupExists(LPCTSTR ptszGroupName)
-{ return (HANDLE)CallService(MS_CLIST_GROUPEXISTS, 0, (LPARAM)ptszGroupName);
-}
+typedef int MGROUP;
+
+EXTERN_C MIR_APP_DLL(MGROUP) Clist_GroupExists(LPCTSTR ptszGroupName);
/////////////////////////////////////////////////////////////////////////////////////////
// creates a new group and calls CLUI to display it
-// wParam = hParentGroup
-// lParam = groupName
// returns a handle to the new group
// hParentGroup is NULL to create the new group at the root, or can be the
// handle of the group of which the new group should be a subgroup.
// groupName is a TCHAR* pointing to the group name to create or NULL for
// API to create unique name by itself
-#define MS_CLIST_GROUPCREATE "CList/GroupCreate"
-__forceinline HANDLE Clist_CreateGroup(HANDLE hParent, LPCTSTR ptszGroupName)
-{ return (HANDLE)CallService(MS_CLIST_GROUPCREATE, (WPARAM)hParent, (LPARAM)ptszGroupName);
-}
+EXTERN_C MIR_APP_DLL(MGROUP) Clist_GroupCreate(MGROUP hParent, const TCHAR *ptszGroupName);
/////////////////////////////////////////////////////////////////////////////////////////
// deletes a group and calls CLUI to display the change
-// wParam = (WPARAM)(HANDLE)hGroup
-// lParam = 0
// returns 0 on success, nonzero on failure
-#define MS_CLIST_GROUPDELETE "CList/GroupDelete"
+
+EXTERN_C MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// renames a group
+// returns 0 on success, nonzero on failure
+
+EXTERN_C MIR_APP_DLL(int) Clist_GroupRename(MGROUP hGroup, const TCHAR *ptszNewName);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// retrieves a group's name
+// returns a TCHAR* on success, NULL on failure
+// if pdwFlags is not NULL, also stores group flags into it (one of GROUPF_* constants
+
+#define GROUPF_EXPANDED 0x04
+#define GROUPF_HIDEOFFLINE 0x08
+
+EXTERN_C MIR_APP_DLL(TCHAR*) Clist_GroupGetName(MGROUP hGroup, DWORD *pdwFlags = NULL);
/////////////////////////////////////////////////////////////////////////////////////////
// change the expanded state flag for a group internally
-// wParam = (WPARAM)(HANDLE)hGroup
-// lParam = newState
// returns 0 on success, nonzero on failure
// newState is nonzero if the group is expanded, 0 if it's collapsed
// CLUI is not called when this change is made
-#define MS_CLIST_GROUPSETEXPANDED "CList/GroupSetExpanded"
+
+EXTERN_C MIR_APP_DLL(int) Clist_GroupSetExpanded(MGROUP hGroup, int iNewState);
/////////////////////////////////////////////////////////////////////////////////////////
// changes the flags for a group
-// wParam = (WPARAM)(HANDLE)hGroup
-// lParam = MAKELPARAM(flags, flagsMask)
+// iNewFlags = MAKELPARAM(flags, flagsMask)
// returns 0 on success, nonzero on failure
// Only the flags given in flagsMask are altered.
// CLUI is called on changes to GROUPF_HIDEOFFLINE.
-#define MS_CLIST_GROUPSETFLAGS "CList/GroupSetFlags"
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// get the name of a group
-// wParam = (WPARAM)(HANDLE)hGroup
-// lParam = (LPARAM)(int*)&isExpanded
-// returns a static buffer pointing to the name of the group
-// returns NULL if hGroup is invalid.
-// this buffer is only valid until the next call to this service
-// & isExpanded can be NULL if you don't want to know if the group is expanded or not.
-#define MS_CLIST_GROUPGETNAME "CList/GroupGetName"
-#define GROUPF_EXPANDED 0x04
-#define GROUPF_HIDEOFFLINE 0x08
+EXTERN_C MIR_APP_DLL(int) Clist_GroupSetFlags(MGROUP hGroup, LPARAM iNewFlags);
/////////////////////////////////////////////////////////////////////////////////////////
// move a group to directly before another group
-// wParam = (WPARAM)(HANDLE)hGroup
-// lParam = (LPARAM)(HANDLE)hBeforeGroup
// returns the new handle of the group on success, NULL on failure
// The order is represented by the order in which MS_CLUI_GROUPADDED is called,
// however UIs are free to ignore this order and sort alphabetically if they wish.
-#define MS_CLIST_GROUPMOVEBEFORE "CList/GroupMoveBefore"
-/////////////////////////////////////////////////////////////////////////////////////////
-// rename a group internally
-// wParam = (WPARAM)(HANDLE)hGroup
-// lParam = (LPARAM)(char*)szNewName
-// returns 0 on success, nonzero on failure
-// this will fail if the group name is a duplicate of an existing name
-// CLUI is not called when this change is made
-#define MS_CLIST_GROUPRENAME "CList/GroupRename"
+EXTERN_C MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore);
/////////////////////////////////////////////////////////////////////////////////////////
// build a menu of the group tree
@@ -439,7 +422,8 @@ __forceinline HANDLE Clist_CreateGroup(HANDLE hParent, LPCTSTR ptszGroupName) // NULL will be returned if the user doesn't have any groups
// The dwItemData of every menu item is the handle to that group.
// Menu item IDs are assigned starting at 100, in no particular order.
-#define MS_CLIST_GROUPBUILDMENU "CList/GroupBuildMenu"
+
+EXTERN_C MIR_APP_DLL(HMENU) Clist_GroupBuildMenu(void);
/////////////////////////////////////////////////////////////////////////////////////////
// changes the 'hide offline contacts' flag and call CLUI
@@ -468,7 +452,7 @@ __forceinline HANDLE Clist_CreateGroup(HANDLE hParent, LPCTSTR ptszGroupName) /////////////////////////////////////////////////////////////////////////////////////////
// change the group a contact belongs to
// wParam = (MCONTACT)hContact
-// lParam = (LPARAM)(HANDLE)hGroup
+// lParam = (LPARAM)(MGROUP)hGroup
// returns 0 on success, nonzero on failure
// use hGroup = NULL to put the contact in no group
#define MS_CLIST_CONTACTCHANGEGROUP "CList/ContactChangeGroup"
diff --git a/include/m_clistint.h b/include/m_clistint.h index a78ff48c6e..56d542a011 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -50,7 +50,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INTM_NAMECHANGED (WM_USER+10)
#define INTM_ICONCHANGED (WM_USER+11)
#define INTM_GROUPCHANGED (WM_USER+12)
-#define INTM_GROUPSCHANGED (WM_USER+13)
#define INTM_CONTACTADDED (WM_USER+14)
#define INTM_CONTACTDELETED (WM_USER+15)
#define INTM_HIDDENCHANGED (WM_USER+16)
@@ -397,8 +396,8 @@ struct CLIST_INTERFACE int (*pfnDocking_ProcessWindowMessage)(WPARAM wParam, LPARAM lParam);
/* group.c */
- WCHAR* (*pfnGetGroupName)(int idx, DWORD* pdwFlags);
- int (*pfnRenameGroup)(int groupID, WCHAR* newName);
+ WCHAR* (*tobedeleted)(int idx, DWORD* pdwFlags);
+ int (*tobedeleted2)(int groupID, const WCHAR *newName);
/* keyboard.c */
int (*pfnHotKeysRegister)(HWND hwnd);
diff --git a/include/m_gui.h b/include/m_gui.h index c8b5383b73..76beacdf2a 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -540,6 +540,11 @@ protected: /////////////////////////////////////////////////////////////////////////////////////////
// CCtrlClc
+
+#if !defined(MGROUP)
+ typedef int MGROUP;
+#endif
+
class MIR_CORE_EXPORT CCtrlClc : public CCtrlBase
{
typedef CCtrlBase CSuper;
@@ -556,7 +561,7 @@ public: void EnsureVisible(HANDLE hItem, bool partialOk);
void Expand(HANDLE hItem, DWORD flags);
HANDLE FindContact(MCONTACT hContact);
- HANDLE FindGroup(HANDLE hGroup);
+ HANDLE FindGroup(MGROUP hGroup);
COLORREF GetBkColor();
bool GetCheck(HANDLE hItem);
int GetCount();
|