summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-14 21:33:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-14 21:33:38 +0000
commit0f8566dd046d34ea0ff6b747f7383ffb17f6761e (patch)
tree7754cc5ea95a3599ad18410f3708cf70625baf63 /src/mir_core
parent5bb6c8a74313a4b62de9cd4c2613d43945c3727b (diff)
WindowList_* functions are not services anymore; unneeded helpers removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14168 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/mir_core_10.vcxproj1
-rw-r--r--src/mir_core/mir_core_10.vcxproj.filters3
-rw-r--r--src/mir_core/mir_core_12.vcxproj1
-rw-r--r--src/mir_core/mir_core_12.vcxproj.filters3
-rw-r--r--src/mir_core/src/mir_core.def7
-rw-r--r--src/mir_core/src/mir_core64.def7
-rw-r--r--src/mir_core/src/windowlist.cpp104
7 files changed, 126 insertions, 0 deletions
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj
index ce4eb74f8c..68946ed6c2 100644
--- a/src/mir_core/mir_core_10.vcxproj
+++ b/src/mir_core/mir_core_10.vcxproj
@@ -92,6 +92,7 @@
<ClCompile Include="src\ui_utils.cpp" />
<ClCompile Include="src\utf.cpp" />
<ClCompile Include="src\utils.cpp" />
+ <ClCompile Include="src\windowlist.cpp" />
<ClCompile Include="src\winver.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters
index 7160a06293..f65ee2856e 100644
--- a/src/mir_core/mir_core_10.vcxproj.filters
+++ b/src/mir_core/mir_core_10.vcxproj.filters
@@ -115,6 +115,9 @@
<ClCompile Include="src\bitmaps.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\windowlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\commonheaders.h">
diff --git a/src/mir_core/mir_core_12.vcxproj b/src/mir_core/mir_core_12.vcxproj
index a83072c7fd..ab2cb013e5 100644
--- a/src/mir_core/mir_core_12.vcxproj
+++ b/src/mir_core/mir_core_12.vcxproj
@@ -96,6 +96,7 @@
<ClCompile Include="src\ui_utils.cpp" />
<ClCompile Include="src\utf.cpp" />
<ClCompile Include="src\utils.cpp" />
+ <ClCompile Include="src\windowlist.cpp" />
<ClCompile Include="src\winver.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/src/mir_core/mir_core_12.vcxproj.filters b/src/mir_core/mir_core_12.vcxproj.filters
index ec0939a562..d320dd8ba4 100644
--- a/src/mir_core/mir_core_12.vcxproj.filters
+++ b/src/mir_core/mir_core_12.vcxproj.filters
@@ -115,6 +115,9 @@
<ClCompile Include="src\bitmaps.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\windowlist.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\m_core.h">
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index f2decbe158..6c1c107d7f 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1238,3 +1238,10 @@ Bitmap_GetFilter @1248
Bitmap_Load @1249
CreateProtoServiceFunction @1250
?SetSilent@CCtrlBase@@QAEXXZ @1251 NONAME
+WindowList_Add @1252
+WindowList_Broadcast @1253
+WindowList_BroadcastAsync @1254
+WindowList_Create @1255
+WindowList_Destroy @1256
+WindowList_Find @1257
+WindowList_Remove @1258
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 3a15379fcd..9fc7449fee 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1238,3 +1238,10 @@ Bitmap_GetFilter @1248
Bitmap_Load @1249
CreateProtoServiceFunction @1250
?SetSilent@CCtrlBase@@QEAAXXZ @1251 NONAME
+WindowList_Add @1252
+WindowList_Broadcast @1253
+WindowList_BroadcastAsync @1254
+WindowList_Create @1255
+WindowList_Destroy @1256
+WindowList_Find @1257
+WindowList_Remove @1258
diff --git a/src/mir_core/src/windowlist.cpp b/src/mir_core/src/windowlist.cpp
new file mode 100644
index 0000000000..425db3f2db
--- /dev/null
+++ b/src/mir_core/src/windowlist.cpp
@@ -0,0 +1,104 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "commonheaders.h"
+
+struct TWindowListItem
+{
+ TWindowListItem(MCONTACT _contact, HWND _wnd) :
+ hContact(_contact),
+ hWnd(_wnd)
+ {}
+
+ MCONTACT hContact;
+ HWND hWnd;
+};
+
+struct TWindowList : public OBJLIST<TWindowListItem>
+{
+ TWindowList() :
+ OBJLIST<TWindowListItem>(10, NumericKeySortT)
+ {}
+};
+
+MIR_CORE_DLL(MWindowList) WindowList_Create(void)
+{
+ return new TWindowList();
+}
+
+MIR_CORE_DLL(void) WindowList_Destroy(MWindowList hList)
+{
+ delete hList;
+}
+
+MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact)
+{
+ if (hList == NULL)
+ return 1;
+
+ hList->insert(new TWindowListItem(hContact, hwnd));
+ return 0;
+}
+
+MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd)
+{
+ if (hList == NULL) return 1;
+
+ for (int i = 0; i < hList->getCount(); i++) {
+ if ((*hList)[i].hWnd == hwnd) {
+ hList->remove(i);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact)
+{
+ if (hList == NULL)
+ return NULL;
+
+ TWindowListItem *p = hList->find((TWindowListItem*)&hContact);
+ return (p == NULL) ? NULL : p->hWnd;
+}
+
+MIR_CORE_DLL(int) WindowList_Broadcast(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (hList == NULL)
+ return NULL;
+
+ for (int i = hList->getCount()-1; i >= 0; i--)
+ SendMessage((*hList)[i].hWnd, message, wParam, lParam);
+ return 0;
+}
+
+MIR_CORE_DLL(int) WindowList_BroadcastAsync(MWindowList hList, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (hList == NULL)
+ return NULL;
+
+ for (int i = hList->getCount()-1; i >= 0; i--)
+ PostMessage((*hList)[i].hWnd, message, wParam, lParam);
+ return 0;
+}