ReactOS  0.4.14-dev-55-g2da92ac
dialog.c
Go to the documentation of this file.
1 /*
2  * WineMine (dialog.c)
3  *
4  * Copyright 2000 Joshua Thielen
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include "main.h"
22 
24 {
25  BOOL IsRet;
26  static BOARD *p_board;
27 
28  switch( uMsg ) {
29  case WM_INITDIALOG:
30  p_board = (BOARD*) lParam;
31  SetDlgItemInt( hDlg, IDC_EDITROWS, p_board->rows, FALSE );
32  SetDlgItemInt( hDlg, IDC_EDITCOLS, p_board->cols, FALSE );
33  SetDlgItemInt( hDlg, IDC_EDITMINES, p_board->mines, FALSE );
34  return TRUE;
35 
36  case WM_COMMAND:
37  switch( LOWORD( wParam ) ) {
38  case IDOK:
39  p_board->rows = GetDlgItemInt( hDlg, IDC_EDITROWS, &IsRet, FALSE );
40  p_board->cols = GetDlgItemInt( hDlg, IDC_EDITCOLS, &IsRet, FALSE );
41  p_board->mines = GetDlgItemInt( hDlg, IDC_EDITMINES, &IsRet, FALSE );
42  CheckLevel( p_board );
43  EndDialog( hDlg, 0 );
44  return TRUE;
45 
46  case IDCANCEL:
47  EndDialog( hDlg, 1 );
48  return TRUE;
49  }
50  break;
51  }
52  return FALSE;
53 }
54 
56 {
57  static BOARD *p_board;
58 
59  switch( uMsg ) {
60  case WM_INITDIALOG:
61  p_board = (BOARD*) lParam;
62  SetDlgItemTextW( hDlg, IDC_EDITNAME, p_board->best_name[p_board->difficulty] );
63  return TRUE;
64 
65  case WM_COMMAND:
66  switch( LOWORD( wParam ) ) {
67  case IDOK:
69  p_board->best_name[p_board->difficulty],
70  sizeof( p_board->best_name[p_board->difficulty] ) / sizeof(WCHAR) );
71  EndDialog( hDlg, 0 );
72  return TRUE;
73 
74  case IDCANCEL:
75  EndDialog( hDlg, 0 );
76  return TRUE;
77  }
78  break;
79  }
80  return FALSE;
81 }
82 
84 {
85  static BOARD *p_board;
86  unsigned i;
87 
88  switch( uMsg ) {
89  case WM_INITDIALOG:
90  p_board = (BOARD*) lParam;
91 
92  /* set best names */
93  for( i = 0; i < 3; i++ )
94  SetDlgItemTextW( hDlg, (IDC_NAME1) + i, p_board->best_name[i] );
95 
96  /* set best times */
97  for( i = 0; i < 3; i++ )
98  SetDlgItemInt( hDlg, (IDC_TIME1) + i, p_board->best_time[i], FALSE );
99  return TRUE;
100 
101  case WM_COMMAND:
102  switch( LOWORD( wParam ) ) {
103  case IDOK:
104  case IDCANCEL:
105  EndDialog( hDlg, 0 );
106  return TRUE;
107  }
108  break;
109  }
110  return FALSE;
111 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2208
#define IDC_EDITNAME
Definition: resource.h:43
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI SetDlgItemInt(HWND hDlg, int nIDDlgItem, UINT uValue, BOOL bSigned)
Definition: dialog.c:2733
#define IDC_TIME1
Definition: resource.h:36
INT_PTR CALLBACK CustomDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:23
#define CALLBACK
Definition: compat.h:27
unsigned mines
Definition: main.h:97
UINT_PTR WPARAM
Definition: windef.h:207
int32_t INT_PTR
Definition: typedefs.h:62
WCHAR best_name[3][MAX_PLAYER_NAME_SIZE+1]
Definition: main.h:98
void CheckLevel(BOARD *p_board)
Definition: main.c:49
WPARAM wParam
Definition: combotst.c:138
#define IDC_EDITROWS
Definition: resource.h:46
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: main.h:71
DWORD best_time[3]
Definition: main.h:99
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI SetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPCWSTR lpString)
Definition: dialog.c:2769
INT_PTR CALLBACK TimesDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:83
__wchar_t WCHAR
Definition: xmlstorage.h:180
DIFFICULTY difficulty
Definition: main.h:100
unsigned rows
Definition: main.h:95
unsigned cols
Definition: main.h:96
#define WM_COMMAND
Definition: winuser.h:1722
INT_PTR CALLBACK CongratsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:55
UINT WINAPI GetDlgItemInt(HWND hDlg, int nIDDlgItem, BOOL *lpTranslated, BOOL bSigned)
Definition: dialog.c:2152
#define IDC_EDITCOLS
Definition: resource.h:45
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
unsigned int UINT
Definition: ndis.h:50
#define IDCANCEL
Definition: winuser.h:825
#define IDC_NAME1
Definition: resource.h:39
#define IDC_EDITMINES
Definition: resource.h:47
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82