Implemented explorer and desktop window using shell views
[reactos.git] / reactos / subsys / system / explorer / shell / shellbrowser.h
1 /*
2 * Copyright 2003 Martin Fuchs
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // shellbrowser.h
24 //
25 // Martin Fuchs, 23.07.2003
26 //
27
28 #include "../utility/treedroptarget.h"
29 #include "../utility/shellbrowserimpl.h"
30
31
32 struct ShellBrowserChild : public ChildWindow, public IShellBrowserImpl
33 {
34 typedef ChildWindow super;
35
36 ShellBrowserChild(HWND hwnd);
37 ~ShellBrowserChild();
38
39 static ShellBrowserChild* create(HWND hmdiclient, const FileChildWndInfo& info)
40 {
41 #ifndef _NO_MDI
42 ChildWindow* child = ChildWindow::create(hmdiclient, info._pos.rcNormalPosition, WINDOW_CREATOR(ShellBrowserChild), CLASSNAME_CHILDWND);
43 #else
44 //TODO: SDI implementation
45 #endif
46
47 ShowWindow(child->_hwnd, info._pos.showCmd);
48
49 return static_cast<ShellBrowserChild*>(child);
50 }
51
52 //IOleWindow
53 STDMETHOD(GetWindow)(HWND* lphwnd)
54 {
55 *lphwnd = _hwnd;
56 return S_OK;
57 }
58
59 //IShellBrowser
60 STDMETHOD(QueryActiveShellView)(struct IShellView ** ppshv)
61 {
62 _pShellView->AddRef();
63 *ppshv = _pShellView;
64 return S_OK;
65 }
66
67 STDMETHOD(GetControlWindow)(UINT id, HWND * lphwnd)
68 {
69 if (!lphwnd)
70 return E_POINTER;
71
72 if (id == FCW_TREE) {
73 *lphwnd = _left_hwnd;
74 return S_OK;
75 }
76
77 HWND hwnd = (HWND)SendMessage(_hWndFrame, WM_GET_CONTROLWINDOW, id, 0);
78
79 if (hwnd) {
80 *lphwnd = hwnd;
81 return S_OK;
82 }
83
84 return E_NOTIMPL;
85 }
86
87 STDMETHOD(SendControlMsg)(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
88 {
89 if (!pret)
90 return E_POINTER;
91
92 HWND hstatusbar = (HWND)SendMessage(_hWndFrame, WM_GET_CONTROLWINDOW, id, 0);
93
94 if (hstatusbar) {
95 *pret = ::SendMessage(hstatusbar, uMsg, wParam, lParam);
96 return S_OK;
97 }
98
99 return E_NOTIMPL;
100 }
101
102 protected:
103 Root _root;
104
105 HWND _hWndFrame;
106
107 IShellView* _pShellView; // current hosted shellview
108 HIMAGELIST _himlSmall; // list
109 // HIMAGELIST _himlLarge; // shell image
110 TreeDropTarget* _pDropTarget;
111
112 LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
113 int Notify(int id, NMHDR* pnmh);
114
115 void OnCreate(LPCREATESTRUCT);
116 void InitializeTree(/*const FileChildWndInfo& info*/);
117 void InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder);
118 bool InitDragDrop();
119
120 void OnTreeGetDispInfo(int idCtrl, LPNMHDR pnmh);
121 void OnTreeItemExpanding(int idCtrl, LPNMTREEVIEW pnmtv);
122 void OnTreeItemRClick(int idCtrl, LPNMHDR pnmh);
123 void OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv);
124
125 void Tree_DoItemMenu(HWND hwndTreeView, HTREEITEM hItem, LPPOINT pptScreen);
126 };