]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/libwin32/aboutDialog.cpp
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / libwin32 / aboutDialog.cpp
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2018 Kern Sibbald
5
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 /*
20  *
21  * Kern Sibbald, August 2007
22  *
23  *
24 */
25
26 #include "bacula.h"
27 #include "win32.h"
28
29 static BOOL CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
30 {
31    /* Get the dialog class pointer from USERDATA */
32    aboutDialog *about;
33
34    switch (uMsg) {
35    case WM_INITDIALOG:
36       /* save the dialog class pointer */
37       SetWindowLong(hwnd, GWL_USERDATA, lParam);
38       about = (aboutDialog *)lParam;
39
40       /* Show the dialog */
41       SetForegroundWindow(hwnd);
42       about->m_visible = true;
43       return true;
44
45    case WM_COMMAND:
46       switch (LOWORD(wParam)) {
47       case IDCANCEL:
48       case IDOK:
49          EndDialog(hwnd, true);
50          about = (aboutDialog *)GetWindowLong(hwnd, GWL_USERDATA);
51          about->m_visible = false;
52          return true;
53       }
54       break;
55
56    case WM_DESTROY:
57       EndDialog(hwnd, false);
58       about = (aboutDialog *)GetWindowLong(hwnd, GWL_USERDATA);
59       about->m_visible = false;
60       return true;
61    }
62    return false;
63 }
64
65 void aboutDialog::show(bool show)
66 {
67    if (show && !m_visible) {
68       DialogBoxParam(appInstance, MAKEINTRESOURCE(IDD_ABOUT), NULL,
69          (DLGPROC)DialogProc, (LPARAM)this);
70    }
71 }