Alexander Nicolaysen Sørnes : shdocvw: Add menu bar to Internet Explorer.

Alexandre Julliard julliard at winehq.org
Fri Jul 23 10:05:48 CDT 2010


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

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Sun Jun 20 20:25:34 2010 +0200

shdocvw: Add menu bar to Internet Explorer.

---

 dlls/shdocvw/En.rc       |   45 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/shdocvw/Makefile.in |    5 ++++-
 dlls/shdocvw/ie.c        |   21 +++++++++++++++++++--
 dlls/shdocvw/iexplore.c  |    1 +
 dlls/shdocvw/resource.h  |   33 +++++++++++++++++++++++++++++++++
 dlls/shdocvw/shdocvw.h   |    2 ++
 6 files changed, 104 insertions(+), 3 deletions(-)

diff --git a/dlls/shdocvw/En.rc b/dlls/shdocvw/En.rc
new file mode 100644
index 0000000..154d080
--- /dev/null
+++ b/dlls/shdocvw/En.rc
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010 Alexander N. Sørnes <alex at thehandofagony.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resource.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+IDR_BROWSE_MAIN_MENU MENU
+{
+    POPUP "&File"
+    {
+        POPUP "&New"
+        {
+            MENUITEM "&Window"                  ID_BROWSE_NEW_WINDOW
+        }
+        MENUITEM "&Open...",                    ID_BROWSE_OPEN
+        MENUITEM "&Save",                       ID_BROWSE_SAVE
+        MENUITEM "Save &as...",                 ID_BROWSE_SAVE_AS
+        MENUITEM SEPARATOR
+        MENUITEM "Print &format...",            ID_BROWSE_PRINT_FORMAT
+        MENUITEM "Pr&int...",                   ID_BROWSE_PRINT
+        MENUITEM "Print previe&w...",           ID_BROWSE_PRINT_PREVIEW
+        MENUITEM SEPARATOR
+        MENUITEM "&Properties...",              ID_BROWSE_PROPERTIES
+    }
+    POPUP "&Help"
+    {
+        MENUITEM "&About Internet Explorer...", ID_BROWSE_ABOUT
+    }
+}
diff --git a/dlls/shdocvw/Makefile.in b/dlls/shdocvw/Makefile.in
index e8ee8dd..8326b78 100644
--- a/dlls/shdocvw/Makefile.in
+++ b/dlls/shdocvw/Makefile.in
@@ -28,7 +28,10 @@ C_SRCS = \
 	view.c \
 	webbrowser.c
 
-RC_SRCS = shdocvw.rc
+RC_SRCS = \
+	En.rc \
+	shdocvw.rc
+
 IDL_TLB_SRCS = shdocvw_v1.idl
 
 @MAKE_DLL_RULES@
diff --git a/dlls/shdocvw/ie.c b/dlls/shdocvw/ie.c
index 7b07de6..9d661ca 100644
--- a/dlls/shdocvw/ie.c
+++ b/dlls/shdocvw/ie.c
@@ -422,8 +422,25 @@ static HRESULT WINAPI InternetExplorer_get_MenuBar(IWebBrowser2 *iface, VARIANT_
 static HRESULT WINAPI InternetExplorer_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
 {
     InternetExplorer *This = WEBBROWSER_THIS(iface);
-    FIXME("(%p)->(%x)\n", This, Value);
-    return E_NOTIMPL;
+    HMENU menu = NULL;
+
+    TRACE("(%p)->(%x)\n", This, Value);
+
+    if((menu = GetMenu(This->frame_hwnd)))
+        DestroyMenu(menu);
+
+    menu = NULL;
+
+    if(Value)
+        menu = LoadMenuW(shdocvw_hinstance, MAKEINTRESOURCEW(IDR_BROWSE_MAIN_MENU));
+
+    if(!SetMenu(This->frame_hwnd, menu))
+    {
+        DestroyMenu(menu);
+        return HRESULT_FROM_WIN32(GetLastError());
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI InternetExplorer_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
diff --git a/dlls/shdocvw/iexplore.c b/dlls/shdocvw/iexplore.c
index 0984889..10292db 100644
--- a/dlls/shdocvw/iexplore.c
+++ b/dlls/shdocvw/iexplore.c
@@ -136,6 +136,7 @@ static IWebBrowser2 *create_ie_window(LPCSTR cmdline)
         return NULL;
 
     IWebBrowser2_put_Visible(wb, VARIANT_TRUE);
+    IWebBrowser2_put_MenuBar(wb, VARIANT_TRUE);
 
     if(!*cmdline) {
         IWebBrowser2_GoHome(wb);
diff --git a/dlls/shdocvw/resource.h b/dlls/shdocvw/resource.h
new file mode 100644
index 0000000..3a1f0e7
--- /dev/null
+++ b/dlls/shdocvw/resource.h
@@ -0,0 +1,33 @@
+/*
+ * Resource identifiers for shdocvw.dll
+ *
+ * Copyright 2010 Alexander N. Sørnes <alex at thehandofagony.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windef.h>
+
+#define IDR_BROWSE_MAIN_MENU           1000
+
+#define ID_BROWSE_NEW_WINDOW           275
+#define ID_BROWSE_OPEN                 256
+#define ID_BROWSE_SAVE                 257
+#define ID_BROWSE_SAVE_AS              258
+#define ID_BROWSE_PRINT_FORMAT         259
+#define ID_BROWSE_PRINT                260
+#define ID_BROWSE_PRINT_PREVIEW        277
+#define ID_BROWSE_PROPERTIES           262
+#define ID_BROWSE_ABOUT                336
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 1af0365..d1787cb 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -40,6 +40,8 @@
 #include "htiframe.h"
 
 #include "wine/unicode.h"
+#include "resource.h"
+
 
 /**********************************************************************
  * Shell Instance Objects




More information about the wine-cvs mailing list