summaryrefslogtreecommitdiff
path: root/plugins/NewsAggregator/Src/Services.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-01-08 17:20:59 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-01-08 17:20:59 +0000
commitfefdc28f87152a94fc7397ebb00242b3ba15a286 (patch)
treefdc2252fe464dd635c74371e9a95c9624ed9cbdf /plugins/NewsAggregator/Src/Services.cpp
parent78f6d722ee8157e6d7ae01bc89e2b470a4d96bf2 (diff)
added toptoolbar support
git-svn-id: http://svn.miranda-ng.org/main/trunk@3018 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Services.cpp')
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp
index cecba97960..c16222014a 100644
--- a/plugins/NewsAggregator/Src/Services.cpp
+++ b/plugins/NewsAggregator/Src/Services.cpp
@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA.
int g_nStatus = ID_STATUS_ONLINE;
UINT_PTR timerId = 0;
+HANDLE hTBButton = NULL;
void SetContactStatus(HANDLE hContact, int nNewStatus)
{
@@ -58,6 +59,8 @@ int NewsAggrInit(WPARAM wParam, LPARAM lParam)
InitIcons();
InitMenu();
+ HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded);
+
// timer for the first update
timerId = SetTimer(NULL, 0, 5000, timerProc2); // first update is 5 sec after load
@@ -258,6 +261,7 @@ void UpdateMenu(BOOL State)
mi.flags = CMIM_ICON | CMIM_NAME | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hService2[0], (LPARAM)&mi);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : TTBST_RELEASED);
db_set_b(NULL, MODULE, "AutoUpdate", !State);
}
@@ -267,3 +271,18 @@ INT_PTR EnableDisable(WPARAM wParam, LPARAM lParam)
UpdateMenu(db_get_b(NULL, MODULE, "AutoUpdate", 1));
return 0;
}
+
+INT_PTR OnToolbarLoaded(WPARAM wParam, LPARAM lParam)
+{
+ TTBButton tbb = {0};
+ tbb.cbSize = sizeof(TTBButton);
+ tbb.name = LPGEN("Enable/disable auto update");
+ tbb.pszService = MS_NEWSAGGREGATOR_ENABLED;
+ tbb.pszTooltipUp = LPGEN("Auto Update Enabled");
+ tbb.pszTooltipDn = LPGEN("Auto Update Disabled");
+ tbb.hIconHandleUp = GetIconHandle("enabled");
+ tbb.hIconHandleDn = GetIconHandle("disabled");
+ tbb.dwFlags = (db_get_b(NULL, MODULE, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE;
+ hTBButton = TopToolbar_AddButton(&tbb);
+ return 0;
+} \ No newline at end of file