1 |
/* wptDateDlg.cpp - Universal dialog to ask for a date |
2 |
* Copyright (C) 2001, 2002, 2003 Timo Schulz |
3 |
* |
4 |
* This file is part of WinPT. |
5 |
* |
6 |
* WinPT is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* WinPT 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 |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with WinPT; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
20 |
|
21 |
#ifdef HAVE_CONFIG_H |
22 |
#include <config.h> |
23 |
#endif |
24 |
|
25 |
#include <windows.h> |
26 |
#include <windows.h> |
27 |
#include <commctrl.h> |
28 |
|
29 |
#include "gpgme.h" |
30 |
#include "resource.h" |
31 |
#include "wptCommonCtl.h" |
32 |
#include "wptContext.h" |
33 |
#include "wptDlgs.h" |
34 |
#include "wptTypes.h" |
35 |
|
36 |
|
37 |
/* (common) Dialog box procedure to select a date. */ |
38 |
BOOL CALLBACK |
39 |
date_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
40 |
{ |
41 |
static date_s *udd; |
42 |
|
43 |
switch( msg ) { |
44 |
case WM_INITDIALOG: |
45 |
udd = (date_s *)lparam; |
46 |
if( udd == NULL ) |
47 |
dlg_fatal_error( dlg, "Can't get dialog param" ); |
48 |
if( udd->text ) |
49 |
SetWindowText( dlg, udd->text ); |
50 |
SetForegroundWindow( dlg ); |
51 |
return TRUE; |
52 |
|
53 |
case WM_SYSCOMMAND: |
54 |
if( LOWORD( wparam ) == SC_CLOSE ) { |
55 |
udd->cancel = 1; |
56 |
EndDialog( dlg, TRUE ); |
57 |
} |
58 |
return FALSE; |
59 |
|
60 |
case WM_COMMAND: |
61 |
switch( LOWORD( wparam) ) { |
62 |
case IDOK: |
63 |
DateTime_GetSystemtime( GetDlgItem( dlg, IDC_DATE_DTP ), &udd->st ); |
64 |
udd->cancel = 0; |
65 |
EndDialog( dlg, TRUE ); |
66 |
return TRUE; |
67 |
} |
68 |
break; |
69 |
} |
70 |
|
71 |
return FALSE; |
72 |
} |