OSDN Git Service

Some code clean-up + removed a debug output.
[mutilities/MUtilities.git] / src / Utils_Win32.h
index f074410..d6e0bfe 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // MuldeR's Utilities for Qt
-// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 
 #pragma once
 
-//Win32 API
-#ifndef _INC_WINDOWS
-#define WIN32_LEAN_AND_MEAN 1
-#include <Windows.h>
-#endif //_INC_WINDOWS
+#include <stdint.h>
+#include <MUtils/Global.h>
+class QIcon;
 
-///////////////////////////////////////////////////////////////////////////////
-// QICON TO HICON
-///////////////////////////////////////////////////////////////////////////////
-
-static HICON qicon_to_hicon(const QIcon &icon, const int w, const int h)
+namespace MUtils
 {
-       if(!icon.isNull())
+       namespace Win32Utils
        {
-               QPixmap pixmap = icon.pixmap(w, h);
-               if(!pixmap.isNull())
+               uintptr_t qicon_to_hicon(const QIcon &icon, const int w, const int h);
+               const uintptr_t &resolve_helper(const QString &libraryName, const QString &functionName);
+
+               template<class T>
+               T resolve(const QString &libraryName, const QString &functionName)
                {
-                       return pixmap.toWinHICON();
+                       return reinterpret_cast<T>(resolve_helper(libraryName, functionName));
                }
        }
-       return NULL;
 }