mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
store statustexts in MDI children
svn path=/trunk/; revision=8139
This commit is contained in:
parent
9f5e152d22
commit
f0dea6d3a0
7 changed files with 50 additions and 62 deletions
|
@ -96,7 +96,7 @@ WebChildWndInfo::WebChildWndInfo(HWND hmdiclient, LPCTSTR url)
|
|||
|
||||
|
||||
FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
|
||||
: ChildWindow(hwnd)
|
||||
: ChildWindow(hwnd, info)
|
||||
{
|
||||
CONTEXT("FileChildWindow::FileChildWindow()");
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#define PM_OPEN_WINDOW (WM_APP+0x07)
|
||||
enum OPEN_WINDOW_MODE {OWM_EXPLORE=1, OWM_DETAILS=2, OWM_PIDL=4};
|
||||
|
||||
#define PM_SETSTATUSTEXT (WM_APP+0x1D)
|
||||
|
||||
|
||||
/// Explorer frame window
|
||||
struct MainFrame : public PreTranslateWindow
|
||||
|
|
|
@ -49,7 +49,7 @@ static LPARAM TreeView_GetItemData(HWND hwndTreeView, HTREEITEM hItem)
|
|||
|
||||
|
||||
ShellBrowserChild::ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info)
|
||||
: super(hwnd),
|
||||
: super(hwnd, info),
|
||||
_create_info(info)
|
||||
{
|
||||
_pShellView = NULL;
|
||||
|
|
|
@ -192,7 +192,8 @@ static const CLSID CLSID_MozillaBrowser =
|
|||
|
||||
|
||||
WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
|
||||
: super(hwnd)
|
||||
: super(hwnd, info),
|
||||
web_super(_navigator)
|
||||
{
|
||||
// first try to create a web control with MS IE's CLASSID
|
||||
HRESULT hr = create_control(hwnd, CLSID_WebBrowser, IID_IWebBrowser2);
|
||||
|
@ -204,15 +205,12 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
|
|||
if (SUCCEEDED(hr)) {
|
||||
_navigator.attach(_control);
|
||||
|
||||
HWND hwndFrame = GetParent(info._hmdiclient);
|
||||
|
||||
// handling events using DWebBrowserEvents2
|
||||
_evt_handler = auto_ptr<DWebBrowserEvents2Handler>(new DWebBrowserEvents2Handler(_hwnd, hwndFrame, _navigator));
|
||||
_connector = auto_ptr<EventConnector>(new EventConnector(_control, DIID_DWebBrowserEvents2, this));
|
||||
|
||||
#ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004)
|
||||
Variant vtMissing;
|
||||
#endif
|
||||
get_browser()->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
|
||||
_control->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
|
||||
//browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,6 +398,11 @@ template<typename BASE, typename SMARTPTR> struct IPCtrlWindow : public BASE
|
|||
{
|
||||
}
|
||||
|
||||
template<typename T> IPCtrlWindow(HWND hwnd, T& info)
|
||||
: super(hwnd, info)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT create_control(HWND hwnd, REFIID clsid, REFIID riid)
|
||||
{
|
||||
// Erzeugen einer Instanz des Controls
|
||||
|
@ -565,8 +570,8 @@ struct DWebBrowserEvents2IF
|
|||
};
|
||||
|
||||
|
||||
// Das Webbrowser-Control muß zunächst komplett initialisiert sein, bevor eine Seite,
|
||||
// die nicht auf das Internet zugreift (z.B. addcom/./index.html) dargestellt werden kann.
|
||||
// The web browser control has to be initialized completely before being able,
|
||||
// to display a page, that does not access internet.
|
||||
struct ANSUNC BrowserNavigator
|
||||
{
|
||||
BrowserNavigator();
|
||||
|
@ -676,7 +681,7 @@ struct ANSUNC DWebBrowserEvents2Impl : public SimpleComObject,
|
|||
break;
|
||||
|
||||
|
||||
//-> anything below here is not present in DWebBrowserEvents, only in DWebBrowserEvents2:
|
||||
// anything below here is not present in DWebBrowserEvents, only in DWebBrowserEvents2: ->
|
||||
|
||||
case DISPID_FRAMEBEFORENAVIGATE:
|
||||
if (pDispParams->cArgs != 6)
|
||||
|
@ -886,23 +891,28 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
/// Web control Eventhandler using DWebBrowserEvents2Impl
|
||||
|
||||
struct DWebBrowserEvents2Handler : public DWebBrowserEvents2Impl
|
||||
/// encapsulation of Web control in MDI child windows
|
||||
struct WebChildWindow : public IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2> >,
|
||||
public DWebBrowserEvents2Impl
|
||||
{
|
||||
typedef DWebBrowserEvents2Impl super;
|
||||
typedef IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2> > super;
|
||||
typedef DWebBrowserEvents2Impl web_super;
|
||||
|
||||
DWebBrowserEvents2Handler(HWND hwnd, HWND hwndFrame, BrowserNavigator& navigator)
|
||||
: DWebBrowserEvents2Impl(navigator),
|
||||
_hwnd(hwnd),
|
||||
_hwndFrame(hwndFrame),
|
||||
_navigator(navigator),
|
||||
_browser(navigator.get_browser(), IID_IWebBrowser2),
|
||||
_connector(navigator.get_browser(), DIID_DWebBrowserEvents2, this)
|
||||
WebChildWindow(HWND hwnd, const WebChildWndInfo& info);
|
||||
|
||||
static WebChildWindow* create(const FileChildWndInfo& info)
|
||||
{
|
||||
ChildWindow* child = ChildWindow::create(info, info._pos.rcNormalPosition,
|
||||
WINDOW_CREATOR_INFO(WebChildWindow,WebChildWndInfo), CLASSNAME_CHILDWND, NULL);
|
||||
|
||||
ShowWindow(*child, info._pos.showCmd);
|
||||
|
||||
return static_cast<WebChildWindow*>(child);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// DWebBrowserEvents2Impl overides ->
|
||||
|
||||
void BeforeNavigate2(IDispatch* pDisp, const Variant& url, const Variant& flags,
|
||||
const Variant& targetFrameName, const Variant& postData,
|
||||
const Variant& headers, VARIANT_BOOL& cancel)
|
||||
|
@ -913,12 +923,13 @@ protected:
|
|||
void NavigateComplete2(IDispatch* pDisp, const Variant& url)
|
||||
{
|
||||
//String adr = (BStr)url;
|
||||
super::NavigateComplete2(pDisp, url);
|
||||
web_super::NavigateComplete2(pDisp, url);
|
||||
}
|
||||
|
||||
void StatusTextChange(const BStr& text)
|
||||
{
|
||||
SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)String(text).c_str());
|
||||
_statusText = text;
|
||||
SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)_statusText.c_str());
|
||||
}
|
||||
|
||||
void ProgressChange(long Progress, long ProgressMax)
|
||||
|
@ -940,7 +951,7 @@ protected:
|
|||
void PropertyChange(const BStr& Property)
|
||||
{
|
||||
Variant value;
|
||||
_browser->GetProperty(Property, &value);
|
||||
_control->GetProperty(Property, &value);
|
||||
}
|
||||
|
||||
void CommandStateChange(long command/*CSC_NAVIGATEFORWARD, CSC_NAVIGATEBACK*/, bool enable)
|
||||
|
@ -1058,40 +1069,10 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
HWND _hwnd;
|
||||
HWND _hwndFrame;
|
||||
BrowserNavigator& _navigator;
|
||||
SIfacePtr<IWebBrowser2> _browser;
|
||||
EventConnector _connector;
|
||||
};
|
||||
|
||||
|
||||
/// encapsulation of Web control in MDI child windows
|
||||
struct WebChildWindow : public IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2> >
|
||||
{
|
||||
typedef IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2> > super;
|
||||
|
||||
WebChildWindow(HWND hwnd, const WebChildWndInfo& info);
|
||||
|
||||
static WebChildWindow* create(const FileChildWndInfo& info)
|
||||
{
|
||||
ChildWindow* child = ChildWindow::create(info, info._pos.rcNormalPosition,
|
||||
WINDOW_CREATOR_INFO(WebChildWindow,WebChildWndInfo), CLASSNAME_CHILDWND, NULL);
|
||||
|
||||
ShowWindow(*child, info._pos.showCmd);
|
||||
|
||||
return static_cast<WebChildWindow*>(child);
|
||||
}
|
||||
|
||||
IWebBrowser2* get_browser()
|
||||
{
|
||||
return _control;
|
||||
}
|
||||
|
||||
protected:
|
||||
BrowserNavigator _navigator;
|
||||
auto_ptr<DWebBrowserEvents2Handler> _evt_handler;
|
||||
auto_ptr<EventConnector> _connector;
|
||||
|
||||
LRESULT WndProc(UINT message, WPARAM wparam, LPARAM lparam);
|
||||
};
|
||||
|
|
|
@ -368,8 +368,9 @@ int SubclassedWindow::Notify(int id, NMHDR* pnmh)
|
|||
}
|
||||
|
||||
|
||||
ChildWindow::ChildWindow(HWND hwnd)
|
||||
: super(hwnd)
|
||||
ChildWindow::ChildWindow(HWND hwnd, const ChildWndInfo& info)
|
||||
: super(hwnd),
|
||||
_hwndFrame(GetParent(info._hmdiclient))
|
||||
{
|
||||
_focus_pane = 0;
|
||||
_split_pos = DEFAULT_SPLIT_POS;
|
||||
|
@ -487,6 +488,11 @@ LRESULT ChildWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
|||
case PM_DISPATCH_COMMAND:
|
||||
return FALSE;
|
||||
|
||||
case WM_MDIACTIVATE:
|
||||
if ((HWND)lparam == _hwnd)
|
||||
SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)_statusText.c_str());
|
||||
break;
|
||||
|
||||
default: def:
|
||||
return DefMDIChildProc(_hwnd, nmsg, wparam, lparam);
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ struct ChildWindow : public Window
|
|||
{
|
||||
typedef Window super;
|
||||
|
||||
ChildWindow(HWND hwnd);
|
||||
ChildWindow(HWND hwnd, const ChildWndInfo& info);
|
||||
|
||||
static ChildWindow* create(const ChildWndInfo& info, const RECT& rect, CREATORFUNC_INFO creator,
|
||||
LPCTSTR classname, LPCTSTR title=NULL);
|
||||
|
@ -304,8 +304,13 @@ protected:
|
|||
|
||||
int _split_pos;
|
||||
int _last_split;
|
||||
|
||||
HWND _hwndFrame;
|
||||
String _statusText;
|
||||
};
|
||||
|
||||
#define PM_SETSTATUSTEXT (WM_APP+0x1D)
|
||||
|
||||
|
||||
/**
|
||||
PreTranslateWindow is used to register windows to be called by Window::pretranslate_msg().
|
||||
|
|
Loading…
Reference in a new issue