Alexander Nicolaysen Sørnes : shdocvw: Add an address bar to IE.

Alexandre Julliard julliard at winehq.org
Wed Jul 28 10:45:09 CDT 2010


Module: wine
Branch: master
Commit: c5ac98290323b06f8da0ea7f73e9f1bd925ec220
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c5ac98290323b06f8da0ea7f73e9f1bd925ec220

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Tue Jul 27 13:09:47 2010 +0200

shdocvw: Add an address bar to IE.

---

 dlls/shdocvw/dochost.c  |    3 +-
 dlls/shdocvw/iexplore.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++-
 dlls/shdocvw/resource.h |    2 +
 dlls/shdocvw/shdocvw.h  |    1 +
 4 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/dlls/shdocvw/dochost.c b/dlls/shdocvw/dochost.c
index b3db012..4978989 100644
--- a/dlls/shdocvw/dochost.c
+++ b/dlls/shdocvw/dochost.c
@@ -311,7 +311,8 @@ void create_doc_view_hwnd(DocHost *This)
         doc_view_atom = RegisterClassExW(&wndclass);
     }
 
-    GetClientRect(This->frame_hwnd, &rect); /* FIXME */
+    GetClientRect(This->frame_hwnd, &rect);
+    adjust_ie_docobj_rect(This->frame_hwnd, &rect);
     This->hwnd = CreateWindowExW(0, wszShell_DocObject_View,
          wszShell_DocObject_View,
          WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c
index 4d7c01c..e596c85 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -47,6 +47,15 @@ static const WCHAR szIEWinFrame[] = { 'I','E','F','r','a','m','e',0 };
 static const WCHAR wszWineInternetExplorer[] =
         {'W','i','n','e',' ','I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0};
 
+void adjust_ie_docobj_rect(HWND frame, RECT* rc)
+{
+    HWND hwndRebar = GetDlgItem(frame, IDC_BROWSE_REBAR);
+    INT barHeight = SendMessageW(hwndRebar, RB_GETBARHEIGHT, 0, 0);
+
+    rc->top += barHeight;
+    rc->bottom -= barHeight;
+}
+
 static INT_PTR CALLBACK ie_dialog_open_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
     static InternetExplorer* This;
@@ -105,18 +114,57 @@ static void ie_dialog_about(HWND hwnd)
     DestroyIcon(icon);
 }
 
+static void create_rebar(HWND hwnd)
+{
+    HWND hwndRebar;
+    HWND hwndAddress;
+    REBARINFO rebarinf;
+    REBARBANDINFOW bandinf;
+    WCHAR addr[] = {'A','d','d','r','e','s','s',0};
+
+    hwndRebar = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0, 0, 0, 0, hwnd, (HMENU)IDC_BROWSE_REBAR, shdocvw_hinstance, NULL);
+
+    rebarinf.cbSize = sizeof(rebarinf);
+    rebarinf.fMask = 0;
+    rebarinf.himl = NULL;
+    rebarinf.cbSize = sizeof(rebarinf);
+
+    SendMessageW(hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rebarinf);
+
+    hwndAddress = CreateWindowExW(0, WC_COMBOBOXEXW, NULL, WS_BORDER|WS_CHILD|WS_VISIBLE|CBS_DROPDOWN, 0, 0, 100,20,hwndRebar, (HMENU)IDC_BROWSE_ADDRESSBAR, shdocvw_hinstance, NULL);
+
+    bandinf.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_TEXT;
+    bandinf.fStyle = RBBS_CHILDEDGE | RBBS_GRIPPERALWAYS;
+    bandinf.lpText = addr;
+    bandinf.cx = 100;
+    bandinf.cyMinChild = 20;
+    bandinf.hwndChild = hwndAddress;
+
+    SendMessageW(hwndRebar, RB_INSERTBANDW, 0, (LPARAM)&bandinf);
+}
+
 static LRESULT iewnd_OnCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
 {
     SetWindowLongPtrW(hwnd, 0, (LONG_PTR) lpcs->lpCreateParams);
+    create_rebar(hwnd);
+
     return 0;
 }
 
 static LRESULT iewnd_OnSize(InternetExplorer *This, INT width, INT height)
 {
+    HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR);
+    INT barHeight = SendMessageW(hwndRebar, RB_GETBARHEIGHT, 0, 0);
+    RECT docarea = {0, 0, width, height};
+
+    adjust_ie_docobj_rect(This->frame_hwnd, &docarea);
+
     if(This->doc_host.hwnd)
-        SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
+        SetWindowPos(This->doc_host.hwnd, NULL, docarea.left, docarea.top, docarea.right, docarea.bottom,
                      SWP_NOZORDER | SWP_NOACTIVATE);
 
+    SetWindowPos(hwndRebar, NULL, 0, 0, width, barHeight, SWP_NOZORDER | SWP_NOACTIVATE);
+
     return 0;
 }
 
diff --git a/dlls/shdocvw/resource.h b/dlls/shdocvw/resource.h
index 31a7005..7283b71 100644
--- a/dlls/shdocvw/resource.h
+++ b/dlls/shdocvw/resource.h
@@ -24,6 +24,8 @@
 #define IDR_BROWSE_MAIN_MENU           1000
 #define IDD_BROWSE_OPEN                1001
 #define IDC_BROWSE_OPEN_URL            1002
+#define IDC_BROWSE_REBAR               1003
+#define IDC_BROWSE_ADDRESSBAR          1004
 
 #define ID_BROWSE_NEW_WINDOW           275
 #define ID_BROWSE_OPEN                 256
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 6fbb20f..44919a5 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -270,6 +270,7 @@ static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_r
 extern HINSTANCE shdocvw_hinstance;
 extern void register_iewindow_class(void);
 extern void unregister_iewindow_class(void);
+extern void adjust_ie_docobj_rect(HWND, RECT*);
 
 HRESULT register_class_object(BOOL);
 HRESULT get_typeinfo(ITypeInfo**);




More information about the wine-cvs mailing list