LoadingWindow::SetIcon

This commit is contained in:
Glenn Maynard
2005-02-07 08:57:13 +00:00
parent cd7b71ebd7
commit ca3e1ef9ff
3 changed files with 27 additions and 8 deletions
@@ -3,6 +3,7 @@
#ifndef LOADING_WINDOW_H #ifndef LOADING_WINDOW_H
#define LOADING_WINDOW_H #define LOADING_WINDOW_H
struct RageSurface;
class LoadingWindow class LoadingWindow
{ {
public: public:
@@ -11,6 +12,7 @@ public:
virtual void Paint() = 0; virtual void Paint() = 0;
virtual void SetText(CString str) { } virtual void SetText(CString str) { }
virtual void SetIcon( const RageSurface *pIcon ) { }
}; };
#endif #endif
@@ -4,6 +4,7 @@
#include "LoadingWindow_Win32.h" #include "LoadingWindow_Win32.h"
#include "RageFileManager.h" #include "RageFileManager.h"
#include "archutils/win32/WindowsResources.h" #include "archutils/win32/WindowsResources.h"
#include "archutils/win32/WindowIcon.h"
#include <windows.h> #include <windows.h>
#include "RageSurface_Load.h" #include "RageSurface_Load.h"
#include "RageSurface.h" #include "RageSurface.h"
@@ -70,8 +71,19 @@ BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
return FALSE; 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() LoadingWindow_Win32::LoadingWindow_Win32()
{ {
m_hIcon = NULL;
hwnd = CreateDialog(handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc); hwnd = CreateDialog(handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc);
for( unsigned i = 0; i < 3; ++i ) for( unsigned i = 0; i < 3; ++i )
text[i] = "ABC"; /* always set on first call */ text[i] = "ABC"; /* always set on first call */
@@ -83,6 +95,8 @@ LoadingWindow_Win32::~LoadingWindow_Win32()
{ {
if( hwnd ) if( hwnd )
DestroyWindow( hwnd ); DestroyWindow( hwnd );
if( m_hIcon != NULL )
DestroyIcon( m_hIcon );
} }
void LoadingWindow_Win32::Paint() void LoadingWindow_Win32::Paint()
@@ -7,20 +7,23 @@
#include <windows.h> #include <windows.h>
#include "../../archutils/Win32/AppInstance.h" #include "../../archutils/Win32/AppInstance.h"
class LoadingWindow_Win32: public LoadingWindow { class LoadingWindow_Win32: public LoadingWindow
AppInstance handle; {
HWND hwnd;
CString text[3];
static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
public: public:
LoadingWindow_Win32(); LoadingWindow_Win32();
~LoadingWindow_Win32(); ~LoadingWindow_Win32();
void SetText(CString str); void SetText(CString str);
void Paint(); 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 #define HAVE_LOADING_WINDOW_WIN32