use white background for header text and icon

This commit is contained in:
Chris Danford
2006-02-23 20:03:10 +00:00
parent 732bd2a29a
commit 6205025e9e
2 changed files with 76 additions and 55 deletions
@@ -631,7 +631,7 @@ public:
~CrashDialog(); ~CrashDialog();
protected: protected:
virtual bool HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ); virtual BOOL HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam );
private: private:
void SetDialogInitial(); void SetDialogInitial();
@@ -665,7 +665,7 @@ void CrashDialog::SetDialogInitial()
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true ); ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
} }
bool CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
{ {
HWND hDlg = GetHwnd(); HWND hDlg = GetHwnd();
@@ -676,6 +676,27 @@ bool CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
DialogUtil::SetHeaderFont( hDlg, IDC_STATIC_HEADER_TEXT ); DialogUtil::SetHeaderFont( hDlg, IDC_STATIC_HEADER_TEXT );
return TRUE; return TRUE;
case WM_CTLCOLORSTATIC:
{
HDC hdc = (HDC)wParam;
HWND hwndStatic = (HWND)lParam;
HBRUSH hbr = NULL;
// TODO: Change any attributes of the DC here
switch( GetDlgCtrlID(hwndStatic) )
{
case IDC_STATIC_HEADER_TEXT:
case IDC_STATIC_ICON:
hbr = (HBRUSH)::GetStockObject(WHITE_BRUSH);
SetBkMode( hdc, OPAQUE );
SetBkColor( hdc, RGB(255,255,255) );
break;
}
// TODO: Return a different brush if the default is not desired
return (BOOL)hbr;
}
case WM_COMMAND: case WM_COMMAND:
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
@@ -741,68 +762,68 @@ bool CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
} }
break; break;
case WM_TIMER: case WM_TIMER:
{
if( m_pPost == NULL )
break;
float fProgress = m_pPost->GetProgress();
SendDlgItemMessage( hDlg, IDC_PROGRESS, PBM_SETPOS, int(fProgress*100), 0 );
if( m_pPost->IsFinished() )
{ {
KillTimer( hDlg, 0 ); if( m_pPost == NULL )
break;
/* Grab the result, which is the data output from the HTTP request. It's float fProgress = m_pPost->GetProgress();
* simple XML. */ SendDlgItemMessage( hDlg, IDC_PROGRESS, PBM_SETPOS, int(fProgress*100), 0 );
RString sResult = m_pPost->GetResult();
RString sError = m_pPost->GetError();
if( sError.empty() && sResult.empty() )
sError = "No data received";
SAFE_DELETE( m_pPost ); if( m_pPost->IsFinished() )
XNode xml;
if( sError.empty() )
{ {
PARSEINFO pi; KillTimer( hDlg, 0 );
xml.Load( sResult, &pi );
if( pi.error_occur ) /* Grab the result, which is the data output from the HTTP request. It's
* simple XML. */
RString sResult = m_pPost->GetResult();
RString sError = m_pPost->GetError();
if( sError.empty() && sResult.empty() )
sError = "No data received";
SAFE_DELETE( m_pPost );
XNode xml;
if( sError.empty() )
{ {
sError = ssprintf( "Error parsing response: %s", pi.error_string.c_str() ); PARSEINFO pi;
xml.Clear(); xml.Load( sResult, &pi );
if( pi.error_occur )
{
sError = ssprintf( "Error parsing response: %s", pi.error_string.c_str() );
xml.Clear();
}
} }
}
int iID; int iID;
if( !sError.empty() ) if( !sError.empty() )
{ {
/* On error, don't show the "report" button again. If the submission was actually /* On error, don't show the "report" button again. If the submission was actually
* successful, then it'd be too easy to accidentally spam the server by holding * successful, then it'd be too easy to accidentally spam the server by holding
* down the button. */ * down the button. */
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() ); SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
} }
else if( xml.GetAttrValue("UpdateAvailable", m_sUpdateURL) ) else if( xml.GetAttrValue("UpdateAvailable", m_sUpdateURL) )
{ {
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue() ); SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue() ); SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue() );
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true ); ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
} }
else if( xml.GetAttrValue("ReportId", iID) ) else if( xml.GetAttrValue("ReportId", iID) )
{ {
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue() ); SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_RESULT_ID), ssprintf("#%i", iID) ); SetWindowText( GetDlgItem(hDlg, IDC_RESULT_ID), ssprintf("#%i", iID) );
ShowWindow( GetDlgItem(hDlg, IDC_RESULT_ID), true ); ShowWindow( GetDlgItem(hDlg, IDC_RESULT_ID), true );
} }
else else
{ {
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() ); SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
} }
ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false ); ShowWindow( GetDlgItem(hDlg, IDC_PROGRESS), false );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue() ); SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_CLOSE), CLOSE.GetValue() );
}
} }
} }
}
return FALSE; return FALSE;
} }
@@ -15,7 +15,7 @@ public:
HWND GetHwnd() { return m_hWnd; } HWND GetHwnd() { return m_hWnd; }
protected: protected:
virtual bool HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) { return false; } virtual BOOL HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam ) { return false; }
private: private:
static BOOL APIENTRY DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); static BOOL APIENTRY DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);