1 |
/* wptDateDlg.cpp - Universal dialog to ask for a date |
/* wptDateDlg.cpp - Universal dialog to ask for a date |
2 |
* Copyright (C) 2001, 2002, 2003 Timo Schulz |
* Copyright (C) 2001, 2002, 2003, 2006 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
17 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
*/ |
|
|
|
20 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
21 |
#include <config.h> |
#include <config.h> |
22 |
#endif |
#endif |
32 |
#include "wptTypes.h" |
#include "wptTypes.h" |
33 |
|
|
34 |
|
|
35 |
/* (common) Dialog box procedure to select a date. */ |
/* Dialog box procedure to select a date. */ |
36 |
BOOL CALLBACK |
BOOL CALLBACK |
37 |
date_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
date_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
38 |
{ |
{ |
41 |
switch( msg ) { |
switch( msg ) { |
42 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
43 |
udd = (date_s *)lparam; |
udd = (date_s *)lparam; |
44 |
if( udd == NULL ) |
if (!udd) |
45 |
dlg_fatal_error( dlg, "Can't get dialog param" ); |
BUG (0); |
46 |
if( udd->text ) |
if (udd->text) |
47 |
SetWindowText( dlg, udd->text ); |
SetWindowText (dlg, udd->text); |
48 |
SetForegroundWindow( dlg ); |
SetForegroundWindow (dlg); |
49 |
return TRUE; |
return TRUE; |
|
|
|
|
case WM_SYSCOMMAND: |
|
|
if( LOWORD( wparam ) == SC_CLOSE ) { |
|
|
udd->cancel = 1; |
|
|
EndDialog( dlg, TRUE ); |
|
|
} |
|
|
return FALSE; |
|
50 |
|
|
51 |
case WM_COMMAND: |
case WM_COMMAND: |
52 |
switch( LOWORD( wparam) ) { |
switch (LOWORD (wparam)) { |
53 |
|
case IDCANCEL: |
54 |
|
udd->cancel = 1; |
55 |
|
EndDialog (dlg, FALSE); |
56 |
|
return TRUE; |
57 |
|
|
58 |
case IDOK: |
case IDOK: |
59 |
DateTime_GetSystemtime( GetDlgItem( dlg, IDC_DATE_DTP ), &udd->st ); |
DateTime_GetSystemtime (GetDlgItem (dlg, IDC_DATE_DTP), &udd->st); |
60 |
udd->cancel = 0; |
udd->cancel = 0; |
61 |
EndDialog( dlg, TRUE ); |
EndDialog (dlg, TRUE); |
62 |
return TRUE; |
return TRUE; |
63 |
} |
} |
64 |
break; |
break; |