mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
draw blue background
svn path=/trunk/; revision=5533
This commit is contained in:
parent
9cc8d55331
commit
6497f3daae
8 changed files with 187 additions and 136 deletions
|
@ -46,6 +46,55 @@ BOOL IsAnyDesktopRunning()
|
|||
}
|
||||
|
||||
|
||||
static void draw_desktop_background(HWND hwnd, HDC hdc)
|
||||
{
|
||||
// We'd want to draw the desktop wallpaper here. Need to
|
||||
// maintain a copy of the wallpaper in an off-screen DC and then
|
||||
// bitblt (or stretchblt?) it to the screen appropriately. For
|
||||
// now, though, we'll just draw some text.
|
||||
|
||||
static const TCHAR BkgndText[] = TEXT("ReactOS 0.1.2 Desktop Example\nby Silver Blade, Martin Fuchs");
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(hwnd, &rect);
|
||||
|
||||
HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue
|
||||
FillRect(hdc, &rect, bkgndBrush/*GetStockBrush(BLACK_BRUSH)*/);
|
||||
DeleteBrush(bkgndBrush);
|
||||
|
||||
// This next part could be improved by working out how much
|
||||
// space the text actually needs...
|
||||
|
||||
rect.left = rect.right - 260;
|
||||
rect.top = rect.bottom - 80;
|
||||
rect.right = rect.left + 250;
|
||||
rect.bottom = rect.top + 40;
|
||||
|
||||
SetTextColor(hdc, RGB(255,255,255));
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_ERASEBKGND:
|
||||
draw_desktop_background(_hwnd, (HDC)wparam);
|
||||
return TRUE;
|
||||
|
||||
case WM_RBUTTONDBLCLK:
|
||||
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DesktopWindow::DesktopWindow(HWND hwnd)
|
||||
: super(hwnd)
|
||||
{
|
||||
|
@ -62,116 +111,94 @@ DesktopWindow::~DesktopWindow()
|
|||
LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_PAINT: {
|
||||
// We'd want to draw the desktop wallpaper here. Need to
|
||||
// maintain a copy of the wallpaper in an off-screen DC and then
|
||||
// bitblt (or stretchblt?) it to the screen appropriately. For
|
||||
// now, though, we'll just draw some text.
|
||||
case WM_PAINT: {
|
||||
PAINTSTRUCT ps;
|
||||
draw_desktop_background(_hwnd, BeginPaint(_hwnd, &ps));
|
||||
EndPaint(_hwnd, &ps);
|
||||
break;}
|
||||
|
||||
PAINTSTRUCT ps;
|
||||
HDC DesktopDC = BeginPaint(_hwnd, &ps);
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
|
||||
break;
|
||||
|
||||
static const TCHAR Text [] = TEXT("ReactOS 0.1.2 Desktop Example\nby Silver Blade, Martin Fuchs");
|
||||
case WM_GETISHELLBROWSER:
|
||||
return (LRESULT)static_cast<IShellBrowser*>(this);
|
||||
|
||||
case WM_CREATE: {
|
||||
HRESULT hr = Desktop()->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
|
||||
|
||||
HWND hWndView = 0;
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
FOLDERSETTINGS fs;
|
||||
|
||||
fs.ViewMode = FVM_ICON;
|
||||
fs.fFlags = FWF_DESKTOP|FWF_TRANSPARENT|FWF_NOCLIENTEDGE|FWF_NOSCROLL|FWF_BESTFITWINDOW|FWF_SNAPTOGRID;
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(_hwnd, &rect);
|
||||
|
||||
// This next part could be improved by working out how much
|
||||
// space the text actually needs...
|
||||
hr = _pShellView->CreateViewWindow(NULL, &fs, this, &rect, &hWndView);
|
||||
|
||||
rect.left = rect.right - 260;
|
||||
rect.top = rect.bottom - 80;
|
||||
rect.right = rect.left + 250;
|
||||
rect.bottom = rect.top + 40;
|
||||
|
||||
SetTextColor(DesktopDC, 0x00ffffff);
|
||||
SetBkMode(DesktopDC, TRANSPARENT);
|
||||
DrawText(DesktopDC, Text, -1, &rect, DT_RIGHT);
|
||||
|
||||
EndPaint(_hwnd, &ps);
|
||||
break;}
|
||||
|
||||
case WM_LBUTTONDBLCLK:
|
||||
explorer_show_frame(_hwnd, SW_SHOWNORMAL);
|
||||
break;
|
||||
|
||||
case WM_GETISHELLBROWSER:
|
||||
return (LRESULT)static_cast<IShellBrowser*>(this);
|
||||
|
||||
case WM_CREATE: {
|
||||
HRESULT hr = Desktop()->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
|
||||
|
||||
HWND hWndView = 0;
|
||||
//TODO: use IShellBrowser::GetViewStateStream() to restore previous view state
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
FOLDERSETTINGS fs;
|
||||
_pShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
|
||||
|
||||
fs.ViewMode = FVM_ICON;
|
||||
fs.fFlags = FWF_DESKTOP|FWF_TRANSPARENT|FWF_NOCLIENTEDGE|FWF_NOSCROLL|FWF_BESTFITWINDOW|FWF_SNAPTOGRID;
|
||||
/*
|
||||
IShellView2* pShellView2;
|
||||
|
||||
RECT rect;
|
||||
GetClientRect(_hwnd, &rect);
|
||||
hr = _pShellView->QueryInterface(IID_IShellView2, (void**)&pShellView2);
|
||||
|
||||
hr = _pShellView->CreateViewWindow(NULL, &fs, this, &rect, &hWndView);
|
||||
SV2CVW2_PARAMS params;
|
||||
params.cbSize = sizeof(SV2CVW2_PARAMS);
|
||||
params.psvPrev = _pShellView;
|
||||
params.pfs = &fs;
|
||||
params.psbOwner = this;
|
||||
params.prcView = ▭
|
||||
params.pvid = params.pvid;//@@
|
||||
|
||||
//TODO: use IShellBrowser::GetViewStateStream() to restore previous view state
|
||||
hr = pShellView2->CreateViewWindow2(¶ms);
|
||||
params.pvid;
|
||||
*/
|
||||
|
||||
/*
|
||||
IFolderView* pFolderView;
|
||||
|
||||
hr = _pShellView->QueryInterface(IID_IFolderView, (void**)&pFolderView);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
_pShellView->UIActivate(SVUIA_ACTIVATE_FOCUS);
|
||||
|
||||
/*
|
||||
IShellView2* pShellView2;
|
||||
|
||||
hr = _pShellView->QueryInterface(IID_IShellView2, (void**)&pShellView2);
|
||||
|
||||
SV2CVW2_PARAMS params;
|
||||
params.cbSize = sizeof(SV2CVW2_PARAMS);
|
||||
params.psvPrev = _pShellView;
|
||||
params.pfs = &fs;
|
||||
params.psbOwner = this;
|
||||
params.prcView = ▭
|
||||
params.pvid = params.pvid;//@@
|
||||
|
||||
hr = pShellView2->CreateViewWindow2(¶ms);
|
||||
params.pvid;
|
||||
*/
|
||||
|
||||
/*
|
||||
IFolderView* pFolderView;
|
||||
|
||||
hr = _pShellView->QueryInterface(IID_IFolderView, (void**)&pFolderView);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pFolderView->GetAutoArrange();
|
||||
hr = pFolderView->SetCurrentViewMode(FVM_DETAILS);
|
||||
}
|
||||
*/
|
||||
|
||||
HWND hwndFolderView = ::GetNextWindow(hWndView, GW_CHILD);
|
||||
|
||||
ShowWindow(hwndFolderView, SW_SHOW);
|
||||
hr = pFolderView->GetAutoArrange();
|
||||
hr = pFolderView->SetCurrentViewMode(FVM_DETAILS);
|
||||
}
|
||||
*/
|
||||
|
||||
HWND hwndFolderView = ::GetNextWindow(hWndView, GW_CHILD);
|
||||
|
||||
new BackgroundWindow(hwndFolderView);
|
||||
}
|
||||
|
||||
if (hWndView && SetShellWindowEx)
|
||||
SetShellWindowEx(_hwnd, hWndView);
|
||||
else if (SetShellWindow)
|
||||
SetShellWindow(_hwnd);
|
||||
break;}
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
if (hWndView && SetShellWindowEx)
|
||||
SetShellWindowEx(_hwnd, hWndView);
|
||||
else if (SetShellWindow)
|
||||
SetShellWindow(_hwnd);
|
||||
break;}
|
||||
|
||||
//TODO: use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state
|
||||
|
||||
if (SetShellWindow)
|
||||
SetShellWindow(0);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
|
||||
case WM_CLOSE:
|
||||
break; // Over-ride close. We need to close desktop some other way.
|
||||
//TODO: use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state
|
||||
|
||||
if (SetShellWindow)
|
||||
SetShellWindow(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
case WM_CLOSE:
|
||||
break; // Over-ride close. We need to close desktop some other way.
|
||||
|
||||
default:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -34,6 +34,17 @@
|
|||
#include "../externals.h"
|
||||
|
||||
|
||||
struct BackgroundWindow : public SubclassedWindow
|
||||
{
|
||||
typedef SubclassedWindow super;
|
||||
|
||||
BackgroundWindow(HWND hwnd) : super(hwnd) {}
|
||||
|
||||
protected:
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
};
|
||||
|
||||
|
||||
struct DesktopWindow : public Window, public IShellBrowserImpl
|
||||
{
|
||||
typedef Window super;
|
||||
|
@ -65,7 +76,7 @@ struct DesktopWindow : public Window, public IShellBrowserImpl
|
|||
}
|
||||
|
||||
protected:
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
IShellView* _pShellView;
|
||||
};
|
||||
|
|
|
@ -471,7 +471,7 @@ void FileChildWindow::scan_entry(Entry* entry, HWND hwnd)
|
|||
|
||||
int FileChildWindow::Notify(int id, NMHDR* pnmh)
|
||||
{
|
||||
return (pnmh->idFrom==IDW_HEADER_LEFT? _left: _right)->Notify(pnmh);
|
||||
return (pnmh->idFrom==IDW_HEADER_LEFT? _left: _right)->Notify(id, pnmh);
|
||||
}
|
||||
|
||||
|
||||
|
@ -480,22 +480,22 @@ BOOL CALLBACK ExecuteDialog::WndProg(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
|
|||
static struct ExecuteDialog* dlg;
|
||||
|
||||
switch(nmsg) {
|
||||
case WM_INITDIALOG:
|
||||
dlg = (struct ExecuteDialog*) lparam;
|
||||
return 1;
|
||||
case WM_INITDIALOG:
|
||||
dlg = (struct ExecuteDialog*) lparam;
|
||||
return 1;
|
||||
|
||||
case WM_COMMAND: {
|
||||
int id = (int)wparam;
|
||||
case WM_COMMAND: {
|
||||
int id = (int)wparam;
|
||||
|
||||
if (id == IDOK) {
|
||||
GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH);
|
||||
dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED?
|
||||
SW_SHOWMINIMIZED: SW_SHOWNORMAL;
|
||||
EndDialog(hwnd, id);
|
||||
} else if (id == IDCANCEL)
|
||||
EndDialog(hwnd, id);
|
||||
if (id == IDOK) {
|
||||
GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH);
|
||||
dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED?
|
||||
SW_SHOWMINIMIZED: SW_SHOWNORMAL;
|
||||
EndDialog(hwnd, id);
|
||||
} else if (id == IDCANCEL)
|
||||
EndDialog(hwnd, id);
|
||||
|
||||
return 1;}
|
||||
return 1;}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -110,9 +110,9 @@ static const int g_pos_align[] = {
|
|||
|
||||
|
||||
Pane::Pane(HWND hparent, int id, int id_header, Entry* root, bool treePane, int visible_cols)
|
||||
: SubclassedWindow(CreateWindow(TEXT("ListBox"), TEXT(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
|
||||
LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
|
||||
0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0)),
|
||||
: super(CreateWindow(TEXT("ListBox"), TEXT(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
|
||||
LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
|
||||
0, 0, 0, 0, hparent, (HMENU)id, g_Globals._hInstance, 0)),
|
||||
_root(root),
|
||||
_treePane(treePane),
|
||||
_visible_cols(visible_cols)
|
||||
|
@ -132,29 +132,29 @@ Pane::Pane(HWND hparent, int id, int id_header, Entry* root, bool treePane, int
|
|||
LRESULT Pane::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_HSCROLL:
|
||||
set_header();
|
||||
break;
|
||||
case WM_HSCROLL:
|
||||
set_header();
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS: {
|
||||
FileChildWindow* child = (FileChildWindow*) SendMessage(GetParent(_hwnd), WM_GET_FILEWND_PTR, 0, 0);
|
||||
case WM_SETFOCUS: {
|
||||
FileChildWindow* child = (FileChildWindow*) SendMessage(GetParent(_hwnd), WM_GET_FILEWND_PTR, 0, 0);
|
||||
|
||||
child->set_focus_pane(this);
|
||||
ListBox_SetSel(_hwnd, TRUE, 1);
|
||||
/*TODO: check menu items */
|
||||
break;}
|
||||
child->set_focus_pane(this);
|
||||
ListBox_SetSel(_hwnd, TRUE, 1);
|
||||
/*TODO: check menu items */
|
||||
break;}
|
||||
|
||||
case WM_KEYDOWN: {
|
||||
FileChildWindow* child = (FileChildWindow*) SendMessage(GetParent(_hwnd), WM_GET_FILEWND_PTR, 0, 0);
|
||||
case WM_KEYDOWN: {
|
||||
FileChildWindow* child = (FileChildWindow*) SendMessage(GetParent(_hwnd), WM_GET_FILEWND_PTR, 0, 0);
|
||||
|
||||
if (wparam == VK_TAB) {
|
||||
/*TODO: SetFocus(g_Globals.hdrivebar) */
|
||||
child->switch_focus_pane();
|
||||
}
|
||||
break;}
|
||||
}
|
||||
if (wparam == VK_TAB) {
|
||||
/*TODO: SetFocus(g_Globals.hdrivebar) */
|
||||
child->switch_focus_pane();
|
||||
}
|
||||
break;}
|
||||
}
|
||||
|
||||
return CallWindowProc(_orgWndProc, _hwnd, nmsg, wparam, lparam);
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
|
||||
|
@ -766,7 +766,7 @@ void Pane::calc_single_width(int col)
|
|||
}
|
||||
|
||||
|
||||
LRESULT Pane::Notify(NMHDR* pnmh)
|
||||
int Pane::Notify(int id, NMHDR* pnmh)
|
||||
{
|
||||
switch(pnmh->code) {
|
||||
case HDN_TRACK:
|
||||
|
@ -832,6 +832,9 @@ LRESULT Pane::Notify(NMHDR* pnmh)
|
|||
Header_SetItem(_hwndHeader, phdn->iItem, &item);
|
||||
InvalidateRect(_hwnd, 0, TRUE);
|
||||
break;}
|
||||
|
||||
default:
|
||||
return super::Notify(id, pnmh);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -64,6 +64,8 @@ struct OutputWorker {
|
|||
|
||||
struct Pane : public SubclassedWindow
|
||||
{
|
||||
typedef SubclassedWindow super;
|
||||
|
||||
Pane(HWND hparent, int id, int id_header, Entry* rool, bool treePane, int visible_cols);
|
||||
|
||||
#define COLUMNS 10
|
||||
|
@ -87,10 +89,10 @@ struct Pane : public SubclassedWindow
|
|||
|
||||
void insert_entries(Entry* dir, int idx);
|
||||
BOOL command(UINT cmd);
|
||||
LRESULT Notify(NMHDR* pnmh);
|
||||
int Notify(int id, NMHDR* pnmh);
|
||||
|
||||
protected:
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
void calc_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str);
|
||||
void calc_tabbed_width(LPDRAWITEMSTRUCT dis, int col, LPCTSTR str);
|
||||
|
|
|
@ -391,15 +391,15 @@ void ShellBrowserChild::OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv)
|
|||
LRESULT ShellBrowserChild::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(nmsg) {
|
||||
case WM_GETISHELLBROWSER: // for Registry Explorer Plugin
|
||||
return (LRESULT)static_cast<IShellBrowser*>(this);
|
||||
case WM_GETISHELLBROWSER: // for Registry Explorer Plugin
|
||||
return (LRESULT)static_cast<IShellBrowser*>(this);
|
||||
|
||||
case WM_CREATE:
|
||||
OnCreate((LPCREATESTRUCT)lparam);
|
||||
goto def;
|
||||
case WM_CREATE:
|
||||
OnCreate((LPCREATESTRUCT)lparam);
|
||||
goto def;
|
||||
|
||||
default: def:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
default: def:
|
||||
return super::WndProc(nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -412,6 +412,7 @@ int ShellBrowserChild::Notify(int id, NMHDR* pnmh)
|
|||
case TVN_ITEMEXPANDING: OnTreeItemExpanding(id, (LPNMTREEVIEW)pnmh); break;
|
||||
case TVN_SELCHANGED: OnTreeItemSelected(id, (LPNMTREEVIEW)pnmh); break;
|
||||
case NM_RCLICK: OnTreeItemRClick(id, pnmh); break;
|
||||
default: return super::Notify(id, pnmh);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -184,6 +184,11 @@ SubclassedWindow::SubclassedWindow(HWND hwnd)
|
|||
_orgWndProc = SubclassWindow(_hwnd, WindowWndProc);
|
||||
}
|
||||
|
||||
LRESULT SubclassedWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
return CallWindowProc(_orgWndProc, _hwnd, nmsg, wparam, lparam);
|
||||
}
|
||||
|
||||
|
||||
ChildWindow::ChildWindow(HWND hwnd)
|
||||
: Window(hwnd)
|
||||
|
|
|
@ -67,7 +67,7 @@ protected:
|
|||
|
||||
virtual LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
virtual int Command(int id, int code);
|
||||
virtual int Notify(int id, NMHDR* pnmh);
|
||||
virtual int Notify(int id, NMHDR* pnmh);
|
||||
|
||||
|
||||
static const void* s_new_info; //TODO: protect for multithreaded access
|
||||
|
@ -85,6 +85,8 @@ struct SubclassedWindow : public Window
|
|||
|
||||
protected:
|
||||
WNDPROC _orgWndProc;
|
||||
|
||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue