[ros-diffs] [gedmurphy] 53664: [DEVMGMT] Add the treeview and resize data. It now somewhat resembles an app.

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Fri Sep 9 19:10:12 UTC 2011


Author: gedmurphy
Date: Fri Sep  9 19:10:11 2011
New Revision: 53664

URL: http://svn.reactos.org/svn/reactos?rev=53664&view=rev
Log:
[DEVMGMT]
Add the treeview and resize data. It now somewhat resembles an app.

Modified:
    trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp
    trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h
    trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp

Modified: trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp?rev=53664&r1=53663&r2=53664&view=diff
==============================================================================
--- trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.cpp [iso-8859-1] Fri Sep  9 19:10:11 2011
@@ -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,7 +19,41 @@
 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

Modified: trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h?rev=53664&r1=53663&r2=53664&view=diff
==============================================================================
--- trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/devmgmt_new/DeviceView.h [iso-8859-1] Fri Sep  9 19:10:11 2011
@@ -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();

Modified: trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp?rev=53664&r1=53663&r2=53664&view=diff
==============================================================================
--- trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/devmgmt_new/MainWindow.cpp [iso-8859-1] Fri Sep  9 19:10:11 2011
@@ -208,7 +208,7 @@
         if (CreateStatusBar())
         {
             /* Create the device view object */
-            m_DeviceView = new CDeviceView();
+            m_DeviceView = new CDeviceView(m_hMainWnd);
 
             /* Initialize it */
             if (m_DeviceView->Initialize())
@@ -217,12 +217,47 @@
                 ShowWindow(hwnd, m_CmdShow);
 
                 /* Set as handled */
-                //RetCode = 0;
+                RetCode = 0;
             }
         }
     }
 
     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
@@ -348,6 +383,12 @@
 
             /* Call the create handler */
             RetCode = pThis->OnCreate(hwnd);
+            break;
+        }
+
+        case WM_SIZE:
+        {
+            RetCode = pThis->OnSize();
             break;
         }
 




More information about the Ros-diffs mailing list