- Object browser improved
[public/netxms.git] / src / console / win32 / ObjectSearchBox.cpp
1 // ObjectSearchBox.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "nxcon.h"
6 #include "ObjectSearchBox.h"
7
8 #ifdef _DEBUG
9 #define new DEBUG_NEW
10 #undef THIS_FILE
11 static char THIS_FILE[] = __FILE__;
12 #endif
13
14
15 //
16 // Constants
17 //
18
19 #define X_MARGIN 4
20 #define Y_MARGIN 4
21
22
23 /////////////////////////////////////////////////////////////////////////////
24 // CObjectSearchBox
25
26 CObjectSearchBox::CObjectSearchBox()
27 {
28 }
29
30 CObjectSearchBox::~CObjectSearchBox()
31 {
32 }
33
34
35 BEGIN_MESSAGE_MAP(CObjectSearchBox, CToolBox)
36 //{{AFX_MSG_MAP(CObjectSearchBox)
37 ON_WM_CREATE()
38 ON_WM_CTLCOLOR()
39 //}}AFX_MSG_MAP
40 END_MESSAGE_MAP()
41
42
43 //
44 // WM_CREATE message handler
45 //
46
47 int CObjectSearchBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
48 {
49 RECT rect;
50
51 if (CToolBox::OnCreate(lpCreateStruct) == -1)
52 return -1;
53
54 // Create font
55 m_fontNormal.CreateFont(-MulDiv(7, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY), 72),
56 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
57 OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
58 VARIABLE_PITCH | FF_DONTCARE, "MS Sans Serif");
59
60 // Create static text
61 GetClientRect(&rect);
62 rect.left += X_MARGIN;
63 rect.right -= X_MARGIN;
64 rect.top += Y_MARGIN;
65 rect.bottom = rect.top + 12;
66 m_wndStatic.Create("Enter object name or IP address:", WS_CHILD | WS_VISIBLE, rect, this);
67 m_wndStatic.SetFont(&m_fontNormal);
68
69 // Create edit box
70 rect.top = rect.bottom + Y_MARGIN;
71 rect.bottom = rect.top + 18;
72 m_wndEditBox.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
73 rect, this, IDC_EDIT_SEARCH_STRING);
74 m_wndEditBox.SetFont(&m_fontNormal);
75 m_wndEditBox.SetLimitText(255);
76
77 // Create button
78 rect.top = rect.bottom + Y_MARGIN * 2;
79 rect.bottom = rect.top + 18;
80 rect.left = rect.right - 70;
81 m_wndButton.Create("&Find", WS_CHILD | WS_VISIBLE, rect, this, ID_FIND_OBJECT);
82 m_wndButton.SetFont(&m_fontNormal);
83
84 return 0;
85 }
86
87
88 //
89 // WM_CTLCOLOR message handler
90 //
91
92 HBRUSH CObjectSearchBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
93 {
94 HBRUSH hbr;
95
96 // Static control
97 if (pWnd->m_hWnd == m_wndStatic.m_hWnd)
98 {
99 hbr = CreateSolidBrush(RGB(255, 255, 255));
100 pDC->SetBkColor(RGB(255, 255, 255));
101 }
102
103 return hbr;
104 }