toolbars to control web browser

svn path=/trunk/; revision=8085
This commit is contained in:
Martin Fuchs 2004-02-07 21:17:27 +00:00
parent 77d84e17ca
commit 97ea59d7c9
4 changed files with 81 additions and 24 deletions

View file

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -73,7 +73,15 @@ MainFrame::MainFrame(HWND hwnd)
/*TODO
{4, ID_... , TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
{5, ID_... , TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
*/ };
*/
{0, 0, 0, BTNS_SEP, {0, 0}, 0, 0},
{7, ID_BROWSE_BACK, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
{8, ID_BROWSE_FORWARD, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
{9, ID_BROWSE_HOME, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
{10, ID_BROWSE_SEARCH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
{11, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
{12, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON, {0, 0}, 0, 0},
};
_htoolbar = CreateToolbarEx(hwnd, WS_CHILD|WS_VISIBLE,
IDW_TOOLBAR, 2, g_Globals._hInstance, IDB_TOOLBAR, toolbarBtns,
@ -130,7 +138,7 @@ MainFrame::MainFrame(HWND hwnd)
}
// insert Registry button
SendMessage(_hdrivebar, TB_ADDSTRING, 0, (LPARAM)TEXT("Registry\0"));
SendMessage(_hdrivebar, TB_ADDSTRING, 0, (LPARAM)TEXT("Reg.\0"));
drivebarBtn.idCommand = ID_DRIVE_REGISTRY;
SendMessage(_hdrivebar, TB_INSERTBUTTON, btn++, (LPARAM)&drivebarBtn);
@ -634,12 +642,6 @@ int MainFrame::Command(int id, int code)
break;
default:
/*@todo if (wParam >= PM_FIRST_LANGUAGE && wParam <= PM_LAST_LANGUAGE)
STRING_SelectLanguageByNumber(wParam - PM_FIRST_LANGUAGE);
else */if ((id<IDW_FIRST_CHILD || id>=IDW_FIRST_CHILD+0x100) &&
(id<SC_SIZE || id>SC_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

View file

@ -29,6 +29,8 @@
#include "../utility/utility.h"
#include "../explorer.h"
#include "../explorer_intres.h"
#include "webchild.h"
//#include <mshtml.h>
@ -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;
}