display status texts

svn path=/trunk/; revision=8123
This commit is contained in:
Martin Fuchs 2004-02-09 23:21:20 +00:00
parent 435db13da9
commit e760b79c60
10 changed files with 97 additions and 68 deletions

View file

@ -37,8 +37,9 @@
#include "../explorer_intres.h"
FileChildWndInfo::FileChildWndInfo(LPCTSTR path, ENTRY_TYPE etype)
: _etype(etype)
FileChildWndInfo::FileChildWndInfo(HWND hmdiclient, LPCTSTR path, ENTRY_TYPE etype)
: super(hmdiclient),
_etype(etype)
{
if (etype == ET_UNKNOWN)
#ifdef __WINE__
@ -62,34 +63,34 @@ FileChildWndInfo::FileChildWndInfo(LPCTSTR path, ENTRY_TYPE etype)
}
ShellChildWndInfo::ShellChildWndInfo(LPCTSTR path, const ShellPath& root_shell_path)
: FileChildWndInfo(path, ET_SHELL),
ShellChildWndInfo::ShellChildWndInfo(HWND hmdiclient, LPCTSTR path, const ShellPath& root_shell_path)
: FileChildWndInfo(hmdiclient, path, ET_SHELL),
_shell_path(path&&*path? path: root_shell_path),
_root_shell_path(root_shell_path)
{
}
NtObjChildWndInfo::NtObjChildWndInfo(LPCTSTR path)
: FileChildWndInfo(path, ET_NTOBJS)
NtObjChildWndInfo::NtObjChildWndInfo(HWND hmdiclient, LPCTSTR path)
: FileChildWndInfo(hmdiclient, path, ET_NTOBJS)
{
}
RegistryChildWndInfo::RegistryChildWndInfo(LPCTSTR path)
: FileChildWndInfo(path, ET_REGISTRY)
RegistryChildWndInfo::RegistryChildWndInfo(HWND hmdiclient, LPCTSTR path)
: FileChildWndInfo(hmdiclient, path, ET_REGISTRY)
{
}
FATChildWndInfo::FATChildWndInfo(LPCTSTR path)
: FileChildWndInfo(path, ET_FAT)
FATChildWndInfo::FATChildWndInfo(HWND hmdiclient, LPCTSTR path)
: FileChildWndInfo(hmdiclient, path, ET_FAT)
{
}
WebChildWndInfo::WebChildWndInfo(LPCTSTR url)
: FileChildWndInfo(url, ET_WEB)
WebChildWndInfo::WebChildWndInfo(HWND hmdiclient, LPCTSTR url)
: FileChildWndInfo(hmdiclient, url, ET_WEB)
{
}
@ -310,7 +311,7 @@ void FileChildWindow::collapse_entry(Pane* pane, Entry* dir)
}
FileChildWindow* FileChildWindow::create(HWND hmdiclient, const FileChildWndInfo& info)
FileChildWindow* FileChildWindow::create(const FileChildWndInfo& info)
{
CONTEXT("FileChildWindow::create()");
@ -327,7 +328,7 @@ FileChildWindow* FileChildWindow::create(HWND hmdiclient, const FileChildWndInfo
mcs.lParam = 0;
FileChildWindow* child = static_cast<FileChildWindow*>(
create_mdi_child(hmdiclient, mcs, WINDOW_CREATOR_INFO(FileChildWindow,FileChildWndInfo), &info));
create_mdi_child(info, mcs, WINDOW_CREATOR_INFO(FileChildWindow,FileChildWndInfo)));
return child;
}
@ -409,9 +410,9 @@ LRESULT FileChildWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
switch(LOWORD(wparam)) {
case ID_WINDOW_NEW: {CONTEXT("FileChildWindow PM_DISPATCH_COMMAND ID_WINDOW_NEW");
if (_root._entry->_etype == ET_SHELL)
FileChildWindow::create(GetParent(_hwnd)/*_hmdiclient*/, ShellChildWndInfo(_path,DesktopFolderPath()));
FileChildWindow::create(ShellChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path, DesktopFolderPath()));
else
FileChildWindow::create(GetParent(_hwnd)/*_hmdiclient*/, FileChildWndInfo(_path));
FileChildWindow::create(FileChildWndInfo(GetParent(_hwnd)/*_hmdiclient*/, _path));
break;}
case ID_REFRESH: {CONTEXT("ID_REFRESH");

View file

@ -27,9 +27,11 @@
/// information structure for creation of FileChildWindow
struct FileChildWndInfo
struct FileChildWndInfo : public ChildWndInfo
{
FileChildWndInfo(LPCTSTR path, ENTRY_TYPE etype=ET_UNKNOWN);
typedef ChildWndInfo super;
FileChildWndInfo(HWND hmdiclient, LPCTSTR path, ENTRY_TYPE etype=ET_UNKNOWN);
ENTRY_TYPE _etype;
LPCTSTR _path;
@ -41,7 +43,9 @@ struct FileChildWndInfo
/// information structure for creation of ShellBrowserChild
struct ShellChildWndInfo : public FileChildWndInfo
{
ShellChildWndInfo(LPCTSTR path, const ShellPath& root_shell_path);
typedef FileChildWndInfo super;
ShellChildWndInfo(HWND hmdiclient, LPCTSTR path, const ShellPath& root_shell_path);
ShellPath _shell_path;
ShellPath _root_shell_path;
@ -50,25 +54,33 @@ struct ShellChildWndInfo : public FileChildWndInfo
/// information structure for creation of FileChildWindow for NT object namespace
struct NtObjChildWndInfo : public FileChildWndInfo
{
NtObjChildWndInfo(LPCTSTR path);
typedef FileChildWndInfo super;
NtObjChildWndInfo(HWND hmdiclient, LPCTSTR path);
};
/// information structure for creation of FileChildWindow for the Registry
struct RegistryChildWndInfo : public FileChildWndInfo
{
RegistryChildWndInfo(LPCTSTR path);
typedef FileChildWndInfo super;
RegistryChildWndInfo(HWND hmdiclient, LPCTSTR path);
};
/// information structure for creation of FileChildWindow
struct FATChildWndInfo : public FileChildWndInfo
{
FATChildWndInfo(LPCTSTR path);
typedef FileChildWndInfo super;
FATChildWndInfo(HWND hmdiclient, LPCTSTR path);
};
/// information structure for creation of WebChildWindow
struct WebChildWndInfo : public FileChildWndInfo
{
WebChildWndInfo(LPCTSTR url);
typedef FileChildWndInfo super;
WebChildWndInfo(HWND hmdiclient, LPCTSTR url);
};
@ -80,7 +92,7 @@ struct FileChildWindow : public ChildWindow
FileChildWindow(HWND hwnd, const FileChildWndInfo& info);
~FileChildWindow();
static FileChildWindow* create(HWND hmdiclient, const FileChildWndInfo& info);
static FileChildWindow* create(const FileChildWndInfo& info);
protected:
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);

View file

@ -35,7 +35,7 @@
/* We can't include webchild.h here - otherwise MinGW produces errors like: "multiple definition of `QACONTAINERFLAGS'"
#include "webchild.h"
*/
extern HWND create_webchildwindow(HWND hmdiclient, const WebChildWndInfo& info);
extern HWND create_webchildwindow(const WebChildWndInfo& info);
#include "../explorer_intres.h"
@ -399,7 +399,7 @@ LRESULT MainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
OBJ_CONTEXT("create ShellChildWndInfo", path);
// Shell Namespace as default view
ShellChildWndInfo create_info(path, shell_path);
ShellChildWndInfo create_info(_hmdiclient, path, shell_path);
create_info._pos.showCmd = SW_SHOWMAXIMIZED;
create_info._pos.rcNormalPosition.left = 0;
@ -410,7 +410,7 @@ LRESULT MainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
create_info._open_mode = (OPEN_WINDOW_MODE)wparam;
// FileChildWindow::create(_hmdiclient, create_info);
return (LRESULT)ShellBrowserChild::create(_hmdiclient, create_info);
return (LRESULT)ShellBrowserChild::create(create_info);
}
break;}
@ -419,6 +419,10 @@ LRESULT MainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
return (LRESULT)(HWND)_hstatusbar;
break;
case PM_SETSTATUSTEXT:
SendMessage(_hstatusbar, SB_SETTEXT, 0, lparam);
break;
default:
#ifndef _NO_MDI
return DefFrameProc(_hwnd, _hmdiclient, nmsg, wparam, lparam);
@ -463,7 +467,7 @@ int MainFrame::Command(int id, int code)
GetCurrentDirectory(MAX_PATH, path); ///@todo store last directory per drive
#ifndef _NO_MDI
FileChildWindow::create(_hmdiclient, FileChildWndInfo(path));
FileChildWindow::create(FileChildWndInfo(_hmdiclient, path));
#else
///@todo SDI implementation
#endif
@ -481,7 +485,7 @@ int MainFrame::Command(int id, int code)
GetCurrentDirectory(MAX_PATH, path);
#ifndef _NO_MDI
FileChildWindow::create(_hmdiclient, FileChildWndInfo(path));
FileChildWindow::create(FileChildWndInfo(_hmdiclient, path));
#else
///@todo SDI implementation
#endif
@ -564,7 +568,7 @@ int MainFrame::Command(int id, int code)
GetCurrentDirectory(MAX_PATH, path);
ShellBrowserChild::create(_hmdiclient, ShellChildWndInfo(path,DesktopFolderPath()));
ShellBrowserChild::create(ShellChildWndInfo(_hmdiclient, path, DesktopFolderPath()));
break;}
case ID_DRIVE_SHELL_NS: {
@ -576,7 +580,7 @@ int MainFrame::Command(int id, int code)
GetCurrentDirectory(MAX_PATH, path);
#ifndef _NO_MDI
FileChildWindow::create(_hmdiclient, ShellChildWndInfo(path,DesktopFolderPath()));
FileChildWindow::create(ShellChildWndInfo(_hmdiclient, path, DesktopFolderPath()));
#else
///@todo SDI implementation
#endif
@ -587,7 +591,7 @@ int MainFrame::Command(int id, int code)
break;
#ifndef _NO_MDI
FileChildWindow::create(_hmdiclient, NtObjChildWndInfo(TEXT("\\")));
FileChildWindow::create(NtObjChildWndInfo(_hmdiclient, TEXT("\\")));
#else
///@todo SDI implementation
#endif
@ -598,7 +602,7 @@ int MainFrame::Command(int id, int code)
break;
#ifndef _NO_MDI
FileChildWindow::create(_hmdiclient, RegistryChildWndInfo(TEXT("\\")));
FileChildWindow::create(RegistryChildWndInfo(_hmdiclient, TEXT("\\")));
#else
///@todo SDI implementation
#endif
@ -612,14 +616,14 @@ int MainFrame::Command(int id, int code)
break;
#ifndef _NO_MDI
FileChildWindow::create(_hmdiclient, FATChildWndInfo(TEXT("FAT Image"))); //@@
FileChildWindow::create(FATChildWndInfo(_hmdiclient, TEXT("FAT Image"))); //@@
#else
///@todo SDI implementation
#endif
break;}
case ID_WEB_WINDOW:
create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://www.reactos.com")));
create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.reactos.com")));
//create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://localhost")));
break;
@ -634,7 +638,7 @@ int MainFrame::Command(int id, int code)
break;
case ID_EXPLORER_FAQ:
create_webchildwindow(_hmdiclient, WebChildWndInfo(TEXT("http://www.sky.franken.de/explorer/")));
create_webchildwindow(WebChildWndInfo(_hmdiclient, TEXT("http://www.sky.franken.de/explorer/")));
break;
case IDW_ADDRESSBAR:

