Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

DesktopWindow Struct Reference

Implementation of the Explorer desktop window. More...

#include <desktop.h>

Inheritance diagram for DesktopWindow:
Inheritance graph
[legend]
Collaboration diagram for DesktopWindow:
Collaboration graph
[legend]

List of all members.

Public Types

typedef Window super

Public Member Functions

 DesktopWindow (HWND hwnd)
 ~DesktopWindow ()
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND *lphwnd)
virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView (IShellView **ppshv)
virtual HRESULT STDMETHODCALLTYPE GetControlWindow (UINT id, HWND *lphwnd)
virtual HRESULT STDMETHODCALLTYPE SendControlMsg (UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)

Static Public Member Functions

static HWND Create ()

Protected Member Functions

LRESULT Init (LPCREATESTRUCT pcs)
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
virtual HRESULT OnDefaultCommand (LPIDA pida)

Protected Attributes

IShellView * _pShellView
WindowHandle _desktopBar

Detailed Description

Implementation of the Explorer desktop window.

Definition at line 51 of file desktop.h.


Member Typedef Documentation

Definition at line 53 of file desktop.h.


Constructor & Destructor Documentation

DesktopWindow::DesktopWindow ( HWND  hwnd )

Definition at line 311 of file desktop.cpp.

References _pShellView.

 :  super(hwnd)
{
    _pShellView = NULL;
}
DesktopWindow::~DesktopWindow (  )

Definition at line 317 of file desktop.cpp.

References _pShellView.

{
    if (_pShellView)
        _pShellView->Release();
}

Member Function Documentation

HWND DesktopWindow::Create (  ) [static]

Definition at line 324 of file desktop.cpp.

References _desktopBar, GET_WINDOW, HWND, IDI_REACTOS, TEXT, and WINDOW_CREATOR.

Referenced by _tWinMain(), and Init().

{
    static IconWindowClass wcDesktop(TEXT("Progman"), IDI_REACTOS, CS_DBLCLKS);
    /* (disabled because of small ugly temporary artefacts when hiding start menu)
    wcDesktop.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1); */

    int width = GetSystemMetrics(SM_CXSCREEN);
    int height = GetSystemMetrics(SM_CYSCREEN);

    HWND hwndDesktop = Window::Create(WINDOW_CREATOR(DesktopWindow),
                    WS_EX_TOOLWINDOW, wcDesktop, TEXT("Program Manager"), WS_POPUP|WS_VISIBLE,  //|WS_CLIPCHILDREN for SDI frames
                    0, 0, width, height, 0);

     // work around to display desktop bar in Wine
    ShowWindow(GET_WINDOW(DesktopWindow, hwndDesktop)->_desktopBar, SW_SHOW);

     // work around for Windows NT, Win 98, ...
     // Without this the desktop has mysteriously only a size of 800x600 pixels.
    MoveWindow(hwndDesktop, 0, 0, width, height, TRUE);

    return hwndDesktop;
}

Here is the caller graph for this function:

virtual HRESULT STDMETHODCALLTYPE DesktopWindow::GetControlWindow ( UINT  id,
HWND lphwnd 
) [inline, virtual]

Definition at line 73 of file desktop.h.

    {
        return E_NOTIMPL;
    }
virtual HRESULT STDMETHODCALLTYPE DesktopWindow::GetWindow ( HWND lphwnd ) [inline, virtual]

Definition at line 60 of file desktop.h.

References WindowHandle::_hwnd.

    {
        *lphwnd = _hwnd;
        return S_OK;
    }
LRESULT DesktopWindow::Init ( LPCREATESTRUCT  pcs ) [protected, virtual]

Todo:
use IShellBrowser::GetViewStateStream() to restore previous view state -> see SHOpenRegStream()

Reimplemented from Window.

Definition at line 348 of file desktop.cpp.

References _desktopBar, WindowHandle::_hwnd, ExplorerGlobals::_hwndDesktopBar, ExplorerGlobals::_hwndShellView, _pShellView, Create(), g_Globals, GetDesktopFolder(), HWND, and Window::Init().

