mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 11:31:54 +00:00
[DEVMGMT]
Add the treeview and resize data. It now somewhat resembles an app. svn path=/trunk/; revision=53664
This commit is contained in:
parent
9ec05fbc97
commit
99530efcdd
3 changed files with 87 additions and 4 deletions
|
@ -1,8 +1,13 @@
|
|||
#include "StdAfx.h"
|
||||
#include "devmgmt.h"
|
||||
#include "DeviceView.h"
|
||||
|
||||
|
||||
CDeviceView::CDeviceView(void)
|
||||
CDeviceView::CDeviceView(HWND hMainWnd) :
|
||||
m_hMainWnd(hMainWnd),
|
||||
m_hTreeView(NULL),
|
||||
m_hPropertyDialog(NULL),
|
||||
m_hShortcutMenu(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,9 +19,43 @@ CDeviceView::~CDeviceView(void)
|
|||
BOOL
|
||||
CDeviceView::Initialize()
|
||||
{
|
||||
/* Create the main treeview */
|
||||
m_hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE,
|
||||
WC_TREEVIEW,
|
||||
NULL,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | TVS_HASLINES |
|
||||
TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_LINESATROOT,
|
||||
0, 0, 0, 0,
|
||||
m_hMainWnd,
|
||||
(HMENU)IDC_TREEVIEW,
|
||||
g_hInstance,
|
||||
NULL);
|
||||
if (m_hTreeView)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return !!(m_hTreeView);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
CDeviceView::Size(INT x,
|
||||
INT y,
|
||||
INT cx,
|
||||
INT cy)
|
||||
{
|
||||
/* Resize the treeview */
|
||||
SetWindowPos(m_hTreeView,
|
||||
NULL,
|
||||
x,
|
||||
y,
|
||||
cx,
|
||||
cy,
|
||||
SWP_NOZORDER);
|
||||
}
|
||||
|
||||
BOOL
|
||||
CDeviceView::Uninitialize()
|
||||
{
|
||||
|
|
|
@ -3,16 +3,19 @@
|
|||
|
||||
class CDeviceView : public CDevices
|
||||
{
|
||||
HWND m_hMainWnd;
|
||||
HWND m_hTreeView;
|
||||
HWND m_hPropertyDialog;
|
||||
HWND m_hShortcutMenu;
|
||||
|
||||
public:
|
||||
CDeviceView(void);
|
||||
CDeviceView(HWND hMainWnd);
|
||||
~CDeviceView(void);
|
||||
|
||||
BOOL Initialize();
|
||||
BOOL Uninitialize();
|
||||
|
||||
VOID Size(INT x, INT y, INT cx, INT cy);
|
||||
VOID Refresh();
|
||||
VOID DisplayPropertySheet();
|
||||
VOID SetFocus();
|
||||
|
|
|
@ -208,7 +208,7 @@ CMainWindow::OnCreate(HWND hwnd)
|
|||
if (CreateStatusBar())
|
||||
{
|
||||
/* Create the device view object */
|
||||
m_DeviceView = new CDeviceView();
|
||||
m_DeviceView = new CDeviceView(m_hMainWnd);
|
||||
|
||||
/* Initialize it */
|
||||
if (m_DeviceView->Initialize())
|
||||
|
@ -217,7 +217,7 @@ CMainWindow::OnCreate(HWND hwnd)
|
|||
ShowWindow(hwnd, m_CmdShow);
|
||||
|
||||
/* Set as handled */
|
||||
//RetCode = 0;
|
||||
RetCode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,6 +225,41 @@ CMainWindow::OnCreate(HWND hwnd)
|
|||
return RetCode;
|
||||
}
|
||||
|
||||
LRESULT
|
||||
CMainWindow::OnSize()
|
||||
{
|
||||
RECT rcClient, rcTool, rcStatus;
|
||||
INT lvHeight, iToolHeight, iStatusHeight;
|
||||
|
||||
/* Autosize the toolbar */
|
||||
SendMessage(m_hToolBar, TB_AUTOSIZE, 0, 0);
|
||||
|
||||
/* Get the toolbar rect and save the height */
|
||||
GetWindowRect(m_hToolBar, &rcTool);
|
||||
iToolHeight = rcTool.bottom - rcTool.top;
|
||||
|
||||
/* Resize the status bar */
|
||||
SendMessage(m_hStatusBar, WM_SIZE, 0, 0);
|
||||
|
||||
/* Get the statusbar rect and save the height */
|
||||
GetWindowRect(m_hStatusBar, &rcStatus);
|
||||
iStatusHeight = rcStatus.bottom - rcStatus.top;
|
||||
|
||||
/* Get the full client rect */
|
||||
GetClientRect(m_hMainWnd, &rcClient);
|
||||
|
||||
/* Calculate the remaining height for the treeview */
|
||||
lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
|
||||
|
||||
/* Resize the device view */
|
||||
m_DeviceView->Size(0,
|
||||
iToolHeight,
|
||||
rcClient.right,
|
||||
lvHeight);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT
|
||||
CMainWindow::OnNotify(LPARAM lParam)
|
||||
{
|
||||
|
@ -351,6 +386,12 @@ CMainWindow::MainWndProc(HWND hwnd,
|
|||
break;
|
||||
}
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
RetCode = pThis->OnSize();
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
/* Handle the notify message */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue