Fixed some bugs in node creation
[public/netxms.git] / src / console / win32 / nxcon.h
1 // nxcon.h : main header file for the NXCON application
2 //
3
4 #if !defined(AFX_NXCON_H__A5C08A87_42D8_47F3_8F69_9566830EF29E__INCLUDED_)
5 #define AFX_NXCON_H__A5C08A87_42D8_47F3_8F69_9566830EF29E__INCLUDED_
6
7 #if _MSC_VER > 1000
8 #pragma once
9 #endif // _MSC_VER > 1000
10
11 #ifndef __AFXWIN_H__
12 #error include 'stdafx.h' before including this file for PCH
13 #endif
14
15
16 //
17 // Common inline functions
18 //
19
20 inline BOOL SafeFreeResource(HGLOBAL hRes)
21 {
22 return (hRes != NULL) ? FreeResource(hRes) : FALSE;
23 }
24
25
26 #include <nxclapi.h>
27 #include <nms_util.h>
28 #include "resource.h" // Main symbols
29 #include "globals.h" // Global symbols
30 #include "ControlPanel.h"
31 #include "EventBrowser.h"
32 #include "EventEditor.h"
33 #include "ObjectBrowser.h"
34 #include "MapFrame.h"
35 #include "DebugFrame.h"
36 #include "NodePropsGeneral.h"
37 #include "ObjectPropCaps.h"
38 #include "ObjectPropSheet.h"
39 #include "RequestProcessingDlg.h"
40 #include "ObjectPropsGeneral.h"
41 #include "ObjectPropsSecurity.h"
42 #include "ObjectPropsPresentation.h"
43 #include "UserEditor.h"
44 #include "NetSummaryFrame.h"
45 #include "DataCollectionEditor.h"
46 #include "DCIDataView.h"
47 #include "GraphFrame.h"
48 #include "MIBBrowserDlg.h"
49 #include "EventPolicyEditor.h"
50 #include "AlarmBrowser.h"
51 #include "ConsolePropsGeneral.h"
52 #include "ActionEditor.h"
53
54
55 #define MAX_DC_EDITORS 1024
56
57
58 //
59 // Key states
60 //
61
62 #define KS_SHIFT_PRESSED 0x0001
63 #define KS_ALT_PRESSED 0x0002
64 #define KS_CTRL_PRESSED 0x0004
65
66
67 //
68 // Open DCI editor structure
69 //
70
71 struct DC_EDITOR
72 {
73 DWORD dwNodeId;
74 CWnd *pWnd;
75 };
76
77
78 /////////////////////////////////////////////////////////////////////////////
79 // CConsoleApp:
80 // See nxcon.cpp for the implementation of this class
81 //
82
83 class CConsoleApp : public CWinApp
84 {
85 public:
86 CConsoleApp();
87 virtual ~CConsoleApp();
88
89 // Overrides
90 // ClassWizard generated virtual function overrides
91 //{{AFX_VIRTUAL(CConsoleApp)
92 public:
93 virtual BOOL InitInstance();
94 virtual int ExitInstance();
95 //}}AFX_VIRTUAL
96
97 // Implementation
98 protected:
99 void CreateObject(NXC_OBJECT_CREATE_INFO *pInfo);
100 HMENU LoadAppMenu(HMENU hViewMenu);
101 BOOL SetupWorkDir(void);
102 CWnd * FindOpenDCEditor(DWORD dwNodeId);
103 CMenu m_ctxMenu;
104 DWORD m_dwClientState;
105 CActionEditor *m_pwndActionEditor;
106 CAlarmBrowser *m_pwndAlarmBrowser;
107 CEventBrowser *m_pwndEventBrowser;
108 CEventEditor *m_pwndEventEditor;
109 CUserEditor *m_pwndUserEditor;
110 CWnd* m_pwndObjectBrowser;
111 CWnd *m_pwndCtrlPanel;
112 CDebugFrame *m_pwndDebugWindow;
113 CNetSummaryFrame *m_pwndNetSummary;
114 CEventPolicyEditor *m_pwndEventPolicyEditor;
115
116 HMENU m_hMDIMenu; // Default menu for MDI
117 HACCEL m_hMDIAccel; // Default accelerator for MDI
118 HMENU m_hAlarmBrowserMenu; // Menu for alarm browser
119 HACCEL m_hAlarmBrowserAccel; // Accelerator for alarm browser
120 HMENU m_hEventBrowserMenu; // Menu for event browser
121 HACCEL m_hEventBrowserAccel; // Accelerator for event browser
122 HMENU m_hObjectBrowserMenu; // Menu for object browser
123 HACCEL m_hObjectBrowserAccel; // Accelerator for object browser
124 HMENU m_hUserEditorMenu; // Menu for user editor
125 HACCEL m_hUserEditorAccel; // Accelerator for user editor
126 HMENU m_hDCEditorMenu; // Menu for data collection editor
127 HACCEL m_hDCEditorAccel; // Accelerator for data collection editor
128 HMENU m_hPolicyEditorMenu; // Menu for event policy editor
129 HACCEL m_hPolicyEditorAccel; // Accelerator for event policy editor
130 HMENU m_hMapMenu; // Menu for map view
131 HACCEL m_hMapAccel; // Accelerator for map view
132
133 public:
134 void EventHandler(DWORD dwEvent, DWORD dwCode, void *pArg);
135 void OnViewDestroy(DWORD dwView, CWnd *pWnd, DWORD dwArg = 0);
136 void OnViewCreate(DWORD dwView, CWnd *pWnd, DWORD dwArg = 0);
137 DWORD GetClientState(void) { return m_dwClientState; }
138 //{{AFX_MSG(CConsoleApp)
139 afx_msg void OnAppAbout();
140 afx_msg void OnViewControlpanel();
141 afx_msg void OnViewEvents();
142 afx_msg void OnViewMap();
143 afx_msg void OnConnectToServer();
144 afx_msg void OnViewObjectbrowser();
145 afx_msg void OnControlpanelEvents();
146 afx_msg void OnViewDebug();
147 afx_msg void OnControlpanelUsers();
148 afx_msg void OnViewNetworksummary();
149 afx_msg void OnToolsMibbrowser();
150 afx_msg void OnControlpanelEventpolicy();
151 afx_msg void OnViewAlarms();
152 afx_msg void OnFileSettings();
153 afx_msg void OnControlpanelActions();
154 afx_msg void OnToolsAddnode();
155 //}}AFX_MSG
156 DECLARE_MESSAGE_MAP()
157 private:
158 BOOL m_bActionEditorActive;
159 BOOL m_bAlarmBrowserActive;
160 BOOL m_bEventBrowserActive;
161 BOOL m_bEventEditorActive;
162 BOOL m_bUserEditorActive;
163 BOOL m_bObjectBrowserActive;
164 BOOL m_bCtrlPanelActive;
165 BOOL m_bDebugWindowActive;
166 BOOL m_bNetSummaryActive;
167 BOOL m_bEventPolicyEditorActive;
168
169 DC_EDITOR m_openDCEditors[MAX_DC_EDITORS];
170
171 public:
172 void CreateTemplateGroup(DWORD dwParent);
173 void CreateTemplate(DWORD dwParent);
174 void PollNode(DWORD dwObjectId, int iPollType);
175 void DeleteNetXMSObject(NXC_OBJECT *pObject);
176 void CreateNode(DWORD dwParent);
177 void CreateContainer(DWORD dwParent);
178 NXC_EPP *m_pEventPolicy;
179
180 void ShowDCIGraph(DWORD dwNodeId, DWORD dwItemId, char *pszItemName);
181 void ShowDCIData(DWORD dwNodeId, DWORD dwItemId, char *pszItemName);
182 void ErrorBox(DWORD dwError, char *pszMessage = NULL, char *pszTitle = NULL);
183 void SetObjectMgmtStatus(NXC_OBJECT *pObject, BOOL bIsManaged);
184 void StartObjectDCEditor(NXC_OBJECT *pObject);
185 CMenu * GetContextMenu(int iIndex);
186 void ObjectProperties(DWORD dwObjectId);
187 void DebugPrintf(char *szFormat, ...);
188 void DebugCallback(char *pszMsg)
189 {
190 if (m_bDebugWindowActive)
191 m_pwndDebugWindow->AddMessage(pszMsg);
192 }
193 CAlarmBrowser *GetAlarmBrowser(void) { return m_bAlarmBrowserActive ? m_pwndAlarmBrowser : NULL; }
194 };
195
196
197 /////////////////////////////////////////////////////////////////////////////
198
199 //{{AFX_INSERT_LOCATION}}
200 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
201
202 #endif // !defined(AFX_NXCON_H__A5C08A87_42D8_47F3_8F69_9566830EF29E__INCLUDED_)