Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/ghost/CMakeLists.txt1
-rw-r--r--intern/ghost/intern/GHOST_TaskbarWin32.h73
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp48
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.h25
4 files changed, 147 insertions, 0 deletions
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index da26b74880f..b77236acf41 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -153,6 +153,7 @@ elseif(WIN32)
intern/GHOST_SystemWin32.h
intern/GHOST_SystemPathsWin32.h
intern/GHOST_WindowWin32.h
+ intern/GHOST_TaskbarWin32.h
)
endif()
diff --git a/intern/ghost/intern/GHOST_TaskbarWin32.h b/intern/ghost/intern/GHOST_TaskbarWin32.h
new file mode 100644
index 00000000000..26e6a80c8e8
--- /dev/null
+++ b/intern/ghost/intern/GHOST_TaskbarWin32.h
@@ -0,0 +1,73 @@
+#ifndef GHOST_TASKBARWIN32_H_
+#define GHOST_TASKBARWIN32_H_
+#ifndef WIN32
+#error WIN32 only!
+#endif // WIN32
+
+#include <windows.h>
+#include <shlobj.h>
+
+/* MinGW needs it */
+#ifdef FREE_WINDOWS
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
+#endif /* FREE_WINDOWS */
+
+// ITaskbarList, ITaskbarList2 and ITaskbarList3 might be missing, present here in that case.
+// Note, ITaskbarList3 is supported only since Windows 7, though. Check for that is done in
+// GHOST_WindowWin32
+#ifndef __ITaskbarList_INTERFACE_DEFINED__
+#define __ITaskbarList_INTERFACE_DEFINED__
+ extern "C" {const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} };
+ const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} }; }
+ class ITaskbarList : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE HrInit (void) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddTab (HWND hwnd) = 0;
+ virtual HRESULT STDMETHODCALLTYPE DeleteTab (HWND hwnd) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ActivateTab (HWND hwnd) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetActiveAlt (HWND hwnd) = 0;
+ };
+#endif /* ITaskbarList */
+
+#ifndef __ITaskbarList2_INTERFACE_DEFINED__
+#define __ITaskbarList2_INTERFACE_DEFINED__
+ extern "C" {const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17} }; }
+ class ITaskbarList2 : public ITaskbarList
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen) = 0;
+ };
+#endif /* ITaskbarList2 */
+
+#ifndef __ITaskbarList3_INTERFACE_DEFINED__
+#define __ITaskbarList3_INTERFACE_DEFINED__
+typedef enum THUMBBUTTONFLAGS {THBF_ENABLED = 0, THBF_DISABLED = 0x1, THBF_DISMISSONCLICK = 0x2, THBF_NOBACKGROUND = 0x4, THBF_HIDDEN = 0x8, THBF_NONINTERACTIVE = 0x10} THUMBBUTTONFLAGS;
+typedef enum THUMBBUTTONMASK {THB_BITMAP = 0x1, THB_ICON = 0x2, THB_TOOLTIP = 0x4, THB_FLAGS = 0x8} THUMBBUTTONMASK;
+typedef struct THUMBBUTTON {THUMBBUTTONMASK dwMask; UINT iId; UINT iBitmap; HICON hIcon; WCHAR szTip[260]; THUMBBUTTONFLAGS dwFlags; } THUMBBUTTON;
+typedef enum TBPFLAG {TBPF_NOPROGRESS = 0, TBPF_INDETERMINATE = 0x1, TBPF_NORMAL = 0x2, TBPF_ERROR = 0x4, TBPF_PAUSED = 0x8 } TBPFLAG;
+#define THBN_CLICKED 0x1800
+ extern "C" {const GUID IID_ITaskList3 = { 0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF} };}
+
+ class ITaskbarList3 : public ITaskbarList2
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE SetProgressValue (HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetProgressState (HWND hwnd, TBPFLAG tbpFlags) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RegisterTab (HWND hwndTab, HWND hwndMDI) = 0;
+ virtual HRESULT STDMETHODCALLTYPE UnregisterTab (HWND hwndTab) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetTabOrder (HWND hwndTab, HWND hwndInsertBefore) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetTabActive (HWND hwndTab, HWND hwndMDI, DWORD dwReserved) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ThumbBarAddButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ThumbBarUpdateButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList (HWND hwnd, HIMAGELIST himl) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon (HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip (HWND hwnd, LPCWSTR pszTip) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip (HWND hwnd, RECT *prcClip) = 0;
+ };
+#endif /* ITaskbarList3 */
+
+#endif /*GHOST_TASKBARWIN32_H_*/
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 36f5c5d1fba..11c6ab01287 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -139,6 +139,26 @@ GHOST_WindowWin32::GHOST_WindowWin32(
m_stereo(stereoVisual),
m_nextWindow(NULL)
{
+ OSVERSIONINFOEX versionInfo;
+ bool hasMinVersionForTaskbar = false;
+
+ ZeroMemory(&versionInfo, sizeof(OSVERSIONINFOEX));
+
+ versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+
+ if(!GetVersionEx((OSVERSIONINFO *)&versionInfo)) {
+ versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ if(GetVersionEx((OSVERSIONINFO*)&versionInfo)) {
+ if(versionInfo.dwMajorVersion>=6 && versionInfo.dwMinorVersion>=1) {
+ hasMinVersionForTaskbar = true;
+ }
+ }
+ } else {
+ if(versionInfo.dwMajorVersion>=6 && versionInfo.dwMinorVersion>=1) {
+ hasMinVersionForTaskbar = true;
+ }
+ }
+
if (state != GHOST_kWindowStateFullScreen) {
RECT rect;
MONITORINFO monitor;
@@ -308,11 +328,22 @@ GHOST_WindowWin32::GHOST_WindowWin32(
}
}
}
+
+ if(hasMinVersionForTaskbar)
+ CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList ,(LPVOID*)&m_Bar);
+ else
+ m_Bar=NULL;
}
GHOST_WindowWin32::~GHOST_WindowWin32()
{
+ if(m_Bar)
+ {
+ m_Bar->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
+ m_Bar->Release();
+ };
+
if (m_wintab) {
GHOST_WIN32_WTClose fpWTClose = ( GHOST_WIN32_WTClose ) ::GetProcAddress( m_wintab, "WTClose" );
if (fpWTClose) {
@@ -1103,6 +1134,23 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
}
+GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress)
+{
+ /*SetProgressValue sets state to TBPF_NORMAL automaticly*/
+ if(m_Bar && S_OK == m_Bar->SetProgressValue(m_hWnd,10000*progress,10000))
+ return GHOST_kSuccess;
+
+ return GHOST_kFailure;
+}
+
+GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
+{
+ if(m_Bar && S_OK == m_Bar->SetProgressState(m_hWnd,TBPF_NOPROGRESS))
+ return GHOST_kSuccess;
+
+ return GHOST_kFailure;
+}
+
/* Ron Fosner's code for weighting pixel formats and forcing software.
See http://www.opengl.org/resources/faq/technical/weight.cpp */
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index a4d31f87ffa..c3b7fdbd3f3 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -39,7 +39,18 @@
#include "GHOST_Window.h"
+/* MinGW needs it */
+#ifdef FREE_WINDOWS
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
+#endif
+
+
+
#include <windows.h>
+#include "GHOST_TaskbarWin32.h"
#include <wintab.h>
@@ -218,6 +229,17 @@ public:
virtual GHOST_TSuccess invalidate();
/**
+ * Sets the progress bar value displayed in the window/application icon
+ * @param progress The progress %
+ */
+ virtual GHOST_TSuccess setProgressBar(float progress);
+
+ /**
+ * Hides the progress bar in the icon
+ */
+ virtual GHOST_TSuccess endProgressBar();
+
+ /**
* Returns the name of the window class.
* @return The name of the window class.
*/
@@ -324,6 +346,9 @@ protected:
/** HCURSOR structure of the custom cursor */
HCURSOR m_customCursor;
+ /** ITaskbarList3 structure for progress bar*/
+ ITaskbarList3 * m_Bar;
+
static LPCSTR s_windowClassName;
static const int s_maxTitleLength;