View file

@ -29,6 +29,8 @@
#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

View file

@ -418,7 +418,7 @@ LRESULT ShellBrowserChild::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
case PM_DISPATCH_COMMAND: {
switch(LOWORD(wparam)) {
case ID_WINDOW_NEW: {CONTEXT("ShellBrowserChild PM_DISPATCH_COMMAND ID_WINDOW_NEW");
ShellBrowserChild::create(GetParent(_hwnd)/*_hmdiclient*/, _create_info);
ShellBrowserChild::create(_create_info);
break;}
default:

View file

@ -37,11 +37,11 @@ struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl
ShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info);
~ShellBrowserChild();
static ShellBrowserChild* create(HWND hmdiclient, const FileChildWndInfo& info)
static ShellBrowserChild* create(const FileChildWndInfo& info)
{
#ifndef _NO_MDI
ChildWindow* child = ChildWindow::create(hmdiclient, info._pos.rcNormalPosition,
WINDOW_CREATOR_INFO(ShellBrowserChild,ShellChildWndInfo), CLASSNAME_CHILDWND, NULL, &info);
ChildWindow* child = ChildWindow::create(info, info._pos.rcNormalPosition,
WINDOW_CREATOR_INFO(ShellBrowserChild,ShellChildWndInfo), CLASSNAME_CHILDWND, NULL);
#else
///@todo SDI implementation
#endif

View file

@ -173,9 +173,9 @@ void BrowserNavigator::navigated(LPCTSTR url)
}
HWND create_webchildwindow(HWND hmdiclient, const WebChildWndInfo& info)
HWND create_webchildwindow(const WebChildWndInfo& info)
{
WebChildWindow* pWnd = WebChildWindow::create(hmdiclient, info);
WebChildWindow* pWnd = WebChildWindow::create(info);
if (!pWnd)
return 0;
@ -200,11 +200,13 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info)
hr = create_control(hwnd, CLSID_MozillaBrowser, IID_IWebBrowser2);
if (SUCCEEDED(hr)) {
HWND hwndFrame = GetParent(info._hmdiclient);
// handling events using DWebBrowserEvents
_evt_handler1 = auto_ptr<DWebBrowserEventsHandler>(new DWebBrowserEventsHandler(_hwnd, _control));
_evt_handler1 = auto_ptr<DWebBrowserEventsHandler>(new DWebBrowserEventsHandler(_hwnd, hwndFrame, _control));
// handling events using DWebBrowserEvents2
_evt_handler2 = auto_ptr<DWebBrowserEvents2Handler>(new DWebBrowserEvents2Handler(_hwnd, _control));
_evt_handler2 = auto_ptr<DWebBrowserEvents2Handler>(new DWebBrowserEvents2Handler(_hwnd, hwndFrame, _control));
SIfacePtr<IWebBrowser2> browser(get_browser());

View file

@ -1068,8 +1068,9 @@ protected:
struct DWebBrowserEventsHandler : public DWebBrowserEventsImpl
{
DWebBrowserEventsHandler(HWND hwnd, IWebBrowser* browser)
DWebBrowserEventsHandler(HWND hwnd, HWND hwndFrame, IWebBrowser* browser)
: _hwnd(hwnd),
_hwndFrame(hwndFrame),
_browser(browser, IID_IWebBrowser2),
_connector(browser, DIID_DWebBrowserEvents, this)
{
@ -1086,8 +1087,7 @@ protected:
HRESULT StatusTextChange(const String& text)
{
_status = text;
SetWindowText(_hwnd, FmtString(_T("%#s - %#s"), _title.c_str(), _status.c_str()));
SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)text.c_str());
return S_OK;
}
@ -1108,8 +1108,7 @@ protected:
HRESULT TitleChange(const String& text)
{
_title = text;
SetWindowText(_hwnd, FmtString(_T("%#s - %#s"), _title.c_str(), _status.c_str()));
SetWindowText(_hwnd, text);
return S_OK;
}
@ -1146,7 +1145,7 @@ protected:
protected:
HWND _hwnd;
String _title, _status;
HWND _hwndFrame;
SIfacePtr<IWebBrowser2> _browser;
EventConnector _connector;
};
@ -1158,8 +1157,9 @@ struct DWebBrowserEvents2Handler : public DWebBrowserEvents2Impl
{
typedef DWebBrowserEvents2Impl super;
DWebBrowserEvents2Handler(HWND hwnd, IWebBrowser* browser)
DWebBrowserEvents2Handler(HWND hwnd, HWND hwndFrame, IWebBrowser* browser)
: _hwnd(hwnd),
_hwndFrame(hwndFrame),
_navigator(browser),
DWebBrowserEvents2Impl(_navigator),
_browser(browser, IID_IWebBrowser2),
@ -1183,8 +1183,7 @@ protected:
void StatusTextChange(const BStr& text)
{
_status = text;
SetWindowText(_hwnd, FmtString(_T("%#s - %#s"), _title.c_str(), _status.c_str()));
SendMessage(_hwndFrame, PM_SETSTATUSTEXT, 0, (LPARAM)String(text).c_str());
}
void ProgressChange(long Progress, long ProgressMax)
@ -1225,8 +1224,7 @@ protected:
void TitleChange(const BStr& text)
{
_title = text;
SetWindowText(_hwnd, FmtString(_T("%#s - %#s"), _title.c_str(), _status.c_str()));
SetWindowText(_hwnd, String(text));
}
void TitleIconChange(const BStr& text)
@ -1327,11 +1325,10 @@ protected:
protected:
HWND _hwnd;
HWND _hwndFrame;
BrowserNavigator _navigator;
SIfacePtr<IWebBrowser2> _browser;
EventConnector _connector;
String _title, _status;
};
@ -1342,10 +1339,10 @@ struct WebChildWindow : public IPCtrlWindow<ChildWindow, SIfacePtr<IWebBrowser2>
WebChildWindow(HWND hwnd, const WebChildWndInfo& info);
static WebChildWindow* create(HWND hmdiclient, const FileChildWndInfo& info)
static WebChildWindow* create(const FileChildWndInfo& info)
{
ChildWindow* child = ChildWindow::create(hmdiclient, info._pos.rcNormalPosition,
WINDOW_CREATOR_INFO(WebChildWindow,WebChildWndInfo), CLASSNAME_CHILDWND, NULL, &info);
ChildWindow* child = ChildWindow::create(info, info._pos.rcNormalPosition,
WINDOW_CREATOR_INFO(WebChildWindow,WebChildWndInfo), CLASSNAME_CHILDWND, NULL);
ShowWindow(*child, info._pos.showCmd);

View file

@ -120,16 +120,16 @@ HWND Window::Create(CREATORFUNC_INFO creator, const void* info, DWORD dwExStyle,
}
Window* Window::create_mdi_child(HWND hmdiclient, const MDICREATESTRUCT& mcs, CREATORFUNC_INFO creator, const void* info)
Window* Window::create_mdi_child(const ChildWndInfo& info, const MDICREATESTRUCT& mcs, CREATORFUNC_INFO creator)
{
Lock lock(GetStaticWindowData()._create_crit_sect); // protect access to s_window_creator and s_new_info
s_window_creator = (CREATORFUNC) creator;
s_new_info = info;
s_new_info = &info;
s_hcbtHook = SetWindowsHookEx(WH_CBT, MDICBTHookProc, 0, GetCurrentThreadId());
HWND hwnd = (HWND) SendMessage(hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs);
HWND hwnd = (HWND) SendMessage(info._hmdiclient, WM_MDICREATE, 0, (LPARAM)&mcs);
UnhookWindowsHookEx(s_hcbtHook);
@ -377,7 +377,8 @@ ChildWindow::ChildWindow(HWND hwnd)
}
ChildWindow* ChildWindow::create(HWND hmdiclient, const RECT& rect, CREATORFUNC_INFO creator, LPCTSTR classname, LPCTSTR title, const void* info)
ChildWindow* ChildWindow::create(const ChildWndInfo& info, const RECT& rect, CREATORFUNC_INFO creator,
LPCTSTR classname, LPCTSTR title)
{
MDICREATESTRUCT mcs;
@ -391,7 +392,7 @@ ChildWindow* ChildWindow::create(HWND hmdiclient, const RECT& rect, CREATORFUNC_
mcs.style = 0;
mcs.lParam = 0;
return static_cast<ChildWindow*>(create_mdi_child(hmdiclient, mcs, creator, info));
return static_cast<ChildWindow*>(create_mdi_child(info, mcs, creator));
}

View file

@ -40,6 +40,16 @@ typedef set<HWND> WindowSet;
*/
/// information structure for creation of a MDI child window
struct ChildWndInfo
{
ChildWndInfo(HWND hmdiclient)
: _hmdiclient(hmdiclient) {}
HWND _hmdiclient;
};
/**
Class Window is the base class for several C++ window wrapper classes.
Window objects are allocated from the heap. They are automatically freed
@ -66,7 +76,7 @@ struct Window : public WindowHandle
DWORD dwStyle, int x, int y, int w, int h,
HWND hwndParent=0, HMENU hMenu=0/*, LPVOID lpParam=0*/);
static Window* create_mdi_child(HWND hmdiclient, const MDICREATESTRUCT& mcs, CREATORFUNC_INFO creator, const void* info=NULL);
static Window* create_mdi_child(const ChildWndInfo& info, const MDICREATESTRUCT& mcs, CREATORFUNC_INFO creator);
// static Window* create_property_sheet(struct PropertySheetDialog* ppsd, CREATORFUNC creator, const void* info);
static LRESULT CALLBACK WindowWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam);
@ -277,8 +287,8 @@ struct ChildWindow : public Window
ChildWindow(HWND hwnd);
static ChildWindow* create(HWND hmdiclient, const RECT& rect,
CREATORFUNC_INFO creator, LPCTSTR classname, LPCTSTR title=NULL, const void* info=NULL);
static ChildWindow* create(const ChildWndInfo& info, const RECT& rect, CREATORFUNC_INFO creator,
LPCTSTR classname, LPCTSTR title=NULL);
protected:
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);