Standardize License information
[openafs.git] / src / WINNT / client_exp / server_status_dlg.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 extern "C" {
11 #include <afs/param.h>
12 #include <afs/stds.h>
13 }
14
15 #include "stdafx.h"
16 #include "server_status_dlg.h"
17 #include "gui2fs.h"
18
19 #ifdef _DEBUG
20 #define new DEBUG_NEW
21 #undef THIS_FILE
22 static char THIS_FILE[] = __FILE__;
23 #endif
24
25
26 /////////////////////////////////////////////////////////////////////////////
27 // CServerStatusDlg property Dlg
28
29 IMPLEMENT_DYNCREATE(CServerStatusDlg, CDialog)
30
31 CServerStatusDlg::CServerStatusDlg() : CDialog()
32 {
33         InitModalIndirect (TaLocale_GetDialogResource (CServerStatusDlg::IDD));
34
35         //{{AFX_DATA_INIT(CServerStatusDlg)
36         m_bFast = FALSE;
37         m_nCell = -1;
38         //}}AFX_DATA_INIT
39 }
40
41 CServerStatusDlg::~CServerStatusDlg()
42 {
43 }
44
45 void CServerStatusDlg::DoDataExchange(CDataExchange* pDX)
46 {
47         CDialog::DoDataExchange(pDX);
48         //{{AFX_DATA_MAP(CServerStatusDlg)
49         DDX_Control(pDX, IDC_SHOWSTATUS, m_ShowStatus);
50         DDX_Control(pDX, IDC_CELL_NAME, m_CellName);
51         DDX_Check(pDX, IDC_DONTPROBESERVERS, m_bFast);
52         DDX_Radio(pDX, IDC_LOCALCELL, m_nCell);
53         //}}AFX_DATA_MAP
54 }
55
56 BEGIN_MESSAGE_MAP(CServerStatusDlg, CDialog)
57         //{{AFX_MSG_MAP(CServerStatusDlg)
58         ON_BN_CLICKED(IDC_SHOWSTATUS, OnShowStatus)
59         ON_BN_CLICKED(IDC_SPECIFIEDCELL, OnSpecifiedCell)
60         ON_BN_CLICKED(IDC_LOCALCELL, OnLocalCell)
61         ON_BN_CLICKED(IDC_ALL_CELLS, OnAllCells)
62         ON_EN_CHANGE(IDC_CELL_NAME, OnChangeCellName)
63         ON_BN_CLICKED(IDHELP, OnHelp)
64         //}}AFX_MSG_MAP
65 END_MESSAGE_MAP()
66
67 /////////////////////////////////////////////////////////////////////////////
68 // CServerStatusDlg message handlers
69 BOOL CServerStatusDlg::Save()
70 {
71         return FALSE;
72 }
73
74 BOOL CServerStatusDlg::OnInitDialog() 
75 {
76         CDialog::OnInitDialog();
77
78         m_CellName.EnableWindow(FALSE);
79         m_nCell = 0;
80
81         UpdateData(FALSE);
82
83         return TRUE;  // return TRUE unless you set the focus to a control
84                       // EXCEPTION: OCX Property Pages should return FALSE
85 }
86
87 void CServerStatusDlg::OnShowStatus() 
88 {
89         UpdateData(TRUE);
90
91         CheckServers(GetCellNameText(), (WHICH_CELLS)m_nCell, m_bFast);
92 }
93
94 void CServerStatusDlg::OnSpecifiedCell() 
95 {
96         m_CellName.EnableWindow(TRUE);  
97
98         CheckEnableShowStatus();
99 }
100
101 void CServerStatusDlg::OnLocalCell() 
102 {
103         m_CellName.EnableWindow(FALSE);
104         m_ShowStatus.EnableWindow(TRUE);
105 }
106
107 void CServerStatusDlg::OnAllCells() 
108 {
109         m_CellName.EnableWindow(FALSE);
110         m_ShowStatus.EnableWindow(TRUE);
111 }
112
113 void CServerStatusDlg::CheckEnableShowStatus()
114 {
115         m_ShowStatus.EnableWindow(GetCellNameText().GetLength() > 0);
116 }
117
118 void CServerStatusDlg::OnChangeCellName() 
119 {
120         CheckEnableShowStatus();
121 }
122
123 CString CServerStatusDlg::GetCellNameText()
124 {
125         CString strCellName;
126
127         m_CellName.GetWindowText(strCellName);
128
129         return strCellName;
130 }
131
132 void CServerStatusDlg::OnHelp() 
133 {
134         ShowHelp(m_hWnd, SERVER_STATUS_HELP_ID);
135 }
136