]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/stored/baculasd/winabout.cpp
kes Add context menu for floating a window.
[bacula/bacula] / bacula / src / win32 / stored / baculasd / winabout.cpp
1 /*
2    Copyright (C) 2000-2004 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    Kern E. Sibbald, 2000
22 */
23
24 #include "bacula.h"
25 #include "winbacula.h"
26 #include "winabout.h"
27 #include "winres.h"
28
29 bacAbout::bacAbout()
30 {
31    visible = false;
32 }
33
34 bacAbout::~bacAbout() { };
35
36 void bacAbout::Show(BOOL show)
37 {
38    if (show && !visible) {
39       DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_ABOUT), NULL,
40          (DLGPROC)DialogProc, (LONG)this);
41    }
42 }
43
44
45 BOOL CALLBACK
46 bacAbout::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
47 {
48    /* Get the dialog class pointer from USERDATA */
49    bacAbout *_this;
50
51    switch (uMsg) {
52    case WM_INITDIALOG:
53       /* save the dialog class pointer */
54       SetWindowLong(hwnd, GWL_USERDATA, lParam);
55       _this = (bacAbout *)lParam;
56
57       /* Show the dialog */
58       SetForegroundWindow(hwnd);
59       _this->visible = true;
60       return TRUE;
61
62    case WM_COMMAND:
63       switch (LOWORD(wParam)) {
64       case IDCANCEL:
65       case IDOK:
66          EndDialog(hwnd, TRUE);
67          _this = (bacAbout *)GetWindowLong(hwnd, GWL_USERDATA);
68          _this->visible = false;
69          return TRUE;
70       }
71       break;
72
73    case WM_DESTROY:
74       EndDialog(hwnd, FALSE);
75       _this = (bacAbout *)GetWindowLong(hwnd, GWL_USERDATA);
76       _this->visible = false;
77       return TRUE;
78    }
79    return 0;
80 }