/[winpt]/trunk/Src/wptCommonDlg.cpp
ViewVC logotype

Annotation of /trunk/Src/wptCommonDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File size: 1993 byte(s)
WinPT initial checkin.


1 twoaday 2 /* wptCommonDlg.cpp
2     * Copyright (C) 2004 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     #include <windows.h>
22    
23     #include "../resource.h"
24    
25     #include "wptTypes.h"
26     #include "wptW32API.h"
27     #include "wptVersion.h"
28     #include "wptGPG.h"
29     #include "wptCommonCtl.h"
30     #include "wptContext.h"
31    
32    
33     static BOOL CALLBACK
34     http_file_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
35     {
36     static http_file_s * ctx;
37    
38     switch (msg) {
39     case WM_INITDIALOG:
40     ctx = (struct http_file_s*)lparam;
41     if (!ctx)
42     BUG (0);
43     SetForegroundWindow (dlg);
44     break;
45    
46     case WM_COMMAND:
47     switch (LOWORD (wparam)) {
48     case IDOK:
49     if (!GetDlgItemText (dlg, IDC_HTTP_URL, ctx->url, sizeof ctx->url-1)) {
50     msg_box (dlg, _("Please enter an URL."), _("HTTP"), MB_ERR);
51     return FALSE;
52     }
53     ctx->cancel = 0;
54     EndDialog (dlg, TRUE);
55     break;
56    
57     case IDCANCEL:
58     ctx->cancel = 1;
59     EndDialog (dlg, FALSE);
60     break;
61     }
62     }
63    
64     return FALSE;
65     }
66    
67    
68     void *
69     get_http_file_dlg (HWND root)
70     {
71     http_file_s * ctx;
72    
73     ctx = new http_file_s;
74     if (!ctx)
75     BUG (0);
76     memset (ctx, 0, sizeof *ctx);
77     DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_HTTP, root,
78     http_file_dlg_proc, (LPARAM)ctx);
79    
80     return ctx;
81     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26