Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * ShellView |
| 3 | * |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 4 | * Copyright 1998 <juergen.schmied@metronet.de> |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <ctype.h> |
| 8 | #include <stdlib.h> |
| 9 | #include <string.h> |
| 10 | #include "ole.h" |
| 11 | #include "ole2.h" |
| 12 | #include "debug.h" |
| 13 | #include "compobj.h" |
| 14 | #include "interfaces.h" |
| 15 | #include "shlobj.h" |
| 16 | #include "shell.h" |
| 17 | #include "winerror.h" |
| 18 | #include "winnls.h" |
| 19 | #include "winproc.h" |
| 20 | #include "commctrl.h" |
| 21 | |
| 22 | #include "shell32_main.h" |
| 23 | #include "pidl.h" |
| 24 | #include "shresdef.h" |
| 25 | |
| 26 | /*********************************************************************** |
| 27 | * IShellView implementation |
| 28 | */ |
| 29 | static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW,REFIID, LPVOID *); |
| 30 | static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW) ; |
| 31 | static ULONG WINAPI IShellView_Release(LPSHELLVIEW); |
| 32 | /* IOleWindow methods */ |
| 33 | static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW,HWND32 * lphwnd); |
| 34 | static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW,BOOL32 fEnterMode); |
| 35 | /* IShellView methods */ |
| 36 | static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW,LPMSG32 lpmsg); |
| 37 | static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW,BOOL32 fEnable); |
| 38 | static HRESULT WINAPI IShellView_UIActivate(LPSHELLVIEW,UINT32 uState); |
| 39 | static HRESULT WINAPI IShellView_Refresh(LPSHELLVIEW); |
| 40 | static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW, IShellView *lpPrevView,LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,RECT32 * prcView, HWND32 *phWnd); |
| 41 | static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW); |
| 42 | static HRESULT WINAPI IShellView_GetCurrentInfo(LPSHELLVIEW, LPFOLDERSETTINGS lpfs); |
| 43 | static HRESULT WINAPI IShellView_AddPropertySheetPages(LPSHELLVIEW, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam); |
| 44 | static HRESULT WINAPI IShellView_SaveViewState(LPSHELLVIEW); |
| 45 | static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW, LPCITEMIDLIST pidlItem, UINT32 uFlags); |
| 46 | static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW, UINT32 uItem, REFIID riid,LPVOID *ppv); |
| 47 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 48 | static BOOL32 ShellView_CanDoIDockingWindow(LPSHELLVIEW); |
| 49 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 50 | static struct IShellView_VTable svvt = |
| 51 | { IShellView_QueryInterface, |
| 52 | IShellView_AddRef, |
| 53 | IShellView_Release, |
| 54 | IShellView_GetWindow, |
| 55 | IShellView_ContextSensitiveHelp, |
| 56 | IShellView_TranslateAccelerator, |
| 57 | IShellView_EnableModeless, |
| 58 | IShellView_UIActivate, |
| 59 | IShellView_Refresh, |
| 60 | IShellView_CreateViewWindow, |
| 61 | IShellView_DestroyViewWindow, |
| 62 | IShellView_GetCurrentInfo, |
| 63 | IShellView_AddPropertySheetPages, |
| 64 | IShellView_SaveViewState, |
| 65 | IShellView_SelectItem, |
| 66 | IShellView_GetItemObject |
| 67 | }; |
| 68 | |
| 69 | //menu items |
| 70 | #define IDM_VIEW_FILES (FCIDM_SHVIEWFIRST + 0x500) |
| 71 | #define IDM_VIEW_IDW (FCIDM_SHVIEWFIRST + 0x501) |
| 72 | #define IDM_MYFILEITEM (FCIDM_SHVIEWFIRST + 0x502) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 73 | #define ID_LISTVIEW 2000 |
| 74 | #define MENU_OFFSET 1 |
| 75 | #define MENU_MAX 100 |
| 76 | #define TOOLBAR_ID (L"SHELLDLL_DefView") |
| 77 | //windowsx.h |
| 78 | #define GET_WM_COMMAND_ID(wp, lp) LOWORD(wp) |
| 79 | #define GET_WM_COMMAND_HWND(wp, lp) (HWND32)(lp) |
| 80 | #define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp) |
| 81 | // winuser.h |
| 82 | #define WM_SETTINGCHANGE WM_WININICHANGE |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 83 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 84 | typedef struct |
| 85 | { int idCommand; |
| 86 | int iImage; |
| 87 | int idButtonString; |
| 88 | int idMenuString; |
| 89 | int nStringOffset; |
| 90 | BYTE bState; |
| 91 | BYTE bStyle; |
| 92 | } MYTOOLINFO, *LPMYTOOLINFO; |
| 93 | |
| 94 | MYTOOLINFO g_Tools[] = |
| 95 | { {IDM_VIEW_FILES, 0, IDS_TB_VIEW_FILES, IDS_MI_VIEW_FILES, 0, TBSTATE_ENABLED, TBSTYLE_BUTTON}, |
| 96 | {-1, 0, 0, 0, 0, 0, 0} |
| 97 | }; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 98 | BOOL32 g_bViewKeys; |
| 99 | BOOL32 g_bShowIDW; |
| 100 | |
| 101 | typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); |
| 102 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 103 | /************************************************************************** |
| 104 | * IShellView_Constructor |
| 105 | */ |
| 106 | LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER pFolder, LPCITEMIDLIST pidl) |
| 107 | { LPSHELLVIEW sv; |
| 108 | sv=(LPSHELLVIEW)HeapAlloc(GetProcessHeap(),0,sizeof(IShellView)); |
| 109 | sv->ref=1; |
| 110 | sv->lpvtbl=&svvt; |
| 111 | |
| 112 | sv->mpidl = ILClone(pidl); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 113 | sv->hMenu=0; |
| 114 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 115 | sv->pSFParent = pFolder; |
| 116 | if(sv->pSFParent) |
| 117 | sv->pSFParent->lpvtbl->fnAddRef(sv->pSFParent); |
| 118 | |
| 119 | TRACE(shell,"(%p)->(%p pidl=%p)\n",sv, pFolder, pidl); |
| 120 | return sv; |
| 121 | } |
| 122 | /************************************************************************** |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 123 | * helperfunctions for communication with ICommDlgBrowser |
| 124 | * |
| 125 | */ |
| 126 | static BOOL32 IsInCommDlg(LPSHELLVIEW this) |
| 127 | { return(this->pCommDlgBrowser != NULL); |
| 128 | } |
| 129 | static HRESULT IncludeObject(LPSHELLVIEW this, LPCITEMIDLIST pidl) |
| 130 | { if ( IsInCommDlg(this) ) |
| 131 | { TRACE(shell,"ICommDlgBrowser::IncludeObject pidl=%p\n", pidl); |
| 132 | return (this->pCommDlgBrowser->lpvtbl->fnIncludeObject(this->pCommDlgBrowser, this, pidl)); |
| 133 | } |
| 134 | return S_OK; |
| 135 | } |
| 136 | static HRESULT OnDefaultCommand(LPSHELLVIEW this) |
| 137 | { if (IsInCommDlg(this)) |
| 138 | { TRACE(shell,"ICommDlgBrowser::OnDefaultCommand\n"); |
| 139 | return (this->pCommDlgBrowser->lpvtbl->fnOnDefaultCommand(this->pCommDlgBrowser, this)); |
| 140 | } |
| 141 | return S_FALSE; |
| 142 | } |
| 143 | static HRESULT OnStateChange(LPSHELLVIEW this, UINT32 uFlags) |
| 144 | { if (IsInCommDlg(this)) |
| 145 | { TRACE(shell,"ICommDlgBrowser::OnStateChange flags=%x\n", uFlags); |
| 146 | return (this->pCommDlgBrowser->lpvtbl->fnOnStateChange(this->pCommDlgBrowser, this, uFlags)); |
| 147 | } |
| 148 | return S_FALSE; |
| 149 | } |
| 150 | |
| 151 | /************************************************************************** |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 152 | * ShellView_CreateList() |
| 153 | * |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 154 | */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 155 | |
| 156 | BOOL32 ShellView_CreateList (LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 157 | { DWORD dwStyle; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 158 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 159 | TRACE(shell,"%p\n",this); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 160 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 161 | dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_SHAREIMAGELISTS | LVS_EDITLABELS; |
| 162 | switch (this->FolderSettings.ViewMode) |
| 163 | { case FVM_ICON: dwStyle |= LVS_ICON; break; |
| 164 | case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break; |
| 165 | case FVM_LIST: dwStyle |= LVS_LIST; break; |
| 166 | case FVM_DETAILS: dwStyle |= LVS_REPORT; break; |
| 167 | } |
| 168 | if (this->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE; |
| 169 | /*if (this->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/ |
| 170 | if (this->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 171 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 172 | this->hWndList=CreateWindowEx32A( WS_EX_CLIENTEDGE, |
| 173 | WC_LISTVIEW32A, |
| 174 | NULL, |
| 175 | dwStyle, |
| 176 | 0,0,0,0, |
| 177 | this->hWnd, |
| 178 | (HMENU32)ID_LISTVIEW, |
| 179 | shell32_hInstance, |
| 180 | NULL); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 181 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 182 | if(!this->hWndList) |
| 183 | return FALSE; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 184 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 185 | // UpdateShellSettings(); |
| 186 | return TRUE; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 187 | } |
| 188 | /************************************************************************** |
| 189 | * ShellView_InitList() |
| 190 | * |
| 191 | * NOTES |
| 192 | * internal |
| 193 | */ |
| 194 | int nColumn1=100; /* width of column */ |
| 195 | int nColumn2=100; |
| 196 | int nColumn3=100; |
| 197 | int nColumn4=100; |
| 198 | |
| 199 | BOOL32 ShellView_InitList(LPSHELLVIEW this) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 200 | { LVCOLUMN32A lvColumn; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 201 | CHAR szString[50]; |
| 202 | |
| 203 | TRACE(shell,"%p\n",this); |
| 204 | |
| 205 | |
| 206 | ListView_DeleteAllItems(this->hWndList); /*empty the list*/ |
| 207 | |
| 208 | //initialize the columns |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 209 | lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; |
| 210 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 211 | lvColumn.fmt = LVCFMT_LEFT; |
| 212 | lvColumn.pszText = szString; |
| 213 | |
| 214 | lvColumn.cx = nColumn1; |
| 215 | strcpy(szString,"File"); |
| 216 | /*LoadString32A(shell32_hInstance, IDS_COLUMN1, szString, sizeof(szString));*/ |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 217 | ListView_InsertColumn32A(this->hWndList, 0, &lvColumn); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 218 | |
| 219 | lvColumn.cx = nColumn2; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 220 | strcpy(szString,"COLUMN2"); |
| 221 | ListView_InsertColumn32A(this->hWndList, 1, &lvColumn); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 222 | |
| 223 | lvColumn.cx = nColumn3; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 224 | strcpy(szString,"COLUMN3"); |
| 225 | ListView_InsertColumn32A(this->hWndList, 2, &lvColumn); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 226 | |
| 227 | lvColumn.cx = nColumn4; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 228 | strcpy(szString,"COLUMN4"); |
| 229 | ListView_InsertColumn32A(this->hWndList, 3, &lvColumn); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 230 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 231 | ListView_SetImageList(this->hWndList, ShellSmallIconList, LVSIL_SMALL); |
| 232 | ListView_SetImageList(this->hWndList, ShellBigIconList, LVSIL_NORMAL); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 233 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 234 | return TRUE; |
| 235 | } |
| 236 | /************************************************************************** |
| 237 | * ShellView_CompareItems() |
| 238 | * |
| 239 | * NOTES |
| 240 | * internal |
| 241 | */ |
| 242 | int CALLBACK ShellView_CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 243 | { LPSHELLFOLDER pFolder = (LPSHELLFOLDER)lpData; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 244 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 245 | TRACE(shell,"\n"); |
| 246 | if(!pFolder) |
| 247 | return 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 248 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 249 | return (int)pFolder->lpvtbl->fnCompareIDs(pFolder, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | /************************************************************************** |
| 253 | * ShellView_FillList() |
| 254 | * |
| 255 | * NOTES |
| 256 | * internal |
| 257 | */ |
| 258 | |
| 259 | void ShellView_FillList(LPSHELLVIEW this) |
| 260 | { LPENUMIDLIST pEnumIDList; |
| 261 | LPITEMIDLIST pidl; |
| 262 | DWORD dwFetched; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 263 | LVITEM32A lvItem; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 264 | |
| 265 | TRACE(shell,"%p\n",this); |
| 266 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 267 | if(SUCCEEDED(this->pSFParent->lpvtbl->fnEnumObjects(this->pSFParent,this->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList))) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 268 | { SendMessage32A(this->hWndList, WM_SETREDRAW, FALSE, 0); /*turn the listview's redrawing off*/ |
| 269 | |
| 270 | while((S_OK == pEnumIDList->lpvtbl->fnNext(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched) |
| 271 | { ZeroMemory(&lvItem, sizeof(lvItem)); |
| 272 | |
| 273 | lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/ |
| 274 | lvItem.iItem = ListView_GetItemCount(this->hWndList); /*add the item to the end of the list*/ |
| 275 | lvItem.lParam = (LPARAM)ILClone(pidl); /*set the item's data*/ |
| 276 | lvItem.pszText = LPSTR_TEXTCALLBACK32A; /*get text on a callback basis*/ |
| 277 | lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 278 | if ( S_OK == IncludeObject(this, ILClone(pidl) )) /* fixme free the pidl*/ |
| 279 | { ListView_InsertItem32A(this->hWndList, &lvItem); /*add the item*/ |
| 280 | } |
| 281 | else |
| 282 | { SHFree(pidl); /* not viewed */ |
| 283 | } |
| 284 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | /*sort the items*/ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 288 | /* ListView_SortItems(this->hWndList, ShellView_CompareItems, (LPARAM)this->pSFParent);*/ |
| 289 | |
| 290 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 291 | /*turn the listview's redrawing back on and force it to draw*/ |
| 292 | SendMessage32A(this->hWndList, WM_SETREDRAW, TRUE, 0); |
| 293 | InvalidateRect32(this->hWndList, NULL, TRUE); |
| 294 | UpdateWindow32(this->hWndList); |
| 295 | |
| 296 | pEnumIDList->lpvtbl->fnRelease(pEnumIDList); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /************************************************************************** |
| 301 | * ShellView_OnCreate() |
| 302 | * |
| 303 | * NOTES |
| 304 | * internal |
| 305 | */ |
| 306 | LRESULT ShellView_OnCreate(LPSHELLVIEW this) |
| 307 | { TRACE(shell,"%p\n",this); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 308 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 309 | if(ShellView_CreateList(this)) |
| 310 | { if(ShellView_InitList(this)) |
| 311 | { ShellView_FillList(this); |
| 312 | } |
| 313 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 314 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 315 | return S_OK; |
| 316 | } |
| 317 | /************************************************************************** |
| 318 | * ShellView_OnSize() |
| 319 | */ |
| 320 | LRESULT ShellView_OnSize(LPSHELLVIEW this, WORD wWidth, WORD wHeight) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 321 | { TRACE(shell,"%p width=%u height=%u\n",this, wWidth,wHeight); |
| 322 | |
| 323 | /*resize the ListView to fit our window*/ |
| 324 | if(this->hWndList) |
| 325 | { MoveWindow32(this->hWndList, 0, 0, wWidth, wHeight, TRUE); |
| 326 | } |
| 327 | |
| 328 | return S_OK; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 329 | } |
| 330 | /************************************************************************** |
| 331 | * ShellView_BuildFileMenu() |
| 332 | */ |
| 333 | HMENU32 ShellView_BuildFileMenu(LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 334 | { CHAR szText[MAX_PATH]; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 335 | MENUITEMINFO32A mii; |
| 336 | int nTools,i; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 337 | HMENU32 hSubMenu; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 338 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 339 | TRACE(shell,"(%p) semi-stub\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 340 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 341 | hSubMenu = CreatePopupMenu32(); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 342 | if(hSubMenu) |
| 343 | { /*get the number of items in our global array*/ |
| 344 | for(nTools = 0; g_Tools[nTools].idCommand != -1; nTools++){} |
| 345 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 346 | /*add the menu items*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 347 | for(i = 0; i < nTools; i++) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 348 | { strcpy(szText, "dummy BuildFileMenu"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 349 | |
| 350 | ZeroMemory(&mii, sizeof(mii)); |
| 351 | mii.cbSize = sizeof(mii); |
| 352 | mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; |
| 353 | |
| 354 | if(TBSTYLE_SEP != g_Tools[i].bStyle) |
| 355 | { mii.fType = MFT_STRING; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 356 | mii.fState = MFS_ENABLED; |
| 357 | mii.dwTypeData = szText; |
| 358 | mii.wID = g_Tools[i].idCommand; |
| 359 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 360 | else |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 361 | { mii.fType = MFT_SEPARATOR; |
| 362 | } |
| 363 | /* tack this item onto the end of the menu */ |
| 364 | InsertMenuItem32A(hSubMenu, (UINT32)-1, TRUE, &mii); |
| 365 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 366 | } |
| 367 | return hSubMenu; |
| 368 | } |
| 369 | /************************************************************************** |
| 370 | * ShellView_MergeFileMenu() |
| 371 | */ |
| 372 | void ShellView_MergeFileMenu(LPSHELLVIEW this, HMENU32 hSubMenu) |
| 373 | { MENUITEMINFO32A mii; |
| 374 | CHAR szText[MAX_PATH]; |
| 375 | |
| 376 | TRACE(shell,"(%p)->(submenu=0x%08x) stub\n",this,hSubMenu); |
| 377 | if(hSubMenu) |
| 378 | { ZeroMemory(&mii, sizeof(mii)); |
| 379 | |
| 380 | /* add a separator */ |
| 381 | mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; |
| 382 | mii.fType = MFT_SEPARATOR; |
| 383 | mii.fState = MFS_ENABLED; |
| 384 | |
| 385 | /*insert this item at the beginning of the menu */ |
| 386 | InsertMenuItem32A(hSubMenu, 0, TRUE, &mii); |
| 387 | |
| 388 | /*add the file menu items */ |
| 389 | strcpy(szText,"dummy 45"); |
| 390 | |
| 391 | mii.cbSize = sizeof(mii); |
| 392 | mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; |
| 393 | mii.fType = MFT_STRING; |
| 394 | mii.fState = MFS_ENABLED; |
| 395 | mii.dwTypeData = szText; |
| 396 | mii.wID = IDM_MYFILEITEM; |
| 397 | |
| 398 | /*insert this item at the beginning of the menu */ |
| 399 | InsertMenuItem32A(hSubMenu, 0, TRUE, &mii); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | /************************************************************************** |
| 404 | * ShellView_MergeViewMenu() |
| 405 | */ |
| 406 | void ShellView_MergeViewMenu(LPSHELLVIEW this, HMENU32 hSubMenu) |
| 407 | { MENUITEMINFO32A mii; |
| 408 | CHAR szText[MAX_PATH]; |
| 409 | |
| 410 | TRACE(shell,"(%p)->(submenu=0x%08x) stub\n",this,hSubMenu); |
| 411 | if(hSubMenu) |
| 412 | { ZeroMemory(&mii, sizeof(mii)); |
| 413 | |
| 414 | /*add a separator at the correct position in the menu*/ |
| 415 | mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; |
| 416 | mii.fType = MFT_SEPARATOR; |
| 417 | mii.fState = MFS_ENABLED; |
| 418 | InsertMenuItem32A(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); |
| 419 | |
| 420 | /*add the view menu items at the correct position in the menu*/ |
| 421 | strcpy(szText,"Dummy 46"); |
| 422 | |
| 423 | mii.cbSize = sizeof(mii); |
| 424 | mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; |
| 425 | mii.fType = MFT_STRING; |
| 426 | mii.fState = MFS_ENABLED; |
| 427 | mii.dwTypeData = szText; |
| 428 | mii.wID = IDM_VIEW_FILES; |
| 429 | InsertMenuItem32A(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); |
| 430 | } |
| 431 | } |
| 432 | /************************************************************************** |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 433 | * ShellView_UpdateMenu() |
| 434 | */ |
| 435 | LRESULT ShellView_UpdateMenu(LPSHELLVIEW this, HMENU32 hMenu) |
| 436 | { TRACE(shell,"(%p)->(menu=0x%08x\n",this,hMenu); |
| 437 | CheckMenuItem32(hMenu, IDM_VIEW_FILES, MF_BYCOMMAND | (g_bViewKeys ? MF_CHECKED: MF_UNCHECKED)); |
| 438 | |
| 439 | if(ShellView_CanDoIDockingWindow(this)) |
| 440 | { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_ENABLED); |
| 441 | CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | (g_bShowIDW ? MF_CHECKED: MF_UNCHECKED)); |
| 442 | } |
| 443 | else |
| 444 | { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| 445 | CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_UNCHECKED); |
| 446 | } |
| 447 | return 0; |
| 448 | } |
| 449 | |
| 450 | /************************************************************************** |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 451 | * ShellView_OnDeactivate() |
| 452 | * |
| 453 | * NOTES |
| 454 | * internal |
| 455 | */ |
| 456 | void ShellView_OnDeactivate(LPSHELLVIEW this) |
| 457 | { TRACE(shell,"%p\n",this); |
| 458 | if(this->uState != SVUIA_DEACTIVATE) |
| 459 | { if(this->hMenu) |
| 460 | { this->pShellBrowser->lpvtbl->fnSetMenuSB(this->pShellBrowser,0, 0, 0); |
| 461 | this->pShellBrowser->lpvtbl->fnRemoveMenusSB(this->pShellBrowser,this->hMenu); |
| 462 | DestroyMenu32(this->hMenu); |
| 463 | this->hMenu = 0; |
| 464 | } |
| 465 | |
| 466 | this->uState = SVUIA_DEACTIVATE; |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | /************************************************************************** |
| 471 | * CShellView_OnActivate() |
| 472 | */ |
| 473 | LRESULT ShellView_OnActivate(LPSHELLVIEW this, UINT32 uState) |
| 474 | { OLEMENUGROUPWIDTHS32 omw = { {0, 0, 0, 0, 0, 0} }; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 475 | MENUITEMINFO32A mii; |
| 476 | CHAR szText[MAX_PATH]; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 477 | |
| 478 | TRACE(shell,"%p uState=%x\n",this,uState); |
| 479 | |
| 480 | //don't do anything if the state isn't really changing |
| 481 | if(this->uState == uState) |
| 482 | { return S_OK; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 483 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 484 | |
| 485 | ShellView_OnDeactivate(this); |
| 486 | |
| 487 | //only do this if we are active |
| 488 | if(uState != SVUIA_DEACTIVATE) |
| 489 | { //merge the menus |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 490 | this->hMenu = CreateMenu32(); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 491 | |
| 492 | if(this->hMenu) |
| 493 | { this->pShellBrowser->lpvtbl->fnInsertMenusSB(this->pShellBrowser, this->hMenu, &omw); |
| 494 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 495 | /*build the top level menu get the menu item's text*/ |
| 496 | strcpy(szText,"dummy 31"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 497 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 498 | ZeroMemory(&mii, sizeof(mii)); |
| 499 | mii.cbSize = sizeof(mii); |
| 500 | mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE; |
| 501 | mii.fType = MFT_STRING; |
| 502 | mii.fState = MFS_ENABLED; |
| 503 | mii.dwTypeData = szText; |
| 504 | mii.hSubMenu = ShellView_BuildFileMenu(this); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 505 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 506 | /*insert our menu into the menu bar*/ |
| 507 | if(mii.hSubMenu) |
| 508 | { InsertMenuItem32A(this->hMenu, FCIDM_MENU_HELP, FALSE, &mii); |
| 509 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 510 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 511 | /*get the view menu so we can merge with it*/ |
| 512 | ZeroMemory(&mii, sizeof(mii)); |
| 513 | mii.cbSize = sizeof(mii); |
| 514 | mii.fMask = MIIM_SUBMENU; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 515 | |
| 516 | if(GetMenuItemInfo32A(this->hMenu, FCIDM_MENU_VIEW, FALSE, &mii)) |
| 517 | { ShellView_MergeViewMenu(this, mii.hSubMenu); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 518 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 519 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 520 | /*add the items that should only be added if we have the focus*/ |
| 521 | if(SVUIA_ACTIVATE_FOCUS == uState) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 522 | { //get the file menu so we can merge with it |
| 523 | ZeroMemory(&mii, sizeof(mii)); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 524 | mii.cbSize = sizeof(mii); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 525 | mii.fMask = MIIM_SUBMENU; |
| 526 | |
| 527 | if(GetMenuItemInfo32A(this->hMenu, FCIDM_MENU_FILE, FALSE, &mii)) |
| 528 | { ShellView_MergeFileMenu(this, mii.hSubMenu); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 529 | } |
| 530 | } |
| 531 | this->pShellBrowser->lpvtbl->fnSetMenuSB(this->pShellBrowser, this->hMenu, 0, this->hWnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 532 | } |
| 533 | } |
| 534 | this->uState = uState; |
| 535 | return 0; |
| 536 | } |
| 537 | |
| 538 | /************************************************************************** |
| 539 | * ShellView_OnSetFocus() |
| 540 | * |
| 541 | * NOTES |
| 542 | * internal |
| 543 | */ |
| 544 | LRESULT ShellView_OnSetFocus(LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 545 | { TRACE(shell,"%p\n",this); |
| 546 | /* Tell the browser one of our windows has received the focus. This should always |
| 547 | be done before merging menus (OnActivate merges the menus) if one of our |
| 548 | windows has the focus.*/ |
| 549 | this->pShellBrowser->lpvtbl->fnOnViewWindowActive(this->pShellBrowser,this); |
| 550 | ShellView_OnActivate(this, SVUIA_ACTIVATE_FOCUS); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 551 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 552 | return 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 553 | } |
| 554 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 555 | /************************************************************************** |
| 556 | * ShellView_OnKillFocus() |
| 557 | */ |
| 558 | LRESULT ShellView_OnKillFocus(LPSHELLVIEW this) |
| 559 | { TRACE(shell,"(%p) stub\n",this); |
| 560 | ShellView_OnActivate(this, SVUIA_ACTIVATE_NOFOCUS); |
| 561 | return 0; |
| 562 | } |
| 563 | |
| 564 | /************************************************************************** |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 565 | * ShellView_AddRemoveDockingWindow() |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 566 | */ |
| 567 | BOOL32 ShellView_AddRemoveDockingWindow(LPSHELLVIEW this, BOOL32 bAdd) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 568 | { BOOL32 bReturn = FALSE; |
| 569 | HRESULT hr; |
| 570 | LPSERVICEPROVIDER pSP; |
| 571 | LPDOCKINGWINDOWFRAME pFrame; |
| 572 | |
| 573 | FIXME(shell,"(%p)->(badd=0x%08x) stub\n",this,bAdd); |
| 574 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 575 | /* get the browser's IServiceProvider */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 576 | hr = this->pShellBrowser->lpvtbl->fnQueryInterface(this->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 577 | if(SUCCEEDED(hr)) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 578 | { /*get the IDockingWindowFrame pointer*/ |
| 579 | hr = pSP->lpvtbl->fnQueryService(pSP, &SID_SShellBrowser, &IID_IDockingWindowFrame, (LPVOID*)&pFrame); |
| 580 | if(SUCCEEDED(hr)) |
| 581 | { if(bAdd) |
| 582 | { hr = S_OK; |
| 583 | /*if(!this->pDockingWindow) |
| 584 | { //create the toolbar object |
| 585 | this->pDockingWindow = DockingWindow_Constructor(this, this->hWnd); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 586 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 587 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 588 | if(this->pDockingWindow) |
| 589 | { //add the toolbar object |
| 590 | hr = pFrame->lpvtbl->fnAddToolbar(pFrame, (IDockingWindow*)this->pDockingWindow, TOOLBAR_ID, 0); |
| 591 | |
| 592 | if(SUCCEEDED(hr)) |
| 593 | { bReturn = TRUE; |
| 594 | } |
| 595 | }*/ |
| 596 | } |
| 597 | else |
| 598 | { /*if(this->pDockingWindow) |
| 599 | { hr = pFrame->->lpvtbl->fnRemoveToolbar(pFrame, (IDockingWindow*)this->pDockingWindow, DWFRF_NORMAL); |
| 600 | |
| 601 | if(SUCCEEDED(hr)) |
| 602 | { // RemoveToolbar should release the toolbar object which will cause |
| 603 | //it to destroy itself. Our toolbar object is no longer valid at |
| 604 | //this point. |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 605 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 606 | this->pDockingWindow = NULL; |
| 607 | bReturn = TRUE; |
| 608 | } |
| 609 | }*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 610 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 611 | pFrame->lpvtbl->fnRelease(pFrame); |
| 612 | } |
| 613 | pSP->lpvtbl->fnRelease(pSP); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 614 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 615 | return bReturn; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 616 | } |
| 617 | |
| 618 | /************************************************************************** |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 619 | * ShellView_CanDoIDockingWindow() |
| 620 | */ |
| 621 | BOOL32 ShellView_CanDoIDockingWindow(LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 622 | { BOOL32 bReturn = FALSE; |
| 623 | HRESULT hr; |
| 624 | LPSERVICEPROVIDER pSP; |
| 625 | LPDOCKINGWINDOWFRAME pFrame; |
| 626 | |
| 627 | FIXME(shell,"(%p) stub\n",this); |
| 628 | |
| 629 | /*get the browser's IServiceProvider*/ |
| 630 | hr = this->pShellBrowser->lpvtbl->fnQueryInterface(this->pShellBrowser, (REFIID)&IID_IServiceProvider, (LPVOID*)&pSP); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 631 | if(hr==S_OK) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 632 | { hr = pSP->lpvtbl->fnQueryService(pSP, &SID_SShellBrowser, &IID_IDockingWindowFrame, (LPVOID*)&pFrame); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 633 | if(SUCCEEDED(hr)) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 634 | { bReturn = TRUE; |
| 635 | pFrame->lpvtbl->fnRelease(pFrame); |
| 636 | } |
| 637 | pSP->lpvtbl->fnRelease(pSP); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 638 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 639 | return bReturn; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 640 | } |
| 641 | |
| 642 | /************************************************************************** |
| 643 | * ShellView_UpdateShellSettings() |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 644 | */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 645 | void ShellView_UpdateShellSettings(LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 646 | { FIXME(shell,"(%p) stub\n",this); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 647 | return ; |
| 648 | /* |
| 649 | SHELLFLAGSTATE sfs; |
| 650 | HINSTANCE hinstShell32; |
| 651 | */ |
| 652 | /* Since SHGetSettings is not implemented in all versions of the shell, get the |
| 653 | function address manually at run time. This allows the code to run on all |
| 654 | platforms.*/ |
| 655 | /* |
| 656 | ZeroMemory(&sfs, sizeof(sfs)); |
| 657 | */ |
| 658 | /* The default, in case any of the following steps fails, is classic Windows 95 |
| 659 | style.*/ |
| 660 | /* |
| 661 | sfs.fWin95Classic = TRUE; |
| 662 | |
| 663 | hinstShell32 = LoadLibrary(TEXT("shell32.dll")); |
| 664 | if(hinstShell32) |
| 665 | { PFNSHGETSETTINGSPROC pfnSHGetSettings; |
| 666 | |
| 667 | pfnSHGetSettings = (PFNSHGETSETTINGSPROC)GetProcAddress(hinstShell32, "SHGetSettings"); |
| 668 | if(pfnSHGetSettings) |
| 669 | { (*pfnSHGetSettings)(&sfs, SSF_DOUBLECLICKINWEBVIEW | SSF_WIN95CLASSIC); |
| 670 | } |
| 671 | FreeLibrary(hinstShell32); |
| 672 | } |
| 673 | |
| 674 | DWORD dwExStyles = 0; |
| 675 | |
| 676 | if(!sfs.fWin95Classic && !sfs.fDoubleClickInWebView) |
| 677 | dwExStyles |= LVS_EX_ONECLICKACTIVATE | LVS_EX_TRACKSELECT | LVS_EX_UNDERLINEHOT; |
| 678 | |
| 679 | ListView_SetExtendedListViewStyle(this->hWndList, dwExStyles); |
| 680 | */ |
| 681 | } |
| 682 | |
| 683 | /************************************************************************** |
| 684 | * ShellView_OnSettingChange() |
| 685 | */ |
| 686 | LRESULT ShellView_OnSettingChange(LPSHELLVIEW this, LPCSTR lpszSection) |
| 687 | { TRACE(shell,"(%p) stub\n",this); |
| 688 | //if(0 == lstrcmpi(lpszSection, TEXT("ShellState"))) |
| 689 | { ShellView_UpdateShellSettings(this); |
| 690 | return 0; |
| 691 | } |
| 692 | return 0; |
| 693 | } |
| 694 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 695 | /************************************************************************** |
| 696 | * ShellView_DoContextMenu() |
| 697 | */ |
| 698 | void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 699 | { UINT32 uCommand, i, uSelected = ListView_GetSelectedCount(this->hWndList); |
| 700 | DWORD wFlags; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 701 | HMENU32 hMenu; |
| 702 | BOOL32 fExplore = FALSE; |
| 703 | HWND32 hwndTree = 0; |
| 704 | INT32 nMenuIndex; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 705 | LPITEMIDLIST *aSelectedItems; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 706 | LVITEM32A lvItem; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 707 | MENUITEMINFO32A mii; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 708 | LPCONTEXTMENU pContextMenu = NULL; |
| 709 | CMINVOKECOMMANDINFO32 cmi; |
| 710 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 711 | TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",this, x, y, fDefault); |
| 712 | aSelectedItems = (LPITEMIDLIST*)SHAlloc(uSelected * sizeof(LPITEMIDLIST)); |
| 713 | |
| 714 | if(aSelectedItems) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 715 | { TRACE(shell,"-- Items selected =%u\n", uSelected); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 716 | ZeroMemory(&lvItem, sizeof(lvItem)); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 717 | lvItem.mask = LVIF_STATE | LVIF_PARAM; |
| 718 | lvItem.stateMask = LVIS_SELECTED; |
| 719 | lvItem.iItem = 0; |
| 720 | |
| 721 | i = 0; |
| 722 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 723 | while(ListView_GetItem32A(this->hWndList, &lvItem) && (i < uSelected)) |
| 724 | { if(lvItem.state & LVIS_SELECTED) |
| 725 | { aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam; |
| 726 | i++; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 727 | TRACE(shell,"-- selected Item found\n"); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 728 | } |
| 729 | lvItem.iItem++; |
| 730 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 731 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 732 | this->pSFParent->lpvtbl->fnGetUIObjectOf( this->pSFParent, |
| 733 | this->hWndParent, |
| 734 | uSelected, |
| 735 | (LPCITEMIDLIST*)aSelectedItems, |
| 736 | &IID_IContextMenu, |
| 737 | NULL, |
| 738 | (LPVOID*)&pContextMenu); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 739 | |
| 740 | if(pContextMenu) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 741 | { TRACE(shell,"-- pContextMenu\n"); |
| 742 | hMenu = CreatePopupMenu32(); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 743 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 744 | /* See if we are in Explore or Open mode. If the browser's tree is present, |
| 745 | then we are in Explore mode.*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 746 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 747 | fExplore = FALSE; |
| 748 | hwndTree = 0; |
| 749 | if(SUCCEEDED(this->pShellBrowser->lpvtbl->fnGetControlWindow(this->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree) |
| 750 | { TRACE(shell,"-- fExplore\n"); |
| 751 | fExplore = TRUE; |
| 752 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 753 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 754 | if(hMenu && SUCCEEDED(pContextMenu->lpvtbl->fnQueryContextMenu( pContextMenu, |
| 755 | hMenu, |
| 756 | 0, |
| 757 | MENU_OFFSET, |
| 758 | MENU_MAX, |
| 759 | CMF_NORMAL | (uSelected != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0)))) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 760 | { if(fDefault) |
| 761 | { TRACE(shell,"-- fDefault\n"); |
| 762 | uCommand = 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 763 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 764 | ZeroMemory(&mii, sizeof(mii)); |
| 765 | mii.cbSize = sizeof(mii); |
| 766 | mii.fMask = MIIM_STATE | MIIM_ID; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 767 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 768 | nMenuIndex = 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 769 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 770 | /*find the default item in the menu*/ |
| 771 | while(GetMenuItemInfo32A(hMenu, nMenuIndex, TRUE, &mii)) |
| 772 | { if(mii.fState & MFS_DEFAULT) |
| 773 | { uCommand = mii.wID; |
| 774 | break; |
| 775 | } |
| 776 | nMenuIndex++; |
| 777 | } |
| 778 | } |
| 779 | else |
| 780 | { TRACE(shell,"-- ! fDefault\n"); |
| 781 | uCommand = TrackPopupMenu32( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,this->hWnd,NULL); |
| 782 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 783 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 784 | if(uCommand > 0) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 785 | { TRACE(shell,"-- uCommand=%u\n", uCommand); |
| 786 | if (((uCommand-MENU_OFFSET) == IDM_EXPLORE) || ((uCommand-MENU_OFFSET) == IDM_OPEN)) |
| 787 | { if (IsInCommDlg(this)) /* are we part of a commctrl? */ |
| 788 | { TRACE(shell,"-- fnOnDefaultCommand\n"); |
| 789 | OnDefaultCommand(this); |
| 790 | } |
| 791 | else /* we are acting with a full featured IShellBrowser */ |
| 792 | { TRACE(shell,"-- fnBrowseObject pidl =%p\n", aSelectedItems[0]); |
| 793 | wFlags = SBSP_DEFBROWSER | SBSP_DEFMODE | SBSP_RELATIVE; |
| 794 | this->pShellBrowser->lpvtbl->fnBrowseObject( this->pShellBrowser, |
| 795 | aSelectedItems[0], |
| 796 | wFlags); |
| 797 | } |
| 798 | } |
| 799 | else |
| 800 | { ZeroMemory(&cmi, sizeof(cmi)); |
| 801 | cmi.cbSize = sizeof(cmi); |
| 802 | cmi.hwnd = this->hWndParent; |
| 803 | cmi.lpVerb = (LPCSTR)MAKEINTRESOURCE32A(uCommand - MENU_OFFSET); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 804 | pContextMenu->lpvtbl->fnInvokeCommand(pContextMenu, &cmi); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 805 | } |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 806 | } |
| 807 | DestroyMenu32(hMenu); |
| 808 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 809 | pContextMenu->lpvtbl->fnRelease(pContextMenu); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 810 | } |
| 811 | SHFree(aSelectedItems); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 812 | } |
| 813 | } |
| 814 | |
| 815 | /************************************************************************** |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 816 | * ShellView_OnCommand() |
| 817 | */ |
| 818 | LRESULT ShellView_OnCommand(LPSHELLVIEW this,DWORD dwCmdID, DWORD dwCmd, HWND32 hwndCmd) |
| 819 | { TRACE(shell,"(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",this, dwCmdID, dwCmd, hwndCmd); |
| 820 | switch(dwCmdID) |
| 821 | { case IDM_VIEW_FILES: |
| 822 | g_bViewKeys = ! g_bViewKeys; |
| 823 | IShellView_Refresh(this); |
| 824 | break; |
| 825 | |
| 826 | case IDM_VIEW_IDW: |
| 827 | g_bShowIDW = ! g_bShowIDW; |
| 828 | ShellView_AddRemoveDockingWindow(this, g_bShowIDW); |
| 829 | break; |
| 830 | |
| 831 | case IDM_MYFILEITEM: |
| 832 | MessageBeep32(MB_OK); |
| 833 | break; |
| 834 | |
| 835 | default: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 836 | FIXME(shell,"-- COMMAND unhandled\n"); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 837 | } |
| 838 | return 0; |
| 839 | } |
| 840 | |
| 841 | /************************************************************************** |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 842 | * ShellView_OnNotify() |
| 843 | */ |
| 844 | |
| 845 | LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 846 | { NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh; |
| 847 | NMLVDISPINFO32A *lpdi = (NMLVDISPINFO32A *)lpnmh; |
| 848 | LPITEMIDLIST pidl; |
| 849 | DWORD dwCursor; |
| 850 | STRRET str; |
| 851 | UINT32 uFlags; |
| 852 | IExtractIcon *pei; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 853 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 854 | TRACE(shell,"%p CtlID=%u lpnmh->code=%x\n",this,CtlID,lpnmh->code); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 855 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 856 | switch(lpnmh->code) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 857 | { case NM_SETFOCUS: |
| 858 | TRACE(shell,"-- NM_SETFOCUS %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 859 | ShellView_OnSetFocus(this); |
| 860 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 861 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 862 | case NM_KILLFOCUS: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 863 | TRACE(shell,"-- NM_KILLFOCUS %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 864 | ShellView_OnDeactivate(this); |
| 865 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 866 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 867 | case HDN_ENDTRACK32A: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 868 | TRACE(shell,"-- HDN_ENDTRACK32A %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 869 | /*nColumn1 = ListView_GetColumnWidth(this->hWndList, 0); |
| 870 | nColumn2 = ListView_GetColumnWidth(this->hWndList, 1);*/ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 871 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 872 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 873 | case LVN_DELETEITEM: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 874 | TRACE(shell,"-- LVN_DELETEITEM %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 875 | SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ |
| 876 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 877 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 878 | case NM_DBLCLK: |
| 879 | case NM_RETURN: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 880 | TRACE(shell,"-- NM_RETURN|NM_DBLCLK ignored, waiting for LVN_ITEMACTIVATE\n"); |
| 881 | break; |
| 882 | |
| 883 | case LVN_ITEMACTIVATE: |
| 884 | TRACE(shell,"-- LVN_ITEMACTIVATE %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 885 | ShellView_DoContextMenu(this, 0, 0, TRUE); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 886 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 887 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 888 | case NM_RCLICK: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 889 | TRACE(shell,"-- NM_RCLICK %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 890 | dwCursor = GetMessagePos(); |
| 891 | ShellView_DoContextMenu(this, LOWORD(dwCursor), HIWORD(dwCursor), FALSE); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 892 | break; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 893 | |
| 894 | case LVN_GETDISPINFO32A: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 895 | TRACE(shell,"-- LVN_GETDISPINFO32A %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 896 | pidl = (LPITEMIDLIST)lpdi->item.lParam; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 897 | |
| 898 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 899 | if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ |
| 900 | { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ |
| 901 | { if(_ILIsValue(pidl)) /*is this a value or a folder?*/ |
| 902 | { _ILGetDataText(this->mpidl, pidl, lpdi->item.pszText, lpdi->item.cchTextMax); |
| 903 | if(!*lpdi->item.pszText) |
| 904 | sprintf(lpdi->item.pszText, "file attrib %u", lpdi->item.iSubItem ); |
| 905 | } |
| 906 | else /*its a folder*/ |
| 907 | { sprintf(lpdi->item.pszText, "folder attrib %u", lpdi->item.iSubItem ); |
| 908 | } |
| 909 | } |
| 910 | } |
| 911 | else /*the item text is being requested*/ |
| 912 | { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ |
| 913 | { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetDisplayNameOf(this->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str))) |
| 914 | { if(STRRET_WSTR == str.uType) |
| 915 | { WideCharToLocal32(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax); |
| 916 | SHFree(str.u.pOleStr); |
| 917 | } |
| 918 | if(STRRET_CSTR == str.uType) |
| 919 | { strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax); |
| 920 | } |
| 921 | } |
| 922 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 923 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 924 | if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/ |
| 925 | { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetUIObjectOf(this->pSFParent,this->hWnd,1, |
| 926 | (LPCITEMIDLIST*)&pidl, (REFIID)&IID_IExtractIcon, NULL, (LPVOID*)&pei))) |
| 927 | { //GetIconLoaction will give us the index into our image list |
| 928 | pei->lpvtbl->fnGetIconLocation(pei, GIL_FORSHELL, NULL, 0, &lpdi->item.iImage, &uFlags); |
| 929 | pei->lpvtbl->fnRelease(pei); |
| 930 | } |
| 931 | } |
| 932 | } |
| 933 | TRACE(shell,"-- text=%s image=%x\n",lpdi->item.pszText, lpdi->item.iImage); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 934 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 935 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 936 | case NM_CLICK: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 937 | WARN(shell,"-- NM_CLICK %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 938 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 939 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 940 | case LVN_ITEMCHANGING: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 941 | WARN(shell,"-- LVN_ITEMCHANGING %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 942 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 943 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 944 | case LVN_ITEMCHANGED: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 945 | WARN(shell,"-- LVN_ITEMCHANGED %p\n",this); |
| 946 | OnStateChange(this, CDBOSC_SELCHANGE); |
| 947 | break; |
| 948 | |
| 949 | case LVN_DELETEALLITEMS: |
| 950 | WARN(shell,"-- LVN_DELETEALLITEMS %p\n",this); |
| 951 | break; |
| 952 | |
| 953 | case LVN_INSERTITEM: |
| 954 | WARN(shell,"-- LVN_INSERTITEM %p\n",this); |
| 955 | break; |
| 956 | |
| 957 | case LVN_BEGINDRAG: |
| 958 | WARN(shell,"-- LVN_BEGINDRAG %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 959 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 960 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 961 | case NM_CUSTOMDRAW: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 962 | WARN(shell,"NM_CUSTOMDRAW %p\n",this); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 963 | break; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 964 | |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 965 | default: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 966 | FIXME (shell,"-- WM_NOTIFY unhandled\n"); |
| 967 | break;; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 968 | } |
| 969 | return 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 970 | } |
| 971 | |
| 972 | /************************************************************************** |
| 973 | * ShellView_WndProc |
| 974 | */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 975 | |
| 976 | LRESULT CALLBACK ShellView_WndProc(HWND32 hWnd, UINT32 uMessage, WPARAM32 wParam, LPARAM lParam) |
| 977 | { LPSHELLVIEW pThis = (LPSHELLVIEW)GetWindowLong32A(hWnd, GWL_USERDATA); |
| 978 | LPCREATESTRUCT32A lpcs; |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 979 | DWORD dwCursor; |
| 980 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 981 | TRACE(shell,"(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 982 | |
| 983 | switch (uMessage) |
| 984 | { case WM_NCCREATE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 985 | { TRACE(shell,"-- WM_NCCREATE\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 986 | lpcs = (LPCREATESTRUCT32A)lParam; |
| 987 | pThis = (LPSHELLVIEW)(lpcs->lpCreateParams); |
| 988 | SetWindowLong32A(hWnd, GWL_USERDATA, (LONG)pThis); |
| 989 | pThis->hWnd = hWnd; /*set the window handle*/ |
| 990 | } |
| 991 | break; |
| 992 | |
| 993 | case WM_SIZE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 994 | TRACE(shell,"-- WM_SIZE\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 995 | return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam)); |
| 996 | |
| 997 | case WM_SETFOCUS: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 998 | TRACE(shell,"-- WM_SETFOCUS\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 999 | return ShellView_OnSetFocus(pThis); |
| 1000 | |
| 1001 | case WM_KILLFOCUS: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1002 | TRACE(shell,"-- WM_KILLFOCUS\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1003 | return ShellView_OnKillFocus(pThis); |
| 1004 | |
| 1005 | case WM_CREATE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1006 | TRACE(shell,"-- WM_CREATE\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1007 | return ShellView_OnCreate(pThis); |
| 1008 | |
| 1009 | case WM_SHOWWINDOW: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1010 | TRACE(shell,"-- WM_SHOWWINDOW\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1011 | UpdateWindow32(pThis->hWndList); |
| 1012 | break; |
| 1013 | |
| 1014 | case WM_ACTIVATE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1015 | TRACE(shell,"-- WM_ACTIVATE\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1016 | return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS); |
| 1017 | |
| 1018 | case WM_COMMAND: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1019 | TRACE(shell,"-- WM_COMMAND\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1020 | return ShellView_OnCommand(pThis, GET_WM_COMMAND_ID(wParam, lParam), |
| 1021 | GET_WM_COMMAND_CMD(wParam, lParam), |
| 1022 | GET_WM_COMMAND_HWND(wParam, lParam)); |
| 1023 | |
| 1024 | case WM_INITMENUPOPUP: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1025 | TRACE(shell,"-- WM_INITMENUPOPUP\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1026 | return ShellView_UpdateMenu(pThis, (HMENU32)wParam); |
| 1027 | |
| 1028 | case WM_NOTIFY: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1029 | TRACE(shell,"-- WM_NOTIFY\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1030 | return ShellView_OnNotify(pThis,(UINT32)wParam, (LPNMHDR)lParam); |
| 1031 | |
| 1032 | case WM_SETTINGCHANGE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1033 | TRACE(shell,"-- WM_SETTINGCHANGE\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1034 | return ShellView_OnSettingChange(pThis,(LPCSTR)lParam); |
| 1035 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1036 | case WM_PARENTNOTIFY: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1037 | TRACE(shell,"-- WM_PARENTNOTIFY\n"); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1038 | if ( LOWORD(wParam) == WM_RBUTTONDOWN ) /* fixme: should not be handled here*/ |
| 1039 | { dwCursor = GetMessagePos(); |
| 1040 | ShellView_DoContextMenu(pThis, LOWORD(dwCursor), HIWORD(dwCursor), FALSE); |
| 1041 | return TRUE; |
| 1042 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1043 | break; |
| 1044 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1045 | /* -------------*/ |
| 1046 | case WM_MOVE: |
| 1047 | WARN(shell,"-- WM_MOVE\n"); |
| 1048 | break; |
| 1049 | |
| 1050 | case WM_ACTIVATEAPP: |
| 1051 | WARN(shell,"-- WM_ACTIVATEAPP\n"); |
| 1052 | break; |
| 1053 | |
| 1054 | case WM_NOTIFYFORMAT: |
| 1055 | WARN(shell,"-- WM_NOTIFYFORMAT\n"); |
| 1056 | break; |
| 1057 | |
| 1058 | case WM_NCPAINT: |
| 1059 | WARN(shell,"-- WM_NCPAINT\n"); |
| 1060 | break; |
| 1061 | |
| 1062 | case WM_ERASEBKGND: |
| 1063 | WARN(shell,"-- WM_ERASEBKGND\n"); |
| 1064 | break; |
| 1065 | |
| 1066 | case WM_PAINT: |
| 1067 | WARN(shell,"-- WM_PAINT\n"); |
| 1068 | break; |
| 1069 | |
| 1070 | case WM_NCCALCSIZE: |
| 1071 | WARN(shell,"-- WM_NCCALCSIZE\n"); |
| 1072 | break; |
| 1073 | |
| 1074 | case WM_WINDOWPOSCHANGING: |
| 1075 | WARN(shell,"-- WM_WINDOWPOSCHANGING\n"); |
| 1076 | break; |
| 1077 | |
| 1078 | case WM_WINDOWPOSCHANGED: |
| 1079 | WARN(shell,"-- WM_WINDOWPOSCHANGED\n"); |
| 1080 | break; |
| 1081 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1082 | case WM_MOUSEACTIVATE: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1083 | WARN(shell,"-- WM_MOUSEACTIVATE\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1084 | break; |
| 1085 | |
| 1086 | case WM_SETCURSOR: |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1087 | WARN(shell,"-- WM_SETCURSOR\n"); |
| 1088 | break; |
| 1089 | |
| 1090 | case WM_DESTROY: |
| 1091 | WARN(shell,"-- WM_DESTROY\n"); |
| 1092 | break; |
| 1093 | |
| 1094 | case WM_NCDESTROY: |
| 1095 | WARN(shell,"-- WM_NCDESTROY\n"); |
| 1096 | break; |
| 1097 | |
| 1098 | case WM_CONTEXTMENU: |
| 1099 | WARN(shell,"-- WM_CONTEXTMENU\n"); |
| 1100 | break; |
| 1101 | |
| 1102 | case WM_MENUSELECT: |
| 1103 | WARN(shell,"-- WM_MENUSELECT\n"); |
| 1104 | break; |
| 1105 | |
| 1106 | case WM_CAPTURECHANGED: |
| 1107 | WARN(shell,"-- WM_CAPTURECHANGED\n"); |
| 1108 | break; |
| 1109 | |
| 1110 | case WM_CHILDACTIVATE: |
| 1111 | WARN(shell,"-- WM_CHILDACTIVATE\n"); |
| 1112 | break; |
| 1113 | |
| 1114 | case WM_ENTERIDLE: |
| 1115 | WARN(shell,"-- WM_ENTERIDLE\n"); |
| 1116 | break; |
| 1117 | |
| 1118 | default: |
| 1119 | FIXME(shell,"-- MESSAGE unhandled\n"); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1120 | break; |
| 1121 | } |
| 1122 | return DefWindowProc32A (hWnd, uMessage, wParam, lParam); |
| 1123 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1124 | /************************************************************************** |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1125 | * |
| 1126 | * |
| 1127 | * The INTERFACE of the IShellView object |
| 1128 | * |
| 1129 | * |
| 1130 | *************************************************************************** |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1131 | * IShellView::QueryInterface |
| 1132 | */ |
| 1133 | static HRESULT WINAPI IShellView_QueryInterface(LPSHELLVIEW this,REFIID riid, LPVOID *ppvObj) |
| 1134 | { char xriid[50]; |
| 1135 | WINE_StringFromCLSID((LPCLSID)riid,xriid); |
| 1136 | TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj); |
| 1137 | |
| 1138 | *ppvObj = NULL; |
| 1139 | |
| 1140 | if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ |
| 1141 | { *ppvObj = this; |
| 1142 | } |
| 1143 | else if(IsEqualIID(riid, &IID_IShellView)) /*IShellView*/ |
| 1144 | { *ppvObj = (IShellView*)this; |
| 1145 | } |
| 1146 | |
| 1147 | if(*ppvObj) |
| 1148 | { (*(LPSHELLVIEW*)ppvObj)->lpvtbl->fnAddRef(this); |
| 1149 | TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); |
| 1150 | return S_OK; |
| 1151 | } |
| 1152 | TRACE(shell,"-- Interface: E_NOINTERFACE\n"); |
| 1153 | return E_NOINTERFACE; |
| 1154 | } |
| 1155 | /************************************************************************** |
| 1156 | * IShellView::AddRef |
| 1157 | */ |
| 1158 | static ULONG WINAPI IShellView_AddRef(LPSHELLVIEW this) |
| 1159 | { TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1); |
| 1160 | return ++(this->ref); |
| 1161 | } |
| 1162 | /************************************************************************** |
| 1163 | * IShellView::Release |
| 1164 | */ |
| 1165 | static ULONG WINAPI IShellView_Release(LPSHELLVIEW this) |
| 1166 | { TRACE(shell,"(%p)->()\n",this); |
| 1167 | if (!--(this->ref)) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1168 | { TRACE(shell," destroying IShellView(%p)\n",this); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1169 | |
| 1170 | if(this->pSFParent) |
| 1171 | this->pSFParent->lpvtbl->fnRelease(this->pSFParent); |
| 1172 | |
| 1173 | HeapFree(GetProcessHeap(),0,this); |
| 1174 | return 0; |
| 1175 | } |
| 1176 | return this->ref; |
| 1177 | } |
| 1178 | /************************************************************************** |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1179 | * ShellView_GetWindow |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1180 | */ |
| 1181 | static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW this,HWND32 * phWnd) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1182 | { TRACE(shell,"(%p) stub\n",this); |
| 1183 | *phWnd = this->hWnd; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1184 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1185 | return S_OK; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1186 | } |
| 1187 | static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW this,BOOL32 fEnterMode) |
| 1188 | { FIXME(shell,"(%p) stub\n",this); |
| 1189 | return E_NOTIMPL; |
| 1190 | } |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1191 | /************************************************************************** |
| 1192 | * IShellView_TranslateAccelerator |
| 1193 | * |
| 1194 | * FIXME: |
| 1195 | * use the accel functions |
| 1196 | */ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1197 | static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW this,LPMSG32 lpmsg) |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1198 | { FIXME(shell,"(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",this,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam); |
| 1199 | /* switch (lpmsg->message) |
| 1200 | { case WM_RBUTTONDOWN: |
| 1201 | return SendMessage32A ( lpmsg->hwnd, WM_NOTIFY, ); |
| 1202 | }*/ |
| 1203 | return S_FALSE; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1204 | } |
| 1205 | static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW this,BOOL32 fEnable) |
| 1206 | { FIXME(shell,"(%p) stub\n",this); |
| 1207 | return E_NOTIMPL; |
| 1208 | } |
| 1209 | static HRESULT WINAPI IShellView_UIActivate(LPSHELLVIEW this,UINT32 uState) |
| 1210 | { CHAR szName[MAX_PATH]; |
| 1211 | LRESULT lResult; |
| 1212 | int nPartArray[1] = {-1}; |
| 1213 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1214 | FIXME(shell,"(%p)->(state=%x) stub\n",this, uState); |
| 1215 | /*don't do anything if the state isn't really changing*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1216 | if(this->uState == uState) |
| 1217 | { return S_OK; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1218 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1219 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1220 | /*OnActivate handles the menu merging and internal state*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1221 | ShellView_OnActivate(this, uState); |
| 1222 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1223 | /*remove the docking window*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1224 | if(g_bShowIDW) |
| 1225 | { ShellView_AddRemoveDockingWindow(this, FALSE); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1226 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1227 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1228 | /*only do this if we are active*/ |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1229 | if(uState != SVUIA_DEACTIVATE) |
| 1230 | { //update the status bar |
| 1231 | strcpy(szName, "dummy32"); |
| 1232 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1233 | this->pSFParent->lpvtbl->fnGetFolderPath( this->pSFParent, |
| 1234 | szName + strlen(szName), |
| 1235 | sizeof(szName) - strlen(szName)); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1236 | |
| 1237 | /* set the number of parts */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1238 | this->pShellBrowser->lpvtbl->fnSendControlMsg(this->pShellBrowser, |
| 1239 | FCW_STATUS, |
| 1240 | SB_SETPARTS, |
| 1241 | 1, |
| 1242 | (LPARAM)nPartArray, |
| 1243 | &lResult); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1244 | |
| 1245 | /* set the text for the parts */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1246 | this->pShellBrowser->lpvtbl->fnSendControlMsg(this->pShellBrowser, |
| 1247 | FCW_STATUS, |
| 1248 | SB_SETTEXT32A, |
| 1249 | 0, |
| 1250 | (LPARAM)szName, |
| 1251 | &lResult); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1252 | |
| 1253 | //add the docking window if necessary |
| 1254 | if(g_bShowIDW) |
| 1255 | { ShellView_AddRemoveDockingWindow(this, TRUE); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1256 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1257 | } |
| 1258 | return S_OK; |
| 1259 | } |
| 1260 | static HRESULT WINAPI IShellView_Refresh(LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1261 | { TRACE(shell,"(%p)\n",this); |
| 1262 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1263 | ListView_DeleteAllItems(this->hWndList); |
| 1264 | ShellView_FillList(this); |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1265 | |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1266 | return S_OK; |
| 1267 | } |
| 1268 | static HRESULT WINAPI IShellView_CreateViewWindow(LPSHELLVIEW this, IShellView *lpPrevView, |
| 1269 | LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,RECT32 * prcView, HWND32 *phWnd) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1270 | { WNDCLASS32A wc; |
| 1271 | *phWnd = 0; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1272 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1273 | TRACE(shell,"(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",this, lpPrevView,lpfs, psb, prcView, phWnd); |
| 1274 | TRACE(shell,"-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom); |
| 1275 | |
| 1276 | /*set up the member variables*/ |
| 1277 | this->pShellBrowser = psb; |
| 1278 | this->FolderSettings = *lpfs; |
| 1279 | |
| 1280 | /*get our parent window*/ |
| 1281 | this->pShellBrowser->lpvtbl->fnAddRef(this->pShellBrowser); |
| 1282 | this->pShellBrowser->lpvtbl->fnGetWindow(this->pShellBrowser, &(this->hWndParent)); |
| 1283 | |
| 1284 | /* try to get the ICommDlgBrowserInterface */ |
| 1285 | this->pCommDlgBrowser=NULL; |
| 1286 | if ( SUCCEEDED (this->pShellBrowser->lpvtbl->fnQueryInterface( this->pShellBrowser, |
| 1287 | &IID_ICommDlgBrowser, |
| 1288 | (LPVOID*) &this->pCommDlgBrowser))) |
| 1289 | { TRACE(shell,"-- CommDlgBrowser\n"); |
| 1290 | } |
| 1291 | |
| 1292 | /*if our window class has not been registered, then do so*/ |
| 1293 | if(!GetClassInfo32A(shell32_hInstance, SV_CLASS_NAME, &wc)) |
| 1294 | { ZeroMemory(&wc, sizeof(wc)); |
| 1295 | wc.style = CS_HREDRAW | CS_VREDRAW; |
| 1296 | wc.lpfnWndProc = (WNDPROC32) ShellView_WndProc; |
| 1297 | wc.cbClsExtra = 0; |
| 1298 | wc.cbWndExtra = 0; |
| 1299 | wc.hInstance = shell32_hInstance; |
| 1300 | wc.hIcon = 0; |
| 1301 | wc.hCursor = LoadCursor32A (0, IDC_ARROW32A); |
| 1302 | wc.hbrBackground = (HBRUSH32) (COLOR_WINDOW + 1); |
| 1303 | wc.lpszMenuName = NULL; |
| 1304 | wc.lpszClassName = SV_CLASS_NAME; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1305 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1306 | if(!RegisterClass32A(&wc)) |
| 1307 | return E_FAIL; |
| 1308 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1309 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1310 | *phWnd = CreateWindowEx32A(0, SV_CLASS_NAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1311 | prcView->left, prcView->top, prcView->right - prcView->left, prcView->bottom - prcView->top, |
| 1312 | this->hWndParent, 0, shell32_hInstance, (LPVOID)this); |
| 1313 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1314 | if(!*phWnd) |
| 1315 | return E_FAIL; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1316 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1317 | return S_OK; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1318 | } |
| 1319 | |
| 1320 | static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW this) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1321 | { TRACE(shell,"(%p)\n",this); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1322 | |
| 1323 | /*Make absolutely sure all our UI is cleaned up.*/ |
| 1324 | IShellView_UIActivate(this, SVUIA_DEACTIVATE); |
| 1325 | if(this->hMenu) |
| 1326 | { DestroyMenu32(this->hMenu); |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1327 | } |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1328 | DestroyWindow32(this->hWnd); |
| 1329 | this->pShellBrowser->lpvtbl->fnRelease(this->pShellBrowser); |
| 1330 | return S_OK; |
| 1331 | } |
| 1332 | static HRESULT WINAPI IShellView_GetCurrentInfo(LPSHELLVIEW this, LPFOLDERSETTINGS lpfs) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1333 | { TRACE(shell,"(%p)->(%p) vmode=%x flags=%x\n",this, lpfs, |
| 1334 | this->FolderSettings.ViewMode, this->FolderSettings.fFlags); |
| 1335 | |
| 1336 | if (lpfs) |
| 1337 | { *lpfs = this->FolderSettings; |
| 1338 | return NOERROR; |
| 1339 | } |
| 1340 | else |
| 1341 | return E_INVALIDARG; |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1342 | } |
| 1343 | static HRESULT WINAPI IShellView_AddPropertySheetPages(LPSHELLVIEW this, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) |
| 1344 | { FIXME(shell,"(%p) stub\n",this); |
| 1345 | return E_NOTIMPL; |
| 1346 | } |
| 1347 | static HRESULT WINAPI IShellView_SaveViewState(LPSHELLVIEW this) |
| 1348 | { FIXME(shell,"(%p) stub\n",this); |
| 1349 | return S_OK; |
| 1350 | } |
| 1351 | static HRESULT WINAPI IShellView_SelectItem(LPSHELLVIEW this, LPCITEMIDLIST pidlItem, UINT32 uFlags) |
| 1352 | { FIXME(shell,"(%p)->(pidl=%p, 0x%08x) stub\n",this, pidlItem, uFlags); |
| 1353 | return E_NOTIMPL; |
| 1354 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1355 | static HRESULT WINAPI IShellView_GetItemObject(LPSHELLVIEW this, UINT32 uItem, REFIID riid, LPVOID *ppvOut) |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1356 | { char xriid[50]; |
| 1357 | WINE_StringFromCLSID((LPCLSID)riid,xriid); |
| 1358 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame^] | 1359 | FIXME(shell,"(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)stub\n",this, uItem, xriid, ppvOut); |
Alexandre Julliard | 85ed45e | 1998-08-22 19:03:56 +0000 | [diff] [blame] | 1360 | |
| 1361 | *ppvOut = NULL; |
| 1362 | return E_NOTIMPL; |
| 1363 | } |