summaryrefslogtreecommitdiff
path: root/MirOTR/icons.cpp
diff options
context:
space:
mode:
authoradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-08-19 20:12:06 +0000
committeradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-08-19 20:12:06 +0000
commit11e5e8749eb7d4d3cfebfa49bbb7ea4624608647 (patch)
treec773fee94a63a078e5cb59bdbfd3165f1830b7ea /MirOTR/icons.cpp
parentc7e64af067562167b6941f3ad8383e3ceb817633 (diff)
initial commit with v0.8.6.1
git-svn-id: http://mirotr.googlecode.com/svn/trunk@2 eced67a3-f377-a0ae-92ae-d6de1850b05a
Diffstat (limited to 'MirOTR/icons.cpp')
-rw-r--r--MirOTR/icons.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/MirOTR/icons.cpp b/MirOTR/icons.cpp
new file mode 100644
index 0000000..7b26df9
--- /dev/null
+++ b/MirOTR/icons.cpp
@@ -0,0 +1,59 @@
+#include "stdafx.h"
+#include "icons.h"
+TCHAR g_dllpath[1024];
+
+struct
+{
+ const TCHAR* stzDescr;
+ const char* szName;
+ int defIconID;
+}
+static iconList[] = {
+ { _T(LANG_ICON_OTR), ICON_OTR, IDI_OTR },
+ { _T(LANG_ICON_PRIVATE), ICON_PRIVATE, IDI_PRIVATE },
+ { _T(LANG_ICON_UNVERIFIED), ICON_UNVERIFIED, IDI_UNVERIFIED },
+ { _T(LANG_ICON_FINISHED), ICON_FINISHED, IDI_FINISHED },
+ { _T(LANG_ICON_NOT_PRIVATE), ICON_NOT_PRIVATE, IDI_INSECURE }
+
+};
+
+HANDLE hIconLibItem[SIZEOF(iconList)];
+
+void InitIcons() {
+ TCHAR szFile[MAX_PATH+500];
+
+ GetModuleFileName(hInst, szFile, SIZEOF(szFile));
+
+ SKINICONDESC sid = {0};
+ sid.cbSize = sizeof(SKINICONDESC);
+ sid.ptszDefaultFile = szFile;
+ sid.ptszSection = _T(MODULENAME);
+ sid.flags = SIDF_ALL_TCHAR;
+
+ for ( int i = 0; i < SIZEOF(iconList); i++ ) {
+ sid.pszName = (char*)iconList[i].szName;
+ sid.ptszDescription = (TCHAR*)iconList[i].stzDescr;
+ sid.iDefaultIndex = -iconList[i].defIconID;
+ hIconLibItem[i] = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ }
+
+}
+
+void DeinitIcons() {
+ for ( int i = 0; i < SIZEOF(iconList); i++ ) {
+ (HANDLE)CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)iconList[i].szName);
+ hIconLibItem[i] = NULL;
+ }
+}
+
+HICON LoadIcon(const char* name, int big) {
+ return ( HICON )CallService( MS_SKIN2_GETICON, big, (LPARAM)name );
+}
+
+HANDLE GetIconHandle(const char* name) {
+ return ( HANDLE )CallService( MS_SKIN2_GETICONHANDLE, 0, (LPARAM)name );
+}
+
+void ReleaseIcon(const char* name, int big) {
+ CallService( big ? MS_SKIN2_RELEASEICONBIG : MS_SKIN2_RELEASEICON, 0, (LPARAM)name );
+}