00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #include "OgreWin32ErrorDialog.h" 00026 #include "resource.h" 00027 00028 namespace Ogre 00029 { 00030 Win32ErrorDialog::Win32ErrorDialog(HINSTANCE hInst) 00031 { 00032 mHInstance = hInst; 00033 } 00034 00035 Win32ErrorDialog* dlg; // This is a pointer to instance, since this is a static member 00036 00037 BOOL Win32ErrorDialog::DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam) 00038 { 00039 HWND hwndDlgItem; 00040 00041 switch (iMsg) 00042 { 00043 00044 case WM_INITDIALOG: 00045 // Center myself 00046 int x, y, screenWidth, screenHeight; 00047 RECT rcDlg; 00048 GetWindowRect(hDlg, &rcDlg); 00049 screenWidth = GetSystemMetrics(SM_CXFULLSCREEN); 00050 screenHeight = GetSystemMetrics(SM_CYFULLSCREEN); 00051 00052 x = (screenWidth / 2) - ((rcDlg.right - rcDlg.left) / 2); 00053 y = (screenHeight / 2) - ((rcDlg.bottom - rcDlg.top) / 2); 00054 00055 MoveWindow(hDlg, x, y, (rcDlg.right - rcDlg.left), 00056 (rcDlg.bottom - rcDlg.top), TRUE); 00057 00058 // Fill in details of error 00059 hwndDlgItem = GetDlgItem(hDlg, IDC_ERRMSG); 00060 SetWindowText(hwndDlgItem, dlg->mErrorMsg.c_str()); 00061 00062 return TRUE; 00063 case WM_COMMAND: 00064 switch (LOWORD(wParam)) 00065 { 00066 case IDOK: 00067 00068 EndDialog(hDlg, TRUE); 00069 return TRUE; 00070 } 00071 } 00072 00073 return FALSE; 00074 00075 } 00076 00077 00078 void Win32ErrorDialog::display(const String& errorMessage, String logName) 00079 { 00080 // Display dialog 00081 // Don't return to caller until dialog dismissed 00082 dlg = this; 00083 mErrorMsg = errorMessage; 00084 DialogBox(mHInstance, MAKEINTRESOURCE(IDD_DLG_ERROR), NULL, DlgProc); 00085 00086 00087 } 00088 }
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:31 2004