]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/win32/winevents.cpp
- hotfix for bug #312 (we don't need /servicehelper on nt) at least I don't know...
[bacula/bacula] / bacula / src / filed / win32 / winevents.cpp
1 /*
2    Copyright (C) 2000-2003 Kern Sibbald and John Walker
3
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2 of
7    the License, or (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU General Public
15    License along with this program; if not, write to the Free
16    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
17    MA 02111-1307, USA.
18
19    This file is patterned after the VNC Win32 code by ATT
20   
21    Copyright (2000) Kern E. Sibbald
22 */
23
24
25 /* Code for the Events dialogue */
26
27 #include "winbacula.h"
28 #include "winevents.h"
29
30 extern "C" void FillEventsBox(HWND hwnd, int id_list);
31
32 bacEvents::bacEvents()
33 {
34    visible = FALSE;
35 }
36
37 bacEvents::~bacEvents()
38 {
39 }
40
41 /* Show the dialogue box */
42 void
43 bacEvents::Show(BOOL show)
44 {
45    if (show && !visible) {
46       DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_EVENTS), NULL,
47          (DLGPROC)DialogProc, (LONG)this);
48    }
49 }
50
51
52 BOOL CALLBACK
53 bacEvents::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
54 {
55    /* The dialog-box this pointer is in USERDATA */
56    bacEvents *_this = (bacEvents *)GetWindowLong(hwnd, GWL_USERDATA);
57
58    switch (uMsg) {
59    case WM_INITDIALOG:
60       /* Retrieve the Dialog box parameter */
61       SetWindowLong(hwnd, GWL_USERDATA, lParam);
62       _this = (bacEvents *)lParam;
63
64       /* Show the dialog */
65       SetForegroundWindow(hwnd);
66       _this->visible = TRUE;
67       return TRUE;
68
69    case WM_COMMAND:
70       switch (LOWORD(wParam)) {
71       case IDCANCEL:
72       case IDOK:
73          EndDialog(hwnd, TRUE);
74          _this->visible = FALSE;
75          return TRUE;
76       }
77       break;
78
79    case WM_DESTROY:
80       EndDialog(hwnd, FALSE);
81       _this->visible = FALSE;
82       return TRUE;
83    }
84    return 0;
85 }