ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/Chooser.cxx
Revision: 263
Committed: 2003-08-16T16:09:44-07:00 (21 years, 10 months ago) by douglas
File size: 1563 byte(s)
Log Message:
Choose me!

File Contents

# Content
1 // Vance Thrift and Biller File Utility 2
2 //
3 // Douglas Thrift
4 //
5 // $Id: Chooser.cxx,v 1.1 2003/08/16 23:09:44 douglas Exp $
6
7 #include "Chooser.h"
8
9 struct
10 {
11 bool* shortcut;
12 Mode* choice;
13 }
14 cheese;
15
16 Mode Chooser::choose(HWND parent)
17 {
18 cheese.shortcut = &shortcut;
19 cheese.choice = &choice;
20
21 DialogBox(gui.instance, MAKEINTRESOURCE(IDD_CHOICE), parent, smersh);
22
23 desktop();
24
25 return choice;
26 }
27
28 void Chooser::desktop(void)
29 {
30 if (!shortcut) return;
31
32 MessageBox(NULL, "Desktop Shortcut", programName.c_str(),
33 MB_ICONINFORMATION);
34 }
35
36 INT_PTR CALLBACK smersh(HWND dialog, UINT msg, WPARAM w, LPARAM l)
37 {
38 switch (msg)
39 {
40 case WM_INITDIALOG:
41 center(dialog);
42 SendMessage(dialog, WM_SETICON, ICON_BIG, LPARAM(gui.icon));
43 SendMessage(dialog, WM_SETTEXT, 0, LPARAM(programName.c_str()));
44 break;
45 case WM_COMMAND:
46 switch (LOWORD(w))
47 {
48 case IDC_CHOICE_DISC:
49 *cheese.choice = disc;
50 if (debug) cerr << "choice = disc\n";
51 EnableWindow(GetDlgItem(dialog, IDC_CHOICE_ALWAYS), TRUE);
52 EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
53 break;
54 case IDC_CHOICE_SCAN:
55 *cheese.choice = scan;
56 if (debug) cerr << "choice = scan\n";
57 EnableWindow(GetDlgItem(dialog, IDC_CHOICE_ALWAYS), TRUE);
58 EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
59 break;
60 case IDC_CHOICE_ALWAYS:
61 *cheese.shortcut = !*cheese.shortcut;
62 if (debug) cerr << "shortcut = " << *cheese.shortcut << "\n";
63 break;
64 case IDCANCEL:
65 *cheese.choice = none;
66 case IDOK:
67 EndDialog(dialog, w);
68 return TRUE;
69 default:
70 break;
71 }
72 break;
73 }
74
75 return FALSE;
76 }