Alarm browser improved
[public/netxms.git] / src / client / console / plugins / AlarmBrowser / browser.cpp
1 /*
2 ** NetXMS - Network Management System
3 ** Portable management console - Alarm Browser plugin
4 ** Copyright (C) 2007 Victor Kirhenshtein
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
15 **
16 ** You should have received a copy of the GNU General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 **
20 ** File: browser.cpp
21 **
22 **/
23
24 #include "alarm_browser.h"
25
26
27 //
28 // Event table
29 //
30
31 BEGIN_EVENT_TABLE(nxAlarmBrowser, nxView)
32 EVT_SIZE(nxAlarmBrowser::OnSize)
33 EVT_NX_REFRESH_VIEW(nxAlarmBrowser::OnViewRefresh)
34 END_EVENT_TABLE()
35
36
37 //
38 // Constructor
39 //
40
41 nxAlarmBrowser::nxAlarmBrowser()
42 : nxView(NXMCGetDefaultParent())
43 {
44 SetName(_T("alarmbrowser"));
45 SetLabel(_T("Alarm Browser"));
46 RegisterUniqueView(_T("alarmbrowser"), this);
47
48 m_view = new nxAlarmView(this, _T("/AlarmBrowser"));
49
50 wxCommandEvent event(nxEVT_REFRESH_VIEW);
51 AddPendingEvent(event);
52 }
53
54
55 //
56 // Destructor
57 //
58
59 nxAlarmBrowser::~nxAlarmBrowser()
60 {
61 UnregisterUniqueView(_T("alarmbrowser"));
62 }
63
64
65 //
66 // Resize handler
67 //
68
69 void nxAlarmBrowser::OnSize(wxSizeEvent &event)
70 {
71 wxSize size = GetClientSize();
72 m_view->SetSize(0, 0, size.x, size.y);
73 }
74
75
76 //
77 // View->Refresh menu handler
78 //
79
80 void nxAlarmBrowser::OnViewRefresh(wxCommandEvent &event)
81 {
82 m_view->RefreshView();
83 }