diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow.h b/stepmania/src/arch/LoadingWindow/LoadingWindow.h index faa6144946..2f3128bff4 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow.h @@ -3,6 +3,7 @@ #ifndef LOADING_WINDOW_H #define LOADING_WINDOW_H +struct RageSurface; class LoadingWindow { public: @@ -11,6 +12,7 @@ public: virtual void Paint() = 0; virtual void SetText(CString str) { } + virtual void SetIcon( const RageSurface *pIcon ) { } }; #endif diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp index 633701a088..587d7f1831 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp @@ -4,6 +4,7 @@ #include "LoadingWindow_Win32.h" #include "RageFileManager.h" #include "archutils/win32/WindowsResources.h" +#include "archutils/win32/WindowIcon.h" #include #include "RageSurface_Load.h" #include "RageSurface.h" @@ -70,8 +71,19 @@ BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam, return FALSE; } +void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon ) +{ + if( m_hIcon != NULL ) + DestroyIcon( m_hIcon ); + + m_hIcon = IconFromSurface( pIcon ); + if( m_hIcon != NULL ) + SetClassLong( hwnd, GCL_HICON, (LONG) m_hIcon ); +} + LoadingWindow_Win32::LoadingWindow_Win32() { + m_hIcon = NULL; hwnd = CreateDialog(handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc); for( unsigned i = 0; i < 3; ++i ) text[i] = "ABC"; /* always set on first call */ @@ -83,6 +95,8 @@ LoadingWindow_Win32::~LoadingWindow_Win32() { if( hwnd ) DestroyWindow( hwnd ); + if( m_hIcon != NULL ) + DestroyIcon( m_hIcon ); } void LoadingWindow_Win32::Paint() diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h index d46627e44f..13cb28fc03 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h @@ -7,20 +7,23 @@ #include #include "../../archutils/Win32/AppInstance.h" -class LoadingWindow_Win32: public LoadingWindow { - AppInstance handle; - HWND hwnd; - CString text[3]; - - static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); - +class LoadingWindow_Win32: public LoadingWindow +{ public: - LoadingWindow_Win32(); ~LoadingWindow_Win32(); void SetText(CString str); void Paint(); + void SetIcon( const RageSurface *pIcon ); + +private: + AppInstance handle; + HWND hwnd; + CString text[3]; + HICON m_hIcon; + + static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); }; #define HAVE_LOADING_WINDOW_WIN32