[loading window] Should really have included this in the initial design. Now it can be indeterminate too.

This commit is contained in:
Henrik Andersson
2011-06-05 11:32:51 +02:00
parent af62e62b42
commit 167cd9238a
6 changed files with 39 additions and 11 deletions
+4 -1
View File
@@ -47,9 +47,12 @@ LoadingWindow *LoadingWindow::Create()
}
}
if( ret )
if( ret ) {
LOG->Info( "Loading window: %s", Driver.c_str() );
ret->SetIndeterminate(true);
}
return ret;
}
+2
View File
@@ -15,10 +15,12 @@ public:
virtual void SetIcon( const RageSurface *pIcon ) { }
virtual void SetProgress( const int progress ) { m_progress=progress; }
virtual void SetTotalWork( const int totalWork ) { m_totalWork=totalWork; }
virtual void SetIndeterminate( bool indeterminate ) { m_indeterminate=indeterminate; }
protected:
int m_progress;
int m_totalWork;
bool m_indeterminate;
};
extern LoadingWindow *pLoadingWindow;
+19 -6
View File
@@ -110,13 +110,11 @@ INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wPara
(LPARAM) (HANDLE) g_hBitmap );
SetWindowTextA( hWnd, PRODUCT_ID );
{
HWND progressCtrl=GetDlgItem( hWnd, IDC_PROGRESS );
SetWindowLong(progressCtrl,GWL_STYLE, PBS_MARQUEE | GetWindowLong(progressCtrl,GWL_STYLE));
SendMessage(progressCtrl,PBM_SETMARQUEE,1,0);
}
break;
case WM_CLOSE:
return FALSE;
case WM_DESTROY:
DeleteObject( g_hBitmap );
g_hBitmap = NULL;
@@ -229,7 +227,22 @@ void LoadingWindow_Win32::SetTotalWork(const int totalWork)
{
m_totalWork=totalWork;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
::SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork);
SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork);
}
void LoadingWindow_Win32::SetIndeterminate(bool indeterminate) {
m_indeterminate=indeterminate;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
if(indeterminate) {
SetWindowLong(hwndItem,GWL_STYLE, PBS_MARQUEE | GetWindowLong(hwndItem,GWL_STYLE));
SendMessage(hwndItem,PBM_SETMARQUEE,1,0);
} else {
SendMessage(hwndItem,PBM_SETMARQUEE,0,0);
SetWindowLong(hwndItem,GWL_STYLE, (~PBS_MARQUEE) & GetWindowLong(hwndItem,GWL_STYLE));
}
}
/*
@@ -17,6 +17,7 @@ public:
void SetIcon( const RageSurface *pIcon );
void SetProgress( const int progress );
void SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate );
private:
AppInstance handle;