{
    if (super::Init(pcs))
        return 1;

    HRESULT hr = GetDesktopFolder()->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
/* also possible:
    SFV_CREATE sfv_create;

    sfv_create.cbSize = sizeof(SFV_CREATE);
    sfv_create.pshf = GetDesktopFolder();
    sfv_create.psvOuter = NULL;
    sfv_create.psfvcb = NULL;

    HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView);
*/
    HWND hWndView = 0;

    if (SUCCEEDED(hr)) {
        FOLDERSETTINGS fs;

        fs.ViewMode = FVM_ICON;
        fs.fFlags = FWF_DESKTOP|FWF_NOCLIENTEDGE|FWF_NOSCROLL|FWF_BESTFITWINDOW|FWF_SNAPTOGRID; //|FWF_AUTOARRANGE;

        ClientRect rect(_hwnd);

        hr = _pShellView->CreateViewWindow(NULL, &fs, this, &rect, &hWndView);

        ///@todo use IShellBrowser::GetViewStateStream() to restore previous view state -> see SHOpenRegStream()

        if (SUCCEEDED(hr)) {
            g_Globals._hwndShellView = hWndView;

             // subclass shellview window
            new DesktopShellView(hWndView, _pShellView);

            _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 = &rect;
            params.pvid = params.pvid;//@@

            hr = pShellView2->CreateViewWindow2(&params);
            params.pvid;
        */

        /*
            IFolderView* pFolderView;

            hr = _pShellView->QueryInterface(IID_IFolderView, (void**)&pFolderView);

            if (SUCCEEDED(hr)) {
                hr = pFolderView->GetAutoArrange();
                hr = pFolderView->SetCurrentViewMode(FVM_DETAILS);
            }
        */
        }
    }

    if (hWndView && SetShellWindowEx)
        SetShellWindowEx(_hwnd, hWndView);
    else if (SetShellWindow)
        SetShellWindow(_hwnd);

     // create the explorer bar
    _desktopBar = DesktopBar::Create();
    g_Globals._hwndDesktopBar = _desktopBar;

    return 0;
}

Here is the call graph for this function:

HRESULT DesktopWindow::OnDefaultCommand ( LPIDA  pida ) [protected, virtual]

Reimplemented from IShellBrowserImpl.

Definition at line 476 of file desktop.cpp.

References MainFrameBase::OpenShellFolders().

{
#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;
}

Here is the call graph for this function:

virtual HRESULT STDMETHODCALLTYPE DesktopWindow::QueryActiveShellView ( IShellView **  ppshv ) [inline, virtual]

Definition at line 66 of file desktop.h.

References _pShellView.

    {
        _pShellView->AddRef();
        *ppshv = _pShellView;
        return S_OK;
    }
virtual HRESULT STDMETHODCALLTYPE DesktopWindow::SendControlMsg ( UINT  id,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT *  pret 
) [inline, virtual]

Definition at line 78 of file desktop.h.

    {
        return E_NOTIMPL;
    }
LRESULT DesktopWindow::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Todo:
use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state

Reimplemented from Window.

Definition at line 429 of file desktop.cpp.

References _desktopBar, WindowHandle::_hwnd, ExplorerGlobals::_hwndShellView, explorer_show_frame(), g_Globals, ShowExitWindowsDialog(), WM_GETISHELLBROWSER, and Window::WndProc().

{
    switch(nmsg) {
      case WM_LBUTTONDBLCLK:
      case WM_RBUTTONDBLCLK:
      case WM_MBUTTONDBLCLK:
        explorer_show_frame(SW_SHOWNORMAL);
        break;

      case WM_GETISHELLBROWSER:
        return (LRESULT)static_cast<IShellBrowser*>(this);

      case WM_DESTROY:

        ///@todo use IShellBrowser::GetViewStateStream() and _pShellView->SaveViewState() to store view state

        if (SetShellWindow)
            SetShellWindow(0);
        break;

      case WM_CLOSE:
        ShowExitWindowsDialog(_hwnd);
        break;

      case WM_SYSCOMMAND:
        if (wparam == SC_TASKLIST) {
            if (_desktopBar)
                SendMessage(_desktopBar, nmsg, wparam, lparam);
        }
        goto def;

      case WM_SYSCOLORCHANGE:
         // redraw background window
        InvalidateRect(g_Globals._hwndShellView, NULL, TRUE);

         // forward message to shell view window to redraw icon backgrounds
        SendMessage(g_Globals._hwndShellView, WM_SYSCOLORCHANGE, wparam, lparam);
        break;

      default: def:
        return super::WndProc(nmsg, wparam, lparam);
    }

    return 0;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 88 of file desktop.h.

Referenced by Create(), Init(), and WndProc().

IShellView* DesktopWindow::_pShellView [protected]

Definition at line 87 of file desktop.h.

Referenced by DesktopWindow(), Init(), QueryActiveShellView(), and ~DesktopWindow().


The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage