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