1 |
/* wptDateDlg.cpp - Universal dialog to ask for a date |
2 |
* Copyright (C) 2001, 2002, 2003, 2006 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 |
#ifdef HAVE_CONFIG_H |
21 |
#include <config.h> |
22 |
#endif |
23 |
|
24 |
#include <windows.h> |
25 |
#include <commctrl.h> |
26 |
|
27 |
#include "gpgme.h" |
28 |
#include "resource.h" |
29 |
#include "wptCommonCtl.h" |
30 |
#include "wptContext.h" |
31 |
#include "wptDlgs.h" |
32 |
#include "wptTypes.h" |
33 |
|
34 |
|
35 |
/* Dialog box procedure to select a date. */ |
36 |
BOOL CALLBACK |
37 |
date_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) |
38 |
{ |
39 |
static date_s *udd; |
40 |
|
41 |
switch( msg ) { |
42 |
case WM_INITDIALOG: |
43 |
udd = (date_s *)lparam; |
44 |
if (!udd) |
45 |
BUG (0); |
46 |
if (udd->text) |
47 |
SetWindowText (dlg, udd->text); |
48 |
SetForegroundWindow (dlg); |
49 |
return TRUE; |
50 |
|
51 |
case WM_COMMAND: |
52 |
switch (LOWORD (wparam)) { |
53 |
case IDCANCEL: |
54 |
udd->cancel = 1; |
55 |
EndDialog (dlg, FALSE); |
56 |
return TRUE; |
57 |
|
58 |
case IDOK: |
59 |
DateTime_GetSystemtime (GetDlgItem (dlg, IDC_DATE_DTP), &udd->st); |
60 |
udd->cancel = 0; |
61 |
EndDialog (dlg, TRUE); |
62 |
return TRUE; |
63 |
} |
64 |
break; |
65 |
} |
66 |
|
67 |
return FALSE; |
68 |
} |