summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/StartupStatus/toolbars.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-10 14:46:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-10 14:46:58 +0000
commit101ca36412b3e7b8851b6b48a4f6cbc17d9f9eff (patch)
treea846c60f7c2a7df17b694deba92e7f6df3bbb882 /plugins/StatusPlugins/StartupStatus/toolbars.cpp
parenta3fdadd09f12f6b246b11a5156bf6f0358e9a5f8 (diff)
bitmap operations were removed from TopToolBar and replaced with IcoLib
git-svn-id: http://svn.miranda-ng.org/main/trunk@379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/StartupStatus/toolbars.cpp')
-rw-r--r--plugins/StatusPlugins/StartupStatus/toolbars.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
index 7a12697c52..9b8ab6c475 100644
--- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp
+++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
@@ -53,35 +53,34 @@ int RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
{
- TTBButton ttb;
- int i, profileCount;
- DBVARIANT dbv;
- char setting[80];
-
- profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
+ int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
ttbButtons = ( HANDLE* )realloc(ttbButtons, profileCount*sizeof(HANDLE));
- ZeroMemory(&ttb,sizeof(ttb));
- ZeroMemory(&dbv,sizeof(dbv));
+
+ TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP;
- ttb.hbBitmapDown = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_TTBDOWN));
- ttb.hbBitmapUp = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_TTBUP));
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ICONBYHANDLE;
ttb.pszServiceDown = ttb.pszServiceUp = MS_SS_LOADANDSETPROFILE;
- for (i=0;i<profileCount;i++) {
- char profileName[128];
- INT_PTR ttbAddResult = -1;
-
+ for (int i=0; i < profileCount; i++) {
+ char setting[80];
_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_CREATETTBBUTTON);
- if (!DBGetContactSettingByte(NULL, MODULENAME, setting, FALSE)) continue;
+ if (!DBGetContactSettingByte(NULL, MODULENAME, setting, FALSE))
+ continue;
+
+ DBVARIANT dbv;
_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_PROFILENAME);
- if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv)) continue;
+ if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv))
+ continue;
+
+ char profileName[128];
strncpy(profileName, dbv.pszVal, sizeof(profileName)-1);
ttb.name = profileName;
+ ttb.hIconHandleDn = hTtbDown;
+ ttb.hIconHandleUp = hTtbUp;
ttb.wParamDown = ttb.wParamUp = i;
- ttbAddResult = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0);
+ INT_PTR ttbAddResult = CallService(MS_TTB_ADDBUTTON, (WPARAM)&ttb, 0);
if (ttbAddResult != -1) {
ttbButtons[ttbButtonCount] = (HANDLE)ttbAddResult;
- // this tooltip makes miranda crash if changed > 3 times or so
+
CallService(MS_TTB_SETBUTTONOPTIONS,MAKEWPARAM(TTBO_TIPNAME,ttbButtons[ttbButtonCount]), (LPARAM)profileName);
DBFreeVariant(&dbv);
ttbButtonCount += 1;
@@ -182,10 +181,10 @@ void RegisterButtons()
sid.pszDescription = "Pressed toolbar icon";
sid.iDefaultIndex = -IDI_TTBDOWN;
sid.flags = SIDF_PATH_TCHAR;
- hTtbDown = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ hTtbDown = Skin_AddIcon(&sid);
sid.pszName = "StartupStatus/TtbUp";
sid.pszDescription = "Released toolbar icon";
sid.iDefaultIndex = -IDI_TTBUP;
- hTtbUp = (HANDLE)CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid);
+ hTtbUp = Skin_AddIcon(&sid);
}