From 86f9e6be8bbdb7eabf2b92b72597c9802a71854a Mon Sep 17 00:00:00 2001
From: MikalaiR <nikolay.romanovich@narod.ru>
Date: Thu, 7 Jan 2016 19:22:07 +0000
Subject: Popup: LoadSkin service

git-svn-id: http://svn.miranda-ng.org/main/trunk@16052 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 plugins/Popup/src/main.cpp     |  2 ++
 plugins/Popup/src/services.cpp | 17 +++++++++++++++++
 plugins/Popup/src/services.h   |  2 ++
 3 files changed, 21 insertions(+)

(limited to 'plugins')

diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 8a8fd046e3..793b33f097 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -389,6 +389,8 @@ MIRAPI int Load(void)
 
 	CreateServiceFunction(MS_POPUP_DESTROYPOPUP, Popup_DeletePopup);
 
+	CreateServiceFunction("Popup/LoadSkin", Popup_LoadSkin);
+
 	// load icons / create hook
 	InitIcons();
 	HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index b2c3887c4c..4be78c8a12 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -474,4 +474,21 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam)
 INT_PTR Popup_DeletePopup(WPARAM, LPARAM lParam)
 {
 	return (INT_PTR)SendMessage((HWND)lParam, UM_DESTROYPOPUP, 0, 0);
+}
+
+INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam)
+{
+	if (lParam)
+	{
+		mir_free(PopupOptions.SkinPack);
+		PopupOptions.SkinPack = mir_a2t((char*)lParam);
+	}
+
+	const PopupSkin *skin = 0;
+	if (skin = skins.getSkin(PopupOptions.SkinPack)) {
+		mir_free(PopupOptions.SkinPack);
+		PopupOptions.SkinPack = mir_tstrdup(skin->getName());
+	}
+
+	return 1;
 }
\ No newline at end of file
diff --git a/plugins/Popup/src/services.h b/plugins/Popup/src/services.h
index b47f04f397..6851c26350 100644
--- a/plugins/Popup/src/services.h
+++ b/plugins/Popup/src/services.h
@@ -53,4 +53,6 @@ INT_PTR Popup_UnregisterPopupClass(WPARAM wParam, LPARAM lParam);
 INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam);
 INT_PTR Popup_DeletePopup(WPARAM, LPARAM lParam);
 
+INT_PTR Popup_LoadSkin(WPARAM, LPARAM lParam);
+
 #endif // __services_h__
-- 
cgit v1.2.3