diff options
Diffstat (limited to 'plugins/TopToolBar/toolbar.cpp')
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 118 |
1 files changed, 60 insertions, 58 deletions
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 81bacd8916..5999e34ca3 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -65,8 +65,7 @@ void InsertSBut(int i) ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE|TTBBF_ISSBUTTON|TTBBF_INTERNAL;
ttb.wParamDown = i;
- ttb.lParamDown = TTBAddButton(( WPARAM )&ttb, 0);;
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_ALLDATA, ttb.lParamDown), (LPARAM)&ttb);
+ TTBAddButton(( WPARAM )&ttb, 0);
}
void LoadAllSButs()
@@ -100,13 +99,11 @@ void InsertLBut(int i) TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
-// ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL;
ttb.name = LPGEN("Default");
ttb.program = _T("Execute Path");
ttb.wParamDown = i;
- ttb.lParamDown = TTBAddButton(( WPARAM )&ttb, 0);
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_ALLDATA, ttb.lParamDown), (LPARAM)&ttb);
+ TTBAddButton(( WPARAM )&ttb, 0);
}
void LoadAllLButs()
@@ -125,8 +122,7 @@ void InsertSeparator(int i) ttb.cbSize = sizeof(ttb);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISSEPARATOR | TTBBF_INTERNAL;
ttb.wParamDown = i;
- ttb.lParamDown = TTBAddButton((WPARAM)&ttb, 0);
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_ALLDATA, ttb.lParamDown), (LPARAM)&ttb);
+ TTBAddButton((WPARAM)&ttb, 0);
}
void LoadAllSeparators()
@@ -239,69 +235,51 @@ int RecreateWindows() return (0);
}
-INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam)
+TopButtonInt* CreateButton(TTBButton* but)
{
- if (wParam == 0)
- return -1;
-
- if (hwndContactList == 0)
- hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
- //oops clui even now not loaded...sorry no buttons available
- if (hwndContactList == 0)
- return -1;
-
- lockbut();
-
- TTBButton *but = (TTBButton*)wParam;
- if ((but->cbSize != sizeof(TTBButton)) ||
- (!(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))) {
- ulockbut();
- return -1;
- }
-
TopButtonInt* b = new TopButtonInt;
b->id = nextButtonId++;
-
- if (but->dwFlags & TTBBF_ISLBUTTON) {
- if (but->program != NULL)
- b->program = _tcsdup(but->program);
- b->pszService = _strdup(TTB_LAUNCHSERVICE);
- }
- else {
- b->program = NULL;
- if (but->pszService != NULL)
- b->pszService = _strdup(but->pszService);
- else
- b->pszService = NULL;
- }
-
- if (but->name != NULL)
- b->name = _strdup(but->name);
- else
- b->name = NULL;
b->dwFlags = but->dwFlags;
- if (b->dwFlags & TTBBF_ICONBYHANDLE) {
- if (but->hIconHandleDn)
- b->hIconDn = Skin_GetIconByHandle(but->hIconHandleDn);
- else
- b->hIconDn = 0;
- b->hIconUp = Skin_GetIconByHandle(but->hIconHandleUp);
- }
- else {
- b->hIconDn = but->hIconDn;
- b->hIconUp = but->hIconUp;
- }
-
b->wParamUp = but->wParamUp;
b->lParamUp = but->lParamUp;
b->wParamDown = but->wParamDown;
b->lParamDown = but->lParamDown;
- b->bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
-
if ( !(b->dwFlags & TTBBF_ISSEPARATOR)) {
+ b->bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
+
+ if (but->dwFlags & TTBBF_ISLBUTTON) {
+ if (but->program != NULL)
+ b->program = _tcsdup(but->program);
+ b->pszService = _strdup(TTB_LAUNCHSERVICE);
+ }
+ else {
+ b->program = NULL;
+ if (but->pszService != NULL)
+ b->pszService = _strdup(but->pszService);
+ else
+ b->pszService = NULL;
+ }
+
+ if (but->name != NULL)
+ b->name = _strdup(but->name);
+ else
+ b->name = NULL;
+
+ if (b->dwFlags & TTBBF_ICONBYHANDLE) {
+ if (but->hIconHandleDn)
+ b->hIconDn = Skin_GetIconByHandle(but->hIconHandleDn);
+ else
+ b->hIconDn = 0;
+ b->hIconUp = Skin_GetIconByHandle(but->hIconHandleUp);
+ }
+ else {
+ b->hIconDn = but->hIconDn;
+ b->hIconUp = but->hIconUp;
+ }
+
char buf[256];
sprintf(buf, "%s_up", b->name);
b->hIconUp = LoadIconFromLibrary(buf, b->hIconUp, b->hIconHandleUp);
@@ -310,6 +288,30 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) b->hIconDn = LoadIconFromLibrary(buf, b->hIconDn, b->hIconHandleDn);
}
}
+ return b;
+}
+
+INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam == 0)
+ return -1;
+
+ if (hwndContactList == 0)
+ hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
+ //oops clui even now not loaded...sorry no buttons available
+ if (hwndContactList == 0)
+ return -1;
+
+ lockbut();
+
+ TTBButton *but = (TTBButton*)wParam;
+ if ((but->cbSize != sizeof(TTBButton)) ||
+ (!(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))) {
+ ulockbut();
+ return -1;
+ }
+
+ TopButtonInt* b = CreateButton(but);
b->LoadSettings();
Buttons.insert(b);
|