/*
- * Copyright 2003, 2004 Martin Fuchs
+ * Copyright 2003, 2004, 2005 Martin Fuchs
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
//
-#include "../utility/utility.h"
-#include "../utility/shellclasses.h"
-#include "../utility/shellbrowserimpl.h"
-#include "../utility/dragdropimpl.h"
-#include "../utility/window.h"
+#include "precomp.h"
-#include "../globals.h"
-#include "../externals.h"
#include "../explorer_intres.h"
-#include "desktop.h"
#include "../taskbar/desktopbar.h"
#include "../taskbar/taskbar.h" // for PM_GET_LAST_ACTIVE
-#include "../shell/mainframe.h" // for MainFrame::OpenShellFolders()
static BOOL (WINAPI*SetShellWindow)(HWND);
{
WindowSet& windows = *(WindowSet*)lparam;
- if (IsWindowVisible(hwnd))
- if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop)
+ if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop)
+ if (IsWindowVisible(hwnd))
windows.insert(hwnd);
return TRUE;
{
list<MinimizeStruct>& minimized = *(list<MinimizeStruct>*)lparam;
- if (IsWindowVisible(hwnd))
- if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop)
- if (!IsIconic(hwnd)) {
+ if (hwnd!=g_Globals._hwndDesktopBar && hwnd!=g_Globals._hwndDesktop)
+ if (IsWindowVisible(hwnd) && !IsIconic(hwnd)) {
+ RECT rect;
+
+ if (GetWindowRect(hwnd,&rect))
+ if (rect.right>0 && rect.bottom>0 &&
+ rect.right>rect.left && rect.bottom>rect.top) {
minimized.push_back(MinimizeStruct(hwnd, GetWindowStyle(hwnd)));
ShowWindowAsync(hwnd, SW_MINIMIZE);
}
+ }
return TRUE;
}
}
-static void draw_desktop_background(HWND hwnd, HDC hdc)
-{
- ClientRect rect(hwnd);
-
- PaintDesktop(hdc);
-/*
- HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue
- FillRect(hdc, &rect, bkgndBrush);
- DeleteBrush(bkgndBrush);
-*/
-
- rect.left = rect.right - 280;
- rect.top = rect.bottom - 56 - DESKTOPBARBAR_HEIGHT;
- rect.right = rect.left + 250;
- rect.bottom = rect.top + 40;
-
-#include "../buildno.h"
- static const LPCTSTR BkgndText = TEXT("ReactOS ")TEXT(KERNEL_VERSION_STR)TEXT(" Explorer\nby Martin Fuchs");
-
- BkMode bkMode(hdc, TRANSPARENT);
-
- TextColor textColor(hdc, RGB(128,128,192));
- DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
-
- SetTextColor(hdc, RGB(255,255,255));
- --rect.right;
- ++rect.top;
- DrawText(hdc, BkgndText, -1, &rect, DT_RIGHT);
-}
-
-
BackgroundWindow::BackgroundWindow(HWND hwnd)
: super(hwnd)
{
// set background brush for the short moment of displaying the
// background color while moving foreground windows
SetClassLong(hwnd, GCL_HBRBACKGROUND, COLOR_BACKGROUND+1);
+
+ _display_version = RegGetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), TEXT("PaintDesktopVersion"), 1);
}
LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case WM_ERASEBKGND:
- PaintDesktop((HDC)wparam);
+ DrawDesktopBkgnd((HDC)wparam);
return TRUE;
case WM_MBUTTONDBLCLK:
- explorer_show_frame(SW_SHOWNORMAL);
+ /* Imagelist icons are missing if MainFrame::Create() is called directly from here!
+ explorer_show_frame(SW_SHOWNORMAL); */
+ PostMessage(g_Globals._hwndDesktop, nmsg, wparam, lparam);
break;
+ case PM_DISPLAY_VERSION:
+ if (lparam || wparam) {
+ DWORD or_mask = wparam;
+ DWORD reset_mask = LOWORD(lparam);
+ DWORD xor_mask = HIWORD(lparam);
+ _display_version = ((_display_version&~reset_mask) | or_mask) ^ xor_mask;
+ RegSetDWORDValue(HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), TEXT("PaintDesktopVersion"), _display_version);
+ ///@todo Changing the PaintDesktopVersion-Flag needs a restart of the shell -> display a message box
+ InvalidateRect(_hwnd, NULL, TRUE);
+ }
+ return _display_version;
+
default:
return super::WndProc(nmsg, wparam, lparam);
}
return 0;
}
+void BackgroundWindow::DrawDesktopBkgnd(HDC hdc)
+{
+ PaintDesktop(hdc);
+
+/* special solid background
+ HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue
+ FillRect(hdc, &rect, bkgndBrush);
+ DeleteBrush(bkgndBrush);
+*/
+}
+
DesktopWindow::DesktopWindow(HWND hwnd)
: super(hwnd)
LRESULT DesktopWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
- case WM_PAINT:
- draw_desktop_background(_hwnd, PaintCanvas(_hwnd));
- break;
-
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONDBLCLK:
case WM_DESTROY:
///@todo use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state
-
+
if (SetShellWindow)
SetShellWindow(0);
break;
HRESULT DesktopWindow::OnDefaultCommand(LPIDA pida)
{
- if (MainFrame::OpenShellFolders(pida, 0))
+#ifndef ROSSHELL // in shell-only-mode fall through and let shell32 handle the command
+ if (MainFrameBase::OpenShellFolders(pida, 0))
return S_OK;
+#endif
return E_NOTIMPL;
}
return true;
}
-LRESULT DesktopShellView::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
+LRESULT DesktopShellView::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case WM_CONTEXTMENU:
case PM_GET_ICON_ALGORITHM:
return _icon_algo;
+ case PM_DISPLAY_VERSION:
+ return SendMessage(_hwndListView, nmsg, wparam, lparam);
+
default:
return super::WndProc(nmsg, wparam, lparam);
}
for(int i=pida->cidl; i>0; --i)
apidl[i-1] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i]);
- hr = ShellFolderContextMenu(ShellFolder(parent_pidl), _hwnd, pida->cidl, apidl, x, y);
+ hr = ShellFolderContextMenu(ShellFolder(parent_pidl), _hwnd, pida->cidl, apidl, x, y, _cm_ifs);
selection->Release();
HRESULT hr = DesktopFolder()->GetUIObjectOf(_hwnd, 0, NULL, IID_IContextMenu, NULL, (LPVOID*)&pcm);
if (SUCCEEDED(hr)) {
+ pcm = _cm_ifs.query_interfaces(pcm);
+
HMENU hmenu = CreatePopupMenu();
if (hmenu) {
UINT idCmd = TrackPopupMenu(hmenu, TPM_LEFTALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, x, y, 0, _hwnd, NULL);
+ _cm_ifs.reset();
+
if (idCmd == FCIDM_SHVIEWLAST-1) {
explorer_about(_hwnd);
} else if (idCmd) {