Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * WineMine (dialog.c) |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 3 | * |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 4 | * Copyright 2000 Joshua Thielen <jt85296@ltu.edu> |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 21 | #include <windows.h> |
| 22 | #include "main.h" |
| 23 | #include "dialog.h" |
| 24 | #include "resource.h" |
| 25 | |
| 26 | BOOL CALLBACK CustomDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) |
| 27 | { |
| 28 | BOOL IsRet; |
| 29 | static BOARD *p_board; |
| 30 | |
| 31 | switch( uMsg ) { |
| 32 | case WM_INITDIALOG: |
| 33 | p_board = (BOARD*) lParam; |
| 34 | SetDlgItemInt( hDlg, IDC_EDITROWS, p_board->rows, FALSE ); |
| 35 | SetDlgItemInt( hDlg, IDC_EDITCOLS, p_board->cols, FALSE ); |
| 36 | SetDlgItemInt( hDlg, IDC_EDITMINES, p_board->mines, FALSE ); |
| 37 | return TRUE; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 38 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 39 | case WM_COMMAND: |
| 40 | switch( LOWORD( wParam ) ) { |
| 41 | case IDOK: |
| 42 | p_board->rows = GetDlgItemInt( hDlg, IDC_EDITROWS, &IsRet, FALSE ); |
| 43 | p_board->cols = GetDlgItemInt( hDlg, IDC_EDITCOLS, &IsRet, FALSE ); |
| 44 | p_board->mines = GetDlgItemInt( hDlg, IDC_EDITMINES, &IsRet, FALSE ); |
| 45 | CheckLevel( p_board ); |
| 46 | EndDialog( hDlg, 0 ); |
| 47 | return TRUE; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 48 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 49 | case IDCANCEL: |
| 50 | EndDialog( hDlg, 0 ); |
| 51 | return TRUE; |
| 52 | } |
| 53 | break; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 54 | } |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 55 | return FALSE; |
| 56 | } |
| 57 | |
| 58 | BOOL CALLBACK CongratsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) |
| 59 | { |
| 60 | static BOARD *p_board; |
| 61 | |
| 62 | switch( uMsg ) { |
| 63 | case WM_INITDIALOG: |
| 64 | p_board = (BOARD*) lParam; |
| 65 | SetDlgItemText( hDlg, IDC_EDITNAME, |
| 66 | p_board->best_name[p_board->difficulty] ); |
| 67 | return TRUE; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 68 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 69 | case WM_COMMAND: |
| 70 | switch( LOWORD( wParam ) ) { |
| 71 | case IDOK: |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 72 | GetDlgItemText( hDlg, IDC_EDITNAME, |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 73 | p_board->best_name[p_board->difficulty], |
| 74 | sizeof( p_board->best_name[p_board->difficulty] ) ); |
| 75 | EndDialog( hDlg, 0 ); |
| 76 | return TRUE; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 77 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 78 | case IDCANCEL: |
| 79 | EndDialog( hDlg, 0 ); |
| 80 | return TRUE; |
| 81 | } |
| 82 | break; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 83 | } |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 84 | return FALSE; |
| 85 | } |
| 86 | |
| 87 | BOOL CALLBACK TimesDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) |
| 88 | { |
| 89 | static BOARD *p_board; |
| 90 | unsigned i; |
| 91 | |
| 92 | switch( uMsg ) { |
| 93 | case WM_INITDIALOG: |
| 94 | p_board = (BOARD*) lParam; |
| 95 | |
| 96 | /* set best names */ |
| 97 | for( i = 0; i < 3; i++ ) |
| 98 | SetDlgItemText( hDlg, (IDC_NAME1) + i, p_board->best_name[i] ); |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 99 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 100 | /* set best times */ |
| 101 | for( i = 0; i < 3; i++ ) |
| 102 | SetDlgItemInt( hDlg, (IDC_TIME1) + i, p_board->best_time[i], FALSE ); |
| 103 | return TRUE; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 104 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 105 | case WM_COMMAND: |
| 106 | switch( LOWORD( wParam ) ) { |
| 107 | case IDOK: |
| 108 | EndDialog( hDlg, 0 ); |
| 109 | return TRUE; |
| 110 | } |
| 111 | break; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 112 | } |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 113 | return FALSE; |
| 114 | } |
| 115 | |
| 116 | BOOL CALLBACK AboutDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) |
| 117 | { |
| 118 | switch( uMsg ) { |
| 119 | case WM_INITDIALOG: |
| 120 | return TRUE; |
Vincent Béron | 9a62491 | 2002-05-31 23:06:46 +0000 | [diff] [blame] | 121 | |
Joshua Thielen | a3f2380 | 2000-03-15 19:06:39 +0000 | [diff] [blame] | 122 | case WM_COMMAND: |
| 123 | switch( LOWORD( wParam ) ) { |
| 124 | case IDOK: |
| 125 | EndDialog( hDlg, 0 ); |
| 126 | return TRUE; |
| 127 | } |
| 128 | break; |
| 129 | } |
| 130 | return FALSE; |
| 131 | } |
| 132 | |