From 97ea59d7c9a119b236124143f6eab4817aceb68a Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 7 Feb 2004 21:17:27 +0000 Subject: [PATCH] toolbars to control web browser svn path=/trunk/; revision=8085 --- .../subsys/system/explorer/explorer_intres.h | 9 +- .../subsys/system/explorer/res/toolbar.bmp | Bin 958 -> 1678 bytes .../system/explorer/shell/mainframe.cpp | 18 ++-- .../subsys/system/explorer/shell/webchild.cpp | 78 ++++++++++++++---- 4 files changed, 81 insertions(+), 24 deletions(-) diff --git a/reactos/subsys/system/explorer/explorer_intres.h b/reactos/subsys/system/explorer/explorer_intres.h index a3b9a289873..831a0b4279d 100644 --- a/reactos/subsys/system/explorer/explorer_intres.h +++ b/reactos/subsys/system/explorer/explorer_intres.h @@ -114,7 +114,7 @@ #define ID_ABOUT_WINEFILE 1705 #define IDC_FILETREE 10001 #define ID_EXPLORER_FAQ 10002 -#define ID_WEB_WINDOW 10003 +#define ID_WEB_WINDOW 10003 #define ID_WINDOW_AUTOSORT 0x8003 #define ID_VIEW_FULLSCREEN 0x8004 #define ID_PREFERED_SIZES 0x8005 @@ -127,7 +127,12 @@ #define ID_DRIVE_FIRST 0x9006 #define ID_ABOUT_WINDOWS 40002 #define ID_ABOUT_EXPLORER 40003 -#define ID_DESKTOPBAR_SETTINGS 40005 +#define ID_DESKTOPBAR_SETTINGS 40004 +#define ID_BROWSE_BACK 40005 +#define ID_BROWSE_FORWARD 40006 +#define ID_BROWSE_HOME 40007 +#define ID_BROWSE_SEARCH 40008 +#define ID_STOP 40009 #define ID_WINDOW_NEW 0xE130 #define ID_WINDOW_ARRANGE 0xE131 #define ID_WINDOW_CASCADE 0xE132 diff --git a/reactos/subsys/system/explorer/res/toolbar.bmp b/reactos/subsys/system/explorer/res/toolbar.bmp index 9a0d13c4c203e168691b5444bc1453b8436d62af..632b1ec6750950d9aecb0a43ab66d2685e362799 100644 GIT binary patch literal 1678 zcmaJ>%Zl4T5S&1W_hxije?q<^3`k&tF8d)i3>m=+)&au^1iAZ^pAhWA9^#uXKIB&x z1WHayRrg5N`jNIZJu@0rb#=G&;?0Y|>4acwh0+pRD>ez_<8E-)DK>+)b>odt4)|$7x4M14Y0MMW!SXR{%QF_BTw;C z|M|suw!)KM@PK^6Gl&81D~vpYZ*!YxVZG=&@~}Kops2^yb=_wb`dHGYT`~3<`YrPC zDVpgZM$$Im)2D#s^VU<(n)SgJwT^jvd2P^;A*St;hxtR^%A-H}LkS*fvzRx40c+V1 zlYNzfCvhZ1uk44-q%Y!m8tf`*Jb0}f{a9GVvrx=dtVoSzOL2SIFs^n`R zy~ez<-*A9=Q{2c+l6}eE0s~>+lR3@=%Vp4`;eQ z`OHT>elsV^HM17&#rITi5{5G%L(ZeG`35O2*20GaXFe^NIMin|Td@;Fl;VveGc~dC b`xf_V`=G>=GuNjjw(tDP$ZLB2$j#k= PM_FIRST_LANGUAGE && wParam <= PM_LAST_LANGUAGE) - STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE); - else */if ((id=IDW_FIRST_CHILD+0x100) && - (idSC_RESTORE)) - MessageBox(_hwnd, TEXT("Not yet implemented"), ResString(IDS_TITLE), MB_OK); - #ifndef _NO_MDI return DefFrameProc(_hwnd, _hmdiclient, WM_COMMAND, MAKELONG(id,code), 0); #else diff --git a/reactos/subsys/system/explorer/shell/webchild.cpp b/reactos/subsys/system/explorer/shell/webchild.cpp index 9ef483b64a9..6cf06cede1d 100644 --- a/reactos/subsys/system/explorer/shell/webchild.cpp +++ b/reactos/subsys/system/explorer/shell/webchild.cpp @@ -29,6 +29,8 @@ #include "../utility/utility.h" #include "../explorer.h" +#include "../explorer_intres.h" + #include "webchild.h" //#include @@ -184,7 +186,7 @@ HWND create_webchildwindow(HWND hmdiclient, const WebChildWndInfo& info) static const CLSID CLSID_MozillaBrowser = {0x1339B54C, 0x3453, 0x11D2, {0x93, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; - + WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info) : super(hwnd), _evt_handler1(NULL), @@ -223,20 +225,68 @@ WebChildWindow::~WebChildWindow() LRESULT WebChildWindow::WndProc(UINT message, WPARAM wparam, LPARAM lparam) { - if (message == WM_ERASEBKGND) { - if (!_control) { - HDC hdc = (HDC)wparam; - ClientRect rect(_hwnd); + try { + switch(message) { + case WM_ERASEBKGND: + if (!_control) { + HDC hdc = (HDC)wparam; + ClientRect rect(_hwnd); - HBRUSH hbrush = CreateSolidBrush(RGB(200,200,235)); - BkMode mode(hdc, TRANSPARENT); - TextColor color(hdc, RGB(200,40,40)); - FillRect(hdc, &rect, hbrush); - DrawText(hdc, TEXT("Sorry - no web browser control could be loaded."), -1, &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE); - DeleteObject(hbrush); + HBRUSH hbrush = CreateSolidBrush(RGB(200,200,235)); + BkMode mode(hdc, TRANSPARENT); + TextColor color(hdc, RGB(200,40,40)); + FillRect(hdc, &rect, hbrush); + DrawText(hdc, TEXT("Sorry - no web browser control could be loaded."), -1, &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE); + DeleteObject(hbrush); + } + + return TRUE; + + case PM_DISPATCH_COMMAND: { + if (_control) { + HRESULT hr = E_FAIL; + + switch(LOWORD(wparam)) { + case ID_BROWSE_BACK: + hr = _control->GoBack(); + break; + + case ID_BROWSE_FORWARD: + hr = _control->GoForward(); + break; + + case ID_BROWSE_HOME: + hr = _control->GoHome(); + break; + + case ID_BROWSE_SEARCH: + hr = _control->GoSearch(); + break; + + case ID_REFRESH: + hr = _control->Refresh(); + break; + + case ID_STOP: + hr = _control->Stop(); + break; + + default: + return FALSE; + } + + if (FAILED(hr) && hr!=E_FAIL) + THROW_EXCEPTION(hr); + } + + return TRUE;} + + default: + return super::WndProc(message, wparam, lparam); } + } catch(COMException& e) { + HandleException(e, _hwnd); + } - return TRUE; - } else - return super::WndProc(message, wparam, lparam); + return 0; }