summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_icons.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-02-28 06:48:33 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-02-28 06:48:33 +0000
commit21e7268a503be780b35e367564d711e79a61dffc (patch)
tree87b408e722116a6faea0d029d090e6278cda0f28 /protocols/Tox/src/tox_icons.cpp
parent4410284da77786594d7009b6c515176de0d5a51e (diff)
Tox:
- added support of tox1 dns resolving - added request/grant items in contact menu - added copy id item in statum menu - code reordering - fixed minor bugs git-svn-id: http://svn.miranda-ng.org/main/trunk@12281 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_icons.cpp')
-rw-r--r--protocols/Tox/src/tox_icons.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp
new file mode 100644
index 0000000000..505dbec2e3
--- /dev/null
+++ b/protocols/Tox/src/tox_icons.cpp
@@ -0,0 +1,63 @@
+#include "common.h"
+
+IconInfo CToxProto::Icons[] =
+{
+ { LPGENT("Protocol icon"), "main", IDI_TOX },
+};
+
+void CToxProto::InitIcons()
+{
+ TCHAR szFile[MAX_PATH];
+ GetModuleFileName(g_hInstance, szFile, MAX_PATH);
+
+ char szSettingName[100];
+ TCHAR szSectionName[100];
+
+ SKINICONDESC sid = { sizeof(SKINICONDESC) };
+ sid.flags = SIDF_ALL_TCHAR;
+ sid.ptszDefaultFile = szFile;
+ sid.pszName = szSettingName;
+ sid.ptszSection = szSectionName;
+
+ mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE));
+ for (int i = 0; i < SIZEOF(Icons); i++)
+ {
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, Icons[i].Name);
+
+ sid.ptszDescription = Icons[i].Description;
+ sid.iDefaultIndex = -Icons[i].IconId;
+ Icons[i].Handle = Skin_AddIcon(&sid);
+ }
+}
+
+HANDLE CToxProto::GetIconHandle(const char *name)
+{
+ for (size_t i = 0; i < SIZEOF(Icons); i++)
+ {
+ if (mir_strcmpi(Icons[i].Name, name) == 0)
+ {
+ return Icons[i].Handle;
+ }
+ }
+ return 0;
+}
+
+HANDLE CToxProto::GetSkinIconHandle(const char *name)
+{
+ char iconName[100];
+ mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name);
+ HANDLE hIcon = Skin_GetIconHandle(iconName);
+ if (hIcon == NULL)
+ {
+ hIcon = GetIconHandle(name);
+ }
+ return hIcon;
+}
+
+void CToxProto::UninitIcons()
+{
+ for (size_t i = 0; i < SIZEOF(Icons); i++)
+ {
+ Skin_RemoveIcon(Icons[i].Name);
+ }
+} \ No newline at end of file