summaryrefslogtreecommitdiff
path: root/plugins/Quotes/src/ExtraImages.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-28 18:45:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-28 18:45:54 +0000
commita70382b0e8bed265a1d314d9f6aae8f2dd48d20b (patch)
tree9a99a073c0d7b9483dab51a0eebf04a9119f61ed /plugins/Quotes/src/ExtraImages.cpp
parent68fb5b69ea8403a3f9dcb70b3133eb10e1711000 (diff)
ex-protos moved to the Plugins folder
git-svn-id: http://svn.miranda-ng.org/main/trunk@2545 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes/src/ExtraImages.cpp')
-rw-r--r--plugins/Quotes/src/ExtraImages.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp
new file mode 100644
index 0000000000..a89032e53c
--- /dev/null
+++ b/plugins/Quotes/src/ExtraImages.cpp
@@ -0,0 +1,67 @@
+#include "StdAfx.h"
+#include "ExtraImages.h"
+#include "IconLib.h"
+#include "EconomicRateInfo.h"
+#include "ModuleInfo.h"
+#include "QuotesProviders.h"
+#include "IQuotesProvider.h"
+#include "Log.h"
+#include "DBUtils.h"
+#include "resource.h"
+
+CExtraImages::CExtraImages() :
+ m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
+ m_bExtraImagesInit(false)
+{
+ m_ahExtraImages[eiUp] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiDown] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiNotChanged] = INVALID_HANDLE_VALUE;
+}
+
+CExtraImages::~CExtraImages()
+{
+}
+
+CExtraImages& CExtraImages::GetInstance()
+{
+ static CExtraImages s_ei;
+ return s_ei;
+}
+
+void CExtraImages::RebuildExtraImages()
+{
+}
+
+bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const
+{
+ if (!m_hExtraIcons)
+ return false;
+
+ HANDLE hIcolib;
+ switch(nIndex) {
+ case eiUp:
+ hIcolib = Quotes_GetIconHandle(IDI_ICON_UP);
+ break;
+ case eiDown:
+ hIcolib = Quotes_GetIconHandle(IDI_ICON_DOWN);
+ break;
+ case eiNotChanged:
+ hIcolib = Quotes_GetIconHandle(IDI_ICON_NOTCHANGED);
+ break;
+ default:
+ hIcolib = NULL;
+ }
+ return ExtraIcon_SetIcon(m_hExtraIcons, hContact, hIcolib) == 0;
+}
+
+int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
+{
+ HANDLE hContact = reinterpret_cast<HANDLE>(wp);
+
+ const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
+ CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
+ if(pProvider)
+ pProvider->SetContactExtraIcon(hContact);
+
+ return 0;
+}