diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-08 18:45:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-08 18:45:11 +0000 |
commit | 929cf4f6f089cc4db4eea16898402120fc812e30 (patch) | |
tree | 67218e5b14923f8021b4406249756bdf1cab232a /plugins/TopToolBar | |
parent | 71defe6c2ba6284e775f2317311e29a77c02b81d (diff) |
default buttons from Clist Nicer+ & Modern
git-svn-id: http://svn.miranda-ng.org/main/trunk@859 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r-- | plugins/TopToolBar/InternalButtons.cpp | 177 | ||||
-rw-r--r-- | plugins/TopToolBar/TopToolBar.vcxproj | 1 | ||||
-rw-r--r-- | plugins/TopToolBar/TopToolBar.vcxproj.filters | 3 | ||||
-rw-r--r-- | plugins/TopToolBar/common.h | 8 | ||||
-rw-r--r-- | plugins/TopToolBar/main.cpp | 30 | ||||
-rw-r--r-- | plugins/TopToolBar/toolbar.cpp | 30 |
6 files changed, 105 insertions, 144 deletions
diff --git a/plugins/TopToolBar/InternalButtons.cpp b/plugins/TopToolBar/InternalButtons.cpp index 4551d55c7d..ccd4c888c2 100644 --- a/plugins/TopToolBar/InternalButtons.cpp +++ b/plugins/TopToolBar/InternalButtons.cpp @@ -5,51 +5,48 @@ #define TTBI_SOUNDSONOFF "TTBInternal/SoundsOnOFF"
#define TTBI_MAINMENUBUTT "TTBInternal/MainMenuBUTT"
-int LoadInternalButtons( HWND );
-int UnLoadInternalButtons();
-
extern HINSTANCE hInst;
-static HANDLE hOnlineBut, hGroupBut, hSoundsBut, hOptionsBut, hMainMenuBut;
-static HANDLE hMinimizeBut;
-static HANDLE hFindUsers;
-
static HWND hwndContactTree;
+struct
+{
+ char *name, *pszService;
+ int iconidUp, iconidDn;
+ char *tooltipUp, *tooltipDn;
+ HANDLE hButton;
+}
+static stdButtons[] =
+{
+ { "Show only Online Users", MS_CLIST_SETHIDEOFFLINE, IDI_SHOWONLINEUP, IDI_SHOWONLINEDN, "Hide Offline Users", "Show All Users" },
+ { "Groups On/Off", TTBI_GROUPSHOWHIDE, IDI_GROUPSUP, IDI_GROUPSDN, "Hide Groups", "Show Groups" },
+ { "Sounds Enable/Disable", TTBI_SOUNDSONOFF, IDI_SOUNDUP, IDI_SOUNDDN, "Disable Sounds", "Enable Sounds" },
+
+ { "Show Options Page", "Options/OptionsCommand", IDI_OPTIONSUP, 0, "Show Options" },
+ { "Minimize Button", MS_CLIST_SHOWHIDE, IDI_MINIMIZEUP, 0, NULL },
+ { "Find/Add Contacts", MS_FINDADD_FINDADD, IDI_FINDADDUP, 0, NULL },
+ { "Show Main Menu", TTBI_MAINMENUBUTT, IDI_MIRANDAUP, 0, "Show Main Menu" }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
int OnSettingChanging(WPARAM wParam, LPARAM lParam)
{
- if (wParam != 0)
- return 0;
-
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
- if (dbcws == NULL)
+ if (wParam != 0 || dbcws == NULL)
return 0;
if ( !strcmp(dbcws->szModule, "CList")) {
- if ( !strcmp(dbcws->szSetting, "HideOffline")) {
- int val = dbcws->value.bVal;
-
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hOnlineBut, (LPARAM)(val)?TTBST_PUSHED:TTBST_RELEASED);
-
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hOnlineBut),
- (LPARAM)((!val)?Translate("Hide Offline Users"):Translate("Show All Users")));
+ if ( !strcmp(dbcws->szSetting, "HideOffline"))
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[0].hButton, (dbcws->value.bVal) ? TTBST_PUSHED : TTBST_RELEASED);
- return 0;
- }
-
- if (!strcmp(dbcws->szSetting, "UseGroups")) {
- int val = dbcws->value.bVal;
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hGroupBut, (LPARAM)((val)?TTBST_PUSHED:TTBST_RELEASED));
- return 0;
- }
+ else if (!strcmp(dbcws->szSetting, "UseGroups"))
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[1].hButton, (dbcws->value.bVal) ? TTBST_PUSHED : TTBST_RELEASED);
}
- if (!strcmp(dbcws->szModule, "Skin")) {
- if (!strcmp(dbcws->szSetting, "UseSound")) {
- int val = dbcws->value.bVal;
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hSoundsBut, (LPARAM)(val)?TTBST_RELEASED:TTBST_PUSHED);
- return 0;
- }
+ else if (!strcmp(dbcws->szModule, "Skin")) {
+ if (!strcmp(dbcws->szSetting, "UseSound"))
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[2].hButton, (dbcws->value.bVal) ? TTBST_RELEASED : TTBST_PUSHED);
}
return 0;
@@ -62,7 +59,6 @@ INT_PTR TTBInternalMainMenuButt(WPARAM wParam, LPARAM lParam) POINT pt;
GetCursorPos(&pt);
TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, 0, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL);
-
return 0;
}
@@ -78,98 +74,47 @@ INT_PTR TTBInternalSoundsOnOff(WPARAM wParam, LPARAM lParam) {
int newVal = !(DBGetContactSettingByte(NULL, "Skin", "UseSound", 1));
DBWriteContactSettingByte(NULL, "Skin", "UseSound", (BYTE)newVal);
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hSoundsBut),
- (LPARAM)((newVal)?Translate("Disable Sounds"):Translate("Enable Sounds")));
return 0;
}
-int UnLoadInternalButtons()
-{
- return 0;
-}
+///////////////////////////////////////////////////////////////////////////////
-int LoadInternalButtons(HWND hwnd)
+int InitInternalButtons(WPARAM, LPARAM)
{
- hwndContactTree = hwnd;
- CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide);
- CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff);
-
- CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt);
+ hwndContactTree = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0);
- int ShowOnline = DBGetContactSettingByte(NULL, "CList", "HideOffline", 0);
- int ShowGroups = DBGetContactSettingByte(NULL, "CList", "UseGroups", 2);
- int SoundsEnabled = DBGetContactSettingByte(NULL, "Skin", "UseSound", 1);
+ CreateServiceFunction(TTBI_GROUPSHOWHIDE, TTBInternalGroupShowHide);
+ CreateServiceFunction(TTBI_SOUNDSONOFF, TTBInternalSoundsOnOff);
+ CreateServiceFunction(TTBI_MAINMENUBUTT, TTBInternalMainMenuButt);
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SHOWONLINEUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SHOWONLINEDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = (ShowOnline?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON|TTBBF_INTERNAL;
- ttb.pszService = MS_CLIST_SETHIDEOFFLINE;
- ttb.wParamUp = ttb.wParamDown = -1;
- ttb.name = "Show only Online Users";
- hOnlineBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- ttb.wParamUp = ttb.wParamDown = 0;
-
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_GROUPSUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_GROUPSDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = (ShowGroups?TTBBF_PUSHED:0)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON|TTBBF_INTERNAL;
- ttb.pszService = TTBI_GROUPSHOWHIDE;
- ttb.name = "Groups On/Off";
- hGroupBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SOUNDUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_SOUNDDN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.dwFlags = (SoundsEnabled?0:TTBBF_PUSHED)|TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_ASPUSHBUTTON|TTBBF_INTERNAL;
- ttb.pszService = TTBI_SOUNDSONOFF;
- ttb.name = "Sounds Enable/Disable";
- hSoundsBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_OPTIONSUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = 0;
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_INTERNAL;
- ttb.pszService = "Options/OptionsCommand";
- ttb.name = "Show Options Page";
- hOptionsBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MINIMIZEUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = 0;
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_INTERNAL;
- ttb.pszService = MS_CLIST_SHOWHIDE;
- ttb.name = "Minimize Button";
- hMinimizeBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_FINDADDUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = 0;
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_INTERNAL;
- ttb.pszService = MS_FINDADD_FINDADD;
- ttb.name = "Find/Add Contacts";
- hFindUsers = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MIRANDAUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
- ttb.hIconDn = 0;
- ttb.dwFlags = TTBBF_VISIBLE|TTBBF_SHOWTOOLTIP|TTBBF_INTERNAL;
- ttb.pszService = TTBI_MAINMENUBUTT;
- ttb.name = "Show Main Menu";
- hMainMenuBut = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
-
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hOnlineBut),
- (LPARAM)((ShowOnline) ? "Hide Offline Users" : "Show All Users" ));
-
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hGroupBut),
- (LPARAM)((ShowGroups) ? "Hide Groups" : "Show Groups" ));
-
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hSoundsBut),
- (LPARAM)((SoundsEnabled) ? "Disable Sounds" : "Enable Sounds" ));
-
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hOptionsBut),
- (LPARAM)"Show Options");
-
- CallService(MS_TTB_SETBUTTONOPTIONS, MAKEWPARAM(TTBO_TIPNAME, hMainMenuBut),
- (LPARAM)"Show Main Menu");
-
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingChanging);
+ for (int i=0; i < SIZEOF(stdButtons); i++) {
+ ttb.name = stdButtons[i].name;
+ ttb.dwFlags = TTBBF_VISIBLE | TTBBF_INTERNAL;
+ if ((ttb.pszTooltipDn = stdButtons[i].tooltipDn) != NULL)
+ ttb.dwFlags |= TTBBF_SHOWTOOLTIP;
+ ttb.pszTooltipUp = stdButtons[i].tooltipUp;
+ ttb.hIconUp = (HICON)LoadImage(hInst, MAKEINTRESOURCE(stdButtons[i].iconidUp), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ if (stdButtons[i].iconidDn) {
+ ttb.dwFlags |= TTBBF_ASPUSHBUTTON;
+ ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(stdButtons[i].iconidDn), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ }
+ else ttb.hIconDn = NULL;
+
+ stdButtons[i].hButton = (HANDLE)TTBAddButton((WPARAM)&ttb, 0);
+ }
+
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[0].hButton,
+ db_get_b(NULL, "CList", "HideOffline", 0) ? TTBST_PUSHED : TTBST_RELEASED);
+
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[1].hButton,
+ db_get_b(NULL, "CList", "UseGroups", 1) ? TTBST_PUSHED : TTBST_RELEASED);
+
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)stdButtons[2].hButton,
+ db_get_b(NULL, "Skin", "UseSound", 1) ? TTBST_RELEASED : TTBST_PUSHED);
+
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanging);
return 0;
}
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj b/plugins/TopToolBar/TopToolBar.vcxproj index 74af8839cf..978fc4bfcc 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj +++ b/plugins/TopToolBar/TopToolBar.vcxproj @@ -237,6 +237,7 @@ </Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClInclude Include="..\ExternalAPI\m_toptoolbar.h" />
<ClInclude Include="BkgrCfg.h" />
<ClInclude Include="common.h" />
<ClInclude Include="resource.h" />
diff --git a/plugins/TopToolBar/TopToolBar.vcxproj.filters b/plugins/TopToolBar/TopToolBar.vcxproj.filters index e6f6451e3c..fca64531d0 100644 --- a/plugins/TopToolBar/TopToolBar.vcxproj.filters +++ b/plugins/TopToolBar/TopToolBar.vcxproj.filters @@ -24,6 +24,9 @@ <ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\ExternalAPI\m_toptoolbar.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="icos\Find_Add Contacts_UP.ico">
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 3ce3807d57..1e14548c0e 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -34,7 +34,6 @@ #include "m_icolib.h"
#include "BkgrCfg.h"
-#define TTB_OPTDIR "TopToolBar"
#define TTBDEFAULT_BKBMPUSE CLB_STRETCH
#define TTBDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE)
#define TTBDEFAULT_USEBITMAP 0
@@ -79,6 +78,9 @@ struct TopButtonInt WPARAM wParamUp;
LPARAM lParamDown;
WPARAM wParamDown;
+
+ int hLangpack;
+ char *szTooltipUp, *szTooltipDn;
};
///////////////////////////////////////////////////////////////////////////////
@@ -102,7 +104,6 @@ int ArrangeButtons(); extern LIST<TopButtonInt> Buttons;
extern bool StopArrange;
extern HWND hwndTopToolBar;
-extern HANDLE hHookTTBModuleLoaded;
extern HINSTANCE hInst;
extern HBITMAP hBmpBackground, hBmpSeparator;
extern int BUTTWIDTH, BUTTHEIGHT, BUTTGAP;
@@ -126,8 +127,7 @@ char *AS(char *str, const char *setting, char *addstr) INT_PTR TTBAddButton(WPARAM, LPARAM);
INT_PTR TTBRemoveButton(WPARAM, LPARAM);
-int LoadInternalButtons( HWND );
-int UnLoadInternalButtons( void );
+int InitInternalButtons(WPARAM, LPARAM);
int LoadToolbarModule( void );
int UnloadToolbarModule( void );
diff --git a/plugins/TopToolBar/main.cpp b/plugins/TopToolBar/main.cpp index 7eb6c653f2..601de36408 100644 --- a/plugins/TopToolBar/main.cpp +++ b/plugins/TopToolBar/main.cpp @@ -3,20 +3,8 @@ #include "version.h"
HINSTANCE hInst;
-
-HANDLE hHookTTBModuleLoaded;
int hLangpack;
-#define MIID_TTB {0xf593c752, 0x51d8, 0x4d46, {0xba, 0x27, 0x37, 0x57, 0x79, 0x53, 0xf5, 0x5c}}
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
@@ -27,8 +15,8 @@ PLUGININFOEX pluginInfo = __PLUGIN_EMAIL,
__PLUGIN_RIGHTS,
__PLUGIN_AUTHORWEB,
- UNICODE_AWARE, //doesn't replace anything built-in
- MIID_TTB
+ UNICODE_AWARE,
+ {0xf593c752, 0x51d8, 0x4d46, {0xba, 0x27, 0x37, 0x57, 0x79, 0x53, 0xf5, 0x5c}}
};
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
@@ -40,12 +28,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
LoadToolbarModule();
-
- hHookTTBModuleLoaded = CreateHookableEvent(ME_TTB_MODULELOADED);
return 0;
}
@@ -53,9 +38,14 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
- UnLoadInternalButtons();
UnloadToolbarModule();
-
- DestroyHookableEvent(hHookTTBModuleLoaded);
return 0;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ hInst = hinstDLL;
+ return TRUE;
+}
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp index 44d2e537b5..6d41d19aff 100644 --- a/plugins/TopToolBar/toolbar.cpp +++ b/plugins/TopToolBar/toolbar.cpp @@ -1,6 +1,8 @@ #include "common.h"
+#define OLD_TBBUTTON_SIZE (offsetof(TTBButton, pszTooltipUp))
+
pfnCustomProc g_CustomProc = NULL;
LPARAM g_CustomProcParam = 0;
@@ -14,6 +16,8 @@ int BUTTGAP; int nextButtonId = 200;
+static HANDLE hTTBModuleLoaded, hTTBInitButtons;
+
//------------ options -------------
COLORREF bkColour;
HBITMAP hBmpBackground, hBmpSeparator;
@@ -281,6 +285,11 @@ TopButtonInt* CreateButton(TTBButton* but) sprintf(buf, "%s_dn", b->name);
b->hIconDn = LoadIconFromLibrary(buf, b->hIconDn, b->hIconHandleDn);
}
+
+ if (but->cbSize > OLD_TBBUTTON_SIZE) {
+ b->szTooltipUp = but->pszTooltipUp;
+ b->szTooltipDn = but->pszTooltipDn;
+ }
}
return b;
}
@@ -301,7 +310,10 @@ INT_PTR TTBAddButton(WPARAM wParam, LPARAM lParam) mir_cslock lck(csButtonsHook);
TTBButton *but = (TTBButton*)wParam;
- if (but->cbSize != sizeof(TTBButton) || (!(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name)))
+ if (but->cbSize != sizeof(TTBButton) && but->cbSize != OLD_TBBUTTON_SIZE)
+ return -1;
+
+ if ( !(but->dwFlags && TTBBF_ISLBUTTON) && nameexists(but->name))
return -1;
b = CreateButton(but);
@@ -754,11 +766,15 @@ static INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam) {
CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0);
StopArrange = FALSE;
- NotifyEventHooks(hHookTTBModuleLoaded, 0, 0);
+ NotifyEventHooks(hTTBInitButtons, 0, 0);
+ NotifyEventHooks(hTTBModuleLoaded, 0, 0);
if (g_CustomProc) {
mir_cslock lck(csButtonsHook);
+ if (hwndTopToolBar)
+ g_CustomProc(TTB_WINDOW_HANDLE, hwndTopToolBar, g_CustomProcParam);
+
for (int i=0; i < Buttons.getCount(); i++) {
TopButtonInt* p = Buttons[i];
g_CustomProc((HANDLE)p->id, p->hwnd, g_CustomProcParam);
@@ -800,7 +816,6 @@ int OnModulesLoad(WPARAM wParam, LPARAM lParam) hwndContactList = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
hFrameTopWindow = addTopToolBarWindow(hwndContactList);
- LoadInternalButtons(( HWND )CallService(MS_CLUI_GETHWNDTREE, 0, 0));
LoadAllSeparators();
LoadAllLButs();
@@ -834,7 +849,11 @@ int LoadToolbarModule() HookEvent(ME_SKIN2_ICONSCHANGED, OnIconChange);
HookEvent(ME_OPT_INITIALISE, TTBOptInit);
- CreateServiceFunction(MS_TTB_ADDBUTTON, TTBAddButton);
+ hTTBModuleLoaded = CreateHookableEvent(ME_TTB_MODULELOADED);
+ hTTBInitButtons = CreateHookableEvent(ME_TTB_INITBUTTONS);
+ SetHookDefaultForHookableEvent(hTTBInitButtons, InitInternalButtons);
+
+ CreateServiceFunction("TopToolBar/AddButton", TTBAddButton);
CreateServiceFunction(MS_TTB_REMOVEBUTTON, TTBRemoveButton);
CreateServiceFunction(MS_TTB_SETBUTTONSTATE, TTBSetState);
@@ -858,6 +877,9 @@ int LoadToolbarModule() int UnloadToolbarModule()
{
+ DestroyHookableEvent(hTTBModuleLoaded);
+ DestroyHookableEvent(hTTBInitButtons);
+
DeleteObject(hBmpSeparator);
DeleteCriticalSection(&csButtonsHook);
|