[ros-diffs] [cwittich] 27222: added explorer-like addressbar

cwittich at svn.reactos.org cwittich at svn.reactos.org
Mon Jun 18 02:09:38 CEST 2007


Author: cwittich
Date: Mon Jun 18 04:09:37 2007
New Revision: 27222

URL: http://svn.reactos.org/svn/reactos?rev=27222&view=rev
Log:
added explorer-like addressbar

Modified:
    trunk/reactos/base/applications/regedit/childwnd.c
    trunk/reactos/base/applications/regedit/main.h

Modified: trunk/reactos/base/applications/regedit/childwnd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/childwnd.c?rev=27222&r1=27221&r2=27222&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/childwnd.c (original)
+++ trunk/reactos/base/applications/regedit/childwnd.c Mon Jun 18 04:09:37 2007
@@ -71,8 +71,9 @@
     SetRect(&rt, 0, 0, cx, cy);
 
     cx = pChildWnd->nSplitPos + SPLIT_WIDTH/2;
-    DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
-    DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx  , rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
+	DeferWindowPos(hdwp, pChildWnd->hAddressBarWnd, 0, rt.left, rt.top, rt.right-rt.left, 23, SWP_NOZORDER|SWP_NOACTIVATE);
+    DeferWindowPos(hdwp, pChildWnd->hTreeWnd, 0, rt.left, rt.top + 25, pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top - 30, SWP_NOZORDER|SWP_NOACTIVATE);
+    DeferWindowPos(hdwp, pChildWnd->hListWnd, 0, rt.left+cx  , rt.top + 25, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE);
     EndDeferWindowPos(hdwp);
 }
 
@@ -253,6 +254,28 @@
 	}
 }
 
+
+LRESULT CALLBACK AddressBarProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    WNDPROC oldwndproc;
+	static TCHAR s_szNode[256];
+    oldwndproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(hwnd, GWL_USERDATA);
+
+	switch (uMsg)
+    {
+		case WM_KEYUP:
+			if (wParam == VK_RETURN)
+			{
+				GetWindowText(hwnd, s_szNode, sizeof(s_szNode) / sizeof(s_szNode[0]));
+				SelectNode(g_pChildWnd->hTreeWnd, s_szNode);
+			}
+			break;
+		default:
+			break;
+	}
+	return CallWindowProc(oldwndproc, hwnd, uMsg, wParam, lParam);
+}
+
 /*******************************************************************************
  *
  *  FUNCTION: ChildWndProc(HWND, unsigned, WORD, LONG)
@@ -273,6 +296,7 @@
     switch (message) {
     case WM_CREATE:
     {
+		WNDPROC oldproc;
         TCHAR buffer[MAX_PATH];
         /* load "My Computer" string */
         LoadString(hInst, IDS_MY_COMPUTER, buffer, sizeof(buffer)/sizeof(TCHAR));
@@ -283,10 +307,18 @@
         _tcsncpy(pChildWnd->szPath, buffer, MAX_PATH);
         pChildWnd->nSplitPos = 250;
         pChildWnd->hWnd = hWnd;
-        pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, (HMENU) TREE_WINDOW);
+		pChildWnd->hAddressBarWnd = CreateWindowEx(WS_EX_CLIENTEDGE, _T("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_CHILDWINDOW | WS_TABSTOP, 
+										CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+										hWnd, (HMENU)0, hInst, 0);
+		pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, (HMENU) TREE_WINDOW);
         pChildWnd->hListWnd = CreateListView(hWnd, (HMENU) LIST_WINDOW/*, pChildWnd->szPath*/);
         SetFocus(pChildWnd->hTreeWnd);
-        break;
+		
+		/* Subclass the AddressBar */
+		oldproc = (WNDPROC)(LONG_PTR)GetWindowLongPtr(pChildWnd->hAddressBarWnd, GWL_WNDPROC);
+        SetWindowLongPtr(pChildWnd->hAddressBarWnd, GWL_USERDATA, (DWORD_PTR)oldproc);
+        SetWindowLongPtr(pChildWnd->hAddressBarWnd, GWL_WNDPROC, (DWORD_PTR)AddressBarProc);
+		break;
     }
     case WM_COMMAND:
         if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
@@ -424,6 +456,7 @@
 			if (fullPath) {
 			    _stprintf(fullPath, _T("%s\\%s"), rootName, keyPath);
 			    SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)fullPath);
+				SendMessage(pChildWnd->hAddressBarWnd, WM_SETTEXT, 0, (LPARAM)fullPath);
 			    HeapFree(GetProcessHeap(), 0, fullPath);
 
 			    {

Modified: trunk/reactos/base/applications/regedit/main.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/main.h?rev=27222&r1=27221&r2=27222&view=diff
==============================================================================
--- trunk/reactos/base/applications/regedit/main.h (original)
+++ trunk/reactos/base/applications/regedit/main.h Mon Jun 18 04:09:37 2007
@@ -57,6 +57,7 @@
     HWND    hWnd;
     HWND    hTreeWnd;
     HWND    hListWnd;
+	HWND    hAddressBarWnd;
     int     nFocusPanel;      /* 0: left  1: right */
     int	    nSplitPos;
     WINDOWPLACEMENT pos;




More information about the Ros-diffs mailing list