ReactOS  0.4.14-dev-614-gbfd8a84
desktop.h
Go to the documentation of this file.
1 /*
2  * Copyright 2003, 2004 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 
20  //
21  // Explorer clone
22  //
23  // desktop.h
24  //
25  // Martin Fuchs, 09.08.2003
26  //
27 
28 
29 #define PM_SET_ICON_ALGORITHM (WM_APP+0x19)
30 #define PM_GET_ICON_ALGORITHM (WM_APP+0x1A)
31 #define PM_DISPLAY_VERSION (WM_APP+0x24)
32 
33 
36 {
38 
40 
41 protected:
43 
44  void DrawDesktopBkgnd(HDC hdc);
45 
47 };
48 
49 
52 {
54 
57 
58  static HWND Create();
59 
61  {
62  *lphwnd = _hwnd;
63  return S_OK;
64  }
65 
67  {
69  *ppshv = _pShellView;
70  return S_OK;
71  }
72 
74  {
75  return E_NOTIMPL;
76  }
77 
79  {
80  return E_NOTIMPL;
81  }
82 
83 protected:
86 
88  WindowHandle _desktopBar;
89 
90  virtual HRESULT OnDefaultCommand(LPIDA pida);
91 };
92 
93 
96 {
98 
99 public:
100  DesktopDropTarget(HWND hTargetWnd) : super(hTargetWnd) {}
101 
102  virtual bool OnDrop(FORMATETC* pFmtEtc, STGMEDIUM& medium, DWORD *pdwEffect)
103  {
104  if (pFmtEtc->cfFormat==CF_HDROP && medium.tymed==TYMED_HGLOBAL) {
105  HDROP hDrop = (HDROP)GlobalLock(medium.hGlobal);
106 
107  if (hDrop) {
108  TCHAR szFileName[MAX_PATH];
109 
110  UINT cFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
111 
112  for(UINT i=0; i<cFiles; ++i) {
113  DragQueryFile(hDrop, i, szFileName, sizeof(szFileName) / sizeof(szFileName[0]));
114 
115  if (DROPEFFECT_COPY & *pdwEffect) {
116  // copy the file or dir
117 
119 
120  } else if (DROPEFFECT_MOVE & *pdwEffect) {
121  // move the file or dir
122 
124 
125  }
126  }
127  //DragFinish(hDrop); // base class calls ReleaseStgMedium
128  }
129 
130  GlobalUnlock(medium.hGlobal);
131  }
132 
133  //@@TreeView_SelectDropTarget(m_hTargetWnd, NULL);
134 
135  return true; //let base free the medium
136  }
137 
139  /* [in] */ DWORD grfKeyState,
140  /* [in] */ POINTL pt,
141  /* [out][in] */ DWORD __RPC_FAR *pdwEffect)
142  {
143  TVHITTESTINFO hit;
144  hit.pt.x = pt.x;
145  hit.pt.y = pt.y;
147  hit.flags = TVHT_ONITEM;
148 
149  /*@@
150  HTREEITEM hItem = TreeView_HitTest(m_hTargetWnd,&hit);
151 
152  if (hItem != NULL)
153  TreeView_SelectDropTarget(m_hTargetWnd, hItem);
154  */
155 
156  return super::DragOver(grfKeyState, pt, pdwEffect);
157  }
158 
160  {
161  //@@ TreeView_SelectDropTarget(m_hTargetWnd, NULL);
162 
163  return super::DragLeave();
164  }
165 };
166 
167 
169 struct DesktopShellView : public ExtContextMenuHandlerT<SubclassedWindow>
170 {
172 
173  DesktopShellView(HWND hwnd, IShellView* pShellView);
175 
176  bool InitDragDrop();
177 
178 protected:
180 
182  int Command(int id, int code);
183  int Notify(int id, NMHDR* pnmh);
184 
185  bool DoContextMenu(int x, int y);
186  HRESULT DoDesktopContextMenu(int x, int y);
187  void PositionIcons(int dir=1);
188 
189  void refresh();
190 
193 };
void DrawDesktopBkgnd(HDC hdc)
Definition: desktop.cpp:301
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
DesktopShellView(HWND hwnd, IShellView *pShellView)
Definition: desktop.cpp:520
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd)
Definition: desktop.h:60
WindowHandle _desktopBar
Definition: desktop.h:88
long y
Definition: polytest.cpp:48
LRESULT Init(LPCREATESTRUCT pcs)
Definition: desktop.cpp:350
int _display_version
Definition: desktop.h:46
long x
Definition: polytest.cpp:48
#define pt(x, y)
Definition: drawing.c:79
BackgroundWindow(HWND hwnd)
Definition: desktop.cpp:259
static HDC
Definition: imagelist.c:92
virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
Definition: desktop.h:78
HWND _hwndListView
Definition: desktop.h:191
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static HWND Create()
Definition: desktop.cpp:326
virtual bool OnDrop(FORMATETC *pFmtEtc, STGMEDIUM &medium, DWORD *pdwEffect)
Definition: desktop.h:102
UINT_PTR WPARAM
Definition: windef.h:207
OLE drop target for the desktop window.
Definition: desktop.h:95
WPARAM wParam
Definition: combotst.c:138
HRESULT DoDesktopContextMenu(int x, int y)
Definition: desktop.cpp:654
const DWORD DROPEFFECT_COPY
Definition: oleidl.idl:930
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: desktop.cpp:431
Implementation of IShellBrowser and ICommDlgBrowser interfaces for explorer child windows (see ShellB...
smooth NULL
Definition: ftsmooth.c:416
#define CF_HDROP
Definition: constants.h:410
LONG_PTR LPARAM
Definition: windef.h:208
virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd)
Definition: desktop.h:73
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: desktop.cpp:576
unsigned int dir
Definition: maze.c:112
#define __RPC_FAR
Definition: rpc.h:56
PreTranslateWindow super
Definition: desktop.h:53
virtual HRESULT STDMETHODCALLTYPE DragLeave(void)
Definition: desktop.h:159
char TCHAR
Definition: xmlstorage.h:189
bool InitDragDrop()
Definition: desktop.cpp:547
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
Definition: desktop.h:138
Implementation of the Explorer desktop window.
Definition: desktop.h:51
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
DesktopWindow(HWND hwnd)
Definition: desktop.cpp:313
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
int Notify(int id, NMHDR *pnmh)
Definition: desktop.cpp:607
virtual HRESULT STDMETHODCALLTYPE DragLeave()
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG AddRef()
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HDC hdc
Definition: main.c:9
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect)
virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(IShellView **ppshv)
Definition: desktop.h:66
SubclassedWindow super
Definition: desktop.h:37
implementation of IDropTarget interface
Definition: dragdropimpl.h:168
IDropTargetImpl super
Definition: desktop.h:97
ExtContextMenuHandlerT< SubclassedWindow > super
Definition: desktop.h:171
IShellView * _pShellView
Definition: desktop.h:87
subclassed ShellView window
Definition: desktop.h:169
#define S_OK
Definition: intsafe.h:59
const DWORD DROPEFFECT_MOVE
Definition: oleidl.idl:931
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
Definition: desktop.cpp:269
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
IShellView * _pShellView
Definition: desktop.h:179
#define DragQueryFile
Definition: shellapi.h:682
bool DoContextMenu(int x, int y)
Definition: desktop.cpp:612
virtual HRESULT OnDefaultCommand(LPIDA pida)
Definition: desktop.cpp:509
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
LONG_PTR LRESULT
Definition: windef.h:209
#define TVHT_ONITEM
Definition: commctrl.h:3523
subclassed background window behind the visible desktop window
Definition: desktop.h:35
LPARAM lParam
Definition: combotst.c:139
int Command(int id, int code)
Definition: desktop.cpp:602
Definition: shlobj.h:490
static UINT WPARAM wparam
Definition: combo.c:716
void PositionIcons(int dir=1)
Definition: desktop.cpp:757
DesktopDropTarget(HWND hTargetWnd)
Definition: desktop.h